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 |
|---|---|---|---|---|---|
23,763,695 | I have a Fortran formatted text file (here is 3 first rows):
```
00033+3251 A B C? 6.96 5.480" 358 9.12 F0V 0.00 2.28s 1.00: 2MASS, dJ=1.3
00033+3251 Aa Ab Aab S1,E 0.62 0.273m 0 9.28 F0V 11.28 K2 1.68* 0.32* SB 1469
00033+3251 Aab Ac A E* 4.26 0.076" 0 9.12 ... | 2014/05/20 | [
"https://Stackoverflow.com/questions/23763695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2579566/"
] | ```
columns = ((0,10),(11,14),(15,18),(19,22),(23,29),(30,35),
(36,44),(44,45),(46,49),(50,55),(56,61),(62,67),
(68,73),(74,79),(79,80),(81,86),(86,87),(88,108))
string=file.readline()
dataline = [ string[c[0]:c[1]] for c in columns ]
```
note the column indices are (start... | This type of file can be read with astropy tables. The header you show looks a lot like a CDS-formatted ascii table, which has a specific reader implemented for it:
<http://astropy.readthedocs.org/en/latest/api/astropy.io.ascii.Cds.html#astropy.io.ascii.Cds> |
48,300,750 | **Please don't mark as duplicate this question without understanding.**
**I have gone through all answers which are available but none is able to resolve my issue.**
**Scenario:** I have to add Sections with feature of expand and collapse on click, these sections are dynamic as per API response. So I have taken On xm... | 2018/01/17 | [
"https://Stackoverflow.com/questions/48300750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2741598/"
] | I *think* this is what is going on. I wish the AWS docs would explicitly state it.
Bookmarks alone would only let you pick up at the next piece of data (e.g. next file in S3). But for a complex job with Dynamic Frames, the job itself it stateful. To resume processing, you need to not only pick up with the next piece o... | As mentioned in this [link](https://docs.aws.amazon.com/glue/latest/dg/monitor-continuations.html), `transformation_ctx` parameter is used for job bookmarks. If you don't want to enable job bookmark then don't pass the parameter.
Moreover, if you want to use job bookmarks, then enable the job bookmark parameter and pa... |
41,873,321 | I'm using TinyMCE WYSIWYG editor in my html form. I want to change icons (16x16 images) of existing toolbar buttons, i.e. bold button, italic button, etc. The idea is to put my own drawings instead of basic **B**, ***I***, etc icons.
I found how to add a brand new button with my custom icon to toolbar via `tinymce.Edi... | 2017/01/26 | [
"https://Stackoverflow.com/questions/41873321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6775670/"
] | I found the solution, but probably you know easier ways, so feel free to answer.
It could be done by creating your own skin for TinyMCE. But skins don't look easy to create and [TinyMCESkinCreator](http://skin.tinymce.com/) doesn't seem help in deep customization. So I found [cool third-party skin](http://tinymceplug... | try this
<https://www.tinymce.com/docs/configure/content-appearance/>
<http://www.wpbeginner.com/wp-tutorials/how-to-add-custom-styles-to-wordpress-visual-editor/>
[How to apply CSS on custom buttons in tinyMCE active editor popup](https://stackoverflow.com/questions/37185129/how-to-apply-css-on-custom-buttons-in-tin... |
8,192,569 | I have a shell script which conditionally calls a function.
For Example:-
```
if [ "$choice" = "true" ]
then
process_install
elif [ "$choice" = "false" ]
then
process_exit
fi
process_install()
{
commands...
commands...
}
process_exit()
{
commands...
commands...
}
```
Please let me know how to accomp... | 2011/11/19 | [
"https://Stackoverflow.com/questions/8192569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/626206/"
] | ```
#!/bin/bash
process_install()
{
commands...
commands...
}
process_exit()
{
commands...
commands...
}
if [ "$choice" = "true" ] then
process_install
else
process_exit
fi
``` | Example of using a function() in bash:
```
#!/bin/bash
# file.sh: a sample shell script to demonstrate the concept of Bash shell functions
# define usage function
usage(){
echo "Usage: $0 filename"
exit 1
}
# define is_file_exists function
# $f -> store argument passed to the script
is_file_exists(){
loca... |
255,926 | This is all being done in an ASP.NET web forms application:
I need a modal popup that will show the user a preview of images that match a search criteria (e.g. they search for "dog" and the popup shows them all dog-related pictures). The search results shouldn't be too long, but the popup should support the ability to... | 2008/11/01 | [
"https://Stackoverflow.com/questions/255926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1574/"
] | i prefer the use of jquery because it doesnt require the use of any server-side computations. also if the app ever ported to another technology other than asp.net it will still most likely work. | I'd say go with ours; [Ajax Calendar Starter-Kit](http://ra-ajax.org/samples/Viewport-Calendar-Starter-Kit.aspx) (click the button to the lower left corner) but then again I am definitely biased... |
69,615,183 | I will try to be brief!
For whatever reason, I couldn't make the entirety of my program in python, so I had to outsource one specific task to php (a language I do not know very well). As the python program runs, it is supposed to trigger the php program to run, and then do a few things afterwards which is not a proble... | 2021/10/18 | [
"https://Stackoverflow.com/questions/69615183",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9120674/"
] | Whenever, I saw this problem. I restarted the computer and it working immediately.
I recommend trying this solution. | It happened to me because of the node.js version and an npm update.
1. Uninstall nodejs
2. Delete folder C:\Users\Administrator\AppData\Roaming\npm
3. Install nodejs (v17.x)
4. In your project folder:
```
npm install -g npm@8.3.2
npm i --package-lock-only
npm audit fix --force
```
It worked for me. I hope it helps ... |
34,771,409 | I have used [NSSM](https://nssm.cc/) to create a Windows Service for my **Selenium Server** instance (**v 2.48.2 of the Selenium Server Standalone JAR**).
I have also set the service to log on as a Local System Account, and have allowed the service to interact with the desktop. When I have used a particular account fo... | 2016/01/13 | [
"https://Stackoverflow.com/questions/34771409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2414019/"
] | You can take advantage of the built-in Sqoop metastore
You can create a simple incremental import job with the following
command:
sqoop job \
--create <> \
--\
import \
--connect <> \
--username <> \
--password <> \
--table <> \
--incremental append \
--check-<> \
--last-value 0
And start it with the --exe... | One way to get it:
Create log table in database and develop incremental import as follows
```
Query the log table using sqoop eval command with the last value from last run
Run the sqoop import
Update the log table with the latest valueusing sqoop eval command
```
You need to automate the process of `sqoop eval`, `... |
6,531,459 | while displaying address from database I have added `,` at the end of each value. when last value of address in empty am getting `,` along with the last value. But I don't want that. Can any one help?
```
if ($Fetch['addr']!=''){
echo $Fetch['addr'].',';
```
it is displaying
```
address,city,postalcode
```
... | 2011/06/30 | [
"https://Stackoverflow.com/questions/6531459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/810107/"
] | Insert your value in array and at the end of it use [`join`](http://php.net/manual/en/function.join.php) to convert array to string with:
```
$array[] = [Your Value Here];
$string = join ( ',' , $array )
``` | Use Substr() It will really helps!
```
$str = "abcde,";
$str = substr($str,'',-1);
```
Now this will remove , from String. |
226,307 | How can I install my Brother HL2270dw laser printer? There are no drivers available in the Software Center. | 2012/12/06 | [
"https://askubuntu.com/questions/226307",
"https://askubuntu.com",
"https://askubuntu.com/users/113151/"
] | I have a blog post on how to install the printer for wireless wifi printing in Ubuntu 12.04 64 bit. Note my version is specific and only tested for the 64 bit version of Ubuntu. Brother does not include 64 bit drivers for the HL-2270DW drivers but I have patched the drivers to make them work with the 64 bit version. Th... | I tried the instructions at the beginning of this post but when I got to the end, i.e.
When asked "Will you specify the DeviceURI?" choose "No" for USB connection or "Yes" for network connection.
I was given a list of eleven URIs to choose from, none of which made any sense to me as a neophite Ubuntu users. See below:... |
29,075,767 | Look at this example:
```
2.1.3 :001 > Stat.create!
(0.1ms) BEGIN
SQL (0.3ms) INSERT INTO `stats` (`created_at`, `updated_at`) VALUES ('2015-03-16 11:20:08', '2015-03-16 11:20:08')
(0.4ms) COMMIT
=> #<Stat id: 1, uid: nil, country: nil, city: nil, created_at: "2015-03-16 11:20:08", updated_at: "2015-03-16 ... | 2015/03/16 | [
"https://Stackoverflow.com/questions/29075767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2398521/"
] | The problem here is that you want to modify behavior for a class-level method. This is inherently not thread-safe, at the very least for concurrent transactions for other Stat objects. A simple workaround would be to flag the instance as not requiring a transaction:
```
class Stat < ActiveRecord::Base
attr_accessor ... | I don't know of any nice way of doing this
On ruby 2.2 you can do
```
stat = Stat.new
stat.method(:save).super_method.call
```
This won't work pre ruby 2.2 (that's when `super_method` was added) and only works because in the list of ancestors, transactions is the first (or last depending on which way you order) to ... |
58,658,474 | I have an A3-sized print document that contains images customer provide and it will fill up the document through calculation (There could sometimes be more than 300 images at once being computed to printDocument). The problem I am facing now is that when it is sent to the printer the document is too big for the printer... | 2019/11/01 | [
"https://Stackoverflow.com/questions/58658474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6293799/"
] | You can use external library [Gson](https://www.baeldung.com/gson-string-to-jsonobject)
```
Gson gson=new Gson();
/*You can convert to your DTO as well */
Map<Object,Object> map = gson.from(myJsonObject,Map.class);
```
Other way is using objectmapper [example](https://www.baeldung.com/jackson-object-mapper-tutori... | I have created a small class for this purpose which can basically get value from json using a path only used google.gson
<https://github.com/izeryab/JsonParser>
Here is how to use this for getting nested value from json:
```
public class Main {
public static void main(String[] args) {
String json = "{\"... |
4,066,763 | I am looking for some help regarding the pointer dereference operator **`->`** . Let me describe what I am trying to do.
I am implementing a unidirectional iterator for a special container. The container is special in the sense that it does not physically allocate any space for the contained values but generates them ... | 2010/11/01 | [
"https://Stackoverflow.com/questions/4066763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485493/"
] | Here is the answer to answer your questions, though I do not think they are so useful as you might hope:
* Yes, it is a unary operator
* No, it does not care what `member` is. If `member` isn't a field/member of the class/struct pointed to be the return of `operator ->` then the compiler will complain.
* `member` coul... | Much of it is answered by others. I'd still like to share how -> operator overloading works.
When we do `pA->Function()`, something like this happens behind the scenes `(pA.operator->())->Function()`
In RAII framework, the pointer class needs to behave as if it were an actual pointer. So one needs to overload the ar... |
57,024,549 | I am learning how to use Hyperledger fabric and Chaincode. Basically, I followed this [link](https://medium.com/coinmonks/hyperledger-fabric-account-based-wallet-java-chaincode-8cbf80a6fb82) to create a Java chain code in Hyperledger fabric, but I can't invoke my chain code in the cli/channel.
I used `BYFN.sh` from Hy... | 2019/07/14 | [
"https://Stackoverflow.com/questions/57024549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11781507/"
] | You are specifying same port number for peer0.0rg1.example.com and peer0.0rg2.example.com in your command. if you have created you network using byfn topology peer0.org2 listens on port 9051. Also, when asking these type of question, it's always better to provide your configuration i.e docker-compose.yaml files. That i... | You could check out the free tool Chaincoder on <https://www.chaincoder.org>, which is a great start for beginners. It uses standard CLI to for fabric network, chaincode, channels... within an IDE. |
209,269 | I am currently twirling around in circles trying to find this word. I've heard it used before, and I want to use it in something I am writing, but I can't remember it. On the tip of my brain, but not falling off.
Anyway, the word means something like to state the obvious truth, and it is so obvious that there is littl... | 2014/11/20 | [
"https://english.stackexchange.com/questions/209269",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/20156/"
] | A term that comes to mind from logic is [*vacuous truth*](http://en.wikipedia.org/wiki/Vacuous_truth) (statement of what cannot be untrue), like WP's example:
>
> [The] statement 'all cell phones in the room are turned off' may be true simply because there are no cell phones in the room."
>
>
>
Another from logic... | Are you thinking of an [*axiom*](http://www.thefreedictionary.com/Axiom)?
>
> A self-evident or universally recognized truth
>
>
>
There's also an [*aphorism*](http://www.thefreedictionary.com/aphorism):
>
> a terse saying embodying a general truth or astute observation.
>
>
>
Along the lines of axiom is *m... |
47,996,071 | I have a TAB file something like:
```
V I 280 6 - VRSSAI
N V 2739 7 - SAVNATA
A R 203 5 - AEERR
Q A 2517 7 - AQSTPSP
S S 1012 5 - GGGSS
L A 281 11 - AAEPALSAGSL
```
And I would like to check the last column respect to the ord... | 2017/12/27 | [
"https://Stackoverflow.com/questions/47996071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8405531/"
] | You can try this awk, it's not perfect but it give you a starting point.
```
awk '{i=(match($6,$1));if(i==1)print;else{a=$6;b=substr(a,i);c=substr(a,1,(i-1));$6=b c;print}}' OFS='\t' infile
``` | ```
gawk '
BEGIN{
OFS="\t"
}
$6 !~ "^"$1".*"$2"$" {
$6 = gensub("(.*"$2")("$1".*)", "\\2\\1", 1, $6)
}
{print}
' input.txt
```
**Output**
```
V I 280 6 - VRSSAI
N V 2739 7 - NATASAV
A R 203 5 - AEERR
Q A 2517 7 - QSTPSPA
S S 1012 5 - SGGGS
L A 281 ... |
5,704 | I'm considering getting a Kindle, but am still doubting as to whether the 3G model is worth the extra expense. As I'm also considering getting an iPhone later: on the off chance that I'd ever want to buy a book without a WiFi hotspot nearby, wouldn't it be possible to share an iPhone's 3G connection with the Kindle thr... | 2010/12/30 | [
"https://apple.stackexchange.com/questions/5704",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/2184/"
] | For information about the full article “iOS 4.3 lets iPhone 4 host wifi over 3G”
<http://devicegadget.com/apple/ios-4-3-lets-iphone-4-host-wifi-3g/1320/>
Thx.. ;) | 1. You can create a mobile hotspot with an iPhone (if you pay your carrier for the privilege and your carrier supports it)
2. A Kindle Fire (which is WiFi only) can connect to a mobile hotspot created by an iPhone to connect to the Internet.
Given 1 and 2, I assume a "regular" Kindle can do the same.
ps - The mobile ... |
12,002,987 | I want to edit my .htaccess to prevent the current folder plus all subfolders to cache content. The site contains html, images, swf, xml files.
I tried this, but the server did not like that.
```
<FilesMatch ".(js|css|pdf|swf)$">
Header set Cache-Control no-cache
</FilesMatch>
```
>
> Internal Server Error
>
>
>... | 2012/08/17 | [
"https://Stackoverflow.com/questions/12002987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/473841/"
] | Here are few tips that can lead you to a solution :
1- [kernel infos](http://linux.die.net/man/2/uname)
2- You can get that information in `/proc/cpuinfo`.
Google for 'Proc Filesystems'.
3- [extract system infos](http://www.daniweb.com/software-development/c/threads/33551/c-program-to-extract-system-info)
4- Anothe... | You'll need to follow three steps:
1) use system() or popen() to invoke shell command or utility from your program. (refer: [this](http://www.cs.uleth.ca/~holzmann/C/system/shell_commands.html))
2) Decide on a utility from [this list](http://www.cyberciti.biz/tips/how-do-i-find-out-linux-cpu-utilization.html), to gen... |
1,019,907 | I have various time-series I'd like to correlate and present as either a csv-file or in-memory datatable (.NET). These time-series are arrays of time-value-pairs (actually these are objects containing more than just time and value). The time-series may span across different overlapping periods, and some might even have... | 2009/06/19 | [
"https://Stackoverflow.com/questions/1019907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32671/"
] | You might go with a data structure like a nested dictionary and iterate over the contents:
```
Dictionary <TimeSeries, Dictionary<DateTime, Value>> dict = new Dictionary<TimeSeries, Dictionary<DateTime, Value>>();
foreach (TimeSeries series in dict.Keys) {
//table row output code goes here
Dictionary<DateTim... | Hey Chris. I realize you've already accepted an answer, but thought I'd post a solution I use. Hopefully it's of some use to someone. If not at least it provides a place for me to find it sometime in the future. :-)
This is VBA code fired off directly from an Excel 2007 code module. It could be easily converted to .Ne... |
18,968,020 | I need to compare the first element of two different files *after* a certain phrase. So far I have this:
```
import re
data1 = ""
data2 = ""
first = re.match(r".*Ignore until after this:(?P<data1>.*)", firstlist[0])
second = re.match(r".*Ignore until after this:(?P<data2>.*)", secondarray[0])
data1 = first.group('dat... | 2013/09/23 | [
"https://Stackoverflow.com/questions/18968020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2661085/"
] | You're probably just having issues because of the newlines in your file. As Martijn Pieters pointed out in the comments to your questions, you can use the flag re.DOTALL to capture everything. So with a file like so, (named `tmp` in this example)
```
Random text
More random text
Even more random text
Ignore until a... | The dot '.' character in regular expressions matches any character except a newline. So if you have your entire file as a single string, then the regular expression is matching up to the first new line, then trying to match your phrase against the start of the next line. When this fails, it returns a NoneType.
See [th... |
6,101,473 | Help. For the past two days I've tried to get Solr to index the exampledocs. I've learned a lot, but am completely stuck. I've tried it on two different Windows 7 PCs.
I'm following the basic tutorial at <http://lucene.apache.org/solr/tutorial.html>, I tried with Solr 1.4 and 3.1. I can get to the Solr admin page just... | 2011/05/23 | [
"https://Stackoverflow.com/questions/6101473",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/766447/"
] | Either
```
PlusMinusDiv mathBase = new PlusMinusDiv();
mathBase.Div(10,20);
```
or
```
IMathBase mathBase = new PlusMinusDiv();
((PlusMinusDiv)mathBase).Div(10,20);
``` | There are a couple of ways you could handle this, you could:
1.Simply add the new method to the interface definition, and update any existing implementations.
2.As above, but use an abstract base class which can provide a default implementation. That way any existing implementations that inherit from your abstract ba... |
21,479 | Does the main character in a short story need a name? My story gives lots of other details about the character. | 2016/03/25 | [
"https://writers.stackexchange.com/questions/21479",
"https://writers.stackexchange.com",
"https://writers.stackexchange.com/users/18369/"
] | Presently, the most talked about television show is the Star Wars series "The Mandolorian" which is about a member of the Mandolorian Culture and his adventures with a young member of the species to which Jedi Master Yoda belongs to. At time of writing, four episodes have been released and neither character has been na... | It's a lot easier to think of the character if s/he has a name, but it isn't strictly required. In Daphne DuMaurier's *Rebecca*, the first-person narrator is never named, and is only known as "the second Mrs. De Winter." |
73,856,942 | I have a issue with my number to string implemention. For some reason I keep getting 000 on my terminal even though. I couldn't find a solution, what is the potantial issue here?
Im now sure my code is broken but don't really see the problem.
```
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/* public dom... | 2022/09/26 | [
"https://Stackoverflow.com/questions/73856942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19508355/"
] | You just want `num2str` to return the digit string for `n`.
A few issues:
1. `finddigits` is supposed to calculate the number of digits in `n`. But, [if it works at all], it uses an algorithm I've never seen.
2. `finddigits` isn't needed in `num2str` as `num2str` can be [much] simpler by filling the buffer in the rev... | Mathematics is also "public domain". Here are two versions of one of your functions, shown with a `main()` that tests both versions with several values.
Don't convert a signed integer value to unsigned for no particular reason. If you need/want the *absolute* value of a (possibly) negative number, C provides a functio... |
25,136,610 | I have the structure like the following in my Xcode project.

I need to read all the images from project and need to store it in array.
I have used the following code from some other StackOverflow posts, but it's not working.
```
NSFileManager *fil... | 2014/08/05 | [
"https://Stackoverflow.com/questions/25136610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2241037/"
] | `- (NSArray *)pathsForResourcesOfType:(NSString *)extension inDirectory:(NSString *)subpath` will get you the array you want.
```
NSArray *imagesArray = [[NSBundle mainBundle] pathsForResourcesOfType:@"png" inDirectory:@"Images"];
``` | Please use this code, hope it will work.
```
NSString *dirPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"images"];
NSError * error;
NSArray * images = [[NSFileManager defaultManager]
contentsOfDirectoryAtPath:dirPath error:&error];
``` |
108,244 | Let's assume a JPG file (or any other image/video file format), that I duplicate the file, and I modify the tags on the copy. Is there a way to verify that the image inside both JPG files is actually the same? I mean, if I do a digest of both files, I will obviously get a different hash. But is there a way to extract f... | 2019/05/13 | [
"https://photo.stackexchange.com/questions/108244",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/84758/"
] | Here's a quick and dirty solution with `exiftool` and `cmp`:
1) Make copies of the two image files:
```
cp img1.jpg tmp1.jpg
cp img2.jpg tmp2.jpg
```
2) Use `exiftool` to remove metadata:
```
exiftool -all= tmp1.jpg
exiftool -all= tmp2.jpg
```
3) Use `cmp` to compare the temporary files:
```
cmp tmp1.jpg tmp2.j... | If you think the only difference is metadata (which is enough to break comparison of finger prints), you can extract the [actual data](https://en.wikipedia.org/wiki/JPEG#Syntax_and_structure) without decoding it. Be careful that JPEG is really two formats: the old [JFIF](https://en.wikipedia.org/wiki/JPEG_File_Intercha... |
15,659,471 | CODE:-
```
List<Task> tasks = new List<Task>();
foreach (var item in arr)//arr contains 1000+ mailids
{
tasks.Add(Task.Factory.StartNew(() =>
{
using (MailMessage msg = new MailMessage())
{
msg=getmsg();... | 2013/03/27 | [
"https://Stackoverflow.com/questions/15659471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1079808/"
] | Regarding the exception 'net\_io\_connectionclosed', please look at this link as it might point you in the right direction about why the connection is being closed. It could be authentication problems, firewall etc.
[Enabling Tracing for System.Net](http://blogs.msdn.com/b/feroze_daud/archive/2005/05/12/416922.aspx)
... | As Jim mentions, you're likely just hitting a throttling/rejection situation. IMHO, you're likely to be more successful by 1) using a single SmtpClient rather than N of them (so the single client could internally serialize as/if necessary) and 2) using the built-in async call ([SendMailAsync](http://msdn.microsoft.com/... |
9,589,907 | Im trying to run the following to import a large volume of sales data in a text file into a database. When i run the following i get the error: "Invalid object name 'PetDatabase.Sales'
```
BULK INSERT PetDatabase.Sales
FROM 'C:\Temp\P1.txt'
WITH
(
FORMATFILE = 'C:\Temp\PetSales.Fmt'
);
```
Can anyone see whats ca... | 2012/03/06 | [
"https://Stackoverflow.com/questions/9589907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1091114/"
] | Ignore this answer. It was written when the question was tagged with `mysql`. Leaving the answer here to keep the comments.
--
Try using `LOAD DATA INFILE` instead.
<http://dev.mysql.com/doc/refman/5.1/en/load-data.html> | 1. Make sure PetDatabase.Sales exists in your text file.
2. Swap for whichever row and field terminator delimiters you're using. Here I'm using delimiters from a comma separated file
BULK INSERT PetDatabase
FROM 'c:\temp\p1.txt'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO
--Check the content of the table.
... |
159,455 | Given a matrix, e.g.
```
matrix = Table[a[i, j], {i, 1, 3}, {j, 1, 3}];
```
I would like to have a function that takes `matrix` as input and returns a list of matrices representing all possible dihedral transformations of `matrix` (all possible simultaneous reflections and rotations along all columns and/or all rows... | 2017/11/08 | [
"https://mathematica.stackexchange.com/questions/159455",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/5517/"
] | Let's denote a matrix by a simple notation:
```
M[a, b, c, d, e, f, g, h, q]
```
such that the matrix form is recovered by the substitution:
```
subM = {M[x__] :> MatrixForm[Partition[{x}, Sqrt[Length[{x}]]]]};
M[a, b, c, d, e, f, g, h, q] /. subM
```
>
> [
Anyo... | 2012/11/24 | [
"https://Stackoverflow.com/questions/13546738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/241654/"
] | The sass compile times became significantly longer with the update from sass 3.1.x to 3.2.x.
There seems to be a specific concern as per Roman's response above, it's caused if you use `@extend` in deeply nested selectors since '@extend' does a lot of processing work. [Here is the link to a currently open issue on th... | In my case it was because of too frequent use of the @extend directive. |
531,329 | When we write the Lagrangian $\mathcal{L}=\frac{1}{2}m\dot{x}^2-U(x)$, where $U$ is the potential energy, we are assuming that the mass $m$ is constant, the only variables being the velocity $\dot{x}$ and position $x$. What can be done to determine the equation of motion of the particle in case the mass is changing?
I... | 2020/02/15 | [
"https://physics.stackexchange.com/questions/531329",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/237982/"
] | If you just give the mass an explicit time-dependence,
$$L = \frac12 m(t) \dot{x}^2 - U(x)$$
then the Euler-Lagrange equation is
$$\frac{d}{dt} (m \dot{x}) = \dot{m} \dot{x} + \dot{m} \ddot{x} = - \frac{dU}{dx}.$$
It's unclear to me why you think "we simply cannot use" this result. It isn't Galilean invariant, but once... | Im my previous naswer, I included a terms of order $dt$ in the Lagrangian. It makes the variation somewhat awkward. After some thoughts, I find it is rather nature to employ the dissipation function and incorporated as a generalized force [Rayleigh Dissipation](https://en.wikipedia.org/wiki/Rayleigh_dissipation_functio... |
223,062 | Using [answer about microphone](https://electronics.stackexchange.com/a/36809/18643) I have built a simple amplifier.

[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fzw9Yz.png) – Schematic created using [CircuitLab](https://www.circu... | 2016/03/16 | [
"https://electronics.stackexchange.com/questions/223062",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/18643/"
] | Do you own a car? It's a very easy experiment, just turn everything electric on and you can "feel" the engine working harder.
The reason for this is the magnetic field every current creates.
Under no load you have the spinning magnetic field from the rotor, which creates a voltage in the stator.
If there is a load a ... | The answer is Yes, Yes, Yes. (I'm a rusty electrical engineer)
Anything else would be a violation of 2nd law of thermodynamics.
Let's start with a simple magnetic moving across a coil.
If you then put a load on the coil, such as a resistance, then swiping the magnetic will attempt to induce a current, which will be li... |
30,941,365 | I tried to play with Database creation and queries. In order to do that I started a C# form application, added a Database Service then added a Table with some values, then I wanted to use some code to retrieve those values.
Here's the code:
```
string conn = "data source = ./SQLEXPRESS; AttachDbFilename=C:\\Users\\As... | 2015/06/19 | [
"https://Stackoverflow.com/questions/30941365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5028734/"
] | It looks like the data source part your connection string is wrong. It should be:
```
"Data source=.\\SQLEXpress"
```
Complete:
```
string conn = "Data source=.\\SQLEXpress; AttachDbFilename=C:\\Users\\Asus\\Desktop\\RobaMia\\SQLSERVER\\WindowsFormsApplication3\\WindowsFormsApplication3\\Database1.mdf; Integrated S... | Have you tried(LocalDB), instead of SQLExpress?
```
"Server=(localdb)\\Test;Integrated Security=true;AttachDbFileName= myDbFile;"
```
<http://www.asp.net/mvc/overview/getting-started/introduction/creating-a-connection-string> |
9,224,855 | >
> **Possible Duplicate:**
>
> [Can you write object oriented code in C?](https://stackoverflow.com/questions/351733/can-you-write-object-oriented-code-in-c)
>
>
>
Can I use C(not C++!!!) for Object Oriented Programming? | 2012/02/10 | [
"https://Stackoverflow.com/questions/9224855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1125374/"
] | There is a book: "Object-Orientated Programming with ANSI-C". | I was always under the impression that you couldn't. This is why: C++ was originally called "C with Objects." There might be a way to, in effect, fake OOP C, but I don't think that it's strictly 100% OOP.
greater minds will be able to clarify this, though |
67,761,348 | I want to use the Hilt in my project for getting the helper class object as the common for my activity. I have tried the below lines of code for it
**Manifest file** entry
```
<application
android:name=".application.AppController"
android:allowBackup="false"
```
My **AppController** class
```
@Hil... | 2021/05/30 | [
"https://Stackoverflow.com/questions/67761348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3946958/"
] | version of dependency for project level and app level must be same.
like :
classpath "com.google.dagger:hilt-android-gradle-plugin:2.38.1"
and
implementation "com.google.dagger:hilt-android:2.38.1"
kapt "com.google.dagger:hilt-android-compiler:2.38.1" | ```
implementation "com.google.dagger:hilt-android:2.38.1"
kapt "com.google.dagger:hilt-android-compiler:2.38.1"
implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03'
kapt 'androidx.hilt:hilt-compiler:1.0.0'
```
worked for me |
42,376,575 | I am learning C and Im writing a simple program where you enter number of days, and it says how much hours are in that days. For example, you enter 2 days, and it says there are 48 hours. There is no error, but the end result is not good.
Here is my code and my result
Code:
```
int day, hour;
hour= 24 * day;
printf(... | 2017/02/21 | [
"https://Stackoverflow.com/questions/42376575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7541617/"
] | You need to evaluate `hour` once `day` is known. You can't schedule an evaluation like that in C, if you get my meaning. (You can, interestingly in C++, using actors.)
Currently you are reading an uninitialised variable. The behaviour on doing that is undefined. | The variable `day` has not been filled yet; it likely contains junk data. To fix this, move the `int hours = day * 24` after the `scanf("%d",&day);`, this way the variable `day` will actually have the value scanned in. |
4,525,121 | In a Project Euler problem I need to deal with numbers that can have hundreds of digits. And I need to perform some calculation on the first 9 digits.
My question is: what is the fastest possible way to determine the first N digits of a 100-digit integer? Last N digits are easy with modulo/remainder. For the first dig... | 2010/12/24 | [
"https://Stackoverflow.com/questions/4525121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277683/"
] | You can count number of digits with this function:
```
(defn dec-digit-count [n]
(inc (if (zero? n) 0
(long (Math/floor (Math/log10 n))))))
```
Now we know how many digits are there, and we want to leave only first 9. What we have to is divide the number with 10^(digits-9) or in Clojure:
```
(defn first-digits ... | In Java:
```
public class Main {
public static void main(String[] args) throws IOException {
long N = 7812938291232L;
System.out.println(N / (int) (Math.pow(10, Math.floor(Math.log10(N)) - 8)));
N = 1234567890;
System.out.println(N / (int) (Math.pow(10, Math.floor(Math.log10(N)) - 8... |
265,765 | I would like to implement a payment solution with my Rails site using Paypal Website Payments Standard. (See <https://www.paypal.com/IntegrationCenter/ic_standard_home.html>). I don't want fancy gateways, and I don't want to go through the hassles related to storing credit card information. I also want to use Paypal IP... | 2008/11/05 | [
"https://Stackoverflow.com/questions/265765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33890/"
] | Both [Spree](http://spreehq.org/) and [Substruct](http://code.google.com/p/substruct/) are e-commerce platforms written in Rails that support Paypal IPN. Both are open source, so it might be helpful to start by looking at how they handle Paypal Integration. | [Spree](http://spreehq.org) contains an [extension](http://github.com/Gregg/spree-pp-website-standard/tree/master) for Payapl Website Payments Standard. In fact, the popular [envycasts](http://envycasts.com) site is a great example of this extension in use. If you want Rails and you want the Paypal Standard stuff, this... |
58,254,254 | I was writing some code in Python when I suddenly became curious regarding blank line conventions for import statements.
I'm aware of the [typical import statement conventions specified in the PEP 8 style guide](https://www.python.org/dev/peps/pep-0008/#imports) and for [blank lines](https://www.python.org/dev/peps/pe... | 2019/10/06 | [
"https://Stackoverflow.com/questions/58254254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7766024/"
] | Can you please try with adding .any() or .all() at the end of you np.select() statement?
```
df["AndHeathSolRadFact"] = np.select(
[
(df['Month'].between(8,12)),
(df['Month'].between(1,2) & df['CloudCover']>30)
], #list of conditions
[1, 1], #list of results
default=0).all() #default if... | EDITED:
I really have a elegant solution for you problem:-
```
from dask.array import from_array as fa
df.compute()['Name of you column'] = fa(the_list_you_want_to_assign_as_column)
``` |
19,372,667 | Since Clojure is designed to run in a Java virtual machine (JVM), I don't understand [this statement](https://nightweb.net/blog/clojure-on-android.html):
>
> While Clojure started its life mainly as a server-side language, the advent of ClojureScript demonstrates that the core developers don't see that as its only pu... | 2013/10/15 | [
"https://Stackoverflow.com/questions/19372667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3758484/"
] | Java is exactly as much of a server-side language as Ruby or Perl (though not really PHP): It's a general-purpose language that is frequently used to write server applications, including Web applications and SOA services. Whether Java is "installed as a default", it's typically trivial to install on the Unix machines t... | I don't know much about Clojure's history, but it seems clear that it has been intended as a general-purpose language for some time--whatever initially pushed Hickey et al. to want to develop it. Because Clojure supports easy access to existing Java libraries and is able to create standard Java-style jar files--both cr... |
39,071,202 | I have a function named `Keys()` to get all the keys of a map, here is the code:
```golang
func main() {
m2 := map[int]interface{}{
2:"string",
3:"int",
}
fmt.Println(Keys(m2))
}
func Keys(m map[interface{}]interface{}) (keys []interface{}) {
for k := range m {
keys = append(key... | 2016/08/22 | [
"https://Stackoverflow.com/questions/39071202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5046896/"
] | 1- Golang is strongly typed language, So the `map[int]interface{}` is not compatible with `map[interface{}]interface{}`.
`int` is different type than `interface{}`,
and see: [Go: What's the meaning of interface{}?](https://stackoverflow.com/questions/23148812/go-whats-the-meaning-of-interface)
2- No, Golang doesn'... | Starting from Go 1.18 (released in beta) the language adds type parameters and you are be able to easily write a function like this:
```
func Keys[K comparable, V any](m map[K]V) []K {
keys := make([]K, 0, len(m))
for k := range m {
keys = append(keys, k)
}
return keys
}
```
Example usage:
`... |
181,149 | I want to create a collection (List or Set) which can behave like Trigger.New context. Means If we use the collection out side of it's class, we should not be able to add any element in this collection. However we can change content of its existing element.
For example in Trigger.New collection of Account Trigger, I c... | 2017/06/29 | [
"https://salesforce.stackexchange.com/questions/181149",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/46652/"
] | There are several "magic" data types that we can't create in Apex Code. For example, we can't create read-only SObject records (as Trigger.new in an after trigger), lists that can't be modified (as in Trigger.new), and so on. You could write your own class to emulate this, but it wouldn't be a perfect replica, since we... | Just assign Trigger.new to an Account list and manipulate that one instead.
```
List<Account> accounts = new List<Account>();
accounts.addAll(Trigger.new);
Account tempAccount = new Account(Name='New Account to Add');
accounts.add(tempAccount);
``` |
11,158,439 | Given the following code:
```
string source = "Some Unicode String";
foreach( char value in source ) {
int y = (int)value;
}
```
Is it possible that the cast from char to int could fail (and under what circumstances)? | 2012/06/22 | [
"https://Stackoverflow.com/questions/11158439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143919/"
] | Use [`any?`](http://ruby-doc.org/core-1.9.3/Enumerable.html#method-i-any-3F):
```
@array.any? { |h| h[:status] == "B" }
``` | Just to add to what steenslag said:
`detect` ***doesn't always return nil.***
You can pass in a lambda to execute (call) if detect does not 'detect' (find) an item. In other words, you can tell `detect` what to do if it can't detect (find) something.
To add to your example:
```
not_found = lambda { "uh oh. couldn'... |
47,236,528 | I am trying to automate this website using VBA excel. I am stuck at one point where I need to select value from the drop-down box. I am very much new to this as this is my first such project.
This is what I have coded to select the value:
```
Set objSelect = objIE.document.getElementById("personTitle")
For Each opt I... | 2017/11/11 | [
"https://Stackoverflow.com/questions/47236528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8920890/"
] | I think you want a different class. The class in that HTML snippet is `select_list`. Then the subsequent `dt` tags.
If you observe the following CSS selector, where ["."](https://www.w3schools.com/cssref/sel_class.asp) means class and [" dt"](https://www.w3schools.com/cssref/sel_element_element.asp) means select all `... | Here are a couple options to try if you haven't already:
```
If opt.Value = "Miss" Then
'Debug.Print "found!"
opt.Click
```
OR
```
If opt.Value = "Miss" Then
'Debug.Print "found!"
opt.Focus
opt.FireEvent ("onchange")
```
If this turns out to be something done in kendoGrid or kendoDropDownList, I might be able to... |
35,539,924 | I am running linux (Debian) and I want to include the header `mpi.h` into my project. The `mpi.h` is located under `/usr/include/mpi` and running `mpiCC` and `mpirun` shows that it's installed. I couldn't find a clear tutorial. | 2016/02/21 | [
"https://Stackoverflow.com/questions/35539924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5940262/"
] | You should add `include_directories(/usr/include/mpi/)` to your CMakeLists.txt and just include the header:
```
#include <mpi.h>
``` | You should include the header file `mpi/mpi.h`
Like this
```
#include<mpi/mpi.h>
``` |
25,285,792 | When we sort a list, like
```
a = [1,2,3,3,2,2,1]
sorted(a) => [1, 1, 2, 2, 2, 3, 3]
```
equal elements are always adjacent in the resulting list.
How can I achieve the opposite task - shuffle the list so that equal elements are never (or as seldom as possible) adjacent?
For example, for the above list one of the... | 2014/08/13 | [
"https://Stackoverflow.com/questions/25285792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/989121/"
] | This is along the lines of Thijser's currently incomplete pseudocode. The idea is to take the most frequent of the remaining item types unless it was just taken. (See also [Coady's implementation](https://stackoverflow.com/a/25291640/2144669) of this algorithm.)
```
import collections
import heapq
class Sentinel:
... | The algorithm already given of taking the most common item left that isn't the previous item is correct. Here's a simple implementation, which optimally uses a heap to track the most common.
```
import collections, heapq
def nonadjacent(keys):
heap = [(-count, key) for key, count in collections.Counter(a).items()]... |
13,622 | In LaTeX, we can say something like:
```
"See equation \ref{eq} on page \pageref{eq}..."
```
Is there any way to do:
```
"See equation \ref{eq} in chapter \chapterref{eq}..."
``` | 2011/03/16 | [
"https://tex.stackexchange.com/questions/13622",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/4270/"
] | [`hyperref`](http://ctan.org/pkg/hyperref) offers `\autoref` which will turn `\autoref{chap:foo}` into "chapter *X*"
```latex
\documentclass{book}
\usepackage{hyperref}
\begin{document}
\chapter{Foo}
\label{chap:foo}
This is the beginning of \autoref{chap:foo}
\end{document}
```
Produces:
![chapter f... | The `refstyle` package has this functionality. It will correctly reference an Appendix also if your label is such. You can also link it to `varioref`. Please read the documentaion.
```
\documentclass{book}
\usepackage[nokeyprefix]{refstyle}
\begin{document}
\mainmatter
\chapter{First chapter}\label{chp:Chp1}
\Eqref{e... |
34,282,341 | I'm struggling with the alignment in the following `navbar` that uses Bootstrap 3.
**Problem:** The `Login` and `Signup` elements are on different rows. Whats the correct way to adjust them so that they are both on the same line? `display: inline-block;` and `white-space: nowrap;` does not appear to work on the `li` ... | 2015/12/15 | [
"https://Stackoverflow.com/questions/34282341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/741099/"
] | Remove `float:left` for your list items and apply `dispaly:inline-block` and apply the style `white-space:nowrap` for your `ul` element.
```
ul.navbar-nav{ white-space:nowrap;}
.navbar-nav li{display:inline-block; float:none;}
``` | I have updated width of `.search-form` from `100% to 76%` and now it works fine.
Check [here](http://www.bootply.com/ZWzOf77CID) |
8,380 | The area of the earth covered by desert is more than 20%. (Sites range from 20-33%, I don't know why the wide range).
With technology close to providing zero cost solar (not free, but declining each year by a substantial fraction) the ability to desalinate water and pump it over desert land will be viable at some poi... | 2015/01/07 | [
"https://worldbuilding.stackexchange.com/questions/8380",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/-1/"
] | A lot of negative posts, so here's a more positive view:
While terraforming ALL of the Earth's deserts away might be a pipe dream at the moment, there were serious engineering proposals in the 20th Century that might have altered the climate of the Sahara considerably, by flooding areas that were below the sea level:
... | The safest answer is that we don't know. Life on Earth is often the result of an equilibrium and pumping to much water into the land will cause some problems. As other mentioned, we need deserts, as they play a role in our biosphere. I will say that we don't know for sure what will happen if we change millions of kilom... |
37,543,057 | For my android app I use the parceler library and the lombok library.
These are the annotations of my class:
```
@Table
@ToString
@Getter
@NoArgsConstructor
@Parcel
public class MyClass {
```
However, during gradle build, Parceler complains that there is no default empty constructor. So does this mean it doesn't re... | 2016/05/31 | [
"https://Stackoverflow.com/questions/37543057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4924595/"
] | This gets into how Lombok adds code to your class. Lombok uses a [known trick](http://notatube.blogspot.com/2010/11/project-lombok-trick-explained.html) in the Java annotation processor to add code to your class. This added code is not visible to Parceler during the annotation processor round and makes the added no-arg... | Use @ParcelFactory on a static method building an empty object:
```
@Builder
public class MyClass {
@ParcelFactory
static MyClass fromParcel() {
return builder().build();
}
}
```
This trick can ben used with Jackson and other libraries allowing you to annotate static factory methods in addition t... |
1,913,929 | How good it'd be to have 64 bit MySQL on 64 bit Linux ofcouse?
Presently I have 32bit Mysql / OS but 64bit hardware.
Shall I consider upgrade? What advantages do I have? | 2009/12/16 | [
"https://Stackoverflow.com/questions/1913929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232879/"
] | Your memcached client will do all of the sharding for you. The harder part is knowing what you should cache so it will actually be beneficial to your application.
In general, you *don't* want to cache things like database queries. You *do* want to cache things that you build from database queries that represent higher... | You can below link, hope it will help to get started....
<http://sacharya.com/using-memcached-with-java/>
<http://www.javascool.com/2010/08/31/using-memcached-with-java-applications/> |
63,791,297 | Let's say I have the following input model:
```
public class InputModel
{
[Required]
public string? Name { get; set; }
[Required]
public DateTime? Birthday { get; set; }
}
```
When the birthday field is not provided then I get the following appropriate response:
```
{
"type": "https://tools.iet... | 2020/09/08 | [
"https://Stackoverflow.com/questions/63791297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/589558/"
] | >
> How can I validate the DateTime string before it gets handled by the
> converter so that I can return a response model similar to the first?
>
>
>
You can create a custom BadRequest method that inherits **`ValidationProblemDetails`** to return the error message you want.
First, add the following code in your ... | Try defining the datatype of the datetime field like as follows:
```
[Required]
[DataType(DataType.DateTime)]
public DateTime? Birthday { get; set; }
``` |
49,744,802 | Sorry for my English.
I'm learning PHP and I try to create a small member area, I think it's a good way to learn.
In my member area, some members are "verified" and some are not.
How can I display different pics based on data `stored in Mysql` using PHP?
What I want is to display `"Picture1" if "1" is the value stored... | 2018/04/10 | [
"https://Stackoverflow.com/questions/49744802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6012193/"
] | Lets assume that you have a database named as db and table as tb with columns name and verify. Name is string and verify is Boolean. Also verify stored 1 if user is verified and 0 it isn't.
so, you can do it by iteration statements (either by using if else or by switch statements)
```
<?php
$servername = "localhost"... | Try this:
```
<img src="<?php echo "/pictures/Picture{$number}.jpg"; ?>" />
``` |
31,964,635 | Usecase : I am trying to read pdf from url and then send it via FTP
I have functions as:
```
def send_via_ftp(self, url, filename, ftp_site, username, password, directory):
import urllib2
try:
data = urllib2.urlopen(url)
except urllib2.URLError, e:
print "Failed to fetch content: %s" % e
... | 2015/08/12 | [
"https://Stackoverflow.com/questions/31964635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2503890/"
] | Windows explorer allots 15 custom overlay icons (Windows reserves 4, so effectively only **[11 overlay icons](https://support.microsoft.com/en-us/help/3106961/registered-icon-overlay-handlers-aren-t-used-by-windows-shell)**) - they are shared between multiple applications (Google drive, One drive, Tortoise SVN). If you... | I did all of the above and nothing worked. The overlay icons were appearing in Explorer but not in Total Commander.
Eventually what solved the issue for me was that I discovered a command in Total Commander that refreshed the Overlay Icons. To access it, right click on the toolbar and click on "Change...", and add "cm... |
11,640,703 | ```
Student Subj Period Score
-------------------------
A Math 100 50
A Hist 100 100
A Sci 200 70
B Math 100 50
B Hist 100 50
```
I'm trying to query for the highest score for an each student.
If scores are all same (suc... | 2012/07/24 | [
"https://Stackoverflow.com/questions/11640703",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1224698/"
] | You want to use analytic functions (I assume this is in Oracle from the mention of pl/sql):
```
select Student, Subj, Period, Score
from (select t.*,
row_number() over (partition by student order by score desc) as seqnum
from t
) t
where seqnum = 1
``` | Gordon's answer certainly works very well, and it uses ANSI syntax that is supported by a number of database engines.
Oracle has an additional syntax that I don't think is ANSI, but it eliminates the need for any subquery. It performs at least as well as Gordon's answer (it may be slightly faster, but I'm not sure). I... |
42,237,899 | This is what `AsyncMethods` class looks like:
```
public class AsyncMethods
{
public static async Task<double> GetdoubleAsync()
{
Console.WriteLine("Thread.CurrentThread.ManagedThreadId: " + Thread.CurrentThread.ManagedThreadId);
await Task.Delay(1000);
return 80d;
}
public stat... | 2017/02/14 | [
"https://Stackoverflow.com/questions/42237899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/683104/"
] | First off: if you have two questions **please ask two questions**. Don't put two questions in one question.
>
> How come everything happened on a single thread?
>
>
>
That's the wrong question to ask. The correct question is: why do you think anything should happen on a second thread?
Here, I'll give you a task:... | They all *start* on the same thread. When you call your three Async methods in sequence, they all execute synchronously up until the first `await` call. (After the `await`, they become state machines that pick up where they left off whenever they get scheduled. If you checked the thread ID *after* the `await Task.Delay... |
5,663,787 | I have to automatically upload folders to an FTP using a Python script. I am able to upload a single file, but not folders with subfolders and files in them. I did a lot of search, but failed. Could some one help me out here? Thanks in advance.
```
#! /usr/bin/python
import ftplib
s = ftplib.FTP('serverip','usrname',... | 2011/04/14 | [
"https://Stackoverflow.com/questions/5663787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/532312/"
] | I recently came into this problem and figured out a recursive function to solve it.
```
import ftplib
import os
server = 'localhost'
username = 'generic_user'
password = 'password'
myFTP = ftplib.FTP(server, username, password)
myPath = r'c:\temp'
def uploadThis(path):
files = os.listdir(path)
os.chdir(path)
... | You basically need to use os.walk() to grab those files and transfer them.
Here's a script I wrote for myself to do much of what your asking.
I wrote it a long time ago, so I'd probably do it differently if I wrote it again, but I get a lot of use out of it.
It imports psftplib, which is a wrapper I wrote for the put... |
1,448 | [CbpA](http://www.uniprot.org/uniprot/P36659) is DNA binding protein found in E. coli and binds non-specifically to curved DNA ([Cosgriff et al., 2010](http://dx.doi.org/10.1111/j.1365-2958.2010.07292.x)), when the bacterium is in a static phase of growth.
The use of "curved DNA" confuses me. Is the term "curved DNA"... | 2012/03/16 | [
"https://biology.stackexchange.com/questions/1448",
"https://biology.stackexchange.com",
"https://biology.stackexchange.com/users/158/"
] | Cone cells are each connected to their own neurone. This allows them a great deal of resolution as the brain can interpret the exact position of the cone cell that was stimulated by a light photon. However in order to improve low light vision, multiple rod cells are connected to a single neurone - this is called summat... | All of the above answers are great, and very informative. But they are also *technically* wrong, in certain conditions. Once you understand them, you'll be able to understand this explanation of why.
The canonical answer is that cones are used for color perception in bright light and rods are used in low light. But ro... |
48,611 | probably a weird question.
I'm using the custom [MetaBox and CustomFields Class](https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress) by jaredatch on Github.
I have this "event-date" metabox:
```
$meta_boxes[] = array(
'id' => 'event_date',
'title' => 'Event Date',
... | 2012/04/11 | [
"https://wordpress.stackexchange.com/questions/48611",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3529/"
] | Use `add_editor_style`
e.g.: functions.php
```
add_editor_style('custom-editor-style.css');
```
<http://codex.wordpress.org/Function_Reference/add_editor_style> | `add_editor_style` is recommended for theme.
You can `mce_css` filter in plugin. The following sample code is from [here](http://codex.wordpress.org/Plugin_API/Filter_Reference/mce_css)
```
function plugin_mce_css( $mce_css ) {
if ( !empty( $mce_css ) )
$mce_css .= ',';
$mce_css .= plugins_url( 'editor.css',... |
29,431,726 | I'm developing an android app where I would like to fetch some data (mostly text) from the internet but not necesseraly from a website! I would like to have a server that allows clients to fetch some text data. What kind of server fits my goals the best? Http or maybe simply tcp? I don't know much about http so I don't... | 2015/04/03 | [
"https://Stackoverflow.com/questions/29431726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3787649/"
] | AWK may be used for this purpose.
See <https://www.gnu.org/software/gawk/manual/html_node/Redirection.html>
which contains the following conceptual example:
```
$ awk '{ print $2 > "phone-list"
> print $1 > "name-list" }' mail-list
$ cat phone-list
-| 555-5553
-| 555-3412
…
$ cat name-list
-| Amelia
-| Anthony... | Using GNU awk for the 4th arg to split():
```
$ cat tst.awk
{
split($0,flds,re,seps)
for (i=1;i in flds;i++) {
printf "%s", flds[i]
if (i in seps)
print seps[i] > "removed.txt"
}
print ""
}
$ echo -e " apple pears banana \n kiwi ananas cocoa" | awk -v re=' [ab][a-z]+' -f ts... |
1,328,568 | I am trying to write a simple audit class that takes input via operator << and writes the audit after receiving a custom manipulator like this:
```
class CAudit
{
public:
//needs to be templated
CAudit& operator << ( LPCSTR data ) {
audittext << data;
return *this;
}
//attempted manipu... | 2009/08/25 | [
"https://Stackoverflow.com/questions/1328568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38892/"
] | To make it work you have to add overload of operator << for functions,
than call the function from it:
```
class CAudit
{
//...other details here as in original question
CAudit& operator << (CAudit & (*func)(CAudit &))
{
return func(*this);
}
};
CAudit audit;
audit << "some text" << CAudit::writ... | Binary shift operator and stream operator is the same operator. It is completely legal to overload operator+ for your class to write "Hello world" on std::cout (although it is a very bad idea). The same way C++ standard authors decided to overload operator<< for streams as writing to the stream.
You didn't write cle... |
14,488,946 | I need to connect to the data in a remote MySQL table, iterate through it, and use ActiveRecord "create" methods so that all validations and callbacks are performed. I have found documentation for having multiple database config settings, and assigning them individually per model, but that doesn't fit my needs because ... | 2013/01/23 | [
"https://Stackoverflow.com/questions/14488946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/636892/"
] | 1) Yes, this is the best way for the aggregate to maintain its integrity. Some say that this can result in aggregates with very large number of methods, however in that case there may be multiple aggregates at play.
2) Ideally, the aggregate would perform the required operation without passing references. There may be... | >
> I assume in most cases if external object needs to performs some
> operation on internal entity, it should call method(s) defined on the
> Aggregate root
>
>
>
Just to add a slightly different take on this, the reverse approach might also be used. Adding methods to the Aggregate Root **in most cases** forces... |
206,283 | As expected, Nvidia drivers have reduced my customizations. I can't login to Unity 3D session. I can't find any content to help me to uninstall the driver and I don't know what to do as I have never uninstalled them before. | 2012/10/25 | [
"https://askubuntu.com/questions/206283",
"https://askubuntu.com",
"https://askubuntu.com/users/99229/"
] | If you have only access to GRUB:
1. Restart your computer
2. Select `Advanced options for Ubuntu` at GRUB Boot Menu
3. Select `Ubuntu ..... (recovery mode)`
4. Select `dpkg` Repair broken packages at the Recovery Menu (this will stop the nvidia processes so we can uninstall). Choose Yes. When finished press ENTER (eve... | I didn't want to modify `/etc/modules`, and just revert to an install without the nvidia drivers. So I mostly did as the accepted suggested, but instead of the last step, I do this:
```
sudo rm /etc/modprobe.d/blacklist-nouveau.conf
sudo update-initramfs -k all -u
```
So my variant summary:
```
sudo apt-get remove ... |
2,434,595 | I'm looking for some stand alone library to access SMB/CIFS shares.
I am not looking for mounting the shares, just browsing and accessing the files for reading.
Preferable something with a simple simple API similar to regular POSIX operations of `opendir`, `scandir`, `read` and etc.
Thanks in advance! | 2010/03/12 | [
"https://Stackoverflow.com/questions/2434595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2454753/"
] | as you say nothing about the preferred language I would recommend looking on <http://jcifs.samba.org> especially <http://jcifs.samba.org/src/docs/api/jcifs/smb/SmbFile.html>
it has what you ask for. Reading files, enumearating directories. API fairly simple. | [Pysmb](http://miketeo.net/wp/index.php/projects/pysmb) is a good choice if you want to access samba shares from python. |
181,782 | I am trying to build a transformer to convert 12V AC power to 5V AC. Here is what I have right now:
[](https://i.stack.imgur.com/yzflK.jpg)
I haven't adjusted the coil ratio yet but I tried it just to see if there would be any output and as a matter of fact there is... | 2015/07/25 | [
"https://electronics.stackexchange.com/questions/181782",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/27630/"
] | The core doesn't need to be circular, but it must be closed, otherwise the linked flux will be very low.
Moreover, the fact that the pipe is empty doesn't improve the situation, since the flux is concentrated where there is higher permeability, i.e. in the core, but the net section of the core in your case is small. I... | From the picture, it appears that you placed the coils "next" to each other. This configuration gives you the **least** amount of flux cutting across the secondary winding. To improve the coupling, you need to wind the secondary **on top** of the primary. The "efficiency" of the coupling will depend on what you use as ... |
9,151,611 | There is a client - server basic application. The client uses a simple remoting to comunicate with the server side. The server side could be powered on WebORB, BlazeDS or any other product. The client side is using the FLEX framework. That is it about a technologies stack. Now, let's forget about the server side and ju... | 2012/02/05 | [
"https://Stackoverflow.com/questions/9151611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/672186/"
] | Try adding an alias for MyCollection.
I got the unhelpful Error #2004 until all of my classes implementing IExternalizable had aliases. In my case it was for persistence (ViewNavigatorApplicationBase.persistNavigatorState = true) in which case I had to make sure I called registerClassAlias early enough in the startup ... | Some of your classes being (de)serialized is probably not linked into Flex project. Try adding following to your main Application/Module file:
```
private var forceReference:Array = [YourClass1, YourClass2];
``` |
736,432 | How to get the location of a program in Ubuntu? For example I have `Oracle`, how to get the folder racine (location) of `Oracle`? | 2016/02/18 | [
"https://askubuntu.com/questions/736432",
"https://askubuntu.com",
"https://askubuntu.com/users/496526/"
] | Bash and Dash have the `command` built-in command that can show you the location of a command with the `-v` switch, if the command refers to an executable. For built-in commands and aliases the result is different. Examples:
```none
$ command -v java
/usr/bin/java
$ echo $?
0
$ command -v echo
echo
$ command -v ls
ali... | Shellscript `what-about`
========================
I have a bash shellscript, that tries to
* find where a program is located,
* find the corresponding package and
* tell what kind of program it is
Maybe use the name `what-about`, make it executable and put it in PATH,
```
#!/bin/bash
LANG=C
inversvid="\0033[7m"
re... |
78,475 | I'm trying to connect the phone lines in my new home. I have 2 lines given by my phone provider arriving downstairs in the apartment:
[](https://i.stack.imgur.com/Wmgz0.jpg)
Then I have 2 `RJ11` cables plugged into to the connections shown above whic... | 2015/11/22 | [
"https://diy.stackexchange.com/questions/78475",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/45848/"
] | Those are RJ45s not RJ11s. RJ11's only have 4 pins. An RJ11 fits into the center 4 pins of this jack though.
Q1 Whether one is left or right I can't tell but the top is definitely for one jack and the bottom is for the other jack.
Q2 leave your white on 5 and blue on 4 like all the diagrams below. You can use 568A ... | This connector looks like the parallel connection, It is designed for 2 telephones. Usually the DSL service provider provides the ADSL Splitter use the splitter and pullout the connection for your phone and your modem.
>
> Make sure no parallel connection before ADSL Splitter, as you will get poor phone signal as wel... |
98,969 | I am looking for expertise that helps to improve speed of the code below. First, a little bit of background:
There is some system of differential equations $\dot{\vec{m}}(t)=S(t)\vec{m}(t)$. In order to solve this without using `NDSolve/NDSolveValue` for this one can just proceed as $$\vec{m}(T)=\left(\prod\limits\_{j... | 2015/11/09 | [
"https://mathematica.stackexchange.com/questions/98969",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/21606/"
] | Your approach is certainly faster than using [`NDSolve`](http://reference.wolfram.com/language/ref/NDSolve), but I think there is a mistake in the implementation, and the accuracy leaves much to be desired. Your ODE is:
$$m'(t) = -i S(t) . m(t)$$
This ODE can be discretized as follows:
$$m'(t) \Delta t \approx m(t +... | Let me at least show you how to avoid the `Do` loop while I think about other possible improvements.
The idiomatic way is to use `Fold`. Here is my version:
```
evol3[mat_, initial_, ti_, tf_] :=
Module[{dt = (tf - ti)/10, res = col[initial],
ar = ArrayRules[mat]},
squ[Fold[
MatrixExp[-I*SparseArray[ar /.... |
69,347,386 | Suppose I have this series of numbers in a vector:
```
vec <- c(1,2,3,4,5) # just an example, numbers could be far higher
```
How can I programmatically divide these numbers into equally-spaced intervals ranging between `0-1`, such that I get:
for
* 1: `0`
* 2: `0, 1`
* 3: `0, 0.5, 1`
* 4: `0, 0.33, 0.66... | 2021/09/27 | [
"https://Stackoverflow.com/questions/69347386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8039978/"
] | We can use *seq* with *length.out* argument:
```
lapply(1:5, function(i) seq(0, 1, length.out = i))
# [[1]]
# [1] 0
#
# [[2]]
# [1] 0 1
#
# [[3]]
# [1] 0.0 0.5 1.0
#
# [[4]]
# [1] 0.0000000 0.3333333 0.6666667 1.0000000
#
# [[5]]
# [1] 0.00 0.25 0.50 0.75 1.00
```
or *mapply*:
```
mapply(seq, from = 0, to = 1,... | Using `map`
```
library(purrr)
map(1:5, ~ seq(0, 1, length.out = .x))
```
-output
```
[[1]]
[1] 0
[[2]]
[1] 0 1
[[3]]
[1] 0.0 0.5 1.0
[[4]]
[1] 0.0000000 0.3333333 0.6666667 1.0000000
[[5]]
[1] 0.00 0.25 0.50 0.75 1.00
``` |
5,646,954 | I have a `winform` called ***Form1*** and a `textbox` called ***textBox1***
In the ***Form1*** I can set the text by typing:
```
textBox1.text = "change text";
```
Now I have created another class. How do I call ***textBox1*** in this class?
so I want to change the text for ***textBox1*** in this class.
How can I ... | 2011/04/13 | [
"https://Stackoverflow.com/questions/5646954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/692957/"
] | You can change the access modifier for the generated field in `Form1.Designer.cs` from `private` to `public`. Change this
```
private System.Windows.Forms.TextBox textBox1;
```
by this
```
public System.Windows.Forms.TextBox textBox1;
```
You can now handle it using a reference of the form `Form1.textBox1`.
Visu... | I Found an easy way to do this,I've tested it,it works Properly.
First I created a Windows Project,on the form I Inserted a TextBox and I named it textBox1
then I inserted a button named button1,then add a class named class1.
in the class1 I created a TextBox:
```
class class1
{
public static TextBox txt1=new... |
9,985,971 | we are developing an application with following characteristics:
* standalone spring 3.1.0.RELEASE application
* JPA with Hibernate 3.6.7.Final
* AMQP (RabbitMQ as Server, Spring AMQP as Client)
* SQL Server 2008 with jTDS driver
We need to synchronize transactions between RabbitMQ and SQL Server, so we are trying to... | 2012/04/03 | [
"https://Stackoverflow.com/questions/9985971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3221/"
] | After digging through the various candidate solutions (use of [Change Data Capture](http://msdn.microsoft.com/en-us/library/bb522489.aspx), adapters for [SQL Server Service Broker](http://msdn.microsoft.com/en-us/library/ms345108%28v=sql.90%29.aspx), and possible conversions from [MSMQ](http://en.wikipedia.org/wiki/Mic... | As i know RabbitMQ *does not* support XA style transactions.
And yes you can do it in Java:
**TestConfiguration.java**
```
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.config.AbstractRabbitConfiguration;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import... |
634,610 | How can I download or turn on my *stereo mix* feature in Windows 7? In music chat rooms I can't play music. When I had Windows XP, I had the *stereo mix* option in Audio settings. I can't seem to find it here. | 2013/08/21 | [
"https://superuser.com/questions/634610",
"https://superuser.com",
"https://superuser.com/users/247227/"
] | As of April 2017 and the new Skype for Windows 10 (Skype UWP - Universal Windows Platform), the `main.db` file has moved to
```
%localappdata%\Packages\Microsoft.SkypeApp_kzf8qxf38zg5c\LocalState\<SkypeUsername>\skype.db
```
with `%localappdata%` being `C:\Users\<username>\AppData\Local`
Source: <https://answers.m... | Normally it will be stored at `main.db file` for windows operating system
the default path for Windows XP:
```
C:\Documents and Settings\<windows user>\Application Data\Skype\<WindowsUsername>
```
the default path for Windows 7+:
```
C:\Users\<username>\AppData\Roaming\Skype\live#<SkypeLiveUsername>
```
1. Clos... |
66,757 | I have a fairly simple python program that takes in some csv style text files containing genomic data (these files are fairly lightweight: <10 megabytes) processes / compares them and then produces some output text files. Currently this program has a command line interface suitable for my own use. However, I want this ... | 2019/08/22 | [
"https://softwarerecs.stackexchange.com/questions/66757",
"https://softwarerecs.stackexchange.com",
"https://softwarerecs.stackexchange.com/users/58506/"
] | The project [argparseweb](https://github.com/nirizr/argparseweb) might be a good starting point.
It aims to automatically convert argparse-like command line interfaces to simple web interfaces. This package was made for getting your personal command line scripts to the next stage - internal shared utilities.
*I haven... | I would use django for a simple web gui which servers via <http://localhost:8000>
Maybe you don't need all the features that django offers (ORM, database migrations, ...).
But django is a solid framework, which helps you if new features will be needed in the future. |
145,351 | I have DKIM set up for one domain and it works properly. I am trying, though, to set it up for another domain name on the same machine. In short, I am sending registration and password recovery emails from one domain and everything else from the other domain. Both domains map to the same host.
Setting up domainkeys i... | 2010/05/26 | [
"https://serverfault.com/questions/145351",
"https://serverfault.com",
"https://serverfault.com/users/15759/"
] | Take a look at this person's question and answer:
DKIM sign outgoing mail from any domain with postfix and ubuntu
[DKIM sign outgoing mail from any domain (with Postfix and Ubuntu)](https://serverfault.com/questions/52830/dkim-sign-outgoing-mail-from-any-domain-with-postfix-and-ubuntu)
You may also need to read this... | For Centos/RHEL take a look at this <http://www.topdog.za.net/postfix_dkim_milter> |
48,163,779 | I would like to insert a new data array into the UITableView without using reloadData() method.
I created simple code to do that.
I referred to [this discussion](https://stackoverflow.com/questions/31870206/how-to-insert-new-cell-into-uitableview-in-swift).
However, error is occurred.
I investigated why error is occur... | 2018/01/09 | [
"https://Stackoverflow.com/questions/48163779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6458354/"
] | Doing *most* (and the hardest part) of what you want can easily be done in MongoDB. The final step when returning "basic", "premium" or "standard" most likely can also be done, but I think it's not worth the hassle as that is trivial in Go.
In MongoDB use the [Aggregation framework](https://docs.mongodb.com/manual/agg... | Since you're only storing IDs to reference documents in other collections, rather than de-normalizing the data entirely, no, you cannot do this purely in MongoDB. MongoDB is not a relational database. What you're describing is exactly what MongoDB was designed *not* to do.
You'll need to perform the logic in Go; wheth... |
38,139,579 | Having created a new ASP.Net Core Web Application (.Net Core) project in Visual Studio 2015 Update 3 and checked this in to a Visual Studio Team Services git repository. I am using the release version of .Net Core and ASP.Net Core.
I am now trying to build this using the VSTS Build system using a build definition bas... | 2016/07/01 | [
"https://Stackoverflow.com/questions/38139579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/783768/"
] | You should replace "tools" section in your project.json like this:
```
"tools": {
"BundlerMinifier.Core": "2.1.258",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"netstandard1.6"
]
},
"Microsoft.AspNetCore.Server.IISIntegration.Tool... | I encountered the same issue with `dotnet restore` using the hosted build agent in VSTS. Based on the comment from @svick , I ran `dotnet --version` to check what is installed on the hosted agent. As of today, it is still `1.0.0-preview1-002702` and not the referenced version of `1.0.0-preview2-003121`.
```
2016-07-0... |
60,099,641 | I am working with two tables:
**tblOrders**
```
| Part | Order |
|:----:|:-----:|
| AXXA | 10122 |
| AXXA | 10125 |
| AXXB | 10244 |
| AXXB | 10254 |
| AXXB | 10259 |
```
and **tblPOs**
```
| rOrder | PONum | PODate |
|:------:|:-------:|:----------:|
| 10122 | PO99283 | 2/6/2020 |
| 10125 | PO99283 | 2... | 2020/02/06 | [
"https://Stackoverflow.com/questions/60099641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4876561/"
] | if your input is
>
> F03, F04, F05
>
>
>
with whitespaces between commas and next value, the statement gives :
>
> select .... where product\_code in ('F03', ' F04', ' F05');
>
>
>
Note the whitespaces. Then the values 'F04' and 'F05' are not found.
What if the input is `'F03,F04,F05'` ? (without spaces) | Here is what I suspect is what you want:
```
text_input = "A,B,C"
in_clause <- paste0("'", unlist(strsplit(text_input, ",")), "'", collapse=",")
sql <- paste0("WHERE product_code IN (", in_clause, ")")
sql
[1] "WHERE product_code IN ('A','B','C')"
```
Here I am still using your combination of `unlist` and `strsplit... |
4,935,719 | I am trying to solve a problem that involves basically implementing a logical AND between the input parameter.
The complexity of the problem involves the size of the input parameters. To give a high level overview, I am trying to implement the logic similar to
```
100 & 100 == 100
001 & 010 == 0
001 & 100 == 0
.....
... | 2011/02/08 | [
"https://Stackoverflow.com/questions/4935719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/608436/"
] | [java.util.BitSet](http://download.oracle.com/javase/6/docs/api/java/util/BitSet.html). | a BigInteger should also work:
* new BigInteger(binaryString, 2) should parse the input correctly
* BigInteger implements "and"
* use testBit(n) to access the bits |
9,866,071 | I want to simulate a keypress in Java. Others have tried this using Robot. This only allows an atomic keypress, where I want to simulate a key hold (for a second, say) and release. So, I need to use JNA or JNI.
I investigated JNative, but this seems to be for consuming key events at an OS level, not generating them a... | 2012/03/26 | [
"https://Stackoverflow.com/questions/9866071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1292066/"
] | You can repeat it by fetching again the data
```
while($row = mysql_fetch_assoc($result)){
//another html element
<div>$row['name']</div>
<div>$row['title']</div>
//and so on
}
```
or you need to put it on the variable and call display it again on other html element
```
$name = $row['name'];
$title = $row['... | I use this or similar code to inject PHP messages into a fixed DIV positioned in front of other elements (z-index: 9999) just for convenience at the development stage.
Each PHP message passes into my 'custom\_message()' function and is further conveyed into the innard of preformatted DIV created by echoed JS.
There c... |
12,953,345 | I have this own class :
```
public class PeriodContainerPanel:StackPanel
{
public PeriodContainerPanel()
: base()
{
addCollectionsToStackPanel();
}
private void addCollectionsToStackPanel()
{
this.Children.Clear();
if (PeriodsList!=null)
{
doubl... | 2012/10/18 | [
"https://Stackoverflow.com/questions/12953345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/885200/"
] | Just use `std::copy` 5 times.
```
int* ptrArray = myArray;
for (i =0;i < 5; i++) {
std::copy(iVector[i].begin(), iVector[i].end(), ptrArray);
ptrArray += iVector[i].size();
}
``` | Or you can use plain old C.
You first initialize the array size to be the number of rows \* the number of columns your vector of vectors has. Then you use memcpy to copy each vector to the array.
```
vector<vector<int> > v = { {1,2},{3,4},{5,6} }; //v is 3 by 2 matrix
int *arr = (int*)malloc( (3*2) * sizeof(int)); /... |
7,391,929 | I have a script which renames files taken from a CSV but it throws an error when it trys to re-rename files after it has already carried out the successful proceedure
CSV file is like:
```
old new
AC100 DC100
AC101 DC102
```
Code tried:
```
$sourceDir = read-host "Please enter source Dir:"
$csvL = $sour... | 2011/09/12 | [
"https://Stackoverflow.com/questions/7391929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1395967/"
] | The answer is in that question:
["pure virtual method called" when implementing a boost::thread wrapper interface](https://stackoverflow.com/questions/3160403/pure-virtual-method-called-when-implementing-a-boostthread-wrapper-interface)
Basically, when the boost::thread object begins running, the object it was run ag... | From reading your updates, you're calling delete in the main thread, while the thread is starting in the other. Depending on the race between the destructor and the invocation of `run`, it will either:
1. Crash before it starts, because the vtable is completely destroyed
2. Call the Thread::run (which is pure virtual... |
1,385,710 | I am considering to use DTOs instead of passing around my domain objects. I have read several posts here as well as elsewhere, and i understand there are several approaches to getting this done.
If i only have about 10 domain classes in all, and considering that i want to use DTOs rather than domain objects for consum... | 2009/09/06 | [
"https://Stackoverflow.com/questions/1385710",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm kind of using DTOs in a project. I tend to make the DTOs only to show the data I need for an specified view. I fetch all the data shown in the view in my data access class. For example, I may have an Order object which references a Client object:
```
public class Client{
public int Id{get;set;}
public stri... | We all know what `Dtos` are (probably).
**But the important thing is to overuse DTOs or not.**
Transfering data using `Dtos` between "local" services is a good practice but have a huge overhead on your developer team.
**There is some facts:**
1. Clients should not see or interact with Entities (`Daos`). So you
alway... |
57,789,008 | What is the advantage of using Firebird read-only transaction? I am working with Firebird databases more than seven years. I have never used this option. I am just curious what is typical scenario for this feature? I am working with Firebird 2.5.x but if you have useful insight related to Firebird 3.x (or newer version... | 2019/09/04 | [
"https://Stackoverflow.com/questions/57789008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/538022/"
] | While the transaction is in effect you see a consistent view of the database - data modifications (deletes/updates/inserts) from other connections or sessions won't be visible.
Common to use for combined reports where you run multiple queries against the same data to show it in different ways. If each query ran indep... | Read-only transactions in Firebird use a pre-committed transaction (although it will still need to be ended with a `COMMIT`). It cannot alter the database (except global temporary tables that are `on commit delete rows`), and it cannot lock rows or tables. It does provide the visibility guarantees of the transaction co... |
8,028,295 | I am currently running the latest version of Code-blocks in Ubuntu 11.04.
I have GTK+2, and 3 developer libraries fully installed (and working), and presumably have x11 installed. The header files are there.
However, a simple code will not compile using x11 coding.
```
#include "X11/Xlib.h"
int main() {
Display ... | 2011/11/06 | [
"https://Stackoverflow.com/questions/8028295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/741470/"
] | I don't know what Code Blocks is, but for a normal compile/link process, you need to specify `-lX11` to link with libX11.so for the Xlib functions. | Thanks! I just had the same problem. To spell it out:
Settings > Compiler and Debugger > Linker settings > Other linker options > "-lX11"
For the record 'codelite' got it right all by itself. |
49,826,455 | I want to place different `textarea`s on different pages. The *CSS* for the `textarea` seems to be overriding the *rows* and *cols* I try to set for the second `textarea`. I've tried "*textarea*" and "*textarea1*", but that obviously didn't work.
```css
textarea {
width: 40%;
height: 75px;
padding: 12px 20px ... | 2018/04/13 | [
"https://Stackoverflow.com/questions/49826455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9311132/"
] | you can use like this
```css
textarea:not(.reason) {
width: 40%;
height: 75px;
padding: 12px 20px ;
box-sizing: border-box;
border: 5px solid #D8FF01;
border-radius: 4px;
background-color: #000;
color: white;
font-weight:bolder;
resize:both;
}
```
```html
<form>
<t... | try to just do a separate css for both by using class so:
```
<form>
<textarea class="xxx" name="comment" placeholder="Enter text here">
</textarea>
</form>
<form>
<textarea class="yyy" name="reason" placeholder="Enter text here: (500 characters maximum)" maxlength="500" rows="10" cols="50">
</t... |
14,948 | At a Catholic Mass (Roman rite) people sometimes say (either in vernacular or Latin):
"Confiteor Deo omnipotenti,
et vobis fratres,
quia peccavi nimis
cogitatione, verbo,
opere et omissione:
mea culpa, mea culpa,
mea maxima culpa.
Ideo precor beatam Mariam semper Virginem,
omnes Angelos et Sanctos,
et vos, fratres,
ora... | 2020/11/19 | [
"https://latin.stackexchange.com/questions/14948",
"https://latin.stackexchange.com",
"https://latin.stackexchange.com/users/8610/"
] | No, the meaning would not change. *Mea culpa* and *culpa mea* both mean “my fault.” [There is a tendency](https://www.jstor.org/stable/3287962?seq=1#metadata_info_tab_contents) that when the possessive comes first, it is emphasized (*my* fault, not yours), and when it comes second, the noun is emphasized. But the meani... | It's not quite clear what you mean by "would the meaning change a bit". The denotative meaning (what the words explicitly mean as such) wouldn't change at all, but the connotative meaning (what the words imply in their wider context) would shift slightly, since putting the possessive first emphasizes it. So *culpa mea*... |
19,238,215 | I'm having trouble with one of my C++ homework assignments. We're using a class to print out a list of phone numbers, but I'm having trouble figuring out how to get the number variable to print the defaults we're supposed to use with our constructors.
If any of you could point me in the right direction, with an exampl... | 2013/10/08 | [
"https://Stackoverflow.com/questions/19238215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2856836/"
] | Your `PhoneNumber` default constructor (`PhoneNumber::PhoneNumber()`) doesn't actually initialize any of the member variables;
```
PhoneNumber::PhoneNumber() {
void setCountry(int ccode = 43);
void setArea(int acode = 800);
void setNumber(int num = 8675309);
void setType(char line = 'H');
void set... | `number` is never initialized. Your `printNumber()` method should build `number` (which needs to be a `string` if you want the `-` in it) from the other members of the class, THEN print it.
So, your `printNumber()` method needs to look more like this...
```
void PhoneNumber::printNumber() const {
number = //whate... |
451,549 | I am trying to get a data backup from a broken LG/Google Nexus 5 smartphone. It was repeating in a boot loop, because the on-switch was stuck at always on.
I dismantled the mainboard. Here is a overview: [](https://i.stack.imgur.com/XrdMI.jpg)
After desoldering the l... | 2019/08/04 | [
"https://electronics.stackexchange.com/questions/451549",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/102633/"
] | 7 milliWatts spread over 60 centimeters will not be detected.
The heat will be dumped into the chest, and cooled by the blood.
Sunlight is 1,000 watts per square meter, or 1,000 watts per 10,000 square cm.
We easily sense sunlight, which is 0.1 watts per square cm.
Your heat density is 0.1 milliWatts per cm length ... | What do you mean by a wire? Is it an electrical wire, with an insulation?
As you have already said, the temperature will depend on the environment (including air flow), surface area of wire and insulation. Additionally, it will also depend on biological factors like blood flow, electrolyte status, perspiration etc.
F... |
45,378,033 | I have an application1(C#) that is hosted on port:80 and application 2(nodejs) that is hosted on port:3030. Both are on localhost.
**The request workflow is as following:**
* browsers sends request to application 1
* application 1 sends back number of cookies
* later on browser sends the request to application 2
* ^... | 2017/07/28 | [
"https://Stackoverflow.com/questions/45378033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7025662/"
] | Your domain is the same in this case localhost, so there shouldn't be any problem.
Another thing is: the port is part of an URI, not of a domain, the domain is also part of an URI, so you are mixing apples and fruits...
Please refer to this [another question in SO](https://stackoverflow.com/questions/1612177/are-http... | Here are a two different solutions you can try:
1. Run an Apache server and route the requests to either servers
2. Disable security( i.e., same origin policy) in the browsers. |
1,430,219 | I have a Rails app for bands. Bands can import their shows which all occur in different time zones. It seems like a ton of work to store these events in UTC. I would have to figure out the time zone for any show created and then convert back to the show's local time zone when displaying to the user. Is there a simple p... | 2009/09/15 | [
"https://Stackoverflow.com/questions/1430219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45849/"
] | I'm working on something similar - a site with a list of events. In my situation, it's important to have the times standardized (in UTC) because we have announce and on-sale times to worry about (i.e., when the events appear on the site and when the on-sale links show up), not just displaying the event start time (whic... | You don't need to worry about UTC here, since the event is tied to the time and location in which it's occurring. If someone is traveling from Hawaii to San Francisco for an 8pm show, that doesn't mean the show is going to start at 4pm for them. So, you can store plain time and location, don't worry about TZ (since pre... |
12,266,741 | I am using UAModalPanel to create a popover controller effect. I can get the popver box to display, but I am struggling to figure out how to create a view (graphically, in storyboard), instantiate that view in code, and add it to the UAModalPanel.
**What I've Tried**
* Created a UIViewController in storyboard, set it... | 2012/09/04 | [
"https://Stackoverflow.com/questions/12266741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/477528/"
] | In storyboards you'll want to drag and drop a new `UIViewController` then give it an identifier here:

Then in code you can get the view property of this view controller with the following:
```
UIViewController *myController = [self.storyboard insta... | Unless you need the segues you may better off creating a standalone XIB
Layout the view as you need, set its Class to your own (MyCustomView) then instantiate like this
```
NSArray *nib=[[NSBundle mainBundle] loadNibNamed:@"MyCustomView" owner:self options:nil];
MyCustomView *view = (MyCustomView*)[nib objectAtInd... |
1,794,281 | I am using the following code:
```
while (invalidInput)
{
// ask the user to specify a number to update the times by
System.out.print("Specify an integer between 0 and 5: ");
if (in.hasNextInt())
{
// get the update value
updateValue = in.nextInt();
// check to see if it was w... | 2009/11/25 | [
"https://Stackoverflow.com/questions/1794281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29326/"
] | The problem was that you did not advance the `Scanner` past the problematic input. From [`hasNextInt()`](http://java.sun.com/javase/6/docs/api/java/util/Scanner.html#hasNextInt%28%29) documentation:
>
> Returns `true` if the next token in this scanner's input can be interpreted as an `int` value in the default radix ... | ```
import java.util.Scanner;
public class Detail
{
public static void main(String args[])
{
int a;
Scanner sc = new Scanner(System.in);
System.out.print("Specify an integer between 0 and 5: ");
a =sc.nextInt();
if(a >= 0 && a <= 5)
{
System.out.println("You have entered an invalid input. Try again.... |
12,304,785 | I have a XML comment like that.
```
/// <summary>
/// Lorem ipsum
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
```
I'd like to place inside it a piece of the (multiline) code. How can I do that ?
Edit
----
Here's the info about multiline code [Adding line breaks to comments for Intellis... | 2012/09/06 | [
"https://Stackoverflow.com/questions/12304785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/106616/"
] | To add an example, use the
```xml
<example>
<code>
Put your example here.
</code>
</example>
```
tags. | I'm not entirely sure what you're asking, but here's my best shot:
I typically place code examples inside an `<example> </example>` tag.
```
/// <summary>
/// Lorem ipsum
/// </summary>
/// <example>
/// Put you're example here.
/// </example>
/// <param name="entity"></param>
/// <returns></returns>
``` |
59,840,967 | in wordpress I have custom post type 'referenzen'. This post type has Custom fields(ACF) 'Referenzen-buildin-type' Group with subfield 'building-type' which is checkbox. I do not know how to select posts with specific building type. This is not working for me :
```
$posts = get_posts(array(
'meta_query' => array(
... | 2020/01/21 | [
"https://Stackoverflow.com/questions/59840967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12754483/"
] | `fill-height` and, in general, all flexbox related properties rely strictly on parent-child relations.
So when you insert a `<div>` in between the parent and the child, they stop working. To learn more about how flexbox works, I recommend [A complete guide to flexbox](https://css-tricks.com/snippets/css/a-guide-to-fle... | just set to fill-height to true, like this
```
<v-container fill-height> </v-container>
```
if does not work, put it in v-content, just try this one
```
<v-content>
<v-container fill-height>
<v-layout>
<v-flex xs12>
...
...
</v-flex>
<... |
18,253,354 | ```
select round(avg(et_gsm_sınyal)) as sinyal,mahalle_kodu,ilce_kodu,sebeke
from
(select et_gsm_sınyal,sozlesme_no,SUBSTR(et_operator,1,5) as sebeke
from thkol316old
where tarih >= ADD_MONTHS (TRUNC (SYSDATE, 'MM'), -1)
AND tarih < TRUNC(SYSDATE, 'MM')) okuma,
(select sozlesme_no,ilce_kodu,ma... | 2013/08/15 | [
"https://Stackoverflow.com/questions/18253354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2615526/"
] | You need to make the body and html elements have height:100%, and you need to give the outer div height: 100%.
CSS:
```
body, html { height: 100%}
<div style="overflow: hidden; clear: both; height: 100%">
<div style="background-color: blue; height: 70%;">Top</div>
...
``` | You can add a `position: absolute` to the parent `div` and subsequently stretch it to achieve full width and height. Note that the `width: 100%` declarations are important to enforce block-level formatting context.
```
<div style="position:absolute; overflow: hidden; top:0; left:0; right: 0; bottom: 0;">
<div style=... |
13,048,824 | I am running the following bash code:
```
num=$(ls -1 $ini/*.ini | wc -l)
echo "Running $num simulations..."
for i in {1..$num};
do
echo "a"
done
```
And I get the following output:
```
Running 24 simulations...
a
```
It should print 24 lines of 'a', but it doesn't. What should I change? Thanks! | 2012/10/24 | [
"https://Stackoverflow.com/questions/13048824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1596293/"
] | The curly brackets don't expand variables. You could use
```
for i in $(seq $num); do
echo "a"
done
```
See e.g. `man bash`:
>
> [...]
>
>
> A sequence expression takes the form `{x..y[..incr]}`, where `x` and `y` are either
> integers or single characters, and incr, an optional increment, is an integer.
> ... | The brace expansion only works for literals, it does not expand variables.
Possible workaround:
```
for i in $(seq 1 $num) ; do
``` |
55,446,686 | In the "C++ concurrency in action" book there is an example:
```
class background_task
{
public:
void operator() () const {
do_something();
do_something_else();
}
};
background_task f;
std::thread my_thread(f);
```
Followed by the text: "In this case,... | 2019/04/01 | [
"https://Stackoverflow.com/questions/55446686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The statement is contrasting the given example with the case immediately before where a normal function `void do_some_work();` is passed as an argument to `std::thread`.
```
std::thread my_thread(do_some_work);
```
The function object `background_task f` should be copyable. This is not possible if the `class backgro... | There's nothing much to read into here.
The callable, whatever it is, must be copied into the thread, otherwise invoking it will not be thread-safe.
And if the callable is of a type that has shall-we-say "unexpected" copy semantics (think a really weirdly written copy constructor) then that's just bad news all around... |
36,045,713 | There is a complex method function, which takes some data from different collections. These collection get defined in some (optional) packages.
Now I need to check if the collection is defined - which means that the package is added to the project.
I tried to use an `if`, but this doesn't work. I still get the error ... | 2016/03/16 | [
"https://Stackoverflow.com/questions/36045713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3142695/"
] | ```
SELECT * from `table` where day='Thursday' AND (`9-10`='DA6220' OR `10-11`='DA6220' OR `11-12`='DA6220'
OR `12-1`='DA6220' OR `1-2`='DA6220' OR `2-3`='DA6220' OR `3-4`='DA6220')
```
Looks like your AND is evaluated first. Please try the above | Elaborating on my comment:
```
SELECT *
FROM `table`
WHERE 0 < LOCATE("DA6220", CONCAT(
`9-10`, " ", `10-11`, " ", `11-12`, " ",
`12-1`, " ", `1-2`, " ", `2-3`, " ", `3-4`
))
```
The nice thing about this approach is that you don't have to repeat your search string repeatedly. It's prob... |
15,062,364 | ```
var video_id='VA770wpLX-Q';
$.getJSON('http://gdata.youtube.com/feeds/api/videos/'+video_id+'?v=2&alt=jsonc',function(data,status,xhr){
alert(data.data.title);
});
```
I am having issue in using getJSON() in ie9 and below, the request is done but function is not running, it is working on all the other browse... | 2013/02/25 | [
"https://Stackoverflow.com/questions/15062364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/976070/"
] | Try this hack, it should make IE work with cross domain requests in this case:
```
$.support.cors = true;
$.getJSON('http://gdata.youtube.com/feeds/api/videos/' + video_id + '?v=2&alt=jsonc', function (data) {
console.log(data.data.title);
});
```
Worked for me <http://jsbin.com/ariyec/1/> | please use jsonp like this:
```
var video_id='VA770wpLX-Q';
$.ajax({
url: 'http://gdata.youtube.com/feeds/api/videos/'+video_id+'?v=2&alt=jsonc',
success: function(data,status,xhr){alert(data.data.title);},
dataType: 'jsonp'
});
``` |
53,255 | I want to make a matrix which has multiple nodes in a single matrix cell. These nodes should be centered to each other. I managed to make this work by using a nested tikz environment like so:
```
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{positioning}
\begin{document}
\begin{tik... | 2012/04/25 | [
"https://tex.stackexchange.com/questions/53255",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/13887/"
] | In general one can use the `remember picture` option and apply it *all* pictures, that should be accessible later. Since your pictures are nested and the options are inheritable, it’s sufficient to apply `remember picture` only to the upper level `{tikzpicture}`.
```
\documentclass{article}
\usepackage{tikz}
\usetikzl... | You can avoid the nested pictures
```
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[auto, semithick,remember picture,
block/.style={rectangle, draw,
minimum width=5em, text centered, rounded corners, minimum
hei... |
3,484,546 | >
> Let $x,y,z > 0$ such that $3x(x+y+z)=yz$ . Find the minimum value of $$P=\frac{y+z}{x}$$
>
>
>
---
$$3x(x+y+z)=yz\Leftrightarrow 3(x+y)(x+z)=4yz$$
Or $$3(\frac{x}{y}+1)(\frac{x}{z}+1)=4$$
Let $a=x/y, b=x/z ( a,b>0)$
We have: $$4=3(a+1)(b+1)\ge3 \cdot 2 \sqrt a \cdot 2 \sqrt b=12 \sqrt {ab} \rightarrow \sqr... | 2019/12/22 | [
"https://math.stackexchange.com/questions/3484546",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/682364/"
] | Let $y+z=2u$ and $yz=v^2$, where $v>0$.
Thus, since by AM-GM $$\frac{y+z}{2}\geq\sqrt{yz},$$ we obtain $u\geq v$,
$$3x^2+6ux-v^2=0$$ or $$x=-u+\sqrt{u^2+\frac{v^2}{3}}$$ and
$$\frac{y+z}{x}=\frac{2u\left(\sqrt{u^2+\frac{v^2}{3}}+u\right)}{\frac{v^2}{3}}\geq\frac{2v\left(\sqrt{v^2+\frac{v^2}{3}}+v\right)}{\frac{v^2}{3... | Your solution is wrong because in your solution equality occurs when $a=b=1$ which is not possible because $x=y=z$ doesn't satisfy the constraints. Instead, you should use method of lagrange multipliers. Let $m = \frac{y}{x}$ and $n = \frac{z}{x}$. Then, lagrangian
$$L = m+n-\lambda(3(1+m+n)-mn)$$
(the constraint is ob... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.