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
97,780
The timing is random and varies from 10 minutes to 2 hours between "phantom touches" on the touch buttons on refrigerator panel. The touches activate the functions, like turning on the dispenser light or trying to set an alarm. We had a similar thing happen previously with an electric cooker with a touch panel - but it...
2016/08/20
[ "https://diy.stackexchange.com/questions/97780", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/6321/" ]
You live in a large complex. This just made the probability that someone else in the facility has a fridge or some other device that is cycling every 10 minutes to 2 hours causing spikes on the line and your phantom problems. You might try a [surge arrest outlet](http://www.homedepot.com/p/CE-TECH-1-Gang-Duplex-Surge-P...
I just wanted to post the apparent solution to this problem: We noticed that there was a faint buzzing sound coming from the circuit breaker box in the apartment. The buzzing got louder and the fridge started having phantom button inputs when we jiggled one of the [plug in circuit breakers](https://2ecffd01e1ab3e9383f...
37,953
How to do this with regular expression? ``` Old -> New http://www.example.com/1.html -> http://www.example.com/dir/1.html http://www.example.com/2.html -> http://www.example.com/dir/2.html http://www.example.com/3.asp -> http://www.example.com/dir/3.html http://www.example.com/4.asp -> http://www.example.com...
2012/11/17
[ "https://webmasters.stackexchange.com/questions/37953", "https://webmasters.stackexchange.com", "https://webmasters.stackexchange.com/users/10452/" ]
This is a rather more general solution, so in that respect it might not be what you are after, but it should redirect the URLs in your question. ``` RewriteEngine on RewriteRule ^(\d)\.(html|asp)$ /dir/$1.html [R=301,L] RewriteRule ^(\d)_([a-z])\.html$ /dir/sub/$1-$2.html [R=301,L] ``` The first `RewriteRule` will m...
``` RewriteEngine on RewriteCond %{HTTP_HOST} ^example\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.example\.com$ RewriteRule ^1\.html$ "http\:\/\/example\.com\/dir\/1\.html" [R=301,L] RewriteCond %{HTTP_HOST} ^example\.com$ [OR] RewriteCond %{HTTP_HOST} ^www\.example\.com$ RewriteRule ^1_a\.html$ "http\:\/\/example\.c...
40,000
In a major scale, I know the chords to be: major, minor, minor, major, major, minor and diminished. What are the chords for the chromatic scale...using the C-major scale as reference...?! What I mean is, in the C-major scale as example we have C-major, D-minor, E-minor, F-major, G-major, A-minor and B-diminished, in...
2015/12/05
[ "https://music.stackexchange.com/questions/40000", "https://music.stackexchange.com", "https://music.stackexchange.com/users/20606/" ]
The chords could be anything. In the C chromatic scale, for the I chord we can have: C major: C,E,G C minor: C,Eb,G C augmented: C,E,G# C half diminished: C,Eb,Gb,Bb C diminished: C,Eb,Gb,A All of the above can be used in the chromatic scale, because all of the above notes belong in the chromatic scale. ...
For me the only way to make sense of your question is to interpret it as "which chords outside the key are frequently added to a piece in major?". Because otherwise the obvious answer is that if you allow any note, any chord could be added. In a major key, it is quite common to add chords from the parallel minor key. ...
7,013,877
> > **Possible Duplicate:** > > [Making a flat list out of list of lists in Python](https://stackoverflow.com/questions/952914/making-a-flat-list-out-of-list-of-lists-in-python) > > > how can I create form a list e.g [[1,2],[3,4]] or [(1,2),(3,4)] the list [1,2,3,4] list comprehension(or map, filter)doesn't s...
2011/08/10
[ "https://Stackoverflow.com/questions/7013877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/331715/" ]
Standard libs are cool: ``` >>> import itertools >>> l = [[1,2],[3,4]] >>> list(itertools.chain(*l)) [1, 2, 3, 4] ```
You want to flatten the list. ``` [y for x in [[1,2],[3,4]] for y in x] ```
50,982,205
**Action:** Initially my app use to work as expected but after Moving react native app created on desktop to a different folder i am getting below error **Error:** Runtime is not ready for debugging on simulator while running app from vscode using command `react-native run-ios` **Tried:** `npm start` as well
2018/06/22
[ "https://Stackoverflow.com/questions/50982205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9971368/" ]
You can try deleting your android, ios and node modules folder and run the following ``` 1.> npm install // to get dependecies loaded 2.> react-native upgrade // to create ios and android folder 3.> react-native link // to link the libraries 4.> react-native run-android (or) > react-native run-ios ``` For react-nati...
Possible dupe of [Moving Create React App folder breaks working app](https://stackoverflow.com/questions/45576822) --- In case above didn't help, **deleting the ios/build folder** and running again worked for me. i.e. from your new root folder ``` rm -r ios/build npx react-native run-ios ``` Per answer in <htt...
21,095,055
I am new to coding and and trying to learn as I go. I'm trying to create a python script that will grab and print all HEADERS from a list of urls in a txt file. It seems to be getting there but im stuck in an infinite loop with one of the urls and I have no idea why and for some reason the "-h", or "--help" wont retu...
2014/01/13
[ "https://Stackoverflow.com/questions/21095055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3190677/" ]
This [page on github](https://docs.github.com/en/get-started/getting-started-with-git/managing-remote-repositories) has the answer you need. You have to switch to ssh authentication from https. Check how it is authenticating as follows. ``` $ git remote -v > origin https://github.com/USERNAME/REPOSITORY.git (fetch) ...
If you used for your GIT the password authentication before, but now are using SSH authentication, you need to [switch remote URLs from HTTPS to SSH](https://docs.github.com/en/github/using-git/changing-a-remotes-url#switching-remote-urls-from-https-to-ssh): ```sh git remote set-url origin git@github.com:USERNAME/REPO...
625,262
I am trying to programmatically access a Windows application app.config file. In particular, I am trying to access the "system.net/mailSettings" The following code ``` Configuration config = ConfigurationManager.OpenExeConfiguration(configFileName); MailSettingsSectionGroup settings = (MailSettingsSectionGroup)...
2009/03/09
[ "https://Stackoverflow.com/questions/625262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This seems to work ok for me: ``` MailSettingsSectionGroup mailSettings = config.GetSectionGroup("system.net/mailSettings") as MailSettingsSectionGroup; if (mailSettings != null) { string smtpServer = mailSettings.Smtp.Network.Host; } ``` Here's my app.config file: ``` <configuration> <system.net> ...
``` private void button1_Click(object sender, EventArgs e) { try { var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); var mailSettings = config.GetSectionGroup("system.net/mailSettings") as MailSettingsSectionGroup; MailMessage msg = new Mai...
29,996,337
I just installed Kony Studio . I am trying to run the HelloWorld app on the Android emulator, always gives me this error: ``` Failure rm failed for /sdcard/profiler_com.kony.HelloWorld.txt, Read-only file system Installing kony application 353 KB/s (3438511 bytes in 9.504s) pkg: /data/local/tmp/luavmandroid.apk Failu...
2015/05/01
[ "https://Stackoverflow.com/questions/29996337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3518682/" ]
It is because `INSTALL_FAILED_OLDER_SDK`, You should set the minimum Android SDK API lower that your device in the project properties > Native > Android > SDK versions > Minimum
If you want to extend support to older version android OS, you need to set the > > Project Settings -> Native Tab -> Android -> SDK versions -> Minimum: to lower version > > > [![Screenshot](https://i.stack.imgur.com/zeJPT.png)](https://i.stack.imgur.com/zeJPT.png) attached. Hope this helps.
212,404
I have several files that all contain a string. This string needs to be replaced by the whole content of another file (that can possibly be multi-line). How can I do this? What I need is something like `sed -i 's/string/filename/' *` where `filename` is an actual file and not the string "filename". Additional info: T...
2015/06/26
[ "https://unix.stackexchange.com/questions/212404", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/50666/" ]
bash works well for this: ``` $ cat replace foo/bar\baz the second line $ cat file the replacement string goes >>here<< $ repl=$(<replace) $ str="here" $ while IFS= read -r line; do echo "${line//$str/$repl}" done < file ``` ``` the replacement string goes >>foo/bar\baz the second line<< ``` Awk would work...
I got this to work: ``` $ foo='baz' $ echo "foobarbaz" | sed "s/foo/${foo}/" bazbarbaz ``` Taking that one step further, your first line would be something like: ``` $ foo=`cat filename` ``` This assumes you know the filename before you reach the line to be replaced, of course - if you don't, you have to read the...
988,473
I know that BIOS loads its first instruction from 0xFFFFFFF0, but why this specific address? I've a bunch of questions and hope you can help me with some of them, at least. **My questions:** * Why is the first BIOS instruction located at the "top" of a 4 GB RAM? * What would happen if my computer only has 1 GB of RAM...
2015/10/18
[ "https://superuser.com/questions/988473", "https://superuser.com", "https://superuser.com/users/411490/" ]
First, this has nothing to do with RAM, really. We're talking about *address space* here - even if you only have 16 MiB of memory, you still have the full 32 bits of address space on a 32-bit CPU. This already answers your first question, really - at the time this was designed, real world PCs had nowhere near the full...
upon RESET an 8088/8086 compatible cpu executes the instructions at 0FFFF0, which is 16 bytes below the 1 megabyte limit. normally the ROM at this location (in PC implementations) would be the BIOS, so at the end of the BIOS ROM, there is a jump to the start of the BIOS rom. shown here: start vector and 'date' signatu...
66,865,881
I am trying to creating a carousel card slider , its working, but when I view it on mobile or tablet mode its not working , I mean cards are overlapping to each other, I want to display responsive card when I view on mobile or tablet mode, please tell me media query for my js file if you have any question please free ...
2021/03/30
[ "https://Stackoverflow.com/questions/66865881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14772642/" ]
You can create a UDF to do the job: ```sql create or replace function isoweek_to_date(s string) returns date as $$ select DATEADD( DAY, WEEK * 7 - CASE WHEN DAYOFWEEKISO(DATE_FROM_PARTS(YEAR, 1, 1)) < 5 THEN 7 ELSE 0 END + 1 - DAYOFWEEKISO(DATE_FR...
I think the following is what you're looking for. Looks similar to Felipe/Hans' solution. It adds 12 weeks onto 2021-01-01, gets the last day of that week with `last_day` and then adds 1 to get the first day of week 13. ```sql select '2021|13' str_dt, dateadd('day', 1, last_day(dateadd('WEEK', SPLIT(str_dt, '...
84,856
What are the best practices in designing a 404 error page? I read so many blogs and articles regarding this. Some says about using fancy images , when some days about sticking to the basics. Are there any guidelines regarding this? What are the best practices? Which of the following details are wrong or to be followe...
2015/09/22
[ "https://ux.stackexchange.com/questions/84856", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/73591/" ]
I'm not saying it's perfect, but we launched a new 404 page this year and we included options asking people to give us feedback when they find a broken link. Consequently we get a few emails a week which are helping us tidy up our site and fix problems. We also included an obvious search box to try and help people fi...
I like the idea of combining humor with a 404 redirect. I am thinking of displaying our latest blogs below the message to make for engaging copy. Our current 404 page looks really bad and has a high bounce rate- <http://www.sevenatoms.com/article_writing_services.shtml>
12,407,549
I'm trying to define a custom `post` action in a controller, but I'm having some questions. This is my controller: ``` module Api module V1 class ExamplesController < ApplicationController def create_a ... end def create_b ... end end end end ``` I want both acti...
2012/09/13
[ "https://Stackoverflow.com/questions/12407549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1595257/" ]
yeah there is definately a bug of some sort, with the optimization. But this works ``` @mixin leftarrow($size:5px, $direction:left) { border-width: $size; border-color: transparent; border-style: solid; display: inline-block; height: 0px; width: 0px; @if $direction == "right" { border-left-color: $na...
First off, you don't want to quote your variables unless you want them to be treated as strings (strings get quoted in your CSS output). It's a really good idea to have your default value be as a part of an "else" instead of an "else if". Are you looking at the generated CSS or looking at it from within something like...
187,713
In C++, what's the generic way to convert any floating point value (float) to [**fixed point**](http://en.wikipedia.org/wiki/Fixed-point_arithmetic) (int, 16:16 or 24:8)? **EDIT:** For clarification, fixed-point values have two parts to them: an integer part and a fractional part. The integer part can be represented b...
2008/10/09
[ "https://Stackoverflow.com/questions/187713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209/" ]
This is fine for converting from floating point to integer, but the O.P. also wanted [fixed point](http://en.wikipedia.org/wiki/Fixed-point_arithmetic). Now how you'd do that in C++, I don't know (C++ not being something I can think in readily). Perhaps try a scaled-integer approach, i.e. use a 32 or 64 bit integer a...
There isn't any built in support in C++ for fixed point numbers. Your best bet would be to write a wrapper 'FixedInt' class that takes doubles and converts them. As for a generic method to convert... the int part is easy enough, just grab the integer part of the value and store it in the upper bits... decimal part wou...
10,912,693
I'm currently using the script ``` SELECT SUM(TABLE_ROWS) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'Tables'; ``` However, it's not accurate, because the engine used by my MySQL tables is InnoDB (I only realised this could be an issue now, be these databases have existed for a while). Is there any way t...
2012/06/06
[ "https://Stackoverflow.com/questions/10912693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/563460/" ]
I was having the same problem which led me to this question. Thanks to computerGuy12345's answer, I came up with a stored procedure that does this without having to copy-paste. As he said, beware that this will scan each table and might take a while. ``` DELIMITER $$ CREATE PROCEDURE `all_tables_rowcount`(databaseN...
`Select Sum(column_Name) from table` ,can not give the exact count of rows in a table , it wil give total row count+1 , wil give the next data inserting row also. and one more thing is, in `sum(Column_Name)` the column\_Name should be int ,if it is varchar or char sum function wont work. soo the best thing is use `Se...
148,865
Your challenge is to compute the [Lambert W function](https://en.wikipedia.org/wiki/Lambert_W_function). \$W(x)\$ is defined to be the real value(s) \$y\$ such that $$y = W(x) \text{ if } x = ye^y$$ where \$e = 2.718281828...\$ is [Euler's number](https://en.wikipedia.org/wiki/E_(mathematical_constant)). Sometimes, ...
2017/11/23
[ "https://codegolf.stackexchange.com/questions/148865", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/58880/" ]
Casio BASIC, 192 Bytes ====================== A port of [My 05AB1E answer](https://codegolf.stackexchange.com/a/203664/94333) ``` ?→X "" If X≥-e^-1 Then 0→R While Re^R<X Isz R WhileEnd -1→L While Re^R>X .5(L+R→M If Me^M<X Then M→L Else M→R If...
[Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 28 bytes ================================================================================== ``` x/.NSolve[#==E^x x,x,Reals]& ``` [Try it online!](https://tio.run/##y00syUjNTSzJTE78n2ar8b9CX88vOD@nLDVa2dbWNa5CoUKnQicoNTGnOFbtv6Y1V0BRZl6JQ1q0roG...
41,559,398
I'd like to write non-ASCII characters (`0xfe`, `0xed`, etc) to a program's standard input. There are a lot of similar questions to this one, but I didn't find an answer, because: * I want to write single-byte characters, not unicode characters * I can't pipe the output of `echo` or something On OS X¹ you can test w...
2017/01/10
[ "https://Stackoverflow.com/questions/41559398", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5405361/" ]
Try a util like `xxd`: ``` # echo hex 52 to pipe, convert it to binary, which goes to stdout echo 52 | xxd -r ; echo R ``` Or for a more specialized util try [`ascii2binary`](http://billposer.org/Software/a2b.html) (default input is decimal): ``` # echo dec 52 to pipe, convert it to binary, which goes to stdout ec...
Using bash, you can echo the input, ``` echo -e -n '\x61\x62\x63\x64' | /path/someFile.sh --nox11 ``` or use cat, which might be more comfortable when there are several lines of prompting: ``` cat $file | /path/someFile.sh --nox11 ``` You can omit the `--nox11`, but that might help when the script spawns a new i...
13,777,395
I have set up a subview "popup" in my application and I want to show a navController if the user taps a button on the subview popup. I've set up the button so far, but if I tap the button the navigationController appears under my popup!? I've searched for some solution but I didn't found any. The whole controller is ac...
2012/12/08
[ "https://Stackoverflow.com/questions/13777395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1779239/" ]
From the so far discussion and debugging the code you want to have the photo browser on the pop-up with a navigation controller. So here is the [sample code](http://dl.dropbox.com/u/58723521/Shared/KGModal-master-with-nav-pop-up.zip) which implements this functionality, have a look at it. I have used the same `KGModa...
I noticed this line of code: ``` [[KGModal sharedInstance] showWithContentView: contentView andAnimated: YES]; ``` And I can only think that, since it is a singleton, it adds the `contentView` on the UIApplication's key window. If that is the case, then a modal view controller will always be below the popup. You can...
69,396,576
I have the same problem that was solved here, trying to create iptables rules that block incoming HTTP/HTTPS traffic except for IPs other than Cloudflare. [Docker container accessible only via Cloudflare CDN (selected ip ranges)](https://stackoverflow.com/questions/62821274/docker-container-accessible-only-via-cloudfla...
2021/09/30
[ "https://Stackoverflow.com/questions/69396576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16997888/" ]
I think the recommended way of binding properties to pojos is to use the `@EnableConfigurationProperties` annotation like so: **KafkaConfig.java** ``` @ConfigurationProperties("kafka") @Data public class KafkaConfig { private String topic; private String event; } ``` **KafkaProducerBeans.java** ``` @Compon...
Add one more annotation `@EnableConfigurationProperties` on the class `KafkaConfig` **KafkaConfig.java** ``` @Configuration @EnableConfigurationProperties // new added annotation @ConfigurationProperties("kafka") @Data public class KafkaConfig { private String topic; private String event; } ```
38,655,154
I have a root viewController(v1) and Second UIViewController(v2). v2 showing on button click and v2 have container(c1). My problem is when I called v2 then c1 also load at same time but I need to load c1 after executing v2 function completely. In v2 I am fetching value from database so its taking some time.
2016/07/29
[ "https://Stackoverflow.com/questions/38655154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4112505/" ]
You just have to right code in func viewDidAppear(animated: Bool) method in child container which get executed after parent complete his loading code ``` func viewDidAppear(animated: Bool) { // code } ```
Instead of stopping the container loading, add a delegate to your child controller which V2 will call once the V2 has completed its loading. ``` @protocol LoadingDelegate { func didFinishLoading() } class ViewController V2 { func viewDidLoad() { childController.delegate = self } func fini...
2,663,122
``` ID- DATE- NAME 10100- 2010/04/17- Name1 10100- 2010/04/14- Name2 10200- 2010/04/17- Name3 10200- 2010/04/16- Name4 10200- 2010/04/15- Name5 10400- 2010/04/01- Name6 ``` I have this fields(and others too) in one table. I need to do a query which return the ID with your respective name where more r...
2010/04/18
[ "https://Stackoverflow.com/questions/2663122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/302745/" ]
You could even do it in constant O(1) time (although it would not be very fast or efficient): There is a limited amount of nodes your computer's memory can hold, say N records. If you traverse more than N records, then you have a loop.
Detecting a loop in a linked list can be done in one of the simplest ways, which results in O(N) complexity using hashmap or O(NlogN) using a sort based approach. As you traverse the list starting from head, create a sorted list of addresses. When you insert a new address, check if the address is already there in the ...
1,690,906
Given that $\frac{dy}{dx}=e^{x-y}$ and $y=1$ when $x=0$ find the exact value of $y$ when $x=1$. After my attempts. I stuck in $$y=e^{1-y}+1-e^{-1}$$ How to proceed?
2016/03/10
[ "https://math.stackexchange.com/questions/1690906", "https://math.stackexchange.com", "https://math.stackexchange.com/users/221836/" ]
A start: Rewrite as $e^y\frac{dy}{dx}=e^x$. This is a separable equation. Integrate. We get $e^y=e^x+C$. Continue.
Your attempted solution is incorrect. Hint: the differential equation $\dfrac{dy}{dx} = e^{x-y}$ is separable.
128,305
How to tag images in the image itself in a web page? I know [Taggify](http://www.taggify.net/), but... is there other options? [Orkut](http://en.blog.orkut.com/2008/06/tag-thats-me.html) also does it to tag people faces... How is it done? Anyone knows any public framework that is able to do it? See a sample bellow...
2008/09/24
[ "https://Stackoverflow.com/questions/128305", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1100/" ]
There's a map tag in HTML that could be used in conjunction with Javascript to 'tag' different parts of an image. You can see the details [here](http://www.w3schools.com/TAGS/tag_map.asp).
You can check out Image.InfoCards (IIC) at <http://www.imageinfocards.com> . With the IIC meta-data utilities you can add meta-data in very user-friendly groups called "cards". The supplied utilities (including a Java applet) allow you to tag GIF's, JPEG's and PNG's without changing them visually. IIC is presently pr...
12,135,704
I am using a WCF service in my app.When the app is run for the first time on the iPad,I want it to call a WCF service and display the result in a UITableView.Alongwith displaying the data in UITableView,i want to store the data in Core Data so when the user is "offline"(not connected to wifi)the data will be displayed ...
2012/08/27
[ "https://Stackoverflow.com/questions/12135704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1550951/" ]
In my case I try this: ``` sudo apt install openjdk-11-jdk-headless sudo apt install openjdk-8-jdk-headless ``` I use openjdk
Find in `/usr/lib/jvm/java-8-oracle/bin/jarsigner -verbose -sigalg SHA1withRSA`
28,806,965
I'm nearing the end of a program development for my computer science course. However, one of the requirements is to have a user manual within the app. I saved the user manual as a PDF inside Eclipse's workspace. It is stored under "/Documents/PDF Manual.pdf". I originally used this code: ``` URL url = getClass().getRe...
2015/03/02
[ "https://Stackoverflow.com/questions/28806965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1320185/" ]
Full working example. Tested in Windows environment. **file structure** ``` .\REPL.java .\doc\manual.pdf .\manifest.mf ``` **REPL.java** ``` package sub.optimal; import java.io.InputStream; import java.io.File; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file...
Use [getResourceAsStream](http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getResourceAsStream%28java.lang.String%29) instead of getResource To write in the temp directory use [createTempFile](http://docs.oracle.com/javase/7/docs/api/java/io/File.html#createTempFile%28java.lang.String,%20java.lang.String%...
15,766,492
Apropos the question ["Why does using the same count variable name in nested FOR loops work?"](https://stackoverflow.com/questions/2393458/why-does-using-the-same-count-variable-name-in-nested-for-loops-work) already posted in this forum,a count variable "i" defined in each nested loop should be considered a new variab...
2013/04/02
[ "https://Stackoverflow.com/questions/15766492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1915076/" ]
The answer you linked to is using *different variables with the same name*, you're simply using the same variable. Compare: ``` for(int i = 0; ... ``` to: ``` for(i = 0; ... ``` The former declares a new variable called `i`, which is how you nest loops like the linked-to answer. Not that I would ever (ever!) rec...
If i were defined in each loop then the behaviour would be as your linked question. In your example you only define `i` once, outside any loop, then reuse it ``` int i; for(i=0; i<=9; i++) { for(i=0; i<=9; i++) { ``` is not the same as ``` for(int i=0; i<=9; i++) { for(int i=0; i<=9; i++) { ```
9,153
I usually build 8 probes, then a pylon, so I could keep building probes and not have to wait for the pylon to build (in 10-pylon you're stuck while the pylon is building). Is one of these build better than the other? [This answer](https://gaming.stackexchange.com/questions/875/what-are-the-popular-build-orders-for-pro...
2010/10/16
[ "https://gaming.stackexchange.com/questions/9153", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/1161/" ]
There was a fun poll about this [on Team Liquid](http://www.teamliquid.net/forum/viewmessage.php?topic_id=136582). The issue with 8 Pylon is that you lose a few seconds of mining time down the line. To make up for it you have to use your first Chrono Boost before the Pylon instead of after. This will lead to a tempora...
I've been practicing this a lot for Cannon rush openings. 8 pylon boost seems like it could maintain the mining pace of the 10 pylon if executed well. You'd lose a boost though that would've been used for building something else.
60,621,603
I was going through an **[article](https://www.geeksforgeeks.org/union-c/)** to learn about union and I had understood that the size of a Union depends upon the largest variable size and the variables share the same memory. So the concept was pretty clear for me but in the article author said that using "union" for a b...
2020/03/10
[ "https://Stackoverflow.com/questions/60621603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10071401/" ]
> > in the article author said that using "union" for a binary tree is worthwhile when it had two pointers to point other two child...what would be the possible explanations for pointers inside a union? > > > I believe you are talking about this code snippet: ``` struct NODE { bool is_leaf; union { ...
I'd also inject that I really don't agree with this author. Just define a `struct` with two pointers and data, and be done. Use `calloc()` to obtain the structure and set it all to binary zeros. There's no point in "saving a few bytes of memory" anymore. If you use a `union` in this way, you *are going to* screw-up and...
53,064,577
So far I have this script: ``` #!/bin/sh echo type in some numbers: read input ``` From here on I'm stuck. Let's say `input=30790148`. What I want to do is add all of those integers up to get 3+0+7+9+0+1+4+8=32. How can I accomplish this?
2018/10/30
[ "https://Stackoverflow.com/questions/53064577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8849558/" ]
This one using `sed` and `bc` ``` echo "12345" | sed -e 's/\(.\)/\1\+0/g' | bc ``` It's a bit hackish though since the `+0` is not intuitive Edit: Using `&` from @PaulHodges' answer, this would shorten to: ``` echo "12345" | sed 's/./&+0/g' | bc ```
This awk one-liner may help you: ``` awk '{for(i=1;i<=NF;i++)s+=$i}END{print s}' FS="" <<< yourString ``` for example: ``` kent$ awk '{for(i=1;i<=NF;i++)s+=$i}END{print s}' FS=""<<< "123456789" 45 ```
4,520,743
I have main menu in my app supporting only landscape mode. I implement landscape restriction by setting up `UIRootViewController::shouldAutorotateToInterfaceOrientation:...` And I have another scene with portrait mode support. So the problem appears when I pass from another scene to main menu in portrait mode: the app ...
2010/12/23
[ "https://Stackoverflow.com/questions/4520743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/326017/" ]
To start with, I recommend against doing both `import decimal` and `from decimal import *`. Pick one and use what you need from there. Generally, I do `import whatever` and then use `whatever.what_is_needed` to keep the namespace cleaner. As commenters have already noted there's no need to create a class for something...
The logic is much the same as previous answers, but severely reformatted. Enjoy! ``` # Loan payment calculator import decimal def dollarAmt(amt): "Accept a decimal value and return it rounded to dollars and cents" # Thanks to @Martineau! # I found I had to use ROUND_UP to keep the final payment # from...
47,465,961
**Situation** I have many URLs in a file, and I need to find out how many unique URLs exist. I would like to run either a bash script or a command. `myfile.log` ``` /home/myfiles/www/wp-content/als/xm-sf0ab5df9c1262f2130a9b313192deca4-f0ab5df9c1262f2130a9b313192deca4-c23c5fbca96e8d641d148bac41017635|https://public....
2017/11/24
[ "https://Stackoverflow.com/questions/47465961", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8851470/" ]
``` cut -d "|" -f 2 file | cut -d "," -f 1 | sort -u | wc -l ``` Output: ``` 4 ``` --- See: `man cut`, `man sort`
``` tr , '|' < myfile.log | sort -u -t '|' -k 2,2 | wc -l ``` * `tr , '|' < myfile.log` translates all commas into pipe characters * `sort -u -t '|' -k 2,2` sorts unique (`-u`), pipe delimited (`-t '|'`), in the second field only (`-k 2,2`) * `wc -l` counts the unique lines
481,516
I'm wondering if the link on the company logo, which usually goes the home page, should be: * <http://www.example.com> * <http://www.example.com/index.html> (or other index file) * /index.html (or other index file) * / (just the root) Does Google care or are there other rules?
2009/01/26
[ "https://Stackoverflow.com/questions/481516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441/" ]
A or D. Hard coding the full path in removes flexibility - let the web server or the app config handle what the default is. (iirc google doesn't care any more than it would for any other link)
Relative URLs (C and D) would be resolved by clients (Google included) to absolute URLs (to B and A respectively) and therefore treated the same as their absolute counterparts. If your A permanently redirects to B, or B to A, then Google will also treat this as one resource. Google will score A+B+C+D as one page. Whic...
67,206
I am trying to set up OpenVPN to allow me to connect a number of laptops to my network in a way that allows the laptops to connect to specific computers via HTTP (to e.g. a server management page) and windows shares (to access files) In the test environment my laptops live in a network with a 192.168.1.X address range...
2009/09/21
[ "https://serverfault.com/questions/67206", "https://serverfault.com", "https://serverfault.com/users/-1/" ]
the issue may be that your VPN is not NAT on the vpn server, so that the VPN clients are directly connecting to the server with the 10.8.0.0 ip, which is a network the other servers have no idea about. 2 solutions are to use iptables to masquerade as a nat on the server, or to add the routes static to the other servers...
As a rule of thumb, you need static routes for every network which is not directly connected to your laptop. So, assuming your OpenVPN server can talk to 10.66.77.20, you need to do the following * on the roaming laptops, add a route to 10.66.77.20 via the OpenVPN server IP * on 10.66.77.20, add a route to the 192.16...
2,472,211
What are the best practices for securing a coldfusion webpage from malicious users? (including, but not limited to, sql injection attacks) Is cfqueryparam enough?
2010/03/18
[ "https://Stackoverflow.com/questions/2472211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/296789/" ]
Although using a prebuilt solution will work, I recommend knowing all the possible issues that must be protected. Check out Hack Proofing ColdFusion at [Amazon](https://rads.stackoverflow.com/amzn/click/com/1928994776).
CfQueryParam is very important, but not nearly enough. There is a boxed solution we use at my work: <http://foundeo.com/security/>. It covers most of the bases. And even if you don't want to buy it, you can take a look at it's feature set and get an idea of the things you should be considering.
65,333,756
I have provided AmazonS3FullAccess policy for both the IAM user and group. Also the buket that I am trying to access says "Objects can be public". I have explicitly made the folder inside the bucket public. Despite all this I am getting access denied error when I tried to access it through its url. Any idea on this?
2020/12/17
[ "https://Stackoverflow.com/questions/65333756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3093728/" ]
I like using `Set` for this purpose. You can create a `Set` from your first array and then any lookup in that Set (using `Set.has`) is O(1) efficiency. ```js const arr1 = [1, 3, 4, 5, 6, 7, 8, 9, 11, 13, 16]; const arr2 = [1, 2, 3, 7, 9, 12, 16, 17]; const arr1Items = new Set(arr1); const matched = arr2.filter(el => ...
The function I wrote below will give the results you want, but remember the function returns an array of arrays, even if the second parameter had only one array or was an array of elements instead of array of arrays (Works for both). ```js Arr1 = [1, 2, 3, 5, 6, 7, 8, 10, 15] Arr2 = [ [1, 3, 5, 7, 8, 9, 10, 11, 1...
38,212
> > But as for you, Bethlehem Ephrathah, Too little to be among the clans of Judah, From you One will go forth for Me to be ruler in Israel. His goings forth are from long ago, From the days of eternity (yom olam). > [‭‭Micah‬ ‭5](https://parabible.com/Micah/5):2‬ ‭NASB‬‬ > > > What are the "days of eternity" (yo...
2019/01/10
[ "https://hermeneutics.stackexchange.com/questions/38212", "https://hermeneutics.stackexchange.com", "https://hermeneutics.stackexchange.com/users/28028/" ]
To understand the verse in question it helps to understand the military context: > > ESV Micah 5: > > > 1a Now **muster your troops**, O **daughterb of troops**; > **siege** is laid against us; > **with a rod they strike the judge** of Israel > on the cheek. > 2c But you, O Bethlehem Ephrathah, > who are too l...
Autodidact asked: ‘***What are ‘the days of eternity’ (yom olam) in Micah*** [5:1 (BHS)] ***asserting about the ruler?***’ --- **One** We’ve understand better the meaning of the term עלם/עולם (OLM/OULM [two variants commonly used in TaNaKh]) translated ‘*eternity*’ by NASB, along with a number of translations. Firs...
2,172,569
Did a new install of postgres 8.4 on mint ubuntu. How do I create a user for postgres and login using psql? When I type psql, it just tells me ``` psql: FATAL: Ident authentication failed for user "my-ubuntu-username" ```
2010/01/31
[ "https://Stackoverflow.com/questions/2172569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61734/" ]
you can also connect to database as "normal" user (not postgres): ``` postgres=# \connect opensim Opensim_Tester localhost; Password for user Opensim_Tester: You are now connected to database "opensim" as user "Opensim_Tester" on host "localhost" at port "5432" ```
With **this command below**, everyone can log in **PostgreSQL** just after installation. \***The default database `postgres`** is used: ```none psql -U postgres ``` You need to put **a password** after running **the command above**: ```none Password for user postgres: ```
1,562,759
In JavaScript, one can print out the definition of a function. Is there a way to accomplish this in Python? (Just playing around in interactive mode, and I wanted to read a module without open(). I was just curious).
2009/10/13
[ "https://Stackoverflow.com/questions/1562759", "https://Stackoverflow.com", "https://Stackoverflow.com/users/111836/" ]
If you're using [iPython](http://ipython.org/ "ipython homepage"), you can use **`function_name?`** to get help, and **`function_name??`** will print out the source, if it can.
You can use the \_\_doc\_\_ keyword: ``` #print the class description print string.__doc__ #print function description print open.__doc__ ```
3,485,764
I know that when developing for Xbox in XNA, you basically just set the resolution to 1280x720 and the Xbox will just take care of things, but on PC I'm having some trouble getting the resolution handled correctly. I would like it to be able to run at other resolutions, but I'm actually happy to make the game always ...
2010/08/15
[ "https://Stackoverflow.com/questions/3485764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/194/" ]
XML forces your data to be well-structured, so that a program which does not understand the *semantics* of your data will still be able to understand its *syntax*. This allows things like XSLT, which will transform one well-formed XML document into another. It means that you can manipulate data without having to interp...
xml lets you be non-standard in a standard way :). It's ugly, it's verbose, it takes up a lot of space and it's absolutely invaluable for interoperability. Basically, xml is nice because it gives you a standard way of describing your data so that a single type of parser can handle data from disparate sources. To use a...
32,754,370
I have following code and it works just fine: ``` <script> (function(w,d,s,g,js,fjs){ g=w.gapi||(w.gapi={});g.analytics={q:[],ready:function(cb){this.q.push(cb)}}; js=d.createElement(s);fjs=d.getElementsByTagName(s)[0]; js.src='https://apis.google.com/js/platform.js'; fjs.parentNode.insertBefore(js,fjs);js.onl...
2015/09/24
[ "https://Stackoverflow.com/questions/32754370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5318279/" ]
The Google Analytics Demos & Tools site provides a step-by-step approach on how to do that in the Embed API's server-side authorization demo: <https://ga-dev-tools.appspot.com/embed-api/server-side-authorization/>
you can solve this by adding an acces\_token to gapi.analytics.auth.authorize() we can get access\_token by creating a service account in google analytics. <https://ga-dev-tools.appspot.com/embed-api/server-side-authorization/> by running a bellow java code you will get the access token ``` public static String getTo...
5,853,912
so I have: ``` char inBuf[80] ``` and then there's another line ``` inBuf+9 ``` what does it mean when I add that +9 to the array's name?
2011/05/02
[ "https://Stackoverflow.com/questions/5853912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/380714/" ]
This would point to the 10th element of the array. So for example: ``` *(inBuf + 9) = 10 ``` would assign 10 to the 10th element.
When you perform addition with it, an array identifier such as your `inBuf` decays to a pointer to the first element in the array, and the number added is multiplied by the size of the array element (in this case char, which has size 1) to produce a new address. So, `inBuf + 9` is the address of the 10th element in th...
183,188
Consider the following code: I'm trying to write a \newcommand that will accept either m or n arguments, where m < n. Here m=4, n=6. I want to set things up so that if I call a newcommand, and it is passed 6 arguments, it will ignore the latter two if `\fl` is defined. The rationale for this is that I want to merge d...
2014/06/04
[ "https://tex.stackexchange.com/questions/183188", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/3406/" ]
Nothing requires you use all arguments in the replacement text: ``` \documentclass{article} \def\fl{} \ifdefined\fl \newcommand{\xx}[6] {#1 #2 #3 #4} \else \newcommand{\xx}[6]{% ...
Here are some options (not extensively tested in your setup though): Option A: --------- Define `\xx` to work on 4 *or* 6 arguments by peeking ahead and see whether a new group `\bgroup` is started. ![enter image description here](https://i.stack.imgur.com/jyCm3.png) ``` \documentclass{article} \makeatletter \newc...
1,939,333
I have user entries as filenames. Of course this is not a good idea, so I want to drop everything except `[a-z]`, `[A-Z]`, `[0-9]`, `_` and `-`. For instance: ``` my§document$is°° very&interesting___thisIs%nice445.doc.pdf ``` should become ``` my_document_is_____very_interesting___thisIs_nice445_doc.pdf ``` a...
2009/12/21
[ "https://Stackoverflow.com/questions/1939333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/90691/" ]
In Rails you might also be able to use [`ActiveStorage::Filename#sanitized`](https://api.rubyonrails.org/classes/ActiveStorage/Filename.html): ``` ActiveStorage::Filename.new("foo:bar.jpg").sanitized # => "foo-bar.jpg" ActiveStorage::Filename.new("foo/bar.jpg").sanitized # => "foo-bar.jpg" ```
If you use Rails you can also use String#parameterize. This is not particularly intended for that, but you will obtain a satisfying result. ``` "my§document$is°° very&interesting___thisIs%nice445.doc.pdf".parameterize ```
32,907,190
I'm using `BreakBeforeBraces: Allman` in my `.clang-format` file, but braces in control statements (such as `if`, `for`, `while`, ...) are not being put on their own line. ``` // Currently: void foo() { while(true) { bar(); } } // What I want: void foo() { while(true) { bar(); } }...
2015/10/02
[ "https://Stackoverflow.com/questions/32907190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/598696/" ]
Achieving the desired result with a specific combination of style options is impossible at the moment. I've reported [the issue as bug 25069](https://llvm.org/bugs/show_bug.cgi?id=25069).
To work around this, I first run [artistic style](http://astyle.sourceforge.net/astyle.html#_Brace_Style_Options) with the option `-A10`, before running clang-format
623,373
I am looking to directly power a Raspberry Pi for my 3D printer from its existing power supply. The terminals on the power supply appear to be ~15 amps max output at 24V. I already have a buck converter wired up to the USB on the Pi to bring the voltage down to ~5V that the Pi wants. What I don't know how to handle is ...
2022/06/13
[ "https://electronics.stackexchange.com/questions/623373", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/315620/" ]
I linked to other questions that should cover the basics of your question (in comments, but I'll list them below as well). Per your additional information, regarding the concern of a fire resulting from a short, you are correct in addressing this concern. If you use a wire gauge that is too small for the power supply,...
**The Official Answer** Often times wire size is related to your fault scenarios. If your RPI was to experience a fault and short 5V and ground together, there would be a large amperage going through the wiring. The question becomes how much is that amperage, and how long does it last, before circuit protection kicks ...
713,145
How can I set the Hostname/Description of a Mellanox/Infiniband unmanaged switch? I would like a way to abstractly distinguish quickly which switches are which when doing 'ibswitches' or 'ibnetdiscover'. For HCAs that are in Servers, the hostnames are set, which is great. Just need a solution for switches. Example:...
2015/08/10
[ "https://serverfault.com/questions/713145", "https://serverfault.com", "https://serverfault.com/users/304140/" ]
You can specify "--node-name-map FILE" for ibnetdiscover and configure the mapping between GUIDs and your desired names, so this name would be shown when running ibswitches/ibnetdiscover. ``` --node-name-map <node-name-map> Specify a node name map. The node name map file maps GUIDs to more user friendly names....
Even shorter answer: now you can, without an external node-name mapping file. <https://github.com/stanford-rc/ibswinfo/> (version 0.6) allows modifying node descriptions for unmanaged Infiniband switches.
874,746
I have a datagrid populated by a Linq query. When the focused row in the datagrid changes I need to set a variable equal to one of the properties in that object. I tried... ``` var selectedObject = view.GetRow(rowHandle); _selectedId = selectedObject.Id; ``` ... but the compiler doesn't care for this at all ("Embed...
2009/05/17
[ "https://Stackoverflow.com/questions/874746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42620/" ]
Have you ever tried to use reflection? Here's a sample code snippet: ``` // use reflection to retrieve the values of the following anonymous type var obj = new { ClientId = 7, ClientName = "ACME Inc.", Jobs = 5 }; System.Type type = obj.GetType(); int clientid = (int)type.GetProperty("ClientId").GetValue(obj, null);...
This may be wrong (you may not have enough code there) but don't you need to index into the row so you choose which column you want? Or if "Id" is the column you want, you should be doing something like this: ``` var selectedObject = view.GetRow(rowHandle); _selectedId = selectedObject["Id"]; ``` This is how I'd gra...
59,251,168
I'm trying to do a string search operation using python and my its not working because I have three different kind of Apostrophe in my text [![images of apostrophes](https://i.stack.imgur.com/SI84O.png)](https://i.stack.imgur.com/SI84O.png). I imported by data from word documents. Example comparison text: > > Stimmt...
2019/12/09
[ "https://Stackoverflow.com/questions/59251168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11098599/" ]
If you replace all unusual forms of the apostrophe before doing anything else you avoid running into any problems: `df = df.replace("`|’", "'", regex=True)`
I think that the simplest solution will be to preprocess your data and use only one of them (e.g. replace all " ’ " with " ' " ). The characters are actually different from each other and that is the reason why you get False when comparing them. Another option is to define a Constant or an enum of a lsit type, such as:...
14,267,526
``` Class A { private Map<Oject,Object> map; public void clear() { map.clear(); } public void work() { synchronized (map) { map.put(new Object, new Object(); } } } ``` If thread A is in the middle of the `work()` method, does this mean thread B won't block if e...
2013/01/10
[ "https://Stackoverflow.com/questions/14267526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1541619/" ]
Your suspicion is correct; this code has a bug. You need to lock around `clear()` as well; otherwise; you can still end up running `put()` and `clear()` concurrently. However, you should actually use a `ConcurrentHashMap()` instead.
Correct. Why would it? That's the point of the `synchronized` block - and thread B hasn't executed a `synchronized` block. In this case, it's exactly like there was no synchronisation at all.
34,351,006
I have a problem with Javascript: I'm trying to increment a number which is a string, so I need to parse it, increment the value, and assign that number to the value in the field. But I don't understand why this code doesn't work properly: ``` <button type="button" onclick="dec()" name="less" style="background-color: ...
2015/12/18
[ "https://Stackoverflow.com/questions/34351006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5457162/" ]
Use the [value attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button) of the button element to pass the id, as ``` <button onClick={this.handleRemove} value={id}>Remove</button> ``` and then in handleRemove, read the value from event as: ``` handleRemove(event) { ... remove(event.target.value...
TL;DR: Don't bind function (nor use arrow functions) inside render method. See official recommendations. <https://reactjs.org/docs/faq-functions.html> --- So, there's an accepted answer and a couple more that points the same. And also there are some comments preventing people from using `bind` within the render met...
11,523,448
I have an azure web application, running MVC 4. It uses the entity framework (version 4.3.1.0) and Code First together with a data context. I have the data context in its own project, that also have all the model files. ``` public class AwesomeModelContext : DbContext { public DbSet<User> Users { get; set; } ...
2012/07/17
[ "https://Stackoverflow.com/questions/11523448", "https://Stackoverflow.com", "https://Stackoverflow.com/users/741850/" ]
I would like to know whether you have a CreatedOn column in the Team table in your database. If you already have a database, please make sure your model class corresponds to the database table. For example, add the CreatedOn property to your model. If you want a code first approach, you can remove the database. Let Ent...
Seems like a thing in EF Code first with migrations enabled, when you upgrade from EF4.\* to EF 5.0. And that in combination with MiniProfiler. The table existed in `dbo._MigrationHistory` under system tables. You try do a few things: 1. You can add `CreatedOn` (DateTime) column manually to `dbo._MigrationHistory` ta...
12,844,504
I want to parse nested JSON strings by splitting them up recursively by { }. The regex I came up with is "{([^}]\*.?)}", which I've [tested](http://java-regex-tester.appspot.com/) appropriately grabs the string I want. However, when I try to include it in my Java I get the following error: "Invalid escape sequence (val...
2012/10/11
[ "https://Stackoverflow.com/questions/12844504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1436111/" ]
~~1. Curle braces have no special meaning here for regexp language, so they should not be escaped I think.~~ 2. If you want to escape them, you can. Backslash is an escape symbol for regexp, but it also should be escaped for Java itself with second backslash. 3. There are good JSON parsing libraries <https://stackover...
Double the backslashes: ``` String[] strArr = jsonText.split("\\{([^}]*.?)\\}"); ```
48,697,639
Hi I have a pandas df with multilevel columns: ``` sample = pd.DataFrame(pd.np.random.randn(10,2),columns=['a','b']) df = pd.concat([samp], keys=['p4'],axis=1) df ``` Output ``` p4 a b 0 0.621016 0.920448 1 0.329792 -0.674688 ``` I know I can add a column c like this: ``` df[('p4','c'...
2018/02/09
[ "https://Stackoverflow.com/questions/48697639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7439683/" ]
In my opinion, a loop is the most readable and maintainable way. For example: ``` for i in range(4, 11): df[('p'+str(i), 'c')] = df[('p'+str(i), 'a')] - df[('p'+str(i), 'b')] ```
I am using MultiIndex for this ``` s=df.T.groupby(level=0).apply(lambda x : x.iloc[0]-x.iloc[1]) s.index=pd.MultiIndex.from_arrays([s.index,['c']]) pd.concat([df,s.T],1) Out[956]: p4 a b c 0 -0.850052 0.960820 -1.810872 1 -0.217418 0.158515 -0.375933 2 0.873...
8,540,679
Can some one please tell me if I should use user controls in my project as much as I can? Ff so why and if not why not?
2011/12/16
[ "https://Stackoverflow.com/questions/8540679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/974330/" ]
It's an interesting question; but think of it this way. You've just written a table, listing all of your users. You show this on the List Users page of your website. On the "Find User" page, you might want to be able to show a list of users. Do you rewrite the same HTML, code, javascript, CSS as before? Or do you re...
I would use the controls that the VS IDE Toolbox provides as much as possible. I would only roll my own control if something that the environment supplied, didn't quite do what I wanted it to do.
34,331,072
I'm using regular expression in my application and I want to test it for different combinations. How to I specify starts with 'a' and ends with 'e'?
2015/12/17
[ "https://Stackoverflow.com/questions/34331072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5681694/" ]
Your regular expression works if you add `.` before the star `*`: ``` (^ap.*e$) ``` However, for your requirements there is no need for the `p`, so this will do ``` (^a.*e$) ``` You can explain this regular expression as follows (see this [link](https://regex101.com/)) 1. `^` assert position at start of the stri...
You can use this ``` (^ap.*e$) ``` You can try testing you REGEX on this website. <http://www.regular-expressions.info/javascriptexample.html>
37,229,950
How do I pull out all words that have the symbol "`<-`" either at the end of the word or somewhere in between but in the latter case only if the "`<-`" symbol is followed by a dot. To put it into context. Exercise 6.5.3 a. of *Hadley Wickhams - Advanced R* asks the reader to list all replacement functions in the base...
2016/05/14
[ "https://Stackoverflow.com/questions/37229950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4046004/" ]
If you want all base package replacement functions and their respective S3 methods, you can try ``` ls(envir = as.environment("package:base"), pattern = "<-") ``` With no packages loaded, this gives the following result: > > > ``` > [1] "<<-" "<-" "[<-" ...
We can try ``` library(stringr) str_extract(v1, "\\w+<-$|\\w*<-\\.\\S+") #[1] "split<-.data.frame" NA "splitdata<-" ``` ### data ``` v1 <- c("split<-.data.frame", "split<-data", "splitdata<-") ```
391,789
Is there are way we can completely avoid illegal states rather then throwing an IllegalStateException when a method is called when it should not be? For example: ``` public interface Process { void start(); void stop(); } ``` Illegal state would be created if `stop()` is called before `start()`.
2019/05/12
[ "https://softwareengineering.stackexchange.com/questions/391789", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/336132/" ]
You can avoid illegal states by starting in a legal state and disallowing transitions into illegal states. The problem is enforcing that in a system complex enough to get useful work done. The code you posted is trivial enough that it can be fixed simply by adding another type to represent your missing state. [![...
Stopping in a stopped state would just be a nop operations, so do nothing. No IllegalStateException need be thrown, just return immediately from the method if the system is in a state where the stop operation would be meaningless. Similar with the start operation. If the system is already started, it would be a nop op...
177,631
I want to check the quality of digitized tracks. I suppose, that a track with a lot of regular vertices has got a good quality. And a track with less regular vertices has got a poor quality. [![enter image description here](https://i.stack.imgur.com/UFBpi.png)](https://i.stack.imgur.com/UFBpi.png) Maybe, I need somet...
2016/01/20
[ "https://gis.stackexchange.com/questions/177631", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/6800/" ]
Have you [tried this](http://www.qgistutorials.com/en/docs/counting_vertices.html)? A QGIS plugin to count polylines / polygons vertices and add a new column storing the number of vertices per feature. This could help sorting poor quality / good quality lines from your approach. --- **EDIT :** if you prefer doing s...
Thinking of a way to visualise this. I'm going by gut-feel here, so please forgive the vagueness :) I'll assume that both tracks use the same CRS. I assume that more detailed track is the 'baseline', and you want to measure how far away the other track is. You could use PostGIS to connect each vertex on the baseli...
63,946
Can anyone tell me what would be the easiest and cheapest way to access the internet? How common are HotSpots (biggest cities or towns) ? Can I rely on it or would be easier to buy 'pay and go' SIM card ? I am not going to use it for any social network or anything like that (except of SE Travel :) ). Google maps, gener...
2016/02/17
[ "https://travel.stackexchange.com/questions/63946", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/35794/" ]
Just buy a colombian prepaid simcard. Major carriers ([Claro](http://www.claro.com.co/portal/co/pc/personas/movil/catalogo-promociones/promocion/paquetes-de-datos/), [Movistar](https://www.movistar.co/descubre/internet/internet-movil-informativo/internet-prepago) or [Tigo](http://www.tigo.com.co/personas/planes/interne...
In the major cities, Bogota, Medellin, Cartagena etc you will find lots of free hotspot places like restaurants, pubs and bars. Even if you don't see hotspot advertised then feel free to ask the waiter for the logon details. Unlike in other countries most hotspots don't require any online registration, simply select th...
8,774,531
I have an UINavigationBar added to my UIViewController view. I want to change the fonts properties. Note that I want to change a UINavigationBar not controller. In my app where I use UINavigationController I use `self.navigationItem.titleView = label;` to display the custom label. How can I accomplish to have a custo...
2012/01/08
[ "https://Stackoverflow.com/questions/8774531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/507035/" ]
Just put this in your app delegate's ``` - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions ``` From Ray Wenderlich: <http://www.raywenderlich.com/4344/user-interface-customization-in-ios-5> ``` [[UINavigationBar appearance] setTitleTextAttributes: [NSDict...
For iOS 13 and Swift 5. For setting the title color & font just add in *viewDidLoad()* the following line: ``` UINavigationBar.appearance().titleTextAttributes = [ .foregroundColor: UIColor.white, .font: UIFont(name: "Arial", size: 24)! ] ``` For setting the bar button item text color & font: ``` UIBarBu...
64,148,532
I am using FtpGet to extract or retrieve a file from the ftp and loading into the database and before that i am storing in a local folder. So before i use tfilecopy to the local Folder i would like to perform a check wherein if the file already exists in the local folder skip or ignore the next steps,if they dont exis...
2020/10/01
[ "https://Stackoverflow.com/questions/64148532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14284366/" ]
You can create a java routine eg: ``` findFile("fileName","FilePath") ``` Invoke the routine for each file by passing the `fileName` and `filePath` as parameters.
Did you check tFileExist component ? It seems that it could be useful (only parameter is folder+filename you want to check ).
1,003,823
I'm trying to setup a Flex project using the Spring + BlazeDS integration by working through the refcard kindly posted by James Ward on refcards.dzone.com. Some problems/challenges are sticking their heads out. The Tomcat deployment is going well, all the files are on the server and I can summon main.swf through the b...
2009/06/16
[ "https://Stackoverflow.com/questions/1003823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122835/" ]
I have the same problem and I fixed it by adding backport-util-concurrent.jar and cfgatewayadapter.jar from test-drive-sample of flex-spring integration , thank you josamoto for your post , finally the integration works good . regards
If you follow along the reference card your URL would be <http://localhost:8080/dzone-server/spring/messagebroker/amf>. The context-root in the reference card is dzone-server. The key step is to make sure the URL above matches the endpoint url defined in the services-config.xml. So the matching endpoint for the above ...
17,041,268
I am having trouble submitted checkbox values and details to my database. This is my HTML: ``` <form method="get" action="check.php"> <input type="checkbox" name="checkAccount"/> <input type="hidden" name="table_name" value="masterChart" /> <input type="hidden" name="column_name" v...
2013/06/11
[ "https://Stackoverflow.com/questions/17041268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2436532/" ]
The classic way to submit data is to add the value attribute to your checkboxes element in your form. On server side you have to ckeck the value for "null". ``` <input type="checkbox" name="checkAccount" value="putyourvaluehere"/> ```
// your html code shoul be like this ``` <form method="get" action="check.php"> <input type="checkbox" name="checkAccount"/> <input type="hidden" name="table_name" value="masterChart" /> <input type="hidden" name="column_name" value="account" /> <p><input type="submit" class="btn bt...
13,177,612
In reference to my [Previous Question](https://stackoverflow.com/questions/13176567/temporary-sql-datafield/13177257#13177257) someone said in select query if I set a column data value for a table it won't going to update columns value in my table within a stored procedure, is that's right?
2012/11/01
[ "https://Stackoverflow.com/questions/13177612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1628540/" ]
No problem on **OS X 10.5** The `osascript`command on **OS X 10.4** doesn't handle UTF-8 encoded text correctly when the string contain extended ASCII character. Solution : Use the `MacRoman` encoding, `osascript` handle it without problem. ``` set myScriptAsString to quoted form of "do shell script \"touch /ü\"" do...
You have saved me from suicide… not for the many hours trying to use an automator Service script to process SublimeText and copying also with pbcopy… I tried it long time before. Nothing. I simply do now ``` `echo '#{s.sub(/\s+$/, '')}' | iconv -t MACROMAN -f UTF8-MAC | pbcopy` ``` Thanks! -------
40,516,231
I have a program that takes in user input for a length and a width and adds it to an array of shapes and after creating and adding each shape it prints them out after each one. BUT, if one of the values are negative (invalid) then it is not supposed to put that shape into the array (which is also not supposed to print ...
2016/11/09
[ "https://Stackoverflow.com/questions/40516231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7033925/" ]
The problem is, that you create a new shape and after that you are checking if the input is valid. I would suggest you check for validity on the front end. You could create a method to check: ``` public boolean isValid(double value){ if (value < 0.0) { System.out.println("Invalid Input"); return f...
The problem is that you are validating the input within the `Rectangle` constructor. You should validate the input *before* passing it to the constructor (and not creating the object when failing). But you could fix this broken design to a less broken one by throwing an Exception instead of just outputting the detecte...
71,760,943
``` nc = dict(zip(nation,cap)) print("Countries and Capitals :{}".format(nc)) k = 0 while k != 5: k = input("input : ") if k == 1: break if k != 1: key = k print("The capital of {} is {} ".format(key,nc[key])) ``` #This only makes an error ...
2022/04/06
[ "https://Stackoverflow.com/questions/71760943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18713105/" ]
If you also want to match `#match-this~` as a separate match, you would have to account for # while matching, as `[^~]` also matches `#` You could match what you don't want, and capture in a group what you want to keep. ``` ~[^~#]*~|((?:(?!match-this).)*match-this(?:(?!match-this)[^#~])*) ``` **Explanation** * `~[...
For this you need [both kinds of lookarounds](https://www.regular-expressions.info/lookaround.html). This will match the 5 spots you want, and there's a reason why it only works this way and not another **and why the prefix and/or suffix can't be included**: `(?<=~)match-this(?!~)|(?<!~)match-this(?=~)|(?<!~)match-thi...
42,576,215
I'm working on a project that is using NSB, really like it but it's my first NSB solution so a bit of a noob. We have a job that needs to run every day that processes members - it is not expected to take long as the work is simple, but will potentially effect thousands of members, and in the future, perhaps tens or hun...
2017/03/03
[ "https://Stackoverflow.com/questions/42576215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1324393/" ]
I would not use a saga for this. Sagas should be lightweight and are designed for orchestration rather than performing work. They are started by messages rather than scheduled. You can achieve your ends by using the built-in [scheduler](https://docs.particular.net/nservicebus/scheduling/). I've not used it, but it lo...
A **real** NSB solution would be to get rid of the "batch" job that processes all those records in one run and find out what action(s) would cause each of these records to need processing after all. When such an action is performed you should publish an NSB event and refactor the batch job to a NSB handler that subsc...
120,475
I'm writing a bash script that extensively uses wget. To define all common parameters in one place I store them on variables. Here's a piece of code: ``` useragent='--user-agent="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0"' cookies_file="/tmp/wget-cookies.txt" save_cookies_cmd="--save-coo...
2014/03/19
[ "https://unix.stackexchange.com/questions/120475", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/63141/" ]
<http://mywiki.wooledge.org/BashFAQ/050> ``` user_agent='--user-agent="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0"' cookies_file="/tmp/wget-cookies.txt" save_cookies_opts=( --save-cookies "$cookies_file" --keep-session-cookies ) load_cookies_opts=( --load-cookies "$cookies_file" --keep-se...
``` mywget() ( echo log "wget $quiet \ userstring=${userstring:-unset} \ cookies=${cookies:-no} $@" echo wget ${userstring:+--useragent="$userstring"} \ ${cookies:+--${cookies}-cookies \ "$cookies_file" --keep-sess...
16,697,794
I have the below code: ``` List<Check<String, String>> listAdd = new ArrayList<Check<String, String>>(); for (list1<String, String> h : list1_a) { for (list2<String, String> s : list2_a) { if (condition) { //if(!listAdd.contains(Check(h.getString(),s.getString()) ...
2013/05/22
[ "https://Stackoverflow.com/questions/16697794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1455116/" ]
Try this: ``` if (condition) { Check c = new Check(h.getString(), s.getString()); if (!list.contains(c)) { list.add(c); } } ``` Make sure you have `equals()` and `hashCode()` methods implemented in the `Check` class. Another approach is to switch the `java.util.List` with some implementation of the ...
try this in place of `//if(!listAdd.contains(Check(h.getString(),s.getString());` ``` if(!listAdd.contains(new Check(h.getString(),s.getString()); ```
99,582
I have a file that contains 4n lines. Here is an excerpt from it containing 8 lines ``` 6115 8.88443 6116 6.61875 6118 16.5949 6117 19.4129 6116 6.619 6117 16.5979 6118 19.4111 6115 8.88433 ``` What I want to do is sort a block, where each block consists of 4 lines based on the first column. The output for the e...
2013/11/09
[ "https://unix.stackexchange.com/questions/99582", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/51025/" ]
Here are some "pure" `awk` solutions: If the indexes are always the same incrementing integer sequence (6115-6119), as in your sample-data, you can use an algorithmic "shortcut": ``` awk '{a[$1]=$0} !(NR%4){for(i=6115;i<6119;print a[i++]);}' ``` This does * Add all lines to the array `a`, distributed at index posi...
You can get a clean solution with R. If the table above is in a file called "table.txt", then perform the following steps. The desired result will be in the file "tableout.txt". ``` > x = read.table("table.txt", col.names=c("a", "b")) > x a b 1 6115 8.88443 2 6116 6.61875 3 6118 16.59490 4 6117 19.41290 ...
14,004,546
how come the i.X and i.Y are not being updated in the fb.Entities collection? am I doing something wrong? I'm learning, Is this the correct way to update values of something in a vector? ``` for (Entity i : fb.Entities) { if (i.Serial == SerialID) { i.X = (USHORT)((data[5] << 8) +...
2012/12/22
[ "https://Stackoverflow.com/questions/14004546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1749335/" ]
If you want your current (local) work stay on top you do ``` git fetch git rebase origin/develop ``` or ``` git pull --rebase ``` Merging in the code i.e. pull when remote and local has changed, can have the effect that your local work is placed in the wrong order and is overwritten by remote changes. So if yo...
Well, [`git pull`](http://git-scm.com/docs/git-pull) does [`git fetch`](http://git-scm.com/docs/git-fetch) followed by [`git merge`](http://git-scm.com/docs/git-merge). So, if you wish to automatically merge the `pull`ed repository, then you have no need for `git fetch`.
12,717,298
I have a div width at 1000px and height at 100% but when i try and make anothe div next to it (on the right) with the following properties: ``` margin-right: 20%; border: 1px solid; float: right; height: 100%; width: 10px; ``` The div appears at the bottom of where the main container div ends. What is wrong?
2012/10/03
[ "https://Stackoverflow.com/questions/12717298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1712995/" ]
You can assign float:left; or display:inline-block; to the first div.
It's somewhat confusing, but place your second div before your first in your code, then the float will affect it. Right now, the first div is display:block, which pushes down the next line. right now it's : ``` <div id="1"> <div id="2" style="float:right"> ``` change it to ``` <div id="2" style="float:right"> <d...
18,932
Me and my friends are going to Japan 2 weeks from now. We'll stay for 4 days in Tokyo, overnight in Hakone, 3 days in Kyoto (with a side visit to Nara) and 2 days in Osaka (Summer Sonic!!). So my question is, what is the most cost effective way to get around in these places? So I found about the [JR Pass](http://jrp....
2013/07/17
[ "https://travel.stackexchange.com/questions/18932", "https://travel.stackexchange.com", "https://travel.stackexchange.com/users/2261/" ]
* [1,750 yen from Tokyo to Hakone](http://transit.loco.yahoo.co.jp/search/result?flatlon=&from=%E6%9D%B1%E4%BA%AC&tlatlon=&to=%E7%AE%B1%E6%A0%B9%E6%B9%AF%E6%9C%AC&via=&expkind=1&ym=201307&d=26&datepicker=&hh=10&m1=2&m2=0&type=1&ws=2&s=0&x=54&y=10&kw=%E7%AE%B1%E6%A0%B9%E6%B9%AF%E6%9C%AC) * [14,280 yen from Hakone to Kyo...
[Current price in JPY is ¥29110](http://www.jrailpass.com/) for a standard 7-day pass. Anyway it is cheaper than 2 individual long-distance shinkansen trips.
170,291
I am attempting to replace JS buttons with quick actions. These button simply call a web service method and alert the result and **need no user interaction**. With quick action a modal always seems to appear and this is not desirable. I am calling the Webservice method in the `doInit` function and firing a toast eve...
2017/04/17
[ "https://salesforce.stackexchange.com/questions/170291", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/3996/" ]
Just add the below code in your component so that it doesn't show up the modal when you click on the Quick action button ``` <aura:html tag="style"> .slds-backdrop { background: rgba(43, 40, 38, 0) !important; } .slds-fade-in-open { display:none !important; } </aura:html> ```
Add this styling on the component. ``` <aura:html tag="style"> .slds-backdrop { background: rgba(43, 40, 38, 0) !important; visibility: hidden !important; } .slds-fade-in-open { display:none !important; } .slds-modal { display: none; visibility: hidden !important; } </aura:...
32,424
Wiktionary says that 教, read as きょお means "to teach". However, I have read that in dictionaries, al forms end in "-う" and not in "-お". Why is 教 different? EDIT: Yes, it says that in English wiktionary. First, the reading they give is "kyoo". Second, they define it as "1.to teach; teachings"
2016/02/24
[ "https://japanese.stackexchange.com/questions/32424", "https://japanese.stackexchange.com", "https://japanese.stackexchange.com/users/13658/" ]
This is a serious misunderstanding, I'm afraid. きょう is just one of the several readings ([読]{よ}み[方]{かた}) of 教. It's a so-called 'sound-reading' [音読み]{おんよみ}, which are Japanese renderings of Chinese speech. You actually misquoted this particular reading; it's きょ**う** not きょ**お**, although that would be pronounced the sa...
All the Kun endings do end in "u". I believe it is only necessary that the Kun end in U 教 common Kun おし.えるoshi.eru おそ.わるoso.waru teach;  faith;  doctrine Radical: 攵 (rap). Strokes: 11画. Elements: 子⺹攵. Pinyin: jiào / jiāo. Hangul: 교 [gyo]. Nanori: のり / ひさ. Jōyō Kanji 2nd Grade. JLPT N4. Example compounds: キョウ 教条主義【きょうじょ...
47,594,015
How can I create library bundle on Symfony 4? In Symfony 3 I use this command: `php bin/console generate:bundle` but in new version not working. And is possible use bundles like Symfony 3, for example, i have blog bundle and telegram bot bundle if not possible how to simulate in Symfony 4?
2017/12/01
[ "https://Stackoverflow.com/questions/47594015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6157616/" ]
Fabien Potencier said in the Symfony 4 best practices blog post "Bundle-less applications is just one of the best practices changes for Symfony 4". You must not generate new bundles, you can use default "App" bundle for your whole project. You can look at this url for blog post about subject [Symfony 4: Monolith vs M...
Start by creating a `src/Acme/TestBundle/` directory and adding a new file called `AcmeTestBundle.php`: ```php // src/Acme/TestBundle/AcmeTestBundle.php namespace App\Acme\TestBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; class AcmeTestBundle extends Bundle { } ``` After add this line in config/bundles.p...
32,228,882
I am trying to add ✔ character (i.e Heavy Check Mark) in the text box. If I hardcode it as a value to the textbox it does show proper check mark in the browser. However If I try to update the value dynamically to "✔" it does not reflect in the browser. I tried ``` 1. $('#txtBox').val(result.value); 2. $('#txtBox')...
2015/08/26
[ "https://Stackoverflow.com/questions/32228882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2186227/" ]
One way to do this is to directly add ✔ character. ```js $('#addChkBox').click(function () { $('#txtBox').val('✔'); }); ``` ```html <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input id="txtBox"/> <button id="addChkBox">Add CheckBox</button> ```
Try this instead: ``` $('#txtBox').append('&#10004;'); ``` I'm not sure how you're defining `result.value`, so I can't speak to how you'd use this. Fiddle: <http://jsfiddle.net/oe16xdbr/2/>
24,412,550
I have the following table: ``` create table x ( id integer, property integer ); ``` I need to efficiently run queries that test multiple property values for a given id. For instance, I may want a query that gets all ids with a property satisfying the condition: *1 and not (2 or 3 or 4 or 5)*. If all my p...
2014/06/25
[ "https://Stackoverflow.com/questions/24412550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2855582/" ]
I assume that `id` is not unique and an existing record `(some_id, property_id)` means that the property is `on`. First, I would notice that `I need to efficiently run queries that test multiple property values for a given id` and `I may want a query that gets all ids with a property satisfying the condition: 1 and no...
Have you considered building a table consisting of (id, propertybin), that gets populated as follows: ``` INSERT LookupTable (id, propertybin) SELECT id, sum(1 << property) FROM MyTable GROUP BY id ``` Now, propertybin holds a binary value for each ID, where each bit represents whether a property from 0 to 63 exists...
22,466,714
Basically I know how to add one row to an external mysql database using android. Now im looking to add multiple rows at once. Heres my code so far. PHP Script ``` <?php $host="db4free.net"; //replace with database hostname $username="xxxxxx"; //replace with database username $password="xxxxxxx"; //replace with data...
2014/03/17
[ "https://Stackoverflow.com/questions/22466714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2205771/" ]
Something like this maybe? ``` INSERT INTO table (name, password ) VALUES ('Name1', 'Password1'), ('Name2', 'Password2'),('Name3', 'Password3'), ('Name4', 'Password4') ```
Using **mysqli** you can not only **avoid deprecated mysql functions** but you can easily loop over insert values using prepared statements. [Referencing](http://ca1.php.net/manual/en/mysqli.prepare.php) In the following example we will be inserting usernames and passwords into the database in a safe and efficient wa...
589,389
What is the correct way to declare and use a FILE \* pointer in C/C++? Should it be declared global or local? Can somebody show a good example?
2009/02/26
[ "https://Stackoverflow.com/questions/589389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
It doesn't matter at all whether it's local or global. The scope of the file pointer has nothing to do with its use. In general, it's a good idea to avoid global variables as much as possible. Here's a sample showing how to copy from `input.txt` to `output.txt`: ``` #include <stdio.h> int main(void) { FILE *fin,...
It's just an ordinary pointer like any other. ``` FILE *CreateLogFile() { return fopen("logfile.txt","w"); // allocates a FILE object and returns a pointer to it } void UsefulFunction() { FILE *pLog = CreateLogFile(); // it's safe to return a pointer from a func int resultsOfWork = DoSomeWork(); fprint...
172,802
The best way to prove that a file F existed before time t and has not been altered since then would be to post the cryptographic hash h=H(F) of the file F on the Bitcoin blockchain. When the cryptographic hash h=H(F) of the file F has been posted on a blockchain, we say that the file F has been *timestamped*. Since the...
2021/07/30
[ "https://academia.stackexchange.com/questions/172802", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/38616/" ]
There is existing software (e.g. moodle, gradescope, etc) that can handle timestamps without making people setup a bitcoin wallet, buy bitcoin, and make non-standard transactions ('posting').
I suspect that the main misunderstanding in this question is the assumption that what the student handed in has to change when the grade changes. Changing the material after it has been handed in would be clear fraud and there is no reason for lecturer to go along with that unless there is real bribery. This is pretty ...
5,433,977
I'm pretty sure that this is a no-brainer but I didn't find any snippet of sample code. What's the best way to insert line breaks (aka the good ol' br/)? As far as I can see if I put a "br" at the beginning of an empty line, it is rendered as `<br/>` but if I have to show several lines of text, the resulting code is q...
2011/03/25
[ "https://Stackoverflow.com/questions/5433977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/162293/" ]
The cleanest and easiest solution is to use the style attribute `white-space: pre;` eg: ``` .poem p(style='white-space:pre;') | Si chiamava Tatiana, la sorella… | Noi siamo i primi, almeno lo crediamo | Che un tale nome arditamente nella | Cornice d’un romanzo introduciamo. ...
I was generating a SASS file from PUG template and I needed `each` item on a new line. This is what worked for me: ``` //- custom-variables.pug //- GENERATE COLORS each color, idx in colors | #{idx}: #{color}; | ``` ```js const pug = require("pug"); const colors = { $primary: "#0074d9", $secondary: "...
123,028
I'd like to know whether it is okay to start a letter like this: > > Dear Bob, > > > Hi, Bob... > > > I've been doing this but not sure it is totally acceptable. Isn't "Hi, Bob" somewhat redundant as there is already "Dear Bob"? Sure, there are many ways to start a letter but what I'd like to know is if it is a...
2017/03/20
[ "https://ell.stackexchange.com/questions/123028", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/10768/" ]
"Dear Mr. Jones" is a formal opening, so people sometimes begin the body with "Hi" to transition to a friendlier tone. "Dear Bob" is informal, so "Hi" would stand out as redundant. However, it would never seem appropriate to repeat the person's name in the first two phrases. Salespeople are (or were) trained to make...
Maybe, just maybe, if the "Dear" part is so long or formal or must follow a particular format that it actually ends up as its own section of the letter: If you must format your letter to open with a very formal salutation, in order to meet guidelines from your workplace/university/organisation, for example: *"Dear Si...
8,007,658
I am facing the issue in division of numbers in java script. Example: ``` var x= 2500, var y = 100 alert(x/y) ``` is showing 25. I need the answer in **25.00** format. What can I do? When I divide 2536/100, it gives as expected.
2011/11/04
[ "https://Stackoverflow.com/questions/8007658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1206161/" ]
Try doing it this way: ``` alert((x/y).toFixed(2)) ```
is it possible to enter x and y as a dollar amount? ie 25.00 and 1.00? if so then use the parseFloat method. ``` var x = 25.00 var y = 1.00 alert(parseFloat(x/y)); ```
54,967,790
Android Studio is giving me a error in 'name' saying it has to be a "throwable tr" in log.v . Can someone explain me why? Log.v("MainActivity", "Name: ",name);
2019/03/03
[ "https://Stackoverflow.com/questions/54967790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11143146/" ]
Android Log Class documentation: * @param tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs. * @param msg The message you would like logged. * @param tr An exception to log ``` public static int v(String tag, String msg, Throwable tr) { retu...
Make sure the third argument is a type of `Throwable`. As per the documentation, method syntax is: ``` public static int v (String tag, String msg, Throwable tr) ``` [Link to documentation](https://developer.android.com/reference/android/util/Log.html#v(java.lang.String,%20java.lang.String,%20java.lang.Throwable)) ...
11,233,659
I would like to timestamp my DLL file with my own Authenticode Timestamping Service. Is this possible? How could I achieve this?
2012/06/27
[ "https://Stackoverflow.com/questions/11233659", "https://Stackoverflow.com", "https://Stackoverflow.com/users/982639/" ]
You can develop your own timestamping service. You can write TSP (RFC 3161) server but Authenticode doesn't use RFC 3161 but PKCS#7/PKCS#9 formats as described in [MSDN article](http://msdn.microsoft.com/en-us/library/windows/desktop/bb931395%28v=vs.85%29.aspx) (which you can implement as well). Our [SecureBlackbox](ht...
You need to write a custom HTTP Timestamp server. It should follow [RFC 3161](http://www.ietf.org/rfc/rfc3161.txt) Time-Stamp Protocol (TSP) rules. When you sign your DLL for authenticode with a tool such as [Signtool.exe](http://msdn.microsoft.com/en-us/library/windows/desktop/aa387764%28v=vs.85%29.aspx) from the Win...
35,129,648
I have a simple front-end that accepts all incoming requests and serves mostly static content written in PHP. I forward qualified requests from PHP to the backend using curl and serving the responses again to the user. I have two (the number might increase over time) similar back-ends doing the heavy lifting. I want t...
2016/02/01
[ "https://Stackoverflow.com/questions/35129648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1548788/" ]
A simple front-end cloud load-balancer should be sufficient. Enable the following apache modules : ``` a2enmod proxy proxy_http proxy_balancer ``` Then, open your `/etc/apache2/conf.d/proxy-balancerconfigure` and configure the modproxybalancer by adding the following lines : ``` BalancerMember http://10.0.0.1 Ba...
nginx is pretty easy to configure for load balancing: <http://nginx.org/en/docs/http/load_balancing.html>
31,864,391
Everytime I have to get the latest changes from the repo I have to stash my changes then do a pull and then unstash my changes again, this process gets very tedious when there's a lot of people working on the project and you have to do this many times a day. I was wondering if there's a git command that does that.
2015/08/06
[ "https://Stackoverflow.com/questions/31864391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4199880/" ]
You can write a shell alias or a git command alias to do this. ``` [alias] update = !git stash save -u && git pull && git stash pop ``` I threw `-u` in there to stash untracked files as well in case the pull adds them.
Running `git pull --rebase` may be what you are after. > > `-r` > > `--rebase[=false|true|preserve]` > > > When `true`, rebase the current branch on top of the upstream branch after fetching. If there is a remote-tracking branch corresponding to the upstream branch and the upstream branch was rebased since last ...
211,675
During the first scene of *Age of Ultron* we see that von Strucker's HYDRA base is protected by an electromagnetic shield developed on top of a Chitauri technology. [![[blue shield shimmering on the base](https://i.stack.imgur.com/zplTQ.jpg)](https://i.stack.imgur.com/zplTQ.jpg) The Avengers base seen in *Age of Ultr...
2019/05/04
[ "https://scifi.stackexchange.com/questions/211675", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/67417/" ]
The Avengers probably never anticipated a direct attack on their facility. We don’t see one in the MCU > > until the last hour of *Avengers: Endgame*. > > > The team is generally responding to threats elsewhere; upstate New York seemingly isn’t where bad stuff tends to happen. The metal curtains in question (th...
The Avengers were probably confident that nobody would dare attack their facility due to their formidable reputation.
129,469
I install Eclipse from the Software Center so it links up and will be updated with the rest of my software. Because I am developing for Android, however, I have to install the ADT Plugin within Eclipse by going to Help > Install new software (or something to that effect). Now, I do understand that I can update Eclipse ...
2012/05/01
[ "https://askubuntu.com/questions/129469", "https://askubuntu.com", "https://askubuntu.com/users/59004/" ]
The best solution is to become root using su or by logging in as the root user from the start, if you have that ability (Ubuntu users don't, unless they fixed that defect). Anyhow, once you are root, do a **chown -R user:group** to the path for your eclipse installation. Then your regular user should be able to instal...
To add up on @Garry's answer, what I did is create a "dev" group, add my user to it, and `chgrp -R dev <eclipse dir>`. You might want to `chmod -R g+w <eclipse dir>` as well to make sure you can write to it.
63,939,302
I have different queries for fetching data from a large table (about 100-200M rows). I've created partial indexes for my table with different predicates to fit the query because I know each query. For example, the table similar to this: ```sql CREATE TABLE public.contacts ( id int8 NOT NULL DEFAULT ssng_generate_i...
2020/09/17
[ "https://Stackoverflow.com/questions/63939302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7087479/" ]
Yes, with a partial index you only pay the overhead of modifying the index for rows that meet the `WHERE` condition, so you will always only need to modify at most one of the indexes at the same time (unless you change `state_id` from 10 to 20 or vice versa).
Partial indexes which are not relevant to the tuple will not get updated. If PostgreSQL can do a HOT update (if the column being changed is not part of an index, and there is room on the same page for the new tuple), then even the relevant index doesn't need to get updated.
14,371
I am running a campaign in the Eberron (DnD) setting, but really, this question could apply to anyone running a game in a medieval setting. I wanted to know what level of detail/accuracy to include in the maps players purchase to provide the most realistic gaming experience. Certainly, it would be easiest to merely g...
2012/05/16
[ "https://rpg.stackexchange.com/questions/14371", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/3584/" ]
Think about what the purpose of such a map is. Medieval maps tend to fall into three categories: * road maps (for travelers by road) * coastal maps for (travelers by sea) * maps of the world (for general information) --- Road Maps ========= If it's for pilgrims and merchants traveling by road, it'll have all the ma...
Take a look at [Old Maps Online](http://www.oldmapsonline.org/); which has a large collection of historical maps available. One Caveat; despite the timeline slider going back as far as 1000AD; there don't appear to be any maps from before the mid 16th century available.
46,993
I'm getting this warning from my server console (and just happens to be for the same player each time). I'm the only mod of the server so I know no one is using commands to teleport themselves and even if they did it would leave a log. What causes this warning?
2012/01/14
[ "https://gaming.stackexchange.com/questions/46993", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/11929/" ]
This warning is generated every time a player moved to a position or at a speed which the server thinks is impossible. This can happen spuriously, as the assumptions the server makes aren't quite the same as what you can actually do (the server doesn't analyze the player's exact inputs), or it can happen due to an atte...
It means that, from the perspective of the server, someone did something that *should* be impossible. This usually means flying or falling into the void.
446,215
Showing one's true colors applies to a situation where a person did something that you perceive as negative. For instance: I thought Jake was a nice guy, but at the club, he showed his true colors. Is there an idiom which would convey the idea that what a person did led you to perceive them positively thereafter? Co...
2018/05/15
[ "https://english.stackexchange.com/questions/446215", "https://english.stackexchange.com", "https://english.stackexchange.com/users/298756/" ]
**shine through** is a common way of latent or hidden ability coming on display > > [**shine through** at Cambridge.org](https://dictionary.cambridge.org/us/dictionary/english/shine-through) > > > — phrasal verb with shine UK ​ /ʃaɪn/ US ​ /ʃaɪn/ verb shone or shined > ​ > If a quality shines through, it is strong ...
> > I thought Jake was a nice guy, but at the club, he ***was a revelation***. > > > TFD(idioms): > > **[be a revelation](https://idioms.thefreedictionary.com/revelation)** > > To be different than one anticipated, **often in a good way**. > > Dana's performance in the play **was a revelation**—I had > ...
105,702
I bought 20"\*28" Umbrella Softbox Reflector for Speedlight (Model: 6Y19. [Details & dimensions](https://www.ebay.com/itm/Portable-50-70cm-20-28-Umbrella-Softbox-Reflector-for-Speedlight-NEW-6Y19-/131620730987?_trksid=p2047675.m43663.l10137&nordt=true&rt=nc&orig_cvip=true)), assuming I can just mount it on my light sta...
2019/03/05
[ "https://photo.stackexchange.com/questions/105702", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/75867/" ]
1. The link of the product is broken, but I am assuming it is simply the softboxes that have an umbrella mechanism inside to open, the flash is inside and the way to hold it is using the umbrella's rod. 2. Do not use the mount you are linking, because it is for continuous light, aka, 4 lightbulbs. 3. Look for a thing c...
My first guess would be to use a gobo-head or a magic arm combined with uni-clamps - the possibilities are endless. I don't know what your sticks are, what kind of contacts and screws you are talking about.
36,440,185
Currently I have created VBA code in worksheet 1 "Sheet1" as ``` Private Sub Worksheet_Activate () ``` So every time I open the worksheet the VBA code will auto run. But the problem I'm facing now is every time I open the Excel workbook, even though I added the codding in ThisWorkbook, ``` Private Sub Workbo...
2016/04/06
[ "https://Stackoverflow.com/questions/36440185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6133158/" ]
Using the [Worksheet.Activate method](https://msdn.microsoft.com/en-us/library/office/ff838003.aspx) won't do anything if that worksheet was already active. ``` Private Sub Workbook_Open() Application.ScreenUpdating = False Worksheets("Sheet2").Activate Worksheets("Sheet1").Activate Application.ScreenU...
Make the `Worksheet_Activate` `Public` instead of `Private`, then run `Worksheet("???").Worksheet_Activate` within you `Workbook_Open` code.
25,969
I'm working on a software development project on a team with only two persons and it's not an option to consider hiring more people. This appears to be a case where one has to **respond to change over following a plan** because the team is small in comparison to the ideal 5-6 people. Do you happen to know successful ...
2019/03/07
[ "https://pm.stackexchange.com/questions/25969", "https://pm.stackexchange.com", "https://pm.stackexchange.com/users/27189/" ]
You can adopt agile with any size of team as it is an *approach* to doing software development. As you mention in your question, one of the key aspects is to favour responding to change over following a plan. It gets a bit more complicated if you are talking about using agile *frameworks*. [The Scrum Guide](https://s...
As with any team, as project manager you need to allow them to manage themselves whenever possible. This is because project managers rarely have direct line management authority over the teams. The team will need to: Agree the work (scope) to deliver Understand and agree the quality of each item in the scope Plan thei...
35,996,604
``` #include <iostream> using namespace std; class Distance { private: int feet; // 0 to infinite int inches; // 0 to 12 public: // required constructors Distance(){ feet = 0; inches = 0; } Distance(int f, int i){ feet = f; inches = i; } // method...
2016/03/14
[ "https://Stackoverflow.com/questions/35996604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4655470/" ]
> > if a instance of Distance is to be returned in operator-() function shouldn't it be returned like `new Distance(feet,inches)` > > > No, `new` isn't necessary here. Just return a copy. Actually the implementation of the negation operator should look like ``` Distance operator- () const { return Distance(-...
It appears to work due to the following reasons: 1. Internally the variables feet and inches being negated i.e., mutable values. 2. Then printing the value of D1 or D2 as the case may be. 3. Ignoring the objects being returned from the operator, which is wrong. The unary operator overloading should have been: ``` Di...
177,549
Is there a word meaning both import and export? So I can ask "Is this product both importable and exportable?" like "Is this product \_\_\_\_?"
2014/06/12
[ "https://english.stackexchange.com/questions/177549", "https://english.stackexchange.com", "https://english.stackexchange.com/users/80048/" ]
In the specific example you mentioned (i.e. politics), it's called [*mudslinging*](http://www.thefreedictionary.com/mudslinging): > > the use of insults and accusations, especially unjust ones, with the aim of damaging the reputation of an opponent; efforts to discredit one's opponent by malicious or scandalous attac...
This only covers the selective use of evidence, rather than doing so against a particular figure, but [cherry picking](http://en.wikipedia.org/wiki/Cherry_picking_%28fallacy%29) may be a useful term. > > Cherry picking, suppressing evidence, or the fallacy of incomplete > evidence is the act of pointing to individua...
2,340,755
i have two excel sheets An example of the two sheets are below ``` sheet1 a 1 b 2 d 1 e 3 g 1 sheet2 a b c d e f ``` i want to put a formula in b1 of sheet 2 and drag it down so that the resulting sheet 2 is ``` sheet2 a 1 b 2 c 0 d 1 e 3 f 0 explanation : - a = 1 because same value in book1 ...
2010/02/26
[ "https://Stackoverflow.com/questions/2340755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/193133/" ]
A combination of if(), iserror() and vlookup() will be your best bet here. Assuming your data from sheet1 is in a range called 'refdata', ``` =IF(ISERROR(VLOOKUP(A1,refdata,2,FALSE)),0,VLOOKUP(A1,refdata,2,FALSE)) ``` should do what you need (Where A1 is the cell containing the data you want to match on)
In Excel 2007 it looks like this: ``` =IFERROR(VLOOKUP(A1,sheet1data,2,0),) ```