Id int64 34.6M 60.5M | Title stringlengths 15 150 | Body stringlengths 33 36.7k | Tags stringlengths 3 112 | CreationDate stringdate 2016-01-01 00:21:59 2020-02-29 17:55:56 | Y stringclasses 3 values |
|---|---|---|---|---|---|
38,916,474 | In the following javascript code, why variable that is not accessible to func function? | <pre><code>var func=function(){console.log(that)}
var obj = {
foo(){
var that=this;
var a=func;
a();
}
}
obj.foo();
</code></pre>
<p><strong>Result :</strong> </p>
<p><em>Uncaught ReferenceError: that is not defined</em></p>
| <javascript><function><scope> | 2016-08-12 11:05:12 | LQ_CLOSE |
38,916,521 | How to use resource dictionary in WPF | <p>I'm new to WPF and I don't understand well how resource dictionary works. I have Icons.xaml that looks like:</p>
<pre><code><ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Canvas x:Key="appbar_3d_3ds" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
<Path Width="32" Height="40" Canvas.Left="23" Canvas.Top="18" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 27,18L 23,26L 33,30L 24,38L 33,46L 23,50L 27,58L 45,58L 55,38L 45,18L 27,18 Z "/>
</Canvas>
<Canvas x:Key="appbar_3d_collada" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
<Path Width="44" Height="30.3735" Canvas.Left="15" Canvas.Top="21.6194" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 39.2598,21.6194C 47.9001,21.6194 55.3802,24.406 59,28.4646L 59,33.4834C 56.3537,29.575 49.2267,26.7756 40.85,26.7756C 30.2185,26.7756 21.6,31.285 21.6,36.8475C 21.6,40.4514 25.2176,43.6131 30.6564,45.3929C 22.7477,43.5121 17.2,39.1167 17.2,33.9944C 17.2,27.1599 27.0765,21.6194 39.2598,21.6194 Z M 35.8402,51.9929C 27.1999,51.9929 19.7198,49.2063 16.1,45.1478L 15,40.129C 17.6463,44.0373 25.8733,46.8367 34.25,46.8367C 44.8815,46.8367 53.5,42.3274 53.5,36.7648C 53.5,33.161 49.8824,29.9992 44.4436,28.2194C 52.3523,30.1002 57.9,34.4956 57.9,39.6179C 57.9,46.4525 48.0235,51.9929 35.8402,51.9929 Z "/>
</Canvas>
</ResourceDictionary>
</code></pre>
<p>How can I use for example "app_3d_collada" in my xaml ? I have for example MenuItem and I would like to use this icon as my MenuItem icon.</p>
| <c#><.net><wpf> | 2016-08-12 11:07:30 | HQ |
38,916,595 | Adjacency matrix of graph in c++ ( getting error while using malloc ) | #include <iostream>
#include <cstdlib>
using namespace std;
class graph{
int v,e,**adj;
public:
graph();
};
graph::graph(){
graph *g = (graph*)malloc(sizeof(graph));
if(g){
cout << " error";
exit(1);
}
int u,V,i;
cout << "Enter no of nodes and edges ? ";
cin >> g->v ;
cin >> g->e ;
g->adj = (int**)malloc(sizeof(int) * sizeof(g->v * g->v ));
for(u = 0 ; u <= g->v ; u++)
for(V = 0 ; V <= g->v ; V++ )
g->adj[u][V] = 0;
cout << " Enter connections ? ";
for(i = 0 ; i <= g->e ; i++){
cin >> u ;
cin >> V ;
g->adj[u][V] = 1;
g->adj[V][u] = 1;
}
cout << g;
}
int main(){
graph a;
return 0;
}
I am trying to figure out whats the problem but unable to resolve by myself . please help !
i've researched for about 2 hours over this topic unfortunately did't found any
proper help desk.
i am learning data structure and implementing in c++ language.
if you could able to advice me
that'd be earnestly kind of you .
thanks !
| <c><malloc> | 2016-08-12 11:12:43 | LQ_EDIT |
38,917,094 | Using c# ClientWebSocket with streams | <p>I am currently looking into using websockets to communicate between a client/agent and a server, and decided to look at C# for this purpose. Although I have worked with Websockets before and C# before, this is the first time I using both together. The first attempt used the following guide:
<a href="http://www.codeproject.com/Articles/618032/Using-WebSocket-in-NET-Part">http://www.codeproject.com/Articles/618032/Using-WebSocket-in-NET-Part</a></p>
<pre><code>public static void Main(string[] args)
{
Task t = Echo();
t.Wait();
}
private static async Task Echo()
{
using (ClientWebSocket ws = new ClientWebSocket())
{
Uri serverUri = new Uri("ws://localhost:49889/");
await ws.ConnectAsync(serverUri, CancellationToken.None);
while (ws.State == WebSocketState.Open)
{
Console.Write("Input message ('exit' to exit): ");
string msg = Console.ReadLine();
if (msg == "exit")
{
break;
}
ArraySegment<byte> bytesToSend = new ArraySegment<byte>(Encoding.UTF8.GetBytes(msg));
await ws.SendAsync(bytesToSend, WebSocketMessageType.Text, true, CancellationToken.None);
ArraySegment<byte> bytesReceived = new ArraySegment<byte>(new byte[1024]);
WebSocketReceiveResult result = await ws.ReceiveAsync(bytesReceived, CancellationToken.None);
Console.WriteLine(Encoding.UTF8.GetString(bytesReceived.Array, 0, result.Count));
}
}
}
</code></pre>
<p>Although this seems to work as expected, I was wondering if there is any way I can use the built in streams/readers in .NET with ClientWebSocket?</p>
<p>Seems odd to me that Microsoft has this rich well established set of stream and reader classes, but then decides to implement ClientWebSocket with only the ability to read blocks of bytes that must be handled manually.</p>
<p>Lets say I wanted to transfer xml, it would be easy for me to just wrap the socket stream in a XmlTextReader, but this is not obvious with ClientWebSocket.</p>
| <c#><websocket> | 2016-08-12 11:40:05 | HQ |
38,917,148 | Page loading ASP.NET | How to make a page load like facebook ?? i made a div with an image[tool image] on left side and its description [textbox] on right. There are many images on database ,how can I show other images in the same format..??
I tried it by creating 10 rows with 10 images and 10 textbox it is working but page load became slow.Don't know how to handle other images..
Now i am using multiple pages with 5 image and text box,is there any better option ?
Help me to learn..I am a beginner !! | <c#><asp.net><sql-server> | 2016-08-12 11:43:11 | LQ_EDIT |
38,917,161 | Appcelerator Studio apps does not run after El Capitan Update. Invalid Request on compile | <p>As the title says, After I have updated my OS to El Capitan all my apps on Appcelerator Studio does not build successfully anymore. Even newly created sample apps does not build. I only get a very generic error message from the console.</p>
<p>My app is targeted for iOS and Android and it does not work for both. I get the same error message as below.</p>
<pre><code>[INFO] : ----- OPTIMIZING -----
[INFO] : - android/alloy.js
[INFO] : - android/alloy/sync/localStorage.js
[INFO] : - android/alloy/sync/properties.js
[INFO] : - android/alloy/sync/sql.js
[INFO] :
[INFO] : Alloy compiled in 1.48612s
[INFO] : Alloy compiler completed successfully
[ERROR] : invalid request
</code></pre>
<p>How to resolve this? I already tried to project clean multiple times.</p>
| <appcelerator> | 2016-08-12 11:44:03 | HQ |
38,917,297 | Compile and use ABI-dependent executable binaries in Android with Android Studio 2.2 and CMake | <p>I'm testing out the new Android Studio C/C++ building via CMake through stable gradle (<a href="http://tools.android.com/tech-docs/external-c-builds" rel="noreferrer">http://tools.android.com/tech-docs/external-c-builds</a>).</p>
<p>In my app, an already rooted device needs to use an ABI-dependent binary that I compile inside Android Studio.</p>
<p>When I try to compile a standard library with </p>
<pre><code>add_library(mylib SHARED mylib.c)
</code></pre>
<p>it gets automatically compiled and copied inside the lib/[ABI] folder of the APK (e.g. /lib/armeabi/mylib.so) but if I compile an executable binary with:</p>
<pre><code>add_executable(mybinary mybinary.cpp)
</code></pre>
<p>binaries are corectly generated inside the build folder: </p>
<pre><code>app/build/intermediates/cmake/debug/lib/armeabi/mybinary
app/build/intermediates/cmake/debug/lib/x86_64/mybinary
...
</code></pre>
<p>but they do not seem to be copied anywhere inside the apk.</p>
<p>Which is the correct way to handle this need? Is a gradle-task the way to go?</p>
<p>build.gradle:</p>
<pre><code>apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.my.app"
minSdkVersion 10
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild{
cmake{
path "CMakeLists.txt"
}
}
defaultConfig {
externalNativeBuild {
cmake {
targets "
arguments "-DANDROID_TOOLCHAIN=clang", "-DANDROID_PLATFORM=android-21"
cFlags "-DTEST_C_FLAG1", "-DTEST_C_FLAG2"
cppFlags "-DTEST_CPP_FLAG2", "-DTEST_CPP_FLAG2"
abiFilters 'x86', 'x86_64', 'armeabi', 'armeabi-v7a'
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'eu.chainfire:libsuperuser:1.0.0.201607041850'
}
</code></pre>
<p>CMakeLists.txt</p>
<pre><code>cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_VERBOSE_MAKEFILE on)
add_executable(mybinary ${CMAKE_CURRENT_SOURCE_DIR}/mybinary.cpp)
target_link_libraries( mybinary libcustom)
target_include_directories (mybinary PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
</code></pre>
<p>mybinary.cpp</p>
<pre><code>#include <stdlib.h>
#include <string>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
string hello = "Hello from C++";
cout << "Message from native code: " << hello << "\n";
return EXIT_SUCCESS;
}
</code></pre>
<p>How the app should interact with mybinary:</p>
<pre><code>import eu.chainfire.libsuperuser.Shell;
...
Shell.SU.run("/path/to/mybinary");
</code></pre>
| <android><android-studio><gradle><android-ndk><cmake> | 2016-08-12 11:51:49 | HQ |
38,917,675 | get all occurence of substring between two chracters in java | <p>I have String Path like this </p>
<pre><code> "/Math/Math1/Algerbra/node"
</code></pre>
<p>how I can get all the occurence of substring between "/" and "/" to get (Math-Math1-Algerbra)</p>
<p>Thanks in advance</p>
| <java><string><substring> | 2016-08-12 12:11:35 | LQ_CLOSE |
38,917,700 | IndexOutOffRangeException Was Unhandled warning | i have implemented some codes in order to make changes to my csv file. however every time i was the program i the the "IndexOutOfRangeException error.
Any Help would be appreciated as i do not know the solution to this
class Program
{
static void Main(string[] args)
{
var filePath = Path.Combine(Directory.GetCurrentDirectory(), "kaviaReport 02_08_2016.csv");
var fileContents = ReadFile(filePath);
foreach (var line in fileContents)
{
Console.WriteLine(line);
}
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
public static IList<string> ReadFile(string fileName)
{
var results = new List<string>();
int lineCounter = 0;
string currentLine = string.Empty;
var target = File
.ReadAllLines(fileName);
//.Skip(1) // Skip the line with column names
while ((currentLine = fileName) != null)//while there are lines to read
{
if (lineCounter != 0)
{
//If it's not the first line
var lineElements = currentLine.Split(',');//split your fields into an array
lineElements[4] = lineElements[4].Replace(' ', ',');//replace the space in position 4(field 5) of your array
//target.WriteAllLines(string.Join(",", fielded));//write the line in the new file
File.WriteAllLines(fileName, target);
}
lineCounter++;
}
return results;
}
}
}
| <c#><csv> | 2016-08-12 12:12:56 | LQ_EDIT |
38,917,751 | WebView WebRTC not working | <p>I'm trying to show <code>WebRTC</code> chat in <code>WebView</code>.
Related to <a href="https://developer.chrome.com/multidevice/webview/overview" rel="noreferrer"> this documentation</a> <code>WebView v36</code> supports <code>WebRTC</code>. For my test
i'm using device with <code>Chrome/39.0.0.0</code> and added permissins to manifest:</p>
<pre><code><uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<user-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
</code></pre>
<p>but when entered into chat see chromium error in the log <em>(device doesn't show \ translate anything, only 'loading' progress bar)</em>:</p>
<pre><code>W/AudioManagerAndroid: Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO
W/AudioManagerAndroid: No audio device will be available for recording
E/chromium: [ERROR:web_contents_delegate.cc(178)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
E/chromium: [ERROR:web_contents_delegate.cc(178)] WebContentsDelegate::CheckMediaAccessPermission: Not supported.
W/AudioManagerAndroid: Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO
W/AudioManagerAndroid: No audio device will be available for recording
D/ChromiumCameraInfo: Camera enumerated: front
</code></pre>
<p>tested on real device, Android 5.1.1</p>
| <android><android-webview><webrtc><android-permissions><webviewchromium> | 2016-08-12 12:15:19 | HQ |
38,917,960 | Convert Text To Varchar | <p>In <code>Postgresql</code> how do you convert a text field to a varchar? I have tried both of the below, but neither convert my text field to varchar.</p>
<pre><code>Cast(Iamtextfield As Varchar)
Char(Iamtextfield)
</code></pre>
| <postgresql> | 2016-08-12 12:26:45 | HQ |
38,918,020 | How to call a view from a view model using MVVM pattern | I have two view models A and B. On a double click on view A I need to display view B. How can I call a view B from a view Model A using the `MVVM` pattern.
I have looked around and I couldn't find a clear example that demonstrate this fundamental concept for the `MVVM` pattern.
Thank you | <c#><wpf><mvvm> | 2016-08-12 12:29:56 | LQ_EDIT |
38,918,588 | warning: URGENT: building for watchOS simulator but linking object file built for iOS | <p>While integrating my java library converted by j2objc I'm receiving this message.</p>
<blockquote>
<p>ld: warning: URGENT: building for watchOS simulator, but linking in
object file
(/Users/admin/Documents/j2objc/dist/lib/libjre_emul.a(IOSArray.o))
built for iOS. Note: This will be an error in the future.</p>
</blockquote>
<p>I do not understand will my code work on real watchOS device? Or this is just a i386 build which works only in the simulator? What I have to do in this case?</p>
| <ios><objective-c><watchos-2><j2objc><watchos-simulator> | 2016-08-12 12:58:34 | HQ |
38,919,936 | Geometric Distribution - Expected number of rolls of a die before a value occurs | <p>Say I want to calculate the expected number of rolls of a die before a particular value is rolled, let's say a 5. I know this involves geometric distribution. Is there an R function that can calculate this?</p>
| <r> | 2016-08-12 14:02:42 | LQ_CLOSE |
38,920,240 | TensorFlow image operations for batches | <p>There are a number of image operations in TensorFlow used for distorting input images during training, e.g. <code>tf.image.random_flip_left_right(image, seed=None)</code> and <code>tf.image.random_brightness(image, max_delta, seed=None)</code> and several others.</p>
<p>These functions are made for single images (i.e. 3-D tensors with shape [height, width, color-channel]). How can I make them work on a batch of images (i.e. 4-D tensors with shape [batch, height, width, color-channel])?</p>
<p>A working example would be greatly appreciated!</p>
| <tensorflow> | 2016-08-12 14:19:03 | HQ |
38,921,765 | ScrollView minHeight to take up all the space | <p>I have a <code>ScrollView</code> which content doesn't necessarily exceeds it's size. Let's say it's a form where, upon errors, it expands to add error messages and then it exceeds the <code>ScrollView</code> size and thus is why I'm using that scroll.</p>
<p>The thing is that I want the content to always be at least of the same size of the ScrollView. I'm aware of the <code>minHeight</code> property, but the only way I found to use it is re-rendering, which I'd like to avoid.</p>
<p>I'm using redux for state management and this is what I have</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><ScrollView
contentContainerStyle={[ownStyles.container, {minHeight: this.props.scrollHeight}]}
style={this.props.style}
showsVerticalScrollIndicator={false}
onLayout={(event) => {
scrollHeight = event.nativeEvent.layout.height;
this.props.setScrollContentHeight(scrollHeight);
}}
></code></pre>
</div>
</div>
</p>
<p>Where the <code>this.props.setScrollContentHeight</code> triggers an action which enters the height on the state, and <code>this.props.scrollHeight</code> is said height. So that after the first render where the onLayout function is triggered, the state is updated with the ScrollView's <code>height</code>, which I then assign as <code>minHeight</code> to its content.</p>
<p>If I set the content's style to <code>flex: 1</code> then the ScrollView won't scroll.</p>
<p>Can you think of a way to avoid that second render for performance purposes?</p>
<p>Thank you!</p>
| <javascript><react-native><redux><react-native-flexbox> | 2016-08-12 15:40:22 | HQ |
38,922,338 | com.android.volley.NoConnectionError - Android emulator with Charles Proxy | <p>I want to proxy network traffic for an Android emulator. </p>
<p>I can't seem to get it to work. </p>
<p>My emulator is booted up using this: </p>
<pre><code>emulator @Nexus_5X_API_23 -http-proxy 10.0.1.17:8888
</code></pre>
<p>The IP and port points to what Charles reports in the Help menu. </p>
<p>The SSL certificate is installed. I can open the emulator browser and Charles shows me all traffic. The browser updates as usual. </p>
<p>All seems good so far. </p>
<p>Now I attempt to run my app. My first network call goes out successfully through Charles. The response returns and Charles displays it. However the response isn't passed to the app successfully. </p>
<p>I've set a breakpoint in the error callback and I can see a <code>com.android.volley.NoConnectionError</code> which is caused by <code>java.io.IOException: unexpected end of stream on Connection</code>. </p>
<p>Why doesn't Charles pass the result back back properly to the app? </p>
<p>Do I need to do what's defined at <a href="https://www.charlesproxy.com/documentation/configuration/browser-and-system-configuration">the end of the configuration page on Charles</a>? </p>
<pre><code>HttpHost httpproxy = new HttpHost("192.168.0.101", 8888, "http");
httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY,httpproxy);
</code></pre>
<p>This doesn't seem correct - what am I missing? </p>
| <android><proxy><android-volley><charles-proxy> | 2016-08-12 16:10:41 | HQ |
38,922,938 | WordPress CPT With Ability to Login and Register | <p>We're responsible for a WordPress plugin which, as part of it's functionality, has a Custom Post Type called 'Applicant'. These are applicants looking to purchase property so against a post you can record things like their contact details, and search requirements.</p>
<p>Now... it's come to light that we need to enable these applicants to be able to login and perform various actions such as save properties to a 'Favourites' list, or edit their own requirements.</p>
<p>If we were building the plugin from scratch I would've just done them as users, however this is a plugin used by hundreds of people so we don't have that luxury and must keep it as a CPT.</p>
<p>My question is... how can I/should I keep it a CPT whilst allowing these people to login and register.</p>
<p>My two initial thoughts are:</p>
<ol>
<li>For every custom post you have a WordPress user and keep the two synced (i.e. if the user is deleted, the custom post gets deleted at the same time). That way you could use the built-in log in and security functionality provided by WordPress, but you have this nightmare of trying to keep the two in sync.</li>
</ol>
<p>or</p>
<ol start="2">
<li>We build our own custom 'login' and 'register' functionality. We store the email address and password against the custom post and use that to validate them. Then also perform our own session management etc.</li>
</ol>
<p>or</p>
<ol start="3">
<li>The final option is we do infact scrap the CPT altogether and just use 'users'. Then write some kind of migration script to move the CPT's over to users.</li>
</ol>
<p>Hope that makes sense. Any thoughts/ideas most welcome.</p>
| <php><wordpress> | 2016-08-12 16:49:14 | HQ |
38,923,372 | C# Directory Not Foud Excemption | Here using VS 2015 Community and C# I am trying to read a JSON file stored inside folder called `lib` in the project as `lib/user.json`
String jsonSTR = File.ReadAllText("lib/user.json");
but I am getting the Directory Not Found Exception
[![enter image description here][1]][1]
Can you please let me know why this is happening? Thanks
[1]: http://i.stack.imgur.com/LK2gI.png | <c#> | 2016-08-12 17:20:43 | LQ_EDIT |
38,923,695 | canvas to WebGL | <p>I tried to study WebGL, but I have nothing.
I do not want to use the library, they are too big.
I wrote what I want on the canvas, help me to do it on WebGL</p>
<p><a href="https://jsfiddle.net/g9tx903c/" rel="nofollow">https://jsfiddle.net/g9tx903c/</a></p>
<pre><code><canvas id="canvas" width="500" height="200"></canvas>
<script type='text/javascript'>
function DrawPoint(x, y, size, blur, opacity) {
var c = document.getElementById('canvas');
var ctx = c.getContext('2d');
var halfSize = size / 2;
var radgrad = ctx.createRadialGradient(halfSize + x, halfSize + y, 0, halfSize + x, halfSize + y, halfSize);
radgrad.addColorStop(blur, 'rgba(255, 255, 255, ' + opacity +')');
radgrad.addColorStop(1, 'rgba(255, 255, 255, 0)');
ctx.fillStyle = radgrad;
ctx.fillRect(x, y, size, size);
}
function DrawcGradient() {
var w = 500;
var h = 200;
var pointR = w / 2;
var x = (w / 2);
var y = (h / 2);
var c = document.getElementById('canvas');
var ctx = c.getContext('2d');
var grd = ctx.createRadialGradient(x, y, 0, x, y, pointR);
grd.addColorStop(0, '#5A6977');
grd.addColorStop(1, '#000');
ctx.fillStyle = grd;
ctx.fillRect(0, 0, w, h);
}
DrawcGradient();
DrawPoint(50, 100, 50, 0.5, 0.2);
DrawPoint(70, 10, 150, 0.93, 0.2);
</script>
</code></pre>
| <javascript><html><canvas><webgl> | 2016-08-12 17:41:39 | LQ_CLOSE |
38,924,048 | Convert HTML File to PDF Using Java | <p>I am looking for a way to convert an HTML file to PDF using a Java library that is preferably free. I have done some searching online to look for tools to use, but haven't found a solution that sticks out (I have seen some mention of iText, but it looked like that would have a charge to use it). Is there an existing library that I can utilize to accomplish the conversion of HTML to PDF?</p>
| <java><html><pdf> | 2016-08-12 18:06:44 | HQ |
38,924,452 | Use vs Import vs Require vs Require-extension in Chicken Scheme | <p>I'm a little hazy on the differences between <code>(use)</code> and <code>(import)</code> in Chicken. Similarly, how do <code>(load)</code>, <code>(require)</code> and <code>(require-extension)</code> differ?</p>
<p>These things don't seem to be mentioned much on the website.</p>
| <scheme><chicken-scheme> | 2016-08-12 18:36:12 | HQ |
38,924,458 | How to see files and file structure on a deployed Heroku app | <p>My client app that is deployed on Heroku allows the user to upload images onto Heroku. I wanted to test out a change I made to delete images, so I need a way to see the state of the folder structure on Heroku to ensure the images are being deleted successfully of the file system.</p>
<p>I tried - </p>
<pre><code>$ heroku run bash --app <appName>
~$ pwd
~$ cd <path to images folder>
</code></pre>
<p>but I only see images here that I uploaded along with the app, not what was uploaded through the client app.</p>
<p>What am I doing wrong?</p>
| <bash><heroku> | 2016-08-12 18:36:20 | HQ |
38,924,798 | Chrome dev tools fails to show response even the content returned has header Content-Type:text/html; charset=UTF-8 | <p>Why does my chrome developer tools show "Failed to show response data" in response when the content returned is of type text/html?</p>
<p>What is the alternative to see the returned response in developer tools?</p>
| <google-chrome><http><google-chrome-devtools> | 2016-08-12 18:58:51 | HQ |
38,925,082 | how to compare two columns in pandas to make a third column ? | <p>i have two columns age and sex in a pandas dataframe </p>
<pre><code>sex = ['m', 'f' , 'm', 'f', 'f', 'f', 'f']
age = [16 , 15 , 14 , 9 , 8 , 2 , 56 ]
</code></pre>
<p>now i want to extract a third column : like this
if age <=9 then output ' child' and if age >9 then output the respective gender </p>
<pre><code>sex = ['m', 'f' , 'm','f' ,'f' ,'f' , 'f']
age = [16 , 15 , 14 , 9 , 8 , 2 , 56 ]
yes = ['m', 'f' ,'m' ,'child','child','child','f' ]
</code></pre>
<p>please help
ps . i am still working on it if i get anything i will immediately update </p>
| <python><pandas> | 2016-08-12 19:18:43 | HQ |
38,925,391 | Is there any way to delegate the index property in typescript? | <p>Is there any way to delegate the index property to a member in typescript? I am writing a wrapper, and I would like to delegate the index property to the object I am wrapping.</p>
<p>Something like:</p>
<pre><code>interface MyStringArray {
length : number;
clear() : void;
[index: number] : string;
}
export class MyStringArrayWrapper implements MyStringArray {
private wrapped : MyStringArray;
public get length() : number {
return this.wrapped.length;
}
public clear() : void {
this.wrapped.clear();
}
// This doesn't work
public get [index : number] : string {
return this.wrapped[index];
}
// This doesn't work either
public set [index : number](value: string) {
this.wrapped[index] = value;
}
}
</code></pre>
| <typescript> | 2016-08-12 19:40:54 | HQ |
38,926,574 | React functional components vs classical components | <p>I'm trying to understand when to use React functional components vs. classes and reading from the <a href="https://facebook.github.io/react/blog/2015/12/18/react-components-elements-and-instances.html" rel="noreferrer">docs</a> they don't really go into detail. Can you give me some primary examples of the below of when you would want a specific feature of a class to make a component?</p>
<blockquote>
<p>A functional component is less powerful but is simpler, and acts like
a class component with just a single render() method. Unless you need
features available only in a class, we encourage you to use functional
components instead.</p>
</blockquote>
| <javascript><class><reactjs><components> | 2016-08-12 21:15:40 | HQ |
38,926,628 | what will be the logic in shell scripting | i have a test file. and suppose content is like this. i want to put this into an array separated by "semicolon" in shell script
History is the discovery, collection, organization, analysis, and presentation of information about past events. History can also mean a continuous typically; chronological record of important or public events or of a particular trend or institution. Scholars who write about history are called historians. It is a field of knowledge which uses a narrative to examine and analyse the sequence of events; and it sometimes attempts to objectively investigate the patterns of cause and effect that determine events;
expected output:
array[0] should print:
History is the discovery, collection, organization, analysis, and presentation of information about past events. History can also mean a continuous typically;
array[1] should print:
chronological record of important or public events or of a particular trend or institution. Scholars who write about history are called historians. It is a field of knowledge which uses a narrative to examine and analyse the sequence of events;
array[3] should print:
and it sometimes attempts to objectively investigate the patterns of cause and effect that determine events;
like this way.... what will be the logic....
| <shell> | 2016-08-12 21:20:58 | LQ_EDIT |
38,926,669 | Strike through plain text with unicode characters? |
<p>Is it possible to strike through <strike>unwanted</strike> revised words in your code comments? Since developers still code in <strike>the dark ages</strike> a simpler time of plain text where text cannot be formatted using hidden identifiers, the only way to accomplish this is with Unicode Characters.</p>
<p>Since some unicode characters can extend be̜̤͉̘̝̙͂̓ͫ̽̊̀y̐ͨͧͩ̚o̥̗̞̬̯͚͂n͔͖̤̜̖̪͒̈́ͅd̯̮ͭ their designated boundaries, I thought it might be possible to find a Unicode Character that creates the strike through effect.</p>
<p>Unfortunately dash characters — occupy a significant amount of horizontal space. Is there an alternative character that I can use to create the <strike>strike-through</strike> effect across my text?</p>
| <unicode><strikethrough> | 2016-08-12 21:25:55 | HQ |
38,927,423 | Where i am wrong on code web service php | <p>Where the code is wrong its giving me an error on mysql_assoc;</p>
<pre><code>if($_SERVER['REQUEST_METHOD'] == "POST"){
$sql=mysql_query("SELECT * FROM users");
$query = mysql_query($sql);
$json = array(); // create empty array
$i = 0; // start a counter
while($result=mysql_fetch_assoc($query)){
$json[$i]['name'] = $result['name'];
$json[$i]['email'] = $result['email'];
$i++;
}
if(count($json)>0){
}else{
$json = array( "msg" => "No infomations Found");
}
header('Content-type: application/json');
}
</code></pre>
<p>this an error after running the service;</p>
<pre><code><br />
<b>Warning</b>: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in <b>C:\xampp\htdocs\satyam\services\select.php</b> on line <b>11</b><br />
</code></pre>
| <php><web-services> | 2016-08-12 22:46:19 | LQ_CLOSE |
38,927,640 | Keycodes alt shift number | I am trying to use ALT + SHIFT + number. I have tried:
if (e.which === 18 && e.which === 16 && e.which === 49) {
//DO SOMETHING
}
if (e.altKey && ( e.which === 16 ) && ( e.which === 49 )) {
//DO SOMETHING
}
if (e.which === 18) && (e.which === 16) && e.which === 49) {
//DO SOMETHING
}
None of them work. Can someone show me how to combine these keys please. | <javascript><jquery><keycode> | 2016-08-12 23:16:29 | LQ_EDIT |
38,928,380 | vue.js: always load a settings.scss file in every vue style section | <p>I find myself repeating this same pattern in every .vue file, in order to use variables, etc.:</p>
<pre><code><style lang="scss">
@import "../styles/settings.scss";
.someclass { color: $some-variable; }
</style>
</code></pre>
<p>or if it's nested in a folder I have to remember to be careful with the path:</p>
<pre><code><style lang="scss">
@import "../../styles/settings.scss";
</style>
</code></pre>
<p>Is there a way to globally import that <code>settings.scss</code> file in every .vue file I create? I looked in the docs and didn't see it, but maybe I missed it, or maybe this is something I need to leverage webpack to do?</p>
| <sass><webpack><vue.js><vue-loader> | 2016-08-13 01:35:48 | HQ |
38,928,476 | I do not understand why I am getting this error: 'else' without a previous 'if'. please anyone? | <p>I am trying to write a code that would calculate the average of as many test scores as the user wants. However, when compiling it with g++ compiler, I get the error:</p>
<p>'else' without a previous 'if'</p>
<p>the only 'else' statement of the code is in the following for loop. that's why i am omitting the rest of the code. Anyone, please tell me what i am doing wrong here. I can't seem to find the answer anywhere. Thanks in advance!</p>
<pre><code>int i, j;
cout >>"How many tests' scores you want to average; \n";
cin << i;
// Assuming i > 0
int test[i]
for (j = 0; j < i; j++)
{
if (j == 0)
cout <<"Enter the 1st score: \n";
cin >> test[j];
if (j == 1)
cout <<"Enter the 2nd score: \n";
cin >> test[j];
if (j == 2)
cout <<"Enter the 3rd score: \n";
cin >> test[j];
else
cout <<"Enter the "<< (j+1) <<"th score: \n";
cin >> test[j];
}
</code></pre>
| <c++> | 2016-08-13 01:58:29 | LQ_CLOSE |
38,928,903 | "git config --list" shows duplicate names | <p><code>git config --list</code> shows two values for <code>user.name</code>, one global, one local:</p>
<pre><code>user.name=My Name
...
user.name=My Other Name
...
</code></pre>
<p>My understanding is that local values override global ones. How can I get <code>git config</code> to only show the values that are actually in effect? I only want to see one value of user.name -- the one that will be used if I commit in the current context.</p>
<p>If my question is based on a misunderstanding, or if this is caused by something wrong with my git install, that would also be very helpful.</p>
| <git> | 2016-08-13 03:29:16 | HQ |
38,929,215 | stream reader over regex loop? | <p>how I can apply stream reader over regex loop </p>
<p>please help
i dont know</p>
<pre><code> string Value =pattern search;
var match = Regex.Match(File.ReadAllText(patch ) , Value);
while (match.Success)
{
doing regex code loop
}
</code></pre>
<p>please give me a hand</p>
| <c#><regex> | 2016-08-13 04:32:00 | LQ_CLOSE |
38,930,806 | Deploying dotnet core to Heroku | <p>I'm trying to deploy my dotnet core application to Heroku, but keep running up against this error:</p>
<pre><code>Restore failed
unknown keyword platform
! Push rejected, failed to compile Web app app.
! Push failed
</code></pre>
<p>When I use <code>dotnet run</code> from the CLI (I'm on a mac) everything runs fine. I've included my <code>Project.json</code> below in case that helps:</p>
<pre><code>{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.EntityFrameworkCore.Sqlite": "1.0.0",
"Microsoft.EntityFrameworkCore.Design": {
"version": "1.0.0-preview2-final",
"type": "build"
}
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2- final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"tooling": {
"defaultNamespace": "Tokens_monolith"
}
}
</code></pre>
| <asp.net><heroku><asp.net-core> | 2016-08-13 08:28:22 | HQ |
38,931,468 | Nginx reverse proxy error:14077438:SSL SSL_do_handshake() failed | <p>So i am using following settings to create one reverse proxy for site as below. </p>
<pre><code> server {
listen 80;
server_name mysite.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
root /home/ubuntu/p3;
location / {
proxy_pass https://mysiter.com/;
proxy_redirect https://mysiter.com/ $host;
proxy_set_header Accept-Encoding "";
}
}
</code></pre>
<p>But getting BAD GATE WAY 502 error and below is the log.</p>
<pre><code>2016/08/13 09:42:28 [error] 26809#0: *60 SSL_do_handshake() failed (SSL: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error) while SSL handshaking to upstream, client: 103.255.5.68, server: mysite.com, request: "GET / HTTP/1.1", upstream: "https://105.27.188.213:443/", host: "mysite.com"
2016/08/13 09:42:28 [error] 26809#0: *60 SSL_do_handshake() failed (SSL: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error) while SSL handshaking to upstream, client: 103.255.5.68, server: mysite.com, request: "GET / HTTP/1.1", upstream: "https://105.27.188.213:443/", host: "mysite.com"
</code></pre>
<p>Any help will be greatly appreciated. </p>
| <ssl><nginx><proxy><reverse-proxy> | 2016-08-13 09:50:09 | HQ |
38,931,673 | woocommerce plugin to add database content to product page | <p>my problem is that i want to build a price comparison site based on woocommerceand that is exactly my problem.
i want to develop a plugin, which makes it possible to post a database entry to my product page.
i tried to add the content with normal sql query with a shortcode, but the content was shown on top of the site.
the content should be loaded by the SKU number.
by adding the php functions with shortcode, the content will be shown on top of the site..</p>
<p>do you have any solutions how i can display custom database content to my product description?</p>
| <php><mysql><wordpress><woocommerce> | 2016-08-13 10:16:10 | LQ_CLOSE |
38,932,089 | Can I initialize an array using the std::initializer_list instead of brace-enclosed initializer? | <p>Can I initialize an array using the <code>std::initializer_list</code> object instead of brace-enclosed initializer?</p>
<p>As known, we can do this: <a href="http://en.cppreference.com/w/cpp/language/aggregate_initialization">http://en.cppreference.com/w/cpp/language/aggregate_initialization</a></p>
<pre><code>unsigned char b[5]{"abc"};
// equivalent to unsigned char b[5] = {'a', 'b', 'c', '\0', '\0'};
int ar[] = {1,2,3};
std::array<int, 3> std_ar2{ {1,2,3} }; // std::array is an aggregate
std::array<int, 3> std_ar1 = {1, 2, 3};
</code></pre>
<p>But I can't initialize an array by <code>std::initializer_list il;</code>: </p>
<p><a href="http://ideone.com/f6aflX">http://ideone.com/f6aflX</a></p>
<pre><code>#include <iostream>
#include <initializer_list>
#include <array>
int main() {
int arr1[] = { 1, 2, 3 }; // OK
std::array<int, 3> arr2 = { 1, 2, 3 }; // OK
std::initializer_list<int> il = { 1, 2, 3 };
constexpr std::initializer_list<int> il_constexpr = { 1, 2, 3 };
//int arr3[] = il; // error
//int arr4[] = il_constexpr; // error
//std::array<int, 3> arr5 = il; // error
//std::array<int, 3> arr6 = il_constexpr; // error
return 0;
}
</code></pre>
<p>But how can I use <code>std::initializer_list il;</code> to initialize an array?</p>
| <c++><c++11><c++14><initializer-list><c++17> | 2016-08-13 11:13:20 | HQ |
38,932,205 | Failed to start mangodb server. dbexit: rc: 48 error in mongodb | I downloaded mongo now I am getting this error. Only after updating mongo I am getting this error. I even tried to stop and start the mongod service again but still it is showing the same error.
[1]: http://i.stack.imgur.com/OBuKQ.png | <javascript><angularjs><node.js><mongodb><express> | 2016-08-13 11:25:29 | LQ_EDIT |
38,933,205 | How to make folder , file using keyboard shortcut? For Windows 8 | <p>How to make folder/file using keyboard shortcut ? I am beginner user for that case do not know this shortcut.</p>
| <windows><keyboard-shortcuts> | 2016-08-13 13:27:14 | LQ_CLOSE |
38,933,511 | NameError: name "user_choice1" is not defined | <p>I am trying out a simple program and keep getting this particular error:</p>
<pre><code>line 34, in <module>
user_choice1 == input("Do you want to exit or continue searching?")
NameError: name 'user_choice1' is not defined
</code></pre>
<p>Here is the piece of code that is causing the error:</p>
<pre><code>while True:
choice = input("Do you want to add items?")
if choice == "y":
add_items()
more = input("Do you want to add more items?")
if more == "y":
add_items()
else:
while True:
user_choice = input("Adding items finished. Do you want to search items or exit?")
if user_choice == "search":
search_item()
while True:
user_choice1 == input("Do you want to exit or continue searching?")
if user_choice1 == "continue":
search_item()
continue
elif user_choice1 == "exit":
sys.exit()
else:
break
elif user_choice == "exit":
sys.exit
else:
continue
elif choice == "n":
search_item()
while True:
user_choice2 = input("Searching finished. Do you want to continue or exit?")
if user_choice2 == "continue":
break
continue
elif user_choice2 == "exit":
sys.exit()
else:
continue
elif choice == "exit":
sys.exit()
else:
print("Invalid Choice")
</code></pre>
<p>What is causing this error? I am using Python 3.5.2.
Also, is there a better way to write this code as in, is there a way to optimize this code?</p>
| <python><python-3.x><nameerror> | 2016-08-13 14:03:56 | LQ_CLOSE |
38,933,801 | Calling an async method from component constructor in Dart | <p>Let's assume that an initialization of MyComponent in Dart requires sending an HttpRequest to the server. Is it possible to construct an object synchronously and defer a 'real' initialization till the response come back?</p>
<p>In the example below, the _init() function is not called until "done" is printed. Is it possible to fix this?</p>
<pre><code>import 'dart:async';
import 'dart:io';
class MyComponent{
MyComponent() {
_init();
}
Future _init() async {
print("init");
}
}
void main() {
var c = new MyComponent();
sleep(const Duration(seconds: 1));
print("done");
}
</code></pre>
<p><strong>Output</strong>:</p>
<pre><code>done
init
</code></pre>
| <asynchronous><constructor><dart> | 2016-08-13 14:38:18 | HQ |
38,934,240 | how would I use Javascript, html and css to produce the running tiger effect seen in run4tigers website? | <p>I wasn't sure if this question has already been asked before but I was wondering how you produce the interactive dotted text and the running tiger animation you see in the middle of the run4tiger website?
<a href="http://run4tiger.com/" rel="nofollow">http://run4tiger.com/</a>
Any information would be appreciated.</p>
| <javascript><jquery><html><css> | 2016-08-13 15:27:36 | LQ_CLOSE |
38,934,567 | Password strength detector in C doesn't work | <p>The password needs a letter and a number. Here's the code:</p>
<pre><code>#include <ctype.h>
int main()
{
char password;
printf("Please enter a password.\n");
scanf("%c", &password);
if ((isalpha (password) && isdigit(password))){
printf("Your password is strong!\n");
} else {
printf("Your password is weak!");
}
return 0;
}
</code></pre>
<p>However, when I compile it, it always prints "Your password is weak" even when I type in both characters and numbers. What's wrong? </p>
| <c> | 2016-08-13 16:06:38 | LQ_CLOSE |
38,935,904 | How to send final kafka-streams aggregation result of a time windowed KTable? | <p>What I'd like to do is this:</p>
<ol>
<li>Consume records from a numbers topic (Long's)</li>
<li>Aggregate (count) the values for each 5 sec window</li>
<li>Send the FINAL aggregation result to another topic</li>
</ol>
<p>My code looks like this:</p>
<pre><code>KStream<String, Long> longs = builder.stream(
Serdes.String(), Serdes.Long(), "longs");
// In one ktable, count by key, on a five second tumbling window.
KTable<Windowed<String>, Long> longCounts =
longs.countByKey(TimeWindows.of("longCounts", 5000L));
// Finally, sink to the long-avgs topic.
longCounts.toStream((wk, v) -> wk.key())
.to("long-counts");
</code></pre>
<p>It looks like everything works as expected, but the aggregations are sent to the destination topic for each incoming record. My question is how can I send only the final aggregation result of each window?</p>
| <apache-kafka><apache-kafka-streams> | 2016-08-13 18:48:37 | HQ |
38,936,016 | Keras - How are batches and epochs used in fit_generator()? | <p>I have a video of 8000 frames, and I'd like to train a Keras model on batches of 200 frames each. I have a frame generator that loops through the video frame-by-frame and accumulates the (3 x 480 x 640) frames into a numpy matrix <code>X</code> of shape <code>(200, 3, 480, 640)</code> -- (batch size, rgb, frame height, frame width) -- and yields <code>X</code> and <code>Y</code> every 200th frame:</p>
<pre><code>import cv2
...
def _frameGenerator(videoPath, dataPath, batchSize):
"""
Yield X and Y data when the batch is filled.
"""
camera = cv2.VideoCapture(videoPath)
width = camera.get(3)
height = camera.get(4)
frameCount = int(camera.get(7)) # Number of frames in the video file.
truthData = _prepData(dataPath, frameCount)
X = np.zeros((batchSize, 3, height, width))
Y = np.zeros((batchSize, 1))
batch = 0
for frameIdx, truth in enumerate(truthData):
ret, frame = camera.read()
if ret is False: continue
batchIndex = frameIdx%batchSize
X[batchIndex] = frame
Y[batchIndex] = truth
if batchIndex == 0 and frameIdx != 0:
batch += 1
print "now yielding batch", batch
yield X, Y
</code></pre>
<p>Here's how run <a href="https://keras.io/models/model/" rel="noreferrer"><code>fit_generator()</code></a>:</p>
<pre><code> batchSize = 200
print "Starting training..."
model.fit_generator(
_frameGenerator(videoPath, dataPath, batchSize),
samples_per_epoch=8000,
nb_epoch=10,
verbose=args.verbosity
)
</code></pre>
<p>My understanding is an epoch finishes when <code>samples_per_epoch</code> samples have been seen by the model, and <code>samples_per_epoch</code> = batch size * number of batches = 200 * 40. So after training for an epoch on frames 0-7999, the next epoch will start training again from frame 0. Is this correct?</p>
<p>With this setup <strong>I expect 40 batches (of 200 frames each) to be passed from the generator to <code>fit_generator</code>, per epoch; this would be 8000 total frames per epoch</strong> -- i.e., <code>samples_per_epoch=8000</code>. Then for subsequent epochs, <code>fit_generator</code> would reinitialize the generator such that we begin training again from the start of the video. Yet this is not the case. <strong>After the first epoch is complete (after the model logs batches 0-24), the generator picks up where it left off. Shouldn't the new epoch start again from the beginning of the training dataset?</strong></p>
<p>If there is something incorrect in my understanding of <code>fit_generator</code> please explain. I've gone through the documentation, this <a href="https://github.com/fchollet/keras/blob/master/examples/cifar10_cnn.py" rel="noreferrer">example</a>, and these <a href="https://github.com/fchollet/keras/issues/1627" rel="noreferrer">related</a> <a href="https://github.com/fchollet/keras/issues/107" rel="noreferrer">issues</a>. I'm using Keras v1.0.7 with the TensorFlow backend. This issue is also posted in the <a href="https://github.com/fchollet/keras/issues/3461" rel="noreferrer">Keras repo</a>.</p>
| <python><tensorflow><generator><keras> | 2016-08-13 19:01:09 | HQ |
38,936,305 | If block error handling in bash | <p>I have if statements with multiple lines of code in bash, sometimes while running the script any of lines of code thrown error message so could you please let me know how to handle errors. I just wanna catch the error and display some error message to identify, and also I do not want to stop the running scripts, since it has 7800 lines of code I wanna continue with the next steps. each test steps are inside if loop. I want to know how to handle errors inside the if loop which having series of lines of code.</p>
<p>Thank you so much for help.</p>
| <bash> | 2016-08-13 19:34:50 | LQ_CLOSE |
38,936,384 | Angular 2 http service. Get detailed error information | <p>Executing Angular2 http call to the offline server doesn't provide much info in it's "error response" object I'm getting in the Observable's .catch(error) operator or subscription error delegate (they are both share the same info actually). But as you can see on the screen shot of the console there's actual error was displayed by zone.js somehow.
So, how can I get this specific error info (net::ERR_CONNECTION_REFUSED)?</p>
<p>Thanks.<a href="https://i.stack.imgur.com/tLrA0.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/tLrA0.jpg" alt="enter image description here"></a></p>
| <http><angular><error-handling><observable> | 2016-08-13 19:46:01 | HQ |
38,936,556 | Is node.js capable platform for enterprise scale applications | <p>My impression is that node.js is neat environment to build simple backing service for wind suit grade applications and for quick prototyping, but how does it bend with transactions, relational databases, messaging, security and other business / cross-cutting concerns? </p>
<p>And by code maintainability wise, what tooling node.js provides to implement concepts like IoC/DI and AOP to keep the system orthogonal, i.e configurable and open to changes?</p>
<p>What tools are provided to build continuous integration pipeline? How are multi module projects handled by npm?</p>
<p>Here are some key questions to consider if node is good for anything else than simple, light, closed system providing basic REST api. </p>
| <javascript><node.js> | 2016-08-13 20:08:10 | LQ_CLOSE |
38,936,779 | Non-blocking multiprocessing.connection.Listener? | <p>I use multiprocessing.connection.Listener for communication between processes, and it works as a charm for me. Now i would really love my mainloop to do something else between commands from client. Unfortunately listener.accept() blocks execution until connection from client process is established.</p>
<p>Is there a simple way of managing non blocking check for multiprocessing.connection? Timeout? Or shall i use a dedicated thread?</p>
<pre><code> # Simplified code:
from multiprocessing.connection import Listener
def mainloop():
listener = Listener(address=(localhost, 6000), authkey=b'secret')
while True:
conn = listener.accept() # <--- This blocks!
msg = conn.recv()
print ('got message: %r' % msg)
conn.close()
</code></pre>
| <python><sockets><asynchronous><python-3.3><python-multiprocessing> | 2016-08-13 20:36:20 | HQ |
38,936,835 | Changing colors for an image in website | <p>how to partition an image in a website ? like this web site (each image is able to change her colors) : <a href="http://www.zolpan-intensement-couleurs.fr/fr/simulateur/decorateur_virtuel/index.aspx" rel="nofollow">http://www.zolpan-intensement-couleurs.fr/fr/simulateur/decorateur_virtuel/index.aspx</a> , what is the language that can we use ?</p>
| <javascript><php><css><jsp> | 2016-08-13 20:42:43 | LQ_CLOSE |
38,937,098 | this pogo-uwp has lotsofproblems in it it is annoying | i have a problem
[error][1]
[1]: http://i.stack.imgur.com/84flo.png
<Page.DataContext>
<viewModels:CapturePokemonPageViewModel x:Name="ViewModel" />
</Page.DataContext> //this error <<<
and errors lots of them
i have tried everything asking the community asking people everything
but it wont go away it is like the embodiment of Satan but for programmers
and Pogo deves or someone help me | <c#><xaml><uwp> | 2016-08-13 21:19:35 | LQ_EDIT |
38,937,102 | Docker Swarm Service - force update of latest image already running | <p>environment</p>
<ul>
<li>docker 1.12 </li>
<li>clusted on Ubuntu 16.04</li>
</ul>
<p>Is there a way to force a rolling update to a docker swarm service already running if the service update is not changing any parameters but the docker hub image has been updated?</p>
<p>Example: I deployed service: </p>
<pre><code>docker service create --replicas 1 --name servicename --publish 80:80 username/imagename:latest
</code></pre>
<p>My build process has updated the latest image on docker hub now I want to pull the latest again.</p>
<p>I have tried running:</p>
<pre><code>docker service update --image username/imagename:latest servicename
</code></pre>
<p>When I follow this process, docker does not pull the latest, I guess it assumes that since I wanted latest and docker already pulled an image:latest then there is nothing to do.</p>
<p>The only work around I have is to remove the service servicename and redeploy.</p>
| <docker><docker-swarm> | 2016-08-13 21:20:17 | HQ |
38,937,108 | partial submission on hacker rank | <p>why is my code <a href="http://ideone.com/zm6hP7" rel="nofollow">http://ideone.com/zm6hP7</a> not satisfying all test cases in the problem <a href="https://www.hackerrank.com/contests/opc-a/challenges/infinite-series" rel="nofollow">https://www.hackerrank.com/contests/opc-a/challenges/infinite-series</a> ?
I have downloaded unsatisfied test cases and still can't find any problem in my code....can somebody tell me what the problem is???</p>
<pre><code>#include<stdio.h>`
#define m 1000000007
int main()
{
long long int t;
scanf("%lld",&t);
for(long long int i=0;i<t;i++)
{
long long int l,r;
scanf("%lld %lld",&l,&r);
long long int x,y;
if(l%2==0)
x=(((l/2)%m)*((l-1)%m))%m;
else
x=((l%m)*(((l-1)/2)%m))%m;
if(r%2==0)
y=(((r/2)%m)*((r+1)%m))%m;
else
y=((r%m)*(((r+1)/2)%m))%m;
printf("%lld\n",y-x);
}
return 0;
}
</code></pre>
| <c> | 2016-08-13 21:21:09 | LQ_CLOSE |
38,939,338 | Swift Trimming String | <p>I am trying to trim a string so that i am left with everything on the right side of a colon in Swift.</p>
<p>For example</p>
<blockquote>
<p>"Sally: Hello My Name is Sally"</p>
</blockquote>
<p>Becomes</p>
<blockquote>
<p>"Hello My Name is Sally"</p>
</blockquote>
<p>What would the trim function be?</p>
| <swift><trim> | 2016-08-14 05:09:07 | LQ_CLOSE |
38,940,575 | image with id in its name? image-name-93943.jpg | <p>I have a website that I have some news there and photos.</p>
<p>So, for example:</p>
<blockquote>
<p>Barack Obama out in NY.</p>
</blockquote>
<p>for this I have some pictures:</p>
<pre><code>mywebsite.com/barack-obama-out-in-NY-157475445.jpg
mywebsite.com/barack-obama-out-in-NY-257475445.jpg
mywebsite.com/barack-obama-out-in-NY-357475445.jpg
</code></pre>
<p>image title and after it the image number (1, 2, 3) with post_id (57475445).</p>
<p>Is it ok for SEO or the id in the image name could be a bad practise?</p>
| <seo> | 2016-08-14 08:45:54 | LQ_CLOSE |
38,941,007 | Endienness conversion between Little and Big | <p>does java have a function to make a direct conversion between Little and BigEndien?</p>
| <java><bit-manipulation> | 2016-08-14 09:46:44 | LQ_CLOSE |
38,942,811 | R crash after big for loop, apply or foreach | I wrote a script which work very correctly on a small sample datasets, but when I am trying the same on much larger - and real - datas, R Studio Session crash with fatal error, as do R session when I run the script without using RStudio. Here's is my sessionInfo() :
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] rsconnect_0.4.3 tools_3.3.1
I tried building the same script using for loop, foreach package, apply functions, plyr's one... Nothing worked. I am sorry not being able to give a reproductible example, but scripts and data are very large, and when they are just extract, it works...
Do anyone know what is the problem ? I precise that I don't get any error message... | <r><apply> | 2016-08-14 13:42:06 | LQ_EDIT |
38,942,845 | Java error i have done everything correct and i m unable to identify mistake. | This is a java code, i have created 4 classes 3 constructor and i am getting error of method area in class Rect cannot be applied to given types; similar error for rest of 2 class aswell. in this program basically i ahve created 4 classes 1 for calculating area of rect 1 for 1 for calculating area of Tri and 1 for calculating area of Square and last one is to acess main function. i have created 3 constructor for all the 3 classes rect tri and square and i am unable to spot the mistake in this program so please help me out with this.
class Rect //1st class rect
{
double l,b; //variables
Rect(double l, double b) //constructor for rect
{
this.l=l;
this.b=b;
}
double area(double l,double b) //method to cal Rect area
{
return l*b;
}
}
class Square //square class
{
double s;
Square(Double s) //constructor for class
{
this.s=s;
}
double area(double s) //method to cal area for square
{
return s*s;
}
}
class Tri // class for triangle
{
double l,b,h; //variables
Tri(double l,double b,double h) // constructor for tri
{
this.l=l;
this.h=h;
this.b=b;
}
double area(double l,double b,double h) //method to cal area for tri
{
return 0.5*l*b*h;
}
}
class Area3
{
public static void main(String args[])
{
Rect r=new Rect(10, 10); //constructor initialization for Rect
Square s=new Square(15.0);//constructor initialization for Square
Tri t=new Tri(10.0,20.0,30.0);//constructor initialization for Tri
System.out.print(" "+r.area()+""+s.area+""+t.area); //print areas
}
} | <java> | 2016-08-14 13:46:08 | LQ_EDIT |
38,943,881 | Excel vba set styl in new sheet with a table | How do I rectify this code?
Sub test()
Sheets("new").DeleteSheets.Add.Name = "new"
ActiveSheet.Range(ActiveSheet.Cells(1, 1), ActiveSheet.Cells(3, 3)) = "f"
ActiveSheet.ListObjects.Add(xlSrcRange, Range(ActiveSheet.Cells(1, 1), ActiveSheet.Cells(3, 3)), , xlYes, , "TableStyleMedium7").Name = "sk"
End Sub | <excel><stylesheet><vba> | 2016-08-14 15:49:00 | LQ_EDIT |
38,943,897 | Free Offline Satellite photo | <p>I tested the leaflet library and it works. now I need to download FREE satellite photos of south america (Chile, Argentina and Uruguay). I prefer 10MB/px (150m aprox) approximately.</p>
<p>Please help me download the images to complete my project.</p>
<p>Tanks!</p>
<p>Marcelo</p>
| <google-maps><web><maps><leaflet><gis> | 2016-08-14 15:51:23 | LQ_CLOSE |
38,944,761 | Can't Parse Regex | For some reason I can't parse this regex, which works in a live demonstration.
I took the code from the live demo, pasted it into a new PHP file, saved it and ran it in my server.
Works here: [live demo](https://3v4l.org/fKIqa)
My code + the error: [here](http://image.prntscr.com/image/d498412b29e8480db33bf30f68888dfb.png)
My `phpinfo`: [here](http://www.filedropper.com/temporaryphpinfo)
| <php><regex> | 2016-08-14 17:29:54 | LQ_EDIT |
38,945,234 | Include files without #include | <p>it is possible to include headers files intro visual studio wihtout <code>#include</code> preprocessor ? </p>
<p>I mean, i have a .cpp intro a visual studio project, and i don't want to use #include intro header file or source file. I want to be included automatically.</p>
<p>I mean some Windows header files are included automatically.. Soo i think is possible with files from my project too..</p>
<p>Best regards.</p>
| <c++><visual-studio> | 2016-08-14 18:21:11 | LQ_CLOSE |
38,945,498 | PHP img src (simple) | <p>I am trying to add an image file to my PHP so when I echo, the picture will appear alongside the message. However I am getting a syntax error on line 3. Any help would be appreciated.</p>
<pre><code><?php
echo "President has been killed";
<IMG SRC = "D:/User Data\Documents/Sheridan/Summer Year 3/Enterprise Java Development/Projects/PhpAssignment/skull.png;"/>
?>
</code></pre>
| <php><html> | 2016-08-14 18:48:01 | LQ_CLOSE |
38,945,783 | How to insert a list of string into a table of SQL server database | I have a table of 3 fields along with a primary key(id,Name,Gender,City).
create table tempTable
(
id int primary key identity,
name nvarchar(50),
gender nvarchar(50),
city nvarchar(50)
)
And there is a list of string like :
List<String> list = new List<String>() { "name", "male", "city" };
I want this list to insert into the tempTable. How can I do that?
| <c#><asp.net><sql-server><ado.net> | 2016-08-14 19:22:09 | LQ_EDIT |
38,948,187 | Query Selector is Null when I use insertAdjacentHTML | <p>I'm using insertAdjacentHtml to create a div with a button right after the opening body tag of the page.</p>
<pre><code><script>document.addEventListener('DOMContentLoaded', function(){
var code = '<div class="overlay"><button class="overlay-close"></button></div>';
document.body.insertAdjacentHTML('afterbegin', code);
}, false);</script>
</code></pre>
<p>But I get an error with the querySelector on my closeBttn.</p>
<p>Uncaught TypeError: Cannot read property 'querySelector' of null</p>
<pre><code><script>
(function() {
var overlay = document.querySelector( 'div.overlay' ),
closeBttn = overlay.querySelector( 'button.overlay-close' );
/* irrelevent other code here */
})();
</script>
</code></pre>
<p>Clearly it looks like I have the overlay button and overlay div present, but it still not working. It works fine without using insertAdjacentHTML, but once I wrapped my code in this function, I get the error, so I'm thinking there's something going on here when I use this function to create my div.</p>
<p>Can anyone help to debug or give a work around?</p>
| <javascript> | 2016-08-15 01:32:41 | LQ_CLOSE |
38,948,304 | output of expression in ( i-- - ++i) in java | <pre><code>int i = 11;
i = i-- - ++i;
System.out.println( i-- - ++i );
</code></pre>
<p>Output:
0</p>
<p>Please can you people explain?
It is really confusing </p>
| <java> | 2016-08-15 01:51:12 | LQ_CLOSE |
38,949,934 | How to change chekbox like this? | I need to change checkbox from [1]: http://i.stack.imgur.com/fPqOp.png
to [2]: http://i.stack.imgur.com/3hLdB.png
please help me to make checkbox like this...
| <java><android><checkbox> | 2016-08-15 05:52:02 | LQ_EDIT |
38,950,476 | Decrypt password using bcrypt php | <p>I search how to decrypt a password stored in bcrypt using php, but I don't find a good explaination. Could you please send some useful links ? Thx in advance and sorry for my english</p>
| <php><php-5.3><bcrypt> | 2016-08-15 06:47:51 | LQ_CLOSE |
38,950,622 | Why does iPhone layout look different in xCode and in Emulator | I've been developing a modified version of an iPad application, and try though I might, I've been unable to resolve the following issue.
[App, as seen in xCode][1]
I'm using a UITableView to display cells of information, however the cells have huge gaps between them in the iPad emulator.
[App, as seen in emulator][2]
If anyone has any ideas that I could try, I'd be happy to test out any different ideas to resolve the issue.
[1]: http://i.stack.imgur.com/4Uapy.png
[2]: http://i.stack.imgur.com/EnWTW.png | <ios><uitableview> | 2016-08-15 07:00:57 | LQ_EDIT |
38,950,764 | Difference between Throw and Throws in Java- Clarification | <p>I am confused to get a clear understanding of when throw is used and throws is used. Kindly provide me an example to show the difference.</p>
<p>Also, I tried the below code:</p>
<p>package AccessModifiers;</p>
<p>//import java.io.IOException;</p>
<p>public class ThrowExceptions {</p>
<pre><code>int QAAutoLevel;
int QAExp;
void QAAutomationHiring(int grade)
{
if (grade<5)
throw new ArithmeticException("Not professionally Qualified");
else
System.out.println("Ready to be test");
}
void QAExperience(int x,int grade)
{
QAAutomationHiring(grade);
}
void checkThrowsExep(int a,int b) throws ArithmeticException
{
try{
int result=a/b;
System.out.println("Result is :"+result);
}
catch(Exception e)
{
System.out.println("The error messgae is: "+ e.getMessage());
}
}
public static void main(String args[])
{
ThrowExceptions t=new ThrowExceptions();
//t.QAAutomationHiring(8);
t.QAExperience(2,8);
t.QAExperience(4,2);
t.checkThrowsExep(5, 0);
}
</code></pre>
<p>}</p>
<p>In the above code, when I run the program, the line- 't.checkThrowsExp' in main function is not reached. I studied that throw and throws are used to catch the exception and continue with the program execution. But here the execution stops and not proceeding to the next set of statements. Please share your comments.</p>
| <java> | 2016-08-15 07:14:23 | LQ_CLOSE |
38,951,144 | converting PHP eregi to preg_match, how do I do it? | <p>I am new to regex but I don't have the time right now to learn it,
yet I need to convert eregi("^..?$", $file) to a preg_match() but I
don't know how to do it, can anybody help me?</p>
<p>Also giving me a little understanding of how it works would also be
nice to have :)</p>
<p>The piece of code:</p>
<pre><code>$fileCount = 0;
while ($file = readdir($dh) and $fileCount < 5){
if (eregi("^..?$", $file)) {
continue;
}
$open = "./xml/".$file;
$xml = domxml_open_file($open);
//we need to pull out all the things from this file that we will need to
//build our links
$root = $xml->root();
$stat_array = $root->get_elements_by_tagname("status");
$status = extractText($stat_array);
$ab_array = $root->get_elements_by_tagname("abstract");
$abstract = extractText($ab_array);
$h_array = $root->get_elements_by_tagname("headline");
$headline = extractText($h_array);
if ($status != "live"){
continue;
}
echo "<tr valign=top><td>";
echo "<a href=\"showArticle.php?file=".$file . "\">".$headline . "</a><br>";
echo $abstract;
echo "</td></tr>";
$fileCount++;
}
</code></pre>
| <php><xml><eregi> | 2016-08-15 07:42:39 | LQ_CLOSE |
38,952,109 | How to onchange in input hidden? | Demo and full code is like this :
http://jsfiddle.net/9R4cV/685/
I using like this :
$('#customer_name').on('change', function() {
$('#customer_copy').val($(this).val());
});
But it's not working
Any solution to solve my problem? | <javascript><jquery><html> | 2016-08-15 08:55:43 | LQ_EDIT |
38,952,159 | Error loading css when updating user record rails | I am using devise for authentication on a client app. After extensive reading of the wiki, I managed to configure my app to suit my needs properly. However I have a css loading problem.
I chose the option of allowing an admin approve an account over `:confirmable` as I am not familiar with combining both `:confirmable` and approving the account.
I followed [this][1] links instruction to do just that and [this link][2] to help with configuring my `routes.rb` file when updating the attribute.
The issue now is, when I click the link to update the attribute, it does so flawlessly but the path for finding css after redirecting back changes.
To clarify what I mean, let's say my css file is in public/user/mycss.css, when I sign in with devise, it loads properly but upon clicking the link_to tag it updates the record, but looks for mycss.css via `users/:id/approve/mycss.css` which doesnt exist(with reference to second link).
I would be glad if someone could help me figure out why it's looking for the css file via that path.
If there is anything I am doing wrong, I am ready to learn and benefit from it because I am fairly new to devise.
[1]: https://github.com/plataformatec/devise/wiki/How-To:-Require-admin-to-activate-account-before-sign_in
[2]: http://stackoverflow.com/questions/15329041/browser-based-new-user-approval-by-admin-in-rails-3-2-app-using-devise | <html><css><ruby-on-rails><ruby><devise> | 2016-08-15 09:00:16 | LQ_EDIT |
38,952,681 | Avoid `logger=logging.getLogger(__name__)` without loosing | I am lazy and want to avoid this line in every python file which uses logging:
logger = logging.getLogger(__name__)
In january I asked how this could be done, and found an answer: http://stackoverflow.com/questions/34726515/avoid-logger-logging-getlogger-name
Unfortunately the answer there has the drawback, that you loose the ability to filter.
I really want to avoid this useless and redundant line.
Example:
import logging
def my_method(foo):
logging.info()
Unfortunately I think it is impossible do `logger = logging.getLogger(__name__)` implicitly if `logging.info()` gets called for the first time in this file.
Is there anybody out there who knows how to do impossible stuff?
| <python><logging> | 2016-08-15 09:38:16 | LQ_EDIT |
38,953,069 | Compare string and array c++ | <p>Im trying to compare the character count of a string with the index elements of an array, but am having trouble.
For example, if the userInput equals XX, the output should be:</p>
<p>XX is not in the array at position 0.</p>
<p>XX is in the array at position 1.</p>
<p>XX is not in the array at position 2.</p>
<pre><code>arr[] = {"X", "XX", "XXX"};
string userInput;
cin >> userInput;
for (int i = 0; i < userInput.length(); i++)
{
if (userInput[i] == arr[i])
{
cout << userInput << " is in the array at position " << i << endl;
}
else
{
cout << userInput << " is not in the array at position " << i << endl;
</code></pre>
<p>Im recieving this error and am not sure how to fix it. Im fairly new to programming so any help would be great. Thank you.</p>
<p>Invalid operands to binary expression ('int' and 'string' (aka 'basic_string, allocator >'))</p>
| <c++><arrays><string> | 2016-08-15 10:04:12 | LQ_CLOSE |
38,953,285 | When i run my autoclicker i cant stop it | If i click on start button i cant click back or stop.
I need stop app.One way to stop app is that you must power off computer :D.
When app is running start button is locked and i cant click on it.
This app is simple AutoClicker.
Exist in java something better to do autoclicker than robot class?
How can i fix it?
Is somewhere error?
Or something to stop the app?
import java.awt.AWTException;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Robot;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.Color;
public class AutoClicker extends JFrame {
private JPanel contentPane;
private final JLabel m = new JLabel("AutoClicker");
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
AutoClicker frame = new AutoClicker();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public AutoClicker() {
setAlwaysOnTop(false);
setTitle("AutoClicker");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 147, 162);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JCheckBox chckbxOnTop = new JCheckBox("On Top");
boolean onTop = false;
chckbxOnTop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if(chckbxOnTop.isSelected()){
setAlwaysOnTop(true);
}
else{
setAlwaysOnTop(false);
}
}
});
chckbxOnTop.setBounds(6, 7, 97, 23);
contentPane.add(chckbxOnTop);
JCheckBox chckbxAutoclicker = new JCheckBox("AutoClicker");
chckbxAutoclicker.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
for(;;){
if(chckbxAutoclicker.isSelected()){
for(;;){
try {
Robot r = new Robot();
r.mousePress(MouseEvent.BUTTON1_MASK);
r.setAutoDelay(1080);
r.mouseRelease(MouseEvent.BUTTON1_MASK);
} catch (AWTException e1) {
e1.printStackTrace();
}
}
}
else {
}
}
}
});
chckbxAutoclicker.setBounds(6, 80, 97, 23);
contentPane.add(chckbxAutoclicker);
m.setForeground(new Color(153, 102, 0));
m.setBounds(16, 92, 120, 31);
contentPane.add(m);
}
}
| <java><windows><swing> | 2016-08-15 10:20:18 | LQ_EDIT |
38,953,569 | stored procedure_ERROR | create or replace PROCEDURE Getstudentname(
@firstname varchar(20),
@lastname varchar (20),
@e_mail varchar(20)
)
as
begin
insert into TBL_STUDENTS(fanme,lname,email)values(@firstname,@lastname,@e_mail);
end;
What can be the error in this procedure.
Procedure GETSTUDENTNAME compiled
Errors: check compiler log
And this sql query is also not working giving:-
Error report -
SQL Error: ORA-00936: missing expression
00936. 00000 - "missing expression"
*Cause:
*Action: | <sql><oracle><stored-procedures> | 2016-08-15 10:41:41 | LQ_EDIT |
38,954,153 | how to get the Total sum for column with joins in sql server | I'm trying to get sum of the packages from this query, but it doesn't give me the correct result.
Select sum(i.cdin_NoofPackages),i.cdin_cdindexid as cntdp, coalesce((i.cdin_NoofPackages),0) as sqty,coalesce((i.cdin_WT),0) as swt ,coalesce((i.cdin_volumewt),0) as svwt ,coalesce((i.cdin_MortgageAmount),0) as samt
from cdindex i inner join company c on i.cdin_CompanyId =c.Comp_CompanyId inner join Territories t on i.cdin_Secterr =t.Terr_TerritoryID left outer join Performainv p on i.cdin_cdindexid=p.pinv_cdindexid
where(cdin_deleted Is null And c.comp_deleted Is null And t.Terr_Deleted Is null and p.pinv_deleted is null and (p.pinv_InvoiceProperty ='01' or p.pinv_InvoiceProperty is null ) and (p.pinv_Status in('Draft','Posted') or p.pinv_status is null) )
and i.cdin_startunstufdate between '2016-07-01' and '2016-07-11'
group by i.cdin_cdindexid,i.cdin_NoofPackages,i.cdin_WT,i.cdin_volumewt ,i.cdin_MortgageAmount
[This is a screen shot of query result][1]
[1]: http://i.stack.imgur.com/3BhuX.jpg | <sql><sql-server> | 2016-08-15 11:23:51 | LQ_EDIT |
38,954,498 | SQL - structure query language | I have this table
SECTION
Which consist of feild called
Semester
2
1
1
1
2
1
1
2
2
2
1
2
I need sql to count how many 1's and how many 2's are there
And out put like this
semester 1 | semester 2
6 | 6 | <sql> | 2016-08-15 11:48:29 | LQ_EDIT |
38,954,510 | Andriod App using facebook Api | I am new to use Facebook API in andriod app.I m trying to access all public images from facebook using facebook api where user can get all pictures with given location from facebook.how it is possible
| <facebook><api> | 2016-08-15 11:49:05 | LQ_EDIT |
38,955,876 | Get Value Without OnClick Js | i am finding solution for last 1 week but still no sucess so finally came here please help me out,
i want whatsapp share button for my android app , all is set only problem is i can get text area value but when i click ob button
<button onclick="GetValue ();">Get the velue of the textarea!</button>
i want to GetValue(); without onclick
this is my whatsapp code
<a href="whatsapp://send" data-text="GetValue ();" data-href="" class="wa_btn wa_btn_s" style="display:none">Share</a>
I want textArea Value in data-text and i am using it like above but it dont work.
this is my textarea
<textarea id="input_output" style="width:95%;" rows="10" wrap="soft">Enter Text Here..
</textarea>
please is there any way to get value without clicking button ? | <javascript><android><jquery><html><css> | 2016-08-15 13:20:00 | LQ_EDIT |
38,955,922 | Where I making mistake in the following code using matlab? | I have written a code :
for i = 1:length(Speed)
new=find(Speed>edges,1,'last');
N(new)=N(new)+1; end
Speed = 3000x1 ; edge = 50x1; N =50x1. After running this code I am getting the following code 'Error using > Matrix dimensions must agree'
I want to store the value in 'new' whenever Speed >edges. but I am getting this error.
| <arrays><matlab><sorting><matrix> | 2016-08-15 13:23:12 | LQ_EDIT |
38,955,945 | I need to solve this with arrays in jquery | I have this code and I need to create the following format of array.
var locations = [
['Bondi Beach', -33.890542, 151.274856, 4],
['Coogee Beach', -33.923036, 151.259052, 5],
['Cronulla Beach', -34.028249, 151.157507, 3],
['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
['Maroubra Beach', -33.950198, 151.259302, 1]
];
I have the following ajax petition and I receive all information correctly.
$.ajax({
url: '../get-route/46',
type: 'get',
success: function (data) {
$.each(data.poi, function(key, element) {
console.log(element.name);
console.log(element.latitud);
console.log(element.longitud);
});
}
});
How can I append this inormation into array called localtion ? | <javascript><jquery><ajax> | 2016-08-15 13:24:56 | LQ_EDIT |
38,957,441 | Extract strings from another string beginning and ending with a special char | <p>let's say I have a string like </p>
<blockquote>
<p>This {is} a new {test} {string} from me.</p>
</blockquote>
<p>My intention is to get all the strings surrounded by the <code>{</code> and <code>}</code> in a array, or a list.
So I want to get: </p>
<blockquote>
<p>{is} {test} {string}</p>
</blockquote>
<p>Substring won't work here. Probably 'regex' is the solution, but I just can't get it to work for me. Can someone help?</p>
| <php><regex><string><split><substring> | 2016-08-15 14:50:19 | LQ_CLOSE |
38,958,551 | check ALL arguments in c# that they can be numeric | <p>I am writing a small console application in C# and it requires two numeric parameters/arguments to be passed to it. I am checking for no params, more than 2 params, if two params. I am also converting those params if 2 returned to numeric for calculations I'm doing. One thing I'm not doing is verifying what's being passed is a number so assume program will crap out if I pass a letter. Is there a look routing I can just run to verify the params passed are in deed able to be numbers? I can handle the kick out from there but curious how you check if an argument CAN be a number or not.</p>
<p>Thanks.</p>
<p>JR</p>
| <c#> | 2016-08-15 15:58:38 | LQ_CLOSE |
38,958,833 | Check if webpage contains text | <p>I am getting a webpage using <code>file_get_contents();</code>:</p>
<pre><code>$file = file_get_contents('http://example.com');
</code></pre>
<p>How do I check if the webpage contains the text 'hello' or 'bye'</p>
| <php><file-get-contents> | 2016-08-15 16:15:41 | LQ_CLOSE |
38,958,934 | Why flexible array member must be at end of struct but struct with flexible array not? | <p>Some struct with flexible array:</p>
<pre><code>struct SomeArray { unsigned length; int array[]; };
</code></pre>
<p>This code gcc (ver. 4.9.2) compiling with no errors:</p>
<pre><code>struct s1{ unsigned length; SomeArray some_array; const char * string; } ss1;
</code></pre>
<p>How this work?</p>
| <c><arrays><struct> | 2016-08-15 16:22:12 | LQ_CLOSE |
38,959,134 | Can we put a char digit into an int Stack in C programming language? | <p>We're given a char arithmetic expression and we should put the operands into an int stack and solve the expression with the operator and get the answer. Is it possible passing a character into a integer stack and get the answer?</p>
| <c> | 2016-08-15 16:35:13 | LQ_CLOSE |
38,959,396 | How to call the functions present in one .py file from other .py file ? I have coded like this | one.py
class One:
def printNumber( self, a ):
print (a)
two.py
<< import one >> gives error no module named one
<< import One >> gives error no module named One
class Two
<< Here I want to call printNumber method from one.py >> | <python><python-3.x><import> | 2016-08-15 16:52:18 | LQ_EDIT |
38,960,379 | I am trying retrive the data type of a unknown data type input by user in Object class. But it taking it as a string by default. Any help plz | `Scanner in=new Scanner(System.in);
Object o=in.next().getClass().getSimpleName();
System.out.println(o);`
//it is showing string data type when input is taken by user
//it is showing correct data type when data is initialized in the code. | <java> | 2016-08-15 18:00:18 | LQ_EDIT |
38,962,415 | Q: Android studio. Radio button group inside another radio button group | I am programming my first application in android studio. User should select the training type (muscle gain, weight loss, own program) and then choose sex (male/female). So, 6 possible outcomes. 2 respective radio groups. After choosing necessary options user hits confirm button and goes to necessary screen with training type (using one of 6 addListeneronbutton methods). But app does not react after installation.
Would you please tell what I'm doing wrong?
public void onRadioButtonClicked(View view) {
switch (view.getId()) {
case R.id.Muscles:
switch (view.getId()){
case R.id.Male:
addListenerOnButton();
case R.id.Female:
addListenerOnButton2();
}
break;
case R.id.Diet:
switch (view.getId()){
case R.id.Male:
addListenerOnButton3();
case R.id.Female:
addListenerOnButton4();
}
break;
case R.id.Own:
switch (view.getId()){
case R.id.Male:
addListenerOnButton3();
case R.id.Female:
addListenerOnButton4();
}
break;
}
}
Respective xml file has following code for choosing sex:
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/radioGroup">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/Male"
android:text="Male"
android:onClick="onRadioButtonClicked"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:id="@+id/Female"
android:text="Female"
android:onclick="onRadioButtonClicked"/>
</RadioGroup>
Inside the same xml second radio group for choosing training type:
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/radioGroup2">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:id="@+id/Muscles"
android:text="@string/Muscles"
android:onClick="onRadioButtonClicked"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/Diet"
android:text="@string/Fat"
android:onClick="onRadioButtonClicked"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/Own"
android:text="@string/Own"
android:onClick="onRadioButtonClicked"/>
</RadioGroup>
| <android><radio-button> | 2016-08-15 20:17:26 | LQ_EDIT |
38,963,329 | Fetch categories list from SQL Server 2008 | <p>I have below table structure in SQL Server 2008:</p>
<ol>
<li>Article (stores articles)</li>
<li>Category (stores category) </li>
<li>ArticleToCategory (stores article and category reference since one article can be tagged to multiple category). </li>
</ol>
<p>Now i want to fetch categories (with article count) whose articles are not tagged to any other category).</p>
| <sql-server><select-query> | 2016-08-15 21:27:07 | LQ_CLOSE |
38,965,930 | how to properly do a T-SQL case statement in my code as shown below. TIA | declare @result as decimal(18, 2)
select @result = sum(basepay)
case @result when
null then 0.00
end
from dbo.tblPayments where ClientID = 1 and month(paymentfor) = 1
print @result | <sql-server><tsql><case> | 2016-08-16 02:52:26 | LQ_EDIT |
38,966,624 | the js is not working on this code | <html>
<head>
<link rel="stylesheet" type="text/css" href="rise.css">
<script>
function myFunction{
document.getElementById("bad").style.display="block";
}
</script>
</head>
<body>
<div id="good">
<div id="vahid">
<div id="one">
<img src="image1.jpg" id="boom"><br><br><br><br><br>
<!--button-->
<img src="button.jpg" onclick="myFunction()" id="button"><br><br><br><br>
<!--icons-->
<span class="local">
<img src="img.jpg">
<img src="img1.jpg">
<img src="img2.jpg">
<img src="img3.jpg">
</span><br><br><br><br>
<span class="local">
<img src="img4.jpg">
<img src="img5.jpg">
<img src="img6.jpg">
<img src="img7.jpg">
</span>
</div>
</div>
<div id="isnani">
<div id="third">
<p >
<span class="fourth">Dashboard</span>
<span class="fifth"> + New</span>
</p>
<!--<p class="fourth"> </p>
<p id="fort"><input type="text" placeholder="search your project here..." ></p>
<div id="jump"><img src="search.jpg" height="20px" width="10px"></div>-->
<p id="sixth"> Welcome to Flatkit</p>
<p id="seventh"> Bootstrap 4 Web App Kit With Angular js</p>
</div>
</div>
</div>
<div id="bad">
</div>
</body>
</html>
css:
#good{
width: 100%;
height: 100%;
}
#bad{
position:absolute;
width: 15%;
height: 100%;
background-color: #023b3b;
top:0%;
display: none;
}
#vahid{
float: left;
width: 7%;
height: 100%;
background-color: #023b3b;
}
#isnani{
float: left;
width: 93%;
height: 100%;
background-color: bisque;
}
#one {
display:block;
background-color: #023b3b;
/* width:60px;
height: 867px;*/
}
#boom{
margin-top: 30%;
height: 5%;
width: 35%;
float: left;
padding-left: 20px;
}
.local img {
height: 2.5%;
width:30%;
margin :10px 0px 10px 20px;
}
/*isnani starts here*/
#third{ float:left;
width:100%;
height: 15%;
border-color:white;
border-style : solid;
background-color : white;
}
.fourth{
margin-left: 2%;
margin-top: 5%;
font-family: sans-serif;
}
.fifth{
color: #808080;
font-size: 80%;
font-weight: 800;
font-family: arial,sans-serif;
margin-left: 1%;
}
#sixth{
font-family: sans-serif;
font-size:150%;
color:#666666;
margin-top: 4%;
margin-left: 2%;
/*top: -2%;/
/* line-height: 3%; */
}
#seventh{
position: absolute;
top: 11%;
color: #808080;
font-family: sans-serif;
font-size: 80%;
margin-left: 1.8%;
margin-top: 1.5%;
/*line-height: 3%;*/
}
#fort{
float: right;
margin-top: -65px;
margin-right: 80px;
}
#button{
margin-left: 80%;
width: 20%;
hyphens: 20%;
}
the java script is not working on this html page.look at the id "bad",initially it's value is none ,but when **click on** the image it need to be displayed.that is given inside the script document.getElementById("bad").style.display="block". | <javascript><html><css><button> | 2016-08-16 04:24:27 | LQ_EDIT |
38,969,531 | PHP oop about class | HI i want to make a code like this .. Can you give me an example on how to implement this ?
$theclassvariable = new Myclass();
$theclassvariable->firstMethod()->secondMethod($param,$param);
thank you so much
| <php><oop> | 2016-08-16 08:01:22 | LQ_EDIT |
38,970,467 | for loop for MATLAB code to calculate Mean value | I have an excel sheet of 41 columns and 513 rows. I want to use a loop which will calculate the mean of 4 columns. The interval is i = 2:4:41. I need help with writing down the loop.
for i = 2:4:41
*the formula for the mean calculation, V()=V()/41;*
Need help with the **. Thank you | <matlab><for-loop> | 2016-08-16 08:51:47 | LQ_EDIT |
38,971,014 | align text with inputbox and div |
div which i use as border i wanted it to be in vertically center it looks like div going upwards
[![div going upward][1]][1]
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<label> Application </label> <input type="text" style="width:10%; bottom:20px;"> <div style="width:1px; height:20px; background-color:grey;display: inline-block"></div> <label> Iteration </label> <input type="text" style="width:10%">
<!-- end snippet -->
[1]: http://i.stack.imgur.com/sSh4Q.png | <html><css><vertical-alignment> | 2016-08-16 09:18:10 | LQ_EDIT |
38,971,119 | Is It possible add my application in account? Please refer image | [I am trying to add application in account same as gmail and what-apps. i did lots of search but no use. Click on it for image ][1]
[1]: http://i.stack.imgur.com/gU8vF.jpg | <android> | 2016-08-16 09:23:24 | LQ_EDIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.