input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Hangfire - Recurring job with specified queue name <p>I have two server, ServerA and ServerB. They share the same hangfire database.
I have two jobs, JobA and JobB.</p>
<p>On ServerA, I use:</p>
<pre><code>RecurringJob.AddOrUpdate(
"JobA",
() => new JobA().Execute(),
this._confi... | <p>Code was missing...</p>
<p>ServerA:</p>
<pre><code>var options = new BackgroundJobServerOptions
{
Queues = new[] { "A" }
};
this._backgroundJobServer = new BackgroundJobServer(options);
</code></pre>
<p>ServerB:</p>
<pre><code>var options = new BackgroundJobSe... |
Why is 'this' losing context in new Angular 1.5 components? <p>Got a very odd issue coming up here with the new components. When we had a 1.4 directive we had the following code...</p>
<pre><code>(function () {
'use strict';
angular.module('app.board').directive('dcCb', dcClipboardCopy);
function dcCb() {
re... | <p>You're handing a function, which is arbitrarily defined on a class, off to the window and event listeners to be executed in a different context than the instance of Clipboard:</p>
<pre><code>$element.on('$destroy', clipboard.destroy);
</code></pre>
<p>This is a fundamental concept of execution context in javascrip... |
How to store text that is to be displayed in an android application? <p>I know C and C++ and I am now trying to develop android applications. I learnt the basics and I am trying to create an educational android application, which gives some theory on the topic and allows users to take a objective test.</p>
<p>Now to d... | <p>Yes you should use database for this. You can store in one table question and in second answers. </p>
|
GDI+ generic error - cannot see why, everything looks fine <p>Im grabbing data from a database, an item image (base 64 string), and trying to display it on my page. This is what I've got:</p>
<pre><code>Dim data() As Byte = CType(dsData.Tables(0).Rows(0).Item("itemimage"), Byte())
Dim stre As New MemoryStream(data, 0,... | <p>I'm assuming your database data is <code>varbinary</code>, not a Base64 image stored as a string. If that's the case you can directly convert a Byte Array to a base64 image.</p>
<pre><code>Dim data() As Byte = CType(dsData.Tables(0).Rows(0).Item("itemimage"), Byte())
imgItem.ImageUrl = "data:image/jpeg;base64," + C... |
Which renderer will be called if we have multiple renderer for same control? <p>I am working on a Xamarin Forms app where I am struck with 2 issues</p>
<p><strong>First:</strong>
I have my custom button renderer and it is working fine. Now I have included reference of another project which have it's own button render.... | <p>For your second question, always create a new class that inherit XF's control, so that the control and renderer would be one-one relationship.</p>
<pre><code>[assembly: ExportRenderer(typeof(Button), typeof(MyApp.Renderers.CustomButtonRenderer))] //bad
[assembly: ExportRenderer(typeof(CutomButton), typeof(MyApp.Re... |
Ui-select ng-model is not binded with selected <p>I am trying to do a simple drop down menu with a search in it.
I cant get the ng-model to be changed on this drop down.
this is what I have done, and as you can see its very simple (mostly copy paste from the get started)</p>
<p>I couldnt find any info about the $selec... | <p>You need <code>ng-model</code> to hold the selected object, not a string.</p>
<p>Rewrite to <code>ng-model="contries.selected"</code> (while <code>contries</code> is you data array). </p>
<p>Then add <code>{{contries.selected}}</code> to your template, you will see a serialization of your selected object, so just ... |
String length not getting updated after new input <p>iam trying to implement a simple TCP server-client model....</p>
<p>Client : </p>
<pre><code>while (fgets(sendline, 4096, stdin) != NULL) {
printf("\n %s \n ",sendline); //check
printf("\n %d \n ",strlen(sendline)); //check
send(sockfd, sendline, strlen(sendline)... | <p>When you read the string from the file in Client, you read the exact number of bytes, i.e. not including a null terminator, so the string 'hello' is sent as five bytes.</p>
<p>When the recv call is made in Server, it reads five bytes and puts them in to a buffer, but it will just overwrite the first five bytes, so ... |
How to get all subfields of mongodb in a query when one field is root field of other field requested? <p>For this specific case, everything works fine, except when
for the fields <code>field1</code>,<code>field2</code> requested, and <code>field1</code> is a part of <code>field2</code>.</p>
<p>Example :</p>
<pre><cod... | <pre><code>db.mycoll.findOne({"_id":1},{"data.amounts.dollar":1,"data":1 })
</code></pre>
|
error cannot find module 'umask' <p>I just installed <strong>nodejs x64</strong> on my Windows 10 computer. I keep all default config,
I open cmd and type:
<code>npm -v</code></p>
<p>Then i got following error:</p>
<pre><code>module.js:457
throw err;
^
Error: Cannot find module 'umask'
at Function.Modul... | <p>update your npm</p>
<pre><code>$ npm install npm -g
</code></pre>
|
How to implement "close expanded tagfield when its label is clicked in ExtJS6"? <p>By default a tagfield cannot be closed when clicking on its field label, so if there is a form full of tag fields it's hard to find a sweet spot where you can click without expanding one of them.</p>
<p>I'd like to keep the triggerOnCli... | <p>[SOLUTUION]: "OnClick"-listener for the label of the tagfield:</p>
<p><a href="http://stackoverflow.com/questions/39663871/extjs-tagfield-how-to-close-its-list-by-clicking-on-its-label-in-ie11/39916588#39916588">Extjs Tagfield: How to close its list by clicking on its label in IE11?</a></p>
<p>[Old Workaround]:
I ... |
Laravel 5.1 and 5.3 which is best for beginner <p>I am new to laravel and but know core PHP well. And I am decided to create a project in laravel. So I started studying laravel. while I research about laravel, <a href="http://stackoverflow.com/tags/laravel/info">laravel community</a> says that laravel 5.1 has <strong>... | <p>@Gowtham I reccommend to go for 5.3 version. because of realy specious features like </p>
<p><strong><a href="https://laravel.com/docs/5.3/scout" rel="nofollow">Laravel Scout</a></strong>: is a driver based full-text search for Eloquent</p>
<p><strong><a href="https://laravel.com/docs/5.3/mail" rel="nofollow">Lara... |
meteor make user's schema collection2 to login <p>I'd like use this schema as user and login or extend form users.I read documentation and I don't understand how extends from users. how I can make it?</p>
<p><code>Dipendenti = new Mongo.Collection('dipendenti');
DipendentiSchema = new SimpleSchema({
nome: ... | <p>I believe you are trying to extend/merge the schema listed above to the users collection. If so, you just need to attach the schema to the collection.</p>
<pre><code>Meteor.users.attachSchema(DipendentiSchema);
</code></pre>
<p>UPDATE:</p>
<p>To use this new merged schema, you should be able to do something like:... |
Proccessing Multiple cURL requests in PHP faster <p>I am trying to speed up my website by processing the cURL requests efficiently. I am running about 3 requests, two go to the same server. Here is my code:</p>
<pre><code>$profile = curl_init();
curl_setopt($profile, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($profil... | <p>Well thanks for all the help guys. Especially @Andrew.</p>
<p>I found a solution that ended up working. Posting it here for other people with a similar problem.</p>
<pre><code>function multiRequest($data, $options = array()) {
// array of curl handles
$curly = array();
// data to be returned
$result = arr... |
Nested 'ifelse'-statement for quantiles <p>I am attempting to assign a number from 1 through 10 to a series of vectors based on what quantile they're in in a dataframe.</p>
<p>So far I have tried</p>
<pre><code>quants <- quantile(Data$Avg, c(.1, .2, .3, .4, .5, .6, .7, .8, .9))
Data$quant <- for ( i in nrow(D... | <p>This should work:</p>
<pre><code>Data$quant <- for ( i in nrow(Data) ) {
Data$quant[1] <- ifelse(Data$Avg [i] < quants[1], 1, ifelse(Data$Avg [i] > quants[1] & Data$Avg[i] < quants[2], 2, 3))
}
</code></pre>
<p>Or equivalently (inside the <code>for</code> loop):</p>
<pre><code>if(Data$Avg [i... |
How to use Hibernate batch processing <p>i have a list of objects i just want to save that objects using hibernate batch processing .below is the code that i have tried </p>
<pre><code>public void create(List<TransArchive> transArchives) {
Session session = getCurrentSession();
Transaction tx = null;
... | <p>For hibernate batch processing you have to set the <strong>Batch_Size</strong> property in your configuration file.</p>
<pre><code><property name="hibernate.jdbc.batch_size"> 50 </property>
</code></pre>
<p>Later on, update your code as below:</p>
<pre><code>public void create(List<TransArchive>... |
Trying to create a div with resizable dragger <p>I'm pretty sure there is already an example for this but I couldn't find one, and I don't know exactly what to search for.</p>
<p><a href="http://imgur.com/a/hHNkZ" rel="nofollow">http://imgur.com/a/hHNkZ</a></p>
<p>I am trying to make a resizable div from the button c... | <p>I think this would be helpful to you:</p>
<p><a href="https://jsfiddle.net/u0Ljnttg/1/" rel="nofollow">https://jsfiddle.net/u0Ljnttg/1/</a></p>
<p>Its little bit complicated, but still good enough. :)</p>
<p>Just for sake of SO:
JS:</p>
<pre><code>var links = document.getElementById("imageLinks");
links.onmoused... |
Powershell: How to send an email to each person with different information in a same pattern? <p>Let's say I'm facing this situation. I've got the examination results(scores) of the students in the class. And I need to let everybody get their score separately without knowing others' scores.
The score is saved in an Ex... | <p>There you go :)</p>
<pre><code>$csv = import-csv path\to\csv\book2.csv
foreach ($c in $csv) {
$name = $c.name
$score = $c.score
$Body = "
<p style='text-align: justify; direction: rtl;'><font face='verdana'>Hello $name</font></p>
<p style='text-align: justify; direction: rt... |
Using strings from loops as parts of function commands and variable names in R <p>How does one use the string coming from a loop
- to generate new variables<br>
- as a part of functions commands <br>
- as functions' arguments<br>
- as a part of if statements<br>
in R?</p>
<p>Specifically, as an example (the code obvio... | <p>Resist the temptation of creating variable names programmatically. Instead, structure your data properly into lists:</p>
<pre><code>list_dist = list(unif = runif, norm = rnorm)
distributions = lapply(list_dist, function (f) f(100, 0, 1))
means = unlist(lapply(distributions, mean))
# â¦Â etc.
</code></pre>
<p>As y... |
How to set stroke color to draw a rectangle on canvas? <p>I want to draw a round rectangle which its stroke is blue and its fill is red, but I can't find a method in Paint class to set stroke color. How can I do that?</p>
<pre><code> mCanvas.drawColor(mBackgroundColor, PorterDuff.Mode.CLEAR);
mCanvas.setDrawFil... | <p>Paint only allows for one color at a time.</p>
<pre><code>mCanvas.drawColor(mBackgroundColor, PorterDuff.Mode.CLEAR);
mCanvas.setDrawFilter(mPaintFlagsDrawFilter);
mFillPaint.setStyle(Paint.Style.FILL);
mFillPaint.setColor(Color.RED);
mStrokePaint.setStyle(Paint.Style.STROKE);
mStrokePaint.setColor(Color.BLUE);
mS... |
Can I DeSerialize a java serialized object to different classes? <p>Unsure how to frame the question. Here is a try :</p>
<p>I have two aerospike caches (sets) say X, Y.</p>
<p>there are two versions of a jar each has a class com.xyz.MyClass</p>
<p>jar1 :</p>
<pre><code>com.xyz.MyClass{
com.abc.Request request;... | <p>It will take huge amount of magic to achive it, and disallowing classloader magic remove half of your options. </p>
<p>Solution that I can propose is editing serialized data. Format in which object are serialized is known and is part of Java spec. So you can edit this bytes to replace one class name to another, but... |
image uploading to the database but not to the destination folder using php jquery ajax <p>I am trying to upload an image using php ajax and jquery. The image is uploaded perfectly without the ajax i.e using only submit_post.php but when I use ajax it does not succeed and comes up with an "error" alert. I am surely mis... | <p>submit the form using below written code and than try to upload and please check the permission of the folder where you want to upload the images </p>
<pre><code> $("#submit_post").on("submit", function(e) {
e.preventDefault();
$.ajax({
url: "url.php",
type: "POST",
... |
retrofit 2 : pass dynamic header along with body <p>I want to pass Header and Body dynamically to a Web Api. So, I have implemented as below:</p>
<pre><code>public interface NotificationService {
@POST("user/update/notification")
Call<JsonObject> notification(@Header("Authorization") String authorization... | <p>As far as I can see, there is no way to pass both Header and Body at the same time.</p>
<p>But You can add <code>Interceptor</code> into <code>OkHttpClient</code> as below:</p>
<pre><code>OkHttpClient.Builder builder = new OkHttpClient.Builder()
.cache(cache);
builder.addInterceptor(new Interceptor() {... |
Difference between 'Just' and 'pure' <pre><code>Just (+) <*> Just 3 <*> Just 5
</code></pre>
<blockquote>
<p>Just 8</p>
</blockquote>
<pre><code>pure (+) <*> Just 3 <*> Just 5
</code></pre>
<blockquote>
<p>Just 8</p>
</blockquote>
<pre><code>pure (*3) <*> [0..10]
</code></pre>
<bl... | <p><code>pure</code> is an overloaded operation. It is defined for all types that implement the <code>Applicative</code> class. One of the types that do that is <code>Maybe</code>. So <code>pure</code> in that context is the same as <code>Just</code>. But there are other types that also implement <code>Applicative</cod... |
Nonshared WPF behavior <p>I have two DataGrids on Window and I am using Blend behavior for creating filters in column headers. </p>
<pre><code><DataGrid>
<i:Interaction.Behaviors>
<v:ColumnBehavior/>
</i:Interaction.Behaviors>
</DataGrid>
<DataGrid>
<i:Interaction.Beha... | <p>Problem is solved. There are two instances of behavior class, as it should be, but both instances are bound to same property in viewmodel...</p>
|
Updating the content of an embded object with files using JS and JQuery <p>I am basically trying to make a web application where I have one pdf file loaded at once. So my main problem is how to I remove the current PDF file being shown and load the next based on my variable name which is basically just an integer dedic... | <p>change "<code>if (pageNumber > 72)</code>" to "<code>if (pageNumber < 72)</code>" </p>
|
Convert iteration to map <p>I've got the following code:</p>
<pre><code>@classmethod
def load(self):
with open('yaml/instruments.yaml', 'r') as ymlfile:
return {v['name']: Instrument(**v) for (v) in list(yaml.load_all(ymlfile))}
</code></pre>
<p>I'd like to load these in parallel using something like:</p>... | <p>Simple solution is to define a top level simple worker function for use in the executor:</p>
<pre><code>def make_instrument_pair(d):
return d['name'], Instrument(**d)
</code></pre>
<p>Then change:</p>
<pre><code>@classmethod
def load(self):
with open('yaml/instruments.yaml', 'r') as ymlfile:
retur... |
Node.js detect when two mongoose find are finished <p>I'm trying to initialize two input with autocomplete with this <a href="https://www.devbridge.com/sourcery/components/jquery-autocomplete/">library</a>. When I load my page, I will trigger an Ajax to initialize two input text.</p>
<p>But I don't know how I can dete... | <p>Mongoose has built-in support for promises which provide a clean way to wait for the completion of multiple async query operations with <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all" rel="nofollow"><code>Promise.all</code></a>:</p>
<pre><code>// Tell Mongoose ... |
Copy and paste the svg element from one div to another div <p>I need to copy and paste the svg element from one div to another. Is there any possibilities where we can easily achieve this. I tired using the below method. </p>
<pre><code>Circle = document.createElementNS("http://www.w3.org/2000/svg", tagName);
... | <p>Your code doesn't work because you'll have to namespace the SVG when you append it to the second div.</p>
<p>Since you're using jQuery, <a href="https://api.jquery.com/clone/" rel="nofollow"><code>clone()</code></a> is a easier method:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true... |
MySQL Master/Slave - Auto Server Id <p>I currently have a single dedicated machine hosting my MySQL instance and I'm looking at moving to a Master/Slave replication setup. I've configured a test master and slave as per the usual tutorials and it works fine.
However, my application runs on AWS using a Load Balancer and ... | <p>When you're using Auto Scaling, then you should move your database off the Auto Scaled instances. Each Auto Scaled instance should not have it's own copy of the database.</p>
<p>Instead:</p>
<ol>
<li>Have a master database that is not part of an Auto Scaling group.</li>
<li>Have 0 or more read-replicas to help all... |
yii2 javascript is not working. how can i add javascript <p>in yii 1, i created special javaScript file and called it menu_navigate.js. And linked it using following code:</p>
<pre><code><script src="<?php echo Yii::app()->theme->baseUrl;?>/Index/menu_navigate.js"></script>
</code></pre>
<p>It... | <p>In yii2 you have to use registerJsFile method in order to call a javascript for example:</p>
<pre><code>$this->registerJsFile('http://example.com/js/main.js', ['depends' => [\yii\web\JqueryAsset::className()]]);
</code></pre>
<p>for further information you can refer this link:
<a href="http://www.yiiframewor... |
How can I return an Index location for an item in a JSON array by searching with text? <p>Here is my JSON array:</p>
<pre><code>var planets = [{
"Name": "Mercury",
"Temperature": "427°C",
"Position" : 1
}, {
"Name": "Venus",
"Temperature": "462°C",
"Position" : 2
}, {
"Name": "Earth",
"Temperature":... | <p>Plain JS: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex" rel="nofollow">findIndex</a></p>
<blockquote>
<p>The findIndex() method returns an index in the array, if an element in
the array satisfies the provided testing function. Otherwise -1 is
return... |
Do action on mouseover using Javascript (else if) <p>I'm new to Javascript and I'm trying to write some code that will change the text in a specified div when some text is hovered over.</p>
<p>I've written a function that activates onmouseover and changes the text using getElementById.innerHTML </p>
<p>It looks like ... | <p>Use <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/this" rel="nofollow"><code>this</code></a> to reference the element being hovered. Here is a simple example.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet... |
Why does this crosstab() query return duplicate keys? <p>I have following table called <code>sample_events</code>:</p>
<pre><code> Column | Type
--------+-----
title | text
date | date
</code></pre>
<p>with values:</p>
<pre><code> title | date
-------+------------
ev1 | 2017-01-01
ev2 | 2017-01-03
ev... | <p><code>crosstab()</code> expects ordered input. You need to add <code>ORDER BY</code> in the input:</p>
<pre><code>SELECT * FROM crosstab (
'SELECT extract(week from date)::int AS week
, extract(dow from date)::int AS day_of_week
, count(*)::int
FROM sample_events
GROUP BY week, day_... |
Space in StringFormat <p>I'm looking to add a comma and one 'space' after a binding. I have the comma after the binding but I cannot work out at all how to do a 'space'. This is what I have;</p>
<pre><code><TextBlock Text="{Binding Name, StringFormat={}{0:\,}\,}" />
</code></pre>
<p>Could someone please inform ... | <p>XAML trims the string of whitespace unless you tell it where the string ends. Surround your string with single quotes.</p>
<pre><code><TextBlock Text="{Binding Name, StringFormat='{}{0}\, '}" />
</code></pre>
|
Best way to integrate bootstrap with symfony3 <p>I know how to use bootstrap with symfony without any bundles: download bootstrap, put compiled css and js files under web directory and its ready to use, working fine.</p>
<p>However I would like to use LESS or SASS mixins, in order not to use bootstrap classes like "ro... | <p>I think what you are looking for is the asset manager Assetic. This is not included by default in symfony3, but check out this page for more information: </p>
<p><a href="http://symfony.com/doc/current/assetic/php.html" rel="nofollow">http://symfony.com/doc/current/assetic/php.html</a>.</p>
<p>Assetic enables you ... |
Uber sdk integration error <p>I'm getting some message on clicking Uber ride request widget. I used the same code from this <a href="https://github.com/uber/rides-android-sdk" rel="nofollow">link</a> in a different app and its working. Am I doing something wrong here? I tried with different client_id and server_token b... | <p>The error indicates that the Uber account you used to authenticate with your app (implementing the widget) already started a ride from within a different app. <a href="https://developer.uber.com/docs/rides/ride-request-widget#implicit-grant-authorization" rel="nofollow">The widget leverages the <code>ride_widgets</c... |
How to allow arbitrary loads on Android 7 Nougat <p>We have an old server (windows server 2003) which only supports older SSL/TLS and cipher suites. This is a problem and we are working on upgrading it. Android 7 does not seem to accept this and I need a quick-fix to go around this problem. </p>
<p>How do I allow arbi... | <p>Not exactly the answer to your question, but I was in the same boat with a 2003 server with Exchange 2003 and Android 7.0 not being able to do ActiveSync with it. As you we are also planning a migration and needed a quick workaround to hold for another month. I ended basically offloading SSL to a 2012 R2 with IIS an... |
SQLSTATE[42000] Violation 1064 in a SELECT <p>Goog morning all</p>
<p>I have a problem with my code visibly</p>
<p>here it is :</p>
<pre><code><fieldset>
<?
if(isset($_POST['requete']) && $_POST['requete'] != NULL){
include "connexion.inc";
$reponse = $bdd->query('SELECT id_piece, piece
... | <p>Try by replacing the line</p>
<pre><code>$reponse = $bdd->query('SELECT id_piece, piece
FROM tbl_piece
WHERE piece = '.$requete.' ');
</code></pre>
<p>with </p>
<pre><code>$reponse = $bdd->query("SELECT id_piece, piece
FROM tbl_piece
WHERE piece = '".$requete."'");
</code></pre>
|
Replace only if string after some string <p>Background is I want to <strong>encode emails</strong> from <code>user@domain.com</code> to <code>user#domain@com</code></p>
<pre><code>$email = 'user@domain.com';
$email_encode = str_replace( '@' , '#' , $email ); // user#domain.com
$email_encode = str_replace( '.' , '@' , ... | <p>You may use a regex like</p>
<pre><code>^(.*)@(.*)\.(.*)$
</code></pre>
<p>and replace with <code>$1#$2@$3</code>.</p>
<p>See the <a href="https://regex101.com/r/yR4nW7/1" rel="nofollow">regex demo</a>.</p>
<p><em>Details</em>:</p>
<ul>
<li><code>^</code> - start of string</li>
<li><code>(.*)</code> - Group 1 c... |
How to treat an object of a class same as another for a generic <p>I have classified an object to NewClass, how can I use a function, say plot, on the object as if It's of a known class, say hist?</p>
| <p>Simple: just provide the required method:</p>
<pre><code>plot.NewClass = function(x, y, ...) { ⦠}
</code></pre>
<p>In the easiest case you can just dispatch to another <code>plot</code> method in the implementation.</p>
<p>If your <code>NewClass</code> object is actually a <code>histogram</code> object in disg... |
Shapes in dygraphs legend <p>Is it possible to add shapes in a dygraphs legend? Right now I'm working on making a graph with series that are related to each other, at the moment I'm able to represent each of the values in the graph with a color and a shape, this means each series has a color and a shape, so the series ... | <p>If you're willing to build dygraphs from HEAD, you can use the new <a href="https://github.com/danvk/dygraphs/pull/683" rel="nofollow"><code>legendFormatter</code></a> option. This gives you complete control over the legend. Check out the PR description for details.</p>
|
JSARToolkit get markers ID <p>I'm using JSARToolkit (<a href="https://github.com/artoolkit/jsartoolkit5" rel="nofollow">https://github.com/artoolkit/jsartoolkit5</a>) on a project. It makes a lot of things easier.</p>
<p>However, I've some trouble when I try to get all markers that have been detected, and their IDs.</... | <p>I think you may be confused about the markerId. I know how it works on Unity and Android, so I am assuming it is similar in JS.</p>
<p>The marker ID is a number that gets assigned to a marker when it is loaded, so if you only load one marker, the ID is always 0.</p>
<p>This has no relationship with the matrix code... |
SQL Server bulk insert XML format file with Maximum LENGTH <p>I want to set the length to MAX for one of my XML fields.</p>
<p>XML Code:</p>
<pre><code><?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">... | <p>The length of a string is limited to 4000 (nchar) or 8000 (char) type. There is no <code>max length</code>-constant - AFAIC</p>
<p>Refer to <a href="https://msdn.microsoft.com/en-us/library/ms187833.aspx" rel="nofollow">this, "Field Attributes"</a></p>
<p>If you look up the schema <em>meta-data</em> just as SQL Se... |
ng-hide not working once the input field is clicked <pre><code> <md-radio-group ng-model="orderDetails.productType" layout="row">
<md-radio-button value="paper" class="md-primary"><h4>Paper</h4></md-radio-button>
<md-radio-button value="nonPaper"><h4>... | <p>Actually this is an Angular material Issue
<a href="https://github.com/angular/material/issues/6536" rel="nofollow">https://github.com/angular/material/issues/6536</a></p>
<p>But if you remove the ng-required it should work.</p>
<p>May be this fiddle helps you : </p>
<pre><code>`https://codepen.io/anon/pen/BLjm... |
Control flow analysis for Tuple Union Types <p>Is there a way to tell typescript that a union type of tuples satisifies the type constraints for any code path in the following example without manually specifying each case in the function body?</p>
<pre><code>type options =
[string, (a:string) => number]
| ... | <p>Here's a typesafe way to make it work. The <code>as</code> keyword is not a cast, it <em>would</em> complain if the types weren't compatible.</p>
<pre><code>type options =
[string, (a:string) => number]
| [number, (b:number) => string ]
function f( [input,fn]: options) {
return (fn as (a: string ... |
Using reference to artifact without multiplying the artifact <p>I've got job that builds jar artifact
In other jobs I want to use this artifact.
As I understand there is a plugin called "Copy artifact plugin" but it copies file.
I don't want to have copy of this artifact in every job I created, I want to pass referen... | <p>This is not technically feasible in situation with multiple slaves. So I believe there is no such functionality in any Jenkins plugin.</p>
<p>You have a choice to even:</p>
<ol>
<li>Force second job to run on master and calculate artifact file path
from root path configured in Jenkins settings, $JOB_NAME,
$BUILD_N... |
Embed leaflet data collection or geojson.io map to form <p>I'm trying to figure out the most lightweight way to collect data for individual mapped polygons from non-technical users. Here's the end vision: users fill out a web form, draw a shape, and then they can easily email their formatted data to me or my colleagues... | <p>A quick proof of concept, adapting code from <a href="https://github.com/Leaflet/Leaflet.draw" rel="nofollow">Leaflet.draw</a> example:</p>
<pre class="lang-js prettyprint-override"><code>var drawControl = new L.Control.Draw({
edit: {
featureGroup: drawnItems
}
});
map.addControl(drawControl);
map.on('draw... |
Do the \d and \w metacharacters include international characters? <p>In Java it appears <code>\d</code> = <code>[0-9]</code> and <code>\w</code> = <code>[A-Za-z_]</code>, is this the same for iOS and ICU?</p>
<p>I don't want to include international characters yet the documentation only includes Unicode references.</p... | <p>In Java, <code>\w</code> matches <code>[a-zA-Z0-9_]</code> by default, and it only matches Unicode letters once you use <code>(?U)</code> (<code>Pattern.UNICODE_CHARACTER_CLASS</code> flag), see <a href="http://ideone.com/G4sARG" rel="nofollow">this demo</a>:</p>
<pre><code>String s = "abc ÅÄ
Å"
System.out.printl... |
XCode: Additional localization of only one button <p>After a long long time, I added another button to my apps dialog. I had localized strings implemented. So I found a similar one like</p>
<pre><code>/* Class = "NSButtonCell"; title = "Keep number"; ObjectID = "2yE-rM-5Sn"; */
"2yE-rM-5Sn.title" = "Nicht umnumerieren... | <p>Select your project name (1.), in my case Timebooking. Maybe the application is selected instead in Targets and you have more options but not localization. Then select Use Base Localization (2.). It should create the English Main.strings file when you add English. There you can add the proper translation. HTH.</p>
... |
Highlight current value in loop menu <p>i'm trying to highlight current value in this loop menu:</p>
<pre><code> <?php
for ($i=count($anos)-1;$i>=0;$i--)
echo '<li><a href="obra.php?ano='.$anos[$i]['ano'].'" onclick="window.location=\'obra.php?ano='.$anos[$i]['ano'].'\';">... | <p>You can use <code>$_GET</code> to use the passed value along with URL. In your case it's <code>ano</code>. </p>
<p>Use this value to compare with loop's value and if they are similar change the style of the element.</p>
<p>So your code look something like this,</p>
<pre><code><?php
$ano="";
if(array... |
Angular 2 pass variable to component dynamically <p>I have a parent component that is initialized with an empty property <code>editingProduct</code> which is the product that is to be edited, but is empty until the user has selected a product.</p>
<p>The editing component is nested inside the parent component (a list ... | <p>Don't nest inside parent templates, just pass <code>product</code> from <code>p-dialog</code> to <code>qs-product-create</code> again. I tested the following code and it is working</p>
<p><strong>app.com.ts</strong></p>
<pre><code>import { Component } from '@angular/core';
@Component({
selector: 'parent-com... |
Built-in functions/methods vs own functions/methods? <p>In any programming language (using python as of now), is it preferable to use builtin function or create your own methods doing the same job as builtin function does?</p>
<p>Please share your opinion according to these scenarios: </p>
<ul>
<li>while creating a p... | <p>Python comes with a huge toolkit ("batteries included", as they say). These functions are made to be used, so no need to re-invent the wheel.</p>
|
Sorting Angularjs ng-repeat by date <p>I am relatively new to AngularJS. Could use some help</p>
<p>I have a table with the following info</p>
<pre><code><table>
<tr>
<th><span ng-click="sortType = 'first_name'; sortReverse = !sortReverse">Referral Name</span></th>
<th>&... | <p>Ideally you'd have a sortable object for date. One candidate is an isoformatted date:</p>
<pre><code>i["date"] = i["date"].isoformat()
</code></pre>
<p>Now sorting should work just fine but it'll display wonky. So you'll need to use a date filter to format it on the UI:</p>
<pre><code><table>
<tr>
... |
Find and return polygons which path/route goes through in PostGIS <p>Hi I am challenged with finding the polygons which a path, returned as a multilinestring, crosses or drives through. So if I have to travel from A to B then I have to count and return all the polygons that I visit, including the polygons A and B are c... | <p>Just use st_intersects: you are looking for the polygons that intersects your route (multi)linestring.</p>
<p>Your query will be something like this</p>
<pre><code>select polygons.id from polygons
where st_intersects(polygons.geometry, ST_GeomFromGeoJSON('GEOJSON HERE'))
</code></pre>
|
Ruby on rails confirm on submit tag with condition <p>On my edit page I will need to make a confirm box pop up if you try to set the end date before the start date.</p>
<p>I have a submit button, but need to get a confirm box coming up when the button is pressed but only if you have moved the end date before the start... | <p>Try this hope it will work </p>
<pre><code>@record_id = @record.id
<%=submit_tag "#{ @record_id.present? ? 'Save' : 'Create'}", :class=>"btn primary med", data: {:confirm => "Are you sure?"} %>
</code></pre>
|
Parameter passed in save() difficult to understand <p>I am learning Django from a most recommended and beneficial book named 'Django By Example'. There is a project called Bookmark. I am now stuck in the forms part which is for downloading the image and saving image object to the database. I could understand validation... | <pre><code>image = super(ImageCreateForm, self).save(commit=False)
</code></pre>
<p>In this statement we are assigning super function to a variable image.</p>
<p>super method is called with ImageCreateForm. Then whatever is returned with super() method, we call the save() method of forms.ModelForm with commit=False.<... |
JScrollPane and Zooming Images <p>I'm trying to write a simple class that extends from JPanel that can zoom in and zoom out on an image and then uses a JScrollPane at the top level to allow someone to scroll back and forth across the zoomed image. I've having trouble with the JScrollPane portion. </p>
<p>When clicking... | <p>After some heavy digging, the Scrollable interface saved me. Implementing this and it's respective methods following this <a href="https://docs.oracle.com/javase/tutorial/displayCode.html?code=https://docs.oracle.com/javase/tutorial/uiswing/examples/components/ScrollDemoProject/src/components/ScrollablePicture.java"... |
unable to execute Celery beat the second time <p>I am using Celery beat for getting the site data after every 10 seconds. Therefore I update the settings in my Django project. I am using rabbitmq with celery.</p>
<p><strong>settings.py</strong></p>
<pre><code># This is the settings file
# Rabbitmq configuration
BROKE... | <p>The exception tells you what the error is: your task expects a positional argument, but you do not provide any arguments in your schedule definition.</p>
<pre><code>CELERYBEAT_SCHEDULE = {
# Executes every Monday morning at 7:30 A.M
'update-app-data': {
'task': 'myapp.tasks.fetch_data_task',
... |
Why my android code is of large size? <p>Following is the code for my app for a flash light</p>
<p>Its size comes out to be 1.4 MB which is too huge .</p>
<p>So i used progaurd to reduce size which ends up in 750 KB which is still huge as compared to code i am using.</p>
<p>Why the size is large ? and how to reduce ... | <p>You are extending <code>AppCompatActivity</code>, this means that your project includes Android Support Library v7, if you don't care about material look on old Android versions, you can simply remove it. Check your <code>build.gradle</code> file to see which libraries are included as those libraries will make your ... |
signalr not working with solution angularjs+asp.net web api <p>here is my signalr piece on backend</p>
<pre><code>public class ChatHub : Hub
{
public void AddMessage(string userName, string message)
{
Clients.All.receivedNewMessage(userName, message);
}
}
</code></pre>
<p>... | <p>Change:</p>
<pre><code>$.connection.hub.start().done(function () {
$scope.addMessage = function () {
myChatHub.server.addMessage($scope.username, $scope.message);
};
});
</code></pre>
<p>To:</p>
<pre><code>$scope.addMessage = function () {
myChatHub.server.addMessage($scope.username, $scope.message);
};... |
How to Change many char's combination's to one of that kind <p>In my application I want to edit string (Make many instances as one)</p>
<p>For example I have string:</p>
<pre><code>string str = "/r/n/r/n/r/n Some text /r/n/r/n/r/n 45678123";
</code></pre>
<p>The wanted result:</p>
<pre><code>"/r/n Sometext /r/n 456... | <p>You can use <code>Regex.Replace(input, @"(?:\r\n){2,}", Environment.NewLine)</code></p>
<p>This will replace multiple occurences of <code>\r\n</code> by a single new line.</p>
<hr>
<p>You can put this in an extension like so:</p>
<pre><code>public static class MyExtensions
{
public static string MakeToOneIns... |
How do I segue from a tableviewcell and pass different data from each cell to the next tableview? <p>I'm trying to practice making list apps with models by making a class to represent each list item. I have a Category class which contains three properties - two strings and one array of strings. Here is the class:</p>
... | <p>In your cell for row at indexPath:</p>
<pre><code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
cell.tag = indexPath.row
return cell
}
</code></pre>
<p>In your prepare ... |
SSL Chain Incomplete <p>After creating 7 SSL Certificates with <code>Let's Encrypt</code>, I have stumbled upon this error. I had setup all my configs correct and I scanned my whole site for SSL Vulnerabilities on <code>[SSLLabs.com][1]</code> and it told me that my server's certificate chain is incomplete.</p>
<p>The... | <p>Replace</p>
<blockquote>
<p>certificate /etc/letsencrypt/live/ghostantiddos.com/cert.pem</p>
</blockquote>
<p>by</p>
<blockquote>
<p>certificate /etc/letsencrypt/live/ghostantiddos.com/fullchain.pem</p>
</blockquote>
<p>then test again with <a href="https://ssllabs.com" rel="nofollow">https://ssllabs.com</... |
SoftLayer API: How to specify OS Reload with RAID options? <p>Using the Python SoftLayer library, I've been attempting to submit an OS reload via the SoftLayer API to get consistent disk setup for provisioned servers. These servers have either RAID10 or RAID1 setup, using all available disks in the array. Upon initial ... | <p>That is the expected behavior for reload, the partitions are applied only to the first disk and it is not possible to specify RAID configuration via API for reload.</p>
<p>You have two options to mantain your RAID configuration:</p>
<p>1.- Do not specify any partition configuration for the reload, so the OS of you... |
Recursive function that outputs a table of references <p>Let's say I have an array like this</p>
<pre><code>Array(
Array("id_1" => 1,"id_2" => 1,"name" => "test1","type" => "A","ref_1" => 0,"ref_2" => 0,),
Array("id_1" => 1,"id_2" => 2,"name" => "test2","type" => "B","ref_1" =>... | <p>Well, finally I got it working. I've added some information to make my life easier.</p>
<p>I've added a flag to each row that says if that row has no childs (so it's the last). The number of "last" rows is the number of rows of the output so I started from there.</p>
<p>Also, I've added a "key" which is "id_1-id_2... |
Issue with deployment polymer application to subdirectory <p>I have a problem trying to deploy a polymer application to the server. I created the Application using Polymer-Cli. Also the routing is done using <code><app-route></code> element.
The server is IIS Server, and the issue comes because they want to deplo... | <p>I solve this issue using the property use-hash-as-path in the app-location:</p>
<pre><code><app-location route="{{route}}" use-hash-as-path></app-location>
<app-route
route="{{route}}"
pattern="/:page"
data="{{routeData}}"
tail="{{subroute}}">
</app-route>
</code></pre>
|
Add custom widget styling to app theme <p>I've implemented a custom view with custom attributes and I am trying to style it in the theme. I've followed the instructions in <a href="http://stackoverflow.com/a/5052401/1969198">this answer</a>, but my widget is not picking up the style from the app theme.</p>
<p>The cust... | <p>Change your second constructor like this,</p>
<pre><code>public BarGraph(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.barGraphStyle);
}
</code></pre>
<p>And inside your third constructor, use this line</p>
<pre><code> TypedArray styledAttributes = context.obtainStyledAttribute... |
SELECT items from DB comparing to latest date in another table <p>I would like to select all items from <code>userLogTable</code> where the record is newer than the latest matching item in <code>activityTable</code>. I would like to do this in a single query.</p>
<p>Currently I select from one table and then loop thro... | <p>I think this does what you want:</p>
<pre><code>select ult.*
from userLogTable ult
where ult.date > (select max(a.date)
from activityTable a
where a.name = ult.name and a.surname = ult.surname
) ;
</code></pre>
|
angular2 rc6 custom global pipes; PLATFORM_PIPES <p>I am using angular with version 2.0.0-rc.6 in older versions there was a possibility to create a global pipe and register it like is shown <a href="http://stackoverflow.com/questions/35044068/is-it-possible-to-override-the-built-in-angular-2-pipes-so-they-can-be-used-... | <p><strong>Working Demo of Default-Pipe & Custom-Pipe: <br><bR><a href="https://plnkr.co/edit/BmZrCbl0czJwnPMf0x0V?p=preview" rel="nofollow">https://plnkr.co/edit/BmZrCbl0czJwnPMf0x0V?p=preview</a></strong></p>
<p><hr>
<strong>Default pipe</strong></p>
<p><em>You don't need to do anything for this.</em></p>
<p><... |
line from -infinity to infinity with ggplot2? <p>I would like to plot something like this with ggplot2</p>
<p><a href="http://i.stack.imgur.com/X3Dbh.png" rel="nofollow"><img src="http://i.stack.imgur.com/X3Dbh.png" alt="enter image description here"></a></p>
<p>I can do this:</p>
<pre><code>library(ggplot2)
ggplot(... | <p>Using a little help from <a href="http://stackoverflow.com/a/7165019/5619526">this post</a>, and a somewhat hacky solution, we can come up with something:</p>
<pre><code>ggplot() + geom_hline(yintercept=1) +
ylab("Likelihood") +
xlab('')+
theme(axis.ticks = element_blank(), axis.text.y = element_blank... |
WebSphere ssl configuration for secure ( ssl ) communication with LDAP <p>We have Web Service deployed on WebSphere 8.5 that needs to communicate with LDAP over ssl. The ssl communication works only when the ldap certificates are imported in JRE cacerts store.</p>
<p>For other services we use, the certificate can be i... | <p>Unfortunately I do not know the details about how your LDAP connection is being made. If it's going to the cacerts file, it suggests the JSSE default SSL Configuration is being used. So something about the call is making it go to the JSSE default and not use the WebSphere socket factories.</p>
|
Reproducible builds in python <p>I need to ship a compiled version of a python script and be able to prove (using a hash) that the compiled file is indeed the same as the original one.</p>
<p>What we use so far is a simple:</p>
<pre><code>find . -name "*.py" -print0 | xargs -0 python2 -m py_compile
</code></pre>
<p>... | <p>Compiled Python files include a four-byte magic number and the four-byte datetime of compilation. This probably accounts for the discrepancies you are seeing.</p>
<p>If you omit bytes 5-8 from the checksumming process then you should see constant checksums for a given version of Python.</p>
<p>The format of the <c... |
Dojo _hasDropDown - How do I declaratively bind the properties? <p>ExpandableSearchComponent.html:</p>
<pre><code><div class="${baseClass}">
<div data-dojo-type="dijit/_HasDropDown" data-dojo-props="dropDown: 'containerNode'">
<div data-dojo-type="dijit/form/TextBox"
name="${SearchVi... | <p><code>dijit/_HasDropDown</code> is a mixin to add dropdown functionality to a widget by inheritance. It is not intended to be used as a widget, especially in declarative markups.</p>
<blockquote>
<p>dijit/_HasDropDown is a dijit widget mixin that provides drop-down
menu functionality. Widgets like dijit/form/Se... |
How do you add superscript to a label in Xamarin Forms using Xaml <p>How do you add superscript to a label in Xamarin Forms using Xaml. Specifically, I would like to add a TM superscript for trademark.</p>
| <p>As Chris mentioned in the comment you can use the unicode character <code>&#8482;</code> (™) </p>
<p>You should use the CustomeRenderer if you want to do anything complex</p>
|
python : get list all *.txt files in a directory <p>i'm beginner in python language</p>
<p>how to get list all <code>.txt</code> file in a directory in python language ? </p>
<p>for example get list file :</p>
<pre><code>['1.txt','2.txt','3.txt','4.txt','5.txt','6.txt']
</code></pre>
| <p>you can use <code>os</code>, <code>subprocess</code> and <code>glob</code> library</p>
<p><code>os</code> library example:</p>
<pre><code>import os
os.system("ls *.txt")
</code></pre>
<p>this command returned all <code>.txt</code> file</p>
<p><code>subprocess</code> library example:</p>
<pre><code>my_result_com... |
Get an id to another page <p>Hello is my frist post there, i need your help.</p>
<p>Frist at all, i want to say sorry for my bad english. I hope you will undestoode me :D</p>
<p>So, i'm a newbie in php and i got a problem.
I want to take the id from a file, to another file, but i don't know how. I will let you the co... | <p>Your PHP code is correct, although you should be using <code>htmlspecialchars()</code> when adding the variables to the output. This to prevent XSS attacks, and the like.</p>
<p>Though, your problem lies most likely in this line:</p>
<pre><code><a href="/index.php?page=news id='.$id.'">
</code></pre>
<p>Mor... |
Most efficient way to list server status results <p>I'm trying to determine the best way to show server status results.
We have roughly two dozen websites and services to maintain, and the old system they had here was crude (HTML, manual color change to reflect status), and I'm trying to re-vamp it a little.</p>
<p>Wh... | <p>This would need to be done client side, with an AJAX query to a script that runs the ping/heartbeat check code. With a callback that updates the status, based upon the ID.<br>
Using <code>setInterval ()</code> will enable you to execute this on a regular basis, without requiring manual input.</p>
<p>Note that if yo... |
Undefined method authenticated? form main::Object <p>I'm learning Sinatra now and I'm building a tiny blog. I've got a little problem with an <code>authenticated?</code> method. I've set up authentication, and now I want the rest of my app to be loaded only when the user is authenticated. So, in my <code>app.rb</code> ... | <p>According to <a href="http://www.sinatrarb.com/extensions.html" rel="nofollow">docs</a> you'd use your <code>authenticated?</code> method as follows:</p>
<pre><code>get '/' do
if authenticated?
# something
else
# something else
end
end
</code></pre>
|
Paypal Payments REST API Updating Payment to Add Item <p>I'm trying to add a second Item to a created payment via a PatchRequest but can't seem to figure it out. </p>
<p>Here is my code: </p>
<pre><code>$patch = new \PayPal\Api\Patch();
$patch->setOp('add');
$patch->setPath('/transactions/0/item_list/items/1');... | <p>I had the same Error Message.</p>
<p>The Problem were the missing square brackets round the JSON. </p>
<p>The right path is '/transactions/0/item_list/items'.</p>
<pre><code>$json = '
[
{
"description":"Testartikel",
"price":"50.00",
"currency":"EUR",
"quantity":1
}
]';
$patchAdd = new \PayP... |
Git: error src refspec does not match any; different behavior on Windows and Linux <p>On Windows my usual workflow is:</p>
<pre><code>git init
git pull https://<repo_address> "branch_name"
git commit --all -m"message"
git push https://<repo_address> "branch_name"
</code></pre>
<p>After performing all bran... | <p>I would recommend doing either a clone (which pulls down the repo and all branches), or if you want to get just a single branch, you can just add the remote and then fetch the branch. Cloning is probably the easiest but if you only want the single branch you can do the following steps.</p>
<pre><code>git init
git ... |
Access first element in a os.scandir <p>I am using <code>os.scandir</code> for getting the list of files in a folder:</p>
<pre><code>img_list2 = os.scandir('/home/shared/test')
</code></pre>
<p>I want to get the first element.</p>
<p>I am trying <code>img_list2.next()</code></p>
<pre><code>>>> img_list2.ne... | <p><a href="https://docs.python.org/3/library/functions.html#next" rel="nofollow"><code>next()</code></a> would give you the next item from the <code>img_list2</code> iterator:</p>
<pre><code>next(img_list2)
</code></pre>
|
Spring Security OAuth Java Config <p>I have a Spring app -- <em>not</em> a Spring Boot app -- that I'm trying to declare a section of the API as OAuth2 protected using Spring Security. My authorization and general resource access config works great when I define <code>http</code> elements in the XML, but when I try to ... | <p>If you are simultaneously using both Java-based and XML-based security configuration, only the XML-based will be picked up. Have you tried disabling/commenting-out all your XML-based http security config and see if your Java-based would activate? </p>
<p>I had a similar problem before. I asked help at the Spring Se... |
troubles in a simple weather webapp using openweathermaps API <p>Initially I had 3 separates .js files, one for each city to test the api, and it worked perfectly.
Now i'm trying to insert all the 3 request in a single .js file, to make all the request at the same time and call a single js from the html, but i am unabl... | <p>Your <code>update</code> function had <code>loc</code> and <code>temp</code> which were <code>undefined</code>. I have updated and tested the code. Let me know if you need help in understanding anything in particular.</p>
<p>Always look at <code>console</code> (right click -> inspect element -> console) for errors.... |
Searching a custom table in wordpress <p>I'm a bit new to php queries with SQL so please bare with me.</p>
<p>I'm currently building a site for a client and they want a search feature that will search all of the products they supply. </p>
<p>I have created a new table in the database called sc_products and then tried... | <p>Your foreach loop is confusing at best, why the global variable? You are also only returning one product and you aren't using the search term at all.</p>
<p>This should help to retrieve more than one product but you need to also use the search criteria in your sql query to filter down:</p>
<pre><code>function sear... |
Apache + Node.js + mod_proxy. Getting forwarded to https and app is not working <p>Problem: My Node-app is running on <a href="http://localhost:3000/" rel="nofollow">http://localhost:3000/</a>, but mod-proxy is redirecting my traffic to <a href="https://localhost:3000/" rel="nofollow">https://localhost:3000/</a> and th... | <p>Your config file will redirect www.node-example.com to <em>localhost:3000 on the server machine</em>.</p>
<p>Do you own <em>node-example.com</em>?</p>
|
Is there some api (or way) for get log when app or service get crashed android? <p>I am building an app which has a Service,
this service save the gps coordinates, and check connection with server (yet not validate internet connection only server connection)
this work well,</p>
<p>The App could be closed and the serv... | <p>I will suggest you to go through following options :</p>
<p><a href="https://www.fabric.io" rel="nofollow">https://www.fabric.io</a> (Logs all crashes)</p>
<p><a href="https://github.com/joshdholtz/Sentry-Android" rel="nofollow">https://github.com/joshdholtz/Sentry-Android</a> (Logs all unhandled exceptions)</p>
|
How to sort a nested Collection by its objects modified value? <p>Basically I have an object as follows: </p>
<pre><code>IDictionary<string, ICollection<KeyValuePair<string, int>>> myDict;
</code></pre>
<p>What I'd like to do is to sort its inner collections by keys without underscore prefixes the... | <p><code>ToDictionary</code> requires two parameters - one for the key selector and one for the value selector, so you could do something like:</p>
<pre><code>myDict = myDict.ToDictionary(
kvp => kvp.Key,
kvp => ICollection<KeyValuePair<sââtring, int>>
... |
Check if all elements in array are the same value with jQuery <p>I need to check (<strong>with jQuery</strong>) if all 'li' in a list has style="display: none",
but I'm a little lost.</p>
<pre><code><ul class="thumbs">
<li style="display: none;">Element 1</li>
<li style="display: none;">El... | <p>Instead of using <code>map</code>, try <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter" rel="nofollow"><code>filter</code></a>ing the list elements based on their CSS properties and checking the length of the resulting array:</p>
<p><div class="snippet" data-la... |
iOS - Showing info from tableView didSelect <p>I currently have a tableView and when the cell has been pressed I want to show certain data. The tableView currently has 2 cells 'Set One', 'Set Two'. </p>
<p>If cell with title 'Set One' didSelect then I would like the next View Controller to show the data for this cell.... | <ol>
<li><p>Add the data MusicSet into an array:</p>
<pre><code>var arrMusicSet:[[String:AnyObject]]! = []
</code></pre></li>
<li><p>Create a Segue from Table Cell to View Controller.</p></li>
<li><p>Set Segue Identifier in IBInspector.</p></li>
<li><p>Now when you will press on cell, the segue will get fired, not nee... |
How to render (appendChild) a raw DOMElement inside a React Component? <p>Edit:
Duplicate found:
<a href="http://stackoverflow.com/questions/32849219/how-can-i-append-external-dom-to-react-component">How can I append external DOM to React component?</a></p>
<hr>
<p>So I can do something like:</p>
<pre><code>compone... | <p>I am not certain of your specific use case, but I think what you might be looking for is the <code>onLoad</code> property.</p>
<pre><code>import React from 'react';
class Example extends React.Component {
constructor () {
super();
this.state = {
imageLoaded: false
}
}
doSomething () {
... |
{nativescript} accessing SmsManager <p>I want to access android smsManager with using nativescript as shown on code below. When I running my app, it thrown an error with message Failed resolving constructor on class android.telephony.SmsManager.
Please help with this error</p>
<pre><code>exports.sendSMSManager = func... | <p>Use this to initialize SMS messenger and send message.</p>
<pre><code>var sms = android.telephony.SmsManager.getDefault();
sms.sendTextMessage("0888001001", null, "Sent from Android", null, null);
</code></pre>
<p>However for Android SDK versions >= 23 you will have to explicitly grant permissions for <strong>andr... |
Horrible, ugly blur when animating CSS scale in Firefox 48 <p>I'm not having this problem when setting the scale property alone on a CSS element, only when using an animation. Also, it doesn't happen in general. It only seems to happen on my modals.</p>
<p>This is what it looks like when I take a screenshot during the... | <p>I was able to fix this problem by adding overflow:hidden on my screen reader content, however I suspect this visual bug can occur in other places, such as when animating very large DOM elements.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet... |
Fast way to get edges crossing two sets of nodes in networkx.Graph <p>What's the fasted way in <code>networkx</code> to get the crossing edges between two disjoint node sets?
Is there some ready-made function to use?</p>
<p>The way I am using now:</p>
<pre><code>import networkx as nx
from itertools import product
A ... | <p>It depends on assumptions about the graph.</p>
<p>If graph is dense than your approach is optimal since set of result edges is almost the same as <code>product(A,B)</code>. Than it is goot to iterate through all possible edges (<code>product(A,B)</code>) and check is it an edge.</p>
<p>If graph is sparse than it w... |
What do the decorators @page, @component and @app mean in ionic 2 apps? <p>I've seen <em>@app</em> and <em>@page</em> and <em>@component</em> used seemingly interchangeably and i don't know what the difference is. </p>
<p>The ionic2 documentation is very bad on this so what is the fundamental difference between these ... | <p>@Page and @App are deprecated decorators you must focus only on @Component</p>
<p>angular2 use something called ReflectMetadata, basically a decorator add some important metadata to your class</p>
|
How to do swift availability checking on watchOS 3 <p>I'm having an interesting problem with <code>watchOS 3</code> and <code>watchOS 2</code>. In my <code>ComplicationController</code> I want to support both <code>watchOS 3</code> and <code>watchOS 2.</code> When creating the complication templates I'm checking if the... | <p>I figured it out with help from a post on the Apple Developer Forums. I needed to add the <code>ClockKit.framework</code> to the linked binaries and set its status to <code>Optional</code>. Now everything works as expected on <code>watchOS 2</code>.</p>
<p>Here's the post:
<a href="https://forums.developer.apple.co... |
IF statement inside a LINQ SELECT to include columns <p>Is it possible to include or exclude column within linq Select?</p>
<pre><code>var numberOfYears = Common.Tool.NumberOfYear;
var list = users.Select(item => new
{
Id = item.Id,
Name= item.Name,
City= Item.Address.Ci... | <p>Thanks to the beauty of the <code>dynamic</code> keyword what you need is now possible in C#. Below an example:</p>
<pre><code>public class MyItem
{
public string Name { get; set; }
public int Id { get; set; }
}
static void Main(string[] args)
{
List<MyItem> items = new List<MyItem>
{
... |
Looping Child arrayList in Parent ArrayList <h2>Problem</h2>
<ul>
<li>I need to create an invoice using pure javascript</li>
<li>Input(Checkbox) have ID's and Values
<blockquote>
<p><code><input type="checkbox" id="2Tier" value="950"/></code></p>
</blockquote></li>
<li>When user clicks $("input[type=checkbox]... | <p>You didn't change a letter in the second index:</p>
<pre><code>for (i = 0; i <= $ListItem.length; i += 1) {
for (j = 0; j <= $selectedWeddingCake.length; j += 1) {
document.getElementById("demo").innerHTML = "<br>Item: " + $selectedWeddingCake[i] + "<br>Price: " + $selectedWeddingCake... |
Accessing a double from one method to another one <p>I am a big beginner in java and just need to know how to use this variable from one method to another as it is part of an assignment. please help.</p>
<pre><code>public class parking {
public static void input(String args[]) {
int hoursParked = IO.getInt("(\\(... | <p>In your code, <code>bill</code> is a <em>local variable</em> in <code>input</code>. You cannot refer to that variable from outside <code>input</code>.</p>
<p>If <code>input</code> and <code>output</code> are to be separate methods, then the usual thing would be to make them <em>instance</em> methods and to create a... |
not able to use three.js <p>I found a cool animation on codepen that takes a map (img) and reconstruct it with blocks. The js files needed is <code>three.min.js</code> and <code>TweenMax.min.js</code> I took the links from codepen and pasted it into my head within <code><script src=""></script></code>. Afte... | <p>The problem was worked out in the comments, but for the sake of not leaving a question technically unanswered I will explain the process for anyone stumbling across this page after searching for the error posted in the question.</p>
<p>In the example which was posted in the question (which is utilizing PHP to load ... |
How to make axes equal size in regards to pixels? <p>I'm using JChart2D for visualization. I would like to make the X and Y axis equal in terms of pixels. By doing so its much easier to see how far the points are from each other in euclidean distance (see image). As it is now, the x-axis is more stretched out. They alr... | <blockquote>
<p><strong><em>By doing so its much easier to see how far the points are from each
other in euclidean distance</em></strong></p>
</blockquote>
<p>not really, the Euclidean Distance requires at the end the position of the 2 points you are calculating and you have it... otherwise you wouldnt be able to ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.