_id
stringlengths 2
6
| partition
stringclasses 3
values | text
stringlengths 4
46k
| language
stringclasses 1
value | title
stringclasses 1
value |
---|---|---|---|---|
d18301 | test | You cannot do it atomically but you can use limit which reduces it.
return mongoTemplate.find(myQuery.limit(1000), Document::class.java) | unknown | |
d18302 | test | Try replacing the / at the beginning of your rewrite rule. In order for it to actually go to another domain, you must specify http:// before the domain, so your last line would need to be like this:
RewriteRule ^(.*)$ http://www.domain.com/somescript.php?id=$1 [L,QSA]
If you don't specify the http:// it's seen as a relative path and will go off of the domain currently in use, just appending it as a regular relative path.
Or: (This only works on some setups)
Apache (or whatever you're using) doesn't go off of your user's home directory. It uses the root directory for the website. So by specifying the / at the beginning of the domain, you're actually saying /www/images.domain.com/<rest of absolute path>. However, if both these directories are owned by the same user, you can use a relative path to go up to the parent directory and then into the alternative directory, like so:
RewriteRule ^(.*)$ ../www.domain.com/somescript.php?id=$1 [L,QSA]
I wouldn't recommend this much though, as relative paths can easily become broken. | unknown | |
d18303 | test | There are several issues with your code, but to address your question on how to add a space after the 8th position in a string, I'm going to assume you have stored your phone numbers in an array @phone_numbers. This is a task well suited for a regex:
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
my @phone_numbers = (
'+45 23455678',
'+45 12314425',
'+45 43631678',
'+45 12345678'
);
s/^(.{8})/$1 / for @phone_numbers;
print Dumper \@phone_numbers;
Output:
$VAR1 = [
'+45 2345 5678',
'+45 1231 4425',
'+45 4363 1678',
'+45 1234 5678'
];
To apply the pattern to your script, just add:
$elements[2] =~ s/^(.{8})/$1 /;
or alternatively
my @chars = split//, $elements[2];
splice @chars, 8, 0, ' ';
$elements[2] = join"", @chars;
to alter phone numbers within your foreach loop.
A: Here is a more idiomatic version of your program.
use strict;
use warnings;
my $inputfile = shift || die "Need input and output file names!\n";
my $outputfile = shift || die "Need an output file name!\n";
open my $INFILE, '<', $inputfile or die "Bestand niet gevonden :$!\n";
open my $OUTFILE, '>', $outputfile or die "Bestand niet gevonden :$!\n";
my $i = 0;
while (<$INFILE>) {
# print; # for debugging
s/"//g;
my @elements = split /;/, $_;
print join "%", @elements;
$elements[2] =~ s/^(.{8})/$1 /;
my $output_line = join(";", @elements);
print $OUTFILE $output_line;
$i = $i+1;
}
close $INFILE;
close $OUTFILE;
exit 0;
A: use substr on left hand side:
use strict;
use warnings;
while (<DATA>) {
my @elements = split /;/, $_;
substr($elements[2], 8, 0) = ' ';
print join(";", @elements);
}
__DATA__
col1;col2;+45 23455678
col1;col2;+45 12314425
col1;col2;+45 43631678
col1;col2;+45 12345678
output:
col1;col2;+45 2345 5678
col1;col2;+45 1231 4425
col1;col2;+45 4363 1678
col1;col2;+45 1234 5678
A: Perl one liner which you can use for multiple .csv files also.
perl -0777 -i -F/;/ -a -pe "s/(\+45\s\d{4})(\d+.*?)/$1 $2/ for @F;$_=join ';',@F;" s_infile.csv
A: This is the basic gist of how its done. The "prefix" to the numeric string is \+45, which is hard coded, and you may change it as needed. \pN means numbers, {4} means exactly 4.
use strict;
use warnings;
while (<DATA>) {
s/^\+45 \pN{4}\K/ /;
print;
}
__DATA__
+45 234556780
+45 12314425
+45 436316781
+45 12345678
Your code has numerous other problems:
You do not use use strict; use warnings;. This is a huge mistake. It's like riding a motorcycle and protecting your head by putting on a blindfold instead of a helmet. Often, it is an easy piece of advice to overlook, because it is explained very briefly, so I am being more verbose than I have to in order to make a point: This is the most important thing wrong. If you miss all the rest of your errors, it's better than if you miss this part.
Your open statements are two-argument, and you do not verify your arguments in any way. This is very dangerous, because it allows people to perform arbitrary commands. Use the three-argument open with a lexical file handle and explicit MODE for open:
open my $in, "<", $inputfile or die $!;
You slurp the file into an array: @infile=<INFILE> The idiomatic way to read a file is:
while (<$in>) { # read line by line
...
}
What's even worse, you loop with foreach (@infile), but refer to $infile[$i] and keep a variable counting upwards in the loop. This is mixing two styles of loops, and even though it "works", it certainly looks bad. Looping over an array is done either:
for my $line ( @infile ) { # foreach style
$line =~ s/"//g;
...
}
for my $index ( 0 .. $#infile ) { # array index style
$infile[$index] =~ ....
}
But neither of these two loops are what you should use, since the while loop above is much preferred. Also, you don't actually have to use this method at all. The *nix way is to supply your input file name or STDIN, and redirect STDOUT if needed:
perl script.pl inputfile > outputfile
or, using STDIN
some_command | perl script.pl > outputfile
To achieve this, just remove all open commands and use
while (<>) { # diamond operator, open STDIN or ARGV as needed
...
}
However, in this case, since you are using CSV data, you should be using a CSV module to parse your file:
use strict;
use warnings;
use ARGV::readonly; # safer usage of @ARGV file reading
use Text::CSV;
my $csv = Text::CSV->new({
sep_char => ";",
eol => $/,
binary => 1,
});
while (my $row = $csv->getline(*DATA)) { # read input line by line
if (defined $row->[1]) { # don't process empty rows
$row->[1] =~ s/^\+45 *\pN{4}\K/ /;
}
$csv->print(*STDOUT, $row);
}
__DATA__
fooo;+45 234556780;bar
1231;+45 12314425;
oh captain, my captain;+45 436316781;zssdasd
"foo;bar;baz";+45 12345678;barbarbar
In the above script, you can replace the DATA file handle (which uses inline data) with ARGV, which will use all script argument as input file names. For this purpose, I added ARGV::readonly, which will force your script to only open files in a safe way.
As you can see, my sample script contains quoted semi-colons, something split would be hard pressed to handle. The specific print statement will enforce some CSV rules to your output, such as adding quotes. See the documentation for more info.
A: To add a space after the eighth character of a string you can use the fourth parameter of substr.
substr $string, 8, 0, ' ';
replaces a zero-length substring starting at offset 8 with a single space.
You may think it's safer to use regular expressions so that only data in the expected format is changed
$string =~ s/^(\+\d{2} \d{4})/$1 /;
or
$str =~ s/^\+\d{2} \d{4}\K/ /;
will achieve the same thing, but will do nothing if the number doesn't look as it should beforehand.
Here is a reworking of your program. Most importantly you should use strict and use warnings at the start of your program, and declare variables with my at the point of their first use. Also use the three-paramaeter form of open and lexical filehandles. Lastly it is best to avoid reading an entire file into an array when a while loop will let you process it a line at a time.
use strict;
use warnings;
@ARGV == 2 or die "Usage: $0 input-file output-file\n";
my ($inputfile, $outputfile) = @ARGV;
open my $in, '<', $inputfile or die "Bestand niet gevonden: $!";
open my $out, '>', $outputfile or die "Bestand niet gevonden: $!";
while (<$in>) {
tr/"//d;
my @elements = split /;/;
substr $elements[2], 8, 0, ' ';
print $out join ';', @elements;
} | unknown | |
d18304 | test | Are you using Saxon? With Saxon 9.8 I get the same behaviour as you do.
The specification was rephrased between 2.0 and 3.0. In 2.0 it says:
In addition, if these integer-part-grouping-positions are at regular
intervals (that is, if they form a sequence N, 2N, 3N, ... for some
integer value N, including the case where there is only one number in
the list), then the sequence contains all integer multiples of N as
far as necessary to accommodate the largest possible number.
While 3.0 says the following (the third rule is new):
The grouping is defined to be regular if the following conditions
apply:
*
*There is an least one grouping-separator in the integer part of the sub-picture.
*There is a positive integer G (the grouping size) such that the position of every grouping-separator in the integer part of the
sub-picture is a positive integer multiple of G.
*Every position in the integer part of the sub-picture that is a positive integer multiple of G is occupied by a grouping-separator.
If the grouping is regular, then the integer-part-grouping-positions sequence contains all integer
multiples of G as far as necessary to accommodate the largest possible
number.
So your grouping is regular under the 2.0 definition but not under the 3.0 definition. Saxon is apparently implementing the 2.0 definition. I suspect the change was intended as a bug fix, and it appears Saxon has not implemented this change.
As a workaround, you could define the picture as
#-###############################################-##
with the extra grouping separator placed so far out to the left that you will never have a number this large.
(Raised a Saxon issue here: https://saxonica.plan.io/issues/3669) | unknown | |
d18305 | test | Here static variable will help you:
function content_before_after($content) {
// define variable as static
static $content_shown;
// if variable has __no__ value
// it means we run function for the first time
if (!$content_shown) {
// change value and return required string
$content_shown = true;
return 'something goes here';
}
// empty string will be returned in second and other function calls
return '';
} | unknown | |
d18306 | test | The error is in accessing the array outside the size given by co_code,
so it can be fixed by changing the if condition.
Corrected : -
if(k>=j-1) | unknown | |
d18307 | test | you should renew AlphaAnimation
you do it is the right | unknown | |
d18308 | test | Since Kane neglected to turn his comment into an answer, I may as well state it plainly here:
This issue arises when you put the Eclipse folder in a location where Windows will have issues with access control (e.g. the Program Files folder). By moving the folder to my personal user's folder, I was able to use Eclipse normally without this issue. | unknown | |
d18309 | test | There are basically two choices for how to handle this.
One choice is to do what you've mentioned -- compile the relevant paths into the resulting executable or library. Here it's worth noting that if files are installed in different sub-parts of the prefix, then each such thing needs its own compile-time path. That's because the user might specify --prefix separately from --bindir, separately from --libexecdir, etc. Another wrinkle here is that if there are multiple installed programs that refer to each other, then this process probably should take into account the program name transform (see docs on --program-transform-name and friends).
That's all if you want full generality of course.
The other approach is to have the program be relocatable at runtime. Many GNU projects (at least gdb and gcc) take this approach. The idea here is for the program to attempt to locate its data in the filesystem at runtime. In the projects I'm most familiar with, this is done with the libiberty function make_relative_prefix; but I'm sure there are other ways.
This approach is often touted as being nicer because it allows the program's install tree to be tared up and delivered to users; but in the days of distros it seems to me that it isn't as useful as it once was. I think the primary drawback of this approach is that it makes it very hard, if not impossible, to support both relocation and the full suite of configure install-time options.
Which one you pick depends, I think, on what your users want.
Also, to answer the above comment: I think changing the prefix between configure- and build time is not really supported, though it may work with some packages. Instead the usual way to handle this is either to require the choice at configure time, or to supported the somewhat more limited DESTDIR feature. | unknown | |
d18310 | test | Your problem is slightly ill-defined. However, I am 99% confidenct that the answer is the matrix profile [a][b]
If you want more help, give me a more rigorous problem definition.
[a] https://www.cs.ucr.edu/~eamonn/PID4481997_extend_Matrix%20Profile_I.pdf
[b] https://www.cs.ucr.edu/~eamonn/Matrix_Profile_Tutorial_Part1.pdf | unknown | |
d18311 | test | The problem was that I was not flushing stdout. Due to buffering, the printf succeeded, but the fflush failed. | unknown | |
d18312 | test | Yes You can , You can find lot of options here
rows = df3.select('columnname').collect()
final_list = []
for i in rows:
final_list.append(i[0])
print(final_list) | unknown | |
d18313 | test | If you want to compare Strings using your custom character ordering, create a RuleBasedCollator, e.g.
String myRules = "< a, A < b, B < t, T < q, Q < c, C < d, D < e, E < f, F < g, G" +
"< h, H < i, I < j, J < k, K < l, L < m, M < n, N < o, O < p, P" +
"< r, R < s, S < u, U < v, V < w, W < x, X < y, Y < z, Z";
RuleBasedCollator myCollator = new RuleBasedCollator(myRules);
String[] test = { "a", "B", "c", "D", "q", "T", "cc", "cB", "cq", "cT" };
Arrays.sort(test, myCollator);
System.out.println(Arrays.toString(test));
Output
[a, B, T, q, c, cB, cT, cq, cc, D]
A: Store the characters in the order you want in an array char[] or list (List)
Compare based on the index of the character in the list/array
list.indexOf(char1) - list.indexOf(char2);
A: There is a very easy solution:
First put your chars in a List:
char[] arrayChars= {'A','B','T', ... };
List<Character> sortedChars= new ArrayList<Character>();
for (char c : arrayChars) { // Arrays.asList won't work
sortedChars.add(c);
}
And then compare the indexes:
int compare(char a,char b) {
return sortedChars.indexOf(a) - sortedChars.indexOf(b);
}
A: I'd do it like this
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
public class Compare {
public static void main(String[] args) {
final List<Character> reference = new ArrayList<Character>(
Arrays.asList(new Character[] {'A','B','T','Q','C','D','E','F'}));
Character[] toBeSorted = {'A','B','C','D','E','F','Q','T'};
Comparator<Character> myComparator = new Comparator<Character>() {
public int compare(Character o1, Character o2) {
Integer i1 = reference.indexOf(o1);
Integer i2 = reference.indexOf(o2);
return i1.compareTo(i2);
}
};
Arrays.sort(toBeSorted, myComparator);
System.out.println(Arrays.asList(toBeSorted));
}
}
A: the integers (N) carry a what is called a natural order. So you simply put your stuff in a list indexed by integers, following the order you want to implement. Then when the time comes to compare 2 chars, you compare their indexes and that's it !
A: Finally, I use String but it works fine with that :
public class IndiceRepetitionComparator implements Comparator<String> {
List<String> relationOrdre = Arrays.asList("A", "B", "T", "Q", "C", "D", "E", "F", "G", "H", "I", "J", "K",
"L", "M", "N", "O", "P", "R", "S", "U", "V", "W", "X", "Y", "Z");
@Override
public int compare(String indiceRepetition1, String indiceRepetition2) {
// même objet
if (indiceRepetition1 == indiceRepetition2) {
return 0;
}
if (indiceRepetition1 == null) {
return -1;
}
if (indiceRepetition2 == null) {
return -1;
}
return (relationOrdre.indexOf(indiceRepetition1) - relationOrdre.indexOf(indiceRepetition2) > 0) ? 1 : -1;
}
}
Thank you for your help | unknown | |
d18314 | test | I had this same problem. I had created a base page where clicking on a nav element triggered an $.ajax() fetch of an inc file that would populate the main div on the page - as follows:
$(document).ready(function(){
// Set trigger and container variables
var trigger = $('nav.primary ul li a'),
container = $('#se-main');
trigger.on('click', function(){
// Set click target from data attribute
target = this.target;
$.ajax({
url:'../inc/'+target + '.inc',
success: function(data){
// Load target page into container
container.html(data);
},
dataType: "text" // this seems to be ignored in Firefox
});
// snip other stuff
});
The Firefox console always logged the 'junk after document element' error unless I edited the INC files and wrapped the text in <html></html>. (The page content still updated, though - so the user wasn't held up by it).
To fix this: add inc to the text/html line in the apache mime.types config file.
Find the line with
text/html html htm
change to
text/html html htm inc
Then restart apache.
That worked for me.
Default file locations:
Linux: /etc/mime.types;
WAMP: [wampdir]\bin\apache\[apacheversion]\conf\mime.types
XAMPP: [xamppdir]\apache\conf\mime.types
Where [wampdir] is wherever you installed WAMP/XAMPP, and [apacheversion] is the version of apache that WAMP is using.
This solution is no use if you don't have access to the mime.types file, or if you're running on shared hosting.
In that case - assuming that you have access to .htaccess - adding the following to .htaccess might work -
AddType text/html .html .htm .inc | unknown | |
d18315 | test | The OpenCV DLL comes with the Computer Vision System Toolbox for MATLAB. It sounds like the Computer Vision System Toolbox is not correctly installed on your computer. | unknown | |
d18316 | test | You should never store/reference activity context (an activity is a context) for longer than the lifetime of the activity otherwise, as you rightly say, your app will leak memory. Application context has the lifetime of the app on the other hand so is safe to store/reference in singletons. Access application context via context.getApplicationContext().
A: If you are aware of Android lifecycles and are careful to distinguish the Application Context and the Context of Activities and Services then there is no fault injecting the Context using Dagger 2.
If you are worried about the possibility of a memory leak you can use assertions to prevent injection of the wrong Context:
public class MyActivityHelper {
private final Context context;
@Inject
public MyActivityHelper (Context context) {
if (context instanceof Application) {
throw new IllegalArgumentExecption("MyActivityHelper requires an Activity context");
}
}
}
Alternatively you could use Dagger 2 Qualifiers to distinguish the two so you don't accidentally inject an app Context where an Activity Context is required. Then your constructor would look something like this:
@Inject
public class MyActivityHelper (@Named("activity") Context context) {
Note also, as per David's comment, a Dagger 2 @Singelton is not necessarily a static reference. | unknown | |
d18317 | test | Without using an extra lib:
const useDebounce = (value, delay, fn) => { //--> custom hook
React.useEffect(() => {
const timeout = setTimeout(() => {
fn();
}, delay);
return ()=> {
clearTimeout(timeout);
}
}, [value]);
};
SomeComponent.js
const [someInputValue, setsomeInputValue] = useState(null);
const fn = ()=> console.log(someInputValue);
useDebounce(someInputValue, 2000, fn); | unknown | |
d18318 | test | Unfortunately, I don't really understand your code, and I also couldn't figure out if you just want plain String-to-byte conversion or if you also want to do some naive encrypting.
In any case, I think the code below does most of what you want. It uses bitmasks to extract the bits from a 0 to 255 integer representing a char (char + 127).
Similary, it uses bitwise OR to convert the binary String[] representation of the String back to chars and finally, back to a String.
public static void main(String[] args)
{
String test = "Don't worry, this is just a test";
List<String> binary = stringToBinary(test);
System.out.println(binary);
System.out.println(binaryToString(binary));
}
public static List<String> stringToBinary(String input)
{
LinkedList<String> binary = new LinkedList<String>();
char[] input_char = input.toCharArray();
for (int c = input_char.length - 1 ; c >= 0; c--)
{
int charAsInt = input_char[c] + 127; // Char range is -127 to 128. Convert to 0 to 255
for (int n = 0; n < 8; n++)
{
binary.addFirst((charAsInt & 1) == 1 ? "1" : "0");
charAsInt >>>= 1;
}
}
return binary;
}
public static String binaryToString(List<String> binary)
{
char[] result_char = new char[binary.size() / 8];
for (int by = 0; by < binary.size() / 8; by++)
{
int charAsInt = 0;
for (int bit = 0; bit < 8; bit++)
{
charAsInt <<= 1;
charAsInt |= binary.get(by * 8 + bit).equals("1") ? 1 : 0;
}
result_char[by] = (char) (charAsInt - 127);
}
return new String(result_char);
} | unknown | |
d18319 | test | Try this:
function CheckStatus() {
var FleetHealthRange = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(Van_05-11).getRange("E2");
var FleetHealth = FleetHealthRange.getValue();
if (How serious? == "Serious Symptom Discovered"){
var emailRange = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Auto-Script-Logic").getRange("A1");
var emailAddress = emailRange.getValue();
var message = 'This Van has serious symptom ' + FleetHealth; // Second column
var subject = '(=sum(Van_05-11!D2)';
MailApp.sendEmail(emailAddress, subject, message);
}
}
How Serious is undefined and if it's a variable it needs to be one string without spaces.
JavaScript Variable Naming
A: Something like this should work:
function CheckStatus() {
//var ss = SpreadsheetApp.openById("120u_KtdWValZXUyn8vaAlEqbNwmRROYMj-fFTx8bPOs");
var FleetHealthRange = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Van_16-23");
var row = FleetHealthRange.getLastRow();
var columns = FleetHealthRange.getLastColumn();
var range = FleetHealthRange.getRange(row, 1, 1, columns).getValues();
// By default, range is a 2D array so range[0][0] has the first column
var lastrow = range[0];
Logger.log("Reading row " + row + " columns " + columns)
//var FleetHealth = FleetHealthRange.getValue();
var column_serious = 5 //column number you want to compare, in this case 5 is column E
if (lastrow[column_serious] == "Serious Symptom Discovered" || lastrow[column_serious] == "Critical Immediate Action Requested")
{
var emailAddress = lastrow[0];
var message = '(=sum(Van_16-23!A2:E20)'
var subject = 'This Van 16-23 has serious symptom';
MailApp.sendEmail('#####@gmail.com', subject, message);
}
}
I placed the code here:
https://docs.google.com/spreadsheets/d/197oWwBDmB0iI3Ry9Km6mfO73Jjx9RWjXHI-bAM28bZs/edit?usp=sharing | unknown | |
d18320 | test | This could be achieved like so:
*
*To get the same colors in all plots map time_pos on color instead of colors, .i.e color = ~time_pos. Using colors I set the color palette to the default colors (otherwise I get a bunch of warnings).
*The tricky part is to get only two legend entries for today and yesterday. First map time_pos on legendgroup so that the traces in all subplots get linked. Second use showlegend to show the legend only for one of the plots, e.g. the first metric.
*To add titles to the subplots I make use of add_annotations following this post
library(plotly)
plot <- function(df) {
.pal <- RColorBrewer::brewer.pal(3, "Set2")[c(1, 3)]
subplotList <- list()
for(metric in unique(df$metrics)){
showlegend <- metric == unique(df$metrics)[1]
subplotList[[metric]] <- df[df$metrics == metric,] %>%
plot_ly(
x = ~ hr,
y = ~ actual,
color = ~ time_pos,
colors = .pal,
legendgroup = ~time_pos,
showlegend = showlegend,
hoverinfo = "text",
hovertemplate = paste(
"<b>%{text}</b><br>",
"%{xaxis.title.text}: %{x:+.1f}<br>",
"%{yaxis.title.text}: %{y:+.1f}<br>",
"<extra></extra>"
),
type = "scatter",
mode = "lines+markers",
marker = list(
size = 7,
color = "white",
line = list(width = 1.5)
),
width = 700,
height = 620
) %>%
add_annotations(
text = ~metrics,
x = 0.5,
y = 1,
yref = "paper",
xref = "paper",
xanchor = "center",
yanchor = "bottom",
showarrow = FALSE,
font = list(size = 15)
) %>%
layout(autosize = T, legend = list(font = list(size = 8)))
}
subplot(subplotList, nrows = length(subplotList), margin = 0.05)
}
plot(x) | unknown | |
d18321 | test | You would feed the data into chunks with a for loop.
Cory Schafer's video demonstrates this in his video:
https://www.youtube.com/watch?v=Uh2ebFW8OYM&t=607s | unknown | |
d18322 | test | You can try to do the following to your config file:
Choice 1:
[yolo]
focal_loss=1
Choice 2 (more effective):
[yolo]
counters_per_class=100, 2000, 300, ... # number of objects per class in your Training dataset
To calculate the counters_per_class, refer to this link
More details here
Choice 3: Do both Choice 1 & Choice 2
A: for yolov7, you can :
*
*Adjust the focal loss with the parameter : h['fl_gamma'] | unknown | |
d18323 | test | Yes, it is possible to send multiple update commands on one operation.
You would need to add the commands to your string builder and number the SQL parameters.
SqlCommand command = connection.CreateCommand()
var querySb = new Stringbuilder();
for(int i = 0; i < trucks.Count; i++)
{
[...]
if (truck.Speed.HasValue)
{
querySb.Append(" , Speed = @Speed" + i);
command.Parameters.AddWithValue("@Speed" + i, truck.Speed);
}
querySb.AppendLine();
}
command.CommandText = querySb.ToString();
command.ExecuteNonQuery();
You might create smaller batches of rows (not send all rows at once), maximum number of parameters in one command is 2,098.
A: I recommend using some kind of bulk operations, since multiple separate db roundtrips produces excess overhead (as you have noticed).
Bulk updates can be implemented i.e with following methods:
*
*By using external library which is specialized on high-speed Bulk operations
*By crafting sql stored procedure which takes array of data as parameter. More information about table-valued parameters can be found in https://learn.microsoft.com/en-us/sql/relational-databases/tables/use-table-valued-parameters-database-engine
*Store all the rows with a BULK INSERT operation to a temporary table and run the T-SQL MERGE operation from temp table to actual data table with a single database transaction. | unknown | |
d18324 | test | Pass your validations to React either as props or data attributes if your Rails app serves HTML, or in the JSON if it's a Single Page App (SPA).
Continue to validate server-side as well as it's dangerous to perform client-side only validation as it can be bypassed with direct server calls.
If you're passing JSON with constraints, you might want to consider a structure that would mimic available html5 validation attributes or your custom validation names.
{
"product": {
"attributes": {
"name": {
"type":"string",
"pattern":"[A-Za-z]",
},
"price": {
"type":"decimal",
"max":"20.00",
"min":"5.00",
},
}
}
}
A: If you use a form system like Formik you can serve a dynamic validation script by ssr. The usual way this is managed anyway is to keep validation separated | unknown | |
d18325 | test | Instead of trying to call multiple functions on you click event, you can simply refactor it by doing this. onClick() serves as the function that handles the click event.
<button onclick="onClick()">Fill Names</button>
And on your JavaScript,
function onClick() {
myFunction();
myFunction2();
lovely2();
lovely5();
}
onClick() will be fired when the user clicks on that button, and this will ensure that all the 4 functions will be called.
A: You can call all the functions within another function and fire that when the button is clicked. I don't think it is possible to call all functions within the html event at once.
<button onclick="clicked()">Click me</button>
function clicked() {
myFunction();
myFunction2();
lovely2();
lovely5();
}
This code will still not work thought because in your current javascript, lovely2() and lovely() are nested within myFunction2() so you cannot call them and calling myFunction2() will not call them either. You will need to move them outside, like this
function myFunction() {
var str = document.getElementById("myname").innerHTML;
var res = str.replace("_____",
document.querySelector('input[name="name"]').value);
document.getElementById("myname").innerHTML = res;
}
function myFunction2() {
var str = document.getElementById("theirname").innerHTML;
var res = str.replace("_____",
document.querySelector('input[name="theirname"]').value);
document.getElementById("theirname").innerHTML = res;
}
function lovely2() {
var str = document.getElementById("myname1").innerHTML;
var res = str.replace("_____",
document.querySelector('input[name="name"]').value);
document.getElementById("myname1").innerHTML = res;
}
function lovely5() {
var str = document.getElementById("theirname1").innerHTML;
var res = str.replace("_____",
document.querySelector('input[name="theirname1"]').value);
document.getElementById("theirname1").innerHTML = res;
}
A: There is a few typo in your code - incorrect position of } and input[name="theirname1"].
function myFunction() {
var str = document.getElementById("myname").innerHTML;
var res = str.replace("_____",
document.querySelector('input[name="name"]').value);
document.getElementById("myname").innerHTML = res;
}
function myFunction2() {
var str = document.getElementById("theirname").innerHTML;
var res = str.replace("_____",
document.querySelector('input[name="theirname"]').value);
document.getElementById("theirname").innerHTML = res;
}
function lovely2() {
var str = document.getElementById("myname1").innerHTML;
var res = str.replace("_____",
document.querySelector('input[name="name"]').value);
document.getElementById("myname1").innerHTML = res;
}
function lovely5() {
var str = document.getElementById("theirname").innerHTML;
var res = str.replace("_____",
document.querySelector('input[name="theirname"]').value);
document.getElementById("theirname1").innerHTML = res;
}
<div id="form1">
<form>
<p><br><input type="text" class="name1" name="name" placeholder="VXA Name">
<br>
</p>
<p><br><input type="text" class="name2" placeholder="CX Name" name="theirname">
</form>
<div class="forms">
<button onclick="myFunction(); myFunction2(); lovely2(); lovely5()">Fill Names</button>
<button class="2" onclick="#">Reset</button>
</div>
</div>
<div id="box1">
<a>Thank you, </a> <a id="theirname">_____</a>, for contacting Us. My name is<a id="myname"> _____, and I'd be more than happy to assist you today.
<a class="copy">Copy text</a>
</a>
</div>
<div id="box2">
<a>Thank you, </a> <a id="theirname1">_____</a>, for contacting Us. My name is<a id="myname1"> _____, and I'd be more than happy to assist you today.
<a class="copy">Copy text</a>
</a>
</div> | unknown | |
d18326 | test | Here is the answer, I figured out how to do it within my constraints.
Make datasets for each file, define each mini batch size for each, and concatenate the get_next() outputs together. This fits on my machine and runs efficiently. | unknown | |
d18327 | test | Check this snippet
Updated
$("a").bind("mousemove", function(event) {
$("div.tooltip").css({
top: event.pageY + 10 + "px",
left: event.pageX + 10 + "px"
}).show();
})
$('.close').bind('click', function(){
$("div.tooltip").fadeOut();
});
body{
font-family:arial;
font-size:12px;
}
.tooltip {
width:350px;
position:absolute;
display:none;
z-index:1000;
background-color:#CB5757;
color:white;
border: 1px solid #AB4141;
padding:15px 20px;
box-shadow: 0px 3px 2px #8D8D8D;
border-radius: 6px;
}
.close{
right: 15px;
position: absolute;
background: #fff;
color: #555;
width: 20px;
height: 20px;
text-align: center;
line-height: 20px;
border-radius: 50%;
font-size: 10px;
cursor:pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="main">
<p>Pellentesque habitant <a href="#">Link to show tooltip</a> morbi senectus
tristique senectus et netus et malesuada pellentesque habitant senectus
fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies
eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper.
Aenean ultricies mi vitae est. Mauris placerat eleifend leo.
</p>
<div class="tooltip">
<span class="close">X</span>
<h3>Tooltip title</h3>
<p>Vestibulum tortor quam, feugiat vitae, ultricies
eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper.
Aenean ultricies mi vitae est. Mauris placerat eleifend leo.
</p>
<form>
<input type="email" placeholder="[email protected]" />
<input type="submit" value="subscribe" />
</form>
<span class="branding">This is our branding message</span>
</div>
A: Follow these steps:
*
*Add the link and the tooltip div inside a new div.
*Set tooltip div property to be visibility: hidden;
*and on hover set the property of this tooltip to be visible.
like:
HTML:
<div class="link"> <a href="#">Link to show tooltip</a>
<div class="tooltip"> ......</div>
</div>
CSS:
.link {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.link .tooltip {
visibility: hidden;
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
position: absolute;
z-index: 1;
}
.link:hover .tooltip {
visibility: invisible;
}
A: You could try to display yout tooltip element with the tilde selector on link hover:
.tooltip {
display: none;
}
a:hover ~ .tooltip{
display: block;
}
And then place your tooltip after the link element.
<p>
blabla
<a href="#">hover me</a>
<span class="tooltip">tooltip content</span>
blabla
</p>
Here a pen where it works | unknown | |
d18328 | test | I think I would tackle this as a shell script, rather than applescript.
The following script will iterate over your set of files in numerical order, and produce plain text output. You can redirect this to a text file. I don't have access to Apple's Numbers, but I'd be very surprised if you can't import data from a plain text file.
I have hard-coded the max file index as 5. You'll want to change that.
If there are any files missing, a 0 will be output on that line instead. You could change that to a blank line as required.
Also I don't know if your files end in newlines or not, so the cat/read/echo line is one way to just get the first token of the line and not worry about any following whitespace.
#!/bin/bash
for i in {1..5} ; do
if [ -e w_$i.txt ] ; then
cat w_$i.txt | { IFS="" read -r n ; echo -e "$n" ; }
else
echo 0
fi
done
A: If all files end with newlines, you could just use cat:
cd ~/Documents/some\ folder; cat w_*.txt | pbcopy
This works even if the files don't end with newlines and sorts w_2.txt before w_11.txt:
sed -n p $(ls w_*.txt | sort -n) | unknown | |
d18329 | test | This is the relevant code that's determining how to coerce column names in result sets, which is converting the strings to lower-case by default.
Try (fetch "select Number from EEComponents" {:identifiers identity}) to leave the strings as-is, or {:identifiers keyword} to turn them into keywords.
(I'd also consider using https://github.com/clojure/java.jdbc) | unknown | |
d18330 | test | This is more about the design of your software then simplifying it. Often you would have a structure with classes that you use and separate PHP files for types of responses.
For example:
You could have the documents: classes.php, index.php and ajax.php.
The classes would contain generic classes that can both be shown as JSON or as HTML.
PS:Simplified could mean:
/********************************************** Search.php ****/
... // some html codes
<div id="content">
<?php
$obj = new classname;
$results = obj->func($_SERVER["HTTP_X_REQUESTED_WITH"]);
echo $results;
?>
</div>
... // some html codes
/********************************************** Classname.php ****/
class classname {
public function func($type){
$arr = ('key1'=>'some', 'kay2'=>'data');
if(!empty($type["HTTP_X_REQUESTED_WITH"]) &&
strtolower($type["HTTP_X_REQUESTED_WITH"]) === "xmlhttprequest"){
echo json_encode($arr);
} else {
return $arr;
}
}
}
A: You can write a single code, and you should use only partials to load AJAX data. The main reason we are using AJAX is to minimize data transfer. You should not load a full page HTML in an AJAX call, although it is perfectly valid.
I would suggest from my experience is, have a single file:
<?php
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
/* special ajax here */
die(json_encode($data));
} else { ?>
Regular Flow of Content
<?php } ?>
A: I would first do all the business logic, calling on your classes, without any dependency on whether you are in an ajax call or not. When all is ready for output, make the switch:
Search.php:
<?php
// first do your business logic without view dependency.
$obj = new classname;
$results = obj->func(); // no type is passed.
if(!empty($_SERVER["HTTP_X_REQUESTED_WITH"]) &&
strtolower($_SERVER["HTTP_X_REQUESTED_WITH"]) === "xmlhttprequest")
{
// ajax request
echo json_encode($results);
exit();
}
// http request
?>
... // some html codes
<div id="content">
<?=$results?>
</div>
... // some html codes
Classname.php:
<?php
class classname {
public function func(){
$arr = ('key1'=>'some', 'kay2'=>'data');
return $arr;
}
}
?> | unknown | |
d18331 | test | Perhaps your customer doesn't want people "guessing" incremental or string IDs in the URL, which is how a lot of insecure web applications get hacked (E.g. Sony) right? It's a slightly-uninformed demand, but well intentioned. I understand your pain.
Would your customer know the difference between a hashed and encrypted ID? Maybe your life could be simpler if you just used salted+hashed IDs, which adds just as much obfuscation (not security!) to the URL, minus the need to URLEncode the encrypted value.
Ideally, you could get this "encrypted ID" requirement punted in favor of a combination of SSL, an authentication system with page level rights-enforcement, and solid audit trail logging. This is standard web application security stuff. | unknown | |
d18332 | test | Are you using in this way
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
if(resultCode == RESULT_OK) {
// stub here
}
}
} | unknown | |
d18333 | test | Yes the above is possible. I still don't get it where is the problem statement. Did you try above? is it failing? if yes then what is the error?
1) Yes, You can have 2 @Test methods in one class using same data provider.
2) If in the same sheet if you are using same data for this tests then there is no problem at all. if there is different data for different test then in your data provider toggle between test data using method name.
Let me know if you need further help. | unknown | |
d18334 | test | There is a build-in Hub.Clients.Others to achieve your requirement.
Here is a sample:
public class ChatHub : Hub
{
public async Task SendMessage(string user, string message)
{
await Clients.Others.SendAsync("ReceiveMessage", user, message);
}
}
Reference:
https://learn.microsoft.com/en-us/aspnet/core/signalr/hubs?view=aspnetcore-3.1#the-clients-object | unknown | |
d18335 | test | You should be able to just do something like this...
=Sum(Fields!myAmountField.Value) / CountDistinct(Fields!myMonthField.Value)
if your report spans more than one year you may have to do something like
=Sum(Fields!myAmountField.Value, "myYearGroupName") / CountDistinct(Fields!myMonthField.Value, "myYearGroupName") | unknown | |
d18336 | test | The problem was in the icon itself. It did load it like it should, but for some reason it didn't display like it should.
I remade the icon I was trying to use to different sizes (16x16 up to 512x512) and added them all to the icon list.
stage.getIcons().add(new Image(getClass().getResourceAsStream("/images/logo_16.png")));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/images/logo_32.png")));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/images/logo_64.png")));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/images/logo_128.png")));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/images/logo_256.png")));
stage.getIcons().add(new Image(getClass().getResourceAsStream("/images/logo_512.png")));
Now it uses the icon like it should. | unknown | |
d18337 | test | First, why not #include "lua.hpp", which comes with Lua and does mostly what your luainc.hdoes?
There are two problems with your code:
*
*You don't emit any error message when luadL_loadfile fails.
*You use lua_pcall to call helloWorld but does not test its return value.
When you change lua_pcall to lua_call you get this error message:
attempt to index global 'io' (a nil value)
This means that you forgot to set the global io after calling luaopen_io. Just add lua_setglobal(lua,"io")and it works. Unlike Lua 5.1, Lua 5.2 does not set globals automatically when you open libraries, unless the library itself does it, which is discouraged.
You'll probably be better off calling luaL_openlibs to open all standard Lua libraries with no surprises.
You may as well use luaL_dofile instead of luaL_loadfile and save the first lua_pcall. You still have to check the return value. | unknown | |
d18338 | test | You mistakenly configured TFS (in fact it created a default collection). If read carefully Move Team Foundation Server from one hardware configuration to another, you have to run the AT-only Configuration Wizard after restoring the databases. | unknown | |
d18339 | test | Yes, that is possible with Amazon Pinpoint. Please see documentation regarding setting up and executing a scheduled campaign. https://docs.aws.amazon.com/pinpoint/latest/userguide/campaigns.html
thanks | unknown | |
d18340 | test | Yes, it does. This example shows how to use it:
http://threejs.org/examples/#webgl_gpgpu_birds | unknown | |
d18341 | test | Hierarchical, fixed-depth many-to-one (M:1) relationships between attributes are typically denormalized or collapsed into a flattened dimension table. If you’ve spent most of your career designing entity-relationship models for transaction processing systems, you’ll need to resist your instinctive tendency to normalize or snowflake a M:1 relationship into smaller subdimensions; dimension denormalization is the name of the game in dimensional modeling.
It is relatively common to have multiple M:1 relationships represented in a single dimension table. One-to-one relationships, like a unique product description associated with a product code, are also handled in a dimension table. Occasionally many-to-one relationships are resolved in the fact table, such as the case when the detailed dimension table has millions of rows and its roll-up attributes are frequently changing. However, using the fact table to resolve M:1 relationships should be done sparingly.
In your case I recommend you to have this following design as a solution : | unknown | |
d18342 | test | In order to make your query works, you have to change your field to FloatField:
class Tags(models.Model):
tag_frequency = models.FloatField(default=0.00, null=True, blank=True)
Set null, blank and default values based on your needs.
Then, put your checkboxes (or radio inputs) in your html form like this:
<form action="" method="post">
<!-- other form fields and csrf_token here -->
<div><label for="input_lf"><input type="checkbox" name="is_lf" id="input_lf"> LF</label></div>
<div><label for="input_hf"><input type="checkbox" name="is_hf" id="input_hf"> HF</label></div>
<div><label for="input_uhf"><input type="checkbox" name="is_uhf" id="input_uhf"> UHF</label></div>
<input type="submit" value="Submit"/>
</form>
Then in your view, you can try something like this:
def form_view(request):
if request.method == 'POST':
# these strings come from HTML Elements' name attributes
is_lf = request.POST.get('is_lf', None)
is_hf = request.POST.get('is_hf', None)
is_uhf = request.POST.get('is_uhf', None)
# Now make your queries according to the request data
if is_lf:
LF = Tags.objects.filter(tag_frequency__gt=125, tag_frequency__lt=134.2)
if is_hf:
# another query here
# and rest of your view | unknown | |
d18343 | test | The support for reference counted items (like np.ndarrays) is quite new (since numba 0.39) and I am not sure if working with tuples of ref. counted items already works. Afaik tuples of ref. counted items are not yet supported. So to make sure your code works, you must replace the tuple with a list:
if __name__ == '__main__':
import numpy as np
grid = np.arange(12)
grids = [grid, grid]
bar(grid, grids)
AND make sure you have numba version 0.39 installed! Otherwise this won't work as well.
Of course a list is not a tuple, so this is only a workaround. But there is no other way to solve this problem, as long as tuples of ref. counted items are not fully supported. | unknown | |
d18344 | test | The issue you are running into is that you need to wait until the page has loaded. Here is my suggestion.
First after you log in you can navigate directly to the job list URL. This is likely to be less fragile than using the XPath:
driver.get('https://www.linkedin.com/jobs/collections/recommended/')
The following is the most important piece you are missing:
wait.until(EC.presence_of_all_elements_located((By.CLASS_NAME, 'job-card-list__title')))
You can look into other wait commands here, but the above appeared to work for me.
Next, I noticed that this only lists a few jobs since the rest are dynamically loaded when you scroll. What I did is simulated the scrolling with:
driver.execute_script('res = document.querySelector("#main > div > section.scaffold-layout__list > div"); res.scrollTo(0, res.scrollHeight)')
time.sleep(2)
The sleep of 2 seconds is needed again to give time for that to execute before you get the source.
With that wait and the scroll, your code for getting the list of job names works.
job_src = driver.page_source
soup = BeautifulSoup(job_src, 'html.parser')
job_list_html = soup.select('.job-card-list__title')
print(len(job_list_html))
for job in job_list_html:
print(job.get_text())
You may notice that the job list is paginated, so this code will only get the first page of jobs, but hopefully this gets you on the right track. | unknown | |
d18345 | test | Here's one approach which should work for you.
Setup assumed:
Sheet1 data is in range A1:B8
Sheet2 data is in range A1:B3
Then formula that you should insert in Sheet2!C2 shall be:
=SUM((FREQUENCY(IFERROR(MATCH(IF(Sheet1!$A$1:$A$8=Sheet2!A2,Sheet1!$B$1:$B$8,"z"),IF(Sheet1!$A$1:$A$8=Sheet2!B2,Sheet1!$B$1:$B$8,"a"),0),"a"),IFERROR(MATCH(IF(Sheet1!$A$1:$A$8=Sheet2!A2,Sheet1!$B$1:$B$8,"z"),IF(Sheet1!$A$1:$A$8=Sheet2!B2,Sheet1!$B$1:$B$8,"a"),0),"b"))>0)+0)
NOTE: This is an array formula and shall be inserted by committing CTRL+SHIFT+ENTER and not just ENTER. If entered correctly, Excel put {} braces around it. | unknown | |
d18346 | test | The best way to store and retrieve Uri with Room is to persist it in the form of String. Moreover we already have the APIs to convert Uri to String and vice versa.
There are 2 ways:
*
*You'll handle the conversion of Uri to String and then storing it and same for fetching.
*Let Room do that for you using a TypeConverter.
It's completely your choice and the app requirements to choose the way. That said, here is the TypeConverter for Uri <-> String:
class UriConverters {
@TypeConverter
fun fromString(value: String?): Uri? {
return if (value == null) null else Uri.parse(value)
}
@TypeConverter
fun toString(uri: Uri?): String? {
return uri?.toString()
}
} | unknown | |
d18347 | test | As an alternative to dynamic sql you can use a case expression. This will make the entirety of your procedure this simple.
create procedure test_sp
(
@metric varchar(50) = NULL
,@from_date date =NULL
,@to_date date =Null
)
AS
BEGIN
SET NOCOUNT ON;
select sum(case when @metric = 'Sales' then sales_value else revenue_value end) from <dataset> where metric = @metric
END
A: You need dynamic SQL here. You can't use a variable for an object (table name, column name, etc) without it.
...
declare @sql varchar(max)
--sum the value based on the metric
set @sql = 'select sum(' + @column_name + ') from <dataset> where metric = ' + @metric
print(@sql) --this is what will be executed in when you uncomment the command below
--exec (@sql)
end
--execute the procedure
exec test_sp @metric ='sales'
But, you could eliminate it all together... and shorten your steps
use testdb
go
create procedure test_sp
(
@metric varchar(50) = NULL
,@from_date date =NULL
,@to_date date =Null
)
AS
BEGIN
SET NOCOUNT ON;
--specifying the column name based on the metric provided
if @metric = 'Sales'
begin
select sum('sales_value')
from yourTable
where metric = @metric --is this really needed?
end
else
begin
select sum('revenue_value')
from yourTable
where metric = @metric --is this really needed?
end
Also, not sure what @from_date and @to_date are for since you don't use them in your procedure. I imagine they are going in the WHERE clause eventually. | unknown | |
d18348 | test | Didn't give proper permission to the local directory -- Marking as Community wiki as answer was provided in the comments | unknown | |
d18349 | test | You can to use the ResultTransformer to transform your results in a map form.
Following the oficial documentation
Like this:
List<Map<String,Object>> mapaEntity = session
.createQuery( "select e from Entity" )
.setResultTransformer(new AliasToEntityMapResultTransformer())
.list();
A: Please try with
Query q1 = entityManager().query(nativeQuery);
org.hibernate.Query hibernateQuery =((org.hibernate.jpa.HibernateQuery)q1) .getHibernateQuery();
hibernateQuery.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); | unknown | |
d18350 | test | One way to implement this is using NSNotificationCenter.
The root view controller, in viewDidLoad, would call addObserver:selector:name:object: to make itself an observer for a notification named, say, @"NextPageRequested".
The button(s) on the detail view(s), when tapped, would call postNotificationName:object: to request the root view controller to go to the next page.
In the root view controller, the notification handler method would (assuming the root view controller is a UITableView):
*
*get the current index path using UITableView's indexPathForSelectedRow
*calculate the next index path
*call selectRowAtIndexPath:animated:scrollPosition: to highlight that row
*call the code needed to actually change the page (possibly by calling tableView:didSelectRowAtIndexPath: directly)
A: Give your detailviewcontroller a parent navigationcontroller and add your next button to the navbar via the navigation item. Pressing Next will trigger a pushviewcontroller to the nav-stack.
Or add a top-toolbar to your current view controller and put the button there. | unknown | |
d18351 | test | With range-v3, you may do:
std::vector<unsigned> vec = {5, 6, 5, 4, 1, 3, 0, 4};
auto pair_view = ranges::view::zip(vec | ranges::view::stride(2),
vec | ranges::view::drop(1) | ranges::view::stride(2));
ranges::sort(pair_view);
Demo
A: Not so efficient but a working solution would be:
std::vector<std::pair<size_t,unsigned int>> temp_vec;
temp_vec.reserve(vec.size());
for(size_t i=0;i<vec.size();++i){
temp_vec.emplace_back(i,vec[i]);
}
std::sort(temp_vec.begin(),temp_vec.end(),[](auto l,auto r){
return /* some condition based on l.first and r.first*/;
});
std::transfrom(temp_vec.begin(),temp_vec.end(),vec.begin(),[](auto item){
return item.second;
});
A: This can be implemented by calling std::sort with a custom iterator, that skips indices and with a custom comparison fucnction, that compares the adjacent value if current comparison is equal.
The custom iterator can be built on top of the existing iterator. A construct like that is called an iterator adaptor. You don't need to write such iterator adaptor from scratch yourself, since boost has already done the hard work. You can use boost::adaptors::strided. If you cannot use boost, then you can re-implement it.
Much simpler solution would be to use pairs, though. Or better yet, a structure if there are sensible names for the members.
A: Not the fastest sorting algorithm but it works:
#include <vector>
#include <algorithm>
int main()
{
std::vector<unsigned> vec = { 5, 6, 5, 4, 1, 3, 0, 4 };
if (vec.size() > 1 && vec.size() % 2 == 0)
{
for (size_t i1 = 0, j1 = i1 + 1; i1 < vec.size() - 1 && j1 < vec.size(); i1+=2, j1 = i1+1)
{
for (size_t i2 = i1 + 2, j2 = i2 + 1; i2 < vec.size() - 1 && j2 < vec.size(); i2 += 2, j2 = i2 + 1)
{
if (vec[i1] > vec[i2] || (vec[i1] == vec[i2] && vec[j1] > vec[j2]))
{
std::swap(vec[i1], vec[i2]);
std::swap(vec[j1], vec[j2]);
}
}
}
}
return 0;
}
[On Coliru] | unknown | |
d18352 | test | From SafeArrayAccessData documentation
After calling SafeArrayAccessData, you must call the SafeArrayUnaccessData function to unlock the array.
Not sure this is the actual reason for the leak. But when debugging problems, a good first step is to ensure you are following all the rules specified in the documentation. | unknown | |
d18353 | test | show me the created the Notification channel Details. Then don't test in Redmi or mi Phones.
addListenersForNotifications = async () => {
await PushNotifications.addListener('registration', 'registration Name');
await PushNotifications.addListener('registrationError', 'error');
await PushNotifications.createChannel({
id: 'fcm_default_channel',
name: 'app name',
description: 'Show the notification if the app is open on your device',
importance: 5,
visibility: 1,
lights: true,
vibration: true,
});
await PushNotifications.addListener('pushNotificationReceived', this.pushNotificationReceived);
await PushNotifications.addListener('pushNotificationActionPerformed', this.pushNotificationActionPerformed);
}; | unknown | |
d18354 | test | You could do:
echo date('H:i', (time() + (15 * 60)));
A: try this:
$curtime = date('H:i');
$newtime = strtotime($curtime) + (15 * 60);
echo date('H:i', $newtime);
A: Close, you want:
$new_time = date('H:i', strtotime('+15 minutes'));
A: you can try this - strtotime("+15 minutes")
A: In case anyone wants to make it work in Object-oriented way, here is the solution:
$currentTime = new DateTime();
$currentTime->add(new TimeInterval('PT15M'));
// print the time
echo $currentTime->format('H:i');
Requires PHP >= 5.3 | unknown | |
d18355 | test | The problem was I updated to version 1.8.1 which has a bug. I downloaded version 1.8.0 and it works fine.
A: Happened to me couple of now many times with TortoiseSVN 1.8.2 - 1.8.10. I found this blog post which solved this problem once, until it pops up again. It annoyed me so much that I wrote a quick bat file script that I run from desktop.
Prerequisites
*
*Download and unzip sqlite3 shell tool, e.g. sqlite-shell-win32-x86-3080803.zip
*Adjust paths in the commands below to match your environment
Fix (manual)
Run this if you just want to test if this helps
*
*In CMD do C:\Downloads\sqlite3.exe "C:\src\.svn\wc.db"
*Once in sqlite shell run delete from WORK_QUEUE;
*Run tortoise svn clean up
Fix (automated)
If previous step worked for you, consider automating the process with these steps
*
*Go to your .svn folder, e.g. C:\src\.svn
*Copy sqlite3 shell tool there
*Create a fix-svn.bat file in that folder
*Insert scripting code, and adjust paths
"C:\src\.svn\sqlite3.exe" wc.db "delete from WORK_QUEUE"
"C:\Program Files\TortoiseSVN\bin\svn" cleanup "C:\src"
*Save bat file and make a shortcut to your desktop
*Next time you need to fix it, just run the shortcut on your desktop
A: Okay, I don't know if this may be an issue. I've sen this error happen when sparse checkouts are used. You can adjust what files you see during checkouts via the --depth flag and in updates via the --set-depth flag. If you --set-depth=exclude on certain files, you will see this error if you attempt to add a file.
Try this from the command line. From the ROOT of your working directory:
$ svn cleanup
$ svn update --set-depth=infinity
$ svn status
Make sure all three of these commands work. Then, try the commit.
A: Update to the release candidate has solved the problem for me.
A: sudo svn cleanup
resolve my problem | unknown | |
d18356 | test | Use exit(0); in your program. Don't forget to use include <stdlib.h> | unknown | |
d18357 | test | There is, as you suggested, a Java API in the class path. (You can see the automatic imports in the "Imports" section of the Scala or Java tab in the Language Manager.) If you choose "Class Documentation" under "Help" you will see the documentation for these API classes.
Bad news: there is no real documentation to speak of. There's method names and parameter types—basically what Javadoc will auto-generate for files that have no documentation. The tutorials have some examples using Groovy, which may help some if you can do the mental conversion to Java/Scala. | unknown | |
d18358 | test | If you want statistic to belong to race only, you don't need to use has_many :through. All you need to do is to add the new reference when building a statistic entry by either a new object:
@race = Race.new(....)
@person.statistics.build(value: @value, updated: @updated, race: @race)
or by foreign key (if the referenced race already exists)
@person.statistics.build(value: @value, updated: @updated, race_id: @race.id) | unknown | |
d18359 | test | If you check your browser's devtools console, you will see a Javascript error thrown when you try to add the second select2:
Uncaught query function not defined for Select2 undefined
If you search for that error, you will find some other questions about this, for eg this one: "query function not defined for Select2 undefined error"
And if you read through the answers and comments, you will find several which describe what you are doing:
*
*This comment:
This problem usually happens if the select control has already been initialized by the .select2({}) method. A better solution would be calling the destroy method first. Ex: $("#mySelectControl").select2("destroy").select2({});
*
*This answer:
One of its other possible sources is that you're trying to call select2() method on already "select2ed" input.
*
*Also this answer:
I also had this problem make sure that you don't initialize the select2 twice.
... and possibly more. These describe what you are doing - calling .select2() on elements which are already initialised as select2s.
The second time $('.select2').select2() runs, as well as trying to initialise your new select2, it is re-initialising the first select2 as a select2 again.
You have another problem in your code - every select has the same ID: id='cntType'. IDs must be unique on the page, so this is invalid HTML.
We can solve both problems at once by keeping track of how many selects you have on the page, and giving each new one an ID including its number, like say cntType-1, cntType-2, etc. Then we can target just the new ID to initialise it as a select2.
Here's a working example.
$(document).ready(function () {
// Track how many selects are on the page
let selectCount = 0;
$("#packages").on("click", function () {
// New select! Increment our counter
selectCount++;
//. Add new HTML, using dynamically generated ID on the select
$(this).before(
"<div class='col-12 packageCard'>" +
"<div class='col-4'>" +
"<div class='form-group'>" +
"<label>Container Type</label>" +
"<select name='cntType' id='cntType-" + selectCount + "' class='form-control select2' data-dropdown-css-class='select2' style='width: 100%;'>" +
"<option value='0' selected='selected' disabled>Select Container Type</option>" +
"<option>20 feet</option>" +
"<option>40 feet</option>" +
"</select>" +
"</div>" +
"</div>" +
"</div>");
// Initialise only our new select
$('#cntType-' + selectCount).select2();
});
})
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.0.0/select2.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/2.1.0/select2.min.js"></script>
<button id="packages">Add</button> | unknown | |
d18360 | test | Ok, so I'm assuming that you have the input in a file opened in an Emacs buffer.
(defun insert-quiz (a-buffer)
(interactive "bBuffer name: ")
(let* ((question-pairs (split-string (with-current-buffer a-buffer (buffer-string))))
(quiz-answers (mapcar (lambda (x) (cadr (split-string x "|"))) question-pairs)))
(insert
(apply #'concat
(mapcar
(lambda (x)
(let ((q-pair (split-string x "|")))
(make-question (car q-pair) (answers-list quiz-answers (cadr q-pair)))))
question-pairs)))))
insert-quiz is an interactive function that takes a buffer name, and uses the stuff in that buffer to generate a quiz for you, then insert that quiz at point as a side-effect. It calls some smaller functions which I'll explain below.
(defun make-question (question answers)
(apply #'format
"%-16s[ ] %-16s[ ] %-16s[ ] %-16s[ ] %s \n"
(append
(list (concat question "?"))
answers)))
make-question takes a question and a list of answers, and formats them as one line of the quiz.
(defun answers-list (quiz-answers right-answer)
(replace (n-wrong-answers quiz-answers right-answer)
(list right-answer)
:start1 (random 3)))
answers-list takes a list of all possible answers in the quiz, and the right answer and uses n-wrong-answers to create a list of four answers, one of which is the correct one.
(defun n-wrong-answers (answer-list right-answer &optional answers)
(if (= 4 (list-length answers))
answers
(n-wrong-answers
answer-list
right-answer
(add-to-list 'answers (random-wrong-answer answer-list right-answer)))))
n-wrong-answers takes a list of all possible answers in the quiz, and the right answer, then uses random-wrong-answer to return a list of four unique incorrect answers.
(defun random-wrong-answer (answer-list right-answer)
(let ((gen-answer (nth (random (list-length answer-list)) answer-list)))
(if (and gen-answer (not (string= gen-answer right-answer)))
gen-answer
(random-wrong-answer answer-list right-answer))))
Finally, at the lowest level, random-wrong-answer takes a list of all possible answers in the quiz, and returns a single wrong answer.
After you load the above functions into Emacs, use M-x insert-quiz and type the name of the buffer you have your input loaded into (you'll get tab completion). It wouldn't be too difficult to change the insert-quiz function so that it takes a filename rather than an open buffer-name.
The input you list above will yield:
amarillo? [ ] yellow [ ] orange [ ] gray [ ] red
azul? [ ] gold [ ] purple [ ] blue [ ] orange
blanco? [ ] pink [ ] red [ ] white [ ] black
dorado? [ ] yellow [ ] golden [ ] red [ ] orange
gris? [ ] red [ ] pink [ ] gray [ ] green
marrón? [ ] brown [ ] yellow [ ] white [ ] golden
naranja? [ ] orange [ ] gold [ ] black [ ] golden
negro? [ ] pink [ ] black [ ] blue [ ] white
oro? [ ] red [ ] gold [ ] purple [ ] brown
púrpura? [ ] purple [ ] orange [ ] gray [ ] black
rojo? [ ] gray [ ] red [ ] black [ ] pink
rosa? [ ] red [ ] green [ ] pink [ ] yellow
verde? [ ] green [ ] purple [ ] red [ ] brown
Hope that helps. | unknown | |
d18361 | test | You need to use Comparator with Collections.sort()
Collections.sort(YourArraylist, new Comparator<ModelObject>(){
public int compare(ModelObject o1, ModelObject o2){
return o1.getPrice() - o2.getPrice();
}
});
If you are using Java 8, You can use following code.
Collections.sort(YourArraylist, (o1, o2) -> o1.getPrice() - o2.getPrice()); | unknown | |
d18362 | test | Its because your UI thread (main) is being shared by service unless you define your service in a separate process in manifest. If you start your service in activity's onResume method, till then your service would be visible but still may cause ANR depending on the time (max 5 secs) it takes to complete requests in service.
Its better to put all the socket stuff (or any expensive calls) of your service in a separate thread. In that case, your app will not hang or crash due to ANR.
You should use ThreadHandler and Handler to execute Messages and/or Runnables in a separate thread inside Service. | unknown | |
d18363 | test | In react, we have something called UseState()
First,
import React, { useState } from 'react';
Then Change
const optionsNeighborhood = [];
To
const [optionsNeighborhood, setoptionsNeighborhood] = useState([])
Then Change
for(const i of arrayZones) {
if(e === i.departmentName) {
for(const j of i.neighborhood) {
console.log(j); // ==> Print the correct data
optionsNeighborhood.push(j);
}
}
}
to
for(const i of arrayZones) {
if(e === i.departmentName) {
for(const j of i.neighborhood) {
console.log(j); // ==> Print the correct data
setoptionsNeighborhood([...optionsNeighborhood, j]);
}
}
} | unknown | |
d18364 | test | Connecting synchronous processing by Unicorn with asynchronous delivery using nginx would imply some logic on nginx side that seems at least awkward to me. At most - impossible.
There is a Railscast about Private Pub gem that makes use of Thin webserver. It's way more suitable for this task: it's asynchronous, it's able to handle many concurrent requests with event-based IO. So I suggest you replace Unicorn with Thin or install Thin side-by-side.
Puma webserver might also be an option, however, I can't give more info about that.
A: nginx won't do websockets. Are you sure you can't do this with AJAX? If you really need push capability you could try something built around the Comet approach: http://en.wikipedia.org/wiki/Comet_(programming)
Faye is a pretty good gem for implementing comet in rails:
http://faye.jcoglan.com/ | unknown | |
d18365 | test | I managed to get what I want by using [%hardbreaks] option to keeping line breaks and by using {nbsp} built-in attribute for non-breaking spaces.
Here is the complete code:
[%hardbreaks]
Array(
{nbsp}{nbsp}Element1,
{nbsp}{nbsp}Element2,
{nbsp}{nbsp}Element3
) | unknown | |
d18366 | test | In the passportjs docs
Association in Verify Callback
One downside to the approach described above is that it requires two instances of the same strategy and supporting routes.
To avoid this, set the strategy's passReqToCallback option to true. With this option enabled, req will be passed as the first argument to the verify callback.
passport.use(new TwitterStrategy({
consumerKey: TWITTER_CONSUMER_KEY,
consumerSecret: TWITTER_CONSUMER_SECRET,
callbackURL: "http://www.example.com/auth/twitter/callback",
passReqToCallback: true
},
function(req, token, tokenSecret, profile, done) {
if (!req.user) {
// Not logged-in. Authenticate based on Twitter account.
} else {
// Logged in. Associate Twitter account with user. Preserve the login
// state by supplying the existing user after association.
// return done(null, req.user);
}
}
));
With req passed as an argument, the verify callback can use the state of the request to tailor the authentication process, handling both authentication and authorization using a single strategy instance and set of routes. For example, if a user is already logged in, the newly "connected" account can be associated. Any additional application-specific properties set on req, including req.session, can be used as well.
By the way, you can handle with the current user and its data to link any social strategy including Twitter.
A: You can do that in 2 ways:
*
*Instead of trying to get req.user inside Twitter Strategy, you can get user email fetched from twitter response and match it with user with same email inside database. Normally, you cannot get email directly from Twitter API, you need to fill request form here to get elevated access. After request accepted, you will be able to get email from Twitter API.
*After twitter login, you can save user twitter profile information inside a temp table and redirect a page like /user/do_login?twitter_profile_id=<user_twitter_profile_id_fetched_from_twitter_response>. When you redirect to /user/do_login you will be able to access req.user and also you will have user profile id. In this action, you can grab user profile info from temp table and merge it with req.user. By the way, I assume that, you are using stored session. | unknown | |
d18367 | test | From what you wrote and the comments in your code I am guessing that you want the program to continue running and asking for input if you enter a non-positive number. In that case I would rewrite it as:
print("Welcome to the number program")
total_number = 0
entries = 0
while True:
number = input("Please give me a number \n")
number = int(number)
if number == -999:
break
if number <= 0:
print("Sorry, this value needs to be positive. Please enter a different number.")
continue
total_number = total_number + number
entries += 1
print(total_number)
print(total_number)
print(entries)
print(total_number / entries)
Also, you can increment numbers with entries += 1
A: *
*In most cases you should NOT create variables first, however this case you should. Create number = 0, tally = 0 and total_number = 0 first
*Accept your first number inside your while loop and handle all of the logic in there as well.
*Your while loop should continue to loop until the final condition is met which seems to be number == -999
*Should tally be incremented if you enter a negative number? I assume not. What about a 0? Wrap the increment for tally and the addition to total_number in an if number > -1: condition. Use an if else to check for number == -999, and an else for handling invalid entries.
*Finally, move your print statements outside of your while loop. It also doesn't need a condition around it because now, if you've exited your while loop, that condition has been satisfied.
Final note here, and this is just a nice to know/have and purely syntactic sugar, MOST languages support abbreviated incrementing. Theres a better word for it, but the gist is simply this.
total_number += number
# is exactly the same as
total_number = total_number + number
# but way nicer to read and write :)
print("Welcome to the number program")
number = 0
total_number = 0
entries = 0
while number != -999:
number = input("Please enter a number! \n")
number = int(number)
if number >= 0
total_number += number
entries += 1
print("Current sum: " + total_number)
elif number == -999:
break
else
print("Sorry, this value needs to be positive.")
print("Sum of entries: "+str(total_number))
print("Number of entries: " + str(entries))
print("Average entry: " +str(total_number/entries))
A: I have rewritten your code. But I am not sure what the goal was. Anyways, if the value were ever to be under 0 the loop would have been exited and a new value would have never been accepted from an input.
Also some things I have written more elegant.
print("Welcome to the number program")
number=int(input("Please give me a number \n"))
total_number=0
entries=0
while number > 0:
total_number += number
print(total_number)
number = int(input("Please give me another number! \n"))
entries += 1
if number == -999:
print(total_number)
print(entries)
print(total_number/entries)
break
elif number < 0:
number = input("Sorry, this value needs to be positive. Please enter a different number!") | unknown | |
d18368 | test | I finally solved this problem by Google Analytics superProxy as suggested in the comment of @EikePierstorff.
I wrote a blog on it.
Here's the main idea.
I first build a project on Google App Engile, with which I authenticate for the access of my Google Analytics. Then a URL of query (which can be pageview of certain pages) is generated in JSON format. I can set the refresh rate on this GAE project so that the JSON file can be updated from Google Analytic.
Sounds almost perfect to me. Thank you all guys for help!
A: You can't query the Google Analytics API without authorization by someone, that's the most important thing to remember.
It's certainly possible to display Google Analytics data on your website to users who don't have access to your account, but in order to do that, someone with access to the account needs to authorize and get an access token in order to run queries.
Normally this is done server side, and once you have a valid access token you can query the API client side (to display charts and graph, etc.). Access tokens are typically valid for 1 hour, so if you want to have your website up all the time, you'll also have to deal with refreshing the access token once it expires.
Now, since you're using Github Pages and don't have a back end, which means all the authorization will need to happen client side. While it's technically possible to do the same thing client side as server side, it's generally not a good idea because private data like your client secret, refresh token, etc. will be visible in the source code.
Applications that do auth client side typically don't authorize on behalf of a user. They require the users themselves to go through an auth flow for security reasons (as I just explained), but that would mean those users 1) have to log in, and 2) can only see the analytics data they have access to, which probably isn't what you want.
--
What you can do is run reports periodically yourself and export that data to a Google Spreadsheet. Google Spreadsheets allow you to embed charts and graphs of data as an <iframe> in external pages, so that might be an option.
At the end of the day, if you can't authorize server side you'll have to come up with some kind of workaround to make this happen.
Here are a few possibly helpful links that might point you in the right direction:
https://developers.google.com/analytics/solutions/google-analytics-spreadsheet-add-on
https://developers.google.com/analytics/devguides/reporting/embed
https://developers.google.com/analytics/solutions/report-automation-magic | unknown | |
d18369 | test | When the program begins, sel is uninitialized and contains a garbage value. This garbage value is used in the while condition on its first iteration
while(sel != 5)
and as such invokes Undefined Behaviour.
You must restructure your loop to not read this uninitialized value, or simply initialize sel (to something other than 5).
Similarly, the contents of ventas, ventasXproductos, and promedioXdia are all uninitialized as well.
This means statements such as
ventasXproducto[i] = ventasXproducto[i] + ventas[i][j];
/* ... and ... */
promedioXdia[i] = promedioXdia[i]/cont;
will be operating with garbage values to start.
You can fix this by initializing your arrays:
float ventas[50][7] = { 0 }, ventasXproductos[50] = { 0 }, promedioXdia[7] = { 0 };
You should not ignore the return value of scanf. You should always check that its return value is the expected number of successful conversions, otherwise you will find yourself operating on incomplete data.
/* An example */
if (2 != scanf("%d%d", &num1, &num2)) {
/* handle failure */
}
(Better yet: avoid using scanf, and use fgets and sscanf to read and parse lines of input.)
You should clarify this expression by adding more parenthesis, otherwise you will run into issues with operator precedence:
while ((ciclos == 's' || ciclos == 'S') && cont < 50)
case 4 of the switch has misleading indentation. Only the first statement with the call to printf is contained within the else block. It is read as:
if(lectura == false)
printf("Primero ingresa los datos del producto!!!\n");
else
printf("%35s\n", "Total de ventas");
for(i=0;i<cont;i++)
printf("%d %.2f\n", i+1, ventasXproductos[i]);
/* ... */
Your lectura flag will not protect you from operating on incomplete data if this is selected. Enclose the code with curly braces:
case 4:
if(lectura == false) {
printf("Primero ingresa los datos del producto!!!\n");
} else {
printf("%35s\n", "Total de ventas");
for(i=0;i<cont;i++)
printf("%d %.2f\n", i+1, ventasXproductos[i]);
/* ... */
}
break;
Note that in &*seleccion, & and * balance each other out. This resolves to the same value as just writing seleccion would.
Note that fflush(stdin); is also (technically) Undefined Behaviour, and should not be relied upon. | unknown | |
d18370 | test | Shibboleth supports IIS using "native module" package (iis7_shib.dll).
Check this https://wiki.shibboleth.net/confluence/display/SP3/IIS for further information. | unknown | |
d18371 | test | I made a little example of how to use a TestScheduler. I think it's very similar to the .NET implementation
@Test
public void should_test_the_test_schedulers() {
TestScheduler scheduler = new TestScheduler();
final List<Long> result = new ArrayList<>();
Observable.interval(1, TimeUnit.SECONDS, scheduler)
.take(5)
.subscribe(result::add);
assertTrue(result.isEmpty());
scheduler.advanceTimeBy(2, TimeUnit.SECONDS);
assertEquals(2, result.size());
scheduler.advanceTimeBy(10, TimeUnit.SECONDS);
assertEquals(5, result.size());
}
https://github.com/bric3/demo-rxjava-humantalk/blob/master/src/test/java/demo/humantalk/rxjava/SchedulersTest.java
EDIT
According to your code : you should pass the scheduler to the Observable.interval operation, as this is what you want to control :
TestScheduler scheduler = new TestScheduler();
Observable<Long> tick = Observable.interval(1, TimeUnit.SECONDS, scheduler);
Subscription toBeTested = Observable.from(Arrays.asList(1, 2, 3, 4, 5))
.buffer(3)
.zipWith(tick, (i, t) -> i)
.subscribe(System.out::println);
scheduler.advanceTimeBy(2, TimeUnit.SECONDS);
A: you have some class:
public class SomeClass {
public void someMethod() {
Observable<Long> tick = Observable.interval(1, TimeUnit.SECONDS);
contactsRepository.find(index)
.buffer(MAX_CONTACTS_FETCH)
.zipWith(tick, new Func2<List<ContactDto>, Long, List<ContactDto>>() {
@Override
public List<ContactDto> call(List<ContactDto> contactList, Long aLong) {
return contactList;
}
}).subscribe()
}
}
Look up [Observable.interval][1] in the docs and you will see it operates on the computation scheduler, so lets override that in our test.
public class SomeClassTest {
private TestScheduler testScheduler;
@Before
public void before() {
testScheduler = new TestScheduler();
// set calls to Schedulers.computation() to use our test scheduler
RxJavaPlugins.setComputationSchedulerHandler(ignore -> testScheduler);
}
@After
public void after() {
// reset it
RxJavaPlugins.setComputationSchedulerHandler(null);
}
@Test
public void test() {
SomeClass someInstance = new SomeClass();
someInstance.someMethod();
// advance time manually
testScheduler.advanceBy(1, TimeUnit.SECONDS);
}
This solution is an improvement to the accepted answer as the quality, integrity and simplicity of the production code is maintained. | unknown | |
d18372 | test | In postman you are doing a post and in browser by default it's a GET
So the error says there is no endpoint that accepts a GET method.
If you change method to get in postman you should get same 404 | unknown | |
d18373 | test | If you take a look at the NSString reference you will get various methods to get the data from a string. An example is
NSData *bytes = [yourString dataUsingEncoding:NSUTF8StringEncoding];
You can also make use of the method UTF8String | unknown | |
d18374 | test | Mixing private and public objects inside a bucket is usually a bad idea. If you only need those objects to be public for a couple of minutes, you can create a pre-signed GET URL and set a desired expiration time. | unknown | |
d18375 | test | Without further information on your problem, and being both languages (scala and groovy) executed over the JVM, I would suggest you just to compile your groovy code and include the jar in the classpath of the JVM running your scala code.
Here you have some ideas about how to turn groovy code into usable bytecode: http://docs.groovy-lang.org/latest/html/documentation/tools-groovyc.html
Then do just do as you would with any java library that you would like to call from scala: Using Java libraries in Scala | unknown | |
d18376 | test | I don't know if this is related or not but I was using jQuery recently using the $.ajax() method to submit POST data from a text field to a php script. The php script would then parse the data (XML) for the bits of information that I needed. I noticed an error on my firephp output that it was unable to parse the XML from the POSTed form. I then had it output the strlen() and the data and noticed it was cutting it from around 7k bytes down to 268 (or 256 or something I forget the exact amount). This made it an incomplete and not valid XML pile of data. I fixed this by using the $.post() method instead. Worked perfectly.
A: You could simply check the length of your string, and if it's over the limit, split it up. Run the first portion in the insert, then do a += update on the field with the second portion. It's a bit crude, but it gets around the bug. | unknown | |
d18377 | test | TableAID int,
Col1 varchar(8)
TableB:
TableBID int
Col1 char(8),
Col2 varchar(40)
When I run a SQL query on the 2 tables it returns the following number of rows
SELECT * FROM tableA (7200 rows)
select * FROM tableB (28030 rows)
When joined on col1 and selects the data it returns the following number of rows
select DISTINCT a.Col1,b.Col2 FROM tableA a
join tableB b on a.Col1=b.Col1 (6578 rows)
The above 2 tables on different databases so I created 2 EF models and retried the data separately and tried to join them in the code using linq with the following function. Surprisingly it returns 2886 records instead of 6578 records. Am I doing something wrong?
The individual lists seems to return the correct data but when I join them SQL query and linq query differs in the number of records.
Any help on this greatly appreciated.
// This function is returning 2886 records
public List<tableC_POCO_Object> Get_TableC()
{
IEnumerable<tableC_POCO_Object> result = null;
List<TableA> tableA_POCO_Object = Get_TableA(); // Returns 7200 records
List<TableB> tableB_POCO_Object = Get_TableB(); // Returns 28030 records
result = from tbla in tableA_POCO_Object
join tblb in tableB_POCO_Object on tbla.Col1 equals tblb.Col1
select new tableC_POCO_Object
{
Col1 = tblb.Col1,
Col2 = tbla.Col2
};
return result.Distinct().ToList();
}
A: The problem lies in the fact that in your POCO world, you're trying to compare two strings using a straight comparison (meaning it's case-sensitive). That might work in the SQL world (unless of course you've enabled case-sensitivity), but doesn't quite work so well when you have "stringA" == "StringA". What you should do is normalize the join columns to be all upper or lower case:
join tblb in tableB_POCO_Object on tbla.Col1.ToUpper() equals tblb.Col1.ToUpper()
Join operator creates a lookup using the specified keys (starts with second collection) and joins the original table/collection back by checking the generated lookup, so if the hashes ever differ they will not join.
Point being, joining OBJECT collections on string data/properties is bad unless you normalize to the same cAsE. For LINQ to some DB provider, if the database is case-insensitive, then this won't matter, but it always matters in the CLR/L2O world.
Edit: Ahh, didn't realize it was CHAR(8) instead of VARCHAR(8), meaning it pads to 8 characters no matter what. In that case, tblb.Col1.Trim() will fix your issue. However, still keep this in mind when dealing with LINQ to Objects queries.
A: This might happen because you compare a VARCHAR and a CHAR column. In SQL, this depends on the settings of ANSI_PADDING on the sql server, while in C# the string values are read using the DataReader and compared using standard string functions.
Try tblb.Col1.Trim() in your LINQ statement.
A: As SPFiredrake correctly pointed out this can be caused by case sensitivity, but I also have to ask you why did you write your code in such a way, why not this way:
// This function is returning 2886 records
public List<tableC_POCO_Object> Get_TableC()
{
return from tbla in Get_TableA()
join tblb in Get_TableB() on tbla.Col1 equals tblb.Col1
select new tableC_POCO_Object
{
Col1 = tblb.Col1,
Col2 = tbla.Col2
}.Distinct().ToList();
}
where Get_TableA() and Get_TableB() return IEnumerable instead of List. You have to watch out for that, because when you convert to list the query will be executed instantly. You want to send a single query to the database server. | unknown | |
d18378 | test | Please share your effort / code along with your question always.
According to me this can go with many scenarios
One of the scenarios would be like,
User have One Cart, Cart will have many products and many Products belongs to many carts
Code goes as below, You can go ahead and add required parameters to the entity.
User Entity
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name = "USERS")
public class User {
@Id
@Column(name = "ID")
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "USER_NAME")
private String userName;
@OneToOne(mappedBy = "user", fetch = FetchType.LAZY)
private Cart cart;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Cart getCart() {
return cart;
}
public void setCart(Cart cart) {
this.cart = cart;
}
}
Cart Entity
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name = "CART")
public class Cart {
@Id
@Column(name = "ID")
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "USER_ID")
private User user;
@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinTable(name = "CART_PRODUCT", joinColumns = @JoinColumn(name = "CART_ID") , inverseJoinColumns = @JoinColumn(name = "PRODUCT_ID") )
private Set<Product> products;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public Set<Product> getProducts() {
return products;
}
public void setProducts(Set<Product> products) {
this.products = products;
}
}
Product Entity
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
@Entity
@Table(name = "PRODUCT")
public class Product {
@Id
@Column(name = "ID")
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "name")
private String productName;
@ManyToMany(cascade = CascadeType.ALL, mappedBy = "products")
private Set<Cart> carts;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public Set<Cart> getCarts() {
return carts;
}
public void setCarts(Set<Cart> carts) {
this.carts = carts;
}
} | unknown | |
d18379 | test | On Android platform: MainThread == UiThread == "ApplicationThread" (it doesn't really exists), so in your case the new Activity will NOT start a new Service but Service's OnStartCommand() method will be raised. The Service will continue to run in the "ApplicationThread".
A: According to the Android Developer Doc,
A service runs in the main thread of its hosting process; the service does not create its own thread and does not run in a separate process unless you specify otherwise.
A: When you start an app by clicking on app's icon on launcher or home screen, Android will create a process for the app with a single thread (aka main or UI thread) of execution. This thread will exist even though there is no component started, such as Activity, Service, BroadcastReceiver, ContentProvider.
Then, it will find and start the default or entry activity for the app (which defined in AndroidManifest.xml file).
I have an Activity A that starts a service S via startService method.
Now as per the documentation Service S will run on main thread or the
UI thread Now my question is when activity A is destroyed will the UI
thread still exist?
Yes, UI thread still exist.
What will happen if I reopen the Activity A through its launcher icon
will there be two UI threads spawned in total?
When you finish Activity A, Android does not destroy the process for the application at that time. It will keep the application in the memory for faster loading if you start the app later.
So when you reopen the Activity A, if there is a process for that application exists already, then the Activity A is started within that process and uses the same thread of execution. Otherwise, Android will create a new process for the application.
Which Thread will a Service run in?
By default, all components (including Service) of the same application run in the same process and thread (called the main or UI thread).
You can find more details in this link:
https://developer.android.com/guide/components/processes-and-threads | unknown | |
d18380 | test | A virtual directory server is a type of server that provides a unified view of identities regardless of how they are stored. (Or you may prefer Wikipedia's definition: "a software layer that delivers a single access point for identity management applications and service platforms"
LDAP is a protocol (hence the "P") for communicating with directory servers.
There isn't a necessary link between LDAP and a VDS, but it is likely that a VDS provides and LDAP interface and, potentially, other programmatic interfaces (Kerberos in particular comes to mind). The details of how you communicate with the VDS are going to be dependent on the configuration you are trying to talk to, but LDAP is a good bet.
Regarding needing a full DN, you don't even need a full DN to authenticate against plain Active Directory. The more usual mode would be to supply something like DOMAIN\username (using the sAMAccountName) or [email protected] (that is, the user principal name) as the SECURITY_PRINCIPAL. In your example, the user would need to type John P R-Asst General Manager rather than anything they are likely to regard as their "user name."
You do, however, need to work out what the VDS you are trying to communicate with requires as the user name. Does it need DOMAIN\username, something else? These are details that whoever runs the VDS you are communicating with should be able to provide you.
In code, you should wind up with something like this (assuming you can use LDAP):
String userName = "DOMAIN\johnp";
String passWord = "asdfgh123";
String ldapURL = "ldaps://vds.example.com";
authEnv.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
authEnv.put(Context.PROVIDER_URL, ldapURL);
authEnv.put(Context.SECURITY_AUTHENTICATION, "simple");
authEnv.put(Context.SECURITY_PRINCIPAL, username);
authEnv.put(Context.SECURITY_CREDENTIALS, password);
try {
DirContext authContext = new InitialDirContext(authEnv);
return true;
} catch (NamingException namEx) {
return false;
} | unknown | |
d18381 | test | viewer.getCamera()->setClearMask(GL_DEPTH_BUFFER_BIT);
viewer.getCamera()->setClearColor(osg::Vec4(1.0, 0.0, 0.0, 1.0));
bg->setDataVariance(osg::Object::DYNAMIC);
viewer.realize(); // set up windows and associated threads.
while(!viewer.done())
{
cap >> frame;
osg::ref_ptr<osg::Image> osgImage = new osg::Image;
osgImage->setImage(frame.cols, frame.rows, 3,
GL_RGB, GL_BGR, GL_UNSIGNED_BYTE,
(uchar*)(frame.data),
osg::Image::AllocationMode::NO_DELETE, 1);
bg->setImage(osgImage);
viewer.frame();
}
This code changes background dynamially. | unknown | |
d18382 | test | Yes that is a standard practice. While building any REST API; ( just like when we create beans and implement getter and setter methods ) get api are for "select" while set api are for update/delete.. Similarly you have PutObject also to update an object onto S3 | unknown | |
d18383 | test | Sounds like you are trying to make a carousel, which there are many handy jquery plugins for. Regardless, you cannot do this using percentages for widths, you have to give your main container a fixed width, then give the inner one (your ul) whatever larger width you want. You must force a width on the UL otherwise the LI elements will just wrap. Once thats done just add an 'overflow-x: auto' to the main container and you should be on your way.
Quick example, http://jsfiddle.net/ybJ6C/8/
I'm using my ipad right now, and didn't see the scroll bar but it does indeed scroll. You'll notice that the scroll continues well past the end, you can adjust that with the width if you know what you want. If its dynamic then you would need js to adjust the width for you based on the elements within. I also don't have the height correct, but its enough to get the idea. (again doing this from my ipad, coding ain't the greatest) | unknown | |
d18384 | test | There is a PyTorch implementation of the DCN architecture from paper you linked in the DeepCTR-Torch library. You can see the implementation here: https://github.com/shenweichen/DeepCTR-Torch/blob/master/deepctr_torch/models/dcn.py
If you pip install deepctr-torch then you can just use the CrossNet layer as a torch.Module:
from deepctr_torch.layers.interaction import CrossNet
crossnet = CrossNet(in_features=512) | unknown | |
d18385 | test | Just Edit This Code...
ImageView imageView = (ImageView) convertView.findViewById(R.id.your_image_view_id);
Otherwise everything is fine... I test it.
Update
Before using url of the image be sure that
When you set the value you are assigning write position on the model contractor.
arrayList2.add(new contenus(
//is this "picture" is first argument
contenusobject.getString("picture"),
contenusobject.getString("name"),
contenusobject.getString("city"),
contenusobject.getString("add_time"),
contenusobject.getString("price")
));
//Or Check hare
String url = contenus.getImage();
Log.d("image url", url);
Picasso.with(context).load(url).into(imageView);
and what about imageView5 is this right id for imageView? | unknown | |
d18386 | test | Mixing python and SQLite files in one single directory is not a good pratice at all. You should fix it and extract elems.db from your libraries directory.
Moreover, as Lutz Horn said in comments, you should make it configurable and not trust that your database file will be always located in the exact same place.
But anyway, to fix your issue without updating these two points, you have to take care of the elem_H.py location. You know elems.db is next to it, so you can do:
import os.path
sqlfile = os.path.join(os.path.dirname(__file__), "elems.db")
*
*__file__ store the relative path to your file from the place where you run command.
*os.path.dirname remove the filename from the given path.
*os.path.join will concat the computed path and your filename. | unknown | |
d18387 | test | regarding:
if (i == 0)
{
printf("\nNo interfaces found! Make sure WinPcap is installed.\n");
return 0;
}
pcap_freealldevs(alldevs);
since the variable i is initialized to 0 and never modified, this if() statement will always be true. One result is the call to: pcap_freealldev() will never be called.
the scope of variables should be limited as much as reasonable.
Code should never depend on the OS to clean up after itself. suggest
#include <stdio.h>
#include <stdlib.h>
#include "pcap.h"
int main( void )
{
pcap_if_t *alldevs = NULL;
char errbuf[PCAP_ERRBUF_SIZE];
/* Retrieve the device list from the local machine */
if (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, NULL /* auth is not needed */, &alldevs, errbuf) == -1)
{
fprintf(stderr,"Error in pcap_findalldevs_ex: %s\n", errbuf);
exit(1);
}
/* Print the list */
for( pcap_if_t *d = alldevs; d != NULL; d= d->next)
{
printf("%d. %s", ++i, d->name);
if (d->description)
printf(" (%s)\n", d->description);
else
printf(" (No description available)\n");
}
if ( ! alldevs )
{
printf("\nNo interfaces found! Make sure WinPcap is installed.\n");
}
/* We don't need any more the device list. Free it */
pcap_freealldevs(alldevs);
} | unknown | |
d18388 | test | As Hack-R alluded in the provided link, you can set the breaks and labels for scale_size() to make that legend more meaningful.
You can also construct a legend for all your geom_line() calls by adding linetype into your aes() and use a scale_linetype_manual() to set the values, breaks and labels.
ggplot(pred, aes(x = x, y = upr)) +
geom_line(aes(y = lwr, linetype = "dashed"), color = "#666666") +
geom_line(aes(y = upr, linetype = "dashed"), color = "#666666") +
geom_line(aes(y = fit, linetype = "solid")) +
geom_point(data = plot.dta, aes(y = y, size = x)) +
scale_size(labels = c("Eensy-weensy", "Teeny", "Small", "Medium", "Large")) +
scale_linetype_manual(values = c("dashed" = 2, "solid" = 1), labels = c("95% PI", "Regression Line")) | unknown | |
d18389 | test | o would be used when trying to determine the year of the current week (i.e. calendar week).
Y would be used for output of the year for a specific date.
This is shown by the following code snippet:
date('Y v. o', strtotime('2012-12-31')); // output: 2012 v. 2013
Not saying it makes it best-practice, but Y is more commonly used to output year. As noted, o would be incorrect/confusing to output the year for such boundary dates.
A: ISO 8601 is a very useful standard for representing dates, but it has several components, not all of which are useful for many purposes. In particular, the "ISO week" and "ISO year" can be slightly confusing terms, and they're often not what you really want to use (and if you do want to use them, you probably already know that).
Wikipedia has a pretty good explanation. Basically, the ISO 8601 standard defines a separate calendar that, instead of breaking up into months and days of the month, breaks up into weeks and days of the week.
You might think this wouldn't make a difference for specifying the year, but there's a little wrinkle: which year do the weeks near the beginning and end of the calendar year fit into? As Wikipedia says, it's not quite intuitive: "The first week of a [ISO] year is the week that contains the first Thursday of the [calendar] year."
The practical upshot: If you're representing dates as conventional year-month-day values, you don't want to use the "ISO year" (o). You won't notice the difference for most of the year, but as you get to December and January, suddenly you'll (sometimes) end up with dates that are a year off. If you just test your system with current dates, you can easily miss this.
Instead, you probably just want to be using plain old Y-m-d. Even though the date() documentation doesn't specifically say it, that's a perfectly valid ISO 8601 standard date.
Really, you should only be using o if you're using the ISO "week date" calendar (meaning you're likely also using W for the week number and N for the day-of-week). | unknown | |
d18390 | test | $regex = "/[a-z] [A_Z] [A-Z] [A-Z] (\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}) /[-0-9a-zA-Z.+_]+@[-0-9a-zA-Z.+_]+\.[a-zA-Z]{2,4} (\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}) (\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/";
If you see this regex closely you have an unescaped / in the middle of regex but you're using / as regex delimiter.
Use this regex instead with an alternative regex delimiter:
$regex = "~[a-z]+ [A-Z]+ [A-Z]+ [A-Z]+ (\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}) [-\w.+]+@[-\w.+]+\.[a-zA-Z]{2,4} (\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}) (\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})~i";
RegEx Demo | unknown | |
d18391 | test | Looks like your controller 'Admin' is calling a method 'add_store', but there are no further segments, that's why your 3rd one isn't passed.
1st segment: "Admin"
2nd segment: "add_store"
I don't know what you want to achieve, but if you have an url like:
admin/add_store/someparam/someotherparam
you would just do
public function add_store($param1, $param2)
{
echo $param1; // 'someparam'
echo $param2; // 'someotherparam'
}
without the need to call directly the uri segment. | unknown | |
d18392 | test | finaly,i use bundle loader with regexp to solove my question.
code like this
{
test: /(en|cn)\.rt$/,
loaders: [
"bundle?regExp=(en|cn)\.rt$&name=[1]",
"react-templates-loader"
]
},
then all xxx.en.rt files will bundle into one en.js | unknown | |
d18393 | test | The week table should not exist. Instead, have a datetime in AllCards and index it.
It is probably slower to go back and forth between Current and AllCards than to simply scan the entire AllCards. Ditto for History. Anyway, both are equivalent to having a pair of indexes on the big table. I assume there is some column that distinguishes a "current" entity from a "history" entry in AllCards?
If the same "card" shows up again each time it is traded, then you might need a table of Cards (with 'card'-related columns) and a table of Trades (with trade related columns. Trades would probably have UId and CCardId columns and the TradeDate, but Cards would not. TradeDate would definitely be indexed, so you can get the week's trades efficiently. | unknown | |
d18394 | test | If you would like to import a json file (as I see in your code), You just need to fetch the file:
fetch('./data.json').then(response => {
console.log(response);
return response.json();
}).then(data => {
// Work with JSON data here
console.log(data);
}).catch(err => {
// Do something for an error here
console.log("Error Reading data " + err);
});
and then update your state after you fetch it.
Hope this can fix the error. | unknown | |
d18395 | test | Recursive directory traversal to rename a file can be based on this answer. All we are required to do is to replace the file name instead of the extension in the accepted answer.
Here is one way - split the file name by _ and use the last index of the split list as the new name
import os
import sys
directory = os.path.dirname(os.path.realpath("/path/to/parent/folder")) #get the directory of your script
for subdir, dirs, files in os.walk(directory):
for filename in files:
subdirectoryPath = os.path.relpath(subdir, directory) #get the path to your subdirectory
filePath = os.path.join(subdirectoryPath, filename) #get the path to your file
newFilePath = filePath.split("_")[-1] #create the new name by splitting the old name by _ and grabbing last index
os.rename(filePath, newFilePath) #rename your file
Hope this helps.
A: check below code example for the first filename1, replace path with the actual path of the file:
import os
os.rename(r'path\\sample_2_description.txt',r'path\\description.txt')
print("File Renamed!") | unknown | |
d18396 | test | Option 1: slf4j, as per comment on question.
Option 2: cxf.apache.org has such a device in it. We use it instead of slf4j because slf4j lacks internationalization support. You are welcome to grab the code.
A: See my comment:
You should check out slf4j before you proceed with this library. It wraps all the major logging libraries and is very high quality.
But I presume that your wrapper class will be used in the same manner as the loggers that it wraps. In that case, the wrapped classes should handle the synchronization for you.
A: Provided that you're just using log4j and util Loggers as shown above, I don't think you'll run into any sync problems. | unknown | |
d18397 | test | We can use Reduce to get the elementwise sum (+) and then divide by the length of the list
Reduce(`+`, df_lst)/length(df_lst)
# a b c
#1 -0.03687367 0.5853922 0.3541071
#2 0.76310860 -0.6035424 0.2220019
#3 0.15773067 -0.5616297 0.4546074
Or convert it to an array and then use apply
apply(array(unlist(df_lst), c(3, 3, 3)), 1:2, mean) | unknown | |
d18398 | test | No need for Service, it just complicates things..
See complete plunkr here - https://plnkr.co/edit/s6lT1a?p=info
it the caller, pass a callback...
presentPopover(myEvent) {
let popover = Popover.create(PopoverComponent,{
cb: function(_data) {
alert(JSON.stringify(_data))
}
});
this.nav.present(popover, {
ev: myEvent
});
}
in the popover...
constructor(private params: NavParams. /* removed rest for purpose of demo */ ) {
this.callback = this.params.get('cb')
}
public loadc(x) {
this.callback(x)
// Close the popover
this.close();
}
A:
Here's what I am trying to do.
Putting group radio buttons in the Ionic2 popover menu.
The options are actually controling which JSON file the content is going to load.
User select an option, close the popover, content will update accordingly in the page.
You can easily achive that by using a shared service to handle the communication between your popover page and your HomePage. Please take a look at this workin plunker.
I've seen you're using a globalService so I propose a small change to make it work like this:
import {Injectable} from '@angular/core';
import {Platform} from 'ionic-angular/index';
import {Observable} from 'rxjs/Observable';
@Injectable()
export class GlobalService {
// Your properties...
public getChapterObserver: any;
public getChapter: any;
constructor(...){
// Your code...
// I'm adding an observer so the HomePage can subscribe to it
this.getChapterObserver = null;
this.getChapter = Observable.create(observer => {
this.getChapterObserver = observer;
});
}
// Method executed when selecting a radio from the popover
public selectChapter(chapter : any) {
this.getChapterObserver.next(chapter);
}
}
Then, in your PopoverPage:
public loadc(x) {
// You can call your globalService like this
//this.globalService.selectChapter(this.menuArray[this.selected]);
// O by simply doing
this.globalService.selectChapter(x);
// Close the popover
this.close();
}
So now we're telling our service that the selectChapter has changed. And finally, in your HomePage:
constructor(private nav: NavController, private globalService: GlobalService) {
// We subscribe to the selectChapter event
this.globalService.getChapter.subscribe((selectedChapter) => {
this.selectedChapter = selectedChapter;
});
}
With that, we're subscribing the HomePage to that GlobalService, so when the chapter changes, we're going to be noticed and we can handle that as we want. | unknown | |
d18399 | test | UPDATE
Please note that for Yarn 2+ you need to prefix the URL with package name:
yarn add otp-react-redux@https://github.com/opentripplanner/otp-react-redux#head=result-post-processor
A: You need use you git remote url and specify branch after hash(#).
yarn add https://github.com/opentripplanner/otp-react-redux.git#result-post-processor
installs a package from a remote git repository at specific git branch, git commit or git tag.
yarn add <git remote url>#<branch/commit/tag> | unknown | |
d18400 | test | It was easy...
buf += [string.to_i(16)].pack('Q') | unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.