input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Sublime 3 - Add specific plugin syntax highlight for no file type <p>I'm trying to implement the solution I found here:
<a href="http://stackoverflow.com/questions/38737683/how-to-change-the-default-syntax-for-new-files-in-sublime-text-3">How to change the default Syntax for new files in Sublime Text 3?</a></p>
<p>But... | <p>The correct path to use for ApplySyntax for the bash shell syntax highlighting is <code>ShellScript/Shell-Unix-Generic</code>, as per the Package path:
<a href="https://github.com/sublimehq/Packages/blob/master/ShellScript/Shell-Unix-Generic.sublime-syntax" rel="nofollow">https://github.com/sublimehq/Packages/blob/m... |
javascript starnage issue , return undefined if block statements are used <pre><code>function ok(){
return
{
home : "OK"
};
}
</code></pre>
<p>when i code like this the function will return <code>undefined</code></p>
<p><a href="https://i.stack.imgur.com/G1YCn.png" rel="nofollow"><img src="https://i.s... | <p>Javascript engines insert semicolons at certain newline positions. So, your first code is really this:</p>
<pre><code>return;
{
home : "OK"
};
</code></pre>
<p>And it returns nothing.</p>
|
autoComplete (jquery.auto-complete.js) categories with label metadata <p>I am able to do basic labels and categories using </p>
<blockquote>
<p><a href="http://jqueryui.com/autocomplete/#categories" rel="nofollow">http://jqueryui.com/autocomplete/#categories</a></p>
</blockquote>
<p>but my need without using </p>
... | <p>I guess is this you are looking for:</p>
<pre><code>jQuery(document).ready(function($) {
$( ".class" ).autocomplete({
source: [ { label: "labelname1", category: "cat1" }, { label: "labelname2", category: "cat2" }, { label: "labelname3", category: "cat3" } ],
select: function( event, ui ) {
$( ".... |
Lua reference function from inside table inside of the table (Using "self" inside of table) <p>Let's say I have a table A and functions C and B inside of it,can I call table A function B inside of function C, by referencing self?</p>
<pre><code>A = {
B = function()
print("I am B")
end,
C = function... | <p>Yes, using the <code>:</code> method call.</p>
<pre><code>A:C()
</code></pre>
<p><code>:</code> is the equivalent of <code>A.C(A)</code>, but it's safer (pass the exact table reference as first argument).</p>
<p>Since you're defining <code>A.C</code> method inside a table constructor expression and you can't use ... |
Javascript loop to count each specified field and count totals of each <p>I am using the following code when filters a specified carmake and counts how many there are.</p>
<p>Here is the data and code:</p>
<pre><code>var obj = obj = {
"garages": [{
"id": "1",
"carId": "1",
"tags": {
... | <p>You can count manually instead of filter:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var obj={garages:[{id:"1",carId:"1",tags:{483:"carmake1",485:"carmake3"}},{id:"2... |
Django AppsNotLoaded <p>I'm trying to make a python script to put some things in my database;</p>
<pre><code>from django.conf import settings
settings.configure()
import django.db
from models import Hero #Does not work..?
heroes = [name for name in open('hero_names.txt').readlines()]
names_in_db = [hero.hero_name fo... | <p>Django must configure all installed applications before you can use any models. To do this you must call <code>django.setup()</code></p>
<pre><code>import django
django.setup()
</code></pre>
<p><a href="https://docs.djangoproject.com/en/1.10/ref/applications/#how-applications-are-loaded" rel="nofollow">From the do... |
Geting the file object from a form in Symfony <p>I have a scenario where I have to make use of a form the old fashioned why like this;</p>
<pre><code><form action="{{ path('admin_app_address_import') }}" method="post" name="form_import">
<div class="form-group">
<label for="inputFile">Fil... | <p>When allowing file uploads, the encoding type of the form must be set to <code>multipart/form-data</code>:</p>
<pre><code><form ... enctype="multipart/form-data">
</code></pre>
|
@keyframes for GaussianBlur (svg) <p>i am creating animation based on GaussianBlur (attribute "stdDeviation"), inside tag "animate" all is working, but i'm trying to use css animation. And it's doesnt work. When i had put attribute "stdDeviation" inside @keyframes browser returned "unknown property name".
working ve... | <p>stdDeviation is not a CSS property and can't be animated with CSS animations. You must use SMIL or JavaScript.</p>
|
ionic get Multi objects from array <p>i have ionic app that send order details by email the email include the item name and size and Qty but when there is multi items in the cart it only sends the last item in the car details
here is my controller code </p>
<p><div class="snippet" data-lang="js" data-hide="false" dat... | <p>That is because you are only sending last element In you API, for loop is executing first , at the end there is only last element in
itemNames , And you are sending that to php.</p>
<p>So there are two things you can do , </p>
<ol>
<li><p>Call ajax inside loop (not good)</p></li>
<li><p>Push all those elements tog... |
Installing image pgk on Octave on Mac <p>I installed GNU Octave, version 4.2.0-rc2 on my Mac[0] using Homebrew[1].</p>
<p>But now I tried to install the image pkg[2].</p>
<p>I tried downloading it and then using this line:</p>
<pre><code>"pkg install image-2.6.0.tar.gz"
</code></pre>
<p>Then I tried installing it w... | <p>I had the exact same problem. Just download the older version 2.4.1 of <code>image</code> and installation should work as expected.</p>
<p>Download Link:</p>
<p><a href="https://sourceforge.net/projects/octave/files/Octave%20Forge%20Packages/Individual%20Package%20Releases/image-2.4.1.tar.gz/download" rel="nofollo... |
Replacing Cookie by Token based authentication in ASP.NET OWIN OpenIdConnect code authorization flow <p>We have a web application written in ASP.NET that uses MVC for serving our Single Page Applications and Web API for ajax calls.</p>
<p>The authentication uses <em>Microsoft.Owin</em> and <em>OpenIdConnect</em> with ... | <p>I think there are two approaches for you to consider.</p>
<ol>
<li>Use javascript libraries to perform sign-in & token acquisition within your single page app. Then your backend is purely an web API, and can just use OAuth bearer middleware to authenticate requests. The backend doesn't know anything about sig... |
Syntax error in angularjs while Data binding <p>browserLink:37 Uncaught Error: Syntax error, unrecognized expression: input#{role}(â¦) </p>
<p>//template </p>
<pre><code><div ng-repeat="role in roles">
<input type="checkbox" id="{{role}}" value="{{role}}" ng-model="role" ng -checked="getCheckedTrue[{{... | <p>Reference the input by name instead of input
|
How to get a MS Translator access token from Swift 3? <p>I am trying to work with a MS Translator API from Swift 3 (right now playing in playgrounds, but the target platform is iOS). However, I got stuck when I was trying to get an access token for OAuth2. I have following code (I tried to port the code from example at... | <p>OK, so after some more desperate googling and experimenting I have found my error. For the future generations:</p>
<p>The problem resided in encoding the parameters in the body of the PUT http request. Instead of:</p>
<pre><code>let scope = "http://api.microsofttranslator.com"
.addingPercentEncoding(w... |
Predict multiple different equations at once <p>I have a set of interrelated equations. My goal is to get forecast for all LHS-variables simultaneously. Here is a brief example:</p>
<pre><code>require('dyn')
require('zoo')
set.seed(1)
y <- zoo(rnorm(30,1))
x <- zoo(rnorm(40,115))
z<-zoo(0.3*rnorm(30,100,20)+... | <pre><code>results <- lapply(model.list, fun1)
results_with_id <- mapply(model = seq_along(results),
x = results,
FUN = function(model, x) {
cbind(model = model,
as.data.frame(x))
... |
Should REST reponse contain any query parameter? <p>should I include my input query parameter in the response?</p>
<p>let's say that I have endpoint which returns people names, I am allowing my client to restrict the result by the country.</p>
<p>I wonder should I include the country query param in the response or no... | <p>Depends on what data the client needs.</p>
<p>If you just want a way to tell the client what they requested, you could have some convention in your API that there's a top-level node that shows what the parameters in the request were that generated this reponse.</p>
<p><code>{"requestParams":"country=UK&city=Lo... |
Threat found on my wordpress website <p>Ever since i connected my website to the domain i started to get on some computers that are trying to visit the website this warring:</p>
<p>Access to the web page was blocked. Show URL</p>
<p>Threat: JS/TrojanDownloader.FakejQuery.B trojan</p>
<p><a href="https://i.stack.img... | <p>If you're going through a host for your domain, I would contact them for an explanation. In the mean time/if you are hosting it yourself, I would try and run the Shodan extension for chrome on the site to check for other active ports that could be influencing the connecting clients. Double check all of your javascri... |
Push one object property with the same object in javascript <p>I have to frame object structure like below dynamically.</p>
<pre><code> "1":{
"A":"one.two.three"
},
"2":{
"B":"three.four.five"
},
"3":{
"c":"six.seven.eight"
},
etc....
Obj ={
A: "123",
B: "345",
... | <p>You can do this:</p>
<pre><code>var obj = {};
obj['temp'] = {};
obj['temp']['tree'] = {};
obj['temp']['tree']['two'] = {};
obj['temp']['tree']['two']['one'] = "1";
</code></pre>
|
How to show progress bar when uploading a file in android retrofit <p>I am developing an android app using retrofit. I want to upload any type of file to my server with parameters. For example in my app there is text field like email and file upload field. when i entered the fields and click the submit button. It shows... | <p>create this interface</p>
<pre><code>public interface ProgressListener {
void transferred(long num);
}
</code></pre>
<p>And this class</p>
<pre><code> public class CountingTypedFile extends TypedFile {
private static final int BUFFER_SIZE = 4096;
private final Prog... |
How to use Adobe afm fonts in matplotlib text? <p>I want to add a text to a figure using an AFM font. I know that I can pass the <code>fontproperties</code> or the <code>fontname</code> keyword argument when creating a text. </p>
<p>Regarding the usage of AFM fonts in matplotlib, I found <a href="http://matplotlib.org... | <p>What is an "AFM font"? AFM files are <strong>A</strong>dobe <strong>F</strong>ont <strong>M</strong>etrics files, which only contain metadata around glyph bounds, kerning pairs, etc. as a convenient lookup mechanism when you don't want to mine the real font file for that information (handy for typesetting, where hav... |
IBM Worklight App Center not working by using latest version of Chrome APP on Android <p>As usual, user download .apk through IBM App Center, everything work fine until update Chrome app to version <strong>53.0.2785.124</strong></p>
<p>Nothing happened when user click the download button.</p>
<p>After that, we <stron... | <p>I'm sorry, but Stack Overflow is not the place for this kind of support for IBM Application Center. As an IBM customer, please open a PMR (support ticket) to contact and receive support from the development team for IBM Application Center.</p>
|
Compare two csv files containing similar columns, eliminate duplicate and output unique content in one file <p>I have two csv files (similar format)</p>
<p>file1.csv </p>
<pre><code> post_status post_type post_content post_title
publish post paragraph one title one
publish post ... | <p>Try</p>
<pre><code>$Content = Get-Content first.csv,second.csv
$Content | Select-Object -Unique | Out-File result.csv
</code></pre>
<p>This solution is for Windows Powershell</p>
<p>Actually, you can do all in one line:</p>
<pre><code>Get-Content first.csv,second.csv | Select-Object -Unique | Out-File result.csv... |
Android: How to code an AlertDialog with onClickListener and onLongClickListener <p>Like the title says. I have coded onClickListener to my AlertDialog but i don't know how to put there onLongClickListener.</p>
<p>This is my code:</p>
<pre><code>private void addRecipeMethod() {
AlertDialog.Builder builder = new A... | <p>Create <code>AlertDialog</code> with custom layout like this</p>
<pre><code> AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
// ...Irrelevant code for customizing the buttons and title
LayoutInflater inflater = this.getLayoutInflater();
View dialogView = inflater.inflate(R.layout.a... |
while loop within a function - python <p>I'm quite new to writing code, so although some of you might find this easy, I don't. So would really appreciate some help from someone i bit more experienced than I am!</p>
<p>This is the code that I am working on right now (it is part of a bigger script)</p>
<pre><code>def c... | <p>In your code, you're breaking from the for loop on the first iteration. Also, if you input an odd number, the line <code>number = int(input("Please type an odd number: "))</code> will never be run. </p>
<p>Hope this helps! </p>
|
Sequelize join twice on two tables <p>I have two table: <code>Conversations</code> and <code>ConversationParticipants</code>.
I need to get the list of conversations that both users <code>1</code> and <code>2</code> participate too.
In <code>MySQL</code>, the query would be this:</p>
<pre><code>SELECT conversation_par... | <p>One way you could do it is find the conversations that have participants with user 1 or 2, and afterwards filter the conversations that have both of them:</p>
<pre><code>const userIdsFilter = [1,2];
//find Conversations that have user 1 OR user 2 as participants,
Conversation.findAll({
include : [{
mod... |
STL list very bad performance <p>It's supposed that "push_back" and "pop_front" methods of a STL list (implemented as a double linked list) should be constant O(1). However we were having cpu issues in an application running on linux and we found that "pop_front" method is incredibly inefficient when using lists. Is th... | <p>If you want to check whether a container is nonempty, you should use <code>!c.empty()</code>, not <code>c.size() > 0</code>.</p>
<p>This is especially important for <code>std::list</code>, because in some implementations, <code>size</code> is a <em>linear time</em> operation, not a <em>constant time</em> operati... |
NodeJS daemon not starting at startup on raspberry pi <p>I have created a little daemon that starts my nodejs API as a service using <code>forever</code>.</p>
<p>Now that the service starts and stops without any problems, I want to make it start when the raspberry pi turns on. My raspberry pi is running on <code>Raspb... | <p>I have found a good solution for creating a nodejs service on <code>Debian</code> / <code>Raspbian</code>.</p>
<p>I installed the <code>forever-service</code> package with npm and create the service with this tool.</p>
<p>It's a really good solution and it works really good: <a href="https://github.com/zapty/forev... |
need to plot a 2D graph of the gray image intensity in matlab <p>what I am trying is to compare two gray scale images by ploting their intensity into graph. The code is bellow is for single image. </p>
<pre><code>img11 = imread('img.bmp');
[rows cols ColorChannels] = size(img11);
for i=1:cols
for j=1:rows
... | <p>Based on your code you should be able to do the following.</p>
<pre><code>img11 = imread('img1.bmp');
img22 = imread('img2.bmp');
figure;
imagesc(img11); % verify you image
figure;
plot(img11(:)); hold on;
plot(img22(:));
</code></pre>
<p>Using the command <code>(:)</code> will flatten a matrix into a single vect... |
How to replace multiple if-else statements to optimize code? <p>I want to know if there is any way i could optimize this code.</p>
<pre><code>String[] array;
for(String s:array){
if(s.contains("one"))
//call first function
else if(s.contains("two"))
//call second function
...and so on
}
</code></... | <p>This wont stop you code from doing many <code>String#contains</code> calls, however, it will avoid the <code>if/else</code> chaining.. </p>
<p>You can create a key-function map and then iterate over the entries of this map to find which method to call.</p>
<pre><code>public void one() {...}
public void two() {...}... |
Select rows that have different values for a column, given another column <p>Given a table with 2 columns a, b.</p>
<p>I want to select rows that for a given a, I can have different values of b.</p>
<p>In this example, I want the first 2 lines</p>
<pre><code>a | b
-----
1 | 1
1 | 2
2 | 1
2 | 1
3 | 1
</code></pre>... | <p>Try this:</p>
<pre><code>SELECT t1.*
FROM mytable AS t1
JOIN (
SELECT a
FROM mytable
GROUP BY a
HAVING COUNT(DISTINCT b) > 1
) AS t2 ON t1.a = t2.a
</code></pre>
|
Laravel 5.3 - changing auth view paths <p>In my Laravel app I have different auth for administrators and users. So I have separete views as well. I have placed auth <code>views</code> folder inside <code>admin</code> folder, so that the view path to my admin auth is now <code>admin.auth.login</code> for example. Where ... | <p>If you take a look at your <code>app\Http\Controllers\Auth\LoginController.php</code>, you will see:</p>
<pre><code>use AuthenticatesUsers;
</code></pre>
<p>It's a <a href="http://php.net/manual/en/language.oop5.traits.php" rel="nofollow">traits</a>, you can find all the login related method over there in <code>us... |
How can I save dragged & dropped elements VALUE after dropped all players (soccer manager) <p>i have a player soccer field and i want the user to create his own LineUp via Drag and Drop...</p>
<p>have a look at my fiddle: <a href="https://jsfiddle.net/ahsce0oj/2/" rel="nofollow">https://jsfiddle.net/ahsce0oj/2/</a></p... | <p>There's a lot of ways to accomplish your goals (pun intended, ha!) here. I will what I would do:</p>
<p>Working Example: <a href="https://jsfiddle.net/Twisty/54vgb8bx/4/" rel="nofollow">https://jsfiddle.net/Twisty/54vgb8bx/4/</a></p>
<p><strong>HTML Snippet</strong></p>
<pre><code> <section id="content">
... |
fatal error: Index out of range, when passing FirebaseData to tablviewCell <p>so I am working a food list project that I want to pass mealname/mealpic/mealDescription to my tableViewCell from FirebaseDatabase.</p>
<p>it will be something looks like this <a href="https://i.stack.imgur.com/mo8J1.png" rel="nofollow">ente... | <p>Try :- </p>
<pre><code>DataService.ds.REF_MENUDATA.observe(.value, with: { (snapshot) in
if let snapshot = snapshot.children.allObjects as? [FIRDataSnapshot]
{
for snap in snapshot {
print("SNAP: \(snap)")
if let menuDict = snap.value as? Dictionary<String, AnyObject> ... |
HTML Make code run independently from the rest of the page...iframe? <p>This is a little hard to explain. I'm creating a webpage that shows how other webpages will render in the browser. Here's a simplified version of the problem I'm having...</p>
<pre><code><div id="test">This is an example of page 1</div&g... | <p>You can only have one id per element in an HTML document. So each div must have a different id, otherwise you <em>will</em> run into problems. If multiple elements need to have the same name, you can use classes <code><div class="test" id="unique-id"></div></code> and then <code><div class="test" id... |
Python, scipy, curve_fit, bounds: How can I contstraint param by two intervals? <p>I`m using scipy.optimize.curve_fit for fitting a sigmoidal curve to data. I need to bound one of parammeters from [-3, 0.5] and [0.5, 3.0]</p>
<p>I tried fit curve without bounds, and next if parameter is lower than zero, I fit once mor... | <p>No, least_squares (hence curve_fit) only supports box constraints.</p>
|
dc:Creator string literal vs. regex FILTER in SPARQL <p>I am using <a href="http://sparql.europeana.eu/" rel="nofollow">Europeana's Virtuoso SPARQL Endpoint</a>.</p>
<p>I have been trying to search in SPARQL for content about a specific contributor. To my understanding, this could be carried out this way:</p>
<pre><c... | <p>I don't think there are any objects with 'Picasso' literally as the creator. <strong>So a regex filter is a good choice, but slow.</strong> </p>
<p>Here's a way to find the strings your regex is matching:</p>
<pre><code>PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?creator, (count(?creator) as ?cco... |
How to resolve the maven dependency issue <p>when i tried to deploy my maven project into AEM 6.2 bundle remains in install state and its shows the following error</p>
<p>com.day.cq.commons,version=[5.7,6) -- Cannot be resolved<br>
com.day.cq.replication,version=[5.15,6) -- Cannot be resolved</p>
<p>need help!!!</p>
| <p>Following is available in AEM 6.2 and that's what your POM should reflect - </p>
<p>For CQ Commons</p>
<pre><code><groupId>com.day.cq</groupId>
<artifactId>cq-commons</artifactId>
<version>5.9.22</version>
</code></pre>
<p>For CQ Replication</p>
<pre><code><groupId>com.a... |
Wallpaper changes every hour? <p>I searched all the internet I cant find a code or example for change the home screen wallpaper every hour or day or min I want something like bing wallpapers or some pictures I put in Drawable all I find live wallpapers or wallpaper service not app or 1 picture with button change the wa... | <p>Add following code in manifest</p>
<pre><code><receiver
android:enabled="true"
android:name=".BootUpReceiver"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.... |
cannot understand this piece of c++ code <p>I am reading some c++ open source code and a beginner in c++, I found this piece of code is very hard to understand, I don't know what this code are doing and why should it be written in this way. Could any body give me any clue? (The question part is on <code>rndseq[k] = (rn... | <pre><code>(rndseq[k] << 8) | (rand() & 0xff)
</code></pre>
<p>these are binary-operation, (see bit-operations in C)</p>
<p>it can be translated into</p>
<pre><code>rndseq[k] * 256 + rand() % 256
</code></pre>
<p>the idea behind the code is, to create a large array with random entries, but its way too com... |
rattle "Info" Score in Description of the dataset <p>Running descriptive statistics in rattle and need to know what "Info" is in the results. Have not been able to find any information in the vignette. Here is an example of what I'm speaking of:</p>
<pre>
Variable1
n missing unique <b><em>Info</em></b> S... | <p>The describe function used in Rattle comes from the package HMisc.</p>
<p>In the documentation of HMisc::describe this is said about Info:</p>
<blockquote>
<p>For numeric variables, describe adds an item called Info which is a
relative information measure using the relative efficiency of a
proportional odds/... |
set multi attributes at once without jquery <p>There is a way to write this code in shorter way
instead of</p>
<pre><code> var aTag = document.createElement('a');
aTag.setAttribute('href', oUrl.toString());
aTag.setAttribute('rel', "test");
aTag.setAttribute('target', "_... | <p>Sure, you could use a loop.</p>
<pre><code>function setAttributes(el, attrs) {
Object.keys(attrs).forEach(function (attr) {
el.setAttribute(attr, attrs[attr]);
});
}
var aTag = document.createElement('a');
setAttributes(aTag, {
href: oUrl,
rel: "test",
target: "_blank"
});
</code></pre>
|
Jupyter magic to handle notebook exceptions <p>I have a few long-running experiments in my Jupyter Notebooks. Because I don't know when they will finish, I add an email function to the last cell of the notebook, so I automatically get an email, when the notebook is done.</p>
<p>But when there is a random exception in ... | <p>A such magic command does not exist, but you can write it.</p>
<pre><code>from IPython.core.magic import register_cell_magic
@register_cell_magic
def handle(line, cell):
try:
exec(cell)
except Exception as e:
send_mail_to_myself(e)
</code></pre>
<p>It is not possible to load automatically ... |
converting float to sprintf <p>I'm trying to convert a float to char string I used sprintf, as the following</p>
<pre><code> float temperature = getTemperature();
char array[15];
sprintf(array, "temperature %f", temperature);
int length = strlen(array);
protocol_WriteMessa... | <p>First of all use a safer alternative like <a href="http://man7.org/linux/man-pages/man3/printf.3.html" rel="nofollow"><code>snprintf()</code></a>, and then remove the <code>&</code> address of operator from the call.</p>
<p>To use <code>snprintf()</code> you need to do something like this</p>
<pre><code>int re... |
Remove warn message about hidden settings in sitecore 8 <p>Sitecore has a dozen of hidden settings, but I see WARN messages in log about wrong value in this fields,
foe example</p>
<p><em>11168 08:18:11 WARN The "EventQueue.Enabled" setting contains an invalid value. The default value is used instead. Invalid value:... | <p>No, there is no setting for that unless you change logging level to <code>ERROR</code> or <code>FATAL</code>.</p>
<p>Looks like those settings are already in your config just with empty values. Maybe it's enough to remove line like that from your configs:</p>
<pre class="lang-xml prettyprint-override"><code><se... |
SQL Error: ORA-01841 <p>I am getting the following error when I run code in SQL Developer:</p>
<blockquote>
<p>SQL Error: ORA-01841: (full) year must be between -4713 and +9999, and not be 0
01841. 00000 - "(full) year must be between -4713 and +9999, and not be 0"</p>
</blockquote>
<p>I get this error when I tr... | <p>First, believe the error. You have bad data.</p>
<p>In all likelihood, you are looking at the results from running the query and not seeing it -- because you are only looking at the first few results. The <code>create table</code> is run over all the rows before it returns, so it will find the offending row.</p>
... |
How to connect to Microsoft SQL server using GORM in golang? <p>I'm trying to connect to a microsoft SQL server using GORM: <a href="https://github.com/jinzhu/gorm" rel="nofollow">https://github.com/jinzhu/gorm</a></p>
<p>But I cannot seem to find any tables when I try using db.HasTable() and I checked the credentials... | <p>I found my error, I was importing the wrong MSSQL driver, gorm already has one
import _ "github.com/jinzhu/gorm/dialects/mssql"</p>
|
Total users from serialized id field <p>I need a little help to get <strong>how many users are associated with a specific company</strong> from a serialized id field.</p>
<pre><code>TABLE_USER
user_id
user_name
user_companies <- Serialized id field
</code></pre>
<p>If I have a INT field I can get value in this way... | <p>That's not the way to use a database. Ideally you should have a joined table with users and companies. It wouldn't be that difficult to run one script that selects, unserializes and inserts into a new table that you can join. But assuming that's how it is you have to do it in PHP:</p>
<pre><code>// SELECT * FROM ... |
How to sort associative arrays in descending order? <p>I know about rsort and array_reverse but I'd like to know how you could reverse all elements of an associative array as well as their index numbers. e.g.:</p>
<p>Take
<code>$age = array("x"=>"35", "y"=>"45", "z"=>"55");</code></p>
<p>and display it a... | <p>I think you want to sort by key in decending order so you need to do flowing.Because <code>array_reverse()</code> function swap key with value in an array.</p>
<pre><code>$age = array("x"=>"35", "y"=>"45", "z"=>"55");
krsort($age);
foreach($age as $x => $x_value){
echo $x . " " . $x_value;
echo "<br... |
large data transformation in python <p>I have a large data set (ten 12gb csv files) that have 25 columns and would want to transform it to a dataset with 6 columns. the first 3 columns remains the same whereas the 4th one would be the variable names and the rest contains data. Below is my input:</p>
<pre><code>#RIC ... | <p>You need to group the levels, i.e <code>L1-BidPrice L1-BidSize L1-AskPrice L1-AskSize</code> and write each to a new row :</p>
<pre><code>import csv
from itertools import zip_longest # izip_longest python2
with open("infile.csv") as f, open("out.csv", "w") as out:
next(f) # skip header
cols = ["#RIC", ... |
Python backtest using percentage based commission <p>I'm writing a script to backtest some strategies for a set of stocks using the bt framework for python. In the bt documentation (<a href="http://pmorissette.github.io/bt/bt.html#module-bt.backtest" rel="nofollow">backtest module</a>) it says: </p>
<blockquote>
<p>... | <p>Solved it by creating a function with parameters for quantity and price. Thus it was easy returning a percentage based on the transaction cost as follows:</p>
<pre><code>def my_comm(q, p):
return abs(q)*p*0.0025
</code></pre>
|
how to pass data between templates meteor js <p>i'm working with Meteor js and i'm trying to pass data from a template to another and this is my code :</p>
<p><strong>BuildingsAction.js</strong></p>
<pre><code> Template.BuildingsAction.viewmodel({
showExhibitions() {
FlowRouter.go("/exhibitions");
... | <p>There are two ways.</p>
<p><strong>1. Using session.</strong></p>
<pre><code>`Session.set('idVar',YourId);`
</code></pre>
<p>Get Session Value:
<code>Session.get('idVar');</code></p>
<p><strong>2. You can send the id in URL</strong></p>
<p><code>FlowRouter.go("/exhibitions",{},{id:YourID});</code> </p>
... |
Can you override an "onscroll" listener by using another? <p>I'm working on a problem where I want to override the global onscroll event listener with one specifically assigned to an element.</p>
<p>Here is an example.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"... | <p>I don't really understand exactly what you're trying to do... but, you can unregister the scroll event handler that you attach at the bottom inside the click event handler, just before you attach your new one, by doing <code>$(window).off('scroll')</code></p>
<p><div class="snippet" data-lang="js" data-hide="false"... |
Ramda: Call array of functions on array of values <p>If I have the array <code>data</code> and the array of functions <code>[fn1, fn2, fn3]</code>, what's the right way with Ramda to get</p>
<pre><code>[fn1(data[0]), fn2(data[1], fn3(data[2]), ...]
</code></pre>
<p>Basically, I want to call each function with the val... | <p>You'll want to use <a href="http://ramdajs.com/docs/#zipWith"><code>zipWith</code></a> with <a href="http://ramdajs.com/docs/#call"><code>call</code></a>:</p>
<pre><code>R.zipWith(R.call, fns, data)
</code></pre>
|
Insert variable in specific place using sed -i <p>i would insert two variable in sed command:</p>
<pre><code>sed -i '39,41 s/^#//' file
</code></pre>
<p>i would</p>
<pre><code>sed -i '$LINE,$LINE_INCREMENTED s/^#//' file
</code></pre>
<p>but return this:</p>
<blockquote>
<p>sed: -e expression #1, char 9: unknown... | <p>drop the quotes for double quotes so environment variables are evaluated:</p>
<pre><code>sed -i "$LINE,$LINE_INCREMENTED s/^#//" file
</code></pre>
|
symmetricds: sym_data table in master node is filled but sym_data_event is empty <p>We have a problem, sym_data table in master node is filled with data but sym_data_event is empty and sym_outgoing_batch is empty too. No any error in log file, symmetricds version is 3.4.2. One day ago all works fine and symmetricds con... | <p>It seems that symmetricds the engine is not working. sym_data table is populated by database triggers, symmetricds engine is not required to run. But to populate data event and outgoing batch tables symmetricds engine has to be running and routing extracted data</p>
|
Is there any way by which I can save files to icloud in Cordova <p>I'm using cordova-sqlite-plugin, according to its documentation, the database file will be backed up by iCloud if I put it to a right directory. But it's not working. I thought perhaps iCloud dosen't support sqlite file, so I dump the data into a sql fi... | <p>Try adding this to your <code>config.xml</code>.</p>
<p><code><preference name="BackupWebStorage" value="cloud" /></code></p>
|
How to exclude a supplier if it returns two values <p>I need to create a clause to restrict the data returned.</p>
<p>if AUTHORIZATION_STATUS from PO_headers_all returns STATUS 'approved' and 'in process' then do not return supplier. however it it returns as 'approved' on its own I need the supplier to be returned.</p... | <p>Ok, let's dive in.</p>
<p>But first a necessary pointer to <a href="http://stackoverflow.com/help/mcve">How to create a Minimal, Complete, and Verifiable example</a></p>
<p>You can find (and hopefully, correct, complete and add into your question) an attempt of such an example in this answer (also on <a href="http... |
TaskFactory handle exceptions <p>How can I easily handle all exceptions that happens inside the task that I am running without blocking the UI thread.</p>
<p>I found a lot of different solutions but they all involve the <code>wait()</code> function and this blocks the whole program.</p>
<p>The task is running async s... | <p>You should not use <code>Task.Factory.StartNew</code> (use <code>Task.Run</code> instead). Also, do not use <code>ContinueWith</code> (use <code>await</code> instead).</p>
<p>Applying both of these guidelines:</p>
<pre><code>try
{
await Task.Run(() =>
{
if (_proxy != null)
{
_gpsdService.SetPr... |
Deadlock inserting into a table in SQLServer 2012 (10.50.6000.34) <p>I have a problem with a SQL Server where I change the requests to multithreaded and it executes this stored procedure on multiple connections to the database and results in a deadlock. I can't imagine how it is deadlocking. If I do it single thread... | <p>This is a typical case where you should consider <code>UPDLOCK</code> in your query:</p>
<pre><code>begin tran
if exists (select * from table with (updlock,serializable) where key = @key)
begin
update table set ...
where key = @key
end
else
begin
insert into table (key, ...)
values (@key, ...)
end
commi... |
Multi Signer DocuSign Issue <p>I am trying to send docusign document to multiple signer .I have added two signer
and call CreateEnvelope method to send documents .I am using .net framework to implement this .but the problem is mail delivered only first recipients .Can you please help me how can i send document to mult... | <p>Based on the code you've provided, it looks like you're specifying a <em>serial</em> routing order:</p>
<ul>
<li>first signer is routing order <strong>1</strong>: <code>signer1.RoutingOrder = "1";</code> </li>
<li>second signer is routing order <strong>2</strong>: <code>signer2.RoutingOrder = "2";</code></li>
</ul>... |
how to add attribute for all subnodes of the xml in sql <p>I have a xml like below in a variable @xml</p>
<pre><code><ContentTemplate>
<Tab Title="Lesson">
<Section Title="Lesson Opening" />
<Section Title="Lesson/Activity" />
</Tab>
<Tab Title="Wrap Up and Assessment">... | <p>Your XML in a variable</p>
<pre><code>DECLARE @xml XML=
N'<ContentTemplate>
<Tab Title="Lesson">
<Section Title="Lesson Opening" />
<Section Title="Lesson/Activity" />
</Tab>
<Tab Title="Wrap Up and Assessment">
<Section Title="Lesson Closing" />
<S... |
get select option value using $(document).ready function in jQuery from multiple dynamic record? <p>Here is my code</p>
<pre><code>foreach($test as $val){
<select name="change" id="change-<?=$val['id']?>" data-id="<?php echo $val['id'];?>">
<option value="">Select Value</option>
... | <p>For the interval you can use plain JavaScript's <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval" rel="nofollow">setInterval()</a> method.</p>
<p>In order to find and iterate over all your <code>select</code> fields, you can use jQuery's "<a href="https://api.jquery.com/attribute-s... |
Searching two column titles, comparing, and deleting duplicate rows from one sheet only. <p>Essentially the following searches column L in Sheet1, compares it to another column in a separate worksheet (e.g. Sheet2) and then deletes the whole row from Sheet1.</p>
<p>I'm having trouble making it applicable to other situ... | <p>Something like this should work for you:</p>
<pre><code>Sub tgr()
Dim wb As Workbook
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim rDel As Range
Dim rHeader1 As Range
Dim rHeader2 As Range
Dim rCheck As Range
Dim sHeader As String
Set wb = ActiveWorkbook
Set ws1 = wb.Sheets... |
How to group by looking at previous and next value in each row <p>Suppose I have a table with the following records...</p>
<pre><code>ResumeId Action
39092 DEV
39092 C
39092 C
39096 C
39096 C
39098 CONF
39098 CONF
</code></pre>
<p>How can... | <p>Here is one method:</p>
<pre><code>select resumeid,
(case when max(action) = min(action) then max(action)
when sum(case when action = 'DEV' then 1 else 0 end) > 0 then 'DEV'
else '??'
end)
from t
group by resumeid;
</code></pre>
<p>Your rules don't specify what to do if ... |
ansible using multiple strategies with strategy plugin <p>I am using ansible 2.1 and would like to figure out how (if possible) to specify more than one strategy in the ansible.cfg file for running ansible playbooks. Currently, I am using <strong>debug</strong> strategy but would like to use <strong>free</strong> or o... | <p>As per <a href="http://docs.ansible.com/ansible/playbooks_strategies.html" rel="nofollow">documentation</a> you can set strategy on per play basis:</p>
<pre><code>- hosts: all
strategy: free
tasks:
...
</code></pre>
|
MAGICS - undefined symbol: _ZTIN5eckit9ExceptionE <p>I'm stuck on a runtime error "undefined symbol: _ZTIN5eckit9ExceptionE" like this</p>
<pre><code>Start 2: basic_python
2: Test command: /usr/local/Python/2.7.10/bin/python "coast.py"
2: Environment variables:
2: PYTHONPATH=/opt/src/ecmwf/Magics-2.29.4-Source/build... | <p>Take a look at <code>Exceptions.h</code> file. Note how all your undefined symbols belong to functions that are <strong>declared but not defined</strong>.</p>
<pre><code>~Exception() throw();
// [...]
virtual void print(std::ostream&) const;
</code></pre>
<p><code>eckit::Exception::~Exception()</code> is your ... |
How to where do i process my data with observable .map and .subscribe <p>I'm retriving some data from my API:</p>
<pre><code>[
{
"id": 1,
"lat": 50.607084,
"lng": 3.043099
},
{
"id": 2,
"lat": 50.607084,
"lng": 3.043099
},
]
</code></pre>
<p>I'd like to process the data only with reactive pro... | <p>What you need to do is mapping the array retrieved from the server to a list of GoogleMapsMarkerOptions. So, (I don't know the constructor of GoogleMapsMarkerOptions) something like:</p>
<pre><code>this.http.get('http://api/getData')
.map(res => {
return res.json().map(x => {
return new Goo... |
How to add analytics code in React Native lifecycle <p>I have a <code>TabBarIOS</code> which contains five navigators. I need to track each view on screen for google analytics, but ReactNative doesn't provide a lifecycle for that.</p>
<p>I'v tried to track in the <code>componentDidMount</code> of those views, but it w... | <p>TabBarIOS.Item has a property named <a href="https://facebook.github.io/react-native/docs/tabbarios-item.html#onpress" rel="nofollow">onPress()</a> that gets called when the item is pressed. You can use this callback to update analytics.</p>
|
C# - Why is Enumerable<T> serializable for T that are not serializable? <p>So far I've been considering <code>typeof(T).IsSerializable</code> to be true if <code>T</code> has attribute <code>[Serializable]</code>. (And unrelated to the confusingly named <code>ISerializable</code>). <br>
That first assumption is wrong; ... | <p>The MSDN link you shared explains this in the <strong>Remarks</strong> section:</p>
<blockquote>
<p>If the current Type represents a constructed generic type, this property applies to the generic type definition from which the type was constructed. For example, if the current Type represents MyGenericType (MyGene... |
Is it possible to embed a c++ or java compiler inside Unity 5 scene <p>I'm implementing a game which teaches programming just like robocode and other related applications but I want to implement this game in unity. the user should answer problems by writing his code in the text-area and then compile it, then I should r... | <p>Not a Unity expert, but you could get away with calling the compiler as an external program - see <a href="http://answers.unity3d.com/questions/1108055/execute-external-program.html" rel="nofollow">this</a> example, where they go over how to call a program in a Windows environment.</p>
<p>You'd have to make sure th... |
Get text from private stash link <p>I have application where I getting code from stash raw file. Scrapping from public repositories is simple, it looks like this:</p>
<pre><code> public getRawFile(rawLink: string) {
return this.http.get(rawLink).map((res: Response) => res.text());
}
</code></pre>
<p>But now... | <p>The server that you are making the request to has to implement CORS to grant JavaScript from your website access (Cross Origin Resource Sharing (CORS)). So if you have access to the place where you are scraping, then add the following HTTP headers at the response of the receiving end:</p>
<pre><code>Access-Control-... |
Cannot read property of undefined issue on callback <p>I have a very simple class that is wrapping a node.js serial port class. On object creation, a new logger is created. When stepping through, everything seems fine - when I call open, I can see that the logger is a valid logger object. However, when the error met... | <p>use an arrow function or bind this, either way should work</p>
<p><code>this.port.on('error', (err) => {this.error(err)});</code></p>
<p>or</p>
<pre><code>var error=this.error.bind(this);
this.port.on('error', error);
</code></pre>
|
Twig loop through array <p>I have the following <code>json_decode</code> data which is something like this:</p>
<pre><code>Array
(
[0] => Array (
[id] => 218
[startTime] => 1478363400000
[EndTime] => 1478367000000
[c] => Array (
[id] => 1
[code] => A
... | <p>Please make sure that you use json_decode function before pass your TimeInfo array to twig template. You can iterate it as a simple multidimensional array. Small trick with startTime/StartTime will help you to avoid an error related to first capital letter in the StartTime element's key of your data array. </p>
<pr... |
Make scope of lock smaller in threadsafe queue <p>I have a dll which has a high priority functionality that runs in a high priority thread. This dll needs to report progress. Basically a callback system is used. The issue is that the dll has no control over the amount of time the callback takes to complete. This means ... | <pre><code>void ProgressIsolator::Work()
{
while (!shutdown)
{
Progress progress;
{
std::unique_lock<std::mutex> lock(mutex);
itemAvailable.wait(lock, [this] { return !queue.empty(); });
progress = queue.front();
queue.pop();
}
... |
IndexError: list index out of range in Python 3 <p>I am newbie to Python. I got the index error when I run the code. I have seen the relevant questions in Stackoverflow, but I still can't see what the bug is. I am very appreciated for any response. Thank you. Here is the code:</p>
<pre><code> class Card:
def __init... | <p>You have <code>13</code> items inside your <code>rank_names</code> list so the index of last element is of value <code>12</code> (lists are enumerated starting with <code>0</code>) - inside loop</p>
<pre><code>for suit in range(4):
for rank in range(1, 14):
card = Card(suit, rank)
</code></pre>
<... |
drop down code for store locator on magento <p>Please can anyone help with the code for a drop down for store locator in magento,this is a look alike of what i want to achieve:</p>
<p><a href="http://www.watchrepublic.co.za/store-locator.html" rel="nofollow">http://www.watchrepublic.co.za/store-locator.html</a></p>
<... | <p>I have no experience with Magento, but after a bit of googling, I came across a <a href="https://www.magentocommerce.com/magento-connect/responsive-custom-menu.html" rel="nofollow">drop down menu extension</a>.</p>
|
How to use a dict to subset a DataFrame? <p>Say, I have given a DataFrame with most of the columns being categorical data.</p>
<pre><code>> data.head()
age risk sex smoking
0 28 no male no
1 58 no female no
2 27 no male yes
3 26 no male no
4 29 yes female yes
</... | <p>You can create a look up data frame from the dictionary and then do an inner join with the <code>data</code> which will have the same effect as <code>query</code>:</p>
<pre><code>from pandas import merge, DataFrame
merge(DataFrame(tmp, index =[0]), data)
</code></pre>
<p><a href="https://i.stack.imgur.com/xW4kf.pn... |
PhpStorm with Live Edit on Mozilla Firefox <p>Can I use Live Edit plugin on Mozilla Firefox and if I can how to do that?</p>
<p>Thanks</p>
| <p>You cannot -- <strong>LiveEdit plugin works with Chrome browser only</strong>.</p>
<p><a href="https://www.jetbrains.com/help/phpstorm/2016.2/live-editing-of-html-css-and-javascript.html?search=live%20e" rel="nofollow">https://www.jetbrains.com/help/phpstorm/2016.2/live-editing-of-html-css-and-javascript.html?searc... |
Is strip_tags necessary for phpmailer? <p>I'm using phpmailer with the following settings:</p>
<pre><code>$mail->ContentType = 'text/plain';
$mail->IsHTML(false);
...
$mail->Body = $_POST['comments'];
$mail->Body = strip_tags($mail->Body);
</code></pre>
<p>I noticed strip_tags() cuts off the text if i... | <p>No, it is not neccesary. If you set <code>$mail->isHTML(false)</code> and you write HTML in the email, it is sent like text plain so it doesnt interpret it like HTML.</p>
<p>For example I've just done this:</p>
<pre><code>$mail->ContentType = 'text/plain';
$mail->isHTML(false);
$mail->Subject = 'Your p... |
GROUP_CONCAT limiting to 100 values is not working <p>I am trying to extract a sum of modified history field limited by 100 and grouped by each account, but the query below extracts sum of all rows from CDR_Accounts with charged_quantity = 60 and does not limit to 100.</p>
<p>table1 = table2 and these are the temporar... | <p>I'm not clear about what your query does is. However limit applies to the final result which includes the grouping as well. if you need to limit the result of GROUP_CONCAT, first apply the limit and then apply the grouping</p>
|
image augmentation algorithms for preparing deep learning training set <p>To prepare large amounts of data sets for training deep learning-based image classification models, we usually have to rely on image augmentation methods. I would like to know what are the usual image augmentation algorithms, are there any consid... | <p>The litterature on data augmentation is very very large and very dependent on your kind of applications.
The first things that come to my mind are the galaxy competition's rotations and Jasper Snoeke's data augmentation. </p>
<p>But really all papers have their own tricks to get good scores on special datasets fo... |
Disable the background of a uibutton <p>I have a circular custom menu with several buttons (with image and text). To not cut title, I had to unlarge button size, but the background of few buttons overlay partially the image or title of other button. That why I'd like to disable the background of buttons, or make image ... | <p>As others have mentioned, you could change the background color quite easily with the following:</p>
<p><strong>Swift 3.0</strong></p>
<pre><code>buttonName.backgroundColor = UIColor.clear
</code></pre>
<p><strong>Swift 2.2 and prior</strong></p>
<pre><code>buttonName.backgroundColor = UIColor.clearColor()
</cod... |
Missing return in a function expected to return 'UITableViewCell' with two tableView <p>I use a croll view, and there are a two(or many) tableView in one view
like this</p>
<p><a href="https://i.stack.imgur.com/jVO6y.png" rel="nofollow"><img src="https://i.stack.imgur.com/jVO6y.png" alt="layout"></a></p>
<p>but at fu... | <p>You return nothing, when <code>tableView != self.tableView</code> and <code>tableView != tableView2</code>. That's why you see this error. If you are sure that this cannot be reached, try removing your <code>else if</code> condition</p>
|
Create vector selecting values from two different vectors <p>Currently, this code works to do what I want to do where dx$res is a vector selecting values from dx$val1 or dx$val2 depending on value of dx$x0.</p>
<pre><code>x0<-c(1,2,1,2,2,1)
val1<-c(8,6,4,5,3,2)
val2<-c(4,8,6,7,9,5)
dx<-data.frame(x0,val1,v... | <p>One option is <code>model.matrix</code> with <code>rowSums</code>. It is also more general for 'n' number of distinct elements in the 'x0' column.</p>
<pre><code>dx$res <- rowSums(dx[-1]*model.matrix(~ factor(x0) - 1 , dx))
dx$res
#[1] 8 8 4 7 9 2
</code></pre>
|
How do I compile this Fortran code with new 2017 ifort? <p>I have the following fortran code that compiles with pre 2017 ifort:</p>
<pre><code>program parallel_m
contains
character(500) function PARALLEL_message(i_ss)
character(50) :: Short_Description = " "
integer :: i_s =0
integer :: n_threads... | <p>Your program is illegal Fortran after the preprocessing because the <code>//</code> is interpretted as a C comment.</p>
<p>Simply do not use <code>icc</code> but <code>ifort</code>. <code>Ifort</code> is for Fortran, <code>icc</code> is for C. <code>Ifort</code> uses a different preprocessor <code>fpp</code> which ... |
Value not set correctly with JavaScript and Primefaces <p>im sending a variable with a JS to an inputtext. then when the value has been set i click on a p:commandButton to call a method that uses that value but the value that passes is blank... although the js sent the value to the input and i see it... it takes it as ... | <p>well i found some sort of solution with my sesion variable... it worked but not quite sure if it's the rigth aproach.</p>
<p>just added this in my Bean class:</p>
<pre><code>/**
* Setea tipo de valor de la meta para busqueda
* @param next
*/
public void setId(String id){
HttpServletRequest rq = (HttpServlet... |
Paypal Donation Button in asp.net page <p>I've created a paypal donation button from paypal business account with all default setting. I copy paste the html into my asp.net page, and it looks fine. The problem is when I click on the button simply nothing happen. Is this because I'm still on localhost? Will it be work a... | <p>Your asp.net page probably already has a form tag on it and you may have placed the PayPal code inside that form, which won't work. Instead of using the form with the hidden fields that PayPal generated for you, you could just use a link with url parameters. Here's an example (make sure you replace YOUR_BUTTON_ID_HE... |
Dstream output to Rabbitmq <p>I am using spark 2.0 (python). I am trying to send the output stream to Rabbitmq. Following is my implemetation, </p>
<pre><code>def sendPartition(iter):
connection = pika.BlockingConnection(pika.URLParameters('amqp://user:pass@ip:5672/'))
channel = connection.channel()
for re... | <p>What you have right now is probably close to the optimum in a general case. Python workers don't share state so you cannot reuse connections between partitions in the same batch.</p>
<p>It should be possible to reuse connections for each worker between batches by creating a singleton wrapping a connection pool (the... |
Edit all conflicting files in a git merge/rebase (special character safe) <p>In the middle of a <code>git rebase</code>, I have a status such as:</p>
<pre><code>$ git status --short
M lib/tmuxinator.rb
UU lib/tmuxinator/cli.rb
UU lib/tmuxinator/config.rb
A spec/fixtures/TMUXINATOR_CONFIG/TMUXINATOR_CONFIG.yml
M tmu... | <p>Many commands have a <code>-z</code>, <code>-0</code>, or <code>--null</code> option to produce/consume <code>NUL</code>-terminated output.</p>
<p>Use the following: </p>
<pre><code>git status -sz | sed -rnz 's/^(U.|.U) (.*)/\2/p' | xargs -0 $EDITOR
</code></pre>
<p>Or as a <code>gitconfig</code> alias:</p>
<pr... |
Type 3 Function Procedure in post Script <p>I am a beginner for post script and just started working on post script.
I want to create a post script procedure which I can use for shading effect for post script.This shading can have more then 2 colors so I need to define stitching function of type 3.</p>
<p>I am thinkin... | <p>I'm not really sure what you are asking for here. Perhaps you could clarify the question. You don't 'read bound variables from the stack', stack objects are just that, objects on the stack.</p>
<p>This:</p>
<pre><code> **/Bounds [ 1 1 num-1 { pop } for ]**
</code></pre>
<p>looks incorrect to me 'num-1' will ... |
Golang Pointer and Struct member function <h2>Invoke function</h2>
<p>When I define a struct <code>Lock</code> and a function <code>Test</code> with the struct <code>Lock</code> as the function receiver</p>
<pre><code>type Lock struct {
}
func (self Lock) Test() {
fmt.Println("Test Func")
}
</code></pre>
<p>I f... | <p>Usually, Golang does things for you under the hood and this is typically one of those cases.</p>
<p>When you define a function with a struct as receiver and you pass it a pointer to the struct, then Golang does the conversion for you: it passes a copy of the struct pointed to.</p>
<p>When you define a function wit... |
Unable to find null value reference to remove nullpointer when registering a user to the database, registers but throws null pointer <p>I am trying to register a user (using java, Java swing). I am able to get it to be inserted into the database but its throwing null pointer. I checked the internet for null pointer to ... | <p><code>rs</code> is null because it's not being set to anything else within the method.</p>
<p>As you're using <code>executeUpdate</code>, then you can use its return value for count:</p>
<pre><code>int count = pst.executeUpdate(sqli);
</code></pre>
<p>instead of trying to use <code>rs</code>.</p>
|
jQuery targeting selector by input type and form name <p>I want to target any input of text type belonging to a form of a specific name. Because the form will have numerous input fields, I don't want to target a particular input name, but rather, capture the blur (or focusout) event for any <code>input[type="text"]</co... | <p>The way the event <code>"change"</code> works is what it sounds like you want. An event handler doesn't actually fire when the input is clicked or if text is keyed in, it fires when text is entered <strong><em>and</em></strong> then the input loses focus.</p>
<p>In the following Snippet the same selector you are us... |
How to open NavigationDrawer with Fab? <p><strong>strong text</strong>
I want while click on FAB button it Open Navigation Drawer.</p>
<p>How to do?</p>
| <p>You can take a look at this <a href="https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.html#openDrawer(android.view.View)" rel="nofollow">DrawerLayout</a></p>
<pre><code>mDrawerLayout = (DrawerLayout) getView().findViewById(R.id.drawer_layout);
FloatingActionButton myFab = (FloatingAct... |
Transform property extends webpage, also having center issues <p>Here's the codepen if it's easier. I'm also a beginner, just a heads up.</p>
<p><a href="http://codepen.io/anon/pen/yaRpPL" rel="nofollow">http://codepen.io/anon/pen/yaRpPL</a></p>
<p>My problem is that every time I hover over this circle, it extends th... | <p>You need to change your margin, Do not use percentage values.</p>
<p>If you need to center your text just the code below to the parent element. </p>
<pre><code>display:flex;
justify-content:center;
align-items:center;
</code></pre>
<p>The css code: </p>
<pre><code>header {
text-align: center;
font-size... |
Timeseries Objects Duplicate Entries <p>I am working on a time series NoSQL database where I need to stamp values on an hourly basis. However, some times the values might stay the same. If the values, which are coming from a third party API, are the same, should I store them as duplicates or wait until the values are u... | <p>If values stays the same then it is not a duplicate entry as timestamp has changed.</p>
|
Getting GPS updates using fused location in background service For ex(15 mins)? <p>Am new for android development need to get gps location in background service without user interaction like for every 15 mins need to fetch the coordinates and send the results to server how can i achieve this. Then i tried fused locatio... | <p>I would suggest you to use AlarmManager to wake up device and receive location as soon as possible (interval 0) then continue to sleep at each 15 minutes. So this approach better than non-stop service.</p>
<p>If user turns off the gps, you will be still getting (network provider) location updates but not accurate d... |
dialog sapui5 oError.body display Rendering <p>Hi I have a dialog witch should display the content of an error in the console from a button.</p>
<p>Inside a UPDATE CRUD I have a dialog witch should return me an error from the console if the operation is in a certain situation.
This is my code from the error function.<... | <p>Should it not be <code>sap.m.Text</code>? Or are you using the AMD Module format? But you are using <code>sap.m.Button</code> in the same code...</p>
<pre class="lang-js prettyprint-override"><code>content: new sap.m.Text({
text: JSON.parse(oError.response.body).error.message.value,
}),
</code><... |
Error in `[<-`(`*tmp*`, i, succ, value = 1) : subscript out of bounds <p>I have to simulate an image with a white crack on a black background. So I defined a function that adds to a matrix with all elements equal to zero some consecutive points equal to one.
The function is the following: </p>
<pre><code>crepa<-f... | <p>These two lines:</p>
<pre><code> if (succ==(ncol(matrice)+1)) succ==ncol(matrice)
if (succ==0) succ==1
</code></pre>
<p>Should be:</p>
<pre><code> if (succ==(ncol(matrice)+1)) succ=ncol(matrice)
if (succ==0) succ=1
</code></pre>
<p>In case you still can't see it, you've used the equality test <code>==</cod... |
Calculated column based on other calculated column <p>I have code that will sum data for the hours column based on a description and then will sum hours based on the supervisor column. I would like to add a calculated column that will take the first sum and divide it by the second sum to give me a percentage. Here is... | <p>You can try this as well</p>
<pre><code>SELECT Description,
SumOfHours,
SupervisorEmail,
TotalHours,
SumSubsubHr/TotalHours AS 'Percentage'
FROM (
SELECT sap.Description,
Sum(main.Hours) AS SumOfHours,
main.supervisor1email AS Superviso... |
Android: Drag map while keeping marker at the center <p>I a, currently getting Current Location of device (lat,lng) in MapActivity. Now I want to let the user move the map, while keeping the marker at the center. This means that whenever the map is moved, current location will be updated. (Right?)</p>
<p>I followed th... | <p>Having a map under an ImageView with your marker icon would be the best way to go here (just a framelayout with your map fragment under and your marker image centered on top should work). Then you can use an <code>OnCameraIdleListener</code> which would receive a callback when the map movement has ended. So just set... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.