input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
device handle in GetTextExtentPoint32() <p>I want to use <code>GetTextExtentPoint32</code> to compute the size of the string in pixels. <code>GetTextExtentPoint32</code> has the follwoing syntax:</p>
<pre><code>BOOL GetTextExtentPoint32(
_In_ HDC hdc,
_In_ LPCTSTR lpString,
_In_ int c,
_Out_ LPSIZE ... | <p>So to get the width of a string of text in your PDF with libharu, use <code>HPDF_Font_TextWidth()</code>. This returns a <code>HPDF_TextWidth</code> structure; use its <code>width</code> field. The width will be measured in either <strong>1/1000th of an em</strong> or <strong>1000 ems</strong>, I'm not sure which (u... |
Graphics - How do I make drawn strings transparent? <p>I tried changing the alpha of a drawn string by doing this:</p>
<pre><code>g2d.drawString("HelloWorld", 50, 50, alphaValue);
</code></pre>
<p>This resulted in a compilation error.</p>
<p>All I'm trying to do is make a drawn string slowly turn transparent.</p>
| <p>You need to set the color</p>
<pre><code>Color curr = g2d.getColor();
// Color curr = Color.GREEN;
g2d.setColor(new Color(curr.getRed(), curr.getGreen(), curr.getBlue(), alphaValue));
g2d.drawString("HelloWorld", 50, 50);
</code></pre>
|
How can I get a list of accounts for users that have logged onto a machine? <p>I am looking for a way, to find out, which users have ever been logged on a local windows 10 machine by using PowerShell.</p>
<p>By using</p>
<pre><code>Get-WmiObject -Class Win32_UserAccount -Filter "LocalAccount='True'"
</code></pre>
<... | <p>This will get all the cached accounts that has been logged into a computer. Note that there are ways to clear this, so there's the possibillity that someone else has been logged in, but cleared the traces. Make sure to run as administrator if <code>lastusetime</code> is of interest. </p>
<pre><code>Get-CimInsta... |
Calculate average from kartik gridview(YII2) <p>I am making a cost accounting application. And then in a case, I have success to sum data, but when I want get a average, I get an error. I have to try too much code in here, but nothing result.
How can I do to get average from my data here?</p>
<p>This is my view:</p>
... | <p>This was the already answered question and was correct answer, but I think you are not able to figure-out the solution. </p>
<p>Now add this code on your view page and try</p>
<pre><code><?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use kartik\grid\GridView;
use yii\data\ActiveDataProvider;
use backe... |
Loop with very large number (2 ^ 64) hangs, how to iterate faster? <p>I'm using python 2.7 version.
I have simple loop like below given</p>
<pre><code>while i < math.pow(2,64):
do_something()
i += 1000
</code></pre>
<p>But this code runs too long. I have heard that python has scientific libraries for working wi... | <p><strong>EDIT</strong>: corrected base conversion from 2 to 10 (thanks Nick A!)</p>
<p>It's not clear what <code>do_something()</code> does, but I don't think this is a senseful approach. If you have to loop over <code>2^54</code> items it simply won't ever stop because it takes so long. Let's do some math.</p>
<p>... |
SQL Join with unique rows <p>I have two tables
Table1</p>
<pre><code> - EMPLID XX_EMPLID GTN DEDCD EFFDT
1 A1 102 XXYY 02-OCT-16
1 A1 103 XXYZ 02-OCT-16
</code></pre>
<p>Table2</p>
<pre><code> - EMPLID DEDCD EFFDT
1 XXYA 02-OCT-16
1 XXY... | <p>Ok, let's see if this answer suits your request.</p>
<pre><code>SELECT a.EMPLID,a.DEDCD, to_char(a.EFFDT,'YYYY-MM-DD') EFFDT, b.DEDCD as DEDCD2,GTN
FROM
(
select EFFDT,GTN,EMPLID,DEDCD,
row_number() over (partition by EMPLID order by DEDCD) rn
from table1 ) A
LEFT OUTER JOIN
(
selec... |
Idris mush tactic <p>So I was reading this paper on elaborator reflection (<a href="https://eb.host.cs.st-andrews.ac.uk/drafts/elab-reflection.pdf" rel="nofollow">https://eb.host.cs.st-andrews.ac.uk/drafts/elab-reflection.pdf</a>) and decided I wanted to try this this tactic out (found in section 5.2):</p>
<pre><code>... | <p>First of all, you need to add some imports:</p>
<pre><code>import Language.Reflection
import Pruviloj.Core
import Pruviloj.Induction
auto : Elab ()
auto =
do compute
attack
try intros
hs <- map fst <$> getEnv
for_ hs $
\ih => try (rewriteWith (Var ih))
hypothesis <|... |
Deactivate second tab in Angular md-tabs <p>Is there any attribute in angular material md-tabs that disables a tab something similar to what they have in Bootstrap.</p>
<pre><code>$scope.tabs = [{
title: 'Dynamic Title 1',
content: 'Dynamic content 1'
}, {
title: 'Dynamic Title 2',
content: 'Dynamic co... | <p>In angular material there is one attribute 'md-selected' , you can use it by set md-selected="selectedTabIndex", let me show you:</p>
<pre><code><md-tabs md-selected="selectedTabIndex" md-dynamic-height md-border-bottom md-center-tabs="true" md-stretch-tabs='always'>
<md-tab label="all" md-on-s... |
Error while installing VSTO file - A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F) <p>When I try install our VSTO (outlook) file on machine 1 for user a, it works fine but for user b it gives below exception.</p>
<pre><code>Log Name: Application
Source: VSTO 4.0
Dat... | <p>Check if there are files that are read-only that block ClickOnce from installing. The error is often not related to a device, but simply caused by installer obstructions where files cannot be deleted/overwritten using the ClickOnce engine.</p>
<p>It might be needed to clear out a previous installation properly manu... |
- (CGRect)convertRect:(CGRect)rect toView:(nullable UIView *)view <pre><code>UIView *sourceView = self.sourceImagesContainerView.subviews[self.currentImageIndex];
UIView *parentView = [self getParsentView:sourceView];
CGRect rect = [sourceView.superview convertRect:sourceView.frame toView:parentView];
NSLog(@"%@",NSStr... | <p>You can't use a tableView as a parent for this transformation unless you are prepared to subtract the contentOffset.</p>
<pre><code>UIView *sourceView = self.sourceImagesContainerView.subviews[self.currentImageIndex];
UITableView *parentView = self.tableView;
CGRect rect = [sourceView.superview convertRect:sourceVi... |
Get value from directive in controller <blockquote>
<p>I know these kind of questions have been asked many time before but none of them working for me. I'm new to directive working, may be its lack of learning that I'm unable to resolve my issue.</p>
</blockquote>
<p>I've a variable in directive that I need in contr... | <p>Try this: </p>
<pre><code>return {
restrict: 'A',
link: function (scope, element, attrs) {
var model = $parse(attrs.fileModel);
var modelSetter = model.assign;
element.bind('change', function () {
scope.$apply(function () {
mod... |
HTTP403: FORBIDDEN - The server understood the request, but is refusing to fulfill it <p>I keep getting the above 403 error when performing an AJAX call to an API. </p>
<p>The error occurs in Microsoft Edge, but does not occur in IE, Chrome, Firefox or Safari.</p>
<p>The page does not use bootstrap, as i have read th... | <p>For anyone else having this issue:</p>
<p>I put my code on a server and ran to it from there to test if it was the localhost connection - Which it was.</p>
<p>The API i am using must be configured to not allow localhost connections, which i've never experienced before.</p>
<p>Great way to waste 2 days and lose yo... |
Is there any way to clone a document in revit <p>I'm working on a revit project where we want to clone a document for multithreading purposes. However there does not appear to be any way to clone a document by default. There does not appear to be a Document.clone() function. </p>
<p>Ultimately I'm looking for somethin... | <p>It sounds like you may want to start by looking into the FilteredElementCollector class. This is has been, in my mind anyway, the default way to get whatever you need from a currently existing Document file. I suggest starting your search with the following and see if that works for you </p>
<pre><code> Fi... |
Paypal sdk for windows 10 app <p>I am developing a Windows 10 app which needs to accept payments through Paypal. I googled for that Windows SDK but didn't find Paypal SDK or documentation related to that.</p>
<p>So if anyone implement that previously please help me out for this.</p>
| <blockquote>
<p>I googled for that Windows SDK but didn't find Paypal SDK or documentation related to that.</p>
</blockquote>
<p>There is no official SDK for integrating Paypal in an UWP app for now.</p>
<p>My suggestion is that you can try to use <a href="https://developer.paypal.com/docs/integration/direct/invoic... |
why ReactDOM is not defined in my helloworld program? <p>I am the new learner of Reactjs. I am trying to execute hello world program in the browser.
But I got an error. i.e </p>
<blockquote>
<p>react-dom.min.js:12 Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined</p... | <p>Use react-dom.min.js after react.min.js
<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
... |
Highstock Shared Tooltip This Index <p>I have to use the shared formatted tooltip, how do I get the index of the point I am hovering on? I've tried other proposed solutions on stack-overflow and none work.</p>
<pre><code>tooltip: {useHTML: true, shared: true, formatter: function (tooltip) {
// where the hell is it!
... | <p>In a formatter callback with a shared tooltip you will not be able to distinguish which point has been hovered so you cannot get the point's index directly. However, the point which is looked for is stored as chart.hoverPoint.</p>
<pre><code>formatter: function(tooltip) {
// where the hell is it!
var nodes... |
Show title tag on hover inside img <p>Hi I need show a Title tag of img inside img.</p>
<p>Like this example <a href="http://jsfiddle.net/51csqs0b/" rel="nofollow">http://jsfiddle.net/51csqs0b/</a></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippe... | <p>This is all thing I can do:</p>
<p>add <code>.image</code> class to <code>a</code></p>
<pre><code><a class="image" href="#"><img src="http://i.stack.imgur.com/Sjsbh.jpg" class="" title="TITLE NEED SHOW ON HOVER" src=""/></a>
</code></pre>
<p>replace <code>data-content</code> with <code>title</co... |
Xcode 7.3- App installation failed <p>When I try to compile my app on my device (iPhone 5c),the Xcode occur this:</p>
<blockquote>
<p>App installation failed</p>
<p>An unknown error has occurred.</p>
</blockquote>
<p><a href="https://i.stack.imgur.com/HPLRm.png" rel="nofollow">like this</a></p>
<p>I have 3 ce... | <p>If you are using free development provisioning profile that you can create with Xcode then this is what you can do:</p>
<p>Steps:</p>
<p>1) Reset the development profile in Xcode Preference</p>
<p>2) Remove your Apple Account from Xcode Prefrences</p>
<p>3) Add Again</p>
<p>4) Create Again</p>
<p>5) Clean &... |
Chef Provisioning - How to use 'chef_server' attribute <p>I am writing a <a href="https://docs.chef.io/provisioning.html" rel="nofollow">Chef provisioning recipe</a> to deploy a number of VMs in our vCenter, using <a href="https://github.com/CenturyLinkCloud/chef-provisioning-vsphere" rel="nofollow">vSphere driver</a> ... | <p>Not sure if this will help you but I set the chef server url outside the machine/machine_batch resource. Something like this:</p>
<pre><code>with_chef_server 'https://api.chef.io/organizations/my_org',
:client_name => Chef::Config[:node_name],
:signing_key_filename => Chef::Config[:client_key]
</code></p... |
How to transver the pressure applied on Normal vector of traigular element to its nodes in FEM? <p>I have a traingular element with <strong>A,B,C</strong> as Vertices. I have applied a pressure <strong>P</strong> on the normal <strong>N</strong> of the traigular surface. now i Need to calculate the force acting on the ... | <p>Regardless of type of your element (namely, CST or DKT or ...), there are several approaches for converting the uniform body load into nodal loads for surface or volume elements. One of these approaches is 'Lumped' which means total force does distribute equally between your nodes. For your case, I suggest you to do... |
Call exported method in react native <p>I want to create a view in Objective C and use in react native, but don't know how to do this
Here's my code:
Obj-C:</p>
<pre><code>#import "DGTAuthenticateButtonView.h"
#import "RCTBridge.h"
#import "RCTEventDispatcher.h"
#import "UIView+React.h"
#import <DigitsKit/DigitsKit... | <p>It seems that's you're mixing 2 different concepts here.</p>
<p>You can either create a <a href="https://facebook.github.io/react-native/docs/native-components-ios.html" rel="nofollow">Native UI Component</a> - a native view that you can use as a component in your RN <code>render</code> functions; or you can create... |
Execute batch & .exe files with Python Code <p>Is there a way to execute batch & .exe files with a Python Code ? </p>
<p>Because i try to write a programm what should execute a batch and later a .exe file at different paths. </p>
| <p>I think what you are looking for is the library subprocess
<a href="https://docs.python.org/3.4/library/subprocess.html" rel="nofollow">https://docs.python.org/3.4/library/subprocess.html</a></p>
|
How to use Callback function on successful HTTP request in Angular2 <p>I am new to Angular2. I have referred the Hero Tutorial given in official web site and have written the following code for HTTP post request in Angular2 as per my requirement. I am used to java-script and i use AJAX calls to interact with web server... | <p>All you need is already in your code</p>
<pre><code>sendData(key: string){
return this.http
.post(this.licenceUrl, key, this.headers)
.toPromise()
.then(res => {
res.json().data;
// code here is executed on success
})
.catch(this.handleError);
}
... |
SAML For Java Application Running on Tomcat <p>I have a Java Application running on tomcat server. I am storing the user information in mysql table and for authentication using Java Rest service.
Now when I land on <strong><em>customer.myapp.com</em></strong> I want to check if there is an active session in the browser... | <p>Sound like a standard use case for the SAML Web Browser Profile. I would suggest reading up on in it. There is a lot of information on the Internet.</p>
<p>Basically the process goes like this.</p>
<ol>
<li>The SP and the IDP exchange metadataXML. This can be done by any means for example email or by publishing th... |
Crash when passing string <p>My code crashes when passing a string parameter.<br><br>Can someone help me sort this? : </p>
<pre><code>- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
NSIndexPath *indexPath = (NSIndexPath *)sender;
if ([[segue identifier] isEqualToString:@"abc"]) {
... | <p>The line in the error...</p>
<blockquote>
<p>-[UIViewController itemstring:]: unrecognized selector sent to instance 0x7fc89b0028d0</p>
</blockquote>
<p>This suggests that the destination of the segue is a <code>UIViewController</code> and not a <code>MyVC</code>.</p>
<p>You probably haven't set the subclass co... |
Intellij Command Line Tools wildcards <p>I'm using Intellij2016 and I would like to add and external tool (a linux rm invocation) in order to delete the content of a specific directory every time I debug my java application. I tried using the command line tools Console but when using * wildcard Intellij seems to ignore... | <p>This is a known <a href="https://youtrack.jetbrains.com/issue/IDEA-162745#tab=Comments" rel="nofollow">issue</a> about wildcards and External Tools (command line parameters).</p>
|
Protocol inheritance issue <p>I try to set up various protocols that work hand in hand. Unfortunately I cannot make them work the way I want. Looking at the following code, I think my goal is obvious: I want to require a class that conforms to a protocol X. If it conforms to protocol Y instead but protocol Y inherits f... | <p>I can see what you are getting at with the 'transitive' protocols, however your error is caused by your <code>associatedtype</code> declaration of VC as seen in the error.</p>
<p><code>Unable to infer associated type 'VC' for protocol 'ViewModelType'</code></p>
<p>I think the compiler is having difficulty here may... |
Jersey web app in Karaf OSGI environment does not work <p>I installed and activated the jersey server 2.19 bundles (and dependencies) in Apache Karaf in order to create a simple webapp ( /tracks/get which produce a json representation of a Track object with simple name and artist fields).</p>
<p>I created a bundle ver... | <p>Not sure if jersey works out of the box in karaf. The typical way to do REST in karaf is to use Apache CXF. CXF offers blueprint namespaces for REST as well as <a href="https://github.com/apache/cxf-dosgi/tree/master/samples/rest" rel="nofollow">CXF-DOSGi which can export REST endpoints</a> based on exported OSGi se... |
Difference between get _the_ excerpt and get_the_content <p>What is the difference between functions get the excerpt and get the content. Both returns the same</p>
| <p>Main difference between both is : </p>
<blockquote>
<p><em>get_the_excerpt</em> returns summary of the posts or we can say that short
content of the post or the content written in Post Excerpt metabox.
<code>excerpt</code> length can be altered by <code>excerpt_length</code> filter</p>
</blockquote>
<p>Exam... |
Understanding an SFINAE example <p>I have difficulties to understand SFINAE. For example, I do not understand why the following code does not compile:</p>
<pre><code>#include <iostream>
using namespace std;
// first implementation
template< size_t M, std::enable_if<M==1,size_t>::type = 0>
int foo()
... | <p>As stated in the comments, you must add <code>typename</code> before <code>std::enable_if</code> because <code>::type</code> is a <a href="http://en.cppreference.com/w/cpp/language/dependent_name" rel="nofollow">dependent type</a>:</p>
<pre><code>template< size_t M, typename std::enable_if<M==1,size_t>::ty... |
Xamarin.iOS, app crashes before it's even ran on the phone <p>when launching an app on the iOS 10 device, the app never gets launched, it just terminates. I have no logs on the device nor in the debug window of Visual Studio, I just see</p>
<blockquote>
<p>Launching 'App1' on 'iPhone'...</p>
<p>The app has been... | <p>Based on your description I'm fairly certain that you're hitting the new, iOS10 requirement, for application to state their required privacy permissions in their <code>Info.plist</code>. </p>
<p>Apple <strong>requires</strong> this for all applications compiled against the iOS10 SDK - otherwise iOS <strong>crash</s... |
How to aggregate calls using zuul <p>I have a REST service that's deployed many times. Each instance is connected to a different Data Source. But they all have the same API and same JSON format for the data returned.</p>
<p>I have created a Gateway module (SpringBoot) that's also a ZuulProxy. I then added the routIng... | <p>That isn't something the spring cloud zuul does natively. You would have to write your own filter to do it. See <a href="http://stackoverflow.com/questions/28467756/how-do-you-create-custom-zuul-filters-in-spring-cloud">How do you create custom zuul filters in spring cloud</a></p>
|
Maven dependency:copy-dependencies -- Get javadoc and sources <p>The Maven goal <code>dependency:copy-dependencies</code> copies artifacts together with their poms (if the parameter is set). Is it somehow possible to also grab sources and javadoc?</p>
| <p>You won't be able to copy the dependencies, along with their sources and their javadoc in a single pass, but you can use <a href="http://maven.apache.org/plugins/maven-dependency-plugin/copy-dependencies-mojo.html#classifier" rel="nofollow"><code>classifier</code></a> parameter and multiple invocation of the Depende... |
Replace Colons with equal to sign in Json using C# <p>I have a json like this</p>
<pre><code>{
name: "Bhupendra",
Age: 28
}
</code></pre>
<p>and I want to replace colons <code>:</code> from json in C#, but they must not replace values Instead only the seperator should be replaced with <code>=</code>
Expecting ... | <p>You can use regular expression to do this. here i try it in JavaScript. </p>
<pre><code><!DOCTYPE html>
<html>
<body>
<p>Click the button to return the string value of the regular expression.</p>
<button onclick="myFunction()">Try it</button>
<p id... |
Overflow in C function strcpy() <p>I'm programming in C language in Linux envirioment and
I'm a confused aboute why segmentation fault does not occur in this code:</p>
<pre><code>int main(){
char buffer[4];
char tmp="qqqqqqqqqqqqqqqqqqqqqqqq";
char *r;
r=strcpy(buffer,tmp);
return 0;}
</code></pre>
<p>I use vari... | <p>C gives you the ability to shoot yourself in the foot.</p>
<p>It's <em>your</em> responsibility to ensure that the receiving buffer is large enough for the contents of the source string passed to <code>strcpy</code>. (Don't forget to allow space for the nul-terminator). That's why people who enjoy their current emp... |
File pointer reading in c and returning null if EOF <p>I am a student making a function that takes an file pointer, lets say <code>stdin</code> and returns a struct pointer. So I'm not sure how to begin. It should return a <code>null</code> pointer when EOF is encountered.</p>
<p>This is what I made so far:</p>
<pre>... | <p>You roughly need this:</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct book
{
char *author;
char *title;
char *bookcode;
} Book;
void freeBook(Book *p)
{
free(p->author);
free(p->title);
free(p->bookcode);
free(p);
}
Book *getBook(... |
Ionic screenshot without 3D WebGL content <p>I have created an ionic app with a 3D webgl canvas.
I tried taking a screenshot of my html including the webgl content with the following code (from <a href="https://www.npmjs.com/package/com.darktalker.cordova.screenshot" rel="nofollow">https://www.npmjs.com/package/com.dar... | <p>For those of you who encounter the same problem, I solved it using the following workaround:</p>
<p>Simply add an <code><img id="placeholder" src=""/></code> below your <code><canvas id="cv" ></canvas></code> and modify screenshot function as follows:</p>
<pre><code>render();
var data = document.... |
Can't empty a bash array (bash --version 3.2.25) <p>My bash array never empty itself.</p>
<p>I am using bash 3.2.25.
I tried using the folowing methods:</p>
<pre><code>declare -a array
# fill array...
# 1
array=()
# 2
empty_array=()
array=( "${empty_array[@]}" )
# 3
unset array
</code></pre>
<p>My array never ge... | <p><code>to_add</code> is also a global variable, and you don't reset its value before appending to it. However, you don't need it: you can append directly to the array.</p>
<pre><code>declare -a array
function get_array() {
local line rest
array=()
while read -r line rest || [[ -n "$line" ]]; do
if [ -n ... |
MySQL Trigger invalidate <p>I have to invalidate a Before inset trigger so that the line will not be inserted in the table</p>
<pre><code>CREATE TRIGGER Trig1
ON MyTable
FOR EACH ROW
BEGIN
.
.
.
.
.
END
</code></pre>
<p>Can i use an other way that displays the error message rather than</p>
<pre><code>INSERT into M... | <p>The trigger does no rollback or commit. To initiate any rollback, you have to raise an exception. Thus your insert/update/delete command will abort. The rollback or commit action has to be raised around your SQL command.</p>
<p>To raise your exception, in your XXX's trigger (eg.) :</p>
<pre><code>create trigger Tr... |
Dynamically load in series HighCharts <p>I am trying to dynamically load in a number of series, depending on projects chosen by the user. I am using Laravel 5.2, PHP 5.6 and HighCharts.
I have managed to load in one JSON file, which is generated when the user selects projects. But I would like it if the JavaScript cou... | <p><br><br>
I think highcharts has a method <code>chart.addSeries</code> for adding a new series. If you want to replace the current series with a new series, you can try removing first the current series using <code>chart.series[0].remove( )</code> then add the new series with <code>chart.addSeries</code>. The paramet... |
get parameters when route is changed in root component using Angular2 <p>so i want to get parameters when route is changed in root component, i tried this :</p>
<pre><code>export class AppComponent {
constructor(_router: Router) {
_router.events.subscribe((links) => {
console.log("detection ... | <blockquote>
<p>So I want to get parameters in the root component, when the route is changed </p>
</blockquote>
<p>You can't. Why? Because your root component is not assigned to any route. Go to your <strong>ProductComponent</strong> and change it to something like this:</p>
<pre><code>import { Component, OnDestroy... |
ReactComponent vs ReactComponentElement in scalajs-react <p>I am trying to write some extra <a href="https://github.com/jhegedus42/scalajs-react-playaround/wiki/React#how-do-scalajs-react-types-map-to-js-react-types-" rel="nofollow">scalajs-react documentation</a> but I am confused.</p>
<p>It says <a href="https://gi... | <p>Perhaps I'm over simplifying, but the source code indicates that a ReactElement is a javascript object with the properties of a ReactNode and <code>key</code> and <code>ref</code> properties. I wouldn't put as much stock in the vDom / scaladoc comments. They exist to provide a hint to the user, not the compiler. It'... |
Does restarting a PC clear the browser cache? <p>I have an old application running on locked-down PCs which are used as wall displays. They all point to a URL using IE11 to get a web page view. The problem is, when the Web Page updates, even if it is refreshed, a cached version is displayed.</p>
<p>If the PC is reset ... | <p>To reduce some potential caching issues, it's best to have Internet Explorer set to request the latest version of the page rather than relying on a cached copy. To do this:</p>
<ol>
<li>From the <strong>Tools</strong> menu choose <strong>Internet Options</strong>.</li>
<li>On the General tab, under Browsing histor... |
Class for controlling properties of the PictureBox (C# forms) <p>I am trying to write something along of a "clean" code... I want to make a Pong game, for now based on Forms.
I want to divide the game nicely into classes.</p>
<p>I want to have a ball class, AI that inherits from player class, I want to use the premade... | <p>You got an issue here:</p>
<pre><code>protected Point Location
{
get
{
return Location; // <--- this is a circular reference..
// meaning, it will recall this getter again.
}
set
{
PaddleBox.Location = new Point(value.X, value.Y);
}
}
</c... |
How to send readable part of mp4 while recording it <p>I'm working on an app that records video in background and sends it to server in parts by reading bytes and storing them in byte array. For now algorithm is pretty simple:</p>
<ol>
<li>start recording;</li>
<li>reading part of video file to byte array;</li>
<li>se... | <p><strong>SOLUTION</strong></p>
<p>I decided to record small chunks of video in recursive way. Next solution is suitable for first version of Camera API. If you're using Camera2 or something else - you can try to use same algorithm.</p>
<p>In service class that records video make sure that mediarecorder is configure... |
what is the right way to Unit test business logic with RedBeanPHP ORM <p>I'm trying to test my business logic that interacts with RedBeanPHP ORM , I don't want to test the RedBeanPHP itself but the behavior of my code when associated with RedBean .</p>
<p>I thought of mocking the method that I wanna test then return t... | <p>I suggest you to use <a href="https://packagist.org/packages/phake/phake" rel="nofollow">The Phake mock testing library</a> that support <a href="http://phake.readthedocs.io/en/2.1/mocking-statics.html" rel="nofollow">Mocking Static Methods</a>. As Example:</p>
<pre><code>/**
* @param string $tableName
* @param i... |
How to create postgres extension inside the container? <p>I have to install <code>hstore</code> to my docker postgres<br>
Here is my ordinary command in the shell to execute my need<br></p>
<pre><code>psql -d template1 -c 'create extension hstore';
</code></pre>
<p>If I remove that line my container, it works, but I ... | <p>It's failing because Postgres isn't running in the container during the build, it's only started in the <code>CMD</code> when a container runs.</p>
<p>The <a href="https://github.com/docker-library/postgres/blob/b2317dd369030a5f3f030b1daa1fc80da3cab9e0/9.6/docker-entrypoint.sh" rel="nofollow">entrypoint script for ... |
Convert to ascii in oracle <p>I am using Asciistr method in oracle which is supposed to convert given structure to ascii. Arabic characters are converted correctly but english are still the same while in some online converters I can see that numbers like 1 and 2 are converted to 0031 and 0032.
Here is my method:</p>
... | <p>As I understand you want to convert any string to consequence of 4 digits tuple. I think you functions should look like</p>
<pre><code> CREATE OR REPLACE FUNCTION to_ascii(str_a VARCHAR2) RETURN VARCHAR2 IS
l_str VARCHAR2(32767);
l_res VARCHAR2(32767);
i NUMBER := 0;
l_char VARCHAR2(1... |
Swift Compiler Error on Pods <p>I made single view application and install pods. I'm using Alamofire, SwifttyJSON,HanekeSwift, and RealmSwift. after the installation, i open .xcworkspace and then get so many errors like this</p>
<p><a href="https://i.stack.imgur.com/iWB9Q.png" rel="nofollow"><img src="https://i.stack.... | <p>I guess you are using a lower version of Xcode and swift is lower while current alamofire and swiftyjson are updated to support xcode 8+ and swift 3.0 or above. You will need to use specific pod to use it in lower xcode.</p>
<p>To go to specific version of pod you need to do it like this</p>
<p>pod 'Alamofire', '3... |
Active link works on page refresh but not scroll? <p>I'm trying to get my links in my fixed header to change on scroll.</p>
<p>The code seems to work if you refresh the page for e.g. If you scroll to Section C and refresh the page and scroll it recognises you're on that section, but for some reason it doesn't seem to ... | <p>Here is the corrected fiddle</p>
<p><a href="https://jsfiddle.net/Lr53c1oh/3/" rel="nofollow">https://jsfiddle.net/Lr53c1oh/3/</a></p>
<p>you need to get the current value of scrollTop every time in the scroll event</p>
<pre><code>$(document).on("scroll", function(){
var scrollTop = $(document).scrollTop();
//res... |
Use numeric custom metrics in Google Analytics on iOS <p>I need to set a custom metric with a simple google analytics event.</p>
<p>I use the following method: to set the event, then set the custom metric, then send it all:</p>
<pre><code>GAIDictionaryBuilder.createEvent(withCategory: <#T##String!#>, action: &l... | <p>Indeed the server converts the String in Int. Obvious!</p>
|
I am deploying Django App on heroku, after successful deployment , I am getting operational Error <pre><code>OperationalError at /admin/login/
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?... | <p>There is a problem in your database settings. You have to modify database settings to be able to deploy to Heroku. I have never used it, but this page explains how to configure database for Django:
<a href="https://devcenter.heroku.com/articles/django-app-configuration" rel="nofollow">https://devcenter.heroku.com/ar... |
The Textbox doesn't show the blinking cursor on clicking or when it has focus <p>In the textboxes from the code below, the blinking cursor doesn't show even after i click the textbox or when it has focus.I'm posting this big a code because i think perhaps it's the parent element properties that are somehow interfering ... | <p>It looks like you problem might comes from the ScaleTransform. If a TextBox is scaled to less then it's original size it's cursor disappears. This happens because the TextBox caret is with Width of 1 and when scaled down it becomes less then 1. So it's not visualized at all.</p>
<p>As a workaround make the minimal ... |
Remove First and last line of File using Pig Script <p>I want to remove the first and last line/row of my file in HDFS using pig script. I tried to achieve this using <strong>Rank</strong> and it worked but i should know the last rank number to remove it but my file is dynamic it can have more or less rows, for that ca... | <p>Once you have Rank available, you can get the first and last rank which you want to exclude (i.e. first and last line of you file) by mean of MIN and MAX eval functions. This way you need not to hard code the rank filter.</p>
<ol>
<li><a href="http://pig.apache.org/docs/r0.16.0/func.html#max" rel="nofollow">Eval fu... |
design custom toggle button in android <p>Can any body please tell me how to design the custom toggle button.</p>
<p><a href="https://i.stack.imgur.com/Cm0Ql.png" rel="nofollow"><img src="https://i.stack.imgur.com/Cm0Ql.png" alt="enter image description here"></a></p>
| <p>create toggle_selector.xml in res/drawable</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/toggle_on" android:state_checked="true"/>
<item android:drawable="@drawable/toggle_off" a... |
Jsch Exec output for error <p>I need to run shell script at a remote machine. I am using JSch to connect to the remote machine and executing the shell script using <code>ChannelExec</code>.
I need to know how I can get to know, if there was any error while execution of the command.</p>
<p>Following is my code</p>
<pr... | <p>Start with the official example for the "exec" channel, do not re-invent the wheel:<br>
<a href="http://www.jcraft.com/jsch/examples/Exec.java.html" rel="nofollow">http://www.jcraft.com/jsch/examples/Exec.java.html</a></p>
<p>To read the error, read also the error stream using the <code>ChannelExec.getErrStream</co... |
How to Initialize 2D Array of QGraphicsItem <p>I'm using Qt for some gui stuff, and I have inherited QGraphicsScene to implement some of my own methods, and one of the things I did was create a list of QGraphicsItems, specifically a 2D array of an object I made which inhertits the QGraphicsItem.</p>
<pre><code>MatrixB... | <p>Your problem is <strong>you are using x as index for row and y as index for column but the boundary conditions are just opposite</strong></p>
<p>So modify your code to :</p>
<pre><code>for (int x = 0; x < this->height; x++){
for (int y = 0; y < this->width; y++){
this->buttons[x]... |
Updating r plot_ly chart by drop down menu <p>I have simple example of plotly chart and found very interesting drop down menu functionality within of plotly charts (<a href="http://moderndata.plot.ly/new-feature-dropdown-menus-in-plotly-and-r/" rel="nofollow">link</a>).</p>
<p>When I tried that on very simple mtcars e... | <p>Your code has some syntax errors, change it to something like this should work appropiate:</p>
<pre><code>p <- plot_ly(mtcars, x= ~mpg, y= ~hp, type="scatter", mode = "markers")
p %>% layout(
yaxis = list(title = "y"),
xaxis = list(title = "x"),
updatemenus = list(
list(
y = 0.8,
buttons... |
Angular 2 can't do actions in subscribe method after service called <p>I have a service to authenticate my user but I don't know what to do with the data that I received. I wan't to redirect the user to the correct page depending of his role and display his name in the page.
I tried different things but when I called ... | <p>Your problem is following line: <code>.subscribe(function(result){</code> !!</p>
<p>With that <code>function()</code>-syntax the <code>this</code>-scope is lost!</p>
<p>You have to use the arrow-syntax <code>() =></code> ..</p>
<p>Like this: <code>.subscribe((result) => {</code>.</p>
<p>That's it, now you ... |
Convert binary string to hexadecimal string C <p>As the title said I was interested in the best way to convert a binary string to a hexadecimal string in C. The binary string is 4 bits at most so converting into a single hexadecimal char would be best.</p>
<p>Thanks for any help, I'm not sure if there's something buil... | <p>You can use <code>strtol</code> to convert the binary string to an integer, and then <code>sprintf</code> to convert the integer to a hex string:</p>
<pre><code>char* binaryString = "1101";
// convert binary string to integer
int value = (int)strtol(binaryString, NULL, 2);
// convert integer to hex string
char he... |
Laravel function in model <p>I have a Laravel model with a simple function in it. But for some reason I get this error:</p>
<blockquote>
<p>Relationship method must return an object of type
Illuminate\Database\Eloquent\Relations\Relation</p>
</blockquote>
<p>Here is my Model:</p>
<pre><code>class Dish extends Mo... | <p>If the calculation will be performed with the model data, you do not need to use <code>$this->attributes</code> to get the model data, that way it actually makes it a bit more "dirty". the cleanest way it will be as mention in the comments: </p>
<pre><code>public function sumBegin($default = 10)
{
return $th... |
Error : java.lang.NoClassDefFoundError: akka/util/Timeout <p><br>
i would like create an API using <strong>spray.io</strong>, i'm follow every instruction from <a href="https://danielasfregola.com/2015/02/23/how-to-build-a-rest-api-with-spray/" rel="nofollow">https://danielasfregola.com/2015/02/23/how-to-build-a-rest-a... | <p>at <strong>build.sbt</strong>, add some code, below this : </p>
<pre><code>mergeStrategy in assembly := {
case m if m.toLowerCase.endsWith("manifest.mf") => MergeStrategy.discard
case m if m.toLowerCase.matches("meta-inf.*\\.sf$") => MergeStrategy.discard
case "reference.conf" => MergeStrategy.concat
c... |
asterisk PAGI dynamic node interruptable <p>im developing dialplan using asterisk and PAGI (PHP asterisk gateway interface)
but i cant find a way to create node which can have dynamic number of annoucements depends on result from database.
I found a way to do this by adding annoucements in loop in method called execute... | <p>You have create in your php code string like</p>
<pre><code>announce1&announce2&announce3
</code></pre>
<p>using loop. After that you can use that string for Playback command, it will work like one large file.</p>
|
disable "done" button on numberDecimal keyboard android? <p>I'm making a calculator app in android and have set the keyboard to always be open in the manifest but if you press the done button it still closes.
is there any way to override this? </p>
<p>the code i have used in manifest:
android:windowSoftInputMode="stat... | <p>You can use Handle and Runnable to enable keyboard .... with this code in Runnable:</p>
<pre><code>InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(getCurrentFocus(),InputMethodManager.SHOW_IMPLICIT);
</code></pre>
<p>But I think you should... |
How to fill Scala Seq of Sets with unique values from Spark RDD? <p>I'm working with Spark and Scala. I have an RDD of <code>Array[String]</code> that I'm going to iterate through. The RDD contains values for attributes like <code>(name, age, work, ...)</code>. I'm using a Sequence of mutable Sets of Strings (called <c... | <p>The answer lies in the fact that Spark is a distributed engine. I will give you a rough idea of the problem that you are facing. Here the elements in each <code>RDD</code> are bucketed into <code>Partitions</code> and each <code>Partition</code> potentially lives on a different node.</p>
<p>When you write <code>rdd... |
Undefined index error when getting results using the field name in oracle pdo connection <pre><code><?php
include ("pdo_mysql_connect.php");
// include ("pdo_oracle_connect.php");
$query="select city ,state from student";
$dataf = $pdoc->query($query);
for($x=0;$x<3;$x++) {
$resultf = $dataf->fetch(... | <p>Use PDO::FETCH_ASSOC option while using fetch function, then fetch function will return data with column names as keys. Otherwise it will return array with numericals as keys.</p>
|
Collect asynchronous and synchronous data in loop <pre><code> var data = [10,21,33,40,50,69];
var i = 0;
var dataSeq = [];
while(i<data.length){
if(data[i]%2 == 0){
store.findOne({'visibility': true},function(err, data){ ... | <p>I think <a href="http://caolan.github.io/async/docs.html#series" rel="nofollow">asyncjs#eachSeries</a> has what you need. </p>
<p>Your code would become something like this:</p>
<pre><code>async.each(data, (item, callback) => {
if(item%2 == 0){
store.findOne({'visibility': tr... |
highcharts-ng addpoint each second <p>I has a livedata spline (updated each second)
But i ll do the same thing with an angular app</p>
<p>(I want to do this : <a href="http://www.highcharts.com/demo/dynamic-update" rel="nofollow">http://www.highcharts.com/demo/dynamic-update</a>
with highcharts-ng in my angularApp.)</... | <p>I think you will be able to achieve the desired results with a small change adding $scope.$apply in your setInterval function:</p>
<pre><code> setInterval(function () {
var x = (new Date()).getTime() // now
var y = Math.random()*180;
$scope.$apply(function() {
//series.addPoin... |
Getting a rectangle to display on the screen in pygame <p>I have the following code, but for some reason the white rectangle doesn't disply on the screen on running the program. It could have something to do with where I have put various blocks of code, or something else. Could someone please advise? Many thanks in adv... | <p>I've just looked at your code and the reason why you can't see the 'white surface/rectangle' on the screen is because it is being blitted outside of the screen's width and height!</p>
<p>When blitting a Surface or Image etc, the x and y coordinates that you pass for the position will set the surface's top-left pixe... |
Using POST via AJAX and PHP to send data <p>I have an object I am sending in an AJAX request:</p>
<pre><code> function send_value() {
$.ajax({
type: 'post',
url: 'get.php',
data: {
source1: "some text",
source2: "some text 2",
uniId: 3
},
... | <p>The issue is because you're not preventing the standard form submission. Hence your <code>form</code> element is sent with no data as it contains no form control elements. </p>
<p>To fix this you can return the function output to the event handler:</p>
<pre><code><form action="get.php" method="post" name="sendf... |
XML Processing not working <p>I am trying to extract data from a sensor (it communicate with "xml type" strings) and convert it to csv.
With my actual code i already write xml files, but the data come in single rows (from root to /root it is).</p>
<p>Dunno if this is the reason but i get a <strong>elementtree.parse er... | <p>You should open your input file by 'read' instead of 'write'. Or you will empty your file when you run your code.</p>
<pre><code>fp_xml = open(file_xml, 'r');
</code></pre>
<p>Besides, I have a better way to get all elements.You don't need to know what the names of all tags ahead of time.</p>
<pre><code>header ... |
How to stop or interrupt a function in python 3 with Tkinter <p>I started with programming in python just a few months ago and I really love it.
It's so intuitive and fun to start with.</p>
<p>Data for starting point:
I have a linux mashine on which runs python 3.2.3 I have three buttons on GUI to start a function wit... | <p>Use <code>threading.Event</code></p>
<pre><code>import threading
class ButtonHandler(threading.Thread):
def __init__(self, event):
threading.Thread.__init__(self)
self.event = event
def run (self):
while not self.event.is_set():
print("Button 1 is pressed!")
t... |
Running an exe file with parameters in a VBScript <p>I need to create a script that runs <code>setup.exe /configure Install.xml</code> from the folder the script is located.</p>
<p>When I run the script below, it does find the <code>setup.exe</code> but it does not read the parameters. It is like the last part (<code>... | <p>Most likely your code doesn't find and run the <code>setup.exe</code> in the script folder, but a different <code>setup.exe</code> somewhere in the <code>%PATH%</code>.</p>
<p>Simply appending the folder to the commandline is not going to do what you want. There are two ways for you to solve this issue:</p>
<ul>
<... |
JavaScript - Fetching Associated Values of (this) Parameter in an onclick Function <p>I am passing on (this) parameter to a function thru onclick(). Within the function when I try to fetch "name" attribute of the calling object of a Table Data Cell it fails. Here is the code.</p>
<pre><code><button name="abcd" oncl... | <p><code>name</code> may not be an property for all the elements (as per <a href="https://developer.mozilla.org/en/docs/Web/HTML/Element/table" rel="nofollow">doc</a> <code>table</code> doesn't have name property), so try <code>getAttribute</code></p>
<pre><code>alert(xparam.getAttribute("name"));
</code></pre>
|
Get the pageUrl (randompage.html) from a string using regex in C# <p>How can i extract the pageurl randompage.html from the following path using regex?</p>
<p>/stars/thisisapath/randompage.html </p>
| <p>For any path ending in <code>.html</code>, this should work:</p>
<pre><code>[^\/]+\.html$
</code></pre>
<p>Example: <a href="https://regex101.com/r/pauXBb/2" rel="nofollow">https://regex101.com/r/pauXBb/2</a></p>
<p>If you want it to be more generic, and accept any file extension, then try:</p>
<pre><code>[^\/]+... |
Getting data from JSON and comparing at Login <p>I have made a JSON webservice which has a list of userID and passwords.I want to get the userID and password checked/compared on the loginscreen of submit button of my ionic project only when details match I should be logged in to my next page or else my access should b... | <p>Here is the complete code snippet what exactly your needs.</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-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/angul... |
What does this icon mean in the Powerline shell git segment? <p>I recently switched from using <a href="https://github.com/powerline/powerline" rel="nofollow">Powerline</a> only in Vim to also using it in zsh and tmux. Using the default configuration for everything so far.</p>
<p>In the shell prompt for a git repo, ca... | <p>It's the number of stashes.</p>
<p>After seeing the number increase and decrease while working I was able to figure this out.</p>
|
Logger name in each java class <p>I am replacing an old logging system in my java application with <code>log4j2</code> .
I am a little confused with logger names. Is the logger name the same thing that we define in the xml file and should that be the same as the argument for <code>logmanager.getlogger (arg)</code> ? </... | <p>You can use <code>private static Logger logger = LogManager.getLogger( YourClassName.class )</code>.</p>
<p>If you only have setup a root logger, this already will show up messages from there.
If you want to have loggers from a specific package to be configured differently from rootlogger (e.g. different log level)... |
How to remove this update icon? Android Swiperefersh <p><strong>CODE</strong></p>
<pre><code>public class YellowFragment extends Fragment implements FlowerAdapter.FlowerClickListener{
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle sav... | <p>After your task is completed, just call <code>swipeContainer_yellow.setRefreshing(false)</code> and it will hide that progressbar</p>
<p>As i can see you have already used it, but problem is you are assuming that your response will be perfect all the time. So instead of keeping it inside <code>if (response.isSucce... |
Cannot start simple docker container with "docker start" command from created image <p>I have simple commands for making and starting container (create.sh):</p>
<pre><code>docker build -t foo .
docker rm bar
docker create --name=bar foo && \
docker start bar && \
docker exec bar sh /bin/echo Test!!!
<... | <p>Your Dockerfile has no ENTRYPOINT or CMD, so it finishes immediately, that is normal.</p>
<p>Check the docs about ENTRYPOINT</p>
|
parse-server source build error when run 'npm install' <p>I tried download parse-server source(<a href="https://github.com/ParsePlatform/parse-server/tree/2.2.21" rel="nofollow">2.2.21 on github</a>) and build but I getting this error.</p>
<p>run command
<code>$ npm install</code></p>
<pre><code>npm WARN deprecated ... | <p>Did you ever resolve this issue? I had this issue on my dev machine but not on my build machine. Strange. Thanks.</p>
|
Restricting Google Places Api results <p>Is it possible to restrict Gopogle Places API to return result within a particular region. I want to retrive results inside Delhi/NCR region. Let's say when I type S in my textfield, it should return Sohna Road, sector 49, gurgaon (and other Delhi/NCR regions) but not State of K... | <p>I think you can achieve this by using the right <code>location</code> and <code>radius</code> according to the <a href="https://developers.google.com/places/web-service/autocomplete" rel="nofollow">developers guide</a> :</p>
<ul>
<li><strong>location</strong> â The point around which you wish to retrieve place
in... |
Continuing Counting Across Subs <p>I am running my main sub which I want to pause every 5 loops for 10 seconds. My code appears to work, but the problem I am facing is that my counting variables (namely j, i, and n) reset their counts after the pause sub is run.</p>
<p>Is there an effective way of passing keeping the ... | <p>Try to use <code>Application.Wait</code> function, instead of <code>Application.OnTime</code>.</p>
<p>Your code would look like:</p>
<pre><code>Sub DataPopulation()
Dim count As Integer
Dim n As Integer
Dim i As Integer
Dim Total As Long
Dim j As Integer
i = 6
n = 7
Total = Cells(Rows.count, "A").End(xlUp).Row
Fo... |
Select all rows from one table and one specific value for each row from another table <p>Good afternoon lads, I am trying to make a page where I can check which bosses I did today. I have two tables (table with bosses and table with boss times). Now I need to show all bosses but for each of them I only want to show the... | <p>I removed GROUP BY and changed the condition to WHERE bossTime.time >= '$currentTime' AND bossTime.time <='$timePlusForm' and for some reason it works</p>
|
Laravel 4.2 behind ELB - Sessions not working <p>I'm running Laravel 4.2 with database session storage.
My application is running behind a Load Balancer.</p>
<p>When only one instance is running, my application works fine.
Then if i enable a second instance my application stops working.</p>
<p>My application adds a ... | <p>I found the problem.
I'm using <a href="https://forge.laravel.com" rel="nofollow">forge</a> to manage and deploy my application. When i deploy my code its running <strong>composer install</strong> and its seems to edit my <strong><em>config/app.php</em></strong> .
I just redeployed my <strong><em>config/app.php</e... |
SSH invocation of a subsystem SFTP using command line <p>I am facing a problem where I have an SFTP server (with no SSH shell access). </p>
<p>When from a client machine I do SFTP request it works:</p>
<pre><code>sftp username@remote_IP
</code></pre>
<p>Then if I do a SSH request it hangs</p>
<pre><code>ssh -l use... | <p>What do you expect it to do?</p>
<p>It starts the SFTP server. And the server waits for SFTP requests, particularly for the <code>SSH_FXP_INIT</code>. And it never gets one. The SSH terminal (<code>ssh</code>) will hardly send an SFTP packet.</p>
<p>So it hangs. As expected.</p>
<hr>
<p><em>(Note that despite th... |
how to get s3 bucket size via aws-sdk (javascript or node) <p>I tried to find/get s3 bucket information using javascript/nodejs aws-sdk, but I didnt find such apis. How to get s3 bucket size / information via aws-sdk (javascript or node) api.</p>
| <p>There is no API to get the bucket size other than enumerating all the objects. </p>
<p>One alternative approach would be to investigate the billing, but I think that will only yield inaccurate data as the billing handles a specific size over a specific time. </p>
|
Making a scroll method with Up and Down arrow in C# <p>I'm building a text based game with three other for a project at school.</p>
<p>We have a log where every line that has been written will be written.</p>
<p>I always take a height of 45 lines and a width of 145, so you have 45 lines to write in, I have made a GUI... | <pre><code>public static void ScrollUpAndDown()
{
if (Program.busy != true)
{
ConsoleKeyInfo KeyInfo;
KeyInfo = Console.ReadKey(true);
switch (KeyInfo.Key)
{
case ConsoleKey.UpArrow:
CurrentLine--;
... |
Need some explanation about one line (pointers) <p>i have one little question, i try to understand a function in C and there is one line i dont understand ...
this is the code :</p>
<pre><code>void *my_memcpy(void *dest, const void *srce, size_t n)
{
unsigned int size_tmp;
size_tmp = 0;
char *tmp_dest ... | <p>If you dig out your operator precedence table, you'll notice that postfix <code>++</code> has a higher precedence than pointer <em>dereference</em>. So</p>
<p><code>*tmp_dest++ = *tmp_srce++;</code></p>
<p>is evaluated as</p>
<p><code>*(tmp_dest++) = *(tmp_srce++);</code></p>
<p>This means that the pointer <code... |
How to resolve error Object #<Object> has no method 'Router' in node.js <p>In routes/index.js</p>
<pre><code>var express = require('express');
var router = express.Router();
</code></pre>
<p>it gives an error</p>
<pre><code>TypeError: Object #<Object> has no method 'Router'
at Object.<anonymous> (/home/d... | <p>Check your express version</p>
<blockquote>
<p>Express router came in <a href="https://github.com/expressjs/express/wiki/New-features-in-4.x" rel="nofollow">express 4</a></p>
</blockquote>
<p>After updating your express version then try to use it</p>
<pre><code>var express = require('express');
var router = exp... |
html not coming properly in outlook <p>Html emails are not displaying properly in outlook, but are working fine in gmail. What should I do?</p>
<p>There is a design break in outlook..</p>
<p>Here is the html code:</p>
<pre><code>strEmailBody = strEmailBody + " <table id=\"table_banner\" cellspacing=\"10\" cellpad... | <p>What are you using to send the Email?
If you are using MailMessage, do you set IsBodyHtml to true?</p>
<pre><code>MailMessage mm = md.CreateMailMessage(mailTo, ld, new Control());
mm.IsBodyHtml = true;
</code></pre>
|
Calculating a definite integral results in a really complex numerical expression instead of a numerical value <p>I am trying to calculate the percentage of sun radiation that is in the visible spectrum.
<br>
My code is:</p>
<pre><code>h=6.626e-34; %planck constant
c=3e8; %speed of light
k=1.38066e-23; %boltzma... | <p>You can convert it to a double using, well: <a href="https://se.mathworks.com/help/symbolic/double.html" rel="nofollow"><code>double</code></a>:</p>
<pre><code>Vp_double = double(Vp)
</code></pre>
<p>You can also use <a href="https://se.mathworks.com/help/symbolic/vpa.html" rel="nofollow"><code>vpa</code></a> if y... |
App crashes when launching another activity <p>I searched everywhere for a solution to my problem, but couldn't get one.So, the problem is I want to launch another activity called <code>FifthActivity</code> from my <code>MainActivity</code> via the button but my activity keeps crashing. I checked the <code>logcat</code... | <p>Try this and let me know if problem solved or not.....</p>
<pre><code>Animation shake,bounce;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fifth);
shake = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.... |
Struggling to debug member function bind_param() <p>I know this might look like a duplicate question. Have had a look at different question and answers, but struggle to get result. So basically my edit profile is working great, before i decide to had more field and still field somehow causing problem. so am getting th... | <p>Your problem is here: </p>
<pre><code> if(!($stmt = $con->prepare("UPDATE user SET firstname = ?, lastname = ?, profession = ?, user_name = ?, phone = ?, address = ?, email = ?, bio = ?,
gender = ?, postcode = ?, dob = ?, country = ? WHERE id = ?"))) {
echo "Prepare failed: (" . $con->errno ... |
Maximum connection to fetch records from database for a dynamic page generation in Java <p>I am developing a web application which has only one page where visitors can see the latest news. I want to generate this page dynamically such that whenever I add some new information to the database it should show it on the pag... | <p>You should look into database connection pooling, here is a reference:
<a href="http://stackoverflow.com/questions/2835090/how-to-establish-a-connection-pool-in-jdbc">How to establish a connection pool in JDBC?</a></p>
<p>But still for 1000 visitor your code will serve it's purpose, to increase response time and im... |
Adding Text to Javascript Span id jquery <p>We have some code that populates a numerical value if greater than 1, and if not, it prints "In-Stock".</p>
<pre><code>$('#our_inventory').html('In-Stock');
</code></pre>
<p>and the website code:</p>
<pre><code><span id="our_inventory" class="value"></span>
</c... | <p>You mean</p>
<pre><code>var $inv = $('#our_inventory'), val = parseInt($inv.text(),10);
$inv.text(val>0?"Inventory:"+val:"In-Stock");
</code></pre>
|
JQuery is working fine with integer but not with string in MVC 5 <p>Jquery is working perfectly fine with integer var but got error for string. My code is as below.</p>
<pre><code>@section Scripts {
<script type="text/javascript">
$(function () {
$.getJSON('/Service/ListServic... | <p>String type should be in quotes. </p>
<p>Change this</p>
<pre><code>var type = @Model.Type;
</code></pre>
<p>to</p>
<pre><code>var type = '@Model.Type';
</code></pre>
|
how to share app with play store link link like Image <p><a href="https://i.stack.imgur.com/WHWpF.png" rel="nofollow"><img src="https://i.stack.imgur.com/WHWpF.png" alt="enter image description here"></a></p>
<p>I want to share app with text like below in whats app.How can i do it.in my case only text appear above squ... | <p>I trid this way and it is working for me</p>
<pre><code> linshare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String shareBody = "Hi, I'm using Check their App at: https://play.google.com/store/apps/yourcompletelink";
... |
Two textbox value to another form <p>How to get to textBox values into another form. What I want to do is to fill up the textBox1(playername) and textBox2(number of player) which is in the Form1 in to the game(Form2). Here's my code that only textBox1 value get in to another form:</p>
<p>Form1:</p>
<pre><code> priva... | <blockquote>
<p>Here's my code that only textBox1 value get in to another form</p>
</blockquote>
<p>Well, yes, that code is only sending one value. Because the constructor only wants one value:</p>
<pre><code>public Form2(String Name)
{
//...
}
</code></pre>
<p>If you want to send two values, send two values:... |
What image size need to print a full A4 paper with UIPrintInteractionController? <p>Printing logic look like this:</p>
<pre><code>let printController = UIPrintInteractionController.shared
printController.printInfo = printInfo
printController.showsNumberOfCopies = false
printController.printingItem = image
printControl... | <p>According to the <a href="https://developer.apple.com/reference/uikit/uiprintpaper" rel="nofollow">documentation</a> the paper size chosen by locale.</p>
<p>When using <code>UIPrintInfoOutputGeneral</code> either US Letter size or A4 is picked, depending on user locale.</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.