input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Disabling 'Submit' Button (while Processing on Server) without jQuery <p>I have an old legacy Web app where I can't add jQuery.</p>
<p>When a form is submitted, a long server-side action takes place, and I need to disable 'Submit' until the response is rendered, or maybe the change the cursor.</p>
<p>I found a soluti... | <p>Target your button and set its disabled attribute to true.</p>
<p><code>document.querySelector("button").setAttribute('disabled', true);</code></p>
<p>I usually refer to this website when I need to make a change that isn't enough to require me to use jQuery.
<a href="http://youmightnotneedjquery.com/" rel="nofollo... |
Python Function Return Statement is Confusing and Complex <p>Could any body explain what do the 'and' and 'or' statements are doing in the return statement of the function below ?
the function seems to be returning the largest common denominator of a and b. </p>
<p> <code>def gcd(a,b): return b and gcd(b, a % b) or ... | <p>The first thing we can do is put in some parenthesis:</p>
<pre><code>((b and gcd(b, a % b)) or a)
</code></pre>
<p>Now lets take this piece by piece:</p>
<pre><code>b and gcd(b, a % b)
</code></pre>
<p>This will give <code>b</code> if <code>b</code> is falsy. Otherwise it'll give you <code>gcd(b, a % b)</code>.... |
How to Print Letters Out of CRM <p>I have a client that frequently response with "snail mail" for Cases. They want to be able to select a response letter type (they have around 50+ standard letter types they choose from) on the Case, and then at their leisure, go and print off the mailing labels, letters, and a pick l... | <p>If they have the budget I would say buy a product specifically for this purpose. Your client will gain a significant feature set for their investment. For example; <a href="http://www.mscrm-addons.com/Products/DocumentsCorePack" rel="nofollow">DCP</a> or <a href="http://www.xperido.com/" rel="nofollow">XperiDo</a>.<... |
Wordpress - Disable and hide all controls on video <p>How to disable and hide all controls on Wordpress 4.6.1 videos?</p>
<p>Following my actual code inside a WordPress page:</p>
<pre><code>[video width="560" height="320" mp4="example.com/test.mp4" loop="true" autoplay="true" preload="auto"][/video]
</code></pre>
| <p>Hi you need to override the inline styles applied to .mejs-controls div for that video shortcode. You can: </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-css lang-css prettyprint-override"><code>.mejs-contro... |
JAVA 2D String array column numbers <p>I have a CSV file which I have to read to a 2D string array (it must be a 2D array)</p>
<p>However it has different column number, like: </p>
<blockquote>
<p>One, two, three, four, five</p>
<p>1,2,3,4</p>
</blockquote>
<p>So I want to read those into an array. I split it... | <p>Sounds like you want a non-rectangular 2-dimensional array. You'll want to avoid defining the second dimension on your 2D array. Here's an example:</p>
<pre><code>final Path path = FileSystems.getDefault().getPath("src/main/resources/csvfile");
final List<String> lines = Files.readAllLines(path);
final Str... |
Trouble getting object from parsed JSON output <p>I'm playing around with the twitter API and i'm trying to parse the json output. However somehow i'm doing something wrong and I'm not getting what I would like to get. </p>
<p>In this case i'm writing in PHP. Started looping thru the array and screen_name and text are... | <p>Since <code>urls</code> is an array, you need to index it.</p>
<pre><code>$urls = filter_var($obj->entities->urls[0]->url, FILTER_SANITIZE_URL);
</code></pre>
|
d3.js reverse transition does not work <p>I am working on horizontal segment bar chart. I want to make it so that the bar chart will animate the colour transition between individual segments depending on the value that is generated randomly every few seconds. </p>
<p>I also have a text box that at the moment says "hel... | <p>The problem is just the <code>delay</code>.</p>
<p>When <code>newSegment > previousSegment</code>, you set the delay like this:</p>
<pre><code>.delay(function(d){return i * 90})
</code></pre>
<p>Which makes sense, because <code>i</code> is an increasing variable. But, when <code>newSegment < previousSegment... |
ConcurrentModificationException - HashMap <p>Consider the following code.</p>
<pre><code>Map<Integer,String> map = new HashMap<Integer, String> (5);
map.put(1, "a");
map.put(2, null);
map.put(3, "b");
map.put(4, "e");
for (String str : map.values()) {
if ("b".equals(str)) {
map.put(5, "f");
... | <p>"b" become last element. </p>
<p>The check is performed in <code>next</code> method of iterator and it is not called anymore. </p>
|
PHP Sleep Function 2 days time? <p>I'm trying to find a way to execute a function (send some emails), 2 days after a new table is inserted into the database. I would like to do this without cron if possible, so I was wondering if is too wrong to use the sleep function, with 2 days time? Or any other suggestion.. </p>
| <p>You can use <strong>SCHEDULE</strong> to set schedule for database query.</p>
<p>Maybe this question is already solved <a href="http://stackoverflow.com/questions/13872598/autorunning-query-in-mysql">here</a></p>
|
Why do both insertion and extraction into/from a std::priority_queue take logarithmic time? <blockquote>
<p>A [<a href="http://en.cppreference.com/w/cpp/container/priority_queue" rel="nofollow"><code>std::priority_queue</code></a>] is a container adaptor that provides constant time lookup of the largest (by default) ... | <blockquote>
<p>For example, if the sorting happens on insertion and the internal container remains sorted, wouldn't the extraction be able to happen in constant time? </p>
</blockquote>
<p>Extract could happen in constant time, but insertion would become <code>O(n)</code>. You'd have to search for the place in the ... |
Swift3 CoreData crash on iOS9 device <p>I have CoreData app that is perfectly working on iOS10, written in Swift3, supporting iOS 8.4 and above.</p>
<p>When I try to run it on iOS 9.3.5 I'm getting error:</p>
<pre><code>2016-10-07 17:47:20.596 FormApp[710:179733] *** Terminating app due to uncaught exception 'NSInval... | <p>For some reason NSSet is expected, but your NSManagedObject code has NSOrderedSet, which is a subclass of NSObject. Try to remove "Arrangment: Ordered" checkmark in your core data model and refactor those relationships to NSSet.
Not sure why this happens in iOS 10 but not in iOS 9 though.</p>
<p>P.S. Perhaps you sh... |
How to remove the border of a Tkinter OptionMenu Widget <p>I have been looking through multiple websites, which only give me a half satisfactory answer, how would I colour each part of of a Tkinter OptionMenu Widget?</p>
<p>Code Snippet:</p>
<pre><code>from tkinter import *
root = Tk()
text = StringVar()
fr = Frame... | <p>I don't understand your problem.</p>
<p>menu["menu"] is a tkinter.Menu object, so you can set others options.</p>
<p>Possible colors options are :</p>
<ul>
<li>activebackground -> that you want </li>
<li>activeforeground -> that you want</li>
<li>background</li>
<li>bg</li>
<li>disabledforeground</li>
<li>fg</li>... |
How to Grab data from database using JQuery Sortable <p>I am attempting to create a menu that allows the user to click and drag the list items into a new order. The list data is pulled from a database.
I've managed to code the click and drag feature for my menu however, I am struggling to then save the data in the new ... | <p>Please Review: <a href="http://api.jqueryui.com/sortable/#event-update" rel="nofollow">http://api.jqueryui.com/sortable/#event-update</a></p>
<blockquote>
<p><strong>update( event, ui )</strong></p>
<p>This event is triggered when the user stopped sorting and the DOM position has changed.</p>
<p><strong... |
Python Threading: Making the thread function return from an external signal <p>Could anyone please point out whats wrong with this code. I am trying to return the thread through a variable flag, which I want to control in my main thread. </p>
<h1>test27.py</h1>
<pre><code>import threading
import time
lock = threadin... | <p>Regular variables should not be tracked in threads. This is done to prevent race condition. You must use thread-safe constructs to communicate between threads. For a simple flag use <code>threading.Event</code>. Also you cannot access local variable <code>flag</code> via thread object. It is local, and is only visib... |
Calling updateDateRangeInput within a Shiny module <p>I have a Shiny application with multiple <code>plot_ly</code> charts on a single page using the same date range. For complicated reasons, I would like each chart in a separate module and be reactive to <code>plot_ly</code> zooms.</p>
<p>The way I did this pre-modul... | <p>I was able to get this to work by updating the date range outside of the module:
The module:</p>
<pre><code>chartTimeseriesUI <- function(id) {
ns <- NS(id)
plotlyOutput(outputId = ns("timeseries"))
}
chartTimeseries <- function(input, output, session, dateRange) {
regionRedraw <- reactive({
... |
search by class in string javascript <p>Let's suppose I have this string:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var myhtml= "<html><body><div class=... | <p>You can use <a href="https://github.com/cheeriojs/cheerio">cheerio</a> for that:</p>
<pre><code>var cheerio = require('cheerio');
var myhtml = "<html><body><div class='header'>Welcome</div><div class='news' id='new_1'>Lorem ipsum....</div><div class='news' id='new_2'>... |
autoit.pixel_search returning color is not found <p>I'm trying to grab the coordinates for a specific pixel value on the screen, but I can't seem to get any results. The error I get is "autoit.autoit.AutoItError: color is not found".</p>
<p>To verify my code I have the mouse move the the pixel that has the colour I wa... | <p>So I figured out how to resolve my problem. I don't know why it works or what caused the problem, but for now here is the solution</p>
<p>The correct formula for PixelSearch is PixelSearch(left, top, right, bottom). </p>
<p>After playing around with the numbers it appears pyautoit is using (right, top, left, botto... |
please explain "#variable" vs "let variable" in angular 2 <p><a href="http://i.stack.imgur.com/whQUr.png" rel="nofollow">Code Snapshot</a></p>
<p>In the above picture when i use <code>#course of courses</code> in <code>*ngFor</code> it does not work. If i use <code>let course of courses</code> it works. Please explain... | <p>This changed from the <code>Beta</code> version of Angular 2 to the <code>RC</code> version.</p>
<p>Now it's <code>let</code> instead of <code>#</code> to not mix up with template variables.</p>
|
Why can't I use moment as an import in my TypeScript React native project? <p>I want to use <a href="http://momentjs.com" rel="nofollow">MomentJS</a> in my ReactNative component using TypeScript. My project is configured to pull in the <a href="https://github.com/moment/moment/blob/develop/moment.d.ts" rel="nofollow">l... | <p>Quoting from <a href="http://stackoverflow.com/questions/36893165/importing-moment-into-typescript-project?noredirect=1&lq=1#comment61356347_36893860">@DavidD's comment in the linked answer</a>:</p>
<blockquote>
<p>Be careful if you use babel on top of the above syntax, babel will prevent the function <code>m... |
NotImplementedException but already call the method in C# <p>I would like to know, why did the NotImplementedException(); still appear even though I'm pretty sure that I have called the method?</p>
<p>this is the throw exception in my dsNBC.xsd designer:</p>
<pre><code>internal int getLastIDbyMaxPeg()
{
throw new... | <p>You have to remove that code and replace it with your actual implementation.<br>
The method has not been implemented (i.e. made to actually <em>do</em> something, rather than throwing the <code>NotImplementedException</code>), only called. </p>
<p>It will not just automatically remove itself because you <em>call</... |
Python list out of function <p>I Need <code>['1', '2', '3']</code> to become this <code>[1, 2, 3]</code></p>
<p>This is my actual code:</p>
<pre><code>def chain_a_list_int(p_chain :str):
tab_chain=[] # [str]
tab_int=[] # [int] (list to return)
tab_chain = p_chain.split(",")
tab_chain = [int(i) for i in t... | <p>That's not an error, but an indication that Python doesn't think that you have asked it to call <code>chain_a_list_int</code>. The minimal tweak to your code is:</p>
<pre><code>the_list = chain_a_list_int(input("enter the number to conserve: "))
print(the_list)
</code></pre>
<p>or</p>
<pre><code>print(chain_a_li... |
symfony user query return fields I don't specify when I am logged In <p>In my symfony app, using fosuserbundle too, this is a <strong>DQL</strong> query I create to recover all data I need concerning user:</p>
<pre><code>public function getAlluserNeedlesInfo()
{
return
$this->getEntityManager()
... | <p>It's the default serialization configuration for FOSUserBundle, if you're logged in, it will serialize all your stuff.</p>
<p>What you need is to override this configuration. It can be done by adding</p>
<pre><code># src/MyBundle/Resources/config/serialization/Model.User.yml
FOS\UserBundle\Model\User:
exclusio... |
Query Left Join with OR Inefficiency <p>I have a table (200K rows) with a field called "Campaign". I have a separate table list of campaigns with additional information. I want to join on <code>where (campaign_id = campaign) OR (cid.spend_source = a.Traffic_Source AND a.Campaign = cid.Campaign_Name)</code>.</p>
<p>The... | <p>Do two separate <code>left join</code>s:</p>
<pre><code>UPDATE a
SET a.campaign_name = coalesce(cidss.Campaign_Name, cidlc.Campaign_Name),
a.Campaign_ID = coalesce(cidss.Campaign_ID, cidlc.Campaign_ID)
FROM database.dbo.table a LEFT JOIN
carb.dbo.carb_lookup_campaignid cidss
ON cid... |
Continue to next blob in the ForEach Block when there is an exception in the Catch block <p>I have many xmls in Azure Storage container. I wrote code to strip off unnecessary data elements from those xmls. To list all the xmls in different folder structures I used</p>
<pre><code>var blobs = container.ListBlobs(prefix:... | <p>Try</p>
<pre><code> foreach (CloudBlockBlob blob in blobs){
bool isError = false;
try
{
// do your code here;
}catch(Exception ex){
isError = true;
}
if(isError... |
Swift: How to make a change to a variable load next time the application is opened <p>I have some global settings variables that are occasionally changed by the user during the apps runtime. I want to make the users change permanent, but at the moment every time the app is then reloaded it reverts to the original value... | <p>What you need is to create <code>UserDefaults</code> values these will be in the memory even when you close and restart your app.</p>
<pre><code>// Set
UserDefaults.standard.set(123, forKey: "key")
// Get
UserDefaults.standard.integer(forKey: "key")
</code></pre>
<p>So basically you could do this in your <code>App... |
mySQL empty SELECT in SELECT shouldn't return null for the whole query <p>I'm using a select in a select, like this : </p>
<pre><code>SELECT id,
(
SELECT name FROM xxx WHERE xxx
) as y
FROM xxx
</code></pre>
<p>But this y is null. And because of this, the whole query is returning null. I want this y to be a 0 i... | <p>This is too long for a comment.</p>
<p>Subqueries in the <code>SELECT</code> are called <em>scalar</em> subqueries. These always return one column and at most one row. If they return no rows, then the value is <code>NULL</code>.</p>
<p>They <em>do not</em> filter rows out of the result set. It is as simple as t... |
No resource found that matches the given name: attr 'andr oid:textColor <p>I get this error:</p>
<blockquote>
<p>Error:(2118, 21) No resource found that matches the given name: attr
'andr oid:textColor'.</p>
</blockquote>
<p>On this line in the file values.xml: </p>
<pre><code><item name="andr ... | <p>I think the error because of the space in the below line.</p>
<p>change </p>
<pre><code><item name="andr oid:textColor">@color/menu_section_header</item>
</code></pre>
<p>to</p>
<pre><code><item name="android:textColor">@color/menu_section_header</item>
</code></pre>
|
jQuery hiding group of containers that don't match index <p>I have multiple containers like this, each with a string of text within them. However, these containers may have the same string of text as another.</p>
<pre><code><div class="main">one</div>
<div class="main">two</div>
<div class="... | <p>You can use simpler code. <a href="https://api.jquery.com/contains-selector/" rel="nofollow"><code>:contains()</code></a> select element has spesific text. Use it in <a href="https://api.jquery.com/not-selector/" rel="nofollow"><code>:not()</code></a> selector.</p>
<pre><code>$(".example").click(function(){
$("... |
Using .asof and MultiIndex in Pandas <p>I've seen this question asked a few times but with no answer. The short version:</p>
<p>I have a pandas <code>DataFrame</code> with a two-level <code>MultiIndex</code> index; both levels are integers. How can I use <code>.asof()</code> on this <code>DataFrame</code>?</p>
<p>L... | <p>I read your post multiple times and I think I finally get what you are trying to achieve.</p>
<p>try this:</p>
<pre><code>df['weekday'] = df.index.weekday
df['hour_of_day'] = df.index.hour
weekly_model = df.groupby(['weekday', 'hour_of_day']).mean()
dates = pd.date_range('2015/1/1', '2015/12/31 23:59', freq='H')
<... |
Bitbake does not install my files in my rootfs <p>My aim is to create Bitbake recipe, that will install config file in /etc directory, and script, that will apply this config into /ect/init.d directory (and invoke update-rc-d).
I already saw another similar question (<a href="http://stackoverflow.com/questions/34067897... | <p>Fortunately, I was able to solve the problem. Here is the solution:</p>
<pre><code>SUMMARY = "Alsa Config"
DESCRIPTION = "Adds alsa configuration file, and startup script that applies it."
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI += " \
... |
Why are the old bars still visible after transition <p>I have a D3 barchart which has 5 bars. When I update it I can see it transitioning to the correct 3 bars but some of the original bars are left visible - how do I make them exit?</p>
<p>This is what it initially looks like:</p>
<p><a href="http://i.stack.imgur.co... | <p>You only have 3 new bars, so the number of elements on your data has changed.
You need to use the <a href="https://bl.ocks.org/mbostock/3808218" rel="nofollow">update pattern</a>.</p>
<pre><code>var rects = plot.selectAll("rect")
.data(currentDatasetBarChart);
rects.enter()
.append("rect")
//Code to sty... |
Swift 3 error: Type 'Any' has no subscript members <p>So I know this question has been asked and answered numerous times before, but I just migrated my project to Swift 3 and Im getting a ton of these errors in my code that parses JSON and I couldn't quite find answers that made me understand how to resolve my specific... | <p>If <code>responseData["UserProfile"]</code> is also a dictionary you'll probably want to cast it as such in you guard by saying <code>guard let userData = responseData["UserProfile"] as? [String : AnyObject] else { return }</code>. I suspect this will solve your problem.</p>
<p>As a small aside, you don't need to ... |
lodash filter on key with multiple values <p>I am trying to find out in <strong><code>lodash</code></strong> <code>javascript library</code>, how to find out filter array of objects multiple values of key. <em>something similar to SQL - WHERE KEY in (val1, val2) </em></p>
<p>Having said, with following example : </p>
... | <p>Lodash's <a href="https://lodash.com/docs/4.16.4#filter" rel="nofollow">filter</a> accepts a predicate. You can create the predicate using partial application, so you can change the values easily:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snipp... |
Can someone help analyse my java code on an averaging program? <p>Hi so I've started learning java online for two weeks now, but as I watched those tutorials, I felt the only way I'd actually grasp that information was to practice it. My other programs worked great, but just when I decided to do something spectacular (... | <p>It seems that you have created an <code>average</code> Object in another class, and are calling the methods given from a main class.</p>
<p>I don't know what exactly you're having trouble with, but one problem is here: </p>
<p><code>average = grade/totalaverage;</code> </p>
<p>These 2 variables that you are div... |
How do I build "gem install json"? <p>Iâm using Rails 4.2.7. Iâm trying to build this tutorial â <a href="https://github.com/webguyian/bookstore" rel="nofollow">https://github.com/webguyian/bookstore</a>, but getting a strange error, âAn error occurred while installing json (1.8.0), and Bundler cannot continue... | <p>The version of the json gem you are using is not compatible with Ruby >= 2.2. Please use at least version 1.8.2 of the json gem with Ruby 2.3. </p>
<p>See the <a href="https://github.com/flori/json/blob/master/CHANGES.md" rel="nofollow">Changelog</a> for details about changes in functionality and compatibility.</p>... |
App freeze: Forcing zero-copy tile initialization as worker context is missing <p>I develop a cordova/phonegap application including several plugins. The App running on android with the cordova crosswalk plugin. After displaying the splash screen the app freezes sometimes on some special devices and produce the followi... | <p>Perhaps this will help others. In my case some initialization <strong>before the first view is rendered</strong> caused this error. Both single of the following points seems to bring on the problem unreproducible from time to time:</p>
<ul>
<li>unzipping some kB and copy some files to the app data directory</li>
<l... |
Can't connect to container cluster: environment variable HOME or KUBECONFIG must be set when running gcloud get credentials <p>For some reason I can't connect to the cluster. Having followed the instructions per google container-engine after setting up the cluster, I get the following error: </p>
<p>ERROR: (gcloud.con... | <p>gcloud attempts to write a kubeconfig file to <code>$HOME/.kube/config</code> (or <code>$KUBECONFIG</code> if it is set). The most straightforward approach is to set <code>HOME</code> to your home directory, but if you have a reason that you'd like to store your kubectl configuration elsewhere, you can do that with ... |
How to calculate the CRC of data to verify it with the CRC of a zip entry? <p>Before we get started: I am an absolute beginner with JAVA. I have always been a C++ coder. So please do tell me when I am doing stupid stuff here!</p>
<p>I am querying a huge database and exporting that data directly into a zip-file. We are... | <p>I reproduced your example and it does work, the checksum is identical, but, I needed to add at least the <code>zipOut.close()</code> call:</p>
<pre><code> zipOut.write(sZipData, 0, sZipData.length);
//zipOut.closeEntry(); // <===== optional
zipOut.flush();
zipOut.close(); // <===... |
Push in array not reactive in HTML <p>When I remove a comment on my HTML var {{selecionados}} selected from, and I click on the list of names is all fine, but when HTML retreat or comment on again no longer works. </p>
<pre><code><script async src="//jsfiddle.net/raphaelscunha/9cwztvzv/1/embed/"></script>
... | <p>Vue.js will only update your view when a property within the <code>data</code> object is <em>changed</em>, not when a new property is added. (See <a href="http://vuejs.org/guide/reactivity.html#Change-Detection-Caveats" rel="nofollow">Change Detection Caveats</a> in the Vue.js guide)</p>
<p>If you want it to react ... |
Does killing the parent actor kill the children too? Seeing some different behaviour <p>I was underassumption that, if you kill the parent actor, the children will be killed too, but when I tried something like this given below, I am getting a different behaviour. Could someone please explain?</p>
<pre><code>1. Here t... | <p>per documentation default strategy</p>
<pre><code>ActorInitializationException will stop the failing child actor
ActorKilledException will stop the failing child actor
Exception will restart the failing child actor
Other types of Throwable will be escalated to parent actor
</code></pre>
<p>you are actually not kil... |
Declare, manipulate and access unaligned memory in C++ <p>I recently posted a question about <a href="http://stackoverflow.com/questions/39908946/unaligned-memory-access-is-it-defined-behavior-or-not">unaligned memory access</a>, but given the answer, I am a little lost. I often hear that "aligned memory access is far ... | <p>Whether something is unaligned or not depends on the data type and its size As the answer from Gregg explains.</p>
<p>A well-written program usually does not have unaligned memory access, except when the compiler introduces it. (Yes, that happens during vectorization but let's skip that). </p>
<p>But you can write... |
Nginx micro caching with JQuery callback <p>I have micro caching setup with my Nginx server to cache an API for 2 seconds. However, each time a request is made to the API, a different url is seen by Nginx because of the attached jQuery callback parameter.</p>
<p><strong>Example:</strong></p>
<p><code>api.example.com/... | <p>Please try out the following code,</p>
<pre><code>server {
...
location ~ \.php$ {
...
set $cache_key $request_uri;
...
if ($args ~ "sheet") {
set $cache_key $cache_key|$arg_sheet;
}
...
fastcgi_cache_key $cache_key;
...
}
...
}
</code></pre>
<p>... |
PHP :editing xml files via php form <p>This is my xml file and my php code. It modifies current information about student. however, what if I have several students. I can only edit the first one (John Doe) how can I edit my second student information then it also changes in my xml file. I have simplified the code here... | <p>Try to use <code>$data->student[0]</code> for first student and <code>$data->student[1]</code> for second (<code>$data->student[n]</code> for nth student) instead of <code>$data->item</code>.</p>
|
How to add VoiceOver accessibility to an App's Icon Badge Number? <blockquote>
<p><strong>Question:</strong></p>
<p>How do I add a custom VoiceOver accessibility <code>Label</code> or <code>Hint</code> to an App
Icon Badge Number?</p>
</blockquote>
<p><a href="http://i.stack.imgur.com/jHGRs.png"><img src="htt... | <p>It appears this is an "Apple-only" feature as of now... <a href="http://lists.apple.com/archives/accessibility-dev/2015/Jan/msg00003.html" rel="nofollow">source</a></p>
<p>Digging through API documentation, there doesn't seem to be any identifier that can set this for you, and I therefore think it's not publicly su... |
tox tests, use setup.py extra_require as tox deps source <p>I want to use setup.py as the authority on packages to install for testing, done with extra_requires like so:</p>
<pre><code>setup(
# ...
extras_require={
'test': ['pytest', ],
},
)
</code></pre>
<p>Tox only appears to be capable of <a hr... | <p>I've come up with a nasty hack that seems to work</p>
<pre><code># tox.ini
...
[testenv]
...
install_command = pip install {opts} {packages} {env:PWD}[test]
</code></pre>
<p>The defualt <code>install_command</code> is <code>pip install {opts} {packages}</code>, unfortunately <code>{packages}</code> is a required a... |
check if date argument is in yyyy-mm-dd format and correct date range <p>Is there a way to check if a date argument is in the correct date range eg </p>
<blockquote>
<p>2016-10-32 or 2016-09-31 should display as invalid</p>
</blockquote>
<p>.</p>
<p>i can able to find correct argument yyyy-mm-dd using below code</... | <p>delegate the validity check to <code>date</code> change the messages as you like</p>
<pre><code>$ d='2016-10-32'; if date -d "$d" &>/dev/null; then echo "$d is OK"; else echo "$d is incorrect"; fi
2016-10-32 is incorrect
$ d='2016-10-31'; if date -d "$d" &>/dev/null; then echo "$d is OK"; else echo "... |
How can I implement C's Structs in Java? <p>I have a little code that let me register an student (ID, name, age, etc), right now I could do it but just accepting one user, would overwrite if I register a new one, which is what I need now, be able to have more than 1 student.</p>
<p>So I was thinking that if I were usi... | <p>Java has no <code>struct</code>. </p>
<p>You can use <code>class</code> as structs with members having public access specifier and no methods</p>
|
Javascript formatting of 10 or 11 digit phone numbers and recognizing a 1800 phone number <p>I am trying to get javascript to format phone numbers based on a users input of 10 or 11 digits. The 11 digits are for phone numbers that start with a 1 at the beginning like a 1-800 number. I need the final output to be either... | <pre><code><script type="text/javascript">
var phoneNumberVars = [ "UserProfilePhone", "UserProfilePhone1", "UserProfilePhone2", "UserProfilePhone3", ];
InitialFormatTelephone();
function InitialFormatTelephone()
{
for (var i = 0; i < phoneNumberVars.length; i++)
{
FormatTelephone(phoneNumberV... |
Setting for Cookies never expire in SailsJs <p>I'm developing one application that i need a infinit session for some login. But my session was expire. I'm using Redis for control sessions and i'm authenticate Users with Json Web Token.
Apparently, my Cookies settings is wrong.</p>
| <p>Open config/session.js</p>
<p>Uncomment the following lines:</p>
<pre><code>cookie: {
maxAge: 24 * 60 * 60 * 1000
},
</code></pre>
<p>Replace maxAge value with some that will point in distant future, like 10 years from now:</p>
<pre><code>maxAge: 10 * 365 * 24 * 60 * 60 * 1000
</code></pre>
|
reduceByKey doesn't work in spark streaming <p>I have the following code snippet in which the reduceByKey doesn't seem to work. </p>
<pre><code>val myKafkaMessageStream = KafkaUtils.createDirectStream[String, String](
ssc,
PreferConsistent,
Subscribe[String, String](topicsSet, kafkaParams)
)
myKafkaMessageStrea... | <p>In a streaming situation, it makes more sense to me to use <code>reduceByKeyAndWindow</code> which does what you're looking for, but over a specific time frame.</p>
<pre><code>// Reduce last 30 seconds of data, every 10 seconds
val windowedWordCounts = pairs.reduceByKeyAndWindow((a:Int,b:Int) => (a + b), Seconds... |
Trying to make movie of 3D PCA plot (rgl) using movie3d <p>I have made a rgl 3D PCA plot in R using the pca3d package, and I am trying to make a gif file containing a movie of the rotating plot using movie3d. There is a function in the pca3d package (makeMoviePCA), that passes its arguments to movie3d. Here is the comm... | <p>I fixed this by telling R where "convert" is by using</p>
<pre><code>Sys.setenv(PATH=paste("/opt/local/bin", Sys.getenv("PATH"), sep=":"))
</code></pre>
|
How to (Dirty) Pair DateTimes Across Two Tables <p>I am looking at a SQL Server 2008 Database with two Tables, each with a PK (INT) column and a DateTime column.</p>
<p>There is no explicit relationship between the Tables, except I know the application has a heuristic tendency to insert to the database in pairs, one r... | <p>JOIN to the row with lowest DATEDIFF (in seconds) between <code>t1.DateTime</code> and <code>t2.DateTime</code>.</p>
|
Exporting Hash Table Using Property Dictionary to CSV <p>I can't seem to figure out how to simply export formatted information to a CSV unless I iterate through each item in the object and write to the CSV line by line, which takes forever. I can export values instantly to the CSV, it's just when using the properties d... | <p>This isn't going to work as written. You are using <code>Import-CSV</code> which creates an array of objects with properties. The <code>Select-String</code> command expects strings as input, not objects. If you want to use <code>Select-String</code> you would want to simply specify the file name, or use <code>Get-Co... |
Access Javascript array in Spring mvc controller <p>Right now I am sending some parameters through URL to the controller in spring mvc project. If the parameters are too long the url is more than 2083 characters which IE do not accept more than 2083 characters in a url.So I am thinking to access the front end JavaScrip... | <p>It is not possible "to access the front end JavaScript array in the backend controller". The JavaScript array (and the logic around it) is in the browser, and your Java backend is on your server. The communication path are the URLs.</p>
<p>You're probably currently sending your parameters with GET requests. You hav... |
How to set properly a SPF record in WHM <p>we ran a test in <a href="https://www.mail-tester.com/" rel="nofollow">https://www.mail-tester.com/</a> by sending an email for mail spam test and this was the result:</p>
<p><a href="http://i.stack.imgur.com/hwIm4.png" rel="nofollow"><img src="http://i.stack.imgur.com/hwIm4.... | <p>There could be more email servers responsible for sending your email. Therefore, you must enter SPF record provided by your web host and not the one recommended by mail-tester.com</p>
<p>with <strong>-all</strong> in SPF record, you're hard failing all other email servers and just allowing one.</p>
<p>It's also po... |
Using gulp-sass, how do I preserve the folder structure of my sass files except for the immediate parent directory? <p>I have a project with multiple folders that contain sass files:</p>
<pre><code>|ââ src
âââ scripts
âââ app1
âââ sass
âââ base.scss
... | <p>You can use the <a href="https://www.npmjs.com/package/gulp-flatmap" rel="nofollow"><code>gulp-flatmap</code></a> plugin to solve this:</p>
<pre><code>var path = require('path');
gulp.task('build:sass', () =>
gulp.src('scripts/app*/')
.pipe(plugins.flatmap((stream, dir) =>
gulp.src(dir.path + '/... |
Is there any resource to learn how drupal 8 configurations work? <p>I'm confused to know how to drupal 8 configurations work,if there any resources please list them.</p>
| <p>Managing your site's configuration
<a href="https://www.drupal.org/docs/8/configuration-management/managing-your-sites-configuration" rel="nofollow">https://www.drupal.org/docs/8/configuration-management/managing-your-sites-configuration</a></p>
<p>Defining and using your own configuration in Drupal 8
<a href="http... |
Keeping Submit Button Disabled Until Form Fields Are Full <p>Would someone be able to take a look at my code and see what I'm missing here?</p>
<p>I have a multi-page form with quite a lot of inputs, and I would like to keep "next page" buttons and the final "submit" buttons disabled until all the fields are full.</p>... | <p>Your <code>elements</code> array includes your <code>button</code>, which has no value. This will cause your loop to always evaluate to <code>cansubmit = false;</code>.</p>
<p>Try this instead: <a href="https://jsfiddle.net/e00sorLu/2/" rel="nofollow">https://jsfiddle.net/e00sorLu/2/</a></p>
<pre><code>function ch... |
Excel Macro to grab data from other spreadsheet <p>I need to write a macro in Excel that basically takes the count of data in another spreadsheet and puts it in the current spreadsheet. For ex. Spreadsheet B has 6 rows filled in column G. I want spreadsheet A to take the number 6 and add it to its own spreadsheet. Any ... | <p>Since this doesn't seem to be going anywhere in the comments. You can refer to a closed workbook with a sheet formula. In your case, something like:</p>
<pre><code> =COUNTA('C:\[Book2.xlsx]Sheet1'!G:G)
</code></pre>
<p>To make this easy, open both workbooks. In workbook a type <code>=CountA(</code> and then selec... |
Firebase3 listen for change event and get the old data value <p>On Firebase3 I am looking for a way to get to old value from an item in an firebasearray. Is there anyway to do it or can we ovveride the child_changed event? Solution should be for firebase 3 javascript sdk.</p>
<pre class="lang-js prettyprint-override">... | <p>There is no way to get the old value with an event. If you need that, you'll have to track it yourself.</p>
<pre><code>var commentsRef = firebase.database().ref('post-comments/' + postId);
var oldValue;
commentsRef.on('child_changed', function(snapshot) {
// TODO: compare data.val() with oldValue
...
o... |
Check for duplicates between jQuery elements <p>Does anybody know how to check for duplicate entries in a queries, where query elements are separated by comma.</p>
<p>Eg.</p>
<pre><code>$query1 = email1,email2,email3;
$query2 = email1,email2,email2;
$query3 = email4,email5,email6;
$query4 = email7,email7,email8;... | <p>Use</p>
<ul>
<li>for separating by comma <code>explode(',',$query)</code> to get an array of entries</li>
<li>then test the arrays against each other with <code>in_array($keyFromAnotherArray,$array)</code></li>
</ul>
<p>that should lead to the solution</p>
|
change date format in displaying <p>I have this below code where i am trying to alert the date selected on click of an image. I am getting the alert but the issue is date format.</p>
<p>Below is alert i am getting. I need the alert in mm/dd/yyy.</p>
<p>And also why i am getting Thu Jan 01 1970 if i use todatestring()... | <p>Try this function to return mm/dd/yyyy</p>
<pre><code>function getmmDdYy(thisDate) {
return ('0' + (thisDate.getMonth() + 1)).slice(-2) +
'/' +
("0" + (thisDate.getDate())).slice(-2) +
'/' +
thisDate.getFullYear();
}
</code></pre>
<p>So on your <code>fnUp... |
PHP $_POST Array Empty <p>i'm new in coding and have a problem coding on Mac.</p>
<p>When i do var_dump($_POST), answer is: array(0){}</p>
<p>Here is the code:</p>
<pre><code><?php
session_start();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name=strip_tags($_POST["name"]);
$age=$_POST["age"]*1;
$_SE... | <p>the problem with this is your session variables are not set at the beginning and you are trying to assign your $name and $age with those unassigned variables on your else block. Validate your assignments like this.</p>
<pre><code><?php
session_start();
$name = $age = "";
if ($_SERVER["REQUEST_METHOD"] == "POST")... |
How to rotate image and axes together on Matlab? <p>Code 1 where flipping vertically and/or horizontally does not affect <code>axes()</code>;
Code 2 where proposed solution does not yield the expected output</p>
<pre><code>close all; clear all; clc;
x = [5 8];
y = [3 6];
C = [0 2 4 6; 8 10 12 14; 16 18 20 22];
C2 = C... | <p>If I correctly understand your question, then this code does what you look for:</p>
<pre><code>x = 5:8;
y = 3:6;
C = reshape(0:2:22,4,3).';
C2 = fliplr(C); % horizontal flip
C3 = flipud(C); % vertical flip
C4 = rot90(C,2); % horizontal+vertical flip
% the answer starts here:
subplot(2,2,1), imagesc(x,y,C)
set(gca,... |
Lazy loading Angular modules with Webpack <p>I'm trying to get lazy-loaded Angular modules working with Webpack, but I'm having some difficulties. Webpack appears to generate the split point correctly, because I see a <code>1.bundle.js</code> getting created that contains the code for the child app, but I don't see any... | <p>The problem was unrelated to the <code>require.ensure</code> implementation. It was caused by some weirdness in the way <code>ocLazyLoad</code> is packaged (<a href="https://github.com/ocombe/ocLazyLoad/issues/179" rel="nofollow">https://github.com/ocombe/ocLazyLoad/issues/179</a>). The fix in my case was simple, I ... |
Why are my callbacks not firing with async queue? <p>I am using <a href="http://caolan.github.io/async/docs.html#.QueueObject" rel="nofollow">async queue</a> to process a huge amount of data. The queue works great until I try to perform an update in the database with <a href="https://docs.mongodb.com/v3.2/reference/met... | <p>I solved my problem this morning. The callbacks were fine, but rather there was a conditional state of the data I was not aware of, thus it was leading to a state in which the code would never call the processComplete() callback. </p>
<p>If anyone else is finding themselves in a similar bind, and you have tons of d... |
How to use different IDE with Netsuite <p>I'm admittedly new to Netsuite, so this may be obvious, although I've been unable to find anything specific one way or the other. In fact, I don't even attend any training until next week, but I'm trying to get part of my development environment setup with one of the editors/I... | <p>I don't like eclipse personally, so I just make my scripts in whatever and use Netsuite's script backend to upload the scripts as 'new' when I'm done. If I want to change them, simply use their backend again to 'edit' the script. You'll see a simple editor, where you can change things, or you just copy and paste wha... |
Python Load csv file to Oracle table <p>I'm a python beginner. I'm trying to insert records into a Oracle table from a csv file.
csv file format : Artist_name, Artist_type, Country . I'm getting below error:</p>
<pre><code>Error: File "artist_dim.py", line 42, in <module>
cur.execute(sqlquery)
cx_Oracle.Dat... | <p>Put quotes around the values:</p>
<pre><code>sqlquery="INSERT INTO ARTIST_DIM VALUES (%d,'%s','%s','%s')" %(x,row['Artist_name'],row['Artist_type'],row['Country'])
</code></pre>
<p>Without the quotes it translates to:</p>
<pre><code>sqlquery="INSERT INTO ARTIST_DIM VALUES (1, Bob, Bob, Bob)"
</code></pre>
|
C# - require a returned type to be assigned to an L-Value? <p>this may not be sensible,
but i'm looking at a situation where i would like it to be a compile error if the return value of a method goes unused.</p>
<p>specifically, Unity3D implements coroutines which look like this:</p>
<pre><code>IEnumerator myCoroutin... | <p>There is no such feature in C# for this. You'd need to create some form of 3rd party code analysis tool to try to look for cases such as these.</p>
|
Admin panel and user panel in one solution ASP.NET <p>i am developing an online election web page using <code>ASP.NET</code>.I have completed the user panel.Now i am trying to develop the Admin panel for my web site.</p>
<p><a href="http://i.stack.imgur.com/dfOUH.png" rel="nofollow">This is my project</a></p>
<p>I ha... | <p>Create a separate, protected folder for your admin forms. Then use membership to create users and roles: for example, you could have admin and editor roles limiting administration abilities, etc.</p>
<p><a href="https://www.asp.net/identity" rel="nofollow">https://www.asp.net/identity</a> </p>
<p>Looking at your s... |
net core - convert reader to json <p>I am working with <code>.net core 1.0.1</code>. I want to execute a stored procedure from a Sql Server Table. I can connect to the database correctly, now I have the following code:</p>
<pre><code>var con = _context.Database.GetDbConnection();
var cmd = con.CreateCommand();
cmd.Com... | <p>Solved with the following:</p>
<pre><code>var con = _context.Database.GetDbConnection();
var cmd = con.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "procedures.sp_Users";
cmd.Parameters.Add(new SqlParameter("@Command", SqlDbType.VarChar) { Value = "Login" } );
cmd.Parameters.Ad... |
Windowactivate three windows with same name <p>In Pulover's Macro creator I'd like to use the command <em>windowactivate</em> to activate 3 windows sequentially. They share the same name. </p>
<p>I tried to create a loop but it didn't work as expected.</p>
<p>How can I solve this?</p>
| <pre><code>; auto-execute section (top of the script):
GroupAdd, GroupName, WinTitle
; return ; end of auto-execute section
; F1::
Loop 3
; {
GroupActivate, GroupName
; Sleep 1000
; }
; return
</code></pre>
<p><a href="https://autohotkey.com/docs/commands/GroupAdd.htm" rel="nofollow">https://autohotkey.com/docs/comm... |
Picasso with OKHttp not displaying image: log error <p>I'm trying to download and cache an image with picasso from a webserver. I found a solution right here: <a href="http://stackoverflow.com/a/30686992/6884064">http://stackoverflow.com/a/30686992/6884064</a></p>
<pre><code> Picasso.Builder builder = new Picasso.Bu... | <p>If you try in android Studio emulator, clean Cache and data of app and uninstall and then install it again.
And also don't forget required permissions:</p>
<pre><code><uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />... |
Convert char to byte <p>I am trying to convert char array to byte. But I am getting the below error:</p>
<blockquote>
<p>Cannot implicitly convert int to byte</p>
</blockquote>
<pre><code>public byte[] asciiToDecConversion(char[] asciiCharArray)
{
byte[] decimalArray = new byte[10];
const byte asciiFormat =... | <p>You need to cast to byte:</p>
<pre><code>decimalArray[j] = (byte) (Convert.ToByte(asciiCharArray[j]) - asciiFormat);
</code></pre>
|
Is there a good "Laravel way" to escape html when returning json results? <p>I feel like this should be a common problem, but I haven't been able to find an answer for it. Blade templates make escaping html easy with <code>{{ $variable }}</code>, but for outputting json to an ajax request, not so much.</p>
<p>Natural... | <p>jQuery DataTables doesn't escape HTML so that if field contains <code><b>Text</b></code> it will be shown in bold in a table by default.</p>
<p>You can encode HTML entities in your response using the code below:</p>
<pre><code>return response()->json(array_map('e', $contacts->toArray()));
</code>... |
Deref a C pointer to a string within a struct within an array? <p>I have a thorny C syntax question. I'm building an array of linked lists, where each node in a list is represented by a struct. Each struct holds a string, which is important later:</p>
<pre><code>// "linkedList.h"
typedef struct llnode listnode;
str... | <p>The C <code>a->b</code> operator evaluates to <code>(*a).b</code>. So your line actually evaluates to something like <code>***(table+i).data</code>, which is obviously incorrect.</p>
<p>It also may help to group with parentheses so it's clear whether the line evaluates to <code>(***(table+i)).data</code> or <cod... |
Vanilla node.js response encoding - weird behaviour (heroku) <p>I'm developing my understanding of servers by writing a webdev framework using vanilla node.js. For the first time a situation arose where a french character was included in a <code>json</code> response from the server, and this character showed up as an u... | <p>If you're going to explicitly set a <code>Content-Length</code>, you should always use <code>Buffer.byteLength()</code> on the body to calculate the length, since that method returns the <em>actual</em> number of bytes in the string and not the number of <em>characters</em> like the string <code>.length</code> prope... |
Speed up Google Web App Spreadsheet loading <p>I'm working on a GAS Web App that reads a spreadsheet (it is not associated with the spreadsheet, and can't be for unrelated reasons).</p>
<p>I load in the sheet, or a range thereof, like this:</p>
<pre><code>var ss = SpreadsheetApp.openById(ssId);
dataSheet = ss.getShee... | <p>As I noted above, I found one answer that might be helpful to others.
I created a second sheet ("ProjectIndex"), and set up two columns that merely pointed to the corresponding columns of interest in "Projects" (I'd originally said I was just searching one column, to keep it simpler: I'm actually searching two).
I l... |
What is the default text color for theme.appcompat.light? <p>The title says it all, looking for the default color value used in TextViews in theme.appcompat.light</p>
<p>tried looking for it in Android studio by hitting ctrl on theme.appcompat.light but it brought me down a rabbit hole that I couldn't find the end of.... | <p>Looks like <code>theme.appcompat.light</code> goes all the way up to <code>Platform.AppCompat.Light</code></p>
<p>By default I'm just going to assume you mean the primary color.</p>
<p>Here's what it looks like:</p>
<pre><code><style name="Platform.AppCompat.Light" parent="android:Theme.Light">
<item... |
C# async/await. call and forget, no waiting. And long running process <p>I am trying to take advantage of new (relatively) C# async/await Task based feature. I went through several examples and I got the general idea of advantages.
Here are two topics I would be very grateful if someone shares with me/us some clues or ... | <blockquote>
<p>I feel like it will be very efficient to do those calls asynchronously (call and forget, no waiting).</p>
</blockquote>
<p>The problem with fire and forget is that you have no idea whether the operation failed. This is not acceptable for most code.</p>
<p>Many logging frameworks synchronously write ... |
Reading array of string in C <p>I need to read an array of n strings from 2 letters in each (e.g. n = 3, need to read something near "ab bf cs"). I use this code and get segmentation fault:</p>
<pre><code>int n;
scanf("%d", &n);
char array[n][2];
char *tmp;
for (int i = 0; i < n; i++)
{
scanf("%s", &tmp... | <p><strong>Problem 1</strong></p>
<p>To store a string of length 2, you need a <code>char</code> array of size 3. Use:</p>
<pre><code>char array[n][3];
</code></pre>
<p><strong>Problem 2</strong></p>
<p>You are using <code>&tmp</code> in the call to <code>scanf</code>. That is wrong on two accounts.</p>
<ol>
<... |
update using a subquery causing error <p>What is wrong with below query, I'm trying to update a count in daily table using a weekly one , I've to update a count per item in daily table using the count for same item in weekly</p>
<pre><code> select a.ik , a.date , d.count
from Table1 a , Table2 b ,
( select count... | <pre><code>select a.ik , a.date , b.count
from Table1 a
join Table2 b on b.ik=a.ik
join Calendar_table c on c.calendar_date=a.date
</code></pre>
|
react native embed video not working <p>It's a known issue for react native webview doesn't handle video playback well. </p>
<p>I found that in this discussion <a href="https://github.com/facebook/react-native/issues/6405" rel="nofollow">https://github.com/facebook/react-native/issues/6405</a> and <a href="https://gi... | <p>You should try using <a href="https://github.com/react-native-community/react-native-video" rel="nofollow"><code>react-native-video</code></a> or other libraries that you might find <a href="https://js.coach/react-native/react-native-media-player?search=video" rel="nofollow">here</a>.</p>
|
Accessing Groovy properties or methods <p>I have a simple question. If I have an <code>HttpResponseDecorator</code>(<code>groovyx.net.http.HttpResponseDecorator</code>) how come I can do <code>response.status</code> to get the response code? When I'm debugging I don't see this property available in the object. I looked... | <p>The Groovy property is a combination of a private field and getters/setters.
Groovy will then generate the getters/setters appropriately. </p>
<p>For example:</p>
<pre><code>class Person {
String name
int age
}
</code></pre>
<p>Properties are accessed by name and will call the... |
Excel VBA: Advanced Filtering Blanks Not Working <p>I have a userform that uses a checkbox to filter out blanks for a certain column. The range to be filtered is Sheet 1 A1:C10, and the criteria range is Sheet 2 A1:C2.</p>
<p>If checked: Don't filter Column C
If unchecked: Filter out blanks on Column C</p>
<p>I have ... | <p>Okay we missed a step.</p>
<blockquote>
<p><strong><em>C1 on sheet2 needs to be empty.</em></strong></p>
</blockquote>
<p>The formula will take care of the filter part.</p>
<p>Then the code is:</p>
<pre><code>If Checkbox1.Value Then
Sheets(2).Range("C2").Value = ""
Else
Sheets(2).Range("C2").Formula = ... |
Azure - SqlBulkCopy throwing a timeout expired exception <p>I'm using an azure sql database (v12) on a vm. I have two different databases instances - one for staging and one for production. I'm trying to grab the data off of staging and insert it into production with the click of a button. This code works successfully ... | <p>When creating your SqlBulkCopy instance, you're passing the connection string <code>externalConnectionString</code> and thus opening a new connection. That may be causing a deadlock issue with both connections trying to modify the same table.</p>
<p>Have you tried passing your existing connection <code>externalConn... |
Unable to write to txt file in php <p>I'm trying to simply overwrite a txt file with a number entered in a text box in PHP. Both the PHP and text file are in the html directory of my apache2 server. Every time it executes it just displays the die() string. I also tried using fwrite() with the same results. Any help wou... | <p>Wrap your PHP code Ina valid checker to see if form was submitted</p>
<p>Like this:</p>
<pre><code>if ($_POST):
//All functions go here
endfor;
</code></pre>
<p>If the file is in the same directory as your PHP file just change the directory to the file name.file Extension in your <em>file_put_content()</em> <... |
Symfony Serializer doesn't deserialize into objects in different namespace: 'no supporting normalizer found' <p>I'm trying to deserialize json into an object using the packages symfony/serializer and symfony/property-access through composer. It works when the class I'm deserializing into is in the same file, but not wh... | <p>The error occurs because <code>Foo</code> class doesn't exists in this context, you've probably forgotten to include this file <code>Somewhere/Foo.php</code> to autoload.</p>
<p>In your sample this should work!</p>
<pre><code><?php // file tests/Test.php
namespace tests;
include 'Somewhere/Foo.php';
//...
</... |
System.Data.SqlClient.SqlException Error while clicking button1 <p>A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll</p>
<p>Additional information: Invalid object name 'Login'.</p>
<p>Here's The Code :</p>
<pre><code>public partial class Form1 : MetroFramework.Forms.Me... | <p>The message is pretty clear: you don't have an object (table, view) in your database named <code>Login</code>. Your query is attempting to select from that object.</p>
<pre><code>Select Count(*) From Login where...
</code></pre>
<p>The bigger and more important issue here is that you're opening yourself up to a S... |
Center logo images within row on shopify page, with css / html? <p>I am making a grid of logos for a client's site. I am wondering how to make them centered within the grids in rows and columns. I have for css: </p>
<pre><code>.center-block {
display: block;
margin-top: auto;
margin-bottom: auto;
margin-left: auto;
ma... | <p>If you want the logo centered horizontally you can do something like this and replace .center-me with your class for the element you want centered.</p>
<p>if it's a block element do this. </p>
<pre><code>.center-me {
margin: 0 auto;
}
</code></pre>
<p>if it's inline (text or links) do this</p>
<pre><code>.cent... |
Setup virtual path with .NET Core Kestrel and Node <p>Is it possible to setup a .NET Core project on localhost:5000 and another Node project which runs next to the previous one, but at localhost:5000/api?</p>
<p>I have done this with .NET 4.6 and IISExpress, but a lot have changed with Kestrel server and I don't under... | <p>I don't think this is possible with kestrel alone. Check out the article explaining the architecture of developing with kestrel versus traditional IIS</p>
<p><a href="https://weblog.west-wind.com/posts/2016/Jun/06/Publishing-and-Running-ASPNET-Core-Applications-with-IIS" rel="nofollow">https://weblog.west-wind.com/... |
Pandas, convert aggregated dataframe to list of tuples <p>I am trying to obtain a <code>list</code> of <code>tuples</code> from a panda's <code>DataFrame</code>. I'm more used to other APIs like <code>apache-spark</code> where <code>DataFrame</code>s have a method called <code>collect</code>, however I searched a bit ... | <p>That's a hierarchical index you got there, so first you can do what is in this <a href="http://stackoverflow.com/questions/10373660/converting-a-pandas-groupby-object-to-dataframe">SO question</a>, and then something like <code>[tuple(x) for x in df1.to_records(index=False)]</code>. For example:</p>
<pre><code> df1... |
Python generating a lookup table of lambda expressions <p>I'm building a game and in order to make it work, I need to generate a list of "pre-built" or "ready to call" expressions. I'm trying to do this with lambda expressions, but am running into an issue generating the lookup table. The code I have is similar to th... | <p>As others have mentioned, Python's closures are <em>late binding</em>, which means that variables from an outside scope referenced in a closure (in other words, the variables <em>closed over</em>) are looked up at the moment the closure is called and <em>not</em> at the time of definition.</p>
<p>In your example, t... |
Ungroup Sheets from an array in VBA <p>I've been trying to get an easy printout (in PDF using a single button) of one sheet with only active range and one chart located in another sheet. I've got everything working, except after I print, both sheets are grouped together and I can't edit my chart. </p>
<p>I'm trying to... | <p><code>If Dir(fname) <> "" Then Exit Sub</code> will bypass <code>Worksheets("ws model updates").Select</code></p>
<pre><code>If OverwriteIfFileExist = False Then
If Dir(fname) <> "" Then
Worksheets("ws model updates").Select
Exit Sub
End If
End If
</code></pre>
|
How to check foreign table permissions on Postgres <p>does anybody know how to check user permissions for a foreign table on Postgres?</p>
<p>I've tried <code>\dE</code> and <code>\det</code>, but no luck.</p>
<p>I just want to know who can select, insert, update and delete from a foreign table.</p>
| <p><code>\dp</code> is a <a href="https://www.postgresql.org/docs/current/static/app-psql.html" rel="nofollow"><strong>psql</strong></a> meta-command which lists tables with their associated access privileges. I believe <code>\z</code> is doing the same thing. It also lists privileges for accessing views and sequences.... |
How to pull the non delimited date and time out of a string <p>I need to pull the date and time out of this string: <code>some_report_20161005_1530.xml</code> so I can reformat it to something more work-with-able. The date and time will change from file to file, but will always stay in this format: <code>some_report_{y... | <p>If the <code>some_report</code> doesn't contain digits, the date and time parts are already in a good order to work in the DateTime constructor, so you can extract them with a simpler regex.</p>
<pre><code>$date_time = new DateTime(preg_replace("/[^0-9]/", "", $your_string));
</code></pre>
|
RecyclerView In card View with Header <p>I want show a list of football games in my application with date time header.</p>
<p>In my case I want to show games in date category in a card view and set a header that shown date but out side of card view.</p>
<p>By adding card view as my RecyclerView parent, date title sho... | <p>You can use the library <a href="https://github.com/luizgrp/SectionedRecyclerViewAdapter" rel="nofollow">SectionedRecyclerViewAdapter</a> to group your data into sections.</p>
<p>First create a Section class:</p>
<pre><code>class MySection extends StatelessSection {
String title;
List<String> list;
... |
Swift 3.0 error with C-style for loop <p>I converted my project to Swift 3.0 and I get this error at the <code>for</code> line. Please see the error image below. After I converted it gave me a C-style error.</p>
<pre><code>func removeButton(_ aButton: UIButton) {
var iteration = 0
var iteratingButton: UIButton... | <p>It's a clear error, Swift 3 does NOT support the c-style <code>for</code> loop.</p>
<p>Instead, you should:</p>
<pre><code> for iteration in 0 ..< buttonsArray.count {
iteratingButton = buttonsArray[iteration]
if(iteratingButton == aButton) {
break
} else {
ite... |
Limiting integer width in python <p>I'm practicing python, I came across a situation where I wanted to limit the character width of a field but it wasn't working.(I hope I'm saying that right) I want to truncate the sum of 2 integers to 5 spaces. eg: the sum of 88888 + 22222 has 6 characters. Is it possible to limit i... | <p>You can easily truncate the value of these integers. Simply convert the result into a string and then use the Python index to select the first five characters:</p>
<pre><code>>>> str(88888 + 22222)[:5]
'11111'
</code></pre>
<p>You can also convert this value back to an integer using <code>int()</code> if ... |
How and in what order do I combine printf formatting arguments for a single printed output consisting of Strings and doubles? <p>Good afternoon, </p>
<p>Here are three lines of java code that I would like to combine into a single printf statement. The idea is to eventually have several columns of evenly spaced data ex... | <blockquote>
<p>when I try to format multiple columns by adding extra "%-#s" formats, I am being told that I have not included enough arguments</p>
</blockquote>
<p>It is expecting a string argument between <code>a_k[k]</code> and <code>a1_k[k]</code>. </p>
<p>Here are the four formats I assume you were wanting. </... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.