_id
stringlengths
2
6
partition
stringclasses
3 values
text
stringlengths
4
46k
language
stringclasses
1 value
title
stringclasses
1 value
d6601
train
You can just try using string.find. But it seems like your problem is that link.get("href") returned None. Your link probably has no "href". A: I had to guess a little bit what exactly your context was. But this might help you. You can check if something is None by "if var is None:" and continuing the loop. But my re...
unknown
d6602
train
You are visiting the URL /products// so there is no value for the parameter productslug in the URL. That means your Product query fails: product = Product.objects.get(slug=productslug) because it has no (correct) value for productslug. To fix it, change your URL pattern to: (r'^products/(?P<productslug>.+)/$', 'zakai....
unknown
d6603
train
You can do what you describe in the examples with the match specification instead of host. It's another way to specify a host, or a set of hosts. For example: Match user u* host t* Hostname %hest.dev User %r This will match against a user pattern and a target host pattern. The command line will then be something l...
unknown
d6604
train
"-p" in this context is part of the regexp. The regexp is looking for a match to any of the following patterns: -p 123 -p123 -p -123 -p-123 The " " and the second "-" are optional. A: BASH will treat everything after =~ operator as regex so BASH will try to match against this regex: -p' '+-?[0-9]+
unknown
d6605
train
I found this old helper class of mine. Maybe you can make use of it. public static class GlyphRunText { public static GlyphRun Create( string text, Typeface typeface, double emSize, Point baselineOrigin) { GlyphTypeface glyphTypeface; if (!typeface.TryGetGlyphTypeface(out glyphTypeface)...
unknown
d6606
train
it (likely) means that your app has executed different from usual, and exposed a bug in your ref counting of the object. this type of issue can also be related to improper multithreading. executing your app to trigger the problem with zombies enabled should help you locate it. A: If you don't initialize a normal local...
unknown
d6607
train
The C-style escape for the backspace character is \b which is also the Regex escape for a word boundary. Fortunately you can put it in a character class to change the meaning: e.Handled = Regex.IsMatch(e.Text, "[0-9\b]+");
unknown
d6608
train
Your double-loop algorithm is somewhat slow, of order O(n**2) where n is the number of dimensions of the vector. Here is a quick way to find the closeness of the vector elements, which can be done in order O(n), just one pass through the elements. Find the maximum and the minimum of the vector elements. Just use two va...
unknown
d6609
train
If you use sqflite or shared_preferences simply remove all data in the main() function with clear all keys or clear the database. Then you need to write a function that will execute this part of the code once. So basically that's all. import 'package:shared_preferences/shared_preferences.dart'; void main(List<String> ...
unknown
d6610
train
Because you have defined button by id not by class <button id="general">General</button> So change let general = document.querySelector(".general"); to let general = document.querySelector("#general"); document.addEventListener('DOMContentLoaded', function(){ let general = document.querySelector("#general"); ...
unknown
d6611
train
With your current setup you actually have two binaries compiled from the same source file: cli and raytracing. raytracing doesn't declare any [dependencies] so of course you're getting an error when trying to compile that. You haven't explained what you're trying to achieve, so I can't tell you the correct way to fix t...
unknown
d6612
train
A couple of problems with your code: * *You do not have a width and height specified on your html and body, without which any of descendent elements wouldn't have a reference to set their positions and/or dimensions in percent units. *You do not have dimensions (width/height) specified on your #div_parent, without ...
unknown
d6613
train
This is due to the use floating point numbers. Floating point numbers involve a binary representation, in which some numbers that can be exactly represented in decimal notation easily are not stored exactly. For example, 0.6 in decimal is (approximately) 0.111111000110011001100110011010 in binary. When converted back t...
unknown
d6614
train
As an example, let's start with 32-bit float array: orig = np.arange(5, dtype=np.float32) We'll convert this to a buffer of bytes: data = orig.tobytes() This is shown as: b'\x00\x00\x00\x00\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@' Note the initial "b", which indicates this is a bytes object, not a string. I...
unknown
d6615
train
rack-ssl-enforcer gem will help you
unknown
d6616
train
It turned out that the delay was due to a combination of: * *poor container's file system behaviour because bind-mount'ed to the local machine's one (Linux container on Windows machine) *project consisting of a large number of (small, actually) source files (~10,000) *git information displayed on the prompt To sol...
unknown
d6617
train
try this [otherNav.view insertSubview:shadowImageView belowSubview:animatedActionView]; because the first parameter must be an View or a subclass of uiview in your case you try to pass an UIImage who itsn't an UIView or subclass of UIview
unknown
d6618
train
You don't need slim. Just irb the code: name = (defined?(name) ? name : 'tags') p name #=> nil It does not work, because you implicitly define name on the left side of the statement name = .... So when Ruby interpreter evaluates defined?(name) it gives truly result. I think you already get the answer: unless defined?(...
unknown
d6619
train
Without having the recaptcha code, you can style it with this CSS: #recaptcha_response_field { background: #fff !important; } OR you can use: input[type=text] { background-color: #fff !important; } A: https://developers.google.com/recaptcha/docs/display#render_param there is a light dark setting
unknown
d6620
train
@MathAng, It looks like the height of your A and LI aren't matching the same height, the default height of the LI tag is 26 pixels in height. But at your CSS you're saying that it must be 10 pixels for the A tag. What I prefer is or use: .scrollable-menu-brands li a { padding-top: 0px; } instead of: .scrollable-me...
unknown
d6621
train
You can use $(document).ready(); $(document).ready(function() { setTimeout(function() { your_func(); }, 1000); }); A: You may use $( document ).ready(); for that problem: $( document ).ready(function() { setTimeout(function() { console.log( "ready!" ); }, 1000); }); A: Your solution works well, don't need to...
unknown
d6622
train
Maybe this will help. You can use initialCommands key in sbt to do this So in build.sbt if you put initialCommands in console := """import my.project._ val myObj = MyObject("Hello", "World") """ after you type 'console', you can start using myObj or the classes in my.project http://www.scala-sbt.org/0.13.5/docs/Ho...
unknown
d6623
train
Problem You are missing how to pass the argument to mysqli_fetch_array(). Solution Therefore, this line: if(mysqli_query($cons, $result)) { should be if($res = mysqli_query($cons, $result)) { // assign the return value of mysqli_query to $res (FWIW, I'd go with $res = mysqli_query($cons, $result); then do if($res) {....
unknown
d6624
train
decodeURIComponent is the key: decodeURIComponent('VehicleId%20eq%20%272415%27&'); // "VehicleId eq '2415'&" That's definitely not a proper ID (not to mention you're trying to do $filter=VehicleId=2135, of course that will break the query string, find a way to encode that value). You should probably make those IDs a ...
unknown
d6625
train
I don't have the exact sql, but you will need to query the systables and syscolumns tables, which have all of the information you need to create the data dictionary. A: I would use the "information schema" views. Here are 2 of the most useful views: SELECT * FROM INFORMATION_SCHEMA.Tables SELECT * FROM INFORMATION_SC...
unknown
d6626
train
Let's remember however that having ssh support in a container is typically an anti-pattern (unless it's your container only 'concern' but then what would be the point of being able to ssh in. Refer to http://techblog.constantcontact.com/devops/a-tale-of-three-docker-anti-patterns/ for information about that anti-patter...
unknown
d6627
train
Your Controller catches and redirects to the same url: @RequestMapping(value="/login", method=RequestMethod.GET) public String loadForm(Model model) { model.addAttribute("user", new User()); return "redirect:/login"; } Also, your SecurityConfig defines this: @Configuration @EnableWebSecurity p...
unknown
d6628
train
EnumPrinters to get the list of printers, EnumJobs to get a list of jobs for that printer. GetJob to get info on a specific job and SetJob to change the settings for that job (pause or cancel it). See more in the Printing and Print Spooler References. .NET has the PrintQueue and PrintServer classes. A: Following URLs...
unknown
d6629
train
Filter the data in list before passing to Adapter ArrayList<Dbbean> list = yourlist; Create a filtered list ArrayList<Dbbean> filteredList = new ArrayList<>(); for(Dbbean dbean : list){ if(dbean.blename.startsWith("Dev") filteredList.add(dbean); } Pass filtered list to Adapter EvelistAdapter adapter ...
unknown
d6630
train
You fetch the exact date, it seems like you want to fetch the week: SELECT COUNT(distinct ip ) AS uni, ( date_added ) AS wday, WEEK( FROM_UNIXTIME( date_added ) ) AS cusotms A: Here is the solution: SELECT COUNT( DISTINCT ip ) AS uni, ( date_added ) AS wday, FROM_UNIXTIME( date_added ) AS cusotms FROM `s...
unknown
d6631
train
You can put this code in separate method (https://refactoring.com/catalog/extractFunction.html) and write it like this: public void DoSomeStuff() { if((example_A >= 0) && (condition_A)) return; if((example_B >= )) && (condition_B)) { doSomething(); return; } doAnything(); } A: If I unders...
unknown
d6632
train
There is an issue discussed in the repository, which hints at a possible problem cause. A broken connection error may be fixed with hard-refreshing the page. Modifying the templates and the content pages reloads after that. Check the browser console to see what the actual issue is. Some actions require manual restart. ...
unknown
d6633
train
There are two ways you could do this really. One is through code and the other is through the administrators panel. I'm assuming based on the question you are interested in the back end solution. This involves creating two unique menu items with the same name (alias' would need to be different). One which is only ...
unknown
d6634
train
I am not sure about the EventBridge filter for the purpose but found a very easy technique from the link below: https://aws.amazon.com/premiumsupport/knowledge-center/eventbridge-create-custom-event-pattern/ So basically you have to let the event you are targeting to be in your cloudtrail or get teh email notifications...
unknown
d6635
train
You can use crosstab to get the dummies, then matrix product to see cooccurrences: s = pd.crosstab(df['ID'],df['VALUE']) pair_intersection = s.T @ s all_three = s.ne(0).all(1) Then, pair_intersection looks like: VALUE Today Tomorrow Yesterday VALUE Today 3 2 ...
unknown
d6636
train
I was able to solve a similar problem. I installed pdftotext with a brew cask. The installation was done with the following command $ brew cask install pdftotext $ pdftotext -v pdftotext version 3.03 Copyright 1996-2011 Glyph & Cog, LLC and place the xpdfrc/language support packages in the following directory I did. l...
unknown
d6637
train
I don't see anyway to avoid the use of node but you can improve the information returned by it by * *compiling the OCaml with the debug info (add -g option to ocamlc) *add the options --debuginfo --sourcemap --pretty to the invocation of js_of_ocaml In your example, you'd have to do ocamlfind ocamlc -g -package js_...
unknown
d6638
train
Heroku's Logplex contains all logging statements from your application - there is no filtering of any kind. By default, Rails does not log SQL statements in production so you'll need to bump your log level in production.rb to a level that is more suitable. http://guides.rubyonrails.org/debugging_rails_applications.html...
unknown
d6639
train
You can pass argument --runner SparkRunner to the pipeline launcher to use spark as the underlying runner. Also, Please share what language of Beam SDK you are using. Python and java have some what different ways to run on Spark via Beam.
unknown
d6640
train
Join the tables SELECT b.*, s.services FROM service_booking AS b JOIN services AS s ON s.service_id = b.service_id
unknown
d6641
train
Select 'Plugins'->'Language Server'->'Settings' and uncheck the box that says 'Display Diagnostics' at the bottom of the page then click OK.
unknown
d6642
train
FYI, here's what Microsoft had to say about it: "It’s not really a bug. Script blocks are valid attribute arguments – e.g. ValidateScriptBlock wouldn’t work very well otherwise. Attribute arguments are always converted to the parameter type. In the case of Mandatory – it takes a bool, and any time you convert ...
unknown
d6643
train
I assume you are using the Workbooks.OpenText method to open the file, i.e. something like: Workbooks.OpenText Filename:="C:\Temp\myFile.txt", _ Origin:=xlWindows, _ StartRow:=1, _ DataType:=xlFixedWidth, _ FieldInfo:=Array(Array(0, 1), Array(6...
unknown
d6644
train
You need to register Data observer to listen to data changes from sync adapter. mRecyclerViewAdapter.registerAdapterDataObserver(myObserver); RecyclerView.AdapterDataObserver are a result of which notify methods you call. So for instance if you call notifyItemInserted() after you add an item to your adapter then onItem...
unknown
d6645
train
I tried your code, and it worked well without 'a+' option when open the text file. Your code shows nothing because you opened file as a 'wrting' mode. You should give the option as 'r' or 'r+' or just leave it as default. 'r' : open for reading (default) 'a' : open for writing, appending to the end of the file if it e...
unknown
d6646
train
It seems you're using python 2 so I'm using this old python 2 super() syntax where you have to specify the class and the instance, although it would work in python 3 as well. In python 3 you could also use the shorter super() form without parameters. For multiple inheritance to work is important that the grandparent cl...
unknown
d6647
train
It is fine to access $scope in that function. .controller("myCtryl", function($scope, $http) { $scope.functionA = function(){ $scope.data = "some data"; } $scope.functionB = function(){ $scope.data //this id valid } } A: You can just access $scope.data in functionB the same way you access it in fu...
unknown
d6648
train
Prior to PHP 5.5, empty() function can only support strings. Any other input provided to it like: a function call e.g. if (empty(myfunction()) { // ... } would result parse error. As per documentation: Note: Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error. In other wor...
unknown
d6649
train
By Jquery you can do this way $.ajax({ url: 'http://jendela.data.kemdikbud.go.id/api/index.php/ccarisanggar/searchGet', type: 'GET', success: function (responce) { // code to append into your table }, error: function (jqXHR, textStatus, errorThrown) { } }); A: I can't show you the whol...
unknown
d6650
train
You need to cancel the setTimeout() if the arrows are clicked before it fires so you don't get multiple timers going at once (which will certainly exhibit weirdness). I don't follow exactly what you're trying to do on the arrows, but this code should manage the timers: var intervalId = setInterval(switchLeft, 4000); ...
unknown
d6651
train
This exception is the result of class identity crisis . You cannot cast between class loaders. As mentioned this site: Other types of confusion are also possible when using multiple class loaders. Figure 2 shows an example of a class identity crisis that results when an interface and associated implementation are ...
unknown
d6652
train
I'm using the JsonSlurper it looks quite simple and OS independent: import groovy.json.JsonSlurper String url = "http://<SONAR_URL>/api/qualitygates/project_status?projectKey=first" def json = new JsonSlurper().parseText(url.toURL().text) print json['projectStatus']['status'] A: Can't you just do new URL( 'http://us...
unknown
d6653
train
use find() $(this).find('.delete-status-update-link').show(); A: You have issues with your code, (function extra ( before function and after ): $('.cycle-status-update') .on('mouseenter', (function(){ $(this).closest('.delete-status-update-link').show(); }))//<----here .on('mouseleave', (function(){ //<--be...
unknown
d6654
train
As mention above in the comment html code: <form> <select name="s1"> <option value="1"> <option selected value="2"> </select> <select name="s2"> <option selected value="1"> <option value="2"> </select> <select name="s3"> <option value="1"> <option selecte...
unknown
d6655
train
In HTML5, there is the Window.sessionStorage attribute that is able to store content against a specific session within a tab/window (other windows will have their own storage, even when running against the same session). There is also localStorage, and database Storage options available in the spec as well. A: HTML5 i...
unknown
d6656
train
The QProcess is allocated on the stack and will deleted as soon as it goes out of scope. This is likely to happen before the the "xterm" child process quits (hence the output). Try allocating the QProcess in the heap instead: QProcess * process = new QProcess(container); ... process->start(executable, arguments); You ...
unknown
d6657
train
This technique for feature selection is rather trivial so I don't believe it has a particular name beyond something intuitive like "low-frequency feature filtering", "k-occurrence feature filtering" "top k-occurrence feature selection" in the machine learning sense; and "term-frequency filtering" and "rare word removal...
unknown
d6658
train
No - its a new request every time - any attributes set in one request, will not be there when the next request comes in. If you want to set attributes that are persistent across requests, you can use: request.getServletContext().setAttribute("att","value");
unknown
d6659
train
I have used the Image Charts API in the past and implemented the builder pattern to generate my chart URL. Transparent backgrounds and coloured axis were used in our app with the method call providing transparency shown below; /** * Remove any background fill colours. The #chco parameter is used for {@link ChartType#B...
unknown
d6660
train
What you're seeing is the Visual Studio "IntelliSense" feature. You can find settings for it under the "Tools / Options" menu, but there are very few. You can choose what displays in the list, which key(s) selects the highlighted item, and how the first highlighted item is selected, but there's nothing available that w...
unknown
d6661
train
Yes, you can use the EditingControlShowing event to get a handle to the combobox. Then hook up an event handler for the SelectedIndexChanged or whatever event you want and code it..! DataGridViewComboBoxEditingControl cbec = null; private void dataGridView1_EditingControlShowing(object sender, ...
unknown
d6662
train
If the models are in your application, just don't register them in the first place. If the model is in a third party app like the django.contrib.auth then use AdminSite unregister method. You can put this in any admin.py or urls.py important is to be discovered by the admin.autodiscover. # admin.py from django.contrib....
unknown
d6663
train
select top 1 with ties FullName,Status,[Current Position] from yourtable order by row_number() over(partition by FullName order by case Status when 'Active' then 1 else 0 end) A: You can select DISTINCT FullName, ordering the table by FullName, Status. SELECT DISTINCT FullName, Status, [Current P...
unknown
d6664
train
You can try the following command: copy /y /b boot_sect.bin+kernel.bin os-image > nul The /y switch is to automatically overwrite the destination file in case it already exists and /b is for binary copy.
unknown
d6665
train
When a form is posted to a CFML server, the posted file is saved in a temporary directory before any of your code runs. All <cffile action="upload"> does is to copy a file from that temporary directory to the location you want it to be. Your remote server ServerB has no idea about any file posted on ServerA, so <cffile...
unknown
d6666
train
Just a sanity check: do you have admin rights when running the installer? A: To answer my own specific questions (rather than solve my problem as thankfully @p4-randall did): * *the p4rubynotes.txt manual says "The P4Ruby Windows installer requires Ruby 1.8." *P4Ruby is seemingly not installed anywhere! To clarif...
unknown
d6667
train
You can just basically "transpose" them with zip: with open('wordlist.txt','r') as f: wordlist= list(zip(*[i.splitlines() for i in f.read().split('_')])) If there are no underlines: with open('wordlist.txt','r') as f: wordlist= list(zip(*[f.readlines()[i:i+3] for i in range(0,len(f.readlines()),3)])) And do n...
unknown
d6668
train
Via Reflection, you can get an equivalent behavior to that one described in Java 8. You can create an instance of a Delegate with a null target and dynamically binding its first argument to the this method parameter. For your example you can create the toStr delegate in the following way: MethodInfo methodToStr = typeo...
unknown
d6669
train
Not quite. It's just a syntactic translation. For example, the compiler will translate this: var query = from item in source select item.Property; into var query = source.Select(item => item.Property); It does that without knowing anything about the Select method. It just does the translation, then tries ...
unknown
d6670
train
In My Case Working 100% Try This import CoreData func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell Identifier name ", for: indexPath) as! Cellname cell.YourButton...
unknown
d6671
train
as written in the exception, you need to add write permission for the web-server. First possible solution would be to set the owner or the group of the folder to www-data. Another solution would be to allow "others" to write in this folder. I would not recommend the second solution, because it could be less secure.
unknown
d6672
train
The problem was that ajaxContext doesn't have a get_response method. It must be an old version of the object whose example I was looking at. Since I wanted the status code, I just used the ajaxContext.status property.
unknown
d6673
train
UPDATE has no "implicit columns" syntax like INSERT does. You have to name all the columns that you want to change. One alternative you can use in MySQL is REPLACE: REPLACE INTO $dbtable VALUES (?, ?, ?, ?, ?, ...) That way you can pass the current value for your primary key, and change the values of other columns. Re...
unknown
d6674
train
The instances are actually providing that information themselves. You need to implement the description method, which is inherited from NSObject, for your custom classes in order for them to be able to print themselves as something other than a memory address (which is what NSObject's implementation does). I've no idea...
unknown
d6675
train
Updated Try to add following codes below your link_to codes, so it looks like: <%= link_to "#", "assets/blindlogo.jpg", :class=>"single_image" %> See http://fancybox.net/howto. This page says you need href in your link element.
unknown
d6676
train
function index(){ $res = $this->Grade->find('first', array( 'conditions' => array('id' => 2) )); $this->set('res', $res); } I highly suggest you go through the CakePHP Book's Tutorials & Examples. There are so many things wrong or strange with your code that I'm not going to even try to explain it ...
unknown
d6677
train
I suppose you tried the test option (lower case) of the Maven Surefire Plugin to invoke a specific test, which Surefire couldn't find in the first module of the reactor build and hence fails. I also suppose integration tests are executed by the Maven Failsafe Plugin. If not, they should, as mentioned by official docume...
unknown
d6678
train
Your function code performance will be slow. Because in your code update command will be executed on 2 times. It is possible to write this function very simply and with high performance. CREATE OR REPLACE PROCEDURE update_leaders_score(in_school_id integer, in_leader_score integer) LANGUAGE plpgsql AS $procedure$ begin...
unknown
d6679
train
There will be no effective difference if you have Option Infer On. If you have Option Infer Off then the first snippet will always result in a variable of type Thing while the second snippet will fail to compile with Option Strict On and result in a variable of type Object with Option Strict Off. The first code snippe...
unknown
d6680
train
PhantomJS is single process, just like node.js, and will never spawn something to process requests. Basically, everything is shared in the same instance (web pages, html ressources, ...) You can spawn custom process, using execFile/spawn modules.
unknown
d6681
train
You need to outside of GetDubPrime catch the ArgumentException that you throw inside it. If nothing catches the exception the program exits. Something like: (...) try { x = GetDubPrime(...); } catch(ArgumentException ex) { // bad data, do something Console.WriteLine(ex.Message); x = 0; // or whatever is nec...
unknown
d6682
train
Here is the default css: /* optional disabled input styling */ table.tablesorter thead tr.tablesorter-filter-row input.disabled { opacity: 0.5; filter: alpha(opacity=50); } As seen, a disabled class is applied to those disabled filters, so you can use css to either apply display:none or visibility:hidden t...
unknown
d6683
train
How did you add your ojdbc driver ? A typical way is shown below: First you need to right click your project and go for "Build Path" and go for "Configure build Path" Then , in the "libraries" tab, click on the "Add External JARs" go to your ojdbc driver file to load it. This is the typical way to load your ojdbc dr...
unknown
d6684
train
$k2 = preg_replace('/[^[:alnum:]]/', '', $k); simple and quick ;)
unknown
d6685
train
Submitted as a bug. Solved by adding to input group and by removing QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); flag.
unknown
d6686
train
A problem can be that you are "blowing up" you're autoencoder. You have an input of 13 and than map that to 200, 150, 100 and 13 again. There is no bottleneck in the network where it has to learn a compressed representation of the input. Maybe try 13 -> 6 -> 4 -> 6 -> 13 or something like that. Than it lears a compress...
unknown
d6687
train
Ruby's include doesn't access the file system. The given module must have already been defined or a NameError will be raised: # foo.rb class Foo include Bar # NameError: uninitialized constant Foo::Bar end This works (everything in one file): # foo.rb module Bar end class Foo include Bar end If your module is d...
unknown
d6688
train
I have tested different parts in relation to the filesystem but it's easier for you to confirm on the actual files to confirm it works on your data. EDIT to allow for inclusion of pathnames import sys import os import os.path import re import itertools #generator function to merge sound and word files def takeuntil(it...
unknown
d6689
train
As far as I know if you are running your application on Micromax device with version 4.2.1, you can face this java.lang.StringIndexOutOfBoundsException as it seems to be a manufacturer bug in that specific version for Micromax device. The same problem happened to me once when I had to play a video in splash screen and ...
unknown
d6690
train
TL;DR: Is it possible to run out of threads when using coroutines? Well, the answer is no (deadlocks are another issue). But, is it possible to use coroutines in a way which means that your concurrency is bound by your number of threads? Yes. I think the first thing you must understand is the difference between a block...
unknown
d6691
train
Those methods can't be mocked because they they are final methods created by spring-retry using a CGLIB proxy.
unknown
d6692
train
Did you try this? myActivity.setTitle(userInput); //Where userInput is new title given by user Hope this helps. A: You can simply call the setTitle() function from within your Activity. It takes either an int (resource ID) or a CharSequence as a parameter. or this.setTitle("New Title Here"); or change in manifest fi...
unknown
d6693
train
if (!Regex.IsMatch(value, @"^[0-9]{5}$")) _errors.Add("PostalCode", "Invalid Zip Code"); break; case Countries.Canada: if (!Regex.IsMatch(value, @"^([a-z][0-9][a-z]) ?([0-9][a-z][0-9])$", RegexOptions.IgnoreCase)) _e...
unknown
d6694
train
Decorators can't change the structure of the class they are decorating. This is a design limitation. There is a proposal to change this but it does not seem to be a priority (maybe upvote the GitHub issue if it's important to you) We could use a mapped type if we want to transform all methods, but we can't apply a map...
unknown
d6695
train
Simply use following code snippet : try { File myFile = new File("/mnt/sdcard/images/2.png"); MimeTypeMap mime = MimeTypeMap.getSingleton(); String ext=myFile.getName().substring(myFile.getName().lastIndexOf(".")+1); String type = mime.getMimeTypeFromExtension(ext); Intent sharingIntent = new Intent...
unknown
d6696
train
For structured ordering in a database, you'll want a column to store the ordering. An int is fine, but a decimal can make updates a little easier. Don't use the name "order" for the column, as it's a keyword, consider "display_order". You can create a self-referencing table. A "canonical" term has a null parent id, an ...
unknown
d6697
train
Build a Question Text to ID hash table function hashtable() { const ss = SpreadsheetApp.getActive(); const sh = ss.getSheetByName('Sheet0'); let texttoid = {}; sh.getDataRange().getDisplayValues().forEach(r => texttoid[r[1]]=r[0]); Logger.log(JSON.stringify(texttoid)); } Execution log 11:58:17 AM Notice Exe...
unknown
d6698
train
call your function this way: function fooBar(item ){ // .... // return truthy condition }; var result = arr.filter(fooBar); - Passing argument to the filter function: const fruits = ['apple', 'banana', 'grapes', 'mango', 'orange']; /** * Array filters items based on search criteria (query) */ const filter...
unknown
d6699
train
Richtextbox1.text = mid(Richtextbox1.text,1,len(richtextbox1.text)-x) & NewTotal Where x is the length of the previous total and NewTotal is the new total string. Edit (see comments): Use this code to solve your issue: dim numberofcolumns as integer = listview1.ColumnHeaders.Count dim str(numberofcolumns-1) as string...
unknown
d6700
train
This will print the lines in file2 that are not in file1: fgrep -F -x -v -f file1 file2 The -F means to treat the input as fixed strings rather than patterns, the -x means to match the whole line, the -v means to print lines that don't match rather than those that do match, and -f file1 uses file1 as a list of pattern...
unknown