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,759,684 | Excel VBA - Do While Loop for SKU numbers | I am trying to automate my SKU numbers
I have 3 Columbs the First goes to 28, Second 6, Third 58.
I want the SKU to have a Trend like so 0{(###)col1}{(##)col2}{(##)col3}0
My Code looks like this
Sub SKU()
Dim x As Long
x = 1
i = 1
j = 1
k = 1
Do While Cells(i, 1) <> ""
Do While Cells(j, 2) <> ""
Do While Cells(k, 3) <> ""
Cells(x, 4).Value = Format(0, "0") & Format(i, "000") & Format(j, "00") & Format(k, "00") & Format(0, "0")
k = k + 1
x = x + 1
Loop
j = j + 1
Loop
i = i + 1
Loop
End Sub
| <excel><do-while><vba> | 2016-08-04 06:11:28 | LQ_EDIT |
38,759,814 | getting error at the statement sqlccon.open "ystem.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code" |
public partial class Webpages_Default : System.Web.UI.Page
{
SqlConnection sqlCon = new SqlConnection(ConfigurationManager.ConnectionStrings["conStr"].ConnectionString);
> Blockquote
protected void Page_Load(object sender, EventArgs e)
{
lblnorecordfound.Visible = false;
gvRCATracker.Visible = false;
if (!IsPostBack) {
//Binding control
sqlCon.Open();
BindPriority();
BindProductCategory();
BindPortfolio();
BindRCAResponseTeam();
BindTSMReview();
BindRCAStatus();
sqlCon.Close();
SetReadOnlyForDateControls();
} | <c#><html><asp.net><sql-server> | 2016-08-04 06:19:00 | LQ_EDIT |
38,761,021 | does Any == Object | <p>The following code in kotlin:</p>
<pre><code>Any().javaClass
</code></pre>
<p>Has value of <code>java.lang.Object</code>. Does that mean <code>Any</code> and <code>Object</code> are the same class? What are their relations?</p>
| <kotlin> | 2016-08-04 07:27:55 | HQ |
38,761,231 | UICollectionView with self sizing cells uses estimatedItemSize for delete animation | <p>I'm using <code>UICollectionView</code> with self sizing cells and have set the <code>estimatedItemSize</code> property for this to work.</p>
<p>When performing a delete animation however, the cells animate to their position if they were sized with the <code>estimatedItemSize</code> property, rather than their auto layout (actual) size.</p>
<p>What's worse is that our cells are variable sizes and there doesn't seem to be a method like <code>UITableView</code> where we can pass an estimated size per index path.</p>
<p>I attempted to subclass the collection view flow layout and override the <code>initialLayoutAttributesForAppearingItemAtIndexPath(_:)</code> and <code>finalLayoutAttributesForDisappearingItemAtIndexPath(_:)</code>, but on inspection the superclass's return values for these methods are correct.</p>
<p>Does anyone know of a solution to this seemingly basic bug?</p>
| <autolayout><uicollectionview> | 2016-08-04 07:37:54 | HQ |
38,761,294 | Why doesn't Kotlin allow to use lateinit with primitive types? | <p>In the Kotlin language we, by default, have to initialize each variable when it is introduced. To avoid this, the <code>lateinit</code> keyword can be used. Referring to a <code>lateinit</code> variable before it has been initialized results in a runtime exception.</p>
<p><code>lateinit</code> can not, however, be used with the primitive types. Why is it so?</p>
| <initialization><kotlin><primitive> | 2016-08-04 07:40:42 | HQ |
38,761,626 | the counterpart of std::move in boost library | <p>I am trying to use <code>std::move</code> in my codes, but the compiler (g++ 4.4) I am using does not support it. Can <code>boost::move</code> substitute <code>std::move</code> completely? Thanks. </p>
| <c++><c++11><boost> | 2016-08-04 07:57:45 | HQ |
38,762,516 | Increase object names programatically C# | I have a textbox for data entry and 10 textboxes for showing datas. 10 viewer textboxes is visible=false by default.For example when i enter textbox count to "3" , only 3 textboxes should be visible. ( Then i can do whatever i want those textboxes)
[Example][1]
[1]: http://i.stack.imgur.com/J24ea.png | <c#><object><textbox><names> | 2016-08-04 08:43:07 | LQ_EDIT |
38,762,715 | How to destructure object properties with key names that are invalid variable names? | <p>As object keys are strings they can contain any kind of characters and special characters. I recently stumbled upon an object which I receive from an API call. This object has '-' in it's key names.</p>
<pre><code>const object = {
"key-with-dash": []
}
</code></pre>
<p>Destructuring does not work in this case because <code>key-with-dash</code> is not a valid variable name.</p>
<pre><code>const { key-with-dash } = object;
</code></pre>
<p>So one question came to my mind. How am I supposed to destructure the object in such cases? Is it even possible at all?</p>
| <javascript><ecmascript-6><destructuring> | 2016-08-04 08:51:27 | HQ |
38,763,460 | Angular $scope variable not updating | <p>In my angular, I define a scope variable <code>$scope.letter_content</code>. When the view is loaded, I load string from my database and set it to <code>$scope.letter_content</code>. Then, I populate on a texteditor(Froala) i'm using.</p>
<p>Below is the code for the view:</p>
<pre><code> {{letter_content}}
<div ng-if="formData['page_number'] == 1 ">
{{letter_content}}
<textarea id="froala-sample-2" froala="froalaOptions" ng-model="letter_content"></textarea>
</div>
</code></pre>
<p>So basically I set <code>letter_content</code> as ng-model for the texteditor. So when I make changes on the texteditor, it modifies the value <code>$scope.letter_content</code>. </p>
<p>One thing I found it weird is that when I modify the text in the texteditor, it changes <code>{{letter_content}}</code> inside the div. However, it does not update <code>{{letter_content}}</code> outside the div. </p>
<p>When I'm done editing the text in my texteditor, I send send a put request to update the value in the database with <code>$scope.letter_content</code>. However, it ends up sending <code>{{letter_content}}</code> outside the div which ends up not updating the content. </p>
<p>Why is this weird thing happening?</p>
| <javascript><angularjs> | 2016-08-04 09:25:30 | HQ |
38,763,521 | git - ignore the modified files in site1 | we have site1 & site2 .
From site 2 , when we tried to pull using below command, we got below error :
**git pull staging development**
[![enter image description here][1]][1]
[![enter image description here][3]][3]
so we tried this command : **git stash pop**
now it displaying like this :
[![enter image description here][2]][2]
I want all site1 changes to be overrided by site2.
[1]: http://i.stack.imgur.com/trRop.png
[2]: http://i.stack.imgur.com/uyJh8.png
[3]: http://i.stack.imgur.com/W48re.png | <php><pdo> | 2016-08-04 09:28:21 | LQ_EDIT |
38,764,337 | I can not access my sql server connection | [enter image description here][1]
[1]: http://i.stack.imgur.com/AXcoe.jpg
TITLE: Connect to Server
------------------------------
Cannot connect to DELL\SQLEXPRESS.
------------------------------
ADDITIONAL INFORMATION:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&EvtSrc=MSSQLServer&EvtID=233&LinkId=20476
------------------------------
No process is on the other end of the pipe
------------------------------
BUTTONS:
OK
------------------------------
| <sql-server> | 2016-08-04 10:05:34 | LQ_EDIT |
38,764,610 | Using Vue.js in Golang's HTML templates | <p>I want to use Vue.js with the Golang's HTML template engine but as both use <code>{{ ... }}</code> for syntax, they conflict with each other...</p>
<p>Does anyone has already did it somehow or have any suggestions on how to overlap this problem?</p>
<p>Thanks in advance.</p>
| <html><go><vue.js> | 2016-08-04 10:17:26 | HQ |
38,765,368 | Segmentation fault on properly allocated array | <p>I get a segmentation fault while assigning values to what looks to me a properly allocated array. Here is the code below:</p>
<pre><code>int SpV = L*L*L;
int V = SpV*T;
int M = 16;
int Ns = 2;
int Np = 10;
float *twopBuf = (float*) malloc(Np*Ns*V*M*2*sizeof(float));
if(twopBuf == NULL){
fprintf(stderr,"Cannot allocate twopBuf. Exiting\n");
exit(-1);
}
for(int bar=0;bar<Np;bar++)
for(int pr=0;pr<Ns;pr++)
for(int t=0;t<T;t++)
for(int v=0;v<SpV;v++)
for(int gm=0;gm<M;gm++){
int pos = 2*gm + 2*M*v + 2*M*SpV*t + 2*M*SpV*T*pr + 2*M*SpV*T*Ns*bar;
twopBuf[ 0 + pos ] = 1.0; // Set to 1.0 for
twopBuf[ 1 + pos ] = 1.0; // testing purposes
}
</code></pre>
<p>L and T are input, so when say <code>L = 32</code> and <code>T = 64</code> it runs fine. But for <code>L = 48</code> and <code>T = 96</code> I get segmentation fault after <code>bar</code> becomes 2 and before it becomes 3. If there wasn't enough memory to allocate <code>twopBuf</code> wouldn't I already get the error message?</p>
<p>I'm running this on the head node of a large supercomputer, if it makes a difference. Thanks.</p>
| <c++><c> | 2016-08-04 10:53:44 | LQ_CLOSE |
38,765,574 | How can I print data that i filtered out of my mysql table | I am currently developing a school project and once again require some advice from fellow coders. I basically have a mysql table from which i filter out data (according to conditions). I used to print this filtered data to the console, however I now want to go further and want to print the results.
Is there a simple way to maybe write the data to another table and print it?
If not is there perhaps a way to just export the data (maybe in the form of a txt.file)?
My problem is basically that i am still a beginner who doesn't know most of the Java terms and functions. It would therefore be very helpful if someone could perhaps recommend a simple way to fulfil the above requirements.
Thank you for your help :)!!
| <java><mysql> | 2016-08-04 11:02:59 | LQ_EDIT |
38,765,653 | stupid javascript error in image filter | So I am making a basic application that adds image filters to images. Here is the code.
class ImageUtils {
static getCanvas(w, h) {
var c = document.querySelector("canvas");
c.width = w;
c.height = h;
return c;
}
static getPixels(img) {
var c = ImageUtils.getCanvas(img.width, img.height);
var ctx = c.getContext('2d');
ctx.drawImage(img, 0, 0);
return ctx.getImageData(0,0,c.width,c.height);
}
static putPixels(imageData, w, h) {
var c = ImageUtils.getCanvas(w, h);
var ctx = c.getContext('2d');
ctx.putImageData(imageData, 0, 0);
}
}
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
...
function makeMoreRed(img, adjustment){
var pixels = ImageUtils.getPixels(img);
var length = pixels.data.length;
var data = pixels.data;
for(var r = 0; r < length; r += 4) {
data[r] += adjustment;
}
ImageUtils.putPixels(pixels, img.width. img.height);
}
...
$(document).ready(function() {
var img = new Image();
img.src = "img/cat.jpg";
makeMoreRed(img, 50);
});
When I launch it with the webpage, Chrome throws this error
[stupid javascript error][1]
This does not make any sense as there is nothing but a semicolon at the end of the function.
Is there any solution on how to resolve this because here you can see that there is no change in the top image (the one that is supposed to be filtered)
[two cat pictures][2]
[1]: http://i.stack.imgur.com/Vvum7.png
[2]: http://i.stack.imgur.com/MRi4m.png | <javascript> | 2016-08-04 11:07:20 | LQ_EDIT |
38,766,410 | check if row allredy exists | I want to check in my sql table if row allredy existes.
I want to save data if he is not existes in my table. I'm using in selsect qurey but it dosent worked
this is my code:
$sql = "INSERT INTO searchtable (word, position, count) VALUES (:word , :position, :count)";
$statement = $db->prepare($sql);
$temp="SELECT COUNT(word) AS searchtableFromword FROM searchtable WHERE word=$title" ;
echo mysql_num_rows($temp);
if($checkTitle == 0 )
{
$statement->execute(array(
'word' => $title,
'position' => $fileNum,
'count' => $titleVal
));
} | <php><mysql><select><sql-insert> | 2016-08-04 11:43:28 | LQ_EDIT |
38,767,126 | getting Error: spawn EACCES while ionic build android in ubuntu 14.04 | <p>i developed one project in ionic2</p>
<p>while i am doing ionic build android i am getting this error</p>
<p><a href="https://i.stack.imgur.com/TUCzj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TUCzj.png" alt="enter image description here"></a></p>
<p>my ionic info is </p>
<p>Cordova CLI: 6.3.0</p>
<p>Ionic Framework Version: 2.0.0-beta.10</p>
<p>Ionic CLI Version: 2.0.0-beta.36</p>
<p>Ionic App Lib Version: 2.0.0-beta.19</p>
<p>OS: Distributor ID: Ubuntu Description: Ubuntu 14.04.5 LTS </p>
<p>Node Version: v4.4.7</p>
<p>I searched in google but no solution works for me..</p>
<p>How can i fix this Bug?</p>
| <android><cordova><ionic2> | 2016-08-04 12:17:50 | HQ |
38,767,278 | Store Array Javascript to PHP with session | <p>I want to store array from index.html to file.php with $_SESSION but I'm getting stuck (I don't know how to store and access it, since im new in php).</p>
<p>Here my codes in <strong>index.html</strong>:</p>
<pre><code><?php
session_start();
$_SESSION["myArray"] = $array;
?>
$(function generateArray (parameter) {
var array = ["hello","world"];
});
</code></pre>
<p>Here my codes in file.php:</p>
<pre><code><?php
session_start();
//print_r($_SESSION["myArray"]) --> how can I do that?
?>
</code></pre>
<p>Can somebody help me? :')</p>
| <javascript><php><arrays><session> | 2016-08-04 12:24:50 | LQ_CLOSE |
38,767,531 | Declaring Const With Curly Braces in JSX | <p>I'm just getting started with React Native and getting used to JSX syntax. Is that what I'm talking about? Or am I talking about TypeScript? Or... ES6? Anyway...</p>
<p>I've seen this:</p>
<pre><code>const { foo } = this.props;
</code></pre>
<p>Inside a class function. What is the purpose of the curly braces and what's the difference between using them and not using them?</p>
| <react-jsx><jsx> | 2016-08-04 12:36:55 | HQ |
38,767,898 | CREATING VIEW WITH SELECT QUERY HAVING SUB QUERIES | CREATE OR REPLACE VIEW SAMPLE_VIEW(MISSION_ID,"ESMP TRACK NO","RFPS TRACK NO","RADAR ID")
AS
SELECT ESMP.MISSION_ID,ESMP.TRACK_NO,RFPS.RFPS_TRK_NO,(SELECT RADAR_ID FROM MATCHED_TT_DETAILS TT1 WHERE TT1.MISSION_ID = ESMP.MISSION_ID AND TT1.TRACK_NO = ESMP.TRACK_NO)
FROM ESMP_DETAILS ESMP,RFPS_DETAILS RFPS WHERE ESMP.MISSION_ID = RFPS.MISSION_ID AND ESMP.TRACK_NO = RFPS.ESMP_TRACK_NO;
I have created above view and i'm getting error.
ESMP_DETAILS table
===================
MISSION_ID TRACK_NO
A 4
B 5
C 6
RFPS_DETAILS TABLE
==================
MISSION_ID RFPS_TRK_NO
A 77
B 88
MATCHED_TT_DETAILS TABLE
========================
MISSION_ID RADAR_ID
A 5
A 6
B 4
I WANT OUTPUT LIKE BELOW IN VIEW
========================
MISSION_ID TRACK_NO RFPS_TRK_NO RADAR_ID
A 4 77 5
A 4 77 6
B 5 88 4
| <sql><oracle> | 2016-08-04 12:52:57 | LQ_EDIT |
38,768,792 | Which Smarttv can open a browser on boot ? | Is their a smarttv that can open a browser when it's powered on (In EU)? And how is can you do it (do you need to hack the tv)? | <boot><smart-tv> | 2016-08-04 13:31:25 | LQ_EDIT |
38,768,913 | Android Auto Google Play Rejection | <p>Google keeps rejecting my app for the following reason:
"During review, we found that if audio is playing on the device while plugging into the Android Auto experience, the music continues to play through the car speakers without user intent. We see this as a driver distraction, and isn't appropriate for Android Auto apps."</p>
<p>I thought I had taken the appropriate steps to resolve this by following the documentation from here: <a href="https://developer.android.com/training/auto/audio/index.html#isconnected">https://developer.android.com/training/auto/audio/index.html#isconnected</a></p>
<p>However, they rejected me again for the same reason.</p>
<p>In my MediaBrowserServiceCompat StreamService class, I've added the following code:</p>
<pre><code>private IntentFilter androidAutoConnectionIntentFilter = new IntentFilter("com.google.android.gms.car.media.STATUS");
private AndroidAutoConnectionStatusReceiver androidAutoConnectionStatusReceiver = new AndroidAutoConnectionStatusReceiver();
</code></pre>
<p>In the onCreate(), I've added:</p>
<pre><code>registerReceiver(androidAutoConnectionStatusReceiver, androidAutoConnectionIntentFilter);
</code></pre>
<p>and added this class to the service as well:</p>
<pre><code>private class AndroidAutoConnectionStatusReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
System.out.println("*** ANDROID AUTO CONNECTED: " + intent);
String status = intent.getStringExtra("media_connection_status");
boolean isConnectedToCar = "media_connected".equals(status);
if (isConnectedToCar) {
// android auto connected so stop playback
Intent stopIntent = new Intent(context, StreamService.class);
stopIntent.setAction(StreamService.ACTION_PLAYER_STOP);
context.startService(stopIntent);
}
}
}
</code></pre>
<p>Any idea how I can update my app to resolve this rejection?</p>
| <android><android-auto> | 2016-08-04 13:36:14 | HQ |
38,769,589 | how to replace last 5 digits with 99999 in update query, guide me how to do it | i have one column ,in that column all rows are having 10 digits '1234567890'
By using update postgresql update sql i need to update last 5 digits to 99999. ie '1234599999'
Can any one provide me update query for above requirement | <postgresql><sql-update> | 2016-08-04 14:03:44 | LQ_EDIT |
38,769,648 | what is the best from/email validation method in php? | <p>I know there is a best method which called "PREG MATCH" in php programming language. I want to know is there any other method in php for validation? and which is the best? what method I practice as a pro php developer? Thank you all :)</p>
| <php><validation><email> | 2016-08-04 14:05:46 | LQ_CLOSE |
38,769,710 | c# delet a item form a listbox using double click | I need help I don't know I do to delete an item from the listbox by double click the item I have just started like 1 hour ago so I don't have code that can help. I didn't find anything on interned that could help me. if you know how to do this or a tutorial pleas comment that | <c#><.net><winforms> | 2016-08-04 14:08:04 | LQ_EDIT |
38,769,976 | Is it possible to Git merge / push using Jenkins pipeline | <p>I am trying to create a Jenkins workflow using a Jenkinsfile. All I want it to do is monitor the 'develop' branch for changes. When a change occurs, I want it to git tag and merge to master. I am using the GitSCM Step but the only thing that it appears to support is git clone. I don't want to have to shell out to do the tag / merge but I see no way around it. Does anyone know if this is possible? I am using BitBucket (on-prem) for my Git server.</p>
| <git><jenkins><groovy><bitbucket> | 2016-08-04 14:18:13 | HQ |
38,771,397 | find memory leak with perfview | i have a c# (.net 4.5) service in production which is compiled in debug. in one day it has leaked 900mb of memory. actually uses 10gb of memory.
So I tried to make a diff with perfview, but I can't find my 900mb leaking. What I can see is the unreachable memory has been increased about 1000mb. what does this mean?
so basically, I think there isn't a real memory leak. maybe the GC is not working, as I expect.
[perfview diff][3]
[perfmon][4]
what can I do to find what it causing to incrase the memory consumption by 400mb-900mb per day?
[3]: http://i.stack.imgur.com/bqyK5.png
[4]: http://i.stack.imgur.com/PXq2p.png | <c#><memory><memory-leaks><garbage-collection><perfview> | 2016-08-04 15:21:33 | LQ_EDIT |
38,771,403 | How to use @HostBinding with @Input properties in Angular 2? | <p>(Angular 2 RC4)</p>
<p>With <a href="https://angular.io/docs/ts/latest/api/core/index/HostBinding-var.html">@HostBinding</a> we should be able to modify properties of the host, right? My question is, does this apply to @Input() properties as well and if so, what is the correct usage? If not, is there another way to achieve this?</p>
<p>I made a Plunker here to illustrate my problem: <a href="https://embed.plnkr.co/kQEKbT/">https://embed.plnkr.co/kQEKbT/</a></p>
<p>Suppose I have a custom component:</p>
<pre><code>@Component({
selector: 'custom-img',
template: `
<img src="{{src}}">
`
})
export class CustomImgComponent {
@Input() src: string;
}
</code></pre>
<p>And I want to feed the src property with an attribute directive:</p>
<pre><code>@Directive({
selector: '[srcKey]'
})
export class SrcKeyDirective implements OnChanges {
@Input() srcKey: string;
@HostBinding() src;
ngOnChanges() {
this.src = `https://www.google.com.mt/images/branding/googlelogo/2x/${this.srcKey}_color_272x92dp.png`;
}
}
</code></pre>
<p>Why can't this directive change the [src] input property of the custom component?</p>
<pre><code>@Component({
selector: 'my-app',
directives: [CustomImgComponent, SrcKeyDirective],
template: `<custom-img [srcKey]="imageKey"></custom-img>`
})
export class AppComponent {
imageKey = "googlelogo";
}
</code></pre>
<p>Thanks!</p>
| <angular> | 2016-08-04 15:21:47 | HQ |
38,771,538 | Javascript regexp does not match date correctly | <p>I'm trying to filter out date results, but I think I may have the regular expression wrong.</p>
<pre><code>if ((strSearchInx == 6) || (strSearchInx == 7)) {
var regDate = new RegExp("/^\d{1,2}\/\d{1,2}\/\d{4}$/");
strSearchField = strSearchField.trim();
//alert(strSearchField);
if (regDate.test(strSearchField) == false) {
alert("Date does not match mm/dd/yyyy format. Please re-enter");
document.getElementById('searchfield').focus();
return false;
}
}
</code></pre>
<p>I've tested it against 8/3/2016 and it doesn't seem to let any response through: Is /^\d{1,2}/\d{1,2}/\d{4}$/ the correct regular expression?</p>
<p>Thanks.</p>
| <javascript><regex><date> | 2016-08-04 15:27:56 | LQ_CLOSE |
38,771,551 | why does std::allocator::deallocate require a size? | <p><code>std::allocator</code> is an abstraction over the underlying memory model, which wraps the functionality of calling <code>new</code> and <code>delete</code>. <code>delete</code> doesn't need a size though, but <a href="http://en.cppreference.com/w/cpp/memory/allocator/deallocate" rel="noreferrer">deallocate()</a> <em>requires</em> it. </p>
<blockquote>
<p><strong>void deallocate( T* p, std::size_t n );</strong><br>
"The argument n must be equal to the first argument of the call to
allocate() that originally produced p; otherwise, the behavior is
undefined." </p>
</blockquote>
<p>Why? </p>
<p>Now I either have to make additional calculations before deallocating, or start storing the sizes that I passed to allocate. If I didn't use the allocator I wouldn't have to do this.</p>
| <c++><memory-management><stl><delete-operator><allocator> | 2016-08-04 15:28:26 | HQ |
38,772,135 | adding nested dictionaries in python from yield | If I do something like this:
x1={'Count': 11, 'Name': 'Andrew'}
x2={'Count': 14, 'Name': 'Matt'}
x3={'Count': 17, 'Name': 'Devin'}
x4={'Count': 20, 'Name': 'Andrew'}
x1
vars=[x1,x2,x3,x4]
for i in vars:
my_dict[i[group_by_column]]=i
my_dict
Then I get:
defaultdict(int,
{'Andrew': {'Count': 20, 'Name': 'Andrew'},
'Devin': {'Count': 17, 'Name': 'Devin'},
'Geoff': {'Count': 10, 'Name': 'Geoff'},
'Matt': {'Count': 14, 'Name': 'Matt'}})
Which is exactly what I want.
However, when I try to replicate this from an object that is has a "yield" built into it, it keeps overwriting very value in the dictionary. For example, `cast_record_stream` is a function result that yields the following dictionaries as requested:
{'Count': 11, 'Name': 'Andrew'}
{'Count': 14, 'Name': 'Matt'}
{'Count': 17, 'Name': 'Devin'}
{'Count': 20, 'Name': 'Andrew'}
{'Count': 5, 'Name': 'Geoff'}
{'Count': 10, 'Name': 'Geoff'}
So then when I run this function it comes out wrong:
for line in cast_record_stream:
record_name=line['Name']
my_dict[record_name]=line
defaultdict(<type 'int'>, {'Devin': {'Count': 10, 'Name': 'Geoff'},
'Matt': {'Count': 10, 'Name': 'Geoff'},
'Geoff': {'Count': 10, 'Name': 'Geoff'},
'Andrew': {'Count': 10, 'Name': 'Geoff'}})
Am I creating a problem here that I can't see? I figured it would just add one value at a time. | <python><dictionary><nested> | 2016-08-04 15:56:02 | LQ_EDIT |
38,772,442 | Css transition from display none to display block, navigation with subnav | <p>This is what I have <a href="https://jsfiddle.net/vour8ad9/" rel="noreferrer">jsFiddle link</a></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>nav.main ul ul {
position: absolute;
list-style: none;
display: none;
opacity: 0;
visibility: hidden;
padding: 10px;
background-color: rgba(92, 91, 87, 0.9);
-webkit-transition: opacity 600ms, visibility 600ms;
transition: opacity 600ms, visibility 600ms;
}
nav.main ul li:hover ul {
display: block;
visibility: visible;
opacity: 1;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><nav class="main">
<ul>
<li>
<a href="">Lorem</a>
<ul>
<li><a href="">Ipsum</a></li>
<li><a href="">Dolor</a></li>
<li><a href="">Sit</a></li>
<li><a href="">Amet</a></li>
</ul>
</li>
</ul>
</nav></code></pre>
</div>
</div>
</p>
<p>Why is there no transition? If I set </p>
<pre><code>nav.main ul li:hover ul {
display: block;
visibility: visible;
opacity: 0; /* changed this line */
}
</code></pre>
<p>Then the "subnav" will never appear (of course ) but why does the transition on the opacity not trigger? How to get the transition working?</p>
| <html><css> | 2016-08-04 16:10:11 | HQ |
38,772,717 | why this show undefined in javaScript |
<body>
<html>
<body>
<p id="demo">Click the button to change the text in this paragraph.</p>
<button onclick="myFunction()">Try it</button>
<p id="para"></p>
<script>
var len ;
function myFunction() {
len = document.getElementById("demo").value() ;
document.getElementById("demo").innerHTML = "Hello World";
document.getElementById("para").innerHTML = len ;
}
</script>
</body>
</html>
I don't understand why this is saying that the len is undefined. Please help. | <javascript> | 2016-08-04 16:25:00 | LQ_EDIT |
38,773,379 | simplest python equivalent to R's gsub | <p>Is there a simple/one-line python equivalent to R's <code>gsub</code> function?</p>
<pre><code>strings = c("Important text, !Comment that could be removed", "Other String")
gsub("(,[ ]*!.*)$", "", strings)
# [1] "Important text" "Other String"
</code></pre>
| <python><r><python-2.7> | 2016-08-04 17:01:56 | HQ |
38,773,419 | Javascript client side ssh / ping / scp | <p>I'm trying to build a web app that has the capability to scp, ssh, and ping devices on the local network from Javascript client-side. I'm very familiar with Django, but that's all server side code and won't be able to communicate with a device on the local area network. </p>
<p>Is there any way to do this in Javascript? I know that packages like <a href="https://github.com/spmjs/node-scp2" rel="nofollow">scp2</a> in NodeJS do exactly what I want, but NodeJS is a server-side framework too. I'm looking for something that does what scp2 does, but client-side. </p>
| <javascript><node.js><django><client-side><scp> | 2016-08-04 17:03:35 | LQ_CLOSE |
38,773,682 | Write a program to read m and n from keyboard and list all possible combinations to get the score m-n | i am new on stack overflow
This task is from my lab assignment and i am lost i cant find algorithm please help me out .
Thanks
Consider the final score of a football match is m-n where m and n are non-negative integers.
Write a c++ program to read m and n from keyboard and list all possible combinations to get the score m-n.
Example outputs:
input m : 1
input n : 0
Possible combinations:
0-0, 1-0
input m : 4
input n : 0
Possible combinations:
0-0, 1-0, 2-0, 3-0, 4-0
input m : 1
input n : 1
Possible combinations:
0-0, 1-0, 1-1
0-0, 0-1, 1-1
input m : 2
input n : 1
Possible combinations:
0-0, 1-0, 2-0, 2-1
0-0, 1-0, 1-1, 2-1
0-0, 0-1, 1-1, 2-1
input m : 2
input n : 2
Possible combinations:
0-0, 1-0, 1-1, 2-1, 2-2
0-0, 1-0, 1-1, 1-2, 2-2
0-0, 1-0, 2-0, 2-1, 2-2
0-0, 0-1, 1-1, 1-2, 2-2
0-0, 0-1, 1-1, 2-1, 2-2
0-0, 0-1, 0-2, 1-2, 2-2
this is the code that i have tried when user enters m=2 and n=1 this code prints only two combinations like
0-0, 1-0, 2-0, 2-1
0-0, 0-1, 1-1, 2-1
{
int m, n;
cout<<"Enter the finals scores of both teams";
cout<<"\nenter the score for team m :";
cin>>m;
cout<<"Enter the score for team n :";
cin>>n;
if (m < 0 && n < 0){
cout<<"score can't be negative";
cout<<"\nenter the score for team m :";
cin>>m;
cout<<"Enter the score for team n :";
cin>>n;
}
else{
int k=0;
if (n==0){
for (int j = 0; j <= m; j++){
for (k; k <= n; k+=1){
cout<<j<<"-"<<k<<",\t";
}
k--;
}
}
else if(m==1 && n==1){
int i=0;
int k=0;
for (int j = 0; j <= m; j++){
for (k; k <= n; k+=1){
cout<<j<<"-"<<k<<",\t";
}
k--;
}
cout<<endl<<endl;
for (int j = 0; j <= n; j++){
for (i; i <= m; i+=1){
cout<<i<<"-"<<j<<",\t";
}
i--;
}
}
else {
int i=0;
int k=0;
for (int j = 0; j <= m; j++){
for (k; k <= n; k+=1){
cout<<j<<"-"<<k<<",\t";
}
k--;
}
cout<<endl<<endl;
for (int j = 0; j <= n; j++){
for (i; i <= m; i++){
cout<<i<<"-"<<j<<",\t";
}
i--;
}
}
}
} | <java> | 2016-08-04 17:18:28 | LQ_EDIT |
38,773,975 | How to replace one substring with different substrings in R? | <p>I have a vector of strings and I want to replace one common substring in all the strings with different substrings. I'm doing this in R. For example:</p>
<pre><code>input=c("I like fruits","I like you","I like dudes")
# I need to do something like this
newStrings=c("You","We","She")
gsub("I",newStrings,input)
</code></pre>
<p>so that the output should look like:</p>
<pre><code>"You like fruits"
"We like you"
"She like dudes"
</code></pre>
<p>However, gsub uses only the first string in newStrings. Any suggestions?
Thanks</p>
| <r> | 2016-08-04 17:37:10 | HQ |
38,774,555 | Dinamic memory leak c++ | bool CPythonNonPlayer::LoadNonPlayerData(const char *c_szFileName)
{
DWORD dwElements;
TMobTable *pTable = (TMobTable *) zObj.GetBuffer();
for(DWORD i = 0; i < dwElements; ++i, ++pTable)
{
TMobTable *pNonPlayerData = new TMobTable;
memcpy(pNonPlayerData, pTable, sizeof(TMobTable));
m_NonPlayerDataMap.insert(TNonPlayerDataMap::value_type(pNonPlayerData->dwVnum, pNonPlayerData));
}
return true;
}
My questtion what i do wrong? This leak me memory so much. After each call of this function application usage increase with 10MB. Sorry if is not enought information just reply and i add more. | <c++><memory-leaks> | 2016-08-04 18:13:04 | LQ_EDIT |
38,775,382 | solution to invoking virtual method on a null object reference | <p><strong>Main Activity</strong>
These are the codes</p>
<pre><code>import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class FunfactMainActivity extends AppCompatActivity {
// Declare our view variables
private TextView mFactTextView;
private Button mShowFactButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_funfact_main);
//Assign the views from the layout file to the corresponding variables
mFactTextView= (TextView) findViewById(R.id.factTextView);
mShowFactButton= (Button) findViewById(R.id.showFactButton);
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View view) {
// The button was clicked, so update the fact TextView with a new fact
String fact = "Ostriches can run faster than horses";
mFactTextView.setText(fact);
}
};
mShowFactButton.setOnClickListener(listener);
}
}
</code></pre>
<p><strong>main.xml</strong>
These are the codes</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.oluwatomisinekpek.funfacts.FunfactMainActivity"
android:background="@android:color/holo_green_dark">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Did you know?"
android:id="@+id/textView2"
android:textSize="20sp"
android:textColor="#80ffffff" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Ants stretch when they wake up in the morning."
android:id="@+id/textView"
android:layout_below="@+id/textView2"
android:layout_centerHorizontal="true"
android:layout_marginTop="150dp"
android:textSize="24sp"
android:textColor="@android:color/white" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Next Fun Fact"
android:id="@+id/Funfactbutton"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@android:color/white" />
</RelativeLayout>
</code></pre>
<p><strong>Logcat</strong></p>
<p>These are the error reports</p>
<pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.Button.setOnClickListener(android.view.View$OnClickListener)' on a null object reference
</code></pre>
<p>I am a new beginner of android development. So far, i know the basics and learning how to debug an app. I found the crash, but do not know how to go about it.</p>
| <java><android><xml><android-layout> | 2016-08-04 19:00:36 | LQ_CLOSE |
38,777,131 | Replace n/a with NA for ALL columns postgreSQL | how do I update *ALL* columns of a table in psql? rather than doing them one column at a time.
Table1
Field1 | Field 2 | Field 3
123 | 987 | n/a
456 | n/a | 101
n/a | abcdef | n/a
So the output should be:
Table1
Field1 | Field 2 | Field 3
123 | 987 | NA
456 | NA | 101
NA | abcdef | NA
Note: Please give a psql query. | <sql><postgresql><sql-update><dynamic-sql><psql> | 2016-08-04 20:46:37 | LQ_EDIT |
38,777,337 | ggplot ribbon cut off at y limits | <p>I want to use geom_ribbon in ggplot2 to draw shaded confidence ranges. But if one of the lines goes outside the set y limits, the ribbon is cut off without extending to the edge of the plot.</p>
<p>Minimal example</p>
<pre><code>x <- 0:100
y1 <- 10+x
y2 <- 50-x
ggplot() + theme_bw() +
scale_x_continuous(name = "x", limits = c(0,100)) +
scale_y_continuous(name = "y", limits = c(-20,100)) +
geom_ribbon(aes(x=x, ymin=y2-20, ymax=y2+20), alpha=0.2, fill="#009292") +
geom_line(aes(x=x , y=y1)) +
geom_line(aes(x=x , y=y2))
</code></pre>
<p><a href="https://i.stack.imgur.com/94iNd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/94iNd.png" alt="enter image description here"></a></p>
<p>What I want is to reproduce the same behaviour as I get with plotting in base R, where the shading extends to the edge</p>
<pre><code>plot(x, y1, type="l", xlim=c(0,100),ylim=c(-20,100))
lines(x,y2)
polygon(c(x,rev(x)), c(y2-20,rev(y2+20)), col="#00929233", border=NA)
</code></pre>
<p><a href="https://i.stack.imgur.com/bmAd4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bmAd4.png" alt="enter image description here"></a></p>
| <r><ggplot2> | 2016-08-04 21:00:25 | HQ |
38,777,498 | How to run non-angular tests in protractor using safari browser? | <p><a href="http://i.stack.imgur.com/OKc7T.png" rel="nofollow">enter image description here</a></p>
<p>This is my console. please let me know the required changes i need to make</p>
| <safari><automation><protractor> | 2016-08-04 21:12:58 | LQ_CLOSE |
38,777,701 | ISO C++ forbids forward references to 'enum' types | <p>Given the program:</p>
<pre><code>enum E : int
{
A, B, C
};
</code></pre>
<p><code>g++ -c test.cpp</code> works just fine. However, <code>clang++ -c test.cpp</code> gives the following errors:</p>
<pre><code>test.cpp:1:6: error: ISO C++ forbids forward references to 'enum' types
enum E : int
^
test.cpp:1:8: error: expected unqualified-id
enum E : int
^
2 errors generated.
</code></pre>
<p>These error messages don't make any sense to me. I don't see any forward references here.</p>
| <c++><clang> | 2016-08-04 21:29:39 | HQ |
38,777,818 | How do I properly create custom text codecs? | <p>I'm digging through some old binaries that contain (among other things) text. Their text frequently uses custom character encodings for Reasons, and I want to be able to read and rewrite them.</p>
<p>It seems to me that the appropriate way to do this is to create a custom codec using the <a href="https://docs.python.org/3.5/library/codecs.html" rel="noreferrer">standard codecs library</a>. Unfortunately its documentation is both colossal and entirely bereft of examples. Google turns up a few, but only for python2, and I'm using 3.</p>
<p>I'm looking for a minimal example of how to use the codecs library to implement a custom character encoding.</p>
| <python><python-3.x> | 2016-08-04 21:38:42 | HQ |
38,779,593 | C# Recursion to get parent value and children value and all its children's children value | Need help with the following question. I was tested on this and failed and really want to know the answer so that I can study it....
Assume an list (C#) of objects in pyramid structure with the following properties:
• id
• name
• value
• parentid
Example (C#):
var b = new block();<br>
b.id = 100;<br>
b.name = "block 100"<br>
b.value = 102.50;<br>
b.parentid = 99;
Write a recursive function that accepts an ID as the only parameter and will loop through an array or list of an undetermined size and number of levels. The recursive function will calculate
------------------------------
block block1 = new block(1, null, "block 1", 11.34M);
block block11 = new block(11, 1, "block 11", 234.34M);
block block111 = new block(111, 11, "block 111", 111);
block block12 = new block(12, 1, "block 12", 564);
block block13 = new block (13, 1, "block 13", 342.23M);
block block131 = new block(131, 13, "block 131", 945);
block block132 = new block(132, 13, "block 132", 10M);
block block133 = new block(133, 13, "block 133", 88M);
block block1331 = new block(1331, 133, "block 1331", 45);
block block2 = new block(2, null, "block 2", 234);
block block3 = new block(3, null, "block 3", 1249.34M);
blocks = new List<block>();
blocks.Add(block1);
blocks.Add(block11);
blocks.Add(block111);
blocks.Add(block12);
blocks.Add(block13);
blocks.Add(block131);
blocks.Add(block132);
blocks.Add(block133);
blocks.Add(block2);
blocks.Add(block3);
decimal sum = SumAll(1);
Console.WriteLine(sum);
Console.ReadKey();
}
---------------
I need a function that gives me a total "value" from the "value" property for the parent and all of its children and its children's children. Can anyone help? | <c#><recursion> | 2016-08-05 00:58:21 | LQ_EDIT |
38,779,755 | How do i create asp.net code for Password Strength? | I am looking to implement a password strength feature for my textbox in my asp.net website.
Currently, my aspx code looks like this :
<span id="password_strength"></span>
<script type="text/javascript">
function CheckPasswordStrength(password) {
var password_strength = document.getElementById("password_strength");
//if textBox is empty
if(password.length==0){
password_strength.innerHTML = "";
return;
}
//Regular Expressions
var regex = new Array();
regex.push("[A-Z]"); //For Uppercase Alphabet
regex.push("[a-z]"); //For Lowercase Alphabet
regex.push("[0-9]"); //For Numeric Digits
regex.push("[$@$!%*#?&]"); //For Special Characters
var passed = 0;
//Validation for each Regular Expression
for (var i = 0; i < regex.length; i++) {
if(new RegExp (regex[i]).test(password){
passed++;
}
}
//Validation for Length of Password
if(passed > 2 && password.length > 8){
passed++;
}
//Display of Status
var color = "";
var passwordStrength = "";
switch(passed){
case 0:
case 1:
passwordStrength = "Password is Weak.";
color = "Red";
break;
case 2:
passwordStrength = "Password is Good.";
color = "darkorange";
break;
case 3:
case 4:
passwordStrength = "Password is Strong.";
color = "Green";
break;
case 5:
passwordStrength = "Password is Very Strong.";
color = "darkgreen";
break;
}
password_strength.innerHTML = passwordStrength;
password_strength.style.color = color;
}
</script>
<div class="row">
<div class="col-sm-6">
<center><asp:label runat="server" text="Password :" Font-Bold="True" Font-Italic="False"></asp:label></center>
<center><asp:TextBox ID="tbPassword" runat="server" onkeyup="CheckPasswordStrength(this.value)"></asp:TextBox></center>
</div>
</div>
Had got this code online... But had tried it on my website and it does not work.
Would really appreciate if somebody can help me with my code.
Thank You. :)
| <javascript><jquery> | 2016-08-05 01:26:16 | LQ_EDIT |
38,780,052 | what is the node.js equivalent of this tsql query | The legacy system used to store passwords in query's output format,
I have to take that encrypted password and create a node function to get the same result as the below query
where the password is test and mysalt is the salt used.
select HASHBYTES('SHA1', convert(VARCHAR, HASHBYTES('SHA1', CONVERT(NVARCHAR(4000), ’test'))) + 'mysalt')
| <sql-server><node.js><string><tsql><sha1> | 2016-08-05 02:08:32 | LQ_EDIT |
38,780,436 | How to switch layouts in Angular2 | <p>What is the best practices way of using two entirely different layouts in the same Angular2 application? For example in my /login route I want to have a very simple box horizontally and vertically centered, for every other route I want my full template with header, content and footer.</p>
| <angular><angular2-routing> | 2016-08-05 03:03:31 | HQ |
38,780,463 | how to convert Byte[] to byte[] | <p>I have a problem: I use byte[] to store data, but I have to connect several byte[] togather, I know Arrays.addAll(Arrays.asList(Byte[])) will do the thing, but how to convert byte[] to Byte[], and how to revert Byte[] to byte[]?</p>
| <java><arrays> | 2016-08-05 03:07:07 | LQ_CLOSE |
38,780,567 | How to create a P2P network without a server? | <p>First I'd like to share a little of WHY I want to create this which seems to be complex:</p>
<p>I've seen that in my city there's a lot of trouble with "lost pets". Since I lost my best companion for 11 years (My dog) I want to contribute my small city by developing a mobile application to allow people upload pictures to a public FTP server (Which I can find for free with a huge amount of storage) and then, create a file format such as JSON o XML and share data information such as: Pet name, location, characteristics, details of how it got lost, special details, picture URLs to show them in the application.</p>
<p>I can contribute with this but I cannot spend time by asking for donations to raise a server nor to maintain it. What I want is to create a simple Peer-To-Peer application to keep updating and sharing XML/JSON files so actually the application would never die and will be 0 server dependent. I have read a lot about P2P programming and that it's the most complex task to do but I really want to do this because I haven't found my best friend and I think this would be really helpful for others (The application is destined to be used just in my city).</p>
<p>What can I use to practice? Are the open source mobile P2P projects to read?</p>
| <mobile><p2p> | 2016-08-05 03:21:58 | LQ_CLOSE |
38,781,089 | "font-family: monospace, monospace" | <p>I'm just curious, in <code>normalize.css</code>, the monospace font rules contain</p>
<pre><code>font-family: monospace, monospace;
</code></pre>
<p>Is there a difference to</p>
<pre><code>font-family: monospace;
</code></pre>
<p>? There must be a reason for using that. Maybe it's a workaround for the behaviour of some browsers?</p>
| <css><monospace><normalize-css> | 2016-08-05 04:24:16 | HQ |
38,781,104 | How to create disabled state of the font awesome icons? | <p>I am using font awesome icons and I need to have a disabled state of the icons. is there any way to do this. I am also using bootstrap. </p>
<p>This is how I am using icons.</p>
<pre><code><i class="fa fa-slack"><i/>
</code></pre>
<p>I just need the icon to look like grayed out.</p>
| <twitter-bootstrap-3><font-awesome> | 2016-08-05 04:25:57 | HQ |
38,781,123 | core java concept, method overloading programme | package arunjava;
public class sample3
{
public static void main(String[] args)
{
Box25 b1=new Box25();
Box25 b2=new Box25();
b1.Dimension(25, 32, 65);
b2.Dimension(25, 45, 62);
System.out.println("volume is"+b1.volume());
System.out.println("volume is"+b2.volume());
b1.Dimension(4, 6, 8);
b2.Dimension(6, 8, 4);
System.out.println("volume is"+b1.vol());
System.out.println("volume is"+b2.vol());
}
}
class Box25
{
double height,width,depth;
int height1,width1,depth1;
public void Dimension(double height, double width, double depth)
{
this.height=height;
this.width=width;
this.depth=depth;
}
public void Dimension(int height1, int width1, int depth1)
{
this.height1=height1;
this.width1=width1;
this.depth1=depth1;
}
double volume()
{
return height*depth*width;
}
int vol()
{
return height1*depth1*width1;
}
}
Hey guys I had created the following programme in my java tutorial. The problem is that i am not able to compute the volume of the box which has the double datatype.
The programme result shows the following:
volume is0.0
volume is0.0
volume is192
volume is192
Secondly i have a doubt in the java concept Method overloading, as i know that in method overloading we can use the same method name with different parameters but as i created the volume method, i had to modify the name of the methods(volume,vol) so as to overload the volume method and get the answer. why is it like that
Eagerly waiting for your reply guys as i am just new to the java programming language. i would a;so request you to paste the corrected code while answering. | <java><methods><int><double><overloading> | 2016-08-05 04:27:32 | LQ_EDIT |
38,781,143 | How to create a data grid with sortable header and a scroll bar in GWT? | <p>I want to create a data grid in GWT. It should have some features like, </p>
<ul>
<li>sortable headers</li>
<li>automatic scroll bar </li>
<li>custom styling for selected row in the grid.</li>
<li>custom styling for selected cell in the grid.</li>
</ul>
| <gwt><datagrid> | 2016-08-05 04:29:29 | LQ_CLOSE |
38,781,166 | found syntax error near ')' SQL server | when I run this query don't know why this show error "Incorrect syntax near ')'."
Thank you for help
select Sum(DateDiff(s,Toc1.OutTime, (Select Top 1 Intime From tblTokenLogs
Where TokenId = Toc1.TokenId And LogId != Toc1.LogId And LogId > Toc1.LogId)))
as Sec From tblTokenLogs As Toc1 Where Toc1.TokenId = 1 And Toc1.OutTime != '') as SecTotal | <sql-server> | 2016-08-05 04:31:50 | LQ_EDIT |
38,782,111 | Explain why it is important to make mutable data members of a Java class private | Explain why it is important to make mutable data members of a Java class private. What consequences does this have, and how do we commonly get around them?
Appreciate any help. Have been googling around but i've only came across answers that say how to create an immutable class etc. | <java><mutable> | 2016-08-05 05:59:42 | LQ_EDIT |
38,782,181 | Read and Write file using vs code extension | <p>i am building an extension to parse json using vs code extension.
so my need is ,it should be able able to load .json file from a particular folder and iterate through content of the file.
Then it should allow user to select few keys from it make a new json file out of this and save it in any folder.</p>
<p>But i am not able to find any way to read and write files in "vs code extension".Could someone please help me.</p>
| <json><visual-studio-code><vscode-extensions> | 2016-08-05 06:04:36 | HQ |
38,782,663 | Texas Holdem odds evaluating package for Python | <p>I write my master thesis on "Estimation of poker skills value in late tournament phase". I encountered a problem because i can not find python package which would evaluate hand odds versus each other.</p>
<p>What is satisfying for my is simply function:
odds(AsAc, KsKc) which would return [% that AsAc wins, % that KsKc wins]</p>
<p>I tried package PokerSleuth but it does not work on my pc.
(<a href="http://www.barsoom.org/scriptable-equity-calculator" rel="nofollow">http://www.barsoom.org/scriptable-equity-calculator</a> - maybe it works for You)</p>
<p>Do You happen to know any python holdem package with function of odds estimation or do You posses a table with all hands vs all hands odds value?</p>
<p>Thanks in advance!</p>
| <python><simulation> | 2016-08-05 06:36:29 | LQ_CLOSE |
38,782,716 | Split the string an get the text | <p>I am having a text as below </p>
<pre><code>*~*****|****|**|*|***|***|****|**|null|null|**|***|***|null|71713470|STMS#******
</code></pre>
<p>using java i need to get the number 71713470 and STMS values from that string. I have tried all the string methods but invain. Could anyone help on this</p>
| <java> | 2016-08-05 06:39:26 | LQ_CLOSE |
38,782,853 | how to develop a wordpress plugin to fetch the posts from the parameters given at home page and parse it as json, like JSON API Plugin | I am trying to develop a small wordpress plugin to fetch the posts, pages from the website and parse it as json to further use in mobile apps.
Right now i am achiving the goal via this method:
1) Created a file webservice.php on my current active theme eg. twentythirteen. So the location of the file is http://www.example.com/wp-content/themes/twentythirteen/webservice.php
2) I am posting the parameters on that url to get a json response like this
http://www.example.com/wp-content/themes/twentythirteen/webservice.php?type=page&limit=10
The thing is i want to post parameters on the home page like this
http://www.example.com?type=page&limit=10
i dont know how to do it i have seen 'JSON API' Plugin which is doing the same thing but not able to find on its code how its fething the request from home page and parse JSON on the same page. Can any one help me with this
| <php><wordpress><mobile-application><json-api><jsonresponse> | 2016-08-05 06:47:35 | LQ_EDIT |
38,783,212 | unity + php + database data output issue | guys~! [enter image description here][1]
In the picture, the log is print pretty!
but, in unity the output is wrong.
How can I solve it?
[1]: http://i.stack.imgur.com/WuPhx.png
and this is my source
private void Awake()
{
info = new Dictionary<string, string>();
}
private IEnumerator Start()
{
WWW dash = new WWW("http://localhost/test.php");
yield return dash;
string[] Separators = new string[] { "\n" };
string[] lines = dash.text.Split(Separators, System.StringSplitOptions.RemoveEmptyEntries);
info.Clear();
for(int i=0; i<lines.Length; i++)
{
GameObject tmp = Instantiate(scorepre);
string[] parts = lines[i].Split(',');
string Name = parts[1];
string Detail = parts[2];
info.Add(Name, Detail);
Debug.Log(Name + " - " + Detail);
named.GetComponent<Text>().text = Name;
detailed.GetComponent<Text>().text = Detail;
tmp.transform.SetParent(infoParent);
} | <php><mysql><unity3d> | 2016-08-05 07:08:05 | LQ_EDIT |
38,783,459 | Repeated Errors Despite Correct Namespace [C++] | I added a class to ns3 and when using it I keep getting the error:
../scratch/seven.cc: In function ‘int main(int, char**)’:
../scratch/seven.cc:102:3: error: ‘RandomAppHelper’ was not declared in this scope
RandomAppHelper source = RandomAppHelper ("ns3::TcpSocketFactory", InetSocketAddress (Ipv4Address ("192.168.1.10"), 10));
^
../scratch/seven.cc:103:3: error: ‘source’ was not declared in this scope
source.SetAttribute ("Delay", StringValue ("Constant:2.5"));
^
The code for this is here: **https://www.nsnam.org/docs/release/3.3/doxygen/application.html**
I can't resolve the error. I used the correct namespace ns3 in the code. Since the error is of "not declared in scope", I am not sure how to rectify it.
Please help.
| <c++><error-handling><compiler-errors><ns-3> | 2016-08-05 07:22:46 | LQ_EDIT |
38,783,498 | plz help me in finding the error in this query | tell me whether the query is correct or contains any error
select cname from company where id IN (select company_id,count(*) from medication group by(company_id) having count(*)>1) order by cname; | <mysql> | 2016-08-05 07:25:27 | LQ_EDIT |
38,783,773 | Spring boot single page application - forward every request to index.html | <p>I have a Spring Boot (v1.3.6) single page application (angular2) and i want to forward all request to the <code>index.html</code>.</p>
<p>A request to <a href="http://localhost:8080/index.html" rel="noreferrer">http://localhost:8080/index.html</a> is working (200 and i get the index.html) but <a href="http://localhost:8080/home" rel="noreferrer">http://localhost:8080/home</a> is not (404).</p>
<p>Runner.class</p>
<pre><code>@SpringBootApplication
@ComponentScan({"packagea.packageb"})
@EnableAutoConfiguration
public class Runner {
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext run = SpringApplication.run(Runner.class, args);
}
}
</code></pre>
<p>WebAppConfig.class</p>
<pre><code>@Configuration
@EnableScheduling
@EnableAsync
public class WebAppConfig extends WebMvcConfigurationSupport {
private static final int CACHE_PERIOD_ONE_YEAR = 31536000;
private static final int CACHE_PERIOD_NO_CACHE = 0;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.setOrder(-1);
registry.addResourceHandler("/styles.css").addResourceLocations("/styles.css").setCachePeriod(CACHE_PERIOD_ONE_YEAR);
registry.addResourceHandler("/app/third-party/**").addResourceLocations("/node_modules/").setCachePeriod(CACHE_PERIOD_ONE_YEAR);
registry.addResourceHandler("/app/**").addResourceLocations("/app/").setCachePeriod(CACHE_PERIOD_NO_CACHE);
registry.addResourceHandler("/systemjs.config.js").addResourceLocations("/systemjs.config.js").setCachePeriod(CACHE_PERIOD_NO_CACHE);
registry.addResourceHandler("/**").addResourceLocations("/index.html").setCachePeriod(CACHE_PERIOD_NO_CACHE);
}
}
</code></pre>
<p><code>styles.css</code>, <code>/app/third-party/xyz/xyz.js</code>,.. are working (200 and i get the correct file). Only <code>/**</code> to <code>index.html</code> is not working.</p>
| <spring><spring-mvc><spring-boot> | 2016-08-05 07:41:26 | HQ |
38,783,995 | Msg 195, Level 15, State 10, Line 2 'CONCAT' is not a recognized built-in function name | SELECT
CONCAT(CCYYMM,RIGHT(C.AMT001,2)) ACCDAT
,CSTCOD
,PRPCOD
,C.RevenueAmount
,D.RevenueAllowance
,OUTLET
,AMTYTD
,ALWYTD
,MODCOD
,RECTYP
,RECCOD
,GRPCOD
,DEPCOD
,[CSTCTR]
,[GLCODE]
FROM PMS.FMNASTBL
CROSS APPLY
(
VALUES
('AMT001',AMT001 )
) c (AMT001,RevenueAmount)
CROSS APPLY
(
VALUES
('ALW001',ALW001 )
) D (ALW001,RevenueAllowance) | <sql><sql-server> | 2016-08-05 07:53:14 | LQ_EDIT |
38,784,263 | Schow javascript associative array in html table using HTML | I need to print out the results of a sort on an associative array in javascript in a HTML table not using PHP or those things.
The sorting works fine as I can see that in the console but it doesn't show the table. Here is the source as far as I have it now:
<!DOCTYPE html>
<html>
<body>
<button onclick="sortarray('name')">Sort by Name</button>
<button onclick="sortarray('year')">Sort by Year</button>
<p id="demo">test</p>
<script>
var array = [
{
name: 'TK345',
year: 2011,
custom: 456,
colour: 'red'
},
{
name: 'ZJ456',
year: 2001,
custom: 96,
colour: 'black'
},
{
name: 'AW364',
year: 1985,
custom: 001,
colour: 'cyan'
},
{
name: 'RT112',
year: 2012,
custom: 33,
colour: 'green'
},
{
name: 'PO445',
year: 2012,
custom: 11,
colour: 'yellow'
}
];
function sortarray(sorter) {
if (array.length < 1) {
return -1;
}
if(sorter == "name"){
var byName = array.slice(0);
var tableout = document.createElement('table');
byName.sort(function(a,b) {
var x = a.name.toLowerCase();
var y = b.name.toLowerCase();
return x < y ? -1 : x > y ? 1 : 0;
tableout.setAttribute('border','1');
tableout.setAttribute('width','100%')
var row = tableout.insertRow(0);
for(j=1; j<=5; j++){
row = tableout.insertRow(j-1);
for (i=1; i<=4; i++)
var text = document.createTextNode(byName);
var cell = row.insertCell(i-1);
cell.setAttribute('align','center')
cell.appendChild(text);
}
})
document.getElementById("demo").appendChild(tableout);
console.log(byName);
}
else if(sorter == "year"){
var byDate = array.slice(0);
var tableout = document.createElement('table');
byDate.sort(function(a,b) {
return a.year - b.year;
tableout.setAttribute('border','1');
tableout.setAttribute('width','100%')
var row = tableout.insertRow(0);
for(j=1; j<=5; j++){
row = tableout.insertRow(j-1);
for (i=1; i<=4; i++)
var text = document.createTextNode(byDate);
var cell = row.insertCell(i-1);
cell.setAttribute('align','center')
cell.appendChild(text);
}
})
document.getElementById("demo").appendChild(tableout);
console.log(byDate);
}
else {};
};
</script>
</body>
</html>
So it doesn't show me anything of that table on the page or in the console.
Any ideas?
Thanks in advance.
TheVagabond | <javascript><html><arrays><html-table> | 2016-08-05 08:07:02 | LQ_EDIT |
38,784,536 | vba - section of indices of empty cells in a row | In a *first step*, I am trying to identify the **indices** of the **empty cells** in a **row** in an excel workbook. In a *second step*, I want to use these indices to delete certain **columns** in **another** excel workbook. How can one do so?
Here I found some related info http://stackoverflow.com/questions/7876340/deleting-empty-rows-in-excel-using-vba
Why I want to do this:
I am importing worksheets from closed excel workbooks into an open workbook. When doing so, I only import the data and not the column names (because these are messy and not appropriate for importing later on in R: defined by three rows and some of these cells their rows are merged).
The problem is that there are empty columns inserted between parts of the data in the closed excel workbooks. I cannot simply delete the columns with no values afterwards, because it can well be that there are columns with no values but that had a column label in the original workbook. | <excel><vba> | 2016-08-05 08:21:58 | LQ_EDIT |
38,785,114 | How to create quintile of variable in R | <p>Is it possible to bin a variable in to quintile (1/5th) using R. And select only the variables that fall in the 5th bin.</p>
<ul>
<li>As of now I am using the closest option which is quartile (.75) as there is not a function to do quintile. </li>
</ul>
<p>Any suggestions please. </p>
| <r><stat> | 2016-08-05 08:52:16 | LQ_CLOSE |
38,785,438 | Remove elements before they are added to the DOM | <p>A series of <code>.cell</code> elements are created on <code>document</code> load.
They are only useful if also an <strong><code>img</code></strong> is added within them.
I need to keep them from being created because they are linked to the creation of other <code>li</code> elements.</p>
<p>Thank you.</p>
<p>Source Code:</p>
<pre><code><div class="main-container">
<div class="parent-container">
<div class="cell"> !always added
<div class="container"> !always added
<div class="screen"></div> !always added
<img> **!If added**
</div>
</div>
</div>
<li>Created even if not needed</li>
</div>
</code></pre>
| <jquery><dom> | 2016-08-05 09:07:32 | LQ_CLOSE |
38,785,926 | how to disable jenkins pipeline job | <p>I am using pipeline jobs with Jenkins 2.0, but I don't see option 'disable job' as I was used to in older Jenkins versions. Am I missing something? Is it still possible to disable (pipeline) job? </p>
| <jenkins><jenkins-pipeline> | 2016-08-05 09:31:04 | HQ |
38,785,991 | Docker deamon config path under mac os | <p>I am using docker in Version 1.12.0 (build 10871) on Mac OS (El Capitan 10.11.4) and I want to provide a config file for the docker daemon.</p>
<p>Under Ubuntu you place the config under <code>/etc/default/docker</code> (see <a href="https://docs.docker.com/engine/admin/#/configuring-docker" rel="noreferrer">docs</a>). Unfortunately, I cannot figure out where to place the config in Mac OS</p>
<p>Any ideas?</p>
| <macos><docker><config><daemon> | 2016-08-05 09:34:22 | HQ |
38,785,996 | Date and Time Formatting error | <p><strong>I'm having the date "2016-08-05 14:46:53 +05:30" and the
date and time format which i have used is "yyyy-MM-DD HH:mm:ss +05:30"</strong>
the problem is that when i'm parsing this date i get the output <strong>"Tue Jan 05 14:46:53 GMT+05:30 2016"</strong> i don't get what is the problem.
The code which i'm using is posted below.</p>
<pre><code>public class DateFormater {
private static String DATE_TIME_FORMAT = "yyyy-MM-DD HH:mm:ss +05:30";
private static String TAG = DateFormater.class.getSimpleName();
public static Date getDate(String s) {
//Input s = 2016-08-05 14:46:53 +05:30
Date date = null;
try {
SimpleDateFormat dateFormat=new SimpleDateFormat(DATE_TIME_FORMAT);
date=dateFormat.parse(s);
} catch (ParseException e) {
e.printStackTrace();
}
return date;
}
public static String getCurrentDateString(Date date) {
DateFormat dateFormat=SimpleDateFormat.getDateInstance(DateFormat.MEDIUM);
Log.i(TAG, "getCurrentDateString: "+dateFormat.format(date));
return dateFormat.format(date);
}
public static String getCurrentTimeString(Date date) {
DateFormat dateFormat=SimpleDateFormat.getTimeInstance(DateFormat.SHORT);
return dateFormat.format(date);//Tue Jan 05 14:46:53 GMT+05:30 2016
}}
</code></pre>
| <java><date><simpledateformat> | 2016-08-05 09:34:37 | LQ_CLOSE |
38,786,057 | Pyhton: Want to get the mouse coordinate in a while loop | I would like to get the mouse click coordinate for several images. This is my code:
j = 0
while j < nb_images:
plt.ion()
fig = plt.figure()
coords = []
#Affichage
plt.imshow(img[j], cmap="gray")
plt.draw()
while len(coords) <1:
cid = fig.canvas.mpl_connect('button_press_event', onclick)
print(coords[0][0], coords[0][1])
j = j + 1
def onclick(event):
global ix, iy
ix, iy = event.xdata, event.ydata
global coords
coords.append((ix, iy))
if len(coords) == 1:
fig.canvas.mpl_disconnect(cid)
plt.close()
return coords
The problem is that I cannot click on the figure to get the coordinate. The figure is busy. How I can fix it?
Thank you | <python><matplotlib><click><mouse><coordinate> | 2016-08-05 09:37:42 | LQ_EDIT |
38,786,126 | Unique key generate with digit and letters in php | <p>I need to generate unique key in php. </p>
<p>The key must be min 8 digit and 4 letters contain. </p>
<p>So any one have idea ?</p>
<p>Thanks you</p>
| <php> | 2016-08-05 09:41:47 | LQ_CLOSE |
38,787,018 | License status check failure on downladoing android sdk tools from Delphi Seattle | I am getting started with ANdroid developement on Delphi seattle.
By following some tutorials i realized that a quick way to setup the android sdk is to create a new multi device app, set android as target platform and build.
At this moment the ide asks
> Android SDK tools are required. Do you want to download and install
> Android SDK tools automatically?
on yes a downlaod process starts, after a license confirmation page i get:
[![android error][1]][1]
Does anyone know how to fix this?
[1]: http://i.stack.imgur.com/EZfHX.png | <delphi><android-sdk-2.3><delphi-10-seattle> | 2016-08-05 10:29:03 | LQ_EDIT |
38,787,267 | How to open modal ? | <p>I have a link in the top menu to add a new event.
When I am on the events list page, this link open a modal with the new event form.
Howether if I am on an other page, I would like this link (in the top menu) to redirect on this events list page with the modal new event form open.</p>
<p>Is it possible ?</p>
<p>Thanks for your help</p>
| <jquery><twitter-bootstrap><symfony> | 2016-08-05 10:42:09 | LQ_CLOSE |
38,787,437 | Different width for each columns in jspdf autotable? | <p>My table has 13 columns. How can I get different width for each column? Can I give each column width like this? </p>
<p><strong>styles: {overflow: 'linebreak' ,columnWidth: [100,80,80,70,80,80,70,70,70,70,60,80,100]},</strong> </p>
<p>My table Syntax:</p>
<pre><code>> var res = doc.autoTableHtmlToJson(document.getElementById(tableID));
> doc.autoTable(res.columns, res.data, { styles: {overflow: 'linebreak'
> ,columnWidth: [100,80,80,70,80,80,70,70,70,70,60,80,100]}, startY:
> 60, bodyStyles: {valign: 'top'}, });
</code></pre>
| <jspdf><jspdf-autotable> | 2016-08-05 10:50:48 | HQ |
38,788,170 | Extract complex Text pattern using SQL function | I need to extract a text pattern looking like this:
NN-NNN-NNNNNNNNN
(2digit,minus, 3digits,minus,9digits)
from along text field.
anyone has a clue?
thanks a lot! | <sql><ibm-midrange><db2-400><textpattern> | 2016-08-05 11:28:53 | LQ_EDIT |
38,788,248 | Interface vs Implementation in C++. What does this mean? | <p>I am learning the concepts of inheritance, especially about access-specifiers, here I am confused about the <code>protected</code> access specifier. The members under protected can be accessible by the base class member functions and derived class member functions. There is a chance of messing up <code>implementation</code> of base class if we declare protected as access specifier. Its always better to declare data members under <code>private</code> rather than protected as only the <code>interface</code> is exposed and not the <code>implementation</code> section. We are declaring only the variables in the private section of a class and how it becomes <code>implementation</code>? Implementation will be done in the <code>member functions</code> right? The terms are confusing, can anyone clarify and explain me the terms?</p>
| <c++><inheritance><interface><protected> | 2016-08-05 11:33:12 | LQ_CLOSE |
38,788,319 | Python Regex Search For HTML Tag with UUID | I'm trying to match a single html whole tag with an id attribute which is a UUID. I tested it with an external resource to make sure the regex is correct with the same input string. The UUID is extracted dynamically so the string replacement is necessary. The output I get when printing is the whole input string which would suggest the regex is incorrect. What's going on here?
The output I would would expect is for the last line to print:
<tr class="ref_row" id="b9060ff1-015d-4089-a193-8fef57e7c2ef">
This is the code I tried:
content = '<tbody><tr class="ref_row" id="b9060ff1-015d-4089-a193-8fef57e7c2ef"><td><b>01/08/2016 14:41:00</b></td>'
ref = 'b9060ff1-015d-4089-a193-8fef57e7c2ef'
regex = '<[^>]+?id=\"%s\"[^<]*?>' % ref
regex_comp = re.compile(regex)
element_to_link = regex_comp.search(content)
print element_to_link.string
I also tried:
element_to_link = re.search(regex, content)
Which yielded the same result.
Please don't suggest that I use Beautiful Soup, this should be possible to do with regular expressions.
Thank you for taking the time to read my question | <python><regex> | 2016-08-05 11:36:51 | LQ_EDIT |
38,788,328 | hello guys look my app i am facing weird & unexpected issue in android app | Hello guys my app is ready to install But problem faced when i install & debug app in device it's show 2 apps install in device (one open with Splashscreen & another open without Splashscreen ) plz find my error.
here is manifest file below
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.soft.prmk.alle"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:hardwareAccelerated="true"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SplashScreen"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest> | <android><android-manifest><splash-screen> | 2016-08-05 11:37:10 | LQ_EDIT |
38,788,721 | How do i stream response in express | <p>I've been trying to get a express app to send the response as stream.</p>
<pre><code>var Readable = require('stream').Readable;
var rs = Readable();
app.get('/report', function(req,res) {
res.statusCode = 200;
res.setHeader('Content-type', 'application/csv');
res.setHeader('Access-Control-Allow-Origin', '*');
// Header to force download
res.setHeader('Content-disposition', 'attachment; filename=Report.csv');
rs.pipe(res);
rs.push("USERID,NAME,FBID,ACCOUNT,SUBSCRIPTION,PRICE,STATE,TIMEPERIOD\n");
for (var i = 0; i < 10; i++) {
rs.push("23,John Doe,1234,500,SUBSCRIPITON,100,ACTIVE,30\n");
}
rs.push(null);
});
</code></pre>
<p>It does print in the console when i replace "rs.pipe(res)" by "rs.pipe(process.stdout)" but how to make it work in express app.</p>
<pre><code>Error: not implemented
at Readable._read (_stream_readable.js:465:22)
at Readable.read (_stream_readable.js:341:10)
at Readable.on (_stream_readable.js:720:14)
at Readable.pipe (_stream_readable.js:575:10)
at line "rs.pipe(res);"
</code></pre>
| <javascript><node.js><csv><express> | 2016-08-05 11:58:54 | HQ |
38,790,248 | Group By and Sum for this query in SQL SERVER | I want to group by OrderNumber, Product, ConveyanceID and Trip for this below query and sum(Volume).
How can I do that
SELECT OD.[Customer]
,OD.[OrderNumber] 'Order#'
,OD.[Shipper]
,OD.[Product]
,OD.[Dock] 'Dock/Track'
,OD.[Lines] 'Berth/Position'
,[TAMS].[fnc_GetDelayCountByOrderNumber](OD.OrderNumber) 'Delays'
,OD.[ScheduledArrival] 'Sched .Arrival'
,OD.ActiveCheckPointStatus 'Active CheckPoint'
,OD.[CheckPointStatus] 'CheckPoint Status'
,OD.[ContractNumber]
,OD.[Direction]
,OD.[Volume]
,OD.[PreviousCheckPointStatus]
,OD.[CheckPointType]
,OD.[SourceContainer]
,OD.[DestinationContainer]
,OD.[UnitsOfMeasure]
,OD.ConveyanceID
,OD.TripId
,OD.NumberOfConveyance
FROM TAMS.OrderDetail OD
WHERE OrderNumber= 8394
[![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/9w0kc.png | <sql><sql-server> | 2016-08-05 13:15:25 | LQ_EDIT |
38,790,285 | Integrate report from Reporting server 2016 via iframe in SharePoint 2013 | <p>I'm trying to integrate a Report from Reporting Server2016 into our SharePoint2013.<br>
It worked fine with Reporting Server 2012 but not anymore with the new enviroment.<p>
I've alread read a bit around and found out that the Reporting Server is sending the Report with X-Frame-Options = SAMEORIGIN in the answer header.<p>
Is there the possibility to turn that off in the Reporting server?<p>
Installing a Browser Plugin that ignores the header is not an option.</p>
| <iframe><sharepoint><reporting-services><report><embed> | 2016-08-05 13:17:31 | HQ |
38,791,685 | How do I include .dll file in executable using pyinstaller? | <p>I want to generate a single executable file from my python script.
For this I use pyinstaller. I had issues with mkl libraries because I use numpy in the script.</p>
<p>I used this <a href="https://github.com/pyinstaller/pyinstaller/issues/1881" rel="noreferrer" title="hook">hook</a> so solve the issue, it worked fine. But it does not work if I copy the single executable file to another directory and execute it. I guess I have to copy the hook also. But I just want to have one single file that I can use at other computers without copying <code>.dll's</code> or the hook.</p>
<p>I also changed the <code>.spec</code> file as described <a href="https://pythonhosted.org/PyInstaller/spec-files.html" rel="noreferrer">here</a> and added the necessary files to the <code>binaries</code>-variable. That also works as long as the <code>.dll's</code> are in the provided directory for the <code>binaries</code>-variable , but that won't work when I use the executable on a computer that doesn't have these <code>.dll's</code>.</p>
<p>I tried using the <code>--hidden-import= FILENAME</code> option. This also solves the issue, but just when the <code>.dll's</code> are provided somewhere.</p>
<p>What I'm looking for is a possibility to bundle the <code>.dll's</code> into the single executable file so that I have one file that works independently.</p>
| <python><numpy><dll><pyinstaller> | 2016-08-05 14:28:16 | HQ |
38,791,818 | Jetbrains Rider + Visual Studio WPF | <p>I'm about to have a project with C# again. As I love using Jetbrains IDE's I came along Rider. The main problem for me is that I need a Windows Forms or WPF Designer for the GUI.</p>
<p>Is there any external software available for it or does anybody knows a convenient work pipeline to use Visual Studio only for WPF/WinForms and Rider as Code IDE? </p>
| <c#><wpf><winforms><rider> | 2016-08-05 14:35:08 | HQ |
38,791,929 | Updating a colum in tableA with values from colum in table B | I'm trying to make an update of a multiple colums in table1 with values from a table that i've created
so i declare a table like this :
TYPE mon_tableau IS VARRAY (2) OF FLOAT;
v_tab mon_tableau;
i give it some values like this
v_tab := mon_tableau (10000, 20000);
then i make an sql statement that gets the values that i want to update with the two values (10000 and 20000) in my v_tab
is there a solution that it makes me do that update
i've tried a cursor in a loop
any suggestion please
thank you
| <sql><oracle><plsql> | 2016-08-05 14:40:11 | LQ_EDIT |
38,791,974 | Asynchronous api calls with redux-saga | <p>I am following <a href="http://yelouafi.github.io/redux-saga/docs/basics/UsingSagaHelpers.html" rel="noreferrer">redux-saga documentation</a> on helpers, and so far it seems pretty straight forward, however I stumbled upon an issue when it comes to performing an api call (as you will see link to the docs points to such example)</p>
<p>There is a part <code>Api.fetchUser</code> that is not explained, thus I don't quiet understand if that is something we need to handle with libraries like <a href="https://github.com/mzabriskie/axios" rel="noreferrer">axios</a> or <a href="https://github.com/visionmedia/superagent" rel="noreferrer">superagent</a>? or is that something else. And are saga effects like <code>call, put</code> etc.. equivalents of <code>get, post</code>? if so, why are they named that way? Essentially I am trying to figure out a correct way to perform a simple post call to my api at url <code>example.com/sessions</code> and pass it data like <code>{ email: 'email', password: 'password' }</code></p>
| <javascript><api><reactjs><redux><redux-saga> | 2016-08-05 14:42:25 | HQ |
38,792,233 | All Angular2's template syntax is broken when I open the page through my hashed router | <p>I have a hashed router that is routing from my main page just fine. The problem comes when a new page opens, all the template syntax is broken. That is all data bindings, ngFors, and even [routerLink]. So the pages open without the angular logic but if I refresh the browser while on these hashed pages they work just fine.</p>
<p><code>app bootstrap file</code></p>
<pre><code>import { enableProdMode } from '@angular/core';
import { disableDeprecatedForms, provideForms } from '@angular/forms';
import { HTTP_PROVIDERS } from '@angular/http';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
import { APP_ROUTER_PROVIDERS } from './path-to-the-router-file';
import { ServerGetService } from './path-to-a-service';
import { AppComponent } from './app/app.component';
// depending on the env mode, enable prod mode or add debugging modules
if (process.env.ENV === 'build') {
enableProdMode();
}
bootstrap(AppComponent, [
HTTP_PROVIDERS,
APP_ROUTER_PROVIDERS,
{
provide: LocationStrategy,
useClass: HashLocationStrategy
},
ServerGetService,
disableDeprecatedForms(),
provideForms()
]).catch((err: any) => console.error(err));
</code></pre>
<p><code>routes file</code></p>
<pre><code>import {provideRouter, RouterConfig} from '@angular/router';
import {SecondPopUpComponent} from './path-to-the-file';
import {firstPopUpComponent} from './path-to-the-file';
import {Component} from '@angular/core';
@Component({
selector: 'mx-empty',
template: '<div></div>'
})
class EmptyComponent {}
export const routes: RouterConfig =
<RouterConfig>[
{
path: 'second-popup',
component: SecondPopUpComponent
}, {
path: 'first-popup',
component: FirstPopUpComponent
}, {
path: '',
component: EmptyComponent
}
];
export const APP_ROUTER_PROVIDERS = [
provideRouter(routes)
];
</code></pre>
<p><code>one of my popup screens (with the problem)</code></p>
<pre><code>import {Component} from '@angular/core';
import {TradePurposeProperty} from './trade-purpose.objects';
import {Router, ROUTER_DIRECTIVES} from '@angular/router';
import {GlobalSettingsData} from '../../services/global-settings-data.service';
@Component({
selector: 'my-popup',
templateUrl: './popup.page.html',
directives: [ROUTER_DIRECTIVES]
})
export class TradePurposePageComponent {
localData: customData[] = [];
constructor(private router: Router, private data: GlobalData) {
if (data.myData) {
this.localData= data.myData;
}
}
onSubmit() {
this.data.myData= this.localData;
this.router.navigate(['']);
}
}
</code></pre>
<p><code>popup.page.html</code></p>
<pre><code><div class="form-popup">
<div class="form-popup__overlay"></div>
<div class="form-popup__content">
<form #dataForm="ngForm" (ngSubmit)="onSubmit()">
<fieldset>
<legend>Properties</legend>
<table>
<thead>
<tr>
<th>first column</th>
<th>secondcolumn</th>
<th>third column</th>
</tr>
</thead>
<tbody>
<tr *ngFor='let data of localData'>
<td>{{data.attr1}}</td>
<td>{{data.attr2}}</td>
<td>
<label>
<input type='checkbox' [(ngModel)]='localData.isSet' [ngModelOptions]="{standalone: true}">
</label>
</td>
</tr>
</tbody>
</table>
<div>
<button type="submit">OK</button>
<a [routerLink]="['']" >Cancel</a>
</div>
</fieldset>
</form>
</div>
</div>
</code></pre>
<p>the only thing that works in the popup file is the onSubmit(), and it even routes but the rest of the bindings do not, and when I click on the <code>cancel</code> so the <code>[routerLink]="['']"</code> should be executed, I get that error
<code>VM55939:84 ORIGINAL EXCEPTION: TypeError: Cannot read property 'startsWith' of undefined</code></p>
<p>any ideas what to do?</p>
| <angular><angular-routing><angular-template> | 2016-08-05 14:54:55 | HQ |
38,792,675 | Properly handle DrawerLayout animation while navigating through fragment | <p>I'm currently struggling with the <code>DrawerLayout</code> animation doing weird stuff; The <strong>hamburger icon</strong> is laggy and often switch from hamburger to arrow without animation if I don't put an Handler to delay the <code>fragment</code> transaction animation. </p>
<p>So I ended up putting an handler to wait until the hamburger icon perform the animation but it just doesn't feel natural that we need to wait until the drawer close to switch fragment. I'm sure there is a better way to handle this...</p>
<p><strong>Here is how I do currently:</strong></p>
<pre><code>private void selectProfilFragment() {
final BackHandledFragment fragment;
// TODO test this again
Bundle bundle = new Bundle();
bundle.putString(FragmentUserProfile.USER_FIRST_NAME, user.getFirstname());
bundle.putString(FragmentUserProfile.USER_LAST_NAME, user.getLastname());
bundle.putString(FragmentUserProfile.USER_PICTURE, user.getProfilepic());
bundle.putString(FragmentUserProfile.USER_EMAIL, user.getEmail());
bundle.putBoolean(FragmentUserProfile.USER_SECURITY, user.getParameters().getSecuritymodule().equals("YES"));
fragment = new FragmentUserProfile();
fragment.setArguments(bundle);
mDrawerLayout.closeDrawer(mDrawerLinear);
new Handler().postDelayed(new Runnable() {
public void run() {
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.setCustomAnimations(R.anim.pull_in_right, R.anim.push_out_left, R.anim.pull_in_left, R.anim.push_out_right);
ft.replace(R.id.content_frame, fragment)
.addToBackStack(fragment.getTagText())
.commitAllowingStateLoss();
}
}, 300);
}
</code></pre>
<p>It's still <em>glitching</em> a little bit in between the <code>DrawerLayout</code> closing and opening fragment transaction animation.</p>
<p><strong>Here is How I instanciate the drawer:</strong></p>
<pre><code>mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
mDrawerListChild.setAdapter(new DrawerListAdapter(this, R.layout.drawer_layout_item, mPlanTitles));
mDrawerListChild.setOnItemClickListener(new DrawerItemClickListener());
mProfilPic.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
selectProfilFragment();
}
});
mDrawerToggle = new ActionBarDrawerToggle(
this,
mDrawerLayout,
toolbar,
R.string.drawer_open,
R.string.drawer_close
) {
public void onDrawerClosed(View view) {
invalidateOptionsMenu();
}
public void onDrawerOpened(View drawerView) {
invalidateOptionsMenu();
}
};
getSupportFragmentManager().addOnBackStackChangedListener(mOnBackStackChangedListener);
mDrawerLayout.setDrawerListener(mDrawerToggle);
setSupportActionBar(toolbar);
</code></pre>
| <android><android-fragments><animation><navigation-drawer> | 2016-08-05 15:17:28 | HQ |
38,793,081 | submit and do html form string in asp mvc controler side | i have html string like this in controller
i receive this from web service (not important)
string str ="<form name='jy'action='https://' method='POST'><input type=submit value='Pay'></form>";
i should send this to view and show to user and user should click on submit and ...
but i want do this form and submit it automatically in controller side .
i mean no need to show this to user then user click on submit
it useless
how can i do this? | <c#><html><asp.net><asp.net-mvc> | 2016-08-05 15:40:46 | LQ_EDIT |
38,793,274 | Is this code efficient in PHP? | function addWeight ($arout, $lineCountry, $lineDomain, $target, $weight)
{
$currentDomain=getDomain();
$currentCountry=getCountry();
if ($currentCountry==$lineCountry && ($currentDomain == $lineDomain || $lineDomain==""))
{
$tarobreakpoint=0;
$arout [$target] = intval($weight);
}
return $arout;
}
Basically it took an array as a parameter. Depending on some circumstances it add elements to the array.
I wonder if this is efficient.
If $arout is passed by reference like all array should then I think it's efficient.
If it's just copied and passed by value then well it's not.
So what's the verdict? | <php><arrays><pass-by-reference><pass-by-value> | 2016-08-05 15:51:45 | LQ_EDIT |
38,793,582 | C# array initialization without new operator | In C#, does the following initialization create instance without usage of new operator?
Initialization:
string[] strArray = {"one","two","three"}; | <c#><initialization><new-operator> | 2016-08-05 16:07:41 | LQ_EDIT |
38,794,578 | PassWord Validation | @"^(?=.*[0-9]+.*)(?=.*[a-zA-Z]+.*)[0-9a-zA-Z]{6,}$"
Hi, I am using this regular expression for password validation, which gives one upper case, one lowercase and a number, but what I want is a special character in it but it should optional but above mentioned must be mandatory
Thanks in advance | <objective-c><regex><passwords> | 2016-08-05 17:12:14 | LQ_EDIT |
38,794,835 | How does string works in c#? | <p>I know strings are inmutable, once created we cannot change it, I've read that if we create a new string object and we assign a value to it and then we assign another value to the same string object internally there is actually another object created and assigned with the new value. Let's say I have:</p>
<pre><code>string str = "dog";
str = "cat";
</code></pre>
<p>If I write <code>Console.WriteLine(str);</code> it returns <code>cat</code>.
So internally there are two objects? But they have the same name? How does it works? I've made some research on google but I have not find yet something convincing enough to me so I can clarify my thoughts about this.
I know strings are reference types, so we have an object in the stack with a reference to a value in the heap, what's happening in this case?(see code above).</p>
<p>I've upload a picture, apologize me if I'm wrong about the idea of the stack and the heap that's why I'm asking this question.
Does the picture reflects what happens in the first line of code(<code>string str = "dog";</code>)? And then what should happen in the second line of code?? The <code>dog</code> value in the heap changes? And then a new object in the stack is created referencing it? Then what happens with the object that was there before? Do they have the same name?
I'm sorry for so many questions but I think that is very important to understand this correctly and to know what's happening behind the scenes...<a href="https://i.stack.imgur.com/3laO8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3laO8.png" alt="enter image description here"></a></p>
| <c#><string><heap-memory><stack-memory> | 2016-08-05 17:28:26 | LQ_CLOSE |
38,794,935 | Python get last month and year | <p>I am trying to get last month and current year in the format: July 2016.</p>
<p>I have tried (but that didn't work) and it does not print July but the number:</p>
<pre><code>import datetime
now = datetime.datetime.now()
print now.year, now.month(-1)
</code></pre>
| <python><date><datetime> | 2016-08-05 17:34:58 | HQ |
38,795,103 | Encrypt String in .NET Core | <p>I would like to encrypt a string in .NET Core using a key. I have a client / server scenario and would like to encrypt a string on the client, send it to the server and decrypt it. </p>
<p>As .NET Core is still in a early stage (e.g. Rijndael is not yet available), what are my options? </p>
| <c#><encryption><.net-core> | 2016-08-05 17:46:24 | HQ |
38,795,200 | Why 2.65 + 2.66 = 5.3100000000000005 | <p>Why 2.65 + 2.66 = 5.3100000000000005 in Javascript?<a href="https://i.stack.imgur.com/pjhDV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pjhDV.png" alt="enter image description here"></a></p>
| <javascript> | 2016-08-05 17:52:30 | LQ_CLOSE |
38,795,329 | “does not name a type” error c++ | <p>I have a class declared as below, and I keep getting "Segment does not name a type" error. I've looked at other similar questions but I can't seem to find a solution to my problem. Any help? Thanks in advance! :)</p>
<pre><code>#ifndef ENTRANCE_H
#define ENTRANCE_H
#include "Segment.h"
#include <vector>
#include "Diodio.h"
class Entrance
{
public:
Entrance();
~Entrance();
void operate();
protected:
Segment *givesEntryTo;
std::vector<Diodio> elBooths;
std::vector<Diodio> manBooths;
private:
};
#endif // ENTRANCE_H
</code></pre>
| <c++><c++11><compiler-errors> | 2016-08-05 18:00:13 | LQ_CLOSE |
38,795,998 | Read ints recusively from file into array, the second last element always wrong | <pre><code>#include <iostream>
#include <fstream>
using namespace std;
int fillArray(ifstream& ifs, int array[]){
int cur;
int counter = 0;
if(ifs>>cur){
counter = fillArray(ifs, array) + 1;
array[counter-1] = cur;
}
return counter;
}
int main(int argc, const char * argv[]) {
int count;
int array[] = {0};
ifstream myfile ("/Users/Desktop/example.txt");
count = fillArray(myfile, array);
for (int i = 0; i<count; i++){
cout<<array[i]<<endl;
}
myfile.close();
return 0;
}
</code></pre>
<p>For example, if the input file is "1 2 3 100 19 16 33", the resulted array is "33 7 19 100 3 2 1".
if the input file is"1 2 3 4 5", the array will be "5 5 3 2 1".
I don't mind ints are filled in reversely, but I don't understand what happened to the second last ints. </p>
<p>And this code works fine in VS, it only has problem in xcode. </p>
| <c++><arrays><recursion> | 2016-08-05 18:50:03 | LQ_CLOSE |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.