Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
55,587,178
How to remove duplicate row in table
<p>I am new in codeigniter frame work and I am trying to stop duplicate record in my table In my table record are repeat I want to show one record at one time</p> <p>This is my code</p> <p>Controller</p> <pre><code> $modelResult = $this-&gt;freightBillModel-&gt;freightBillByDate($data); &lt;table id="freight_table" class="table table-bordered table-striped table-sm" style="display:block; overflow: auto; "&gt; &lt;tr&gt; &lt;th&gt;SR.No&lt;/th&gt; &lt;th&gt;Bill No&lt;/th&gt; &lt;th&gt;pkgs&lt;/th&gt; &lt;th&gt;freight&lt;/th&gt; &lt;/tr&gt; &lt;tbody&gt; &lt;?php $counter = 1; ?&gt; &lt;?php foreach($modelResult as $freight){?&gt; &lt;tr&gt; &lt;td&gt;&lt;?php echo $counter;?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $freight['tbb_no'];?&gt;&lt;/td&gt; &lt;?php $singleBill = $this-&gt;freightBillModel-&gt;fetchBillByNo($freight['tbb_no']); ?&gt; &lt;?php $lr_freight=0; $no_of_pkgs=0; ?&gt; &lt;?php foreach ($singleBill as $bill) : ?&gt; &lt;?php $lr_freight+=$bill-&gt;lr_freight; ?&gt; &lt;?php $no_of_pkgs+=$bill-&gt;no_of_pkgs; ?&gt; &lt;?php endforeach; ?&gt; &lt;td&gt;&lt;?php echo $no_of_pkgs;?&gt;&lt;/td&gt; &lt;td&gt;&lt;?php echo $lr_freight;?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php $counter++; ?&gt; &lt;?php }?&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>Model:</p> <pre><code> public function freightBillByDate($data){ extract($data); $this-&gt;db-&gt;select('bn.branch_name as to,ts_tbb.tbb_no,ts_tbb.tbb_id,ts_tbb.bilty_id,ts_tbb.current_time,ts_tbb.status,b.*'); $this-&gt;db-&gt;from('ts_tbb'); $this-&gt;db-&gt;join('bilty b', 'b.id = ts_tbb.bilty_id'); $this-&gt;db-&gt;join('branch bn', 'b.lr_to=bn.branch_id'); $this-&gt;db-&gt;where('lr_from',$lr_from); $this-&gt;db-&gt;where('lr_to',$lr_to); if($bill_type=="pending_bill"){ $this-&gt;db-&gt;where('billed_status','not_billed'); }else if($bill_type=="bill_register"){ $this-&gt;db-&gt;where('billed_status','billed'); } $this-&gt;db-&gt;order_by('lr_date','desc'); $query=$this-&gt;db-&gt;get(); return $query-&gt;result_array(); } function fetchBillByNo($billNo){ return $this-&gt;db-&gt;select('*')-&gt;from('ts_tbb')-&gt;join('bilty','bilty_id=bilty.id')-&gt;where('tbb_no',$billNo)-&gt;get()-&gt;result(); }[![In this picture first two records are repeat][1]][1] </code></pre> <p>I want to show unique records, Current table it shows duplicate rows Please tell me where i am wrong in my code</p>
<php><mysql><sql><codeigniter>
2019-04-09 07:22:13
LQ_CLOSE
55,590,306
merge two key values and assign it to a new key in a single dictionary python
I am new to python. I have dictionary with some values stored in the form of list. I want to combine two key values and assign the value to the new key. I tried searching stack overflow and got various results in combining the values of two different dicts. But i need to combine in a single dict. So how to merge two keys and assign it to a new key in a single dictionary Here's the sample code: fields = ["Classification","Fuel_Type"] #two fields to combine target = "Classification_Fuel_Type" d = [ {'Fuel': 'Gas', 'Gears': 6, 'Width': 209, 'Year': 2012, 'Engine': 'Lincoln 5.4L 8 Cylinder 310 hp 365 ft-lbs FFV', 'Classification': 'Automatic transmission'}, {'Fuel': 'E85', 'Gears': 5, 'Width': 209, 'Year': 2014, 'Engine': 'Lincoln 5.4L 8 Cylinder 310 hp 365 ft-lbs FFV', 'Classification': 'Automatic transmission'}, {'Fuel': 'E85', 'Gears': 6, 'Width': 509, 'Year': 2011, 'Engine': 'Lincoln 5.4L 8 Cylinder 310 hp 365 ft-lbs FFV', 'Classification': 'Automatic transmission'}] Required output: [{'Classification_Fuel_Type':'Automatic transmissionGas','Fuel': 'Gas', 'Gears': 6, 'Width': 209, 'Year': 2012, 'Engine': 'Lincoln 5.4L 8 Cylinder 310 hp 365 ft-lbs FFV', 'Classification': 'Automatic transmission'}, {'Classification_Fuel_Type':'Automatic transmissionE85'.'Fuel': 'E85', 'Gears': 5, 'Width': 209, 'Year': 2014, 'Engine': 'Lincoln 5.4L 8 Cylinder 310 hp 365 ft-lbs FFV', 'Classification': 'Automatic transmission'}, {'Classification_Fuel_Type':'Automatic transmissionE85','Fuel': 'E85', 'Gears': 6, 'Width': 509, 'Year': 2011, 'Engine': 'Lincoln 5.4L 8 Cylinder 310 hp 365 ft-lbs FFV', 'Classification': 'Automatic transmission'}]
<python><python-3.x><dictionary>
2019-04-09 10:10:14
LQ_EDIT
55,592,258
schedule queue job don't work for me i cant find any solution
protected function schedule(Schedule $schedule){ `enter code here`$schedule->job(new SendFeedbackEmail)->everyMinute(); }
<php><laravel><scheduling>
2019-04-09 11:54:01
LQ_EDIT
55,593,657
J unit testing failing when using picocli
test wont run correctly trying to run a junit test- errors Please be kind fairly new to both java and picocli package picocli; import java.io.Serializable; import picocli.CommandLine.Option; public class ComparatorRunnerConfig implements Serializable{ /** The output path. */ @Option(names = {"-o", "--output-parquet"}, required = false, description = "define output parquet path") private String outputParquetPath; public String getOutputParquetPath() { return outputParquetPath; } @Option(names = {"-ic", "ingestorPath"}, required = false, description = "define ingestor path") private String ingestorPath; public String getingestorPath() { return ingestorPath; } @Option(names = {"-if", "--inputfile"}, required = false, description = "define input-file") private String inputFile; public String getinputFile() { return inputFile; } @Option(names = {"-rc", "--report-class"}, required = false, description = "define report") private String report; public String getReport() { return report; } @Option(names = {"-of", "--output-file"}, required = false, description = "define outputfile") private String outputFile; public String getoutputFile() { return outputFile; } //Using the config in a main method: public static void main(String[] args) { ComparatorRunnerConfig config = new ComparatorRunnerConfig(); new CommandLine(config).parse(args); } } MY JUNIT TEST package picocli; import static org.junit.Assert.*; import org.junit.Test; public class ConfigurationTest { @Test public void testBasicConfigOptions() { String args = "-rc BlahBlah"; ComparatorRunnerConfig mfc = new ComparatorRunnerConfig(); new CommandLine( mfc ).parse(args); String myTestValue = mfc.getReport(); assertEquals("I expected the ComparatorRunnerConfig to have the value getReport but got: "+myTestValue, myTestValue, "BlahBlah"); } } test fails
<java><picocli>
2019-04-09 13:06:07
LQ_EDIT
55,595,267
how to count comparison selectionsort?
how to count comparison selectionsort? terms : when the statements you perform to find the maximum value is 'true' then count comparison. The value to get the maximum value is held at the first element in the array, not at random. i try with c variable count position change - no work new variable 'first' , first=sort[MAX] insert first for loop, - no work int main() { int sort[10000],i,n,MAX,temp,count,first; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&sort[i]); } for(MAX=0;MAX<n;MAX++) for(i=MAX+1;i<n;i++) { if(sort[MAX]>first) { count++; temp=sort[MAX]; sort[MAX]=sort[i]; sort[i]=temp; } } printf("%d ",count); return 0; }
<c++><c><selection-sort>
2019-04-09 14:31:22
LQ_EDIT
55,595,982
¿Como soluciono el firebase auth?
[enter image description here][1]El packete de import 'package:firebase_auth/firebase_auth.dart'; me da error, ya he descargado todos los paquetes de flutter con ctrl + shift + get packages. [1]: https://i.stack.imgur.com/eaiDK.png
<flutter>
2019-04-09 15:09:35
LQ_EDIT
55,597,217
Find specific item in an array?
<p>I have an array that looks like this:</p> <pre><code>cardNumber: "2344234454562036" cardType: "Visa" cardholderName: "Yeyy" cvv: "123" expiryMonth: 12 expiryYear: 2022 postalCode: "52636" redactedCardNumber: "••••••••••••2036" __proto__: —' </code></pre> <p>I need to get the value of <code>redactedCardNumber</code> from that array.</p> <p>The first thing that I am confused about is that when i print the above 'array' in the console, it actually show an <strong>object</strong> before everything! so is this an <code>array</code> or an <code>object</code>?</p> <p>also, what is the best way of getting the specific item like '<code>redactedCardNumber</code>' from it?</p>
<javascript>
2019-04-09 16:20:10
LQ_CLOSE
55,598,152
What Replaces Code Analysis in Visual Studio 2019?
<p>I'm toying with getting our team and projects ready for VS 2019. Right away, trying to set up Code Analysis for a new project, I find this:</p> <p><a href="https://i.stack.imgur.com/deZRE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/deZRE.png" alt="enter image description here"></a></p> <p>So, if this is deprecated (and apparently can't even be used, so I'm thinking "deprecated" really means "gone"), where are we supposed to set up our Rule Sets? Is there some other location, or perhaps an altogether new solution to the problem of style and code quality?</p>
<visual-studio><roslyn><fxcop><roslyn-code-analysis><visual-studio-2019>
2019-04-09 17:23:18
HQ
55,598,190
Search and replace a particular string having special characters in a file using Perl
Search and replace a particular string in a file using Perl. I have a .txt file. where i need to search and replace a string. i code i have is working fine for string not having special characters.but for the string containing special characters like (?,=,:: ) is not working with this code. Can anyone please urgently help?? Thanks in advance. a.txt file content: ------------------ <tbody> <tr><td> App URL </td><td> <xmp class="no-margin" style="white-space:pre-wrap">https://example.com/abc/f?p=CDE:HOME/</xmp> </td></tr><tr><td> App control </td><td> <xmp class="no-margin" style="white-space:pre-wrap">SSO</xmp> </td></tr><tr><td> App Owner </td><td> <xmp class="no-margin" style="white-space:pre-wrap">CCS</xmp> </td></tr> </tbody> ----------------------------- Need to replace in a.txt file: <xmp class="no-margin" style="white-space:pre-wrap">https://example.com/abc/f?p=CDE:HOME/</xmp> ---------------------------- Replacement String: <a href="https://example.com/abc/f?p=CDE:HOME/" target="_blank">https://example.com/abc/f?p=CDE:HOME/</a> --------------------------- #!/usr/bin/perl use strict; use warnings; $^I = '.bak'; # create a backup copy my $string2 = '<xmp class="no-margin" style="white-space:pre-wrap">https://example.com/abc/f?p=CDE:HOME/</xmp>' ; #old string my $string3 = '<a href="https://example.com/abc/f?p=CDE:HOME/" target="_blank">https://example.com/abc/f?p=CDE:HOME/</a>'; #new string while (<>) { s/$string2/$string3/g; print; # print to the modified file expected result in a.txt file after replacement: ---------------------------------------------- <tbody> <tr><td> App URL </td><td> <a href="https://example.com/abc/f?p=CDE:HOME/" target="_blank">https://example.com/abc/f?p=CDE:HOME/</a> </td></tr><tr><td> App control </td><td> <xmp class="no-margin" style="white-space:pre-wrap">SSO</xmp> </td></tr><tr><td> App Owner </td><td> <xmp class="no-margin" style="white-space:pre-wrap">CCS</xmp> </td></tr> </tbody>
<perl>
2019-04-09 17:26:41
LQ_EDIT
55,598,922
Why does the read() function return an error?
<p>I used the read() function to read the contents from a file but got a -1 return value. The file is not empty, I think it might be the problem of data type, but I am not sure. The contents of the file are like this: 1e00 000a 0600 0003 0100 0004 0300 0005 0800 0006 0900 0007 0b00 0003 0c00 0009 Thanks in advance.</p> <pre><code>#define swapFname "test.disk" int main(int argc, char const *argv[]) { int diskfd; unsigned *buf; diskfd = open (swapFname, O_RDWR | O_CREAT, 0600); int location = (2-2) * 16 * 8 + 0*8; // 0 int ret = lseek (diskfd, location, SEEK_SET); int retsize = read (diskfd, (char *)buf, 32); if (retsize &lt; 0) { printf ("Error: Disk read returned incorrect size: %d\n", retsize); exit(-1); } } </code></pre>
<c>
2019-04-09 18:17:53
LQ_CLOSE
55,601,724
python - eror when using quotation marks
Every time i write some code with " and run it on terminal - it shows me eror - how can i fix that? thanks ^ SyntaxError: invalid syntax Radani:Books radani$ python 2.py File "2.py", line 16 Print "what is 5 - 7?", 5-7 ^ SyntaxError: invalid syntax
<python><syntax><python-2.x>
2019-04-09 21:38:21
LQ_EDIT
55,601,879
How to fix ,,Extraneous argument label 'input:' in call" and sigrabitTHREAD1 problem in swift
I'm building calendar app in swift. It has got a sigrbrtTHREAD1 problem and that strang mistake. Sorry for probably silly question but I'm completely beginner. Here is the code: import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. var wydarzenia = ["Wydarzenie1", "Wydarzenie2" ] weak var input: UITextField! weak var output: UILabel! print(wydarzenia) func show(_ sender: UIButton) { print(wydarzenia) } func add(_ sender: UIButton) { wydarzenia.append (input: String). !Extraneous argument label 'input:' in call! } } } } }
<ios><swift>
2019-04-09 21:54:37
LQ_EDIT
55,602,357
How to fix a While Loop only running once
Im trying to calculate how long until India surpasses China in population, my while loop only executes the first iteration though. I have tried setting a while loop to execute within the loop itself and it just became an infinite loop instead,i have tried indenting print within and outside the loop as well. while India<China : China += Cgrowth*China India += Igrowth*India count += 1 print(count) My output always ends in 1. i did the math out and even after one loop the statement is still true, so why is print(count) being ran while the loops conditions are false?
<python>
2019-04-09 22:47:45
LQ_EDIT
55,604,111
How to SET the number of lines for a UILabel using Swift in Xcode
I am currently working on a project where I need to be able to set the number of lines for a UILabel. This means that if I input 5, the label HAS to conform and return 4 times (issues like having too few characters will not be a problem). So far, I have tried to do this by setting the .numberOfRows property, but this only places a limit on the UILabel which is not what I desire (if you are curious, there is some code below). Any help? My code: if Double(w!) > 277 { print("Values:") print(w!) let numRows = Int(w!/237) print(numRows) heightOfCell += Double(numRows)*20.5 cell!.textLabel?.numberOfLines = numRows + 2 }
<ios><swift><uitableview><uilabel>
2019-04-10 03:00:32
LQ_EDIT
55,605,184
Code for C# that allows you to Sum all Quantity from SQL Database with only name Condition without using datagridview
<p>Please Help. What is the code for C# Windows Form that allows you to Sum all Quantity from SQL Database with only name Condition without using Datagridview. Thanks in advance</p> <p>This be like: Checking if how many stocks are added automatically without using tables</p> <p>Name = wheels Result = Total Quantity</p>
<c#><vb.net>
2019-04-10 05:19:42
LQ_CLOSE
55,605,398
Why this code is not giving the output as expected
<p>I was expecting the output as AB , ABCD but the output is ABCD , B. How's that possible?</p> <pre><code> public class Test { public static void main(String[] args) { StringBuffer a = new StringBuffer("A"); StringBuffer b = new StringBuffer("B"); operate(a, b); System.out.println(a + " " + " , " + " " + b); } static void operate(StringBuffer x, StringBuffer y) { x.append(y); y = x.append("C"); y.append("D"); } } </code></pre>
<java><stringbuffer>
2019-04-10 05:38:54
LQ_CLOSE
55,606,614
Spark :Join Dataframe by an array column
I have two dataframes with a column `field` array<string>. So is it safe to do the following df1.join(df2, "field"); Similarly in a SQL query on a hive table with an array column
<apache-spark><hive>
2019-04-10 07:05:16
LQ_EDIT
55,606,841
How to update core-js to core-js@3 dependency?
<p>While I was trying to install and setup react native, the precaution observed about the core-js version as update your core-js@... to core-js@3 But don't know how to update my core-js.</p> <pre><code>$ sudo react-native init AwesomeProject121 Password: This will walk you through creating a new React Native project in /Users/amarnr1989/AwesomeProject121 Using yarn v1.13.0 Installing react-native... yarn add v1.13.0 info No lockfile found. [1/4] 🔍 Resolving packages... warning react-native &gt; create-react-class &gt; fbjs &gt; core-js@1.2.7: core-js@&lt;2.6.5 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2. [2/4] 🚚 Fetching packages... [----------------------------------------------------------------------------------------------------------------------------------------------------------] 0/601internal/modules/cjs/loader.js:584 throw err; ^ Error: Cannot find module '/Users/amarnr1989/AwesomeProject121/node_modules/react-native/package.json' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15) at Function.Module._load (internal/modules/cjs/loader.js:508:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at checkNodeVersion (/usr/local/lib/node_modules/react-native-cli/index.js:306:21) at run (/usr/local/lib/node_modules/react-native-cli/index.js:300:3) at createProject (/usr/local/lib/node_modules/react-native-cli/index.js:249:3) at init (/usr/local/lib/node_modules/react-native-cli/index.js:200:5) at Object.&lt;anonymous&gt; (/usr/local/lib/node_modules/react-native-cli/index.js:153:7) at Module._compile (internal/modules/cjs/loader.js:701:30) </code></pre> <p>Please Suggest </p>
<react-native><npm-install>
2019-04-10 07:19:54
HQ
55,607,183
Can someone explain this ruby sytax to me?
Can someone explain this code to me? What does the pipeline syntax mean and how it works array = [1, 2, 3, 4, 5, 3, 6, 7, 2, 8, 1, 9] array.each_with_index.reduce({}) { |hash, (item, index)| hash[item] = (hash[item] || []) << index hash }.select { |key, value| value.size > 1 }
<ruby-on-rails><ruby>
2019-04-10 07:38:33
LQ_EDIT
55,610,265
Python-Regex remove quotes in the 'keys' section of a string in a string of key/value pairs
I am trying to remove single quotes from the 'key' pairs in a string, but leave the single quotes in the value pair. Each time the key/value options will be different so it needs to be generic. The only thing that will stay is the commas. For example my original string is: ```` 'Key'='Value', 'Key'='Value', 'Key'='Value', 'Key'='Value' ```` and my desired outcome is: ```` Key='Value', Key='Value', Key='Value', Key='Value' ```` Not sure how I would go about doing this in regex/python. I've tried looping through regex matches and re.sub but to no avail Any help would be wonderful, thanks
<python><regex>
2019-04-10 10:28:27
LQ_EDIT
55,612,360
How can I delete all full-black images from a folder by python
After cropping and saving images, I found that there are many full black images (RGB = 0,0,0). I want to delete these images The followings are the codes I have tried ``` import os, glob from PIL import image def CleanUp_images(): for filename in glob.glob('/Users/Xin/Desktop/TestFolder/*.jpg'): im = Image.open(filename) pix = list(im.getdata()) if pix == [(0,0,0)]: os.remove(im) CleanUp_images() ``` However, the above codes didnt work out Can anyone give me a help? thanks a lot!!!
<python><python-imaging-library>
2019-04-10 12:17:17
LQ_EDIT
55,613,789
How to fix "FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory" error
<p>I'm trying to deploy a reactjs application to heroku. While compiling assets, the build fails and produces this error:</p> <pre><code>-----&gt; Ruby app detected -----&gt; Compiling Ruby/Rails -----&gt; Using Ruby version: ruby-2.5.1 -----&gt; Installing dependencies using bundler 1.15.2 Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.3). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. Fetching gem metadata from https://rubygems.org/............ Fetching version metadata from https://rubygems.org/.. Fetching dependency metadata from https://rubygems.org/. Using rake 12.3.1 Using concurrent-ruby 1.1.3 Using minitest 5.11.3 Using thread_safe 0.3.6 Using builder 3.2.3 Using erubi 1.7.1 Using mini_portile2 2.3.0 Using crass 1.0.4 Using rack 2.0.6 Using nio4r 2.3.1 Using websocket-extensions 0.1.3 Using mini_mime 1.0.1 Using jsonapi-renderer 0.2.0 Using arel 9.0.0 Using mimemagic 0.3.2 Using public_suffix 3.0.3 Using airbrake-ruby 2.12.0 Using execjs 2.7.0 Using bcrypt 3.1.12 Using popper_js 1.14.5 Using rb-fsevent 0.10.3 Using ffi 1.9.25 Using bundler 1.15.2 Using regexp_parser 1.3.0 Using mime-types-data 3.2018.0812 Using chartkick 3.0.1 Using highline 2.0.0 Using connection_pool 2.2.2 Using orm_adapter 0.5.0 Using method_source 0.9.2 Using thor 0.19.4 Using multipart-post 2.0.0 Using geokit 1.13.1 Using temple 0.8.0 Using tilt 2.0.9 Using hashie 3.5.7 Using json 2.1.0 Using mini_magick 4.9.2 Using multi_json 1.13.1 Using newrelic_rpm 5.5.0.348 Using one_signal 1.2.0 Using xml-simple 1.1.5 Using pg 0.21.0 Using puma 3.12.0 Using rack-timeout 0.5.1 Using redis 4.0.3 Using secure_headers 6.0.0 Using swagger-ui_rails 0.1.7 Using i18n 1.1.1 Using nokogiri 1.8.5 Using tzinfo 1.2.5 Using websocket-driver 0.7.0 Using mail 2.7.1 Using marcel 0.3.3 Using addressable 2.5.2 Using rack-test 1.1.0 Using warden 1.2.8 Using sprockets 3.7.2 Using request_store 1.4.1 Using rack-protection 2.0.4 Using rack-proxy 0.6.5 Using autoprefixer-rails 9.4.2 Using uglifier 4.1.20 Using airbrake 7.4.0 Using rb-inotify 0.9.10 Using mime-types 3.2.2 Using commander 4.4.7 Using net-http-persistent 3.0.0 Using faraday 0.15.4 Using hashie-forbidden_attributes 0.1.1 Using omniauth 1.8.1 Using haml 5.0.4 Using slim 4.0.1 Using paypal-sdk-core 0.3.4 Using faker 1.9.1 from https://github.com/stympy/faker.git (at master@aca03be) Using money 6.13.1 Using loofah 2.2.3 Using xpath 3.2.0 Using activesupport 5.2.0 Using sidekiq 5.2.3 Using sass-listen 4.0.0 Using houston 2.4.0 Using stripe 4.2.0 Using paypal-sdk-adaptivepayments 1.117.1 Using monetize 1.9.0 Using rails-html-sanitizer 1.0.4 Using capybara 3.12.0 Using rails-dom-testing 2.0.3 Using globalid 0.4.1 Using activemodel 5.2.0 Using case_transform 0.2 Using decent_exposure 3.0.0 Using factory_bot 4.11.1 Using fast_jsonapi 1.5 Using groupdate 4.1.0 Using pundit 2.0.0 Using sass 3.7.2 Using actionview 5.2.0 Using activerecord 5.2.0 Using carrierwave 1.2.3 Using activejob 5.2.0 Using actionpack 5.2.0 Using bootstrap 4.1.3 Using actioncable 5.2.0 Using actionmailer 5.2.0 Using active_model_serializers 0.10.8 Using activestorage 5.2.0 Using railties 5.2.0 Using sprockets-rails 3.2.1 Using simple_form 4.1.0 Using responders 2.4.0 Using factory_bot_rails 4.11.1 Using font-awesome-rails 4.7.0.4 Using highcharts-rails 6.0.3 Using jquery-rails 4.3.3 Using lograge 0.10.0 Using money-rails 1.13.0 Using slim-rails 3.2.0 Using webpacker 3.5.5 Using rails 5.2.0 Using sass-rails 5.0.7 Using geokit-rails 2.3.1 Using swagger-docs 0.2.9 Using devise 4.5.0 Using devise_token_auth 1.0.0 Bundle complete! 68 Gemfile dependencies, 125 gems now installed. Gems in the groups development and test were not installed. Bundled gems are installed into ./vendor/bundle. Bundle completed (5.09s) Cleaning up the bundler cache. Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.3). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. The latest bundler is 2.0.1, but you are currently running 1.15.2. To update, run `gem install bundler` -----&gt; Installing node-v10.14.1-linux-x64 -----&gt; Installing yarn-v1.12.3 -----&gt; Detecting rake tasks -----&gt; Preparing app for Rails asset pipeline Running: rake assets:precompile yarn install v1.12.3 warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... info fsevents@1.2.4: The platform "linux" is incompatible with this module. info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation. [4/5] Linking dependencies... warning "@rails/webpacker &gt; postcss-cssnext@3.1.0" has unmet peer dependency "caniuse-lite@^1.0.30000697". warning " &gt; react-addons-css-transition-group@15.6.2" has incorrect peer dependency "react@^15.4.2". warning " &gt; react-bootstrap-table-next@1.4.0" has unmet peer dependency "classnames@^2.2.5". warning " &gt; react-progressbar@15.4.1" has incorrect peer dependency "react@^15.0.1". warning " &gt; redux-immutable@4.0.0" has unmet peer dependency "immutable@^3.8.1 || ^4.0.0-rc.1". warning "eslint-config-airbnb &gt; eslint-config-airbnb-base@11.3.2" has incorrect peer dependency "eslint-plugin-import@^2.7.0". warning " &gt; webpack-dev-server@2.11.2" has unmet peer dependency "webpack@^2.2.0 || ^3.0.0". warning "webpack-dev-server &gt; webpack-dev-middleware@1.12.2" has unmet peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0". [5/5] Building fresh packages... $ cd client &amp;&amp; yarn yarn install v1.12.3 warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/5] Validating package.json... [2/5] Resolving packages... [3/5] Fetching packages... info fsevents@1.2.4: The platform "linux" is incompatible with this module. info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation. [4/5] Linking dependencies... warning " &gt; babel-loader@7.1.0" has unmet peer dependency "webpack@2 || 3". warning " &gt; react-intl@2.3.0" has incorrect peer dependency "react@^0.14.9 || ^15.0.0". warning " &gt; react-router-dom@4.1.1" has incorrect peer dependency "react@^15". warning " &gt; react-router-redux@5.0.0-alpha.6" has incorrect peer dependency "react@^15". warning " &gt; enzyme@2.8.2" has incorrect peer dependency "react@0.13.x || 0.14.x || ^15.0.0-0 || 15.x". warning " &gt; eslint-import-resolver-webpack@0.8.3" has unmet peer dependency "webpack@&gt;=1.11.0". warning " &gt; html-webpack-plugin@2.29.0" has unmet peer dependency "webpack@1 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3". warning "image-webpack-loader &gt; file-loader@1.1.11" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0". warning " &gt; react-test-renderer@15.6.1" has incorrect peer dependency "react@^15.6.1". [5/5] Building fresh packages... Done in 31.85s. Done in 76.09s. Webpacker is installed 🎉 🍰 Using /tmp/build_8f521e11fc612876bcd3c01cd8da6bdd/config/webpacker.yml file for setting up webpack paths Compiling… Compilation failed: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0x8dbaa0 node::Abort() [node] 2: 0x8dbaec [node] 3: 0xad83de v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node] 4: 0xad8614 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node] 5: 0xec5c42 [node] 6: 0xec5d48 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [node] 7: 0xed1e22 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node] 8: 0xed2754 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node] 9: 0xed53c1 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node] 10: 0xe9e844 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node] 11: 0x113dfae v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node] 12: 0x2daefc5be1d &lt;--- Last few GCs ---&gt; [587:0x2713f20] 1469419 ms: Mark-sweep 1362.0 (1417.7) -&gt; 1361.9 (1418.2) MB, 1183.8 / 0.0 ms (average mu = 0.099, current mu = 0.004) allocation failure scavenge might not succeed [587:0x2713f20] 1470575 ms: Mark-sweep 1363.1 (1418.7) -&gt; 1362.9 (1419.7) MB, 1151.7 / 0.0 ms (average mu = 0.053, current mu = 0.004) allocation failure scavenge might not succeed &lt;--- JS stacktrace ---&gt; ==== JS stack trace ========================================= 0: ExitFrame [pc: 0x2daefc5be1d] Security context: 0x395bbaa1e6e1 &lt;JSObject&gt; 1: addMappingWithCode [0x1a4bb3f1a89] [/tmp/build_8f521e11fc612876bcd3c01cd8da6bdd/node_modules/webpack-sources/node_modules/source-map/lib/source-node.js:~150] [pc=0x2daf487dfd2](this=0x08663a09ad49 &lt;JSGlobal Object&gt;,mapping=0x2969e26a1e61 &lt;Object map = 0x1067d74ad2e1&gt;,code=0x3e38d99f4479 &lt;String[6]: break &gt;) 2: /* anonymous */ [0x1a4bb3dcc79] [/tmp/... ! ! Precompiling assets failed. ! ! Push rejected, failed to compile Ruby app. ! Push failed </code></pre> <p>I've tried various methods in my <code>package.json</code> file:</p> <pre><code>"scripts" : { "start": "cross-env NODE_OPTIONS=--max_old_space_size=5120 webpack" } "scripts" : { "webpacker": "node --max-old-space-size=4096 node_modules/.bin/react-scripts start" } "scripts" : { "start": "node --max-old-space-size=6144 client/app/app.js" } </code></pre> <p>I've researched and found various github and stackoverflow threads but they do not seem to fix my issue.</p> <ul> <li><a href="https://github.com/npm/npm/issues/12238" rel="noreferrer">https://github.com/npm/npm/issues/12238</a></li> <li><a href="https://stackoverflow.com/questions/44046366/increase-javascript-heap-size-in-create-react-app-project">Increase JavaScript Heap size in create-react-app project</a></li> </ul> <p>Here is my <code>package.json</code> file:</p> <pre><code>{ "name": "safe_deliver", "private": true, "engines": { "node": "&gt;=6.0.0", "yarn": "&gt;=0.25.2" }, "scripts": { "postinstall": "cd client &amp;&amp; yarn", "pre-commit": "cd client &amp;&amp; npm run lint:staged", "start": "cross-env NODE_OPTIONS=--max-old-space-size=6144 bin/webpack" }, "dependencies": { "@fortawesome/fontawesome": "^1.1.8", "@fortawesome/fontawesome-free": "^5.3.1", "@fortawesome/fontawesome-free-brands": "^5.0.13", "@fortawesome/fontawesome-free-regular": "^5.0.13", "@fortawesome/fontawesome-free-solid": "^5.0.13", "@fortawesome/fontawesome-svg-core": "^1.2.4", "@fortawesome/free-solid-svg-icons": "^5.3.1", "@fortawesome/react-fontawesome": "^0.1.3", "@rails/webpacker": "^3.3.1", "babel-plugin-emotion": "^9.2.6", "babel-preset-react": "^6.24.1", "babel-preset-stage-0": "^6.24.1", "bootstrap": "4.0.0", "chart.js": "^2.7.3", "chartkick": "^3.0.1", "emotion": "^9.2.6", "google-maps-react": "^2.0.2", "jquery": "^3.2.1", "jquery-ujs": "^1.2.2", "leaflet": "^1.3.1", "normalize.css": "^8.0.1", "popper.js": "^1.12.9", "prop-types": "^15.6.1", "rc-time-picker": "^3.6.2", "react": "^16.4.1", "react-addons-css-transition-group": "^15.6.2", "react-animate-height": "^2.0.5", "react-bootstrap-table-next": "^1.4.0", "react-calendar": "^2.16.0", "react-datepicker": "^2.3.0", "react-dom": "^16.4.1", "react-emotion": "^9.2.6", "react-fontawesome": "^1.6.1", "react-geocode": "^0.1.2", "react-https-redirect": "^1.0.11", "react-input-mask": "^2.0.4", "react-progressbar": "^15.4.1", "react-star-rating-component": "^1.4.1", "react-stripe-elements": "^2.0.1", "reactjs-popup": "^1.3.2", "redux-immutable": "^4.0.0", "reset-css": "^4.0.1", "seamless-immutable": "^7.1.4", "styled-components": "^3.4.2" }, "devDependencies": { "eslint": "3.19.0", "eslint-config-airbnb": "15.0.1", "eslint-plugin-import": "2.2.0", "eslint-plugin-jsx-a11y": "5.0.3", "eslint-plugin-react": "7.0.1", "pre-commit": "1.2.2", "webpack-dev-server": "^2.7.1" } } </code></pre> <p>I am expecting this error to go away and the application to be deployed. Right now it is throwing javascript heap out of memory error.</p>
<node.js><reactjs><webpack>
2019-04-10 13:27:33
HQ
55,614,109
ajax posting NAN valie
Im posting a variable via ajax however when I use it in php I get NAN why is that ? its supposed to be a number //in js var variableToSend = 1; $.post('ajax.php', {variable: variableToSend}); <?php echo $_POST['variable']?>;
<javascript><php><jquery><ajax>
2019-04-10 13:42:01
LQ_EDIT
55,614,244
Count the number of characters without len() and combine the variables
<h1>Q1</h1> <p>Write code that combines the following variables so that the sentence “You are doing a great job, keep it up!” is assigned to the variable message. Do not edit the values assigned to a, b, c, or d.</p> <h1>Q2</h1> <p>Count the number of characters in string str1. Do not use len(). Save the number in variable numbs</p> <p>I've tried some solutions as below. I wonder if there any faster way to solve it? </p> <h1>Q1</h1> <pre><code>a = "You are" b = "doing a great " c = "job" d = "keep it up!" seq1 = [a, b] seq2 = " ".join(seq1+[c]) message = ",".join(seq2 + [d]) </code></pre> <p>Is there any more simple way to deal with the problem? I hope I'm not hardcoding lol.</p> <h1>Q2</h1> <pre><code>str1 = "I like nonsense, it wakes up the brain cells. Fantasy is a necessary ingredient in living." list1 = list(str1) print(list1) numbs = count(list1) print(numbs) </code></pre> <p>Should I use the count function like this in the code? Are there any modules or functions that I could apply? like loop function or Counter function?</p> <p>Thanks in advance!</p>
<python>
2019-04-10 13:48:24
LQ_CLOSE
55,615,136
In Visual Studio 2019 how can I remove unused usings on format document?
<p>In Visual Studio 2019 how can I remove unused usings on format document? </p> <p>I have found instructions for previous versions of Visual Studio (Go to Tools > Options > Text Editor > C# > Code Style > Formatting.). I don't see that in Visual Studio 2019.</p>
<visual-studio><visual-studio-2019>
2019-04-10 14:31:37
HQ
55,617,012
How to write in file the result of querry in C#. For example(Name salary)
I need to write in .doc file the result of querry in C# Code `SqlCommand command = new SqlCommand("SELECT Id,Name,Price FROM [Products] WHERE [Id]=@Id ", sqlConnection); While (await sqlReader.ReadAsync()){ listBox3.Items.Add(Convert.ToString(sqlReader["id"]) + " " + Convert.ToString(sqlReader["Name"]) + " " + (1 + ((readSearch1 - f) * 1.2) / f));}`
<c#><sql>
2019-04-10 16:09:13
LQ_EDIT
55,617,081
What is the "and" and "or" Operator in Kotlin?
<p>We all know that in Java, we use the &amp;&amp; operator for "and" and || operator or "or". But when it comes to Kotlin, this doesn't work. When I was trying out a simple program, I noticed that the &amp;&amp; operator in Kotlin was behaving like the || operator in Java using IntelliJ, I have no idea why.</p> <pre><code>while(day!=1 &amp;&amp; month != 1 &amp;&amp; year!= 0) { ... ... } </code></pre> <p>When I debugged the program, I saw that when day = 1, month = 8, year = 1947, it jumped out of the loop.</p> <p>I modified the code and debugged again, this time it jumped out when day = 31, month = 1, year = 1947.</p> <p>So what exactly is the "and" and "or" operator in Kotlin?</p>
<java><android><intellij-idea><kotlin>
2019-04-10 16:12:36
LQ_CLOSE
55,619,286
What is the difference between Google App Engine and Google Cloud Run?
<p>Does anyone know, difference between Google App Engine Flex and Google Cloud Run?</p> <p>Thanks</p>
<google-app-engine><google-cloud-run>
2019-04-10 18:38:36
HQ
55,621,212
is it possible to React.useState(() => {}) in React?
<p>is it possible to use a <code>function</code> as my React Component's state ?</p> <p>example code here:</p> <pre><code>// typescript type OoopsFunction = () =&gt; void; export function App() { const [ooops, setOoops] = React.useState&lt;OoopsFunction&gt;( () =&gt; console.log('default ooops') ); return ( &lt;div&gt; &lt;div onClick={ ooops }&gt; Show Ooops &lt;/div&gt; &lt;div onClick={() =&gt; { setOoops(() =&gt; console.log('other ooops')) }}&gt; change oops &lt;/div&gt; &lt;/div&gt; ) } </code></pre> <p>but it doesn't works ... the <code>defaultOoops</code> will be invoked at very beginning, and when clicking <code>change oops</code>, the <code>otrher ooops</code> will be logged to console immediately not logging after clicking <code>Show Ooops</code> again.</p> <p>why ?</p> <p>is it possible for me to use a function as my component's state ? </p> <p>or else React has its special ways to process such <code>the function state</code> ? </p>
<reactjs><typescript><default-value><react-hooks>
2019-04-10 20:57:14
HQ
55,621,632
Firestore - How to decrement integer value atomically in database?
<p>Firestore has recently launched a new feature to increment and decrement the integer values atomically.</p> <p>I can increment the integer value using</p> <p>For instance, <code>FieldValue.increment(50)</code></p> <p>But how to decrement ?</p> <p>I tried using <code>FieldValue.decrement(50)</code> But there is no method like decrement in FieldValue.</p> <p>It's not working.</p> <p><a href="https://firebase.googleblog.com/2019/03/increment-server-side-cloud-firestore.html?linkId=65365800&amp;m=1" rel="noreferrer">https://firebase.googleblog.com/2019/03/increment-server-side-cloud-firestore.html?linkId=65365800&amp;m=1</a></p>
<android><firebase><google-cloud-firestore>
2019-04-10 21:35:26
HQ
55,622,768
Uncaught Invariant Violation: Rendered more hooks than during the previous render
<p>I have a component that looks like this (very simplified version):</p> <pre><code>const component = (props: PropTypes) =&gt; { const [allResultsVisible, setAllResultsVisible] = useState(false); const renderResults = () =&gt; { return ( &lt;section&gt; &lt;p onClick={ setAllResultsVisible(!allResultsVisible) }&gt; More results v &lt;/p&gt; { allResultsVisible &amp;&amp; &lt;section className="entity-block--hidden-results"&gt; ... &lt;/section&gt; } &lt;/section&gt; ); }; return &lt;div&gt;{ renderResults() }&lt;/div&gt;; } </code></pre> <p>When I load the page this component is used on, I get this error: <code>Uncaught Invariant Violation: Rendered more hooks than during the previous render.</code> I tried to find an explanation of this error, but my searching returned no results. </p> <p>When I modify the component slightly:</p> <pre><code>const component = (props: PropTypes) =&gt; { const [allResultsVisible, setAllResultsVisible] = useState(false); const handleToggle = () =&gt; { setAllResultsVisible(!allResultsVisible); } const renderResults = () =&gt; { return ( &lt;section&gt; &lt;p onClick={ handleToggle }&gt; More results v &lt;/p&gt; { allResultsVisible &amp;&amp; &lt;section className="entity-block--hidden-results"&gt; ... &lt;/section&gt; } &lt;/section&gt; ); }; return &lt;div&gt;{ renderResults() }&lt;/div&gt;; } </code></pre> <p>I no longer get that error. Is it because I included the <code>setState</code> function within the jsx that is returned by <code>renderResults</code>? It would be great to have an explanation of why the fix works.</p>
<javascript><reactjs><react-hooks>
2019-04-10 23:45:04
HQ
55,623,811
confused with function int main ( int argc, char* argv[ ]) to read files and store in std::vector
i have to write a function where it receives 2 files as the command line argument (file1 file2) which the program reads in these files should be stored in two std:vector container file 1 has 4 int values in each line representing a rectangles bottom point then top point eg 73 4 113 46 so x y x y i have to write a class for representing the rectangle which makes each rectangle an object of that class file2 just contains list of areas 1 per line in int value. i have to use c++11 to write this function in can you please an example show how to implement this in int main(int argc, char *argv[ ] ) iam a total noob to this...
<c++><c++11><command-line>
2019-04-11 02:27:34
LQ_EDIT
55,626,182
Intent getting null in onReceive in MyAlarm class even though I sat putEctra while sending intent
MainActivity: package com.jimmytrivedi.alarmdemo; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TimePicker; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import java.util.Calendar; import butterknife.BindView; import butterknife.ButterKnife; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private static final String TAG = MainActivity.class.getSimpleName(); @BindView(R.id.timePicker) TimePicker timePicker; @BindView(R.id.buttonAlarm) Button buttonAlarm; @BindView(R.id.cancelAlarm) Button cancelAlarm; private AlarmManager alarmManager; private PendingIntent pendingIntent; private Intent intent; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); cancelAlarm.setEnabled(false); selClickListener(); } private void selClickListener() { buttonAlarm.setOnClickListener(this); cancelAlarm.setOnClickListener(this); } @Override public void onClick(View v) { int id = v.getId(); switch (id) { case R.id.buttonAlarm: Calendar calendar = Calendar.getInstance(); if (Build.VERSION.SDK_INT >= 23) { calendar.set( calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), timePicker.getHour(), timePicker.getMinute(), 0); } else { calendar.set( calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), timePicker.getCurrentHour(), timePicker.getCurrentMinute(), 0); } setAlarm(calendar.getTimeInMillis()); showLog("getTimeInMillis: "+calendar.getTimeInMillis() ); cancelAlarm.setEnabled(true); break; case R.id.cancelAlarm: cancelAlarm(); break; } } private void setAlarm(long time) { //creating a new intent specifying the broadcast receiver Intent intent = new Intent(this, MyAlarm.class); intent.putExtra("REMINDER_ID", "1"); //creating a pending intent using the intent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0); //setting the repeating alarm that will be fired every day alarmManager.setRepeating(AlarmManager.RTC, time, AlarmManager.INTERVAL_DAY, pendingIntent); Toast.makeText(this, "Alarm is set", Toast.LENGTH_SHORT).show(); } private void cancelAlarm() { pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0); alarmManager.cancel(pendingIntent); Toast.makeText(this, "Canceled", Toast.LENGTH_SHORT).show(); } private void showLog(String msg) { Log.d(TAG, msg); } } ---------------------- setAlarm: private void setAlarm(long time) { //creating a new intent specifying the broadcast receiver Intent intent = new Intent(this, MyAlarm.class); intent.putExtra("REMINDER_ID", "1"); //creating a pending intent using the intent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0); //setting the repeating alarm that will be fired every day alarmManager.setRepeating(AlarmManager.RTC, time, AlarmManager.INTERVAL_DAY, pendingIntent); Toast.makeText(this, "Alarm is set", Toast.LENGTH_SHORT).show(); } MyAlarm class: package com.jimmytrivedi.alarmdemo; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.media.MediaPlayer; import android.provider.Settings; import android.util.Log; public class MyAlarm extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { String id = intent.getStringExtra("REMINDER_ID"); Log.d("Test", "ID: "+ id) ; MediaPlayer mediaPlayer = MediaPlayer.create(context, Settings.System.DEFAULT_RINGTONE_URI); mediaPlayer.start(); Log.d("Test", "Alarm just fired") ; } } Don't know why intent is getting null? BTW, onReceived called and works other things. Reminder is also coming. And I printed logs also, This: (Log.d("Test", "Alarm just fired") ;) is also printing. Why? Any help? Looks like mostly code, so added some random article: It looks like your post is mostly code; please add some more details An article (with the linguistic glossing abbreviation art) is a word that is used with a noun (as a standalone word or a prefix or suffix) to specify grammatical definiteness of the noun, and in some languages extending to volume or numerical scope. The articles in English grammar are the and a/an, and in certain contexts some. "An" and "a" are modern forms of the Old English "an", which in Anglian dialects was the number "one" (compare "on" in Saxon dialects) and survived into Modern Scots as the number "owan". Both "on" (respelled "one" by the Norman language) and "an" survived into Modern English, with "one" used as the number and "an" ("a", before nouns that begin with a consonant sound) as an indefinite article. In many languages, articles are a special part of speech which cannot be easily combined[clarification needed] with other parts of speech. In English grammar, articles are frequently considered part of a broader category called determiners, which contains articles, demonstratives (such as "this" and "that"), possessive determiners (such as "my" and "his"), and quantifiers (such as "all" and "few").[1] Articles and other determiners are also sometimes counted as a type of adjective, since they describe the words that they precede.[2] In languages that employ articles, every common noun, with some exceptions, is expressed with a certain definiteness, definite or indefinite, as an attribute (similar to the way many languages express every noun with a certain grammatical number—singular or plural—or a grammatical gender). Articles are among the most common words in many languages; in English, for example, the most frequent word is the.[3] Articles are usually categorized as either definite or indefinite.[4] A few languages with well-developed systems of articles may distinguish additional subtypes. Within each type, languages may have various forms of each article, due to conforming to grammatical attributes such as gender, number, or case. Articles may also be modified as influenced by adjacent sounds or words as in elision (e.g., French "le" becoming "l'" before a vowel), epenthesis (e.g., English "a" becoming "an" before a vowel), or contraction (e.g. Irish "i + na" becoming "sna").
<android><android-intent><broadcastreceiver>
2019-04-11 06:41:49
LQ_EDIT
55,627,640
make jquery array with each(function) for selects and inputs
I want to rebuild this array: var testarr=[["Option1","","Text1"],["Option2","Input_1",""]]; with jquery each(function) an push() for selects and inputs <div> <select id="idTest" class="select_css" name="selectTest[]"> <option value="" selected>Option</option> <option value="Option1">Option1</option> <option value="Option2">Option2</option> </select> <input type="text" class="input_css" data-room="1" name="input_1[]" /> <input type="text" class="input_css" data-other="1" name="input_2[]" /> </div> <div> <textarea name="textareaTest[]" placeholder="Test" class="textarea_css" id="textarea1"></textarea> </div> <div> <select id="idTest" class="select_css" name="selectTest[]"> <option value="" selected>Option</option> <option value="Option1">Option1</option> <option value="Option2">Option2</option> </select> <input type="text" class="input_css" name="input_1[]" /> <input type="text" class="input_css" name="input_2[]" /> </div> <div> <textarea name="textareaTest[]" placeholder="Test" class="textarea_css" id="textarea1"></textarea> </div> <div id="arrlist"></div> <script> var testarr=[["Option1","","Text1"],["Option2","Input_1",""]]; for(var i=0; i<testarr.length; i++) { text = '<div>'+testarr[i][0]+'<br>'+testarr[i][1]+'</div><div>'+testarr[i][2]+'</div>'; $("#arrlist").append(text); } </script> [https://jsfiddle.net/htpmj532/6/][1] [1]: https://jsfiddle.net/htpmj532/6/
<jquery><arrays>
2019-04-11 08:08:52
LQ_EDIT
55,627,780
Evaluating pytorch models: `with torch.no_grad` vs `model.eval()`
<p>When I want to evaluate the performance of my model on the validation set, is it preferred to use:</p> <ul> <li><code>with torch.no_grad:</code></li> </ul> <p>Or</p> <ul> <li><code>model.eval()</code></li> </ul>
<machine-learning><deep-learning><pytorch><autograd>
2019-04-11 08:16:55
HQ
55,628,015
Where can I download Java Mission Control(7) (OpenJDK11 or higher)?
<p>Java Mission Control(JMC) was announced to be handed over from Oracle to the open source community from JDK 11 onwards. However JMC is not bundled with the <a href="https://jdk.java.net/11/" rel="noreferrer">OpenJDK11 releases</a>.</p> <p>I read that JMC will be provided as separate <a href="https://jdk.java.net/jmc/" rel="noreferrer">download here</a>, but there are no builds to download. Also Oracle no longer provides a download on <a href="https://www.oracle.com/technetwork/java/javaseproducts/mission-control/java-mission-control-1998576.html" rel="noreferrer">their page about JMC</a>. And I can no longer find it in the <a href="https://www.oracle.com/technetwork/java/javase/downloads/index.html" rel="noreferrer">Oracle JDK</a>.</p> <p>The source is mirrored on <a href="https://github.com/JDKMissionControl/jmc" rel="noreferrer">GitHub</a> but there are also no build releases to download.</p> <p>Where can I download the most recent open source licensed version of Java Mission Control?</p>
<java><jmc><jfr>
2019-04-11 08:30:42
HQ
55,630,459
how can i write my source code in python so that it works in DASH framework
i have written my code in python using Jupyer Notebook and is working fine. I need help on how to write that code in DASH or make it work in dash ``` PATH = 'products.csv' data = pd.read_csv(PATH) colors = ['#f4cb42', '#cd7f32', '#a1a8b5'] #gold,bronze,silver medal_counts = data.Categories.value_counts(sort=True) labels = medal_counts.index values = medal_counts.values pie = go.Pie(labels=labels, values=values, marker=dict(colors=colors)) layout = go.Layout(title='Sales by CATEGORIES ') fig = go.Figure(data=[pie], layout=layout) py.iplot(fig) ``` the code draws a pie chart
<python><pandas><flask><plotly-dash>
2019-04-11 10:36:01
LQ_EDIT
55,632,195
Why dose this happen (C programming Run time error)
i have written this code for a wordsearch program however when i run it this happens [(What happens when it runs)][1] if anyone has any idea why this happens please could you help me m completely lost. (if indentation is wrong on here just know that it is correct in my actual code) (new to c programming and Stackoverflow so please be easy on me) this is the code - #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <math.h> #define WIDTH 16 #define HEIGHT 16 #define NWORDS 6 char wordsearch[HEIGHT][WIDTH]; /* horizontaly */ int canPlaceH (const char * word, int i, int j) { if ((strlen(word) + j) > WIDTH) return 0; do { if ((wordsearch[i][j] != 0) && (wordsearch[i][j] != *word)) return 0; j += 1; } while (*++word); return 1; } void placeH(const char * word, int i, int j) { do { wordsearch[i][j++] = *word; } while (*++word); } /* verticaly */ int canPlaceV(const char * word, int i, int j) { if ((strlen(word) + i) > HEIGHT) return 0; do { if ((wordsearch[i][j] != 0) && (wordsearch[i][j] != *word)) return 0; i += 1; } while (*++word); return 1; } void placeV(const char * word, int i, int j) { do { wordsearch[i++][j] = *word; } while (*++word); } /* diagonal up */ int canPlaceDU(const char * word, int i, int j) { int ln = strlen(word); if (((ln + j) > WIDTH) || ((i - ln) < 0)) return 0; do { if ((wordsearch[i][j] != 0) && (wordsearch[i][j] != *word)) return 0; i -= 1; j += 1; } while (*++word); return 1; } void placeDU(const char * word, int i, int j) { do { wordsearch[i--][j++] = *word; } while (*++word); } /* diagonal down */ int canPlaceDD(const char * word, int i, int j) { int ln = strlen(word); if (((ln + j) > WIDTH) || ((i + ln) > HEIGHT)) return 0; do { if ((wordsearch[i][j] != 0) && (wordsearch[i][j] != *word)) return 0; i += 1; j += 1; } while (*++word); return 1; } void placeDD(const char * word, int i, int j) { do { wordsearch[i++][j++] = *word; } while (*++word); } void fillWordsearch(const char ** a, int sz) { /* first step add words from a */ const char * used[NWORDS - 1] = { NULL }; /* to not get two times the same word */ for (int w = 0; w != NWORDS; ++w) { /* random choice of a word not yet used */ const char * word; for (;;) { word = a[rand() % sz]; int i; /* check not yet used */ for (i = 0; i != w; ++i) if (!strcmp(used[i], word)) break; if (i == w) { /* not yet used */ used[w] = word; break; } } /* random placement */ int i, j, d; typedef int (*canFunc)(const char *, int, int); typedef void (*placeFunc)(const char *, int, int); const canFunc canPlace[] = { canPlaceH, canPlaceV, canPlaceDU, canPlaceDD }; const placeFunc place[] = { placeH, placeV, placeDU, placeDD }; do { i = rand() % HEIGHT; j = rand() % WIDTH; d = rand() % 4; } while (!(*canPlace[d])(word, i, j)); (*place[d])(word, i, j); #ifdef DEBUG for (int i = 0; i != HEIGHT; ++i) { for (int j = 0; j != WIDTH; ++j) putchar((wordsearch[i][j] == 0) ? '.' : wordsearch[i][j]); putchar('\n'); } putchar('\n'); #endif /* second step fill not yet set characters with random lowercase letters */ int q,w; for (q = 0; q < HEIGHT; q++) for (w = 0; w != WIDTH; ++w) if (wordsearch[q][w] == 0) wordsearch[q][w] = 'a' + rand() % ('z' - 'a' + 1); } } int main() { const char *animalArray[] = { "lynx", "kitten", "cheetah", "ape", "doe", "reindeer", "whale", "baboon", "skunk", "dugong", "elephant", "anteater", "chameleon", "lizard", "horse" }; const char *colourArray[] = { "red", "green", "blue", "black", "pink", "yellow", "brown", "orange", "purple", "black", "white", "cyan", "maroon", "magenta", "gray" }; const char *videogameArray[] = { "fortnite", "fifa", "hytale", "soma", "prey", "destiny", "titanfall", "woldenstein", "battlefield", "fallout", "tekken", "skyrim", "dishonored", "uncharted", "anthem" }; const char *sportsArray[] = { "basketball", "football", "cricket", "wrestling", "fencing", "rowing", "volleyball", "baseball", "hockey", "racing", "golf", "bobsleigh", "curling", "snowboarding", "bowling" }; const char *countryArray[] = { "england", "ireland", "china", "wales", "bangladesh", "maldives", "slovenia", "uruguay", "colombia", "samoa", "jamaica", "malta", "bulgaria", "armenia", "gamnbia" }; printf("---------------------------------\n"); printf("| Welcome to the WordSearch Game |\n"); printf("---------------------------------\n"); printf("Choose a Category - \n"); printf("Option 1 - Animals\n"); printf("Option 2 - Colours\n"); printf("Option 3 - Video Games\n"); printf("Option 4 - Sports\n"); printf("Option 5 - Countries\n"); int i; if ((scanf("%d", &i) != 1) || (i < 1) || (i > 5)) return -1; srand(time(NULL)); switch (i) { case 1: fillWordsearch(animalArray, sizeof(animalArray)/sizeof(*animalArray)); break; case 2: fillWordsearch(colourArray, sizeof(colourArray)/sizeof(*colourArray)); break; case 3: fillWordsearch(videogameArray, sizeof(videogameArray)/sizeof(*videogameArray)); break; case 4: fillWordsearch(sportsArray, sizeof(sportsArray)/sizeof(*sportsArray)); break; default: fillWordsearch(countryArray, sizeof(countryArray)/sizeof(*countryArray)); break; } /* print result */ for (i = 0; i != HEIGHT; ++i) { for (int j = 0; j != WIDTH; ++j) putchar(wordsearch[i][j]); putchar('\n'); } return 0; } [1]: https://i.stack.imgur.com/l8pHx.png
<c>
2019-04-11 12:10:37
LQ_EDIT
55,632,261
How to pair sublists of (x,y) cell coordinates?
I have a list of 60 lists (representing 60 images). Each of these 60 lists contains 30 sublists, each sub-list corresponding to a cell's coordinates. The goal is to track each cell's coordinates, in other words, to pair each sublist (cell) of the bigger list to all of the other sublists of each bigger list (the image). Thus, in the end, we shall obtain 60 lists: each list is a cell's coordinates over the 60 images. That way I can calculate each cell's speed. `[[[[99, 87, 10], [212, 271, 10], [224, 394, 10], [394, 178, 10], [155, 91, 10], [297, 107, 10], [406, 52, 10], [349, 427, 10], [149, 118, 10], [184, 199, 10], [185, 247, 10], [62, 232, 10], [63, 71, 10], [205, 46, 10], [381, 74, 10], [255, 389, 10], [98, 143, 9], [99, 373, 10], [55, 341, 10], [89, 195, 10], [305, 182, 10], [263, 255, 9], [345, 62, 9], [226, 235, 9], [242, 142, 9], [379, 35, 9], [391, 265, 9], [205, 151, 9], [335, 397, 9], [122, 211, 9]]], [[[347, 425, 10], [64, 75, 10], [399, 184, 10], [178, 244, 10], [292, 106, 10], [379, 35, 10], [383, 71, 10], [184, 200, 10], [212, 271, 10], [406, 52, 10], [302, 181, 10], [149, 87, 10], [245, 142, 10], [221, 238, 10], [93, 145, 10], [211, 146, 10], [51, 339, 10], [223, 392, 9], [97, 93, 10], [345, 61, 9], [63, 230, 9], [91, 197, 10], [141, 121, 10], [262, 263, 10], [392, 259, 9], [100, 369, 9], [207, 44, 9], [127, 212, 9], [254, 389, 9]]], [[[212, 269, 9], [383, 71, 10], [184, 200, 10], [296, 178, 10], [69, 80, 10], [173, 247, 10], [409, 56, 10], [140, 122, 10], [207, 45, 10], [394, 257, 10], [403, 187, 10], [64, 224, 10], [91, 205, 10], [148, 87, 10], [51, 337, 10], [223, 392, 10], [218, 148, 10], [93, 99, 10], [248, 143, 10], [339, 59, 10], [91, 145, 10], [323, 400, 10], [261, 263, 10], [289, 106, 9], [254, 382, 10], [343, 422, 9], [134, 214, 9], [217, 242, 9], [383, 40, 9], [103, 363, 9]]], [[[383, 74, 10], [208, 271, 10], [220, 146, 10], [253, 143, 10], [394, 257, 10], [212, 43, 10], [321, 401, 10], [212, 239, 10], [343, 422, 10], [136, 123, 10], [383, 43, 10], [93, 103, 10], [135, 214, 10], [333, 56, 10], [409, 59, 10], [110, 359, 10], [177, 205, 10], [260, 263, 10], [293, 177, 10], [69, 80, 9], [409, 190, 10], [50, 331, 10], [92, 207, 9], [254, 380, 9], [148, 87, 9], [169, 250, 9], [65, 219, 9], [220, 385, 9], [283, 107, 9], [87, 149, 9]]], [[[95, 106, 10], [110, 356, 10], [317, 406, 10], [223, 383, 10], [344, 421, 10], [136, 124, 10], [142, 88, 10], [164, 256, 10], [47, 328, 10], [253, 376, 10], [277, 107, 10], [68, 82, 10], [383, 45, 10], [255, 142, 10], [214, 41, 10], [291, 176, 10], [221, 146, 9], [412, 193, 10], [409, 61, 10], [171, 206, 10], [260, 263, 10], [207, 237, 10], [95, 211, 9], [65, 217, 9], [395, 255, 10], [208, 271, 9], [326, 53, 9], [136, 215, 9], [86, 154, 9], [385, 79, 9]]], [[[343, 418, 9], [203, 271, 10], [113, 353, 10], [254, 368, 10], [67, 82, 10], [135, 88, 10], [315, 406, 10], [214, 40, 10], [223, 145, 10], [269, 106, 10], [407, 58, 10], [225, 386, 10], [97, 111, 10], [259, 145, 10], [169, 201, 10], [205, 238, 10], [399, 249, 9], [254, 261, 9], [387, 80, 9], [97, 215, 10], [142, 215, 9], [83, 157, 9], [47, 327, 9], [284, 173, 9], [413, 195, 9], [59, 212, 9], [136, 128, 9], [161, 259, 9], [320, 50, 9], [382, 46, 9]]], [[[45, 322, 10], [134, 129, 10], [142, 214, 10], [75, 154, 10], [262, 142, 10], [311, 406, 10], [278, 169, 10], [257, 361, 10], [97, 115, 10], [119, 351, 10], [215, 35, 10], [169, 203, 10], [223, 140, 10], [383, 47, 10], [253, 260, 10], [202, 271, 10], [202, 236, 10], [412, 200, 10], [413, 52, 9], [97, 219, 10], [343, 413, 10], [401, 247, 9], [268, 103, 10], [160, 261, 9], [64, 82, 9], [387, 79, 9], [316, 51, 9], [58, 211, 9], [134, 91, 9]]], [[[195, 274, 10], [313, 47, 10], [97, 219, 10], [415, 205, 10], [73, 158, 10], [57, 83, 10], [169, 201, 10], [57, 209, 10], [232, 382, 10], [266, 103, 10], [159, 261, 10], [275, 167, 10], [399, 241, 10], [387, 77, 10], [225, 134, 10], [267, 139, 9], [343, 410, 9], [413, 49, 9], [143, 214, 10], [251, 261, 10], [199, 235, 9], [257, 361, 10], [41, 317, 9], [122, 350, 10], [304, 409, 9], [91, 119, 9], [128, 130, 9], [215, 31, 9], [133, 91, 9], [381, 49, 9]]], [[[233, 382, 9], [130, 93, 10], [69, 160, 10], [41, 317, 10], [398, 236, 10], [190, 281, 10], [89, 119, 10], [143, 215, 10], [217, 28, 10], [125, 129, 10], [344, 404, 10], [247, 262, 10], [413, 47, 10], [167, 200, 10], [395, 76, 10], [297, 412, 10], [271, 137, 10], [309, 49, 10], [49, 83, 10], [263, 358, 10], [55, 202, 9], [379, 50, 9], [154, 265, 9], [223, 129, 9], [415, 205, 9], [130, 353, 9], [191, 233, 9], [275, 167, 9], [100, 221, 9], [263, 97, 9]]], [[[146, 223, 9], [261, 92, 10], [183, 283, 9], [267, 355, 9], [382, 49, 10], [397, 76, 10], [46, 76, 10], [68, 160, 10], [43, 315, 10], [123, 91, 10], [412, 47, 10], [417, 206, 10], [272, 137, 10], [236, 383, 10], [345, 401, 10], [273, 167, 10], [99, 223, 10], [223, 128, 9], [133, 353, 10], [307, 43, 10], [119, 124, 10], [188, 238, 9], [153, 265, 10], [398, 231, 9], [57, 199, 10], [218, 27, 9], [297, 412, 9], [166, 195, 9], [245, 260, 9], [89, 119, 9]]], [[[218, 21, 10], [225, 122, 10], [268, 171, 10], [41, 313, 10], [122, 91, 10], [344, 398, 10], [295, 417, 10], [239, 388, 10], [242, 259, 10], [62, 163, 10], [184, 241, 10], [148, 225, 10], [303, 41, 10], [149, 265, 10], [137, 356, 9], [279, 139, 10], [88, 119, 10], [100, 230, 10], [400, 230, 9], [260, 92, 9], [418, 206, 10], [401, 75, 9], [167, 188, 9], [44, 76, 10], [58, 196, 9], [412, 47, 9], [269, 349, 9], [119, 123, 9], [385, 50, 9]]], [[[403, 77, 10], [412, 41, 10], [57, 195, 10], [271, 349, 10], [172, 286, 10], [44, 73, 10], [41, 309, 10], [299, 37, 10], [419, 208, 10], [383, 49, 10], [400, 229, 10], [245, 389, 10], [237, 256, 10], [57, 166, 10], [118, 124, 10], [151, 231, 10], [255, 91, 10], [184, 243, 10], [88, 121, 10], [118, 88, 10], [100, 231, 10], [224, 115, 9], [295, 419, 10], [267, 173, 10], [345, 397, 9], [283, 136, 9], [142, 268, 9], [137, 359, 9], [167, 181, 9], [217, 15, 9]]], [[[179, 248, 10], [250, 86, 10], [297, 35, 10], [58, 166, 10], [170, 287, 10], [292, 422, 10], [152, 231, 10], [220, 112, 10], [215, 13, 10], [268, 178, 10], [41, 308, 10], [277, 347, 10], [100, 237, 10], [421, 207, 10], [56, 194, 10], [245, 389, 10], [403, 238, 10], [139, 269, 10], [410, 35, 10], [81, 124, 10], [235, 255, 10], [284, 137, 10], [169, 179, 10], [141, 365, 10], [346, 395, 9], [116, 88, 9], [118, 124, 9], [385, 52, 9], [38, 69, 9], [407, 83, 9]]], [[[285, 136, 10], [285, 424, 10], [169, 178, 10], [409, 83, 10], [165, 291, 10], [248, 392, 10], [115, 123, 10], [405, 29, 10], [61, 195, 10], [82, 127, 10], [247, 87, 10], [269, 183, 10], [279, 346, 10], [217, 11, 10], [151, 232, 10], [43, 304, 10], [351, 391, 10], [405, 241, 10], [58, 166, 10], [388, 57, 10], [35, 63, 9], [293, 34, 10], [113, 86, 10], [178, 250, 9], [100, 245, 9], [214, 109, 9], [235, 256, 10], [421, 208, 9], [139, 271, 9], [145, 369, 9]]], [[[67, 199, 10], [410, 88, 10], [227, 257, 10], [136, 279, 10], [209, 106, 10], [56, 169, 10], [217, 10, 10], [40, 301, 10], [389, 57, 10], [109, 80, 10], [147, 373, 10], [250, 395, 10], [291, 133, 10], [113, 129, 10], [243, 88, 10], [152, 233, 10], [163, 295, 10], [410, 243, 10], [423, 212, 10], [269, 187, 10], [33, 57, 9], [83, 127, 9], [283, 428, 9], [170, 175, 9], [355, 385, 9], [178, 256, 9], [405, 29, 9], [290, 34, 9], [101, 251, 9], [284, 344, 9]]], [[[409, 89, 10], [236, 91, 9], [106, 74, 10], [283, 429, 9], [355, 379, 10], [421, 213, 10], [37, 301, 10], [416, 248, 10], [283, 33, 10], [179, 263, 10], [391, 56, 10], [267, 191, 10], [225, 257, 10], [135, 285, 10], [153, 375, 10], [100, 256, 9], [209, 104, 9], [83, 128, 9], [292, 131, 9], [163, 297, 10], [112, 129, 10], [52, 172, 9], [291, 343, 9], [170, 166, 9], [31, 53, 9], [215, 9, 10], [155, 239, 9], [403, 29, 9], [71, 197, 9], [257, 397, 9]]], [[[281, 433, 9], [235, 89, 10], [359, 373, 10], [278, 28, 10], [409, 89, 10], [422, 248, 10], [262, 399, 10], [161, 302, 10], [295, 344, 10], [159, 379, 10], [387, 55, 10], [215, 8, 10], [111, 136, 10], [33, 295, 10], [51, 173, 10], [109, 69, 10], [134, 285, 10], [81, 136, 10], [292, 130, 10], [173, 160, 9], [401, 28, 9], [77, 197, 10], [219, 253, 10], [105, 257, 10], [208, 101, 9], [157, 247, 9], [29, 51, 9], [179, 269, 9], [267, 193, 9]]], [[[178, 153, 10], [401, 29, 10], [262, 199, 9], [153, 253, 9], [412, 94, 10], [207, 98, 10], [427, 244, 10], [163, 382, 10], [85, 196, 10], [112, 141, 10], [77, 142, 10], [418, 217, 10], [105, 260, 10], [278, 21, 10], [295, 125, 10], [359, 371, 9], [46, 177, 9], [134, 284, 10], [32, 293, 9], [29, 46, 10], [177, 274, 10], [217, 247, 10], [290, 430, 9], [235, 91, 10], [158, 309, 9], [265, 401, 9], [302, 344, 9], [382, 52, 9], [111, 67, 9]]], [[[275, 17, 10], [412, 103, 9], [207, 98, 10], [76, 149, 10], [109, 266, 10], [299, 119, 10], [400, 26, 10], [151, 257, 10], [217, 243, 10], [376, 49, 10], [159, 311, 10], [261, 199, 10], [267, 401, 10], [297, 429, 10], [175, 278, 10], [220, 9, 10], [415, 217, 10], [181, 148, 9], [89, 199, 10], [31, 43, 9], [43, 184, 10], [235, 83, 9], [164, 386, 9], [31, 293, 10], [361, 367, 9], [431, 247, 9], [304, 345, 9], [131, 287, 9], [111, 58, 9]]], [[[299, 119, 10], [77, 151, 10], [399, 26, 10], [187, 145, 10], [205, 91, 10], [92, 199, 10], [301, 422, 10], [165, 386, 10], [409, 218, 10], [127, 292, 10], [224, 13, 10], [307, 344, 10], [106, 271, 10], [40, 188, 10], [374, 50, 10], [117, 149, 10], [273, 16, 10], [361, 367, 10], [29, 296, 10], [433, 249, 10], [256, 202, 10], [411, 109, 10], [236, 77, 9], [151, 259, 9], [160, 313, 9], [173, 280, 9], [116, 56, 9], [218, 239, 9], [268, 403, 9], [33, 37, 9]]], [[[313, 349, 10], [367, 47, 10], [395, 22, 10], [201, 88, 10], [172, 281, 10], [97, 200, 10], [125, 296, 10], [187, 145, 10], [226, 14, 10], [433, 250, 10], [271, 404, 10], [297, 413, 10], [401, 219, 10], [307, 116, 10], [79, 158, 10], [116, 153, 10], [39, 31, 10], [163, 314, 10], [105, 272, 10], [25, 297, 9], [166, 387, 10], [250, 202, 10], [364, 359, 10], [151, 261, 10], [35, 193, 9], [219, 238, 9], [233, 70, 9], [266, 17, 9], [410, 110, 9]]], [[[226, 15, 10], [151, 261, 9], [21, 296, 10], [247, 201, 10], [364, 50, 10], [389, 20, 10], [271, 404, 10], [314, 349, 10], [194, 143, 10], [410, 112, 10], [32, 199, 10], [167, 386, 10], [107, 272, 10], [113, 159, 10], [401, 219, 10], [121, 46, 10], [307, 109, 10], [219, 237, 10], [364, 357, 10], [299, 412, 10], [235, 63, 10], [79, 159, 9], [123, 298, 10], [169, 283, 9], [103, 194, 9], [194, 86, 9], [433, 251, 9], [41, 26, 9], [263, 17, 9], [166, 313, 9]]], [[[407, 113, 10], [109, 271, 10], [147, 262, 10], [226, 16, 10], [118, 164, 10], [118, 302, 10], [123, 39, 10], [16, 296, 10], [309, 107, 10], [169, 284, 10], [399, 223, 10], [301, 411, 10], [241, 58, 10], [80, 161, 10], [431, 242, 10], [241, 201, 10], [31, 207, 10], [109, 193, 10], [364, 353, 10], [320, 353, 10], [197, 147, 10], [263, 19, 9], [358, 51, 9], [46, 23, 9], [191, 79, 9], [220, 237, 9], [386, 20, 9], [166, 314, 9], [167, 385, 9], [271, 404, 9]]], [[[203, 151, 9], [167, 319, 10], [191, 79, 10], [364, 347, 10], [272, 405, 10], [27, 212, 10], [111, 193, 10], [167, 285, 10], [221, 230, 10], [241, 56, 10], [13, 298, 10], [313, 100, 10], [398, 223, 10], [322, 353, 10], [45, 21, 10], [379, 21, 10], [110, 273, 10], [117, 304, 10], [357, 51, 10], [260, 17, 9], [170, 385, 9], [125, 38, 10], [302, 410, 9], [238, 203, 9], [400, 116, 9], [145, 263, 10], [230, 17, 9], [431, 236, 9], [80, 163, 9], [124, 166, 9]]], [[[361, 341, 10], [124, 166, 10], [117, 195, 10], [325, 353, 10], [395, 226, 10], [224, 232, 10], [394, 115, 10], [315, 97, 10], [193, 75, 10], [272, 403, 10], [22, 217, 10], [9, 303, 9], [230, 17, 10], [355, 50, 10], [431, 231, 9], [113, 273, 9], [171, 382, 9], [237, 207, 10], [169, 290, 9], [173, 323, 10], [259, 17, 9], [81, 161, 10], [207, 151, 9], [127, 37, 9], [377, 22, 9], [239, 55, 9], [115, 311, 9], [305, 409, 9], [43, 16, 9], [145, 269, 9]]], [[[392, 226, 9], [357, 340, 10], [167, 295, 10], [315, 92, 10], [392, 112, 10], [237, 207, 10], [371, 23, 10], [176, 325, 10], [16, 221, 10], [231, 23, 10], [143, 272, 10], [122, 199, 10], [8, 305, 10], [113, 274, 10], [130, 32, 10], [225, 232, 10], [196, 69, 10], [261, 10, 10], [239, 52, 10], [331, 357, 10], [38, 11, 10], [88, 165, 9], [429, 229, 9], [172, 379, 9], [274, 405, 9], [352, 50, 9], [110, 316, 9], [127, 169, 9], [311, 405, 9], [214, 151, 9]]], [[[91, 169, 10], [125, 169, 10], [365, 17, 10], [142, 271, 10], [386, 230, 10], [163, 298, 10], [386, 112, 10], [170, 376, 10], [232, 202, 10], [10, 313, 10], [316, 86, 10], [347, 53, 10], [131, 27, 10], [357, 338, 10], [331, 357, 10], [218, 151, 10], [179, 326, 9], [225, 231, 10], [231, 22, 10], [116, 274, 10], [241, 49, 9], [313, 403, 10], [278, 409, 9], [430, 224, 9], [11, 224, 9], [37, 9, 10], [109, 323, 9], [199, 63, 9], [125, 203, 9]]], [[[385, 109, 9], [278, 409, 9], [10, 223, 9], [331, 357, 9], [215, 230, 10], [10, 320, 10], [100, 326, 10], [221, 153, 10], [315, 403, 10], [429, 223, 10], [169, 369, 10], [115, 280, 10], [263, 11, 10], [37, 9, 10], [157, 303, 10], [203, 62, 10], [229, 23, 10], [379, 230, 9], [127, 170, 10], [182, 323, 9], [359, 17, 10], [142, 271, 9], [91, 169, 9], [127, 208, 9], [131, 26, 9], [357, 331, 9], [317, 83, 9], [343, 58, 9], [239, 49, 9]]], [[[281, 413, 10], [29, 13, 10], [211, 224, 10], [356, 329, 10], [187, 319, 10], [128, 211, 10], [265, 11, 10], [167, 369, 10], [130, 175, 10], [139, 268, 10], [334, 353, 10], [206, 59, 10], [99, 167, 10], [233, 52, 10], [428, 223, 10], [379, 104, 10], [134, 25, 10], [97, 327, 10], [314, 79, 10], [316, 403, 10], [152, 303, 10], [338, 62, 9], [111, 286, 10], [233, 201, 9], [226, 159, 9], [377, 230, 9], [10, 326, 9], [224, 22, 9], [357, 19, 9]]], [[[375, 232, 10], [137, 25, 10], [317, 401, 10], [10, 328, 10], [335, 352, 10], [353, 20, 10], [206, 58, 10], [379, 103, 10], [225, 23, 10], [310, 73, 10], [271, 15, 10], [353, 326, 10], [188, 315, 10], [285, 419, 10], [92, 323, 10], [233, 51, 10], [128, 213, 10], [231, 196, 10], [13, 217, 10], [163, 368, 9], [230, 164, 9], [208, 219, 9], [337, 62, 9], [23, 13, 9], [423, 217, 9], [110, 286, 9], [133, 175, 9], [137, 268, 9], [149, 303, 9], [101, 167, 9]]], [[[225, 164, 10], [188, 309, 10], [373, 237, 9], [145, 25, 10], [9, 329, 10], [419, 214, 10], [325, 399, 10], [131, 267, 10], [227, 193, 10], [285, 419, 10], [308, 67, 10], [89, 323, 10], [231, 21, 10], [335, 352, 10], [207, 215, 10], [353, 320, 9], [110, 291, 10], [337, 62, 9], [105, 163, 10], [232, 52, 9], [19, 15, 9], [207, 59, 9], [13, 214, 9], [272, 19, 9], [377, 100, 9], [135, 181, 9], [135, 217, 9], [149, 303, 9], [349, 19, 9]]], [[[236, 55, 9], [88, 323, 10], [337, 346, 10], [286, 422, 10], [333, 400, 10], [347, 19, 10], [350, 313, 10], [417, 207, 10], [112, 292, 10], [129, 265, 10], [159, 374, 10], [235, 20, 10], [205, 51, 10], [149, 23, 10], [274, 21, 10], [340, 70, 10], [9, 329, 10], [16, 16, 9], [371, 97, 9], [308, 61, 9], [136, 218, 9], [370, 239, 10], [227, 195, 9], [149, 303, 9], [136, 182, 9], [107, 161, 9], [16, 211, 9], [226, 166, 9], [191, 305, 9], [201, 211, 9]]], [[[363, 243, 9], [334, 400, 9], [226, 194, 10], [143, 217, 10], [347, 308, 10], [151, 302, 10], [83, 325, 10], [129, 263, 10], [286, 425, 10], [236, 21, 10], [155, 375, 10], [19, 203, 10], [9, 337, 10], [337, 77, 10], [197, 203, 10], [195, 303, 10], [205, 44, 9], [155, 28, 10], [220, 164, 10], [347, 19, 10], [307, 55, 10], [112, 158, 9], [235, 59, 9], [370, 98, 9], [115, 299, 10], [339, 343, 10], [137, 184, 9], [15, 16, 9], [415, 201, 9], [275, 22, 9]]], [[[277, 23, 10], [206, 43, 10], [149, 214, 10], [230, 194, 10], [304, 52, 10], [335, 79, 10], [239, 25, 10], [339, 341, 10], [127, 256, 10], [116, 155, 10], [196, 203, 10], [340, 21, 10], [161, 32, 9], [139, 183, 10], [19, 195, 10], [151, 375, 9], [14, 16, 9], [151, 298, 9], [237, 67, 9], [85, 325, 9], [9, 341, 10], [121, 298, 10], [415, 196, 10], [357, 245, 10], [196, 302, 9], [285, 431, 9], [220, 166, 9], [368, 98, 9], [346, 305, 9], [337, 401, 9]]], [[[161, 32, 9], [367, 98, 9], [214, 165, 10], [331, 83, 9], [10, 15, 10], [151, 214, 10], [236, 74, 10], [339, 335, 10], [127, 253, 10], [205, 38, 10], [230, 194, 10], [290, 431, 10], [280, 28, 10], [416, 190, 10], [83, 326, 10], [335, 26, 10], [115, 154, 10], [119, 298, 10], [195, 201, 10], [141, 183, 10], [304, 46, 10], [22, 193, 10], [357, 247, 10], [151, 298, 9], [199, 298, 9], [239, 25, 9], [339, 301, 9], [343, 403, 9], [146, 377, 9]]], [[[165, 37, 9], [236, 75, 10], [208, 167, 9], [346, 406, 10], [247, 28, 10], [11, 14, 10], [200, 292, 10], [331, 88, 10], [121, 298, 10], [416, 190, 10], [13, 344, 10], [122, 247, 10], [359, 248, 10], [291, 431, 10], [202, 35, 10], [333, 301, 10], [338, 334, 10], [232, 197, 9], [329, 29, 9], [149, 295, 9], [151, 213, 10], [23, 194, 10], [193, 195, 9], [146, 377, 9], [275, 35, 9], [80, 328, 9], [358, 97, 9], [146, 179, 9], [117, 151, 9], [305, 45, 9]]], [[[117, 292, 10], [119, 143, 10], [328, 28, 10], [417, 183, 10], [200, 197, 10], [358, 99, 10], [171, 40, 10], [329, 93, 10], [205, 167, 10], [200, 32, 10], [149, 178, 10], [28, 194, 10], [307, 45, 10], [327, 298, 10], [338, 332, 10], [142, 380, 10], [299, 431, 9], [151, 213, 10], [359, 250, 10], [20, 345, 10], [273, 38, 10], [11, 13, 10], [202, 290, 9], [238, 197, 9], [247, 28, 9], [346, 407, 9], [76, 328, 9], [235, 77, 9], [121, 239, 9], [149, 291, 9]]], [[[149, 209, 10], [328, 94, 10], [200, 166, 10], [358, 99, 10], [21, 345, 10], [241, 197, 10], [147, 286, 10], [232, 82, 10], [308, 51, 10], [349, 411, 10], [356, 254, 10], [413, 176, 10], [170, 43, 10], [273, 38, 10], [329, 29, 10], [247, 23, 10], [118, 292, 10], [141, 381, 10], [76, 327, 9], [299, 430, 10], [197, 25, 10], [122, 139, 9], [200, 197, 10], [28, 193, 9], [121, 237, 9], [149, 177, 9], [328, 296, 9], [203, 286, 9]]], [[[26, 346, 10], [248, 197, 10], [341, 326, 10], [171, 46, 10], [201, 283, 10], [123, 139, 10], [197, 167, 10], [201, 197, 10], [304, 430, 10], [232, 83, 10], [147, 285, 10], [412, 173, 10], [141, 382, 10], [199, 23, 10], [327, 295, 10], [351, 418, 10], [355, 254, 10], [151, 207, 10], [148, 171, 10], [31, 191, 10], [119, 292, 10], [75, 326, 9], [274, 44, 9], [335, 37, 9], [358, 106, 9], [313, 57, 9], [251, 20, 9], [119, 235, 9]]], [[[305, 427, 10], [326, 99, 10], [352, 422, 10], [128, 136, 10], [148, 170, 10], [226, 88, 10], [27, 347, 10], [121, 231, 10], [254, 21, 10], [201, 281, 10], [341, 322, 10], [355, 262, 10], [152, 201, 10], [202, 202, 10], [339, 39, 10], [73, 323, 9], [137, 389, 10], [193, 165, 10], [314, 57, 10], [149, 283, 10], [356, 109, 10], [37, 187, 10], [327, 293, 10], [411, 175, 9], [121, 292, 9], [277, 47, 9], [171, 47, 9], [197, 17, 9], [10, 8, 9]]], [[[39, 184, 10], [203, 207, 9], [147, 164, 10], [152, 200, 10], [355, 267, 10], [17, 11, 10], [321, 103, 10], [339, 40, 10], [151, 281, 10], [346, 319, 10], [356, 116, 10], [136, 392, 10], [257, 19, 10], [316, 59, 10], [71, 322, 10], [307, 425, 10], [185, 169, 10], [171, 50, 10], [29, 347, 9], [260, 195, 10], [411, 171, 10], [277, 47, 10], [325, 292, 10], [199, 10, 9], [355, 424, 10], [119, 291, 9], [131, 137, 10], [122, 230, 9], [201, 274, 9], [221, 89, 9]]], [[[203, 209, 10], [200, 10, 10], [20, 11, 10], [261, 17, 10], [316, 59, 10], [320, 109, 10], [167, 56, 10], [353, 118, 10], [35, 344, 10], [154, 283, 10], [323, 291, 10], [305, 417, 10], [407, 164, 10], [355, 267, 10], [281, 53, 9], [136, 397, 10], [69, 317, 10], [346, 317, 10], [263, 195, 10], [135, 136, 10], [205, 269, 9], [221, 89, 10], [359, 431, 10], [127, 225, 9], [147, 194, 9], [38, 182, 9], [345, 45, 10], [121, 291, 9], [151, 160, 9], [185, 169, 9]]], [[[209, 266, 10], [139, 134, 10], [319, 110, 10], [349, 46, 10], [356, 274, 10], [261, 17, 10], [157, 159, 10], [39, 179, 10], [69, 313, 10], [37, 344, 10], [405, 157, 10], [141, 190, 10], [182, 170, 10], [350, 121, 10], [349, 314, 9], [323, 289, 10], [26, 11, 10], [359, 433, 10], [158, 285, 9], [130, 223, 10], [284, 57, 9], [319, 58, 9], [124, 287, 9], [266, 196, 9], [311, 413, 9], [165, 61, 9], [213, 88, 9], [136, 397, 9], [203, 211, 9], [200, 10, 9]]], [[[203, 214, 10], [130, 284, 10], [316, 110, 10], [40, 173, 10], [325, 58, 10], [310, 412, 10], [357, 433, 10], [405, 155, 10], [349, 122, 10], [352, 49, 10], [68, 313, 10], [212, 266, 10], [39, 344, 10], [160, 287, 10], [201, 8, 10], [130, 219, 10], [184, 171, 10], [213, 87, 10], [136, 399, 10], [139, 187, 9], [139, 135, 10], [263, 13, 10], [322, 287, 10], [266, 195, 9], [164, 62, 9], [357, 281, 9], [157, 158, 9], [286, 58, 9], [26, 10, 9], [353, 309, 9]]], [[[217, 265, 10], [361, 281, 10], [350, 431, 10], [309, 411, 10], [329, 59, 10], [46, 345, 10], [358, 52, 10], [128, 401, 10], [272, 191, 10], [131, 284, 10], [139, 133, 10], [206, 217, 10], [315, 111, 10], [128, 217, 10], [137, 184, 10], [349, 123, 10], [157, 160, 10], [31, 8, 10], [40, 167, 10], [213, 85, 10], [320, 285, 10], [290, 58, 9], [209, 10, 9], [163, 292, 9], [399, 151, 9], [184, 175, 9], [268, 10, 9], [159, 67, 9], [353, 309, 9]]], [[[331, 59, 10], [365, 281, 10], [61, 310, 10], [291, 59, 10], [363, 55, 10], [158, 68, 10], [214, 11, 10], [275, 189, 10], [399, 151, 10], [208, 79, 10], [310, 113, 10], [349, 124, 10], [122, 401, 10], [320, 285, 10], [167, 292, 10], [44, 160, 10], [269, 8, 10], [309, 409, 10], [123, 212, 10], [187, 179, 10], [349, 431, 10], [220, 265, 10], [137, 279, 9], [51, 338, 9], [203, 220, 9], [137, 183, 10], [37, 13, 9], [157, 160, 9], [139, 133, 9], [352, 308, 9]]], [[[352, 308, 10], [316, 281, 10], [118, 405, 10], [369, 281, 10], [37, 13, 10], [332, 59, 10], [346, 131, 10], [363, 53, 10], [220, 265, 10], [297, 61, 10], [393, 147, 10], [142, 275, 10], [143, 188, 9], [137, 129, 10], [170, 292, 10], [271, 8, 10], [203, 221, 9], [157, 68, 9], [308, 115, 9], [205, 79, 9], [52, 339, 9], [275, 188, 9], [347, 431, 9], [157, 161, 9], [43, 154, 9], [53, 309, 9], [122, 211, 9], [311, 403, 9]]], [[[143, 275, 9], [205, 79, 9], [155, 67, 10], [46, 307, 10], [369, 280, 10], [280, 188, 10], [160, 163, 10], [205, 223, 10], [148, 193, 10], [389, 146, 10], [171, 293, 10], [119, 208, 10], [221, 266, 10], [346, 135, 10], [315, 398, 10], [297, 61, 10], [43, 153, 10], [333, 58, 10], [115, 405, 9], [368, 50, 10], [219, 11, 9], [134, 125, 9], [58, 344, 9], [339, 431, 9], [278, 11, 9], [193, 185, 9], [315, 277, 9], [353, 307, 9], [38, 14, 9], [307, 115, 9]]], [[[225, 268, 10], [341, 140, 10], [193, 185, 10], [39, 307, 10], [314, 275, 10], [165, 164, 10], [368, 50, 10], [117, 203, 10], [206, 223, 10], [301, 64, 10], [335, 57, 10], [286, 191, 10], [220, 13, 10], [333, 429, 10], [149, 191, 10], [38, 15, 10], [111, 404, 10], [131, 124, 10], [386, 139, 10], [373, 275, 10], [171, 301, 10], [283, 13, 10], [41, 148, 9], [58, 344, 9], [355, 307, 9], [202, 74, 9], [145, 280, 9], [301, 116, 9], [319, 392, 9]]], [[[357, 302, 10], [149, 191, 10], [290, 14, 10], [308, 271, 10], [230, 275, 10], [146, 281, 10], [327, 391, 10], [127, 124, 10], [143, 57, 10], [201, 67, 10], [105, 407, 10], [207, 229, 10], [374, 45, 10], [41, 147, 10], [327, 427, 10], [177, 304, 10], [337, 59, 9], [295, 119, 9], [381, 137, 10], [221, 11, 10], [290, 188, 9], [37, 309, 10], [375, 269, 9], [169, 167, 9], [305, 67, 9], [40, 17, 9], [191, 191, 9], [59, 345, 9], [339, 145, 9]]], [[[207, 231, 9], [200, 65, 10], [305, 67, 10], [380, 139, 10], [44, 143, 10], [359, 302, 10], [376, 44, 10], [45, 17, 10], [191, 193, 10], [335, 153, 10], [35, 309, 10], [119, 121, 10], [117, 196, 10], [147, 285, 10], [231, 278, 10], [291, 116, 10], [319, 425, 10], [100, 407, 9], [143, 56, 9], [289, 187, 10], [334, 391, 9], [340, 57, 9], [182, 307, 10], [149, 191, 9], [65, 349, 9], [307, 271, 9], [290, 14, 9], [229, 11, 9], [375, 265, 9], [169, 169, 9]]], [[[49, 19, 10], [167, 169, 10], [344, 55, 10], [142, 55, 10], [68, 347, 10], [338, 385, 10], [359, 298, 10], [193, 193, 10], [287, 117, 10], [152, 191, 10], [46, 140, 10], [29, 309, 10], [117, 119, 10], [314, 423, 10], [205, 235, 10], [93, 404, 10], [152, 291, 10], [374, 261, 10], [295, 182, 10], [379, 43, 9], [295, 16, 9], [231, 286, 9], [231, 11, 9], [307, 268, 9], [115, 190, 9], [376, 137, 9], [197, 62, 9], [310, 71, 9], [337, 157, 9]]], [[[171, 166, 10], [25, 309, 9], [307, 424, 10], [191, 316, 10], [364, 293, 10], [152, 191, 10], [152, 292, 10], [193, 59, 10], [196, 199, 10], [296, 181, 10], [307, 266, 10], [231, 11, 10], [343, 50, 10], [296, 17, 10], [68, 349, 10], [287, 118, 10], [337, 159, 10], [115, 118, 10], [371, 257, 10], [339, 382, 10], [141, 49, 10], [235, 291, 10], [47, 140, 10], [202, 238, 9], [53, 20, 9], [376, 137, 9], [311, 79, 9], [93, 403, 9], [112, 187, 9], [385, 39, 9]]], [[[110, 117, 10], [339, 382, 10], [154, 292, 10], [196, 202, 10], [298, 178, 10], [178, 164, 10], [238, 14, 10], [304, 425, 10], [375, 135, 10], [386, 40, 10], [52, 23, 10], [153, 191, 10], [308, 259, 10], [191, 322, 10], [344, 45, 10], [141, 46, 10], [235, 293, 10], [201, 247, 10], [111, 184, 10], [88, 398, 9], [22, 308, 10], [70, 350, 10], [283, 118, 9], [299, 19, 10], [368, 253, 10], [191, 62, 10], [364, 293, 9], [337, 164, 9], [49, 139, 9], [313, 85, 9]]], [[[335, 167, 10], [303, 26, 10], [347, 43, 10], [369, 289, 9], [203, 251, 10], [236, 296, 10], [387, 39, 10], [301, 175, 10], [101, 118, 10], [188, 65, 10], [203, 206, 10], [375, 135, 10], [279, 122, 10], [154, 190, 10], [315, 85, 10], [105, 181, 10], [245, 16, 9], [53, 23, 10], [85, 398, 10], [346, 385, 10], [302, 427, 10], [22, 310, 10], [185, 160, 10], [76, 353, 9], [154, 296, 9], [141, 41, 10], [363, 253, 9], [310, 253, 9], [53, 139, 9], [187, 327, 9]]], [[[241, 299, 10], [211, 206, 10], [80, 392, 10], [159, 187, 10], [57, 29, 10], [349, 385, 10], [248, 16, 10], [76, 358, 10], [370, 289, 10], [391, 39, 10], [347, 39, 10], [94, 119, 10], [208, 257, 10], [189, 159, 10], [307, 32, 10], [188, 68, 10], [153, 303, 10], [57, 137, 10], [23, 311, 10], [185, 328, 10], [373, 131, 9], [275, 128, 9], [310, 253, 9], [142, 33, 9], [333, 167, 10], [100, 175, 9], [319, 85, 9], [362, 251, 9], [298, 431, 9], [305, 172, 9]]], [[[61, 136, 9], [296, 430, 10], [213, 203, 10], [356, 386, 10], [97, 169, 10], [371, 127, 10], [314, 37, 10], [310, 248, 10], [323, 86, 10], [349, 33, 10], [370, 287, 10], [275, 130, 10], [251, 15, 10], [333, 169, 10], [245, 305, 10], [140, 28, 10], [305, 172, 10], [22, 317, 10], [86, 122, 10], [196, 160, 10], [152, 311, 10], [355, 253, 9], [160, 187, 9], [187, 70, 9], [211, 259, 10], [59, 29, 10], [75, 394, 9], [183, 326, 9], [394, 39, 9], [76, 365, 9]]], [[[98, 165, 10], [319, 37, 10], [355, 253, 10], [247, 305, 10], [370, 119, 10], [256, 16, 10], [293, 431, 10], [183, 71, 10], [62, 37, 10], [309, 241, 10], [63, 137, 10], [203, 163, 10], [326, 93, 10], [362, 387, 10], [153, 316, 10], [273, 135, 10], [335, 159, 10], [141, 27, 10], [350, 33, 10], [86, 122, 10], [69, 399, 10], [181, 323, 10], [400, 35, 9], [376, 290, 10], [305, 171, 9], [219, 199, 9], [214, 260, 9], [165, 182, 9], [22, 317, 9], [75, 365, 9]]], [[[86, 122, 10], [225, 194, 10], [253, 309, 9], [351, 254, 10], [320, 37, 10], [152, 316, 10], [76, 370, 10], [22, 320, 10], [293, 430, 10], [329, 100, 10], [365, 386, 10], [403, 33, 10], [309, 176, 10], [205, 164, 10], [308, 239, 10], [61, 37, 10], [135, 21, 10], [171, 183, 10], [364, 117, 10], [355, 28, 10], [273, 142, 10], [217, 261, 9], [61, 135, 9], [64, 405, 9], [380, 289, 10], [95, 164, 9], [178, 73, 9], [333, 157, 9], [257, 15, 9]]], [[[171, 73, 9], [362, 116, 10], [57, 410, 10], [271, 149, 10], [206, 166, 10], [308, 238, 10], [58, 133, 10], [409, 29, 10], [173, 182, 10], [333, 157, 10], [355, 26, 10], [308, 177, 10], [261, 14, 10], [23, 326, 10], [181, 331, 10], [95, 164, 10], [225, 256, 10], [368, 386, 10], [350, 254, 10], [293, 428, 9], [335, 103, 9], [152, 317, 9], [134, 15, 10], [254, 309, 9], [226, 193, 9], [61, 44, 9], [85, 118, 9], [325, 40, 9], [79, 375, 9], [381, 289, 9]]]]`
<python><list><data-structures><nested><distance>
2019-04-11 12:14:47
LQ_EDIT
55,633,137
Assembly location for Razor SDK Tasks was not specified
<p>My project fails to build on a build server. I recently added a new ASP.Net Core (2.2) MVC project with razor pages. The project and the rest of the solution target the .Net Framework 4.7.2.</p> <p>In Visual Studio on my dev-machine this works fine, but the build server cannot build it. It shows this error.</p> <blockquote> <p>C:\Users\tfs-build.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(161):C:\Users\tfs-build.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(161,5): Error : Assembly location for Razor SDK Tasks was not specified. The most likely cause is an older incompatible version of Microsoft.NET.Sdk.Razor, or Microsoft.NET.Sdk.Web used by this project. Please target a newer version of the .NET Core SDK.</p> </blockquote> <p>I made my coworker install the <a href="https://dotnet.microsoft.com/download" rel="noreferrer">.Net Core SDK 2.2</a>, since I remembered installing that on the dev-machine to be able to create the project. But this did not help on the buildserver.</p> <p>What could cause this? Why is the behaviour different from the development environment?</p>
<c#><asp.net-core><razor><.net-core><msbuild>
2019-04-11 13:01:35
HQ
55,633,769
Selecting sharepoint site language using powershell script
Is there a way or a script to get a list of the available languages for a sharepoint site in powershell?
<powershell><sharepoint>
2019-04-11 13:32:58
LQ_EDIT
55,633,970
Wordpress Images not displaying (Woocommerce)
Hope you're well, I'm having a problem with my WordPress site after I used a plugin to minify the css. It doesn't display the products images (it's a WooCommerce plug-in who display the images) (Sorry for my bad english) It's a image/gif who appears first and it block my image. This is my website: https://geerdesfromage.com/ The HTML code should be like that : ``` <img src="https://geerdesfromage.com/wp-content/uploads/2019/03/gouda-affiné-1-600x556.jpg" width="600" height="556" alt="gouda-affiné-1" class="jetpack-lazy-image jetpack-lazy-image--handled" data-lazy-loaded="1" scale="0"> ``` But it appears like that : ``` <img src="image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" width="600" height="556" data-src="https://geerdesfromage.com/wp-content/uploads/2019/03/gouda-affiné-1-600x556.jpg" alt="gouda-affiné-1" class="jetpack-lazy-image jetpack-lazy-image--handled" data-lazy-loaded="1" scale="0"> ``` Thanks in advance for help, I can send a piece of cheese for the person who helped me ahah! Have a nice day guys,
<html><wordpress><woocommerce>
2019-04-11 13:43:34
LQ_EDIT
55,634,527
How to obtain a position of last non-zero element
<p>I've got a binary variable representing if event happened or not:</p> <pre><code>event &lt;- c(0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0) </code></pre> <p>I need to obtain a variable that would indicate the time when the last event happened. The expected output would be:</p> <pre><code>last_event &lt;- c(0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 13, 13, 13, 13) </code></pre> <p>How can I obtain that with base R, tidyverse or any other way?</p>
<r><tidyverse><base>
2019-04-11 14:08:19
HQ
55,634,812
BiometricPrompt crashes on Samsung S9 with Face unlock
<p>I am using the new <a href="https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt" rel="noreferrer"><code>BiometricPrompt</code></a> API in Android P (API 28) in my application. (I am actually using it inside a wrapper based on <a href="https://github.com/anitaa1990/Biometric-Auth-Sample" rel="noreferrer">this project</a> so that it functions on older devices too, but that is not relevant to the question.) This is working very well on all devices I have tested, except for the Samsung S9 with face unlock.</p> <p>Even though the stock Android version of <code>BiometricPrompt</code> currently only implements fingerprint authentication, Samsung appears to have extended it to support Face Unlock as well. When I trigger biometric authentication in my app, the "bottom sheet" pops up with a face icon (instead of the fingerprint icon shown on all other devices) and at the top of the screen some text appears that says "no face detected". (Note that the icon shown here is provided by the operating system, not by me, so it is obviously of Samsung's design.)</p> <p>According to the documentation, the <code>BiometricPrompt</code> is only supposed to close itself and call my <code>onAuthenticationSucceeded</code> method if the authentication has been successful. According to <code>logcat</code>, it looks like it has been successful:</p> <pre><code>I/IFaceDaemonCallback: BpFaceDaemonCallback onAcquired() I/SS_3A: INFO: AEC: TsAec_process_get_aec_info: 650: [Id=132] algo_out g=1.785 e_time=0.025 IsLLS=0x0 Ev=7.422 Bv=2.348 ProEv=7.348 Cvgd=1 lux=261, lls=0x0 E/CHI: [SS_ERR ]: [CHI_FACTORY ]: chxseccamerafactoryusecase.cpp: ExecuteCaptureRequest: 452: pMetaData is NULL I/FaceHal: face_processFrontImage[614398] I/FaceServiceWrapper: ss_face_processFrontImage(data_len = 614398, width = 480, height = 640, rotation = 270) I/NativeFaceService: FaceService::processFrontImage - data_len (614398) width(480) height(640) rotation(270) format(2) I/NativeFaceService: SEC_FR_SERVICE_AUTHENTICATE I/sec_fr_engine_qsee: sec_fr_engine_on_authenticate_frame D/sec_fr_engine_qsee: call QSEECom_send_cmd I/SS_3A: INFO: AEC: TsAec_process_get_aec_info: 650: [Id=133] algo_out g=1.785 e_time=0.025 IsLLS=0x0 Ev=7.422 Bv=2.352 ProEv=7.352 Cvgd=1 lux=261, lls=0x0 E/CHI: [SS_ERR ]: [CHI_FACTORY ]: chxseccamerafactoryusecase.cpp: ExecuteCaptureRequest: 452: pMetaData is NULL I/SS_3A: INFO: AEC: TsAec_process_get_aec_info: 650: [Id=134] algo_out g=1.864 e_time=0.025 IsLLS=0x0 Ev=7.359 Bv=2.332 ProEv=7.332 Cvgd=0 lux=262, lls=0x0 E/CHI: [SS_ERR ]: [CHI_FACTORY ]: chxseccamerafactoryusecase.cpp: ExecuteCaptureRequest: 452: pMetaData is NULL I/SS_3A: INFO: AEC: TsAec_process_get_aec_info: 650: [Id=135] algo_out g=1.910 e_time=0.025 IsLLS=0x0 Ev=7.324 Bv=2.324 ProEv=7.324 Cvgd=0 lux=262, lls=0x0 E/CHI: [SS_ERR ]: [CHI_FACTORY ]: chxseccamerafactoryusecase.cpp: ExecuteCaptureRequest: 452: pMetaData is NULL I/SS_3A: INFO: AEC: TsAec_process_get_aec_info: 650: [Id=136] algo_out g=1.920 e_time=0.025 IsLLS=0x0 Ev=7.316 Bv=2.316 ProEv=7.316 Cvgd=0 lux=262, lls=0x0 E/CHI: [SS_ERR ]: [CHI_FACTORY ]: chxseccamerafactoryusecase.cpp: ExecuteCaptureRequest: 452: pMetaData is NULL I/sec_fr_engine_qsee: [Performance Log] QSEECom_send_cmd (129683) us in sec_fr_engine_on_authenticate_frame D/sec_fr_engine_qsee: QSEECom_send_cmd Success D/sec_fr_engine_qsee: return value from qsapp is 0 I/NativeFaceService: sec_fr_engine_on_authenticate_frame - status = [0], identified = [1], keepProcessing = [1] I/NativeFaceService: identify succeeds I/FaceServiceStorage: GetFileSize::Size of file: 196 bytes. I/FaceServiceStorage: file size = 196 I/NativeFaceService: sid file length = 196 I/sec_fr_engine_qsee: sec_fr_engine_authenticated D/sec_fr_engine_qsee: call QSEECom_send_cmd I/SS_3A: INFO: AEC: TsAec_process_get_aec_info: 650: [Id=137] algo_out g=1.936 e_time=0.025 IsLLS=0x0 Ev=7.305 Bv=2.301 ProEv=7.301 Cvgd=0 lux=263, lls=0x0 I/sec_fr_engine_qsee: [Performance Log] QSEECom_send_cmd (12414) us in sec_fr_engine_authenticated D/sec_fr_engine_qsee: QSEECom_send_cmd Success D/sec_fr_engine_qsee: return value from qsapp is 0 I/FaceServiceCallback: sendAuthenticated in I/faced_Proxy: wrapped_object_length = 0 I/IFaceDaemonCallback: BpFaceDaemonCallback onAuthenticated() I/FaceServiceCallback: sendAuthenticated out I/SemBioFaceServiceD: handleAuthenticated : 1 D/keystore: AddAuthenticationToken: timestamp = 168377203, time_received = 16675 I/SemBioFacePrompt: isSuccess = true </code></pre> <p>However, it then crashes with the following error:</p> <pre><code>E/keystore: getAuthToken failed: -3 W/System.err: javax.crypto.IllegalBlockSizeException W/System.err: at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:519) W/System.err: at javax.crypto.Cipher.doFinal(Cipher.java:2055) W/System.err: at com.mycompany.myapp.activities.LoginActivity.onAuthenticationSuccessful(LoginActivity.java:560) W/System.err: at com.mycompany.common.security.BiometricCallbackV28.onAuthenticationSucceeded(BiometricCallbackV28.kt:18) W/System.err: at com.samsung.android.bio.face.SemBioFaceManager.sendAuthenticatedSucceeded(SemBioFaceManager.java:1507) W/System.err: at com.samsung.android.bio.face.SemBioFaceManager.access$2400(SemBioFaceManager.java:73) W/System.err: at com.samsung.android.bio.face.SemBioFaceManager$3.lambda$onAuthenticationSucceeded$1(SemBioFaceManager.java:1673) W/System.err: at com.samsung.android.bio.face.-$$Lambda$SemBioFaceManager$3$GGUPv9osWllaLwJM7Wg6GJEWK8E.run(Unknown Source:6) W/System.err: at android.os.Handler.handleCallback(Handler.java:873) W/System.err: at android.os.Handler.dispatchMessage(Handler.java:99) W/System.err: at android.os.Looper.loop(Looper.java:214) W/System.err: at android.app.ActivityThread.main(ActivityThread.java:6981) W/System.err: at java.lang.reflect.Method.invoke(Native Method) W/System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445) W/System.err: Caused by: android.security.KeyStoreException: Key user not authenticated W/System.err: at android.security.KeyStore.getKeyStoreException(KeyStore.java:1168) W/System.err: at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.update(KeyStoreCryptoOperationChunkedStreamer.java:132) W/System.err: at android.security.keystore.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:217) W/System.err: at android.security.keystore.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:506) W/System.err: ... 14 more </code></pre> <p>According to the documentation, the success of the biometric authentication should have unlocked the keystore, but that has clearly not happened as shown by the <code>Key user not authenticated</code> message in the exception.</p> <p>How can I get this working?</p>
<android><samsung-mobile><biometrics><android-biometric-prompt>
2019-04-11 14:22:43
HQ
55,636,530
Java external command : not found, createProcess errno=2
<p>I try</p> <pre><code>ProcessBuilder().command("C:\\Windows\\System32\\sc.exe query power"); </code></pre> <p>or</p> <pre><code>ProcessBuilder().command("c:/windows/system32/sc.exe query power"); </code></pre> <p>or</p> <pre><code>ProcessBuilder().command("c:/windows/system32/sc query power"); </code></pre> <p>I always get the same error ...</p>
<java><windows>
2019-04-11 15:49:30
LQ_CLOSE
55,636,826
how to express that a variable belongs to a set in cplex call by c ++
I have a sensor node that has neighbors for example C (ij) to represent the set of neighbors of the point (ij) how it is presented with cplex and c ++ in a constraint thank you [enter image description here][1] [1]: https://i.stack.imgur.com/653q4.png
<c++><cplex>
2019-04-11 16:04:39
LQ_EDIT
55,637,710
Counting the amount of times a number shows up as the first digit in a data set
<p>I have a dataset as a .txt file like this:</p> <pre><code>17900 66100 11300 94600 10600 28700 37800 </code></pre> <p>I want to extract the first digit from every number in my dataset and then count how many times that number appears as the first digit in my dataset. How would I solve that in python code?</p>
<python>
2019-04-11 16:59:04
LQ_CLOSE
55,640,173
I am having trouble making my site responsive. I need it to fit any and all screens. Can someone help please? Thanks
Here is the CSS and HTML that I am working with. I already tried at @media only screen. I will copy and paste my html and css down below. Again I need a way to make the webpage fit all screens without shifting from their original positions and layout. Don't worry about this gibberish they weren't letting me post a question until i used more details. "hbg j jgv j gj gn vjf bgnfgbngrnbijrnjivnmjinvijrnbijvnejgbnijefnienijvnebijneijbniejnvijeninbitenbienbinbingbnvrgbjrbnornbijnrbijnrbgijngivijrgbjrbniutrbniurtbnibninbnirnribnirnrijnrtinrtnitninitrnirtnbrtnribntjbnitnjngiuthnibrnibnintirnjirbnijnirtijbnirtbirnbirntijgnvirngibrn" HTML- <h1><img src="listening_here.png" alt="ListeningHere"></h1> <div class="invisible"> <div class="first"> <h2>What is the season?</h2> <div class="box"> <select name="season"> <option value=""></option> <option value="Winter">Winter</option> <option value="Summer">Summer</option> <option value="Spring">Spring</option> <option value="Fall">Fall</option> </select> </div> </div> <div class="first"> <h2>What is the time of day?</h2> <div class="box"> <select name="season"> <option value=""></option> <option value="Morning">Morning</option> <option value="Afternoon">Afternoon</option> <option value="Evening">Evening</option> <option value="Night">Night</option> </select> </div> </div> <div class="first"> <h2>What is the weather like?</h2> <div class="box"> <select name="season"> <option value=""></option> <option value="Sunny">Sunny</option> <option value="Rainy">Rainy</option> <option value="Cloudy">Cloudy</option> <option value="Snowy">Snowy</option> </select> </div> </div> <div class="fourth"> <button>Submit</button> </div> </div> CSS- body { top: 0; bottom: 0; left: 0; right: 0; margin: 0; height: 100%; width: 100%; font-family: Lato, sans-serif; font color: black; font-weight: 400; background-color: #C1E5E5; } h1 { padding-left: 50px; } h3 { text-align: center; font-size: 500%; font-style: normal; font-weight: 400; } .invisible { margin:auto; border-radius: 15px; background-color: whitesmoke; padding: 30px; width: 60%; height: 500px; } .first { height: 150px; width: 90%; float: left; text-align: center; background-color: whitesmoke; } .second { height: 150px; width:90%; float: left; text-align: center; background-color: whitesmoke; } .third { height: 150px; width:90%; float: left; text-align: center; background-color: whitesmoke; } .fourth { height: 50px; width: 90%; float: left; text-align: center; background-color: whitesmoke; } .center { display: block; margin-left: auto; margin-right: auto; width: 40%; border-radius: 8px; } .box { position: absolute; padding-left: 265px; padding-right: 50px; text-align: center; } .box select { background: blue; color: white; padding: 10px; width: 250px; height: 50px; border: none; font-size: 20px; box-shadow: 0 5px 25px rgba(0,0,0,.5); -webkit appearance: button; outline: none; }
<html><css><responsive-design>
2019-04-11 19:50:37
LQ_EDIT
55,643,527
How to return int and string attributes in a single java method
I would like to return the values of all the attributes from the Baseballplayer class. The method that needs to do this must be the public string getBaseballPlayer(int i) method (because I need to reference this method inside getBaseballPlayers() to return all the values as an arraylist of strings) I'm having trouble doing this because all the attributes have different datatypes (int, string, Height). Ive tried doing this public String getBaseballPlayer(int i){ ArrayList <String> bArray = new ArrayList <String>(); bArray.add(getHometown()); bArray.add(getState()); bArray.add(getHighSchool()); bArray.add(getPosition()); however it only works for the string methods, and doesn't necessarily return the actual values but rather the get methods for each string attribute. public class BaseballPlayer extends Player implements Table { private int num; private String pos; public BaseballPlayer( int a, String b, String c, int d, String e, String f, String g, Height h){ super(a,ft,in,c,d,e,f,ht); num = a; pos = b; } public BaseballPlayer(){} //Returns the value of a specific attribute. The input parameter start with 0 for the first attribute, then 1 for the second attribute and so on. //you can use getBaseballPlayer(int i) in getBaseballPlayers( ) with a for loop getting each getBaseballPlayer(int i). public String getBaseballPlayer(int i){ ArrayList <String> bArray = new ArrayList <String>(); bArray.add(getHometown()); bArray.add(getState()); bArray.add(getHighSchool()); bArray.add(getPosition()); return (bArray); } //Returns the value of all attributes as an ArrayList of Strings. public ArrayList <String> getBaseballPlayers(){ } I'm just looking for the simplest way to return each attributes value, then using that method return each value as an arraylist of strings in another method.
<java><arrays><methods><return>
2019-04-12 02:12:23
LQ_EDIT
55,644,365
How to calculate date and change format date
How to calculate date and change format date. I can't compare date code below. I want to know why help me please i want example compare date or calculate day results of different days <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> <script> var d = new Date(); var curr_date = d.getDate(); var curr_month = d.getMonth() + 1; var curr_year = d.getFullYear(); var d1 = curr_date + "/" + curr_month + "/" + curr_year; //alert(d1); change format date completed 12/04/2019 var date2 = new Date("04/12/2018"); var curr_date2 = date2.getDate(); var curr_month2 = date2.getMonth() + 1; var curr_year2 = date2.getFullYear(); var d2 = curr_date2 + "/" + curr_month2 + "/" + curr_year2; //alert(d2); // change format date completed 12/04/2018 if(d1 > d2) { console.log("aaa"); }else{ console.log("bbb"); } </script> <!-- end snippet -->
<javascript>
2019-04-12 04:07:37
LQ_EDIT
55,644,416
C# application permenant store variable value
I m using Properties.setting.default.var trick to store permanently a value in c# application on same pc. Now I m facing a problem that when I saves the value but copy the application to another pc the permanent value does not remains. Is properties.setting trick not work on this scenario? If yes? Please advise the solution. Thanks
<c#>
2019-04-12 04:15:28
LQ_EDIT
55,646,506
WARNING: API 'variant.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'
<p>I just upadated kotlin to 1.3.30 and I now get this error when syncing gradle:</p> <blockquote> <p>WARNING: API 'variant.getPackageLibrary()' is obsolete and has been replaced with 'variant.getPackageLibraryProvider()'. It will be removed at the end of 2019. For more information, see <a href="https://d.android.com/r/tools/task-configuration-avoidance" rel="noreferrer">https://d.android.com/r/tools/task-configuration-avoidance</a>. To determine what is calling variant.getPackageLibrary(), use -Pandroid.debug.obsoleteApi=true on the command line to display a stack trace. Affected Modules: hydatabase</p> </blockquote> <p>Here is my <code>build.gradle</code>:</p> <pre><code>apply plugin: 'com.squareup.sqldelight' apply plugin: 'kotlin-multiplatform' apply plugin: 'com.android.library' android { compileSdkVersion 28 defaultConfig { minSdkVersion 19 } lintOptions { abortOnError false } } sqldelight { Database { packageName = "com.company.hydatabase" } } kotlin { targets { fromPreset(presets.jvm, 'jvm') fromPreset(presets.android, 'android') } sourceSets { commonMain.dependencies { api 'org.jetbrains.kotlin:kotlin-stdlib-common' } jvmMain.dependencies { api 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' // ICU4J: Use DecimalFormat // Get rid of this when minSDKLevel = API 24 - Nougat (7.0) // https://developer.android.com/guide/topics/resources/internationalization.html api 'com.ibm.icu:icu4j:60.2' } androidMain.dependencies { implementation 'org.jetbrains.kotlin:kotlin-stdlib' api "com.squareup.sqldelight:android-driver:1.1.1" } androidMain.dependsOn jvmMain } } task copyDatabase(type: Copy) { from "${rootProject.file('hyappcommon/Databases/').path}" into "${rootProject.file('hydatabase/src/main/assets/databases/').path}" include '**/*.sqlite' } preBuild.dependsOn(copyDatabase) // workaround for https://youtrack.jetbrains.com/issue/KT-27170 configurations { compileClasspath } </code></pre>
<kotlin><android-gradle-plugin>
2019-04-12 07:24:58
HQ
55,647,287
How to send request on click React Hooks way?
<p>How to send http request on button click with react hooks? Or, for that matter, how to do any side effect on button click?</p> <p>What i see so far is to have something "indirect" like:</p> <pre><code>export default = () =&gt; { const [sendRequest, setSendRequest] = useState(false); useEffect(() =&gt; { if(sendRequest){ //send the request setSendRequest(false); } }, [sendRequest]); return ( &lt;input type="button" disabled={sendRequest} onClick={() =&gt; setSendRequest(true)} ); } </code></pre> <p>Is that the proper way or is there some other pattern?</p>
<reactjs><react-hooks>
2019-04-12 08:16:50
HQ
55,648,016
Android expandable/collapable layout
Please i need a way to design an expandable layout that change its hieght and elements position and state(GONE,VISIBLE) with an animation just like the pictures below [Minimum height][1] [Medium heght][2] [Full height (match_parent)][2] [1]: https://drive.google.com/file/d/1F6EPr8onnhE8clAm87N1RZhRg5yoIi9K/view?usp=drivesdk [2]: https://drive.google.com/file/d/1_uLwZ5NPuLJJ7W5c1qISgCs6yZOFgjH7/view?usp=drivesdk
<android><android-layout><android-fragments>
2019-04-12 09:00:38
LQ_EDIT
55,648,028
Find if word exist in array or string PHP
<p>I am trying to find if any of the string inside an array exist in array of words.</p> <p>For example:</p> <pre><code>$key = ["sun","clouds"]; $results = ["Sun is hot","Too many clouds"]; </code></pre> <p>If any of <code>$key</code> exists in <code>$results</code> to return <code>true</code></p> <p>With below script I get the result I want but only if word in <code>$results</code> is exact like the word in <code>$key</code>.</p> <pre><code>function contain($key = [], $results){ $record_found = false; if(is_array($results)){ // Loop through array foreach ($results as $result) { $found = preg_match_all("/\b(?:" .join($key, '|'). ")\b/i", $result, $matches); if ($found) { $record_found = true; } } } else { // Scan string to find word $found = preg_match_all("/\b(?:" .join($key, '|'). ")\b/i", $results, $matches); if ($found) { $record_found = true; } } return $record_found; } </code></pre> <p>If the word in <code>$results</code> is <code>Enjoy all year round **sunshine**</code> my function returns <code>false</code> as can not find word sun. How can I change my function to return true if string contain that string as part of word?</p> <p>I want the word <code>sun</code> to match even with <code>sun</code> or <code>sunshine</code>.</p> <p>TIA</p>
<php><regex><preg-match-all>
2019-04-12 09:01:38
LQ_CLOSE
55,649,080
Trying to move data from Google Bigquery to Blob
I am trying to move data from Google bigquery to Blob incrementally, can anyone help me with this?
<google-bigquery><azure-storage-blobs><azure-data-factory>
2019-04-12 09:57:22
LQ_EDIT
55,651,283
Creating a view dynamically via a variable - SQL SERVER
I am attempting to create a SQL Server view based upon a query dynamically using a variable. I have written and tested the query and can confirm it works with the results, I have attached a link to Imgur to view the screenshots as I am unable to post the full query due to reasons. Creating the view however, I am receiving a few errors and can't seem to work them out! I have checked over the query multiple times and re-structured my code in creating the view. declare @MarketingCampaignID int,@viewQuery nvarchar(max) set @MarketingCampaignID=246159 if exists(select * from sys.views where name='vwCampaign_' + cast(@MarketingCampaignID as nvarchar(255)) + '_FlatValueTable') begin set @viewQuery = 'drop view XMPieTracking.vwCampaign_' + cast(@MarketingCampaignID as nvarchar(255)) + '_FlatValueTable' exec (@viewQuery) end set @viewQuery = N'Create View XMPieTracking.vwCampaign_' + cast(@MarketingCampaignID as nvarchar(255)) + '_FlatValueTable' set @viewQuery = @viewQuery + N'SELECT * FROM (...) exec( @viewQuery) - See images. https://imgur.com/a/qIhN339
<sql><sql-server>
2019-04-12 12:07:25
LQ_EDIT
55,652,128
get current url 0th index value in angular 7
<p>The url is <a href="http://localhost:4200/horizontal/ecommerce/product-edit/men/2" rel="nofollow noreferrer">http://localhost:4200/horizontal/ecommerce/product-edit/men/2</a> I want to get horizontal value</p>
<angular>
2019-04-12 12:56:28
LQ_CLOSE
55,653,187
Swift default AlertViewController breaking constraints
<p>I am trying to use a default AlertViewController with style <strong>.actionSheet</strong>. For some reason, the alert causes a <strong>constraint error</strong>. As long as the alertController is not triggered (displayed) through a button, there are no constraint errors on the whole view. Could it be that this is a <strong>bug of Xcode?</strong></p> <p>The exact error I get looks like this:</p> <pre><code>2019-04-12 15:33:29.584076+0200 Appname[4688:39368] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "&lt;NSLayoutConstraint:0x6000025a1e50 UIView:0x7f88fcf6ce60.width == - 16 (active)&gt;" ) Will attempt to recover by breaking constraint &lt;NSLayoutConstraint:0x6000025a1e50 UIView:0x7f88fcf6ce60.width == - 16 (active)&gt; </code></pre> <p>This is the code I use:</p> <pre><code>@objc func changeProfileImageTapped(){ print("ChangeProfileImageButton tapped!") let alert = UIAlertController(title: "Change your profile image", message: nil, preferredStyle: .actionSheet) alert.addAction(UIAlertAction(title: "Photo Library", style: .default, handler: nil)) alert.addAction(UIAlertAction(title: "Online Stock Library", style: .default, handler: nil)) alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil)) alert.view.tintColor = ColorCodes.logoPrimaryColor self.present(alert, animated: true) } </code></pre> <p>As you can see, it is <strong>very basic</strong>. That's why I am very confused about the strange behavior I get as this <strong>default implementation</strong> should not cause any errors, right?</p> <p><a href="https://i.stack.imgur.com/FTZFV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FTZFV.png" alt="Output I get"></a></p> <p>Although, through breaking the constraints, the alert displays properly on all screen sizes I would be really thankful for any help I get.</p>
<ios><swift><iphone><xcode><ios-autolayout>
2019-04-12 13:49:44
HQ
55,653,276
R Extract a column comparing two column of two dataframes
I'm little bit stuck in R I have two dataframe. I Want to compare two column from different dataframe and extract values of another column based on the matching position of the 2 columns compared. [![enter image description here][1]][1] [![enter image description here][2]][2] So here there is my 2 dataframe. I want the half_data_means for which range_mean and a match. What I tried is: mean_test=df_half_data_mean_with_NA[df_half_data_mean_with_NA$range_mean %in% test$a,] But I got all dataframe for the matching values. [1]: https://i.stack.imgur.com/2P2Jq.png [2]: https://i.stack.imgur.com/heBfX.png
<r><dataframe><match>
2019-04-12 13:54:43
LQ_EDIT
55,654,224
Javascript: How to only invoke a function that's called from within another function when a specific div is NOT clicked?
I am calling campusInfo(id) a few places in my code. Inside campusInfo(id) function I am calling campusInfo_2(HouseID). One of the instances where I am calling campusInfo(id) is on the onclick of a div. In this case I don't want campusInfo_2(HouseID) invoked. Here is the campusInfo(id) javascript function which calls campusInfo_2(HouseID) //campus information function campusInfo(id) { fetch(`https://api/` + id) .then(r => r.json()) .then(r => { const mapClassToResponse = { '.campus-name': 'name', '.program-levels-values:eq(4)': 'annualTuition' }; var HouseID = r['Houses'][0]['HouseID']; Object.keys(mapClassToResponse).map(k => { $(k).html(r[mapClassToResponse[k]]); }); //formatting numbers to have commas $(".program-levels-values:eq(4)").digits(); $(".campus-number:eq(0)").digits(); $(".campus-number:eq(1)").digits(); //program-levels $(r.programLevels).each(function (index, item) { $('.program-levels-values:eq(0)').append(item.programLevel + ' '); }); //institution control if (r.isInstitutionControlPublic == false) { $('.program-levels-values:eq(2)').html('Private'); } else { $('.program-levels-values:eq(2)').html('Public'); } campusInfo_2(HouseID); }).catch(console.log); }; Here is the div where I don't want campusInfo_2(HouseID) being invoked <div class="other-school" onclick="campusInfo(10)"><label class="other-schools-list">Portland State University</label</div> Here is what I tried thus far but it was saying in console that the element was undefined. if(document.getElementsByClassName('other-school').clicked == false) { campusInfo_2(HouseID); }
<javascript><jquery><function>
2019-04-12 14:46:13
LQ_EDIT
55,656,433
how to insert id from another table to a table using 1 form
i've been on this for atleast 3 days but i cant seem to get it. i have to get the user_id from the users table and insert it to the user_id of patients table using only one form. this is the tables i am using: user_table: user_id is auto increment. ╔═════════╦══════════╦════════════════╦═══════════╗ ║ user_id ║ level_id ║ email ║ password ║ ╠═════════╬══════════╬════════════════╬═══════════╣ ║ 1 ║ 5 ║ sasa@denva.com ║ sasadenva ║ ║ 2 ║ 1 ║ tony@stark.com ║ tonystark ║ ╚═════════╩══════════╩════════════════╩═══════════╝ patients_table: patients_id is auto increment. +--------+---------+--------------+----------+-----------+--------+ | pat_id | user_id | name | address | number | sex | | 1 | 1 | sasa mindred | manhatan | 987654329 | female | | 2 | 2 | tony stark | new york | 123456789 | male | +--------+---------+--------------+----------+-----------+--------+ i made the name short for the table here. $sql = "SELECT email FROM users WHERE email=?"; $stmt =mysqli_stmt_init($conn); if(!mysqli_stmt_prepare($stmt, $sql)) { header("Location: ../auth/register.php?error=sqlerror"); exit(); }else{ mysqli_stmt_bind_param($stmt, "s", $email); mysqli_stmt_execute($stmt); mysqli_stmt_store_result($stmt); $resultcheck= mysqli_stmt_num_rows($stmt); if($resultcheck > 0) { header("Location: ../auth/register.php?error=emailtaken&last_name=".$last."&first_name=".$first."&middle_name=".$middle."&sex=".$sex.""); exit(); }else{ $sql= "INSERT INTO users (level_id, email, password, created_at) VALUES (?, ?, ?, now())"; $stmt = mysqli_stmt_init($conn); if(!mysqli_stmt_prepare($stmt, $sql)){ header("Location: ../auth/register.php?error=sqlerror"); exit(); }else{ $hashedPwd = password_hash($password, PASSWORD_DEFAULT); mysqli_stmt_bind_param($stmt, "iss", $lvl, $email, $hashedPwd); $user_id = mysqli_insert_id($conn); $sqli = "INSERT INTO patients (user_id, last_name, first_name, middle_name, sex) VALUES ($user_id, ?, ?, ?, ?)"; $stmt = mysqli_stmt_init($conn); if(!mysqli_stmt_prepare($stmt, $sql)){ header("Location: ../auth/register.php?error=sqlerror"); exit(); }else{ mysqli_stmt_bind_param($stmt, "ssss", $last, $first, $middle, $sex); mysqli_stmt_execute($stmt); } mysqli_stmt_execute($stmt); header("Location: ../auth/register.php?signup=success".$conn->insert_id.""); exit(); } } } i expected the output to insert the user_id from the users table to the user_id of the patients table
<php><html><database><mysqli>
2019-04-12 16:57:29
LQ_EDIT
55,656,607
How to call function properties from other file
<p>There are 2 Files 1.Frontend 2.Backend In Frontend There is one function pop(), which basically is b = a.get() and what i want is whenever user type something in entry box it should be printed via backend...</p> <h1>FRONTEND</h1> <pre><code>from tkinter import * import backend win = Tk() win.geometry("500x500") def pop(): b = a.get() But = Button(text = "CLICK",command = pop) But.pack() a = StringVar() e_1 = Entry(textvariable = a) e_1.pack() </code></pre> <h1>BACKEND</h1> <pre><code>from frontend import pop print(b) </code></pre> <p>I was expected that whenever use type something in entry box it should be print via backend but i got an error that is "b" is not define..</p>
<python><tkinter>
2019-04-12 17:09:26
LQ_CLOSE
55,656,650
I don't think I have loaded Java SE 12 properly
I don't believe I have loaded Java properly--chiefly because I can't see an exe suffix after the javac icon in program files (check out screenshot). Furthermore I have carefully copied (in front and with semi-colon) and pasted the pathway for javac into the system variable editing box (again see screenshot) I followed the oracle tutorial for the HelloWorldApp to the letter, setting up a my application folder and putting the notepad file inside. Take a look for yourself (ssh) Et puis I open the shell punch in my script; hit dir; get the spiel about files and such; enter javac HelloWorldApp.java to only end invariably with Javac not a recognised command Arrgh what am I doing wrong? Is it as I suspect--that the Java SE12 isn't loaded properly (mind you I tried with earlier versions and it didn't work either) Am not saving the notepad file correctly (ie helloworld?) Am I not editing the path for the javac compiler properly? Help please. Thanx
<java>
2019-04-12 17:12:51
LQ_EDIT
55,657,741
Is there a yolo dnn detector version similar to "Not Suitable for Work (NSFW)"?
So I look onto old yahoo's [NSFW][1] and can't help but wonder if there is a Yolo DNN version trained on similar (not released) dataset that would detect human nudity and locate it on pictures? Is there at least a public database of it or one must gather his own? [1]: https://yahooeng.tumblr.com/post/151148689421/open-sourcing-a-deep-learning-solution-for
<neural-network><yolo>
2019-04-12 18:38:26
LQ_EDIT
55,658,450
How to insert image to Sqlite in android? and get for profile
<p>I have an app it can get image from my phone gallery but how I can store that image into SQLite database and get that image for user profile from the SQLite database.</p>
<java><android><sqlite>
2019-04-12 19:40:15
LQ_CLOSE
55,658,999
How to convert strings into lists
<p>("1 34 23 12 -89 11)</p> <p>How do I make it like this:</p> <p>['1','34','23','12','-89','11']</p> <p>This is spaced string which I need to convert to a list.</p>
<python>
2019-04-12 20:26:54
LQ_CLOSE
55,659,233
How custom the design of UIButton in objective-C?
<p>I need help to create a custom UIButton, I'm creating a tweak, i have an custom uiview and i know how to add a button on it. </p> <p>But i don't like the blue and tiny stock style of it, I want to custom my button like my UIView with color style and size but don't know how to.</p> <p>I want something like this : <a href="https://i.stack.imgur.com/ROYEH.png" rel="nofollow noreferrer">Image of button style I want</a></p>
<ios><objective-c><button><uibutton><tweak>
2019-04-12 20:49:14
LQ_CLOSE
55,659,381
I am trying to make the user not needing to type in http://. How do I have an input that is prefilled in Python?
<p>I want to have an already prefilled input for the user so they do not need to type in http://. I tried <code>"prefilled=http://"</code> but that did not work.</p> <pre><code>url = input("Enter a URL address starting with http:// ") </code></pre>
<python>
2019-04-12 21:02:24
LQ_CLOSE
55,660,626
Greatest value from an array of numbers (Ruby)
<p>I am currently learning Ruby and for the sake of my life I cannot find a solution to this:</p> <p>Return the greatest value from an array of numbers.</p> <p>Input: [5, 17, -4, 20, 12] Output: 20</p> <p>Can anyone help me out with this and explain why they used their solution?</p> <p>thank you.</p>
<ruby><ruby-on-rails-3>
2019-04-12 23:29:38
LQ_CLOSE
55,660,641
How to return array in a variable with multiple object layer
<p>I haw the two following variables: </p> <pre><code>'ecommerce': { 'checkout': { 'actionField': {'step': 4}, 'products': [{ 'name': 'Spirit Pack', 'id': '12345', 'price': '55', }] } } 'ecommerce': { 'purchase': { 'actionField': {'step': 4}, 'products': [{ 'name': 'Spirit Pack', 'id': '12345', 'price': '55', }] } } </code></pre> <p>How can I return the array named <code>products</code> when the second level of layer object is different. </p>
<javascript><arrays><multidimensional-array>
2019-04-12 23:31:59
LQ_CLOSE
55,660,958
Why does not work styling in Pandas Excel?
import pandas as pd import xlsxwriter from datetime import datetime import sys path = sys.argv[1] xl = pd.ExcelFile(path) df = xl.parse("Sheet1") df.columns = ['Nume', 'Tip de', 'Unit', 'Speciale Price', 'Suma de', 'Suma'] def highlight_max(x): return ['background-color: yellow' if v == x.max() else '' for v in x] df.style.apply(highlight_max) df.loc[-1] = ['Totul', '', '', '', df['Suma de'].sum(), df['Suma'].sum()] I tried to apply `highlight_max` to columns
<python><pandas>
2019-04-13 00:28:10
LQ_EDIT
55,661,427
How to modify tcp congestion algorithm?
i am going to modify the tcp congestion algorithm(such as Vegas,Reno).I know this will need to modify the kernel of linux,but i do not know hot to do it.I want to know that if i want to change the RTT time of Vegas,what should i do?.I really appreciate your help,Thank you.
<c><linux><tcp><linux-kernel>
2019-04-13 02:16:09
LQ_EDIT
55,661,615
How to get Url params after slash
<p>I have a URL "<a href="https://www.example.com/username" rel="nofollow noreferrer">https://www.example.com/username</a>" and I want to extract the username from the URL. For example '<a href="https://www.facebook.com/david" rel="nofollow noreferrer">https://www.facebook.com/david</a>'</p>
<javascript><node.js>
2019-04-13 03:04:36
LQ_CLOSE
55,661,826
How to fix "Parse error: syntax error, unexpected '}"
<p>I'm working with if statements, and I cannot seem to find where I'm going wrong, I'm fairly new to PHP so If someone can maybe guide me in the right direction it would be awesome, thanks.</p> <p>I've tried to rewrite the whole code, and experimented by adding more "}" on the end of the code, which did not seem to work at all.</p> <pre class="lang-php prettyprint-override"><code>&lt;?php $username = ""; $email = ""; $errors = array(); //Connect to the database $db = mysqli_connect('localhost', 'root', '', 'registration'); //If the register button is clicked if (isset($_POST['register'])){ $username = mysql_real_escape_string($_POST['username']); $email = mysql_real_escape_string($_POST['email']); $password_1 = mysql_real_escape_string($_POST['password_1']); $password_2 = mysql_real_escape_string($_POST['password_2']); //Ensure that the form fields are filled correctly. if (empty($username)){ array_push($errors, "A username is required.")} if (empty($email)){ array_push($errors, "An email is required.")} if (empty($password_1 != $password_2)){ array_push($errors, "Passwords do not match.")} } </code></pre>
<php>
2019-04-13 03:54:55
LQ_CLOSE
55,662,830
How to replace "\" with "/" in python? i'm getting an EOL error
<p>How can i replace ("\") with ("/") in python?</p> <pre><code>a = ("Hello/World") b = a.replace("/","\") print(b) </code></pre> <p>i was expected that i'll successfully replace but i'm getting an error EOL error</p>
<python><python-3.x>
2019-04-13 06:46:15
LQ_CLOSE
55,663,193
Converting Decimal value to Binary in Java.(problem with used method in this code!)
Sir! here my problem is on method. in this code used method was void type. ok then why there is return and next it does recursion! if anyone little describe it, then i think it will be easy for me :) ` import java.util.Scanner; class Code { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter your Decimal value here : "); int num = sc.nextInt(); printBinaryform(num); System.out.println(); } private static void printBinaryform(int number) { int remainder; if (number <= 1) { System.out.print(number); return; // KICK OUT OF THE RECURSION } remainder = number % 2; printBinaryform(number >> 1); System.out.print(remainder); } } `
<java><recursion>
2019-04-13 07:45:14
LQ_EDIT
55,664,820
With preg_match it's possible to have the same pattern and have different replacements?
<p>I create this pattern </p> <pre><code>$pattern = "/&lt;a href='(?&lt;href&gt;.+?)'&gt;(?&lt;name&gt;.+?)&lt;\/a&gt;/i"; </code></pre> <p>And i have this example,</p> <pre><code>$string = "&lt;a href='https://www.php.net/'&gt;https://www.php.net/&lt;/a&gt; &lt;a href='https://stackoverflow.com/'&gt;https://stackoverflow.com/&lt;/a&gt; &lt;a href='https://www.google.com/'&gt;https://www.google.com/&lt;/a&gt;"; </code></pre> <p>Using this, i can find the matches and extract the href, and the name. </p> <pre><code>preg_match_all($pattern, $string, $matches); Array ( [0] =&gt; Array ( [0] =&gt; https://www.php.net/ [1] =&gt; https://stackoverflow.com/ [2] =&gt; https://www.google.com/ ) [href] =&gt; Array ( [0] =&gt; https://www.php.net/ [1] =&gt; https://stackoverflow.com/ [2] =&gt; https://www.google.com/ ) [1] =&gt; Array ( [0] =&gt; https://www.php.net/ [1] =&gt; https://stackoverflow.com/ [2] =&gt; https://www.google.com/ ) [name] =&gt; Array ( [0] =&gt; https://www.php.net/ [1] =&gt; https://stackoverflow.com/ [2] =&gt; https://www.google.com/ ) [2] =&gt; Array ( [0] =&gt; https://www.php.net/ [1] =&gt; https://stackoverflow.com/ [2] =&gt; https://www.google.com/ ) ) </code></pre> <p>The problem is when I use the preg_replace, since the pattern is the same, it changes the same information for all the URL, and i need to change only the name and preserve the rest of the information accordingly.</p> <p>Using,</p> <pre><code>if(preg_match_all($pattern, $string, $matches)) { $string = preg_replace($pattern, "&lt;a href='$1'&gt;Name&lt;/a&gt;", $string); } </code></pre> <p>I can get the results from the groups, and preserve the first part of the href. But if i try to change the name, it's the same for all results. </p> <p>If I try to use "str_replace", I can have different results as intended, but this gave me 2 problems. One is that if i try to replace the name, i also change the href, and if i have similar URL with "more slashes" it will change the match part, and leave the rest of the information.</p> <p>In a database I have list of URL with a column that have names, and if the string match any row in the table I need to change the name accordingly and preserve the href. </p> <p>Any help? </p> <p>Thank you.</p> <p>Kind regards!</p>
<php><regex><preg-replace><preg-match><str-replace>
2019-04-13 11:12:22
LQ_CLOSE
55,665,337
KeyStoreException: Signature/MAC verification failed when trying to decrypt
<p>I am trying to create a simple Kotlin object that wraps access to the app's shared preferences, by encrypting content before saving it.</p> <p>Encrypting seems to work OK, but when I try to decrypt, I get an javax.crypto.AEADBadTagException, which triggers from a 'android.security.KeyStoreException: Signature/MAC verification failed'.</p> <p>I have tried debugging to see what's the underlying issue, but I can't find anything. No search has given me any clue, I seem to follow a few guides to the letter without success.</p> <pre><code>private val context: Context? get() = this.application?.applicationContext private var application: Application? = null private val transformation = "AES/GCM/NoPadding" private val androidKeyStore = "AndroidKeyStore" private val ivPrefix = "_iv" private val keyStore by lazy { this.createKeyStore() } private fun createKeyStore(): KeyStore { val keyStore = KeyStore.getInstance(this.androidKeyStore) keyStore.load(null) return keyStore } private fun createSecretKey(alias: String): SecretKey { val keyGenerator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, this.androidKeyStore) keyGenerator.init( KeyGenParameterSpec.Builder(alias, KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT) .setBlockModes(KeyProperties.BLOCK_MODE_GCM) .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE) .build() ) return keyGenerator.generateKey() } private fun getSecretKey(alias: String): SecretKey { return if (this.keyStore.containsAlias(alias)) { (this.keyStore.getEntry(alias, null) as KeyStore.SecretKeyEntry).secretKey } else { this.createSecretKey(alias) } } private fun removeSecretKey(alias: String) { this.keyStore.deleteEntry(alias) } private fun encryptText(alias: String, textToEncrypt: String): String { val cipher = Cipher.getInstance(this.transformation) cipher.init(Cipher.ENCRYPT_MODE, getSecretKey(alias)) val ivString = Base64.encodeToString(cipher.iv, Base64.DEFAULT) this.storeInSharedPrefs(alias + this.ivPrefix, ivString) val byteArray = cipher.doFinal(textToEncrypt.toByteArray(charset("UTF-8"))) return String(byteArray) } private fun decryptText(alias: String, textToDecrypt: String): String? { val ivString = this.retrieveFromSharedPrefs(alias + this.ivPrefix) ?: return null val iv = Base64.decode(ivString, Base64.DEFAULT) val spec = GCMParameterSpec(iv.count() * 8, iv) val cipher = Cipher.getInstance(this.transformation) cipher.init(Cipher.DECRYPT_MODE, getSecretKey(alias), spec) try { val byteArray = cipher.doFinal(textToDecrypt.toByteArray(charset("UTF-8"))) return String(byteArray) } catch (e: Exception) { e.printStackTrace() return null } } private fun storeInSharedPrefs(key: String, value: String) { this.context?.let { PreferenceManager.getDefaultSharedPreferences(it).edit()?.putString(key, value)?.apply() } } private fun retrieveFromSharedPrefs(key: String): String? { val validContext = this.context ?: return null return PreferenceManager.getDefaultSharedPreferences(validContext).getString(key, null) } </code></pre> <p>Can anyone point me in the right direction ?</p>
<android><encryption><kotlin><keystore><android-keystore>
2019-04-13 12:17:28
HQ
55,667,394
Who can explain this code ? Why it shows 1
<p>How does this work?</p> <pre><code>int a=5&lt;=5; cout&lt;&lt;a; // output : 1 </code></pre> <p>Who can explain why output is 1?</p>
<c++><c++11>
2019-04-13 16:05:48
LQ_CLOSE
55,669,069
awk or sed: how to modify based on previous and next lines
<p>I have a file like below</p> <pre><code>* jhasjdhjh sample1 * oioieoirer sample2 * jsdhfjhdf * ppppppp sample3 * iouiuiouo </code></pre> <p>I want it to be</p> <pre><code>* jhasjdhjh * sample * oioieoirer * sampel2 * jsdhfjhdf * ppppppp * sample3 * iouiuiouo </code></pre> <p>So sample1, sample2 we want to add <code>*</code> (space asteric space) since the above line and below line have <code>*</code> (asteric space)</p> <p>sample3 we want to add * (5 spaces and asteric) because the previous line has (space and asteric)</p> <p>So I have to check the previous line and the next line based on their asteric and then i have to decide what to put on the current line.</p>
<regex><awk><sed>
2019-04-13 19:23:37
LQ_CLOSE
55,669,573
Python regular expression to capture last word with missing line feed
<p>I need to capture words separated by tabs as illustrated in the image below.</p> <p><a href="https://i.stack.imgur.com/nv3Pg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nv3Pg.png" alt="enter image description here"></a></p> <p>The expression <code>(.*?)[\t|\n]</code> works well, except for the last line where a line feed is missing. Can anyone suggest a modification of the regular expression to also match the last word, i.e. Cheyenne? <a href="https://regex101.com/r/Z6KmDo/1" rel="nofollow noreferrer">Link to code example</a></p>
<python><regex>
2019-04-13 20:26:59
LQ_CLOSE
55,669,689
How can ignoring of return value be marked in Java code?
<p>There is C convention to mark that function is called for side effects only and in this particular invocation we are not interested in returning value:</p> <pre><code>(void) getSomethingAndDoAction(...); </code></pre> <p>Are there any equivalent in Java?</p>
<java>
2019-04-13 20:41:56
LQ_CLOSE
55,670,711
Error getting the selected value in Javascript
I am working on this project where I need to get the selected value from the user and and do a simple if - else. However, I'm not being able to get the value of the selected option from the user. **Please don't mark this as duplicate, I tried many resources before I came here. I want a solution not go read this documentation either.** ```javascript function getInsulinStrength() { let insulinSt = document.getElementById('insulinStrength'), selectedNode = insulinSt.options[insulinSt.selectedIndex]; if (selectedNode.value ==="Humalog"){ insulinStrengthTotal = 1800; } else { insulinStrengthTotal = 1500; } return insulinStrengthTotal; } ``` This value needs to be put in the function below: ```javascript function doTheMath(){ let carbIntake = getCurrentMeal(); let cbs = getCurrentBloodSugar(); let tbs = getTargetBloodSugar(); let br = getBasalRate(); let is = getInsulinStrength(); let dailyBasalRate = br * 24; let gramsPerInsulin = 450 / dailyBasalRate; let bolus = carbIntake / gramsPerInsulin; if (cbs > tbs){ let correctionFactor = is / dailyBasalRate; let correctionDose = (cbs - tbs) / correctionFactor; bolus += correctionDose; } return bolus; } ``` Everything else works minus the getInsulinStrength() function. Regardless of what the user chooses, it returns the same value. I ADDED THE HTML CODE ~ just to make give more insight. ```html <select id = "insulinStrength" name="insulinStrength" type="text" class="selectBtn" > <option value="">Select Insulin Type</option> <option value="Novolog">Novolog</option> <option value="Humalog">Humalog</option> <option value="Apidra">Apidra</option> <option value="Velosulin">Velosulin</option> </select> ``` The result is supposed to change when the user chooses Humalog. But the *results always stay the same for every single selected value*.
<javascript><html>
2019-04-13 23:24:41
LQ_EDIT
55,672,136
i am new in open cv. im trying to save the detected object into a new image.what will i do
import cv2 import numpy as np tric_cascade = cv2.CascadeClassifier('cascade.xml') img = cv2.imread('anthon18c.png') gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) tric = tric_cascade.detectMultiScale(gray,1.01,7) for (x,y,w,h) in tric: img = cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) cv2.imshow('img', img) cv2.waitKey(0) cv2.destroyAllWindows() this is the code I copied from a tutorial.
<python><opencv><cascade><drawrectangle>
2019-04-14 05:12:21
LQ_EDIT
55,672,529
I am getting a strange undefined reference to error for some of the methods in my ComplexNumber.cpp, I am very new to templates though
<p>Getting c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: main.o:main.cpp:(.text+0x2b): undefined reference to (<em>insert my methods in ComplexNumber.cpp</em>) when compiling using a makefile after the G++ main.o ComplexNumber.o -o output is being ran.</p> <p>I have tried checking online for places I may have missed a and used my other header files I have done in the past for reference to check for errors there, but I have had no luck. I am using cygdrive on windows to compile, but have also tried just using mingw on regular command prompt as well. </p> <p>Header File: '''''''''''''</p> <pre><code>#include &lt;stdio.h&gt; #ifndef COMPLEXNUMBER_H_ #define COMPLEXNUMBER_H_ template&lt;typename T&gt; class ComplexNumber { public: // a is a real number, b is a complex number T a; T b; ComplexNumber(); ComplexNumber(T, T); void toString(); ComplexNumber operator +(ComplexNumber&lt;T&gt;&amp; c); ComplexNumber operator *(ComplexNumber&lt;T&gt;&amp; c); bool operator ==(ComplexNumber&lt;T&gt;&amp; c); }; #endif /* COMPLEXNUMBER_H_ */ </code></pre> <p>''''''''''''''</p> <p>ComplexNumber.cpp ''''''''''''''</p> <pre><code>#include &lt;iostream&gt; #include &lt;stdlib.h&gt; #include &lt;ctime&gt; #include "ComplexNumber.h" using namespace std; template &lt;typename T&gt; ComplexNumber&lt;T&gt;::ComplexNumber() {} template &lt;typename T&gt; ComplexNumber&lt;T&gt;::ComplexNumber(T a, T b) { this-&gt;a = a; this-&gt;b = b; } template &lt;typename T&gt; ComplexNumber&lt;T&gt; ComplexNumber&lt;T&gt;:: operator +(ComplexNumber&amp; c) { ComplexNumber &lt;T&gt; temp; // adds the complex numbers, (a+bi) + (c+di) = (a+b) + i(c+d) temp.a = this-&gt;a + c.a; temp.b = this-&gt;b + c.b; return temp; } template &lt;typename T&gt; ComplexNumber&lt;T&gt; ComplexNumber&lt;T&gt;:: operator *(ComplexNumber&amp; c) { ComplexNumber&lt;T&gt; temp; // multiplies complex numbers, (a+bi) + (c+di) = (a*c-b*d) + i(a*d + b*c) temp.a = (this-&gt;a * c.a) - (temp.b * c.b); temp.b = (temp.a * c.b) + (temp.b * c.a); return temp; } template &lt;typename T&gt; bool ComplexNumber&lt;T&gt;:: operator ==(ComplexNumber&lt;T&gt;&amp; c) { ComplexNumber&lt;T&gt; temp; // compares complex numbers to see if they're equal, (a+bi) == (c+di) -&gt; if (a==c) &amp; (b==d) if (temp.a == c.a &amp;&amp; temp.b == c.b) { cout&lt;&lt; "The complex numbers are equal."&lt;&lt;endl; return true; } return false; } template &lt;typename T&gt; void ComplexNumber&lt;T&gt;::toString() { cout&lt;&lt; "("&lt;&lt; this-&gt;a&lt;&lt; " + "&lt;&lt; this-&gt;b&lt;&lt; "i)"&lt;&lt;endl; } </code></pre> <p>MakeFile: ''''''''''''''</p> <pre><code>all: ComplexNumber ComplexNumber: main.o ComplexNumber.o g++ main.o ComplexNumber.o -o output main.o: main.cpp g++ -c main.cpp ComplexNumber.o: ComplexNumber.cpp g++ -c ComplexNumber.cpp clean: rm *.o output </code></pre> <p>''''''''''''''</p>
<c++><templates><header-files>
2019-04-14 06:24:12
LQ_CLOSE
55,673,868
I dont understand how to write functions recursively
So I need to call one function recursively in another function. I have some array, and first 2 parameters in function are pointers on beggining of array and behind the end of array. Third parameter is function which I need to call recursively, and 4th parameter is parameter with default value, and I named it a_0; Suppose that array has elements: a_1, a_2, a_3, ... , a_n. My function Result need to calculate this: f(...f(f(f(a_0,a_1),a_2),a_3),...,a_n) This is task for practice, for exam, and I dont understand really principle of recursion(I understand for Factoriel) but I dont understand this example. int Result(int *p, int *q,int (*f)(int, int), int a_0=0) { ...... }
<c++><recursion>
2019-04-14 09:39:41
LQ_EDIT
55,673,886
What is the difference between C.UTF-8 and en_US.UTF-8 locales?
<p>I'm migrating a python application from an ubuntu server with locale en_US.UTF-8 to a new debian server which comes with C.UTF-8 already set by default. I'm trying to understand if there would be any impact but couldn't find good resources on the internet to understand the difference between both. </p>
<python><linux><docker><debian><locale>
2019-04-14 09:42:24
HQ
55,674,176
django can't find new sqlite version? (SQLite 3.8.3 or later is required (found 3.7.17))
<p>I've cloned a django project to a Centos 7 vps and I'm trying to run it now, but I get this error when trying to <code>migrate</code>:</p> <pre><code>$ python manage.py migrate django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17). </code></pre> <p>When I checked the version for sqlite, it was 3.7.17, so I downloaded the newest version from sqlite website and replaced it with the old one, and now when I version it, it gives:</p> <pre><code>$ sqlite3 --version 3.27.2 2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7 </code></pre> <p>Still when I try to migrate the project, I get the exact same message as before which means the newer version is not found. I'm new to linux and would appreciate any help.</p>
<python><django><sqlite><centos7>
2019-04-14 10:20:18
HQ
55,674,572
How to save the xml file in the directory I want (android studio)
<p>There is some filled document <code>xml Document doc = builder.newDocument ();</code> which I want to save to the <code>assets</code> folder of my application, how can I do this? I climbed to the Internet, but I could not find information, I was probably looking bad (</p>
<java><android><xml><save>
2019-04-14 11:05:13
LQ_CLOSE
55,677,240
What all can you do with match in Javascript?
<p>I'm not sure what the code below means. I know how to use match, but I'm not sure on what the brackets and "^" signs mean. Is there a website to where I can understand what all you can do with match?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var imagesURL; imagesURL = html.match(/CapImg[^"']*/g);</code></pre> </div> </div> </p>
<javascript>
2019-04-14 15:57:02
LQ_CLOSE
55,679,314
cant understand what is wrong with my code
<p>Write a function name " month_days" that receive a parameter(m) which represent a number between 1-12 (months of the year). The function returns how many days in that month[in January(1)there are 31 days'and so on).If the number is not between 1-12 the function will return -1 </p> <pre><code>def month_days(m): if m = 1: return 31 elif m = 2: return 28 elif m = 3: return 31 elif m = 4: return 30 elif m = 5: return 31 elif m = 6: return 30 elif m = 7: return 31 elif m = 8: return 31 elif m = 9: return 30 elif m = 10: return 31 elif m = 11: return 30 elif m = 12: return 31 </code></pre> <p>The IDE shows that there is something wrong with the code and i cant understand whats wrong</p>
<python><python-3.x>
2019-04-14 19:39:39
LQ_CLOSE
55,679,439
How to use explode method in php
I changed the split() function( deprecated) with explode() and still got error.Any help? function createTimestamp($time) { list($day, $month, $year, $hour, $minute) = explode(':', $time); // error is here return mktime($hour, $minute, -1, $month, $day, $year) + 1492640000000; }
<php>
2019-04-14 19:53:37
LQ_EDIT
55,680,121
How to represent mapping between two trees in Haskell?
<p>I'm trying to implement a tree-processing algorithm in Haskell, and (due to the fact this is my first Haskell program!), am struggling with the design of the data structures. Can any of the FP gurus out there lend a hand?</p> <p>I'll start by describing the important characteristics of the algorithm, sketch out how I would approach this using an imperative language, and finish with the stumbling baby-steps I have made so far in Haskell.</p> <h1>The problem</h1> <p>I won't describe the full algorithm in detail, but the salient points are as follows:</p> <ul> <li>The algorithm operates on two rose trees, X and Y.</li> <li>The first phase of the algorithm computes some derived properties for each node, based on its label and attributes, and those of its descendants.</li> <li>These derived properties are used to compute a partial mapping between the two trees, such that a node in X may be associated with a node in Y and vice versa. Because the mapping is partial, any node in X or Y may either be mapped (i.e. have a partner the other tree), or alternatively may be unmapped.</li> <li>The final phase of the algorithm optimises these mappings, via a sequence of operations which inspect parent / children / siblings of mapped nodes.</li> </ul> <p>The data structures must therefore have the following characteristics:</p> <ul> <li>Given a reference to a node, provide access the parent of that node, siblings of that node, and children of that node.</li> <li>Given a node in an input tree, permit <em>annotation</em> of that node with additional information (derived properties, and an optional reference to a node in the other tree).</li> </ul> <h1>Sketch of an imperative solution</h1> <p>If I was to implement this algorithm using an imperative language, the solution would look something like the following.</p> <p>Let's assume that the starting point is the following definition of the input tree:</p> <pre><code>struct node { // Identifier for this node, unique within the containing tree size_t id; // Label of this node enum label label; // Attributes of this node // An attribute can be assumed to be a key-value pair // Details of the attributes themselves aren't material to this // discussion, so the "attribute" type is left opaque struct attribute **attributes; size_t n_attributes; // Pointer to parent of this node // NULL iff this node is root struct node *parent; // Pointer to first child of this node // NULL iff this node is leaf struct node *child; // Double-linked list of siblings of this node struct node *prev; struct node *next; }; </code></pre> <p>The pointers embedded in each node clearly support the up / down / left / right traversals required by the algorithm.</p> <p>Annotation can be implemented by defining the following structure:</p> <pre><code>struct algo_node { // Pointer to input node which has been wrapped struct node *node; // Derived properties computed by first phase of the algorithm // Details of the properties themselves aren't material to this // discussion, so the "derived" type is left opaque struct derived props; // Pointer to corresponding node in the other tree // NULL iff this node is unmatched struct node *match; }; </code></pre> <p>The first phase of the algorithm constructs an <code>algo_node</code> for each <code>node</code> in each of the input trees.</p> <p>Mapping from an <code>algo_node</code> to a <code>node</code> is trivial: follow the embedded <code>*node</code> pointer. Mapping in the other direction can be supported by storing <code>algo_node</code>s in an array, indexed by the <code>id</code> of the input node.</p> <p>This is of course just one possible implementation. Many variations are possible, including</p> <ul> <li>Abstracting the children linked list behind a <code>list</code> or <code>queue</code> interface, rather than storing three raw pointers</li> <li>Instead of associating the input tree with the algorithm tree via indices, encode parent / child / sibling relationships directly in <code>struct algo_node</code></li> </ul> <h1>Moving to Haskell</h1> <p>Let's start with the following definition of the input tree:</p> <pre><code>data Tree = Leaf Label Attributes | Node Label Attributes [Tree] </code></pre> <p>Augmentation of each node with an id can be achieved as follows:</p> <pre><code>data AnnotatedTree = Tree Int addIndex :: Int -&gt; AnnotatedTree -&gt; (AnnotatedTree, Int) indexedTree = addIndex 0 tree </code></pre> <p>Similarly, we can write a function which computes derived properties:</p> <pre><code>data AnnotatedTree = Tree DerivedProperties computeDerived :: DerivedProperties -&gt; AnnotatedTree -&gt; (AnnotatedTree, DerivedProperties) derivedTree = computeDerived DefaultDerived tree </code></pre> <p>The above snippets can be adjusted with little work, such that <code>AnnotatedTree</code> contains both the index and the derived properties.</p> <p>However, I don't know where to begin with representing mappings between the two trees. Based on some reading, I have some half-baked ideas ...</p> <ul> <li>Define <code>AnnotatedTree</code> to contain a path from the root of the other tree to the mapped node - encoded as a list of indices into each successive children list, <code>[Integer]</code> <ul> <li>Use a zipper (of which I currently have a fairly loose understanding) to access the mapped node (or its parent / children / siblings) via the path</li> <li>Or perhaps use a lens (... of which I have an even less clear understanding!) to do the same</li> </ul></li> <li>Define <code>AnnotatedTree</code> to contain a reference to the mapped node directly, as a <code>Maybe Tree</code> <ul> <li>But then I don't see a way to walk to parent / siblings of the mapped node</li> </ul></li> </ul> <p>... but I could really do with some guidance on which (if any) of these are worth pursuing.</p> <p>Any help would be much appreciated!</p>
<algorithm><haskell><tree><mapping><abstract-syntax-tree>
2019-04-14 21:18:55
HQ
55,681,358
BrowserslistError: Unknown browser kaios
<p>I have updated my project to use the last versions of node and yarn, after this upgrade now my react project doesn't want to work with "browserslist". </p> <p>I run "yarn start" and get this error:</p> <pre><code>./src/assets/css/material-dashboard-react.css?v=1.2.0 (./node_modules/css-loader??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??postcss!./src/assets/css/material-dashboard-react.css?v=1.2.0) BrowserslistError: Unknown browser kaios at Array.reduce (&lt;anonymous&gt;) at Array.some (&lt;anonymous&gt;) at Array.filter (&lt;anonymous&gt;) at new Promise (&lt;anonymous&gt;) </code></pre> <p>I have the following versions:</p> <ul> <li>node v10.15.3</li> <li>npm 6.9.0</li> <li>yarn v1.15.2</li> </ul> <p>And my package.json its</p> <pre><code>{ "name": "frontend", "version": "0.1.0", "private": true, "dependencies": { "@material-ui/core": "3.9.3", "@material-ui/icons": "3.0.2", "axios": "0.18.0", "classnames": "2.2.6", "html2canvas": "^1.0.0-alpha.12", "immutable": "3.8.2", "jspdf": "^1.4.1", "jspdf-autotable": "^2.3.5", "moment": "2.22.2", "npm-run-all": "4.1.5", "perfect-scrollbar": "1.4.0", "plotly.js": "1.47.1", "react": "^16.6.3", "react-currency-format": "1.0.0", "react-dates": "18.2.2", "react-dom": "^16.6.3", "react-excel-workbook": "0.0.4", "react-google-maps": "9.4.5", "react-plotly.js": "2.3.0", "react-redux": "6.0.0", "react-router": "4.3.1", "react-router-dom": "4.3.1", "react-scripts": "2.1.8", "react-select": "2.1.2", "react-swipeable-views": "0.13.1", "redux": "4.0.1", "redux-immutable": "4.0.0", "redux-persist": "5.10.0", "redux-thunk": "2.3.0", "weather-icons": "^1.3.2" }, "scripts": { "start": "react-scripts --max-old-space-size=8192 start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" }, "browserslist": [ "&gt;1%", "not dead", "not ie &lt;= 11", "not op_mini all" ] } </code></pre> <p>For me the issue it's related to css-loader, I try solving the issue and add css-loader@2.1.1 to the package.json. I try with other solution but no ones work.</p>
<javascript><reactjs><react-scripts>
2019-04-15 00:47:56
HQ
55,681,705
How to remove duplicate categories from dataframe
I am trying to calculate the total number of companies associated with each active investor. 'df' represents my original dataframe, in which the 'active_investors' column displays a list of active investors for each company listed. For example, one row might contain Company A, listing investors 1,2,3,4. What I am trying to do is split the dataframe such that it displays company A as four separate rows i.e. for each investor 1, 2, 3 and 4. So far, I have the following code: ``` #Separate names of investors for each company df1 = df %>% separate_rows(active_investors, sep = ",") #Total number of companies each investor has invested in investor = aggregate(data.frame(count = df1$company_name), list(active_investors = df1$active_investors), length) ``` The problem is that some investors are listed twice i.e. the same investor name, but are listed as two separate investors. I am unsure how to compile the frequencies (i.e. total companies the investor has invested in) such that these duplicates are removed.
<r><dataframe><dplyr><tidyr>
2019-04-15 01:51:34
LQ_EDIT
55,682,713
Mocking an API response type
<p>I have function which accepts an Oracle Jolt ServletResult. I'm looking to unit test this function to verify that it correctly uses the data that it's been passed. ServletResult has a protected Constructor and the objects seem to be created internally in Jolt by a Factory. </p> <p>I've tried Mocking the ServletResult, but that almost requires re-implementing it. The other option I was thinking about was using reflection to create the object. It seems though that Spring ReflectionTestUtils doesn't seem to handle constructors. </p> <p>What is the best way to deal with this sort of thing? Should such tests just be left to integration testing rather than unit testing? </p>
<java><reflection><junit>
2019-04-15 04:45:31
LQ_CLOSE
55,682,814
Swift Xcode 10.1 - Tip Calculator Crashed Immediately
So I'm pretty new to Swift. I'm building a tip calculator in Swift and I found a tutorial online and modified it. It was a Swift 3 tutorial however, so I don't know how well it translates to Swift 10, but it was working until I tried added a feature that would allow me to split the bill. Now the whole app just gives me a white screen and no runtime errors. I've tried to implement the splitting the bill feature two ways including using a switch case (currently in the code), and asking the user to input a number and neither way seemed to work. import UIKit class ViewController: UIViewController { @IBOutlet weak var billAmountField: UITextField! @IBOutlet weak var tipSelector: UISegmentedControl! @IBOutlet weak var userTipAmountField: UITextField! @IBOutlet weak var tipAmountField: UITextField! @IBOutlet weak var totalAmountField: UITextField! @IBOutlet weak var userSplitSelector: UISegmentedControl! @IBOutlet weak var totalSplitAmount: UITextField! @IBOutlet weak var numSplitLabel: UILabel! @IBAction func calculateTip(_ sender: AnyObject) { if let billAmount = Double(billAmountField.text!) { var tipPercentage = 0.0 var split = 1.0 switch tipSelector.selectedSegmentIndex { case 0: tipPercentage = 0.15 case 1: tipPercentage = 0.18 case 2: tipPercentage = 0.20 case 3: userTipAmountField.isUserInteractionEnabled = true if let userTipAmount = Double(userTipAmountField.text!){ tipPercentage = userTipAmount / 100 } default: break } switch userSplitSelector.selectedSegmentIndex { case 0: if split >= 2 { split -= 1 } let splitString = String(split) numSplitLabel.text = splitString case 1: split += 1 let splitString = String(split) numSplitLabel.text = splitString default: break } let roundedBillAmount = round(100 * billAmount) / 100 let tipAmount = roundedBillAmount * tipPercentage let roundedTipAmount = round(100*tipAmount)/100 let totalAmount = roundedBillAmount + roundedTipAmount let totalSplitAmt = totalAmount / split if (!billAmountField.isEditing) { billAmountField.text = String(format: "%.2f", roundedBillAmount) } tipAmountField.text = String(format: "%.2f", roundedTipAmount) totalAmountField.text = String(format: "%.2f", totalAmount) totalSplitAmount.text = String(format: "%.2f", totalSplitAmt) } else { //show error billAmountField.text = "" tipAmountField.text = "" totalAmountField.text = "" totalSplitAmount.text = "" } } override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } } I'm doing this project in a Virtual Machine if that matters. [Here is my Storyboard][1] [1]: https://i.stack.imgur.com/eKJXl.png Any suggestions on a fix would be much appreciated!
<ios><swift><calculator>
2019-04-15 04:59:05
LQ_EDIT
55,683,009
Invalid Syntax on .findall (text) highlighting just the ( or random letter?
<p>When attempting to run this I get an 'Invalid Syntax' error and it will highlight either the ( 't' or the space in line </p> <p>extractedPhone = phoneRegex.findall (text)</p> <p>Any reasons why? Double checked all other () to ensure everything was opened and closed, renamed text to sample, not sure what is going on! </p> <p>The goal of this is to search for phone numbers and emails from PDF just by copying the file and then running this.</p> <p>Thank you</p> <pre><code>#! Python3 import re import pyperclip #create a regex for phone numbers phoneRegex = re.compile(r''' ((\d\d\d)|(\(\d\d\d\)))? #area code optional (\s | -) #first seperator \d\d\d #three digits (\s | -) #second seperator \d\d\d\d #last four digits (((ext(\.)?\s)|x) #ext. 12345 (\d{2,5))? #ext optional number ''', re.VERBOSE) #create a regex for email addresses emailRegex = re.compile('''( [A-Za-z0-9-_+.]+ #name part (AZaz+_-.) @ #@ [A-Za-z0-9-_+.]+ #domain )''' re.VERBOSE) #get text off the clipboard text = pyperclip.paste() #extract the email / phone from this text extractedPhone = phoneRegex.findall (text) #here is the issue line extractedEmail = emailRegex.findall (text) allPhoneNumber = [] for numbers in extractedPhone: allPhoneNumbers.append(phoneNumber[0]) print (extractedPhone) print (extractedEmail) </code></pre>
<python>
2019-04-15 05:24:15
LQ_CLOSE
55,683,871
want to find specific string from given text using regex
<p>I want specific string from below text using regex.</p> <pre><code>str = 'Supervision68 - Outdoor Supervision In Compliance922 KAR 2:100 - Section 10(15) Each child' </code></pre> <p>Specific string : '68 - Outdoor Supervision In Compliance'</p> <p>I have tried an get below result:</p> <pre><code>re.findall('\d+(.*?)922', str) </code></pre> <p>result: ' - Outdoor Supervision In Compliance'</p>
<python><regex>
2019-04-15 06:53:00
LQ_CLOSE