input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Laravel and running through a batch of results <p>I'm having a big head ache with Laravel's <code>chunk</code> and <code>each</code> functions for breaking up result sets.</p>
<p>I have a table, that has a column <code>processed</code> with a value of <code>0</code>. If I run the following code, it goes through all 13... | <p>Try this</p>
<pre><code> Records::where('processed',0)->chunk(100, function($records){
foreach($records as $record)
{
// do your stuff...
}
});
</code></pre>
<p><a href="https://laravel.com/docs/5.3/queries#chunking-results" rel="nofollow">https://laravel.com/docs/5.3/queries#chunking-resul... |
TypeError: Cannot find function includes in object <p>I have very little experience using Google Script but I was attempting to use it to search through one column of a spreadsheet and find all instances of the string "Film Dub" (knowing that there can be only one per cell).</p>
<p>Below is my code:</p>
<pre><code> ... | <p>You should use indexOf with a string to check for the existence of a text block.</p>
<pre><code>function filmDub() {
var sheet = SpreadsheetApp.getActiveSheet();
var data = sheet.getDataRange().getValues();
for (var i = 1; i < 100; i++) {
var s = data[i][2].toString();
if (s.indexOf('Film Dub') !==... |
how to use connect-flash with ajax <p>I have a page with a form that posts edits to a local endpoint via AJAX ($.post). I want to display a message to the user whether it went good or bad. But I can't get it to work. Here's what I have so far:</p>
<p><strong>jade template (excerpt)</strong></p>
<pre><code>if message
... | <p>Well if your using ajax you dont have to use express flash messages, you can simply use ajax.success method:</p>
<pre><code> $.ajax({
method:'post',
ulr: '/user/singup',
data: data,
success: function(msg) {
console.log('Success!!');
... |
Adding a title in godoc <p>I am trying to add a title in my godoc. I have referred <a href="https://godoc.org/github.com/fluhus/godoc-tricks#Titles" rel="nofollow">godoctricks</a>. My godoc looks like below:-</p>
<pre><code>// Package hello-world provides a helloworld example
//
// Pre-requisites
//
// * Go 1.5+
// ... | <p>The list seems to cause the problem. You may want to create an issue for that.</p>
<p>If you add any line before listing prerequisites, it will work as expected:</p>
<pre><code>// Package hello-world provides a helloworld example
//
// Pre-requisites
//
// You need to have the following:
// * Go 1.5+
// * Linux ... |
Setting and accessing a varibale by two different threads <p>I have two threads, one setting a variable of a class, and the other one accessing the variable by a get method. </p>
<pre><code>public class Parent {
private int value = -1
public int getValue()
return this.value;
}
public void setVa... | <p>There are some solutions here:</p>
<ol>
<li>use standard Java class <code>AtomicInteger</code> for storing your value in multi-threaded safe way. Actually it's the best and fastest way.</li>
<li>add <code>synchronized</code> keyword to your <code>getValue</code> and <code>setValue</code> methods</li>
<li>add <code>... |
Is A Driver For SQL Server Corrupt, And How To Fix It If So? <p>OK, I'm at wit's end here (not like I have many to start with, but that's a different story!). So (sigh)...</p>
<p>Somewhere along the line I get the distinct feeling that one or more of my database drivers have been corrupted or something, and I don't k... | <p>To test connectivity try this
1. Create a blank text file in a folder
2. Rename the extensión to .udl to the text file (exmanple New textfile.udl)
3. Double click on New textfile.udl</p>
<p>The .udl file will show you input connection paremeters, fill them and click on Test connection. This can help you to test ... |
Compiler Error: "error CS0307: The variable 'int' cannot be used with type arguments" <p>If I have the following code:</p>
<pre><code>private void Check(bool a, bool b)
{
}
private void Check(int a, int b, int c, bool flag)
{
Check(a < b, a > (flag ? c : b - 10));
}
</code></pre>
<p>I get a compile-time er... | <p>This is a great day for me. I never thought I would see one of these in the wild! I have only ever seen this in compiler test cases.</p>
<p>Consider the following program fragment:</p>
<pre><code>F(G<A,B>(7));
</code></pre>
<p>In C# 1.0, that meant "call method F with two arguments: <code>G<A</code> and ... |
How to invoke sudo command from Ruby <p>want to update /etc/hosts from Ruby, so i have below code in my ruby script</p>
<pre><code>system("sudo echo 'some.valid.ip.address some.domain.name.com' >> /etc/hosts")
</code></pre>
<p>expecting it will prompt for password, however i got below permission denied error</p... | <p>If it is possible, you can run the Ruby script as root and it will work.</p>
|
My program seems to be written perfectly, but stops running and allows user input with no scanner? <p>first time post here.</p>
<p>I am trying to create a class which compares quick sort, merge sort, bubble sort, and selection sort. I have implemented all of the sort methods and created a random array method which po... | <p>Your infinite loop is in bubbleSort:</p>
<pre><code>public static int bubbleSort(int[] a)
{
boolean hasSwapped = true;
while (hasSwapped == true)
{
hasSwapped = false; // Need to set this to false
for (int i = 0; i < a.length - 1; i++)
{
if (a[i] > a[i + 1]) // ... |
Go through array based on previous value <p>I have an array <code>['green', 'red', 'yellow', 'blue']</code>.</p>
<p>I want to change the background color of my website using these colors. But I don't want to just take a random color from this array. I want to iterate it in order.</p>
<p>So if I get the background col... | <p>You could use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Remainder_()" rel="nofollow">modulo</a> <code>%</code> with the length of the array.</p>
<pre><code>function setBgColor(currentColor) {
var array = ['green', 'red', 'yellow', 'blue'],
... |
`git -S -m commit` failing to ask for password â Signing after moving from GPG mac to GPG shell <p>I am setting up new machine (macOS Sierra) for web development, and I have done <code>brew install gpg</code> which has installed <code>gpg2</code> and <code>gpg-agent</code>. I have copied my keys from <code>~.gnupg</... | <p>It turns out the problem is that I copied all the files from <code>~.gnupg</code>, which overwrote files created by <code>brew install gpg</code> (probably one of the <code>.conf</code> files.</p>
<p>I uninstalled gpg and all the associated sub-packages (there are a lot of them), copied only <code>pubring.gpg</code... |
Loading relation from multiple directories <p>If we have a directory structure like so:</p>
<pre><code>/hdfs/foo
/hdfs/foo/foo1
/hdfs/foo/foo2
</code></pre>
<p>The orc files are in foo1 and foo2. There could conceivably be any number of subdirectories under foo. (They are partitioned files).</p>
<p>How can I load ... | <p>Pig does not allow globbing (<a href="http://pig.apache.org/docs/r0.14.0/basic.html#load" rel="nofollow">official document</a>) in load.</p>
<p>we have to do this either using some script or create manual.</p>
<p>you have to do
relation = LOAD '/hdfs{/foo/file/foo/foo/file...)' using OrcStorage();</p>
|
GameMaker Studio: Testing App on Android <p>I keep receiving this error "Execution failed for task ':library:compileReleaseJavaWithJavac'.</p>
<blockquote>
<p>Compilation failed; see the compiler error output for details" whenever I try testing my app for Android. I have the latest JDK/SDK files installed and have a... | <p>This developer had the same problem and a solution has been found, follow this link and scroll to the bottom for the solution
<a href="https://forum.yoyogames.com/index.php?threads/library-compilereleasejavawithjavac.3883/" rel="nofollow">https://forum.yoyogames.com/index.php?threads/library-compilereleasejavawithja... |
Cannot transfer value to another class ( c# ) <p>I have the first class named:</p>
<pre><code> Appartments[] appartments;
</code></pre>
<p>I want to copy the value of "Number" and paste it to "AppartmentInfo.cs" class( I guess they are called Parameters).</p>
<pre><code> public static void FindFloo... | <p>You are attempting to access the <code>AInfo[i].Floor1</code> property but if <code>AppartmentInfo</code> is a class, then each element in your <code>AInfo</code> array will be <code>null</code>. You would need to create an <code>AppartmentInfo</code> object first: </p>
<pre><code> for (int i = 0; i < amount... |
Spritekit- how to set up collisions between two objects so they behave like billiard balls? <p>I'm trying to create a billiards game with SpriteKit but am having a problem when it comes to the physics part of it. I'm trying to set it up so when a ball hits another ball the ball being hit bounces off and eventually slo... | <p>The action you're doing is just the MoveTo action so your sprite will just try and move there constantly. Try doing the SKAction apply force, this will apply a force to the ball in the direction you want it to move to but will not 'force' it to go to on particular location in your scene, the physics engine should ta... |
How to swipe to dismiss a DialogFragment in android <p>I set this <code>View.OnTouchListener</code> on my <code>DialogFragment</code>'s layout:</p>
<pre><code>public class SwipeDismissTouchListener implements View.OnTouchListener {
// Cached ViewConfiguration and system-wide constant values
private int mSlop;
... | <p>The key was to set the <code>SwipeDimissTouchListener</code> on the view returned by the <code>DialoFragment</code>'s <code>Dialog</code>'s <code>Window</code>'s <code>getDecorView()</code> in the <code>DialogFragment</code>'s <code>onResume</code> method, like so:</p>
<pre><code> @Override
public void onRes... |
Simple Python code for a starter <p>I am trying to write a code that a user can input raw data that will pull up a numerical grade from a list, AND pair that numerical value with a letter grade. ie: the fourth grade in the list is 86, so it will PRINT 86 as well as the letter grade B.</p>
<p>Here is what I have so far... | <p>This should achieve what you are looking for:</p>
<pre><code>grades = [62, 68, 93, 75, 89, 85]
def LetterGrade(grade):
if grade >= 90:
result = [grade, 'A']
elif grade >= 80 and grades < 90:
result = [grade, 'B']
elif grade >= 70 and grades < 80:
result = [grade... |
removeChild not working in chrome extension <p>I'm trying to <strong>remove all the link elements</strong> with a rel tag of "stylesheet" using <code>node.removeChild</code> from a webpage but it will not work.
I know chrome extensions have some limitations for security reasons but I don't seem to find if this problem ... | <p>First of all, change the Query to <code>var styles = document.querySelectorAll ("link[rel='stylesheet']")</code> - this gets rid of the unnecessary if-block. Second, are you sure the DOM is loaded when init() is called? For this, instead of calling init directly, try adding this line: <code>document.addEventListener... |
How can I show dynamic list of MapQuickItem? <p>How can I show for example dynamic list of planes from <a href="http://doc.qt.io/qt-5/qtlocation-planespotter-example.html" rel="nofollow">http://doc.qt.io/qt-5/qtlocation-planespotter-example.html</a> example?
I would like to add and remove items from the map. And also r... | <p>Both a QList based property or a QAbstractListModel derived class would work.</p>
<p>On the QML Side you would use either as the model for a <code>Repeater</code> that uses the <code>Plane</code> type as its delegate, taking the coordinate from the <code>model</code> handle</p>
<p>Somewhat like this</p>
<pre><cod... |
Optimization of the ternary operator in Perl <p>I have this loop :</p>
<pre><code>for my $line (split /\n/, $content) {
($line !~ /^\-{2,}$/) ? ( $return .= "$line\n" )
: ( $return .= "\N{ZERO WIDTH SPACE}$line\n" );
}
</code></pre>
<p>There will be mostly lines that doesn't match the re... | <blockquote>
<p><em>When you have a test which you know that it will choose one branch in 99% of the cases, does it change something (performance) to write it with that branch first?</em></p>
</blockquote>
<p>In the simple if/else case (which is what the ternary operator is), the answer is <strong><em>no</em></stron... |
WPF: Invalid Resx file. ResX input is not valid <p>I got a WPF project which ran fine but after some time I got the really awkward compiler error</p>
<blockquote>
<p>Invalid Resx file. ResX input is not valid. Cannot find valid "resheader" tags for the ResX reader and writer type names.</p>
</blockquote>
<p>I didn'... | <p>Replace all your <strong>Header</strong> attributes with <strong>name</strong> e.g.:</p>
<pre class="lang-xml prettyprint-override"><code><xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
</code></pre>
<p>You've probably changed it by accident if you've used "Replace all" somewhere. <br>
... |
Replace text within specific part of NSString <p>Is it possible to change text within a specific part of an NSString? For example, I want to use <code>stringByReplacingOccurrencesOfString</code>, but only within a certain part of a string. In this example, I only want to replace <code>#</code>'s after <code>#q=</code>,... | <p>The direct answer to your question is yes, you can use <code>stringByReplacingOccurrencesOfString:withString:options:range:</code>; the <code>range</code> parameter specifies the part of the string within which replacements should be done.</p>
<p>There are other searching methods provide by <code>NSString</code> wh... |
Comments in TFS Markdown Widgets <p>How does one comment out a line inside a TFS Markdown Widget? When I say "comment out" what I am referring to is making a line of text not visible to the view when it is saved. In other words, a line of text that is only viewable to me (as the editor) when I open the widget for edi... | <p><strong>Update:</strong></p>
<p>Both <code>[comment]: #</code> and <code>[comment]: <></code> should be work. It's regardless of the content in <code>[]</code>. So, there is no difference between <code>[comment]</code> or <code>[\\]</code>, even<code>[123]</code>. </p>
<p>However, <strong>suggest you use <c... |
Angular2 FileSaver.js - Cannot find module 'file-saver' <p>I am working on moving an angular 1.x site to a new angular 2.0 site I created the site using angular-cli 1.0.0-beta.15. </p>
<p>I have a button to export some data to a CSV file. When the page first loads I get an error message "Cannot find module 'file-save... | <p>Install the new TypeScript 2 version.. that should work..</p>
|
JavaScript AutoComplete does not narrow down results <p>I am able to fetch the complete list of items as I start typing but I am unable to see the results narrowed down as I continue to type.</p>
<p>JavaScript</p>
<pre><code><script type="text/javascript">
jq(function autoCompleteDisease() {
jq("#diseaseNam... | <p>Issue fixed! Had missed a line in the controller .java file - fetching the results bas</p>
|
html button causes postback before ajax call <p>I have what I think is a fairly standard HTML form for sending a "booking" email, sitting inside a popup div. On submit I'd like it to send the form data through AJAX to an ashx handler (in order to store the booking and send an email), however the button causes a postbac... | <p>Switch the button type to "button". <code>type="submit"</code> will cause the default post behavior.</p>
<p>Alternative: Add a click handler to the button and add <code>return false</code> at the end of the click handler. This will prevent the normal post behavior.</p>
<p>Example:</p>
<pre><code>function submit()... |
CSS dropdown navbar design error <p>I have this list element in my navigation bar that I want to fix.</p>
<p><a href="http://i.stack.imgur.com/vMWLJ.png" rel="nofollow"><img src="http://i.stack.imgur.com/vMWLJ.png" alt="Fixing the dropdown align and color"></a></p>
<p>HTML Code:</p>
<pre><code><li class="dropdown... | <p>I changed one bit of code.</p>
<pre><code>.dropdown:hover .dropdown-content {
display:inline-table;
right:0px;}
</code></pre>
<p>This keeps the submenus from bleeding off the screen. You can alter the <code>px</code> value to shift it one way or the other.</p>
<p>Fiddle: <a href="https://jsfiddle.net/Le7se5L9/" r... |
How to officially auto size a container to it's content <p>What is the official way to auto size a container div to it's contents? </p>
<p>I want the "BorderContainer1056" to size to it's contents: </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snip... | <h2>UPDATE</h2>
<p>To summarize:</p>
<ul>
<li><code>#VGroup1061</code>: </li>
</ul>
<blockquote>
<p><a href="https://www.w3.org/wiki/CSS_absolute_and_fixed_positioning#Summary" rel="nofollow">No <code>position:absolute</code></a></p>
</blockquote>
<ul>
<li><code>#BorderContainer1056</code></li>
</ul>
<blockquote... |
disable JndiProperty source when using Spring @Value annotation <p>I have a spring app configured to have a property file configuration on xml as </p>
<pre><code> <context:property-placeholder location="classpath:app.properties"/>
</code></pre>
<p>I have classes that looks up values from here using the @Value a... | <p>I created a <a href="http://docs.spring.io/autorepo/docs/spring/current/javadoc-api/org/springframework/core/SpringProperties.html" rel="nofollow">spring.properties</a> file and added this value
<a href="http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/jndi/JndiLocatorDelegate.html#IGNORE_JN... |
Escaping HTML in JavaScript <p>When I'm building HTML in JavaScript I'm constantly escaping double quotes. E.g.</p>
<pre><code>$(wrapper).append("<input type=\"text\" name=\"thingummy[" + id + "]\" data-id=\"" + data_id + "\" id=\"" + id + "_" + data_id + "\" /> <br>");
</code></pre>
<p>and, when there a... | <p>You could perhaps use <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals" rel="nofollow">templating strings</a> in JavaScript. Makes it simple to insert variables into a string too with <code>${var}</code> syntax.</p>
<pre><code>echo '$(wrapper).append(`<input type="text" n... |
Unable to apply DSC via puppet <p>Environment: Windows 10, with Powershell v5</p>
<p>Have following puppet manifest that should create a AppPool in IIS.</p>
<pre><code>class mywebserver {
dsc_xWebAppPool {'DefaultWebAppPool2':
dsc_name => 'DefaultAppPool2',
dsc_ensure => 'Present... | <p>Looks like it is a <strike>puppet</strike> powershell bug:
<a href="https://tickets.puppetlabs.com/browse/MODULES-3690" rel="nofollow">https://tickets.puppetlabs.com/browse/MODULES-3690</a></p>
|
Filter objects data in javascript using recursion <p>There is an object that includes other objects. The keys of this objects can be undefined, defined or empty. I am interested only in defined and not empty values of these keys. I will show examples:
data object</p>
<pre><code>var d = {
google: {
email: '... | <p>This code forks fine, but it runs 4 times!
Can anyone help to fix that?
</p>
<pre><code><head>
<meta charset="UTF-8">
<title>Document</title>
<script>
function iterate(data, fields) {
var response = Object.create({}, "");
response.els = [];
... |
Installation of OpenCV in Ubuntu 14.04 <p>I built OpenCV from Source but I can't manage to use it. Every time I try to even load an image with the next code I get <code>No module named cv2.cv</code>. Why is that happening? How can I fix it?</p>
<pre><code>from cv2.cv import *
img = LoadImage("/home/User/Desktop/Image... | <p>I found the solution to my problem. I had to install <code>python-opencv</code> as follows:</p>
<pre><code>sudo apt-get install python-opencv
</code></pre>
<p>After that OpenCV works fine.</p>
|
Java While Loop Not Ending <p>I am very new to java and decided to start a new project recently to help myself learn. My project is an impossible quiz. I started making my first question in the quiz and ran into a problem. I have a while loop that is supposed to exit the question if the player runs out of lives however... | <p>Change || for &&...</p>
<p><code>while (lives != 0 || !correct == true)</code></p>
<p><code>while (lives != 0 && !correct == true)</code></p>
|
Displaying a custom message containing the category link of first product added to cart <p>On WooCommerce, I want to show a custom message at the top of the cart page that contains the category link of the first product added to cart.</p>
<p>This is the message:</p>
<blockquote>
<p>Add more T-shirts from <strong><c... | <p>Here is a custom function that will show your custom message on cart page, with the category archive pages link for the first product added to cart. <br>
If a product without a category is added to cart, nothing is displayed. <br>
Optionally you can also display it on checkout page <em>(uncommenting last line)</em>.... |
JavaScript Finding if string in array can be found in an object <p>I have an object that includes different roles and I have an array that includes specific colors.</p>
<p>What I want to do, is see if the roles.name includes any of the strings in the colors array. I've tried different approaches, such as:</p>
<pre><c... | <p>You're using <code>indexOf</code> backwards. It should be <code>array.indexOf(valueToSearchFor)</code>, but you have <code>valueToSearchFor.indexOf(array)</code>. Also, <code>indexOf</code> returns the index, not a boolean; to test whether the element is found, you have to compare it to <code>-1</code>.</p>
<p><div... |
dprintf implicit declaration warning <p>When using <a href="https://linux.die.net/man/3/dprintf" rel="nofollow">dprintf()</a> I'm getting the warning "implicit declaration of dprintf". That tends to mean a necessary file isn't included, but I already included stdio.h, which is supposed to be all that it needs. Is there... | <p>The "feature_test_macros" section of the man page explains that to make stdio.h declare dprintf(), you must first <code>#define _POSIX_C_SOURCE 200809L</code> (or higher) before you <code>#include <stdio.h></code>. The reason for this is that dprintf() was not standardized until POSIX.1-2008, but <code><st... |
How to Transfer values to another class method <p>I have global variables in Question class and increments these values in event handler. I have another class User which contains a static method <code>Details()</code>. I want to pass these two variables values (after increments) from event handler to the <code>Details(... | <p>First off: Method names in Java are camelCase. Not UpperCase ;)</p>
<p>If you want to access fields of a class in another class there are serveral ways to achieve that. The easiest one are static fields:</p>
<pre><code>public class MyClass {
public static String accessible;
}
public class AnotherClass {
p... |
oracle CRUD frontend <p>We have an existing system using Oracle DB and several applications working on/off it using JDBC/ODBC etc. For an additional interface for CRUD operations I am looking at a web based front-end. I dont see a whole of ideas in this areas, maybe because the ORacle DB is mostly enterprise and proba... | <p>As far as I know there aren't really any options like this specifically for Oracle databases. You might be better off going with a desktop solution, of which there are many.</p>
<p>There is a web UI called "<a href="http://www.h2database.com/html/tutorial.html" rel="nofollow">H2 Console</a>" which claims to work wi... |
Get UTC time and format it without milliseconds <p>I have the following function that returns a <code>DateTime</code> format which I can easily print using the <code>toString</code> method.</p>
<pre><code>def getUTCNow(): DateTime = {
val now = new Date()
val utc = new DateTime(now).withZone(DateTimeZone.UTC)
... | <p>Using java and joda , this can be done as follows</p>
<pre><code>DateTime dateTime = new DateTime(new Date()).withZone(DateTimeZone.UTC);
System.out.println(dateTime.toString("yyyy-MM-dd'T'HH:mm:ss'Z'"));
</code></pre>
<p>In your case as well the equivalent should be similar to :</p>
<pre><code>utc.toString("yyy... |
While-Loop BASH-Regex not matching <p>Why is this INCREDIBALLY simple REGEX not matching?!!?</p>
<pre><code>#!/bin/bash
while true
do
read -r -p $'What is the JIRA Ticket associated with this work?' JIRA
#Use a regular expresion to verify that our reply stored in JIRA is only 4 digi... | <p>The regular expression is open-ended, meaning it only has to match a substring of the left-hand argument, not the entire thing. Anchor your regular expression to force it to match the entire string:</p>
<pre><code>if [[ ! "$JIRA" =~ ^[0-9]{4}$ ]]
</code></pre>
|
Asp.Net MVC5 Project Admin Area Route - Error Routing Controller ActionResult <p>MVC5 project I created the area for the admin panel.
I got a problem.</p>
<p>There are ProductController and ListActionResult on the <strong>front of the site</strong>.</p>
<p>And.</p>
<p>There are ProductController and ListActionResult... | <p>change in RegisterArea method like this. </p>
<pre><code>public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Admin_default",
"Admin/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", area = "Admin", id = ""... |
Classes, Objects, Inheritance? <p>I'm supposed to create three classes: a parent, and child 1 and child 2.<br>
Child 1 and 2 are supposed to inherit from the Parent class.
So I believe I've done that. </p>
<pre><code>class Parent:
"""Parent Object"""
def __init__(self):
self.greeting = "Hi I'm a Pare... | <blockquote>
<p>Child 1 and 2 are supposed to inherit from the Parent class. So I believe I've done that</p>
</blockquote>
<p>Yes, in the first code, you have, but not in the second code. </p>
<blockquote>
<p>I have to write a parent object and child 1 and 2 objects that will print out their respective strings</p... |
Java Programming Making Classes Object names <p>Okay, so I'm in java Object Oriented Programming and I'm stuck on one little thing on a project.</p>
<p>I have to create a class that holds a student name, calculates the total score and calculates the average score. But what's holding me up is that I need to create an o... | <p>It's not very clear what you are asking, you are asking how to create a student object and set that objects name field to the input given from the scanner?</p>
<p>One way to pass information from the program to the class is to create a constructor that sets the fields value upon object creation: </p>
<p><code>Stud... |
iOS: Autolayout and popOverController issue (possible Xcode bug) <p>I am displaying my <code>popOverController</code> for iPhone and iPad in the code below. </p>
<pre><code> ViewController *vc = [[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
if ([UIDevice currentDevice].userInterfaceIdiom ==
... | <p>The conditional constraints in the storyboard use <em>size classes</em>.</p>
<p>The horizontal size class on a popover-presented view controller on an iPad is Compact, just like on an iPhone. That is why you are seeing the iPhone size for the buttons.</p>
<p>To see that this is true, override <code>viewDidAppear:<... |
Filtering Firebase lists based nested child keys? <p>In the <a href="https://firebase.google.com/docs/database/web/structure-data" rel="nofollow">Firebase docs for Structuring Data</a>, they give the follow data structure as an example of mapping users to groups. </p>
<pre><code>{
"users": {
"alovelace": {
... | <p>That information is already in the data model. Right under <code>/users/alovelace/groups</code> you have a list of the groups she's a member off.</p>
<p>The reason for recommending this model is that it doesn't even require a query to load the list of groups, it just requires a direct-access read of <code>/users/al... |
Jasmine TypeError : undefined is not a constructor <p>I have this function inside a controller :</p>
<pre><code> $scope.delt = function() {
$scope.data = {};
$scope.confirmPopup = $ionicPopup.confirm({
title: '<b>Delete user</b>',
tem... | <p>Typo at the end of the describe function - you are not closing the parent level (describe function) - note that I have added comments just for description purposes.</p>
<pre><code>describe('manageUserCtrl', function() {
var controller, window, scope,
$rootScope,$q, store, API, $ionicPopup, deferredLogup... |
How to change wl.client.init in IBM MobileFirst version 8 <p>I an trying to convert my MFP 7.1 hybrid app to MFP v8 Cordova app .However, I am getting an error with the statement 'WL.init.connect'. </p>
<p>What is strange is that I am able to deploy the app in MobileFirst version 8 and run it my device. I see the dev... | <p>In v8.0, many features and APIs have either been deprecated or discontinued. You need to review this list of API changes and make your changes accordingly.</p>
<ul>
<li>Migration cookbook: <a href="https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/migration-cookbook/" rel="nofollow">https://mobil... |
9 Nested Fors without repeting the past number <p>I'm trying to get all the permutations for a 123456789. I'm using JTree. I can't get around this without burning my computer to the ground. Here's what I have:</p>
<pre><code> //create the root node
DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root");
//cr... | <p>You can use recursion. You will find the explanation of this algorithm <a href="http://javahungry.blogspot.com/2014/03/algorithm-to-find-permutations-of-string-using-recursion-in-java.html" rel="nofollow">here</a>.</p>
<pre><code>public class Permutations {
private boolean[] used;
private StringBuilder out ... |
Why is stat's st_size field offset 96 on 64bit OSX and can it be calculated? <p>Using the latest sources from <a href="http://opensource.apple.com/source/xnu/xnu-3248.60.10/bsd/sys/stat.h" rel="nofollow" title="apple's opensource repo">apple's open source repo</a> I have derived the following structure for the "sta... | <p>On OS X, both fields of <code>struct timespec</code> are <code>long</code>, which is 64-bit in the usual LP64 convention. Therefore, <code>sizeof(struct timespec) == 16</code> (you can check this yourself), and it is aligned on a 64-bit boundary, giving you an offset of 96 for <code>st_size</code>.</p>
|
Face detection using hog features <p>Currently for face detection I am using svm classifier over HOG feature set.But I need to implement other classifiers over those HOG feature set and compare the results between them .What other classifiers can I use other than svm?</p>
| <p>There are plenty of other classification algorithms, a simple logistic regression could be a starting point. You could use <a href="http://www.sciencedirect.com/science/article/pii/S0030402614008511" rel="nofollow" title="here">logistic regression</a>; implement <a href="http://www.gaussianprocess.org/gpml/chapters/... |
how can i change my program to accept different inputs? <p>i have an absolute value program and as of right now it accepts numbers like 1 +1 -1 but i also need it to be able to accept decimals as valid inputs from the user. i also need to use the intString.matches method. how would i go about doing that?
here is the co... | <p>You can do that with</p>
<pre><code>Float num = input.nextFloat();
</code></pre>
<p>Your code will be like that...</p>
<pre><code>import java.text.DecimalFormat;
import java.util.Scanner;
public class AbsoluteValue {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
... |
Parenthesis around placement new operator for arrays <p>Playing around with placement new for arrays, I came up (by chance/mistake) with the following code:</p>
<pre><code>#include <new>
struct X{};
int main()
{
char buf[256];
std::size_t n = 10;
X* p = new (buf) (X[n]); // incorrect way, parenthes... | <p>With the parentheses, the type to be newed comes from a <em>type-id</em>, in this case <code>X[n]</code>. This is a variable length array which is not standard behavior. Without the parentheses, the type to be newed is a <em>new-type-id</em>, an array of <code>X</code>.</p>
|
Spacing comes automatically when i declare any div <p>Any <code>section / div / header</code> i declare in <code>HTML</code> i am getting <code>1px</code>off extra spacing and that causing another issue when I <code>hover</code> on any element the other element such as <code>header</code> start shaking with animation. ... | <p>Could you plz post the rendered CSS?<br/>
A cause can be that a child element of <code>.navigation</code> has a <code>margin-top</code> that reaches out the <code>.navigation</code> container so you should check those too.</p>
|
python urlib in loop <p>my requirement is to read some page which has so many links available in order
i have to stop at suppose at 4th link
and i have to read and connect to the url at that particular link
save the link contents in a list
again the connected link has so many links and i have to connected to the link a... | <p>Without knowing the particular site you're talking about this is just a guess, but could it be that the links in the page you're interested in are relative and not absolute? If that's the case when you reset url in the for loop then it would be set to an incomplete link like /link.php instead of <a href="http://exa... |
Trouble with gcovr exclusions <p>I am running gcovr (3.3) on an out of source build like:</p>
<p><code>gcovr --root=/path/to/source --object-directory=/path/to/build</code></p>
<p>Now I want to exclude two different things from the report:</p>
<p>1) Any <code>.cpp</code> files that have "Test" in their name</p>
<p>... | <p>Both of these options are not well documented, so the main source of knowledge is <a href="https://github.com/gcovr/gcovr/blob/master/scripts/gcovr" rel="nofollow">source code</a>. </p>
<blockquote>
<p>a) what is --exclude-directories for since it seems like you (should) be able to exclude a directory with the ri... |
Glassfish how to trust an expired certificate for SSL <p>I'm trying to setup a SpringSecurity CAS authentication on a glass fish server and the server has an expired self-signed cert. I've managed to import the cert but I"m still getting the following error:</p>
<blockquote>
<p>FAILURE: javax.net.ssl.SSLHandshakeEx... | <p>Well, looks like I found a terrible way to do it. I threw this <strong>SSLHelper</strong> class into my project and it just did magic things</p>
<pre><code>import com.sun.net.ssl.HostnameVerifier;
import com.sun.net.ssl.HttpsURLConnection;
import com.sun.net.ssl.SSLContext;
import com.sun.net.ssl.TrustManager;
imp... |
Is there any reason to use Python's generator-based coroutines over async/await? <p>Despite its well-known "one way to do it" philosophy, Python (as of version 3.5) supports two ways of writing coroutines:</p>
<ol>
<li><a href="https://www.python.org/dev/peps/pep-0342/" rel="nofollow">enhanced generators</a> (perhaps ... | <p>Quoting <a href="https://mail.python.org/pipermail/python-dev/2015-April/139728.html" rel="nofollow">Guido van Rossum himself</a>:</p>
<blockquote>
<p>[...] eventually we'll always be using async functions when coroutines are called for, dedicating generators once again to their pre-PEP-342 role of a particularly... |
Make a div scroll with page only in a certain place? <p>How can it be made so that a div scrolls with the page but only in a certain area of the page?</p>
<p>I can't work out how to do this with CSS for only part of the page, I think javascript may be the only option.</p>
<p>For e.g. There's three sections of a page,... | <p>Some Javascript is needed in order to read the point where you want to change the state of the div you wish to address. You can do this with the <code>getBoundingClientRect()</code> method. I have worked out a fiddle that will show you.
What happens is that you read the position of #Middle. I have added an input fie... |
How to configure Angular $http to send requests to different host? <p>I have an Angular web app deployed onto Heroku that pulls static files from S3. I have RequireJS enabled to allow angular to lazily load controllers and templates. The problem is that when the app is loaded, the window.location variable is set to <co... | <p>I was able to get Angular to load the templates from S3 instead of the current host! First, some here's tech I'm using:</p>
<ul>
<li>RequireJS for making my application modular</li>
<li>Angular </li>
<li>Angular UI Router for state routing in the application</li>
<li>Angular AMD to help reconcile Angular with Requi... |
Ordering based on number value in a string from SQL <p>I have these CB1-15 values however I want to order them by... CB1-15 but currently it goes CB1, CB10, CB11 etc.</p>
<p>This is how my table looks...</p>
<pre><code>CB Description File Path
CB1 New Product new.png
CB10
CB11
CB12 ... | <p>Use the below script.</p>
<pre><code> SELECT *
FROM YourTable
ORDER BY CAST(Replace(YourColumn,'CB','')as INT)
</code></pre>
|
Why does this function only run once? <p>I really think this should run every 100ms, but it only beeps once.</p>
<p>I know about setInterval, but this confuses me.</p>
<pre><code>var test = function () {
console.log('beep')
setTimeout( test, 100 );
}();
</code></pre>
<p>Anybody know why this only runs once a... | <p>The anonymous function is being executed before it's assigned to <code>test</code>.</p>
<p>You can declare it as a named function expression:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyp... |
Scrollbarwidth prevents document from 100% width <p>Im trying to have this view or two columns, one is taking the third of the page and the other is taking 1/3 (the rest of the page). All works fine</p>
<pre><code>$(window).resize(function(){
var height = $(window).height();
var width = $(document).wid... | <p>the scroll bar is showing up because your html is beyond the bounds of the current window. If your code above is fixing that, you could consider hiding the html until your code has executed. the following css will hide it until you are ready:</p>
<pre><code> html {
display: none;
}
</code></pre>
|
Google Script: Application skips valid urls <p>My code is below</p>
<p>So my problem is it works fine but it should skip a url like:
<a href="http://services.runescape.com/m=itemdb_rs/api/catalogue/detail.json?item=1" rel="nofollow">http://services.runescape.com/m=itemdb_rs/api/catalogue/detail.json?item=1</a> because... | <p>Use the muteHttpExceptions parameter with the fetch() method to know where exactly the problem is.</p>
<p>Change:</p>
<pre><code>var response = UrlFetchApp.fetch(url); // get api endpoint
</code></pre>
<p>To:</p>
<pre><code>var response = UrlFetchApp.fetch(url, {muteHttpExceptions: true});
Logger.log(response.g... |
somehow not able to pass a value to a function leading to a typeError <p>I'm trying to re-implement the function getElementsByClassName. As part of my function I want to recursively call my function on an element's children w/ its own child nodes. </p>
<p>However, despite console logging that I'm passing a value w/ ch... | <p>you are referring to document as object with property of element div, but it can't has such property</p>
<pre><code>return inner(document[children[i]]);
</code></pre>
<p>should be</p>
<pre><code>return inner(children[i]);
</code></pre>
|
Execute script after onchange event of input file in HTML5 <p>I want to know if it is possible to execute a script just after the onchange event of an input file finished? If so, how?</p>
<p>I'm very new to promises but I want know if this can be achieved, specifically for the input file</p>
<pre><code><input type... | <p>This how you can listen on changing the input</p>
<pre><code><input id="myInput" type="file">
<script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
<script>
var inputControl = $('#myInput');
inputControl.on('change', function(e) {
alert(this.value);
});
inputControl.on('cha... |
Amazon Alexa Intent Skill Console <p>Hey Is it just me or is Amazon having problems on their server?</p>
<p>I'm on the page where we set up our json intents and sample utterances</p>
<p>But when I try to save it. It's just loading and loading. I tested this out on another laptop and it's just loading as well</p>
<p>... | <p>This happens occasionally. Usually it sorts itself out after a few hours. Sometimes longer on a weekend. You can post a notice in their forums and they'll say "gosh I'm sorry" and usually get back to you when it's working again.</p>
|
Can anyone tell me what the purpose of a Gemspec file in Ruby is? <p>After combing through Google I know what goes <em>in</em> a gemspec file for my project, but I have no clue as to <em>why</em> we need it, I guess I'm looking for a practical definition.</p>
<p>(Currently working through Learn Ruby the Hard Way by Ze... | <p>According to the official <a href="http://guides.rubygems.org/make-your-own-gem/" rel="nofollow">RubyGems site</a>:</p>
<blockquote>
<p>The gemspec defines whatâs in the gem, who made it, and the version of
the gem. Itâs also your interface to RubyGems.org. All of the
information you see on a gem page (li... |
Disable animation on scaling/rotation with transform <p>I'm making a chess game in a page and I'm trying to flip the whole board (a div) using the css transform. I first tried rotate or scale(1, -1) both are working but makes a small annoying animation. </p>
<p><a href="http://i.stack.imgur.com/xuSeO.gif" rel="nofollo... | <p>You didn't post your HTML code, but if you are only adding the .rotated class to the main div - you must also add this class to the individual chess piece divs.</p>
<p>For example, if you were using jQuery to add the class ...it would look something like this:</p>
<p><div class="snippet" data-lang="js" data-hide="... |
Row-wide Column in Bootstrap? <p>I am trying to figure out how to make a row wide column in bootstrap. In the picture below you see what i want to accomplish. After that there is the source code in which I tried to I realize that. </p>
<p>I really would like to know what the optimal way is to solve this so the correct... | <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.CONTENT_A , .CONTENT_B , .CONTENT_C {
border: 1px solid red;
padding: 10px;
background-color: #bbb
}
.CONTENT_A , .CO... |
Extracting column from numpy array - unhashable array <p>I have a file of experimental data that I have parsed into a numpy array. I am attempting to extract the first column of the array into a variable using:</p>
<pre><code>Thermo_Col = df[:,[0]]
</code></pre>
<p>where <code>Thermo_Col</code> is the column of tempe... | <p>I think df is not a numpy array, but a DataFrame, try this:</p>
<pre><code>df.iloc[:, [0]]
</code></pre>
|
Get the id of the popover button <p>I'm dynamically adding buttons to the DOM. On each button, there's a popover. Here's my code:-</p>
<pre><code><button class="pop-Add" id='button1'>Add</button>
var popOverSettings = {
placement: 'bottom',
container: 'body',
selector: '[rel="popover"]',
html:true,
conten... | <p>I think the most simple answer would be to just add the id of the "click me" button as a <code>data-attribute</code> to the newly created popover and accessing that <code>data-attribute</code>:</p>
<p><a href="http://jsfiddle.net/RRGnb/490/" rel="nofollow">JS Fiddle</a></p>
<pre><code>$(document).on('click', '.cli... |
How to setup a Scala hello world app with Akka and Sl4j logging? <p>I'm not new to programming, but the amount of disparate content around there around logging is making my head spin. </p>
<p><strong>Mission:</strong> To get a basic Scala app daemon with an actor that listens to a RabbitMQ message. </p>
<p>Now I do n... | <p>I don't know if it's the cause, but you have at least two visible problems:</p>
<ol>
<li>Your <code>build.sbt</code> is missing commas in the dependency list</li>
<li>Your main class is called <code>Main</code> but is sitting inside a file called <code>main</code></li>
</ol>
<h3>Edit</h3>
<p>You also use an old v... |
How can I integrate Twitter Bootstrap CSS and Javascript into a vanilla VueJS project? <p><code>
vue init webpack helloworld
npm run dev
</code></p>
<p>Awesome, I have a Vue project.</p>
<p>How can I integrate Twitter Bootstrap (latest) in my project? CSS and Javascript.</p>
<p>I tried to install it using NPM and re... | <p>You can find detailed instructions here: <a href="https://www.namekdev.net/2016/08/load-boostrap-4-alpha-into-vue-js-project/" rel="nofollow">https://www.namekdev.net/2016/08/load-boostrap-4-alpha-into-vue-js-project/</a></p>
|
Issues calling super method in ObjectMapper <p>trying to convert ObjectMapper syntax to Swift 3.0:</p>
<pre><code>class CustomJsonResponse: Mappable {
var status: String?
var response: String?
var errorCode: CustomErrorCode?
init() {
}
required init?(map: Map) {
}
func mapping(map... | <p>I think you are missing:</p>
<pre><code>init() {
super.init()
}
</code></pre>
|
Checkout branch in git submodule <p>How do I change branches from within a submodule? When I run <code>git branch</code> from within the submodule, I see the following output:</p>
<pre><code>> git branch
* (HEAD detached from 229a7b2)
master
</code></pre>
<p>How would I put myself on a new branch? Like <code>d... | <p>Simply list your branches:</p>
<pre><code>git branch -avv
</code></pre>
<p>And then checkout the one you want</p>
<pre><code>git checkout -b myBranch origin/mybranch
</code></pre>
<p>Or create a new development branch from the commit you currently are:</p>
<pre><code>git checkout -b development
</code></pre>
<... |
Can I use scout with laravel 5.1 <p>Given Laravel scout was introcuced with laravel 5.3 can I use it with laravel 5.1?<br>
The docs at <a href="https://laravel.com/docs/5.3/scout" rel="nofollow">https://laravel.com/docs/5.3/scout</a> doesn't state anything about this.</p>
| <p>Yes you can include it in laravel 5.x as well , Using this blog </p>
<p><a href="https://scotch.io/tutorials/build-search-functionality-with-laravel-scout-and-vue-js" rel="nofollow"><strong>Blog Link</strong></a></p>
<p>Also you can check Other Elastic Search plugin which are being used in laravel much before Scou... |
Using HTMLAgilitypack to get data <pre><code><ol class="list-data-b">
<li class="in-ttl-b">(a) kanji; a Chinese character [ideograph]
<ul class="list-data-b-in"><li class="text-jejp text-c"><span class="ex">æ¼¢åã§æ¸ã</span></li><li class="text-jeen text-c">write... | <p>Selecting the first text can be done as explained in <a href="http://stackoverflow.com/questions/39569210/retrieve-parts-of-text-inside-li">your previous question</a>. Now to get each pair of Chinese/Japanese-English texts, you can iterate through the <code>ul</code> elements, and then, from each <code>ul</code>, ge... |
Using rowSum and subset to clean data <p>I am having trouble subsetting a large data frame. I have 5,000 observations and 60+ columns. I want to subset based on ~ 30 columns -- essentially to "drop" any observations where the sum of the values in these 30 columns of <code>interest == 0</code>. A small sample is below: ... | <p>First, take a look at <strong>subset()</strong> function.
You can use it like this:</p>
<pre><code>subset(data, condition)
</code></pre>
<p>So, you miss the <strong>data</strong> argument here.</p>
<p>Second, you put <strong>(</strong> in <strong>rowSums</strong> wrongly. It must be <strong>rowSums(df[,1:2]) > 0<... |
Can I use asp.net identity with MVC 5 where back-end is web API? <p>I have a web API which is written in java and on front end I am creating an Admin panel so to protect our restricted page I could use form based authentication however I heard that form based authentication has been deprecated(<a href="http://programme... | <p>You can install web api framework in mvc project with nuget. And install Microsoft.AspNet.Identity, Microsoft.AspNet.Identity.EntityFramework,
Microsoft.AspNet.Identity.Owin. So you can use identity in MVC framework.</p>
|
selenium web driver Unreachable browser exception with Safari on Mac <p>I have written simple code to open safari web browser in eclipse with selenium web driver on mac .also where to look for safari exe and where to place it on mac plzz help.thanks</p>
<pre><code>package sanityTest;
import org.openqa.selenium.Web... | <p>The Safari WebDriver on Mac OS currently requires that you compile, sign, and install a specific WebDriver browser extension as detailed <a href="https://github.com/SeleniumHQ/selenium/wiki/SafariDriver" rel="nofollow">here</a>. This requires that you sign up for a free Apple developer account and get a test key to ... |
Remove max and min duplicate of a list of number <p>I would like to remove ONLY the maximum and minimum duplicate of a list of
numbers. Example: (<strong>1 1 1</strong> 4 4 5 6 <strong>8 8 8</strong>) Result: (<strong>1</strong> 4 4 5 6
<strong>8</strong>)</p>
<p>How do I combine max() min() function with <code>list(s... | <pre><code>s = raw_input("Please Input a series of numbers")
numbers = map(int, s.split())
# numbers = [1, 1, 1, 4, 4, 5, 6, 8, 8, 8]
mi = min(numbers)
ma = max(numbers)
b = [mi] + [x for x in numbers if x != mi and x != ma] + [ma]
</code></pre>
|
What's the correct way to find all entities ordered by field in Spring Data? <p>I'm using Spring Data JPA and want to add a method in my base Repository interface to get all entities ordered by field <code>order</code>:</p>
<pre><code>@NoRepositoryBean
public interface OrderedEntityDao<T extends OrderedEntity> e... | <p>The correct named query will be:</p>
<pre><code>public interface OrderedEntityDao<T extends OrderedEntity> extends EntityDao<T> {
public List<T> findAllByOrderBy<colname><Desc|Asc>();
}
</code></pre>
<p>In your case:</p>
<pre><code>public List<T> findAllByOrderByOrderDesc... |
Aligning image, button, and animated text using CSS <p>So I have this front page and I'm trying to have the button align towards the middle like below the text, but I've tried adding margins and it won't move. Any tips? </p>
<p><img src="http://i.stack.imgur.com/f5YYR.jpg" alt="Here is the photo"></p>
<p><div class="... | <p>So whats killing you here is the float right it is overriding anything you add after that.</p>
<p>Now i don't think this is the best solution but if you remove the float you can then add whatever margin left you need to get the button to move.</p>
<p>something to look into for you would be bootstrap, it is a much ... |
Angular 2 function inside callback value not updating view <p>I have created function and inside function i'm calling one callback function after callback response I have update string variable but this string variable not updating my view.</p>
<pre><code>import { Component } from 'angular2/core';
@Component({
s... | <p>You just need to use <strong>ArrowFunction (()=>)</strong> and <strong>ChangeDetectionRef</strong> as shown below,</p>
<pre><code>import {Injectable, ChangeDetectorRef } from 'angular2/core'; //<<<===here
export class ViewComponent {
getAddress : string;
public totlaBalance : string;
constr... |
Using a Razor For loop on an IEnumerable ViewModel - problems accessing by index <p>I am aware that you can't access a value by index when using an <code>IEnumerable<T></code> .</p>
<p>Here is my view:</p>
<pre><code>@model IList<CustomerViewModel>
@for (int i = 0; i < Model.Count - 1; i++)
{
@Mo... | <p>Your model expects the type <code>IList<CustomerViewModel></code>, where in your method <code>Index</code> you are passing <code>IEnumerable<CustomerViewModel></code> as model. <code>IEnumerable<T></code> cannot be automatically converted to <code>IList<T></code>, so you get an error.</p>
<p... |
how to link Discrete Maths Predicate LOGIC with java predicate LOGIC, to form simple AI response java Appln? <p>i have gone through PREDICATE and LAMBDA expression in java but i didn't understand how to link DM Predicate logic with this one for forming simple AI java Application?</p>
| <blockquote>
<p>In Discrete Mathematics predicate logic we can create functions which can process natural language by making it as a simple regular expression. I'm asking how to write same functions using java lambda and predicate. </p>
<p>Example - ''All of Jane's friends are generous'' = > Regular Expression ... |
Google datalab : how to import pickle <p>Is it possible in Google Datalab to read pickle/joblib models from Google Storage using %%storage clause?</p>
<p>This question relates to <a href="http://stackoverflow.com/questions/39599138">Is text the only content type for %%storage magic function in datalab</a></p>
| <p>Run the following code in an otherwise empty cell:</p>
<pre><code>%%storage read --object <path-to-gcs-bucket>/my_pickle_file.pkl --variable test_pickle_var
</code></pre>
<p>Then run following code:</p>
<pre><code>from io import BytesIO
pickle.load(BytesIO(test_pickle_var))
</code></pre>
<p>I used the ... |
PHP echo wrong login details (div) <p>i have a user login page and php script to check the login credentials with data stored in a database. Everything works fine, i just tried adding a msg box styled with CSS containing the text "wrong email" if login details didn't match the data in the database and it will automatic... | <p>Remove the redirection code from the <code>else</code> condition, PHP will redirect without echoing/displaying anything on-screen.</p>
<pre><code> ... else
{
echo '<div class="alert">';
echo '<span class="closebtn" onclick="this.parentElement.style.display="none";">&times;</span>';
... |
How to move PHPunit 4.8 to the path? <p>Hi I try to install PHPunit on my 14.04 ubuntu, but newest version require PHP 5.6 and I got only 5.5 so I installed PHPUnit </p>
<p>via composer <code>composer global require "phpunit/phpunit = 4.8.*"</code> </p>
<p>But when I try to access it <code>phpunit -c app/</code> </p>... | <p><a href="https://akrabat.com/global-installation-of-php-tools-with-composer/" rel="nofollow">This</a> link explains how to add all composer installed tools to the path.</p>
|
Reading .dat file with fixed column width <p>The code I use in SAS</p>
<pre><code>Options symbolgen ps=10000;
Data span_nonspan;
INFILE 'C:\September 2016\SAMPLE.dat';
INPUT @1 XYZ $10.
@11 ABC $7.
@18 PM $3.
run;
</code></pre>
<p>Can anyone please help me h... | <pre><code>import pandas as p
data = p.read_fwf("filename", colspecs=[(0,10),(11,17),(17,20),(20,24)],names=['DP','PHONETYPE','MARKET','FOLDER'])
data.head()
</code></pre>
|
how to target pseudo element with java script <p>so i have a menu and i add a font awesome icon on each parent menu.
and if they click the icon it will show slide down animation to show their child menu.</p>
<p>currently my code is like this
on css</p>
<pre><code>li {
a {
border-bottom: solid thin $color-... | <p>Use this keyword instead of targeting <code>a</code> element.</p>
<pre><code>var resizeTimer;
$(window).resize(function(e) {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
if ($(window).width() <= 767) {
$('.menu-item-has-children a').click(function() {
... |
How to compare originalList to filterList in recyclerview using Filter? <p>In this code I have search multiple text ex. I have search sachin.</p>
<p>sachin is show the list but click to back sachin to sac not display to sa list on adapter. How to solve it without any library?</p>
<p><br>when I press back space and re... | <p>Without any Library simple logic
<br>Finally I have solution in this question</p>
<p>In your Adapter Constructor add the new copy list</p>
<p>After the copy list is add in filter </p>
<pre><code> private List<YourModel> modelList;
private List<YourModel> modelListCopy;
private ItemFilter mFilter = ... |
minimizing run time by ordering scripts to run in the right order <p>I am using scrapy and scrapyd to crawl some content. I have 28 crawlers that run, but only 8 at a time. Each crawler takes from 10 min to several hours to complete. So im looking for a way to order them correctly, in order to minimize the time the ser... | <p>The best way I've found is to set them up as cronjobs to execute at specific times. I have around 30 cronjobs configured to start at various times meaning you can set specific times per scrap.</p>
<p>Executing a PHP cmmand by cronjob at 5pm every day:</p>
<pre><code>* 17 * * * php /opt/test.php
</code></pre>
<p>I... |
Data transfers between From Azure to Onedrive <p>Does anyone know if the uploads from Azure to Onedrive are counted towards my Azure Egress quota?</p>
<p>Thanks</p>
| <p>Whenever data flows out of an Azure region, it is counted towards your egress quota and is billed accordingly.</p>
<p>Since Onedrive service is not an Azure service, any data that goes from Azure to Onedrive will be considered as data egress and will be counted towards your egress quota.</p>
|
An infinite carousel with vanilla JavaScript <p>I am trying to build my own <em>carousel</em> with pure JavaScript. </p>
<p>I'm struggling with picking up the most <strong>efficient</strong> way to add an <code>infinite carousel</code> option.</p>
<p>For some reasons, every element (photo, generic object) must have a... | <p>I created a simple slider with css transformations as the animation technique and plain Javascript. </p>
<pre><code>var img = document.getElementsByClassName("img")[0];
img.style.transform = 'translate('+value+'px)';
</code></pre>
<p>You can test it in this codepen snippet.
<a href="http://codepen.io/TobiObeck/pe... |
Need help in understanding Firebase config security <p>If one integrates this config in JS, won't it be a security concern as any one can open the JS file, get access to this details and access my firebase DB?</p>
<pre><code>var config = {
apiKey: "xxxx",
authDomain: "xxx.firebaseapp.com",
databaseURL: "ht... | <p>That's just so the client can identify your app. Even the apiKey is more like a reference and less like a secret password so don't worry. You can use this to instantiate many apps inside a single file. (see <a href="https://firebase.google.com/docs/web/setup" rel="nofollow">https://firebase.google.com/docs/web/setup... |
Anchor with hash fragment is not navigating to matching id <p>I have an anchor with a hash fragment:</p>
<p><code><a href="#people">People</a></code></p>
<p>Farther down on my page I have a section with a matching ID:</p>
<p><code><section id="people">...</section></code></p>
<p>When the lin... | <p>For this I use </p>
<pre><code><a name="subject"></a> - At the position in the page where I want to go
<a href="#subject">Go to subject</a> For the link to jump there
</code></pre>
<p>check out my page - you should be able to view source</p>
<p><a href="http://www.cambodia.me.uk/visiting-k... |
Split and check first 8 digits are met <p>I have some data that looks like this, when reading this data from a file, is there a way to only add to the list if the first 8 digits are met?</p>
<pre><code>11111111 ABC Data1
</code></pre>
<p>my current method is only splitting the space in between</p>
<pre><code>Number ... | <p>If you want to only add a 8 digit number from an input string, do it as shown below</p>
<pre><code>descr = input()
reqd_int = int( descr.split(' ')[0:8] )
</code></pre>
<p>This will fail if the input contains less than 8 integers at the start.</p>
<p>The other option is to use regular expressions, use it as shown... |
Too many elements when initialize hashmap <p>When I set immutable hashmap contents on initialization like this:</p>
<pre><code>var result_tags=HashMap[String,Int]()
result_tags=("video"->0,"game"->0,"news"->0,"ee"->0,"sport"->0,
"shop"->0,"ju"->0,"story"->0,"pho"->0,"con"->0,"live"-... | <p>What you're actually doing there is initializing a giant <code>Tuple</code> type and trying to assign it to the <code>result_tags</code> variable which is of type <code>HashMap</code>, which wouldn't work even if the tuple size wouldn't exceed
maximum size.</p>
<p>So the error you get regarding tuples is not refer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.