input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Dont find socket.io <p>File </p>
<pre><code>chat
node_modules
web
public
css
estilo.css
img
tiempo.jpg
js
script.js
view
vista.html
app.js
package.json
</code></pre>
<p>JSON</p>
<pre><code>{
... | <p>thanks guys,it to find the solution,to my problem , a had to reorder the code, what start first and finish the last</p>
<pre><code>var express = require('express'),
app = express(),
io = require('socket.io'),
nicknames=[],
users={};
var server=app.listen(3000, function () {
console.log(... |
Add Module from GIT to Android Studio throws "buildToolsVersion is not specified" error <p>I want to include <a href="http://www.materialdoc.com/color-picker/" rel="nofollow">this Color Picker</a> into my Android Studio project. </p>
<p>So I checked it out into a local folder, added it to my project with the "New->Imp... | <p>Follow the steps :</p>
<p>Open the <code>build.gradle</code> file of color picker module </p>
<p><a href="http://i.stack.imgur.com/FLFby.png" rel="nofollow"><img src="http://i.stack.imgur.com/FLFby.png" alt="enter image description here"></a></p>
<p>so in your case add these lines to <code>build.gradle</code> fil... |
Need help dealing with the checker here <p>Okay, so I have this function that I need to create and I think the code checker is somehow flawed and I tried manage it but my code still seems to fail</p>
<pre><code>def reversecomp(L):
""" assumes L is a list of lists whose elements are ints
Mutates L such that it r... | <p>The spec says "It does not return anything"; your program does.</p>
|
using regex in searching for a field using get_field_by_name <p>I am trying to get a uvm register field by name in systemverilog. I want to use regex, so that I can use a pattern for the field name. Here is my register fields:</p>
<pre><code>YY_XXX_2_N
ZZ_BBB_3_N
UU_AAA_8_N
MM_CCC_4_N
YY_WWW_9_N
</code></pre>
<p>as y... | <p><code>get_field_by_name()</code> needs an exact match to return a single handle to a field. What you need to do is use <code>get_fields()</code> to build the list of fields, and then use the SV find()</p>
<pre><code>uvm_field_reg all_fields[$], selected_fields[$];
all_fields = get_fields();
selected_fields = all_f... |
Angular2 DI: Injecting a global extended service (Can't resolve all parameters) <p>I have just upgraded my Ionic app codebase to ng2 Release, using AngularFire2. In the codebase, I have a global service called FirebaseService which extends AngularFire.</p>
<pre><code>@Injectable()
export class FirebaseService extends ... | <p>There are two possible problems:</p>
<ol>
<li><p>As mentioned by @shinglesmingles, you should add the decorator <code>Injectable</code> to your service class declaration</p></li>
<li><p>Avoid circular references, though they generally work, there are cases they don't</p></li>
</ol>
<p>Example of [2]:</p>
<pre><co... |
Hibernate- One to Many Mapping - save relation mapping but not the nested Entity <p>I have Entity A(Role) having OneToMany relationship to Entity B(Functions), when I am trying to save A, when I run it first time everything works well, next time when I want to add new role with some of functions, I get error as UNIQUE ... | <p>Please, use a <code>@ManyToMany</code> mapping.</p>
|
How to change static property value in runtime C#? <p>I have bind the static property in xaml.</p>
<p>C#</p>
<pre><code> public static WrapperClass
{
public static string Filter
{
get
{
return this.GetString(CultureInfo.Culture, "Filter");
}
}
</co... | <p>With WPF 4.5 you can do it like this : </p>
<p><code><TextBox Text="{Binding Path=(local:WrapperClass.Filter), Mode=TwoWay}" /></code></p>
|
Syntax error: "(" unexpected -- with !(*.sh) in bash script <p>Regards,</p>
<p>I want to run a sh file:</p>
<pre><code>#!/bin/bash
for f in !(*.sh); do ffmpeg -i "$f" -vf yadif=0:-1 -threads 0 -c:v libx264 -pix_fmt yuv420p -r 29.97 -b:v 3000k -s 1280x720 -preset:v slow -profile:v Main -level 3.1 -bf 2 -movflags fasts... | <p>This is not a "sh file" -- it's a <strong>bash</strong> script. If you run it with <code>sh yourscript</code>, it will not work (as extglobs, the shell feature you're trying to use, aren't supported in POSIX sh); it needs to be run only with <code>bash yourscript</code>, or with <code>./yourscript</code> when starti... |
How to use try_files with 2 or more roots <p>I have looked hi and low and found no such implementation and am wondering if what I am trying is even possible. I have 3 relative paths that serve up static content:</p>
<pre><code>Path1: /usr/local/www/style1/static/...
Path2: /usr/local/www/style2/static/...
Path3: /usr... | <p>You could use a common root and try the three directories in the <code>try_files</code> statement:</p>
<pre><code>location /static {
root /usr/local/www;
try_files /style1$uri /style2$uri /style3$uri =404;
}
</code></pre>
|
Why and What purpose use this <?= ?> syntax in cakephp <p>Why and What purpose use this <code><?= ?></code> syntax in cakephp</p>
<p>code example</p>
<pre><code><h1>
Getting All bookmarks with certain Tags:
<?= $this->Text->toList( $tags ); ?>
</h1>
<section>
<?php ... | <p>It is the short echo syntax. It is a built-in part of PHP not specific to the CakePHP framework. However, the <a href="http://book.cakephp.org/3.0/en/contributing/cakephp-coding-conventions.html#short-echo" rel="nofollow">CakePHP coding standards</a> state that it should be used in template files instead of <code>&l... |
GORM for MongoDB: Derived Property? <p>I am trying to build a criteria of comparing the value of a derived property of adding two fields as shown in
<a href="http://stackoverflow.com/questions/15254483/can-i-do-a-math-operation-inside-a-createcriteria">Can I do a math operation inside a createCriteria</a>, i.e.</p>
<... | <p>derived properties are a Hibernate/SQL specific feature and are not supported in GORM for MongoDB. An alternative is to simply do this in code:</p>
<pre><code>class SumFormula {
Integer column1
Integer column2
Integer getSum() { column1 + column2 }
}
</code></pre>
|
How to increase the size of a subplot figure in MATLAB <p>I am trying to create a summary figure that consists of multiple subplots. The issue is that I can not increase the overall size of the figure past the size of the screen. I am trying to create a 12 by 8 subplot so I can view all the figures from an experiment a... | <p>If you want to save the whole figure, don't look at the figure itself, but use the <a href="https://fr.mathworks.com/help/matlab/ref/print.html" rel="nofollow"><code>print</code></a> function to configure the renderer.</p>
<p>Try something like:</p>
<pre><code>print('-r1200','Plot','-dpng',)
</code></pre>
<p>This... |
Changing a global variable in a function without using global keyword <p><a href="http://i.stack.imgur.com/EQUph.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/EQUph.jpg" alt="screenshot of code from a textbook"></a></p>
<p>Here is my code:</p>
<pre><code>def L_value_Change(k):
global L
L = k
retu... | <p>You need the <code>global</code> keyword when you want to rebind the global variable to a different object. But you don't need it if all you want to do is change a mutable object. In your case <code>L</code> is a list and can be mutated in place with a slice operation <code>L[:] = k</code>. To demonstrate:</p>
<pre... |
one page website anchor only works properly in chrome <p>I created my online portfolio and it's one page, I used anchor tags on the top menu which work perfectly in chrome but in explorer and Firefox when you click the skills tab it lands somewhere in the middle of my work anyone know why a simple tag might not load ri... | <p>It seems that you make an anchor with an <code><a></code> element with the <code>name</code> parameter. To make an anchor, you need an <code>id</code>. </p>
<p>Example:</p>
<pre><code><div id="skill"/>
</code></pre>
<p>or with a <code>div</code> with some content:</p>
<pre><code><div id="skill">... |
Chrome doesn't display Javascript alert box <p>System: Windows Server 2012 via Parallel's 11</p>
<p>I'm experiencing a strange problem on Google Chrome 53.0.2 with the Javascript alert box.</p>
<p>As you know, when the alert() function is fired in the browser, a dialog box will immediately be displayed in the browser... | <p>I had a similar issue in recent weeks.
After much testing I was able to correct this by the following means</p>
<ol>
<li>Settings> Show advanced settings</li>
<li>Scroll to bottom</li>
<li>Remove the checkmark from "use hardware acceleration when available"</li>
</ol>
<p>I won't pretend to know why this worked.</p... |
Class with templated class from different header wont compile <p>I have multiple errors with my class, either "string", a variable, or the template class isnt declared. Not sure whats wrong with my header files or how I'm setting it up. </p>
<p>Now my program uses 2 classes, one is a templated class that uses dynamic ... | <p>in your .h file. You should just <code>#include <string></code>... there's no need to worry about compile-time problem doing that, even in production. Its a standard header, and thus will not change as much as your program code will.</p>
<p>Otherwise, attempting to forward declare <code>std::string</code> isn... |
Eclipse NEON CDT doesn't recognize c++11/14 header content <p>Eclipse NEON.1 4.6.1 with CDT 9.1.0, g++ 5.4.0</p>
<p>It doesn't recognize all c++11/14 features. It does recognize keywords like <code>auto</code> and <code>nullptr</code>. It doesn't however recognize things coming from headers which depend on the correct... | <p>Found out what the problem was. When I added the <code>-std=c++14</code> option in the command to get the compiler spec on the provider tab I added them for the "Build" configuration as I was using that configuration. Turned out that the indexer was set to always use the "Build" configuration. After I added the sett... |
Python 3 pandas directory search for a string in filename <p>Hello again StackExchange!</p>
<p>Attempting to print all files in a directory but this time I only want to print all of the .csv files that have the string ..."AMX_error"...csv somewhere in the filename. I have the "all .csv" working, but am missing that b... | <p>Unless you have a reason for filtering the files first, you can simply check that the string of interest is in the filename while you're in the for loop. </p>
<pre><code>import glob
import pandas as pd
path = r'C:\Users\Desktop\Experiment'
#Following command to search for string in the filename
allFiles = glob.gl... |
Write a command that lists the unique values (remember, name/value pairs) that are actually set (i.e. ignore commented lines) <p>The /etc/ssl/openssl.cnf file contains a number of name, value pairs of the form âname = valueâ. It also contains a number of other things including headers, in which the line starts wit... | <p>Check out <code>awk</code> for questions that require you to go line by line, parsing the line, and making decisions on what get's outputted. For example:</p>
<pre><code>awk -F"[= \t]+" '$0 ~ /^[^#\r\n\t \[]/ {print $1, $2}' /etc/ssl/openssl.cnf
</code></pre>
<p>awk moves through files line by line. We first speci... |
How to centering a div horizontally without width in old version browsers <p>How to centering a div horizontally without width in old version browsers which are not supported display:inline-block property.</p>
<p>How to centering my <strong>.container</strong> div horizontally without width</p>
<pre><code><div cla... | <p>Make the content you want to center (<code>.container</code>) inline-block. This way you can center it with <code>text-align: center</code> on the parent div.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-cs... |
White border position:fixed even if margin:0 and padding:0 <p>This white border is driving me crazy in IE and Edge, it does not appear in Chrome and Firefox.</p>
<p>If you follow the link:</p>
<p><a href="http://might.to" rel="nofollow">Might.to</a></p>
<p>You will see that at the bottom of the page there is a white... | <p>Try to add
width: 100%;
height: 100%;
border: none;</p>
|
How to change value of an input with buttons <p>I have a form in which I want the user to be able to set the value in 15 minute increments with the use of two buttons.</p>
<p>Here is what I have so far:</p>
<pre><code><div class="form-group">
<label class="control-label " for="time">Authorisation Dura... | <p>You can use native <a href="/questions/tagged/html5" class="post-tag" title="show questions tagged 'html5'" rel="tag">html5</a> <code>time</code> input:</p>
<pre><code><input type="time" step="900">
</code></pre>
<p>Try it:</p>
<p><div class="snippet" data-lang="js" data-hide="true" data-console="tr... |
Why input stream object fails after reading file to the end? <p>Here is the code .
It is giving the EXACT output as shown below means it is reading the file.
But it is also showing <code>fails</code> as you can see it means <code>fin.fails()</code> is <code>true</code>.
I want to know why this is true although i am su... | <p>Still can't find why the <code>fin.fails()</code> is true because i think no one willing to
But i figured out to read white spaces and file without making <code>fin.fails()</code> =<code>true</code> .
just replace the <code>while(!fin.eof())</code> with <code>while(fin.get(ch))</code> and remove the <code>fin.get(ch... |
How do I mount multiple rails engines? <p>What should I do if I want to be able to host multiple instances of the same rails engine (bot)? This will be separate engines (using the same code) but using different model attributes, data, etc.. </p>
<p>The only way that makes sense to me is to mount separate engine (bots... | <p>Yeah your idea will basically work. Here's an example for mounting the enginge 10 times at 10 different routes:</p>
<pre><code>Rails.application.routes.draw do
(1..10).each do |idx|
mount MyEngine::Engine => "/bot_#{idx}"
end
end
</code></pre>
|
upgrading to sublime text 3 3126 build, it stopped showing "install package" option <p>I recently upgraded to sublime text 3 3126 build. After this update, latest udpate stopped showing "install package" option. I could not find answer to this other than ignoring couple of packages which sublime 3 doesnt like. I am wai... | <p>Add following to ignore list -</p>
<p>Preferencecs -> Settings</p>
<pre><code>"ignored_packages":
[
"ApplySyntax",
"BracketHighlighter",
"Color Highlighter",
"DictionaryAutoComplete",
"SublimeCodeIntel",
"Vintage",
"WordHighlight"
],
</code></pre>
<p><a href="https://github.com/wbond/p... |
Ns_error_domain attribute only valid on enum/struct/union/class error building Realm 2.0.0 + Xcode 8 <p>I'm trying to build an Objective-C project in Xcode8 with Realm 2.0.0 (installed via CocoaPods) and I'm getting a Semantic Issue error:</p>
<blockquote>
<p>Ns_error_domain attribute only valid on enum/struct/union... | <p>It turns out that <a href="https://github.com/realm/realm-cocoa/issues/4164" rel="nofollow">some Realm headers were unintentionally incompatible with Objective-C++ when using the C++98 language dialect</a>. This has been <a href="https://github.com/realm/realm-cocoa/pull/4168" rel="nofollow">fixed on Realm's master ... |
How to share tasks/operations in MSBuild targets? <p>I have an msbuild script that performs some copy operations. It actually does a whole boat load of copies and other things, including messages, deletes, removedir, its own ItemGroup sections, etc.</p>
<p>I need to duplicate this target but only 1%-ish of its XML is ... | <p>Create a target file and use <a href="https://msdn.microsoft.com/en-us/library/ms171464.aspx" rel="nofollow"><code>Import</code></a> to import target in your project file.</p>
<p>Your target file is something like this:</p>
<pre><code><Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer... |
C if statement comparing two integer variables to the same constant <p>I am trying to compare two integer variables to a same constant. Apparently in this case, both variables have the same default values. I tried to simplify the comparison statement like this:</p>
<pre><code>if (po->app_tag == po->inst_id == 0)... | <p>Due to associativity of the <code>==</code> operator (it associates from left to right), </p>
<pre><code>po->app_tag == po->inst_id == 0
</code></pre>
<p>is interpreted as:</p>
<pre><code>(po->app_tag == po->inst_id) == 0
</code></pre>
<p>That's how the language is defined.</p>
<p>Using </p>
<pre><... |
Weighted rowSums of a matrix <p>I have a matrix like this:</p>
<p><a href="http://i.stack.imgur.com/1ckfJ.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/1ckfJ.jpg" alt=""></a></p>
<p>I would like to sum every value of a single row but with a ponderation.</p>
<p>Example: Given a specific row, the sum would be... | <p>You are looking for a matrix-vector multiplication. For example, if you have a matrix:</p>
<pre><code>set.seed(0)
A <- matrix(round(rnorm(9), 1), 3)
# [,1] [,2] [,3]
#[1,] 1.3 1.3 -0.9
#[2,] -0.3 0.4 -0.3
#[3,] 1.3 -1.5 0.0
</code></pre>
<p>And you have another vector <code>x</code>, which is what you ... |
How to resolve the issue in unix with command "start ssh" <p>Hi I am getting below error :</p>
<p>raahool@ubuntu:~$ start ssh
start: Name "com.ubuntu.Upstart" does not exist</p>
<p>Although i already install the Upstart package.</p>
<p>Please advice.</p>
| <p>Managing services (start, stop, reload, restart) require elevated permissions. Run your command with sudo and (assuming you have sudo privileges) it will work.</p>
<pre><code>sudo start ssh
</code></pre>
|
Transfer data from factory to controller <p>Somehow I am not able to get my data from the factory method to the controller. I am using javascript remoting and factory is given below </p>
<pre><code>function userRecordFetchFactory($rootScope) {
var custRec = {};
return { ... | <p>Suggest you write your factory in a simpler way to read it. All your nesting is causing you not to see the whole thing easily</p>
<p>Put all the accessible members up top</p>
<pre><code>// pass functions as references to object properties
// can easily see the whole factory object at top of the file
var custRec =... |
VBA code to convert heights <p>On an Excel spreadsheet order form, there is a column for heights. They need to be in a 3 digit format: 500, 506, 510, etc. I need a macro to convert the values in this column to follow that format.</p>
<p>I created these Subs, and it does work, but it's very slow and crashes Excel somet... | <p>There's no need to perform repeated replacements on each cell value. In the best case scenario, you would only match one of them. The worst case scenario is that you match <em>more</em> than one, which means that your output is going to be incorrect. I'd just use a regular expression and then format the matches:<... |
Multiple apache subdomains - main domain and subs all same CNAME, IP and PORT. One subdomain works, the other doesn't <p>I am trying to create a setup so that I have the following three domains:</p>
<p><code>mydomain.com
files.mydomain.com
mail.mydomain.com</code></p>
<p>I have managed to get the first two to work bu... | <p>There is a dot:</p>
<pre><code><VirtualHost .*:80>
^
^
^
</code></pre>
|
Notify all clients when specific event happens. Where to subscribe to events? <p>I googled two examples on how I can notify all clients when specific event happens and I'm confused which of them I should use:</p>
<p>Example 1 - <a href="http://www.nullskull.com/a/1360/notify-client-applications-using-wcf-callbacks.asp... | <p>If you are going to use WCF, then you need to implement broadcasting events with a <a href="https://msdn.microsoft.com/en-us/library/ms731064(v=vs.110).aspx" rel="nofollow">duplex WCF service</a> (broadcaster service). The first link does mention this.</p>
<p>I think the events you are referring to are the operatio... |
Pass parameter from form to Controller Laravel <p>I'm trying to understand how to pass parameters via URL in Laravel.</p>
<p>In my case I've a home page (/) (HomeController@get__home and view home) that contains n data get from a database table.
The user can select one of them and go to the next page.</p>
<p>The seco... | <p>Since you're using a form with post method, you should define the route like this:</p>
<pre><code>Route::post("/login", "LoginController@login");
</code></pre>
<p>And then call it in the form action:</p>
<pre><code><form action="{{action('LoginController@login')}}" method="post">
<select name="positi... |
Python writing (xlwt) to an existing Excel Sheet, drops charts and formatting <p>Am using python to automate some tasks and ultimately write to an existing spreadsheet. Am using the xlwt, xlrd and xlutils modules. </p>
<p>So the way I set it up is to open the file, make a copy, write to it and then save it back to the... | <p>Could you do this with win32com?</p>
<pre><code>from win32com import client
...
xl = client.Dispatch("Excel.Application")
wb = xl.Workbooks.Open(r'\test\test2.xls')
ws = wb.Worksheets[10]
for i,e in enumerate(WSM_1V,1):
ws.Cells[i][0].Value = float(e)
wb.save
wb.Close()
xl.Quit()
xl = None
</code></pre>
|
AngularJS ng-click function not bringing info to new view <p>I am trying to make a friends list. I have it set up so a user can search for friends and click on their image to see their profile, this takes them to the profile where there is information displayed that I have in an array in my service. I have an 'add frie... | <p>In your service, you returns nothing.</p>
<p>Can you try in your service:</p>
<pre><code> this.userFriends = [];
this.addFriend = function(profileObj) {
this.userFriends.push(profileObj);
};
this.removeFriend = function(profileObj) {
for( var i = this.userFriends.length - 1; i >= 0; i--) {
... |
Is there a command for creating an app using cookiecutter-django? <p>Once a Django project has been created using cookiecutter-django, is there a command like <code>python manage.py startapp <app_name></code> to run instead of writing the new app from scratch?</p>
| <p>Cookiecutter Django renders a Django project, and included with the files is a <code>manage.py</code> module. If you have Django installed, you can just call <code>python manage.py startapp <app_name></code> and it should just work. </p>
|
Heroku local web debug with Intellij IDEA <p>I'm writing a telegram bot in Java. This bot will be hosted on Heroku in future. For now I'm just building it with Gradle and run it locally with:</p>
<pre><code>heroku local web
</code></pre>
<p>command. Is there any way to debug it using Intellij IDEA?</p>
| <p>Yes, running <code>heroku local</code> starts a normal Java process under the hood. You can confirm this by running <code>jps</code> (unsure if that works on Windows).</p>
<p>In order to debug with Intellij, you'll need to provide to proper JVM options to enable debugging. For example:</p>
<pre><code>-Xdebug -Xrun... |
Unit testing AEM 6.1 and mocking sling, Jcr and Osgi <p><strong>background</strong></p>
<p>Hi, </p>
<p>So I'm recently started at a company using AEM 6.1 and I'm also a junior developer. </p>
<p>When I pair with my buddy(senior developer) he generally drives. But doesn't write unit tests, this bugs me. He has explai... | <p>I felt the same way when I first began developing in AEM. Over time I pushed to change that for my company, and now we have an environment where we unit test our AEM code.</p>
<p>Why is it difficult to test AEM code? I think the main reasons boil down to 2 points:</p>
<ol>
<li>Many Adobe examples come in the for... |
Django REST Framework prevent multiple validation queries in batch create <p>When trying to do bulk inserts using Django/Django Rest Framework 3, the validation step is causing <code>n * related_model_fields</code> queries, which is causing a lot of unnecessary latency. </p>
<p>In the example below, <code>Thing</code>... | <p>You'll likely want to roll your own validators and replace the default's one. For example, on the <code>User</code> you'll have a UniqueValidator that will query the DB for existing <code>username</code>. You could remove it and deal with that constraint explicitly by yourself - done that for some batch import.</p>
|
USB Control of a Sony Action Camera <p>I am trying to find an action camera that I can control over USB and then download the video over USB, all programmatically. I would like to use one of the Sony ones, preferably the HDR-AS50. However I want to know whether controlling it over USB is doable before I go out and buy ... | <p>Unfortunately there is no supported way to control the camera over USB. You can have a look at this thread to see related questions on this topic:</p>
<p><a href="http://stackoverflow.com/search?q=%5Bsony-camera-api%5D+usb">http://stackoverflow.com/search?q=%5Bsony-camera-api%5D+usb</a></p>
|
rework preg_replace with preg_replace_callback <p>I've seen many answers about this but as this one is a bit specific, I still need some help. I'm trying to update Blogstudio's <a href="https://github.com/Blogestudio/Fix-Serialization/blob/master/fix-serialization.php" rel="nofollow">Fix Serialization</a> script which... | <p>The problem:</p>
<pre class="lang-none prettyprint-override"><code>s:(\d+): # group 1
( # group 2
[\\\\]?"[\\\\]?"
|
[\\\\]?"
((.*?)[^\\\\]) # group 3 (and 4)
[\\\\]?"
)
;
</code></pre>
<p>As you can see there's an alternation with 2 branches inside the group 2. Groups 3 (and 4) are in the... |
How to sort ingredients inside NSString? Ex. 1/2 Cup Milk, 1/4 Spoon Powder <p>I have list of ingredients like below in NSArray as NSString object.</p>
<pre><code>"1/2 Cup Milk",
"125 grams Cashew",
"2 green onions",
"1/4 Cup Sugar",
"1/6 Spoon Salt",
"3/2 XYZ",
"One cup water",
"Almond oil"
</code></pre>
<p>And I wa... | <p>You can define a category on <code>NSString</code> to compare numbers (including fractions):</p>
<pre><code>@interface NSString (Number)
- (NSNumber * _Nullable)numberValue;
- (NSComparisonResult)compareNumber:(NSString *)string;
@end
@implementation NSString (Number)
- (NSNumber *)numberValue {
NSError *erro... |
How to compile typescript files in a specific folder with Angular Quickstart <p>I've used Angular <a href="https://angular.io/docs/js/latest/quickstart.html" rel="nofollow">Quickstart example</a> as a beginning for my angular 2 application. I'm currently trying to compile files in a separate directory to avoid the mess... | <p>I had this same problem. Check it out in this issue someone raised. <a href="https://github.com/typings/typings/issues/69" rel="nofollow">Link to Github issue</a></p>
<p>Simply specify the directory (outDir) in <code>tsconfig.json</code> like shown below.</p>
<p><div class="snippet" data-lang="js" data-hide="fals... |
how to remove event listener from this during callback <p>I have a page with some javascript for listening to some stories which are in a series of audio files. I use the popcorn library to add footnotes to particular timestamps which highlights the words in the text on the page as the audio plays. I have a javascrip... | <p>Looks like stampX is recreated every time because you declare it inside the onreadystatechange function.</p>
<p>This means every addEventListener you do gets a different callback function.</p>
<p>What you need to do is seperate it's logic, move it outside, higher on the lexical scope, for exampl where you declare ... |
Arrays and Sum Iffs <p>I did ask this question before but its parameters have expanded and I'm none-the-wiser.</p>
<p>So. I wish to create an array-based calculation as I am trying to learn better excel.</p>
<p>In this instance, I have the following columns (excuse me - I couldn't seem to make a table)</p>
<pre><cod... | <p>All you need to do is add the two new test to the Boolean strings:</p>
<pre><code>=SUMPRODUCT(($A$1:$A$7="London")*($B$1:$B$7="PPM")*($C$1:$C$7>=40)*($C$1:$C$7<80),$C$1:$C$7,$D$1:$D$7)
</code></pre>
<p><a href="http://i.stack.imgur.com/Ky1Kt.png" rel="nofollow"><img src="http://i.stack.imgur.com/Ky1Kt.png" a... |
how to properly build spring boot docker image using Dockerfile? <p>I have the following spring boot project structure:</p>
<pre><code>pwd
/Users/eugene/Documents/Dev/Java/workspace/Springboot-Receiver-API
tree
.
âââ Dockerfile
âââ pom.xml
âââ src
â  âââ main
â  âââ java
â... | <p>AFAIK you could either use the <a href="https://maven.apache.org/plugins/maven-resources-plugin/" rel="nofollow">maven-resources-plugin</a> to make sure that the Dockerfile is at the appropriate location (and then you could even put the name of the jar file as a variable into your Dockerfile):</p>
<pre><code><bu... |
LESS.php - where does it save the compiled file? <p>I am trying to setup a php LESS parser: less.php (<a href="https://github.com/oyejorge/less.php#basic-use" rel="nofollow">https://github.com/oyejorge/less.php#basic-use</a>).</p>
<p>I've written a basic code from the example:</p>
<pre><code><?php
require_once '... | <p>According to its documentation, <code>getCss</code> does not save the CSS. In fact, the variable <code>$css</code> will contain the CSS. To write the value of <code>$css</code> to disk, use for example <code>file_put_contents</code>. I.e:</p>
<pre><code><?php
require_once 'less.php/Less.php';
$parser = new Less... |
AlarmManager with right side icon for repeating alarms <p>I'm trying to create an alarm clock app.</p>
<p>The thing is that I want to display the Alarm icon to the right side of the app when the user enables an alarm.<br>
I know that <code>AlarmManager.setAlarmClock()</code> does that, but I want to repeat the alarm, ... | <p>I found the answer.
You just need to add:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>Intent alarmChanged = new Intent("android.intent.action.ALARM_CHANGED");
... |
React - componentWillReceiveProps does not execute when component rendered in unit test <p>New to React, so apologize in advance if this is an ignorant question. I'm using componentWillReceiveProps to execute a function post-render. The function is passed in as a prop. Trying to write a unit test to show that the passe... | <p><code>componentWillReceiveProps</code> is not called on the initial render, as stated in the docs:</p>
<p><a href="https://facebook.github.io/react/docs/component-specs.html#updating-componentwillreceiveprops" rel="nofollow">https://facebook.github.io/react/docs/component-specs.html#updating-componentwillreceivepro... |
Status code 400 on post message to influxdb <p>I'm trying to post a json file to influxdb on my local host. This is the code:</p>
<pre><code>import json
import requests
url = 'http://localhost:8086/write?db=mydb'
files ={'file' : open('sample.json', 'rb')}
r = requests.post(url, files=files)
print(r.text)
</code></pre... | <p>Writing data with JSON was deprecated for performance reasons and has since been removed.</p>
<p>See GitHub issue comments <a href="https://github.com/influxdata/influxdb/pull/2696#issuecomment-107043910" rel="nofollow">107043910</a>.</p>
|
Creating a new database using NPoco <p>I'm trying to create a database using NPoco. I would like to know how I could do that ? Please list out the ways to create/initiate Database in Npoco .Thanks in Advance</p>
| <p>You don't. Npoco is not responsible for creating the database and scheme etc. It's a micro orm for querying and mapping.</p>
<p>You need to script off your database yourself.</p>
|
MT4 expert trade panel - "OBJ_RECTANGLE_LABEL" <p>MetaTrader4 Expert Advisor for Trade Panel.<br>
How can I link some <strong><code>OBJ_RECTANGLE_LABEL</code></strong> for moving with another single object?</p>
| <h2>Link 'em indirectly</h2>
<p>There is no direct support for linking a few GUI-objects to move with another one.</p>
<p>This does not mean, it is not possible to have it working like this.</p>
<p>In one Augmented Trader UI-tool, I needed to have both all the GUI-components and some computed values behaving under s... |
Getting Second-to-Last Element in List <p>I am able to get the second-to-last element of a list with the following:</p>
<pre><code>>>> lst = ['a', 'b', 'c', 'd', 'e', 'f']
>>> print(lst[len(lst)-2])
e
</code></pre>
<p>Is there a better way than using <code>print(lst[len(lst)-2])</code> to achieve th... | <p>There is: negative indices:</p>
<pre><code>lst[-2]
</code></pre>
|
Word VBA: Insert a picture without known aspect ratio of file <p>.addPicture requires width and height, but this could end up distorting the image. Is there any way to use .LockAspectRatio = msoCTrue when adding the file image?</p>
<p>Also, how do you stipulate a page to put the canvas or the picture? Macro recorder n... | <p>Set the canvas size to 0 and lock it's aspect ratio, <em>then</em> add the picture. The canvas will scale to accommodate it. After the image is loaded, <em>then</em> scale the canvas as needed:</p>
<pre><code>Set sCanvas = ActiveDocument.Shapes.AddCanvas(MillimetersToPoints(20), MillimetersToPoints(20), 0, 0)
sCa... |
Laravel Blade Directives not executing when template loaded from string <p><strong>EDIT</strong>: The code snippet below, where <code>view</code> takes an array <code>['template' => 'my template']</code> as the first argument is a feature of <code>wpb/string-blade-compiler</code> which is overriding the native larav... | <p>So, I did a little testing on my own server and came up with a solution:</p>
<p>My condensed code in a singe route:</p>
<pre><code>Route::get('/test', function () {
$template = Blade::compileString('@hello(derek) !');
ob_start();
try {
eval('?>' . $template);
} catch (\Exception $e)... |
Why does WebRTC needs ICE protocol to operate? <p>As far as I understand, ICE protocol is used for discovering the nodes/devices from the end-user device to "the outside".</p>
<p>I don't understand why it's needed. Isn't packet-routing is the responsibility of network devices like routers and switches? They should fin... | <p>NAT is a kludge, put in place to try to conserve IPv4 addresses until IPv6 becomes ubiquitous, and it breaks the end-to-end connectivity which is the promise of IP. Because of that, some things don't work correctly through NAT. There are various kludges to work around the NAT kludge, and ICE is part of that. This is... |
php calculated CRC-CCITT (XModem) <p>I'm trying to implement a CRC-CCITT (XModem) check in php without success. Does anyone know how to do it? I expected crc16('test') will return <code>0x9B06</code>.</p>
| <p>Here is a simple bit-wise calculation of the XMODEM 16-bit CRC, in C:</p>
<pre><code>#include <stdint.h>
unsigned crc16xmodem_bit(unsigned crc, void const *data, size_t len) {
if (data == NULL)
return 0;
while (len--) {
crc ^= (unsigned)(*(unsigned char const *)data++) << 8;
... |
New append method on DOM Elements? <p>On firefox up to 48, Safari up to 9, IE and Chrome:</p>
<pre><code>var p = document.createElement('p');
alert(p.append); // undefined
</code></pre>
<p>But starting from firefox 49 and Safari 10 onwards:</p>
<pre><code>alert(p.append); // function append () { native code }
</cod... | <p>It's on <a href="https://developer.mozilla.org/docs/Web/API/ParentNode/append" rel="nofollow">MDN</a>, you need to look better :-)</p>
<blockquote>
<p>The <strong>ParentNode.append</strong> method inserts a set of Node objects or DOMString objects after the last child of the ParentNode. DOMString objects are inse... |
TypeError: unsupported operand type(s) for *: 'PCA' and 'float' <p>EDIT:</p>
<p>Here is the head of the data csv:</p>
<pre><code> Fresh Milk Grocery Frozen Detergents_Paper Delicatessen
0 12669 9656 7561 214 2674 1338
1 7057 9810 9568 1762 3293 1776
2 6353 8808 7684 ... | <p><code>PCA.fit()</code> tansforms the model in-place and returns <code>self</code> so that you can chain other model operations. So, after</p>
<pre><code>pca_samples = pca.fit(log_data)
</code></pre>
<p><code>pca_samples</code> is just another reference to <code>pca</code>.</p>
|
Is it possible to update multiple json object using just one function and one button using angularjs? <p>Her's the HTML code</p>
<pre><code><ion-view view-title="Reviewer Title">
<ion-content>
<div class="content no-header">
<ion-nav-bar class="bar-assertive-900" align-title="left">
&... | <p>Certainly!</p>
<p>First you should inject $q into your service as we will use it below.
Using Q you can pass an array of promises to be resolved.</p>
<pre><code>service.update = function (rv_id,qs_id,chs_id, rv_object,qs_object,chs_object) {
return $q.all([
$http.put(getUrlForId(id), object),
$... |
Identify and replace all sum-to-zero rows in a list of binary matrices <p>I'm looking for a solution to the following problem - there must be a simple answer!</p>
<p>I have a list of binary matrices,and I would like to identify all the rows for every matrix in which every element on that row is zero (= row sums to zer... | <p>For a single matrix <code>A</code>, you can do</p>
<pre><code>A[!rowSums(A), ] <- 1 / ncol(A)
</code></pre>
<p><strong>Example</strong></p>
<pre><code>A <- structure(c(0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0), .Dim = c(4L, 4L))
# [,1] [,2] [,3] [,4]
#[1,] 0 0 0 1
#[2,] 0 1 1... |
Python user input file path <p>I am working on an easy project which requires user input a path for program and goes to this path
Here, I Worte on OSX: </p>
<pre><code>from pathlib import Path
def main():
user_input_path = Path(input())
</code></pre>
<p>And debug like this</p>
<pre><code>>>> /Users/akr... | <p>The <code>input()</code> function reads in the input, and then tries to parse it as if it's something in Python notation. Instead, use the <code>raw_input()</code> function, it does not parse anything and returns the input as a string.</p>
|
Does running 2 Linux shell commands with & make them start at the same time? <p>My end goal is to start 2 commands at the same time (or at least a few hundred ms delta from each other). I read about <code>&</code> in Linux. For ex:</p>
<p><code><linux_shell_cmd_1> & <linux_shell_cmd_2></code></p>
... | <p>Given as your goal is to be within a few hundred ms delta, this should work as-needed on typical modern hardware under a reasonable quantity of load.</p>
<pre><code>cmd1 & cmd2 # start cmd1 in background and cmd2 in foreground
</code></pre>
<p>...starts <code>cmd1</code> in the background (without waiting ... |
How can I launch clion shortly using commandline? <p>I downloaded clion and made desktop entry, but I don't know how to launch clion on commandline. As we can launch sublime-text by typing <code>subl</code> on commandline, how can I make shortcut for clion using commandline?</p>
| <p>Three most obvious possibilities:</p>
<ol>
<li>Create a symlink from clion.sh to somewhere in your PATH</li>
<li>Add the bin/ directory to Your PATH</li>
<li>Write a shellscript yourself to launch Clion.
....</li>
</ol>
|
Seeding values into asp:controls <p>I'm confused over this issue in my code and hoping that someone sees something that I'm missing here. The top part of this works perfectly but the same basic code being executed on two other similar fields directly below fails to inject the value into the text box even though I've st... | <p>Do you have a typo? uuname vs uname and uudate vs udate?</p>
<pre><code>TextBox **uuname** = (TextBox)AddItemFv.Row.FindControl("AssetEnteredByTextBox");
if (**uname** != null)
**uname**.Text = Session["RegUser"].ToString();
TextBox **uudate** = (TextBox)AddItemFv.Row.FindControl("AssetEnteredText... |
Is it possible to retrieve elements from a page and save them? <p>I am in the process of making a chatbot for a chat and i will need to download elements from a page, like example.com.
What i mean is to get an element from a page, like</p>
<pre><code><a href="http://www.iana.org/domains/example">More information... | <pre><code> On Error Resume Next
Set File = WScript.CreateObject("Microsoft.XMLHTTP")
File.Open "GET", "http://www.microsoft.com/en-au/default.aspx", False
'This is IE 8 headers
File.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Cent... |
whether Java thread execution for a single instruction based on native CPU or bytecode <p>First of all, I might not describe the problem clearly, please leave a comment since I have limited knowledge about the case I'm asking about </p>
<p>From OCA/OCP Java® SE 7 Programmer I & II Study Guide</p>
<blockquote>
... | <p>The quote is right. You don't have control over what native instructions are executed. There are a lot of architectures and VM types and you can't be sure about all of them.</p>
<p>As for the bytecode for your particular case, if you're curious you can try using <code>-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssemb... |
Java Fibonacci Sequence fast method <p>I need a task about finding Fibonacci Sequence for my independent project in Java. Here are methods for find.</p>
<pre><code>private static long getFibonacci(int n) {
switch (n) {
case 0:
return 0;
case 1:
return 1;
default:
... | <p>There is a way to calculate Fibonacci numbers instantaneously by using <strong>Binet's Formula</strong></p>
<p><strong><em>Algorithm:</em></strong></p>
<pre><code>function fib(n):
root5 = squareroot(5)
gr = (1 + root5) / 2
igr = 1 - gr
value = (power(gr, n) - power(igr, n)) / root5
// round it to t... |
Wordpress wp_query filter using posts_groupby - how to COUNT values in joined table? <p>try to join my custom table to WP_Query, here is my wp_query code</p>
<pre><code> $the_query = new WP_Query( array('post_type'=> $post_type, 'paged' => $paged ,'posts_per_page' => 1, 'meta_query' => $meta_query, 'ta... | <p>Combining your code with my comments (NB: the inner query in the join function is different to yours - the example table you posted doesn't have a <code>business_id</code> column):</p>
<pre><code>add_filter( 'posts_join', 'custom_posts_join', 10, 2 );
function custom_posts_join( $join, $query ) {
global $wpdb... |
How to get tomcat context.xml Parameters values into spring PropertyPlaceholderConfigurer <p>Following is my tomcat context.xml</p>
<pre><code><Parameter name="datasource.url" override="false" value="jdbc:mysql://localhost:3306/"/>
<Parameter name="datasource.username" override="false" value="root"/>
... | <p>Spring approach is correct one.
Create a separate properties file and import in spring:</p>
<pre><code><context:property-placeholder location="classpath*:some.properties"/>
</code></pre>
<p>then
import spring context into your tomcat context:</p>
<pre><code><context-param>
<param-name>cont... |
PrintTo for a pointer in Google Test <p>I can specify how to display the content of an object if a test has failed. To do it, I define the function <code>PrintTo</code> for the class. The result is as desired (the string <code>MyObject as object</code>):</p>
<pre><code>x.cpp:17: Failure
Value of: foo1
Expected: has fo... | <p>As suggested by @AndyG and @olaf-dietsche, the leading <code>const</code> should be removed. These work:</p>
<p><code>Foo* value</code></p>
<p><code>Foo* const value</code></p>
<p>And these does not:</p>
<p><code>const Foo* value</code></p>
<p><code>const Foo* const value</code></p>
<p><code>const Foo*& va... |
Make flex element ignore child element <p>Is it possible to make a flex element ignore a child element so it's size does not affect the other elements?</p>
<p>For example, I have a wrapper with <code>display: flex</code>. It has a header, content, and footer.</p>
<pre><code><div class="wrapper">
<header&... | <p>When you declare .wrapper as <code>display:flex</code> you automatically implicitly declare all its direct child elements to be <code>display:flex-item</code>. You can override the implicit declaration with something as simple as <code>header { display: block; }</code></p>
|
SWAB segmentation algorithm on time series data <p>I'm trying to understand how to do segmentation on a set of time series data (daily stock prices, temperatures etc.) and came across a book that explains how to do the SWAB (sliding-window and bottom-up) segmentation algorithm, but I don't quite understand it. This seg... | <p><strong>Exact steps</strong></p>
<p>Here is a breif description of the methodology:</p>
<blockquote>
<p>The Sliding Window algorithm works by anchoring the left point of a
potential segment at the first data point of a time series,
then attempting to approximate the data to the right with
... |
Add JavaScript animation on Joomla website <p>sorry for my bad english.</p>
<p>I'm trying to add an animated doughnout chart on the home page.</p>
<p>But I can't use JavaScript, what extension should I use (I've tried some without success) ? </p>
<p>How can I activate Jquery for the entire website ?</p>
<p>Can I ad... | <blockquote>
<p>I'm trying to add an animated doughnout chart on the home page.</p>
<p>But I can't use JavaScript, what extension should I use (I've tried
some without success) ?</p>
</blockquote>
<p>The best alternative to a JavaScript chart would be an <a href="https://developers.google.com/chart/" rel="nof... |
VueJS bind model to dynamically inserted form element <p>I'm using VueJS with a form, and I'm having trouble with dynamically added input fields.</p>
<p>The form starts with a single input field, where someone can enter a number, along the lines of:</p>
<p><code><input type="text" name="line[1]" v-model="line[1]"&... | <p>My suggestion is:</p>
<pre><code><input v-for="line in lines" v-model="line" name="line[]">
</code></pre>
<p>Set <code>lines</code> as an array in your <code>data</code>, and <code>push</code> new elements into it.</p>
<pre><code>new Vue({
data: {
lines: ['initial text']
},
methods: {
addLine:... |
How to validate file name and file extension from single Regex? <p>I'm trying to validate my file name and file extension using regular expression. My file name should only contain these characters:'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8... | <p>Something like this?</p>
<pre><code>return /^[a-z0-9_.@()-]+\.txt$/i.test(fileName);
</code></pre>
<p>If you want two separate checks, are you indicate in comments, you might do something like this:</p>
<pre><code>var validFilename = /^[a-z0-9_.@()-]+\.[^.]+$/i.test(fileName);
var validExtension = /\.txt$/i.test(... |
Get struct from C++ dll into a C# application <p>I'm learning C# and have some experience with it. For a small project I need to implement a C++ dll into my C# app. It is a licenseplate recognition sdk.I can initialize it, so calling to this C++ code is working. But I have a problem to receive a struct back from the c+... | <p>I actually had to solve a similar issue to this recently. I simply serialized the data into a struct and shipped it over a local zeromq socket.</p>
<pre><code>//
// Weather update server in C++
// Binds PUB socket to tcp://*:5556
// Publishes random weather updates
//
// Olivier Chamoux <olivier.chamoux@fr.... |
Distance between point and a line (from two points) <p>I'm using Python+Numpy (can maybe also use Scipy) and have three 2D points (P1, P2, P3); I am trying to get the distance from P3 perpendicular to a line drawn between P1 and P2. Call P1 (x1,y1), P2 (x2,y2) and P3 (x3,y3)</p>
<p>In vector notation this would be pre... | <p>Try using the <em>norm</em> function from <code>numpy.linalg</code></p>
<pre><code>d = norm(np.cross(p2-p1, p1-p3))/norm(p2-p1)
</code></pre>
|
Laravel Delete/Forget Cookie not working <p>How do you a delete cookies in Laravel. This is not working:</p>
<pre><code>public function logout(Request $request)
{
$this->guard()->logout();
$request->session()->flush();
$request->session()->regenerate();
Cookie::queue(Cookie::forge... | <p>You can do this by using the code I provided, it's pretty much the same, but I know that this way of doing it works for me. But if you need to do it inline, this might also work for you:</p>
<pre><code>Cookie::queue(
Cookie::forget('cookieName')
);
</code></pre>
<p>This is how I think it should be done.</p>
|
Batch file to find multiple string using findstr and copy files to a folder <p>I am attempting to find multiple strings in files in a directory, there are thousands. I currently run the following command to search the directory:</p>
<pre><code>findstr /s "customerid" *
</code></pre>
<p>Now this allows me to find the ... |
<p>Supposing you want to find all files that contain both words (<code>customer</code> and <code>event</code> in this example), you could use the following script:</p>
<pre class="lang-dos prettyprint-override"><code>@echo off
setlocal EnableExtensions DisableDelayedExpansion
rem // Define constants here:
set "PATT... |
How do I build a grand-child record using the build_ helper method? <p>In my <code>user.rb</code> file, after the user is created, I then create a Profile for the User with the following helper method:</p>
<pre><code>profile = user.profile.build(profile_params)
profile.save
</code></pre>
<p>And after that I want to c... | <p>For a <code>has_many</code> association, use <code>association.build</code></p>
<p>ex.</p>
<pre><code>position = profile.positions.build(position_params)
</code></pre>
|
Split timestamp column CSV <p>I have a CSV file in the following format:</p>
<pre><code>name, lat, lon, alt, time
id1, 40.436047, -74.814883, 33000, 2016-01-21T08:08:00Z
</code></pre>
<p>I am trying to use Python to split the time into new columns so it looks like this:</p>
<pre><code>name, lat, lon, alt, year, mont... | <p>You should try importing the data with Pandas instead of numpy. Panda read_csv handles dates quite nicely</p>
<p>try something like this</p>
<pre><code>import pandas as pd
yourData = pd.read_csv(yourData_Path,delimiter = ',',skiprows = 0,
parse_dates={'time':[-1]},header = 1,na_values = -9999)
</code>... |
Unable to share / reuse specflow steps between two projects in one solution <p>How to reuse steps between two projects in specflow? Though added reference and assembly, the step stays purple. I have two projects(for two different modules) in one solution
<strong>ProjectA</strong>
Feature
Steps
P... | <p>You have to configure the stepAssemblies in the app.config of your test project.<br>
Have a look at the documentation here: <a href="http://www.specflow.org/documentation/Configuration/" rel="nofollow">http://www.specflow.org/documentation/Configuration/</a> (near the end)</p>
<p>basically you need to add a referen... |
Save all but some fields of a struct to a file in MATLAB <p>I have a struct variable which is <code>parameters</code> with some other variables ex <code>foo1</code> ,<code>foo2</code>. <code>parameters</code> has 20 fields. ex. <code>a,b,c,d,e ...</code>
I want to save only 18 fields. I don't want to save <code>parame... | <p>You can either remove the fields before saving it with <code>rmfield</code>.</p>
<pre><code>tosave = rmfield(parameters, {'a', 'b'});
save(filename, '-struct', 'tosave');
</code></pre>
<p>or you could get a listing of all fields, remove the fields you don't want and then pass these to <code>save</code>. This has t... |
Why is there blank text appearing in the toast output when i have a string? <p>As far as i know this will store the user and pass in the variables i made.Then get the text and convert it to a string.Now if that is happening how come only a blank bubble appears when i call it?</p>
<pre><code>package com.set.ultimax.log... | <p>You have to get the text from the <code>EditText</code>s at the time you click the button, instead of getting it on <code>onCreate</code>.</p>
<p>Try this:</p>
<pre class="lang-java prettyprint-override"><code>logIn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perfor... |
tshark packet capture filter by request url <p>I am trying to only capture packets that contain requests to a certain API endpoint so tried to filter using the following:</p>
<pre><code> tshark -i 2 -f 'port 80' -T pdml http.request.uri contains "/google/"
</code></pre>
<p>However I keep getting the following error:<... | <p>Your <a href="https://www.wireshark.org/docs/man-pages/tshark.html" rel="nofollow"><code>tshark</code></a> command is incorrect. To specify a Wireshark display filter, you need to use the <code>-Y</code> option.</p>
<p>Windows:</p>
<pre><code>tshark -i 2 -T pdml -Y "http.request.uri contains \"/google/\""
</code>... |
How can I combine these custom filters? <p>Im trying to create a filter mechanism using this code, which works perfectly (independently):</p>
<pre><code> // Report Filtering
$scope.filter = {};
$scope.getCategories = function () {
return ($rootScope.reportsData || []).map(function (report) {
return repo... | <p>If you select a category and a package you only want to display the reportData that matches with both?</p>
<p>The problem you are having is that you are using your "filter" object for both types of filtering and this in combination with your noFilter function that also verifies if anything is checked on the filter ... |
Access docker bridge using docker exec <p>first of all, I'm a totally n00b in docker, but I got into a project that are actually running in docker, so I've been reading about it.</p>
<p>My problem is, I have to inspect my development environment in a mobile device(iOS). I tried to access by my docker ip because this i... | <blockquote>
<p>I've to access with the docker network bridge instead of docker host(the default).</p>
</blockquote>
<p>Unless you have a protocol that does something odd, like connecting back out to the device from the server, normally accessing <code><macip>:8000</code> from your device would be enough. Can ... |
Compare a numeric value inside a string in Freemarker <p>I have a use case wherein I get an amount in the form of a string and I need to compare it to an integer value. The string has the following conditions:
1. Its first three letters denote the currency
2. The string can consist of commas
For e.g. EUR 540,000 deno... | <p>You can encapsulate that into a <code>#function</code> or a <code>TemplateMethodModelEx</code>. But really, the data-model (template context) you are using is rather strange. Especially if the template is supposed to do math, you should get the numbers (like <code>BigDecimal</code>-s or <code>Integer</code>-s), not ... |
Custom Paging in ASP using Offset and Fetch <p>I am developing an custom pager but stuck that how to use the functionality of Offset and Fetch in ASP.NET<code>SELECT columns from table order by ID
OFFSET 0 rows fetch next 10 rows only</code>
Just want a head start how i use this in my Repeater ... | <p>Not sure what is the question, but it seems like all you need to do is something like this </p>
<p>SELECT columns from table order by ID
OFFSET (Page-1)*PageSize rows fetch next PageSize rows only</p>
<p>Where Page is a page number and PageSize - amount of items on 1 page. </p>
|
Passing ERB code from rails helper <p>i want to send this to views, </p>
<pre><code> if !mapped.correct?
html << "<%= link_to toggle_correct_mapped_path(mapped), class: 'btn btn-success'%>"
else
html << "<%= link_to toggle_wrong_mapped_path(mapped), class: 'btn btn-danger'%>"
end
<... | <p>Fixed. </p>
<p>Had to remove the quotation mark and the <%=. Just,</p>
<pre><code>html << link_to(toggle_correct_mapped_path(mapped), class: 'btn btn-success')
</code></pre>
|
View Double Variable In Memory <p>I'm studing about how programs save data on their memory.
So I made a simple program that contains a global double variable :</p>
<pre><code>#include <iostream>
#include <conio.h>
using namespace std;
double b = 512;
int main(){
getch();
return 0;
}
</code></pre... | <p>4080000000000000 is the double representation of +512.0. double are represented with a sign, an exponent and a mantissa in memory.</p>
<pre><code> 4 0 8 0 00 00 00 00 00 00
0 100 00001000 0000 00000000 00000000 0000000 000000000 00000000 00000000
^ --... |
ORA-12154 -- working in SQL PLUS not in C# <p>I have a working C# application running on my computer. I have given it to a colleague and he gets the dreaded ORA-12154 ERROR. After much searching and trying, we are at a loss at what to try next.</p>
<p>Setup:
C# makes a connection like</p>
<pre><code>using (var conn... | <p>I assume that it is using a different TNS names file and that in that one the <code>MY_TNS_ENTRY</code> does not exist. Check out <a href="http://stackoverflow.com/questions/3073219/how-can-you-tell-which-tnsnames-ora-file-is-used-by-a-net-call">this</a> question to see how to check which file it is using.</p>
|
chrome extension get active tab id in browser action popup <p>I am writing an extension supposed to catch any kind of redirections through a backgroud page, keep track of them for each tab, and outline them in a browser action for each tab.
Thus i want the action popup script to get the active tab's Id to display only ... | <p>You need <code>tabs.query</code>:</p>
<pre><code>chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
var currTab = tabs[0];
if (currTab) { // Sanity check
/* do stuff */
}
});
</code></pre>
<p>"Rare cases" <del>are mostly limited to a detached DevTools window being the current window<... |
How to list the content of cells depending on the value of another cell <p>I have an excel file to organize 4 projects (a,b,c,d), each project being assigned tasks, and everything being organized along a calendar:</p>
<p><a href="http://i.stack.imgur.com/qh79h.png" rel="nofollow"><img src="http://i.stack.imgur.com/qh7... | <p>so, unmerging all cells, and given standard predefined cell contents, it is possible to count the occurence with COUNTIFS as described in this screenshot</p>
<p><a href="http://i.stack.imgur.com/R5U94.png" rel="nofollow"><img src="http://i.stack.imgur.com/R5U94.png" alt="count_cell_occurence"></a></p>
|
Basic Angularjs code not runing? <p>I using very simple code. I seem to be missing something that does run the Angularjs code.</p>
<p>here is my html code:</p>
<pre><code><html>
<head>
<title></title>
</head>
<body ng-app="myAppApp">
<div ng-controller="exempleCtrl">
H... | <p>The issue, as pointed out in the comments, is that you did not include your Javascript code in the HTML file. So assuming you called it something like <code>app.js</code> and is in the same directory as the HTML file, then you need to include it as follows:</p>
<pre><code> <html>
<head>
<title>... |
Using charAt(index) in android <p>I am trying to assign a String to different Buttons, such that each character in the String gets assigned to each Button using the String.charAt(index) method. Like:</p>
<pre><code>private String myString = "34567124";
/*Getting the Views*/
Button bUtton1 = (Button)findViewById(R.id.b... | <p>In this case you might consider splitting <code>myString</code> (this will convert it into an array of single-character strings). Then you can do something like this:</p>
<pre><code>private String myString = "34567124";
//here I am splitting...
private String[] digitsArray = myString.split("");
...
//then you can d... |
Add anchor to react bootstrap table <p>The React Bootstrap Table documents provide <a href="http://allenfang.github.io/react-bootstrap-table/example.html#select-radio" rel="nofollow">an example of how to select a row</a>.</p>
<p>However, I do not see any mention of how to wrap a row in an anchor tag (or a click handle... | <p>Woohoo! Got it! You can add the attribute <code>hideSelectColumn: true</code> and you will be able to register the click callback, and won't have that extra column of radio elements!</p>
<pre><code>var selectRowProp = {
mode: "radio",
hideSelectColumn: true,
clickToSelect: true,
bgColor: "rgb(238, 193, 213)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.