input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Default DPI effects on Visual Studio and Windows Forms <p>I am having a strange effect when editing a legacy Windows Forms project in Visual Studio 2015 on my new computer with a high DPI (150%) setting. When I edit the project on the laptop screen (DPI 150) everything appears normal and the forms' default font is the... | <p>I have solved my own issue. Documenting here for anyone else who might have this strange experience. When docked, I had three displays connected, two 1920x1200 monitors through DVI and one 1024x768 projector through VGA. Apparently this extra projector connection was creating some sort of strange DPI issues in Vi... |
How do I get the field name of my id field related from ManyToOne relationship? <p>I have 2 tables related, InProducto and InUnidadMedida, which InProducto is related ManyToOne with InUnidadMedida.
I want to know how can I get the name of my related ID to show it in the list.</p>
<p>Index twig</p>
<pre><code> ... | <p>It's just <code>{{ entity.unidadMedida.name }}</code> (given the property is <code>$name</code>)</p>
<p>You can also make it a bit simpler by making just <code>{{ entity.unidadMedida }}</code> and making a method <code>__toString</code> in <code>InUnidadMedida</code> Entity</p>
<pre><code>...
public function __toS... |
Add a custom field to checkout and to my_account user details on registration <p>I have a woocommerce site I am building and I want to add the user's birthdate to the usermeta in the database as well as display it in the wp-admin under their profile. </p>
<p>I have limited experience with messing with PHP. </p>
<p>I... | <blockquote>
<p><strong>â Light Update â <em>(All data is now updated in database)</em></strong></p>
</blockquote>
<hr>
<p><strong>1) SOLVING THE ERROR:</strong></p>
<p>You have to use <a href="https://developer.wordpress.org/reference/functions/update_user_meta/" rel="nofollow"><strong><code>update_user_meta(... |
Make a custom div shape <p>How to make a div like this? Any ideas please.</p>
<p><a href="http://i.stack.imgur.com/B0NQ8.png" rel="nofollow"><img src="http://i.stack.imgur.com/B0NQ8.png" alt="enter image description here"></a></p>
<p>Here's my code so far: <a href="https://jsfiddle.net/Lpzqeu74/?utm_source=website&am... | <p>Here is a quick solution, try it:</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>#shape {
border-top: 100px solid black;
border-right: 60px solid transparent;
... |
Trouble moving div down <p>Im sure this is very simple but i have been looking at this for a while today and just cant figure it out.</p>
<p>All i want to do is move the top div '#template-nav' down a little bit so there is some white space above it. I have tried margin-top and padding but it just wont move down. </p>... | <p>Adding a margin-top to that top element inside <code>#template</code> won't work, since the margins of the element and its top child influence each other.
But you can add a <code>padding-top</code>to <code>#template</code>:</p>
<p><a href="https://jsfiddle.net/wh6cgLt0/" rel="nofollow">https://jsfiddle.net/wh6cgLt0... |
Referencing .NetCore Class Library in .NetCore Web Application <p>I have created a .NetCore Class Library which I have tested in same solution with .NetCore Console Application (and it works just fine), however when I try referencing it inside another (ASP.NET Core Web Application) solution as a <a href="https://www.nu... | <p>I finally figured out what was causing the problem. The NuGet package I created was packed with <code>nuget.exe</code> manually, and for some reason did not have the frameworks and their dependencies listed. I fixed the package by executing <code>dotnet pack</code> on the class library and this produced correcly pac... |
removing the borders of the navbar's button in Bootstrap 3 <p>I'm creating a webpage and let's say I've got this navbar: (Courtesy <a href="http://www.tutorialspoint.com/" rel="nofollow">TutorialsPoint</a>)</p>
<pre><code><nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">... | <p>Note sure why you're having difficulty...</p>
<p><code>.navbar.navbar-default, .navbar button.navbar-toggle { border: none; }</code></p>
<p>See it in a fiddle here: <strong><a href="https://jsfiddle.net/NotInUse/svwptu7v/" rel="nofollow">FIDDLE</a></strong></p>
<p><div class="snippet" data-lang="js" data-hide="fa... |
Is it possible to fetch all the results into an array using fetchAll method <p><strong>Is it possible to fill an array from the statement->fetchAll()
(PDO fetchAll)?</strong></p>
<pre><code> public function showDetails()
{
$db = ConnectDatabase::getInstance();
$connect = $db->getConnection(... | <p>Do you mean like this?</p>
<pre><code>$array = $stmt->fetchAll(PDO::FETCH_ASSOC);
</code></pre>
<p>In order to echo an ARRAY, you must use print like so:</p>
<pre><code>print_r($member2->showDetails());
</code></pre>
<p>That being said, it won't be very... pretty. Use a loop to format how you want:</p>
<p... |
Simple way to use the google contacts API from a python script <p>I'm currently trying to write a script and I would need to access my GMail contacts to finish it. I tried googling that a bit and it looks like there are a few libraries to do that, but some answers seems very old, and some others aren't that clear.</p>
... | <p>Here is what I'm using in the end :</p>
<pre><code>if arg == "--init":
gflow = OAuth2WebServerFlow(client_id='<ID>', client_secret='<secret>',
scope='https://www.googleapis.com/auth/contacts.readonly',
redirect_uri='http://localhost');
gflo... |
Django model form doesn't populate when instance=object is set <p>I'm trying to populate a ModelForm with existing data if it exists or create a new instance if not. I've read the <a href="https://docs.djangoproject.com/en/1.9/topics/forms/modelforms/" rel="nofollow">django docs</a> and several questions here on Stack ... | <p>Because you're <em>also</em> passing <code>request.POST</code>. That is supposed to contain the <em>submitted</em> data, which would naturally override the values already in the instance; but since you're doing that on a GET, the POST data is empty, so your form is displayed empty.</p>
<p>Only pass request.POST int... |
Transparent status bar and CollapsingToolbarLayout <p>I know that there thousand of questions like this one but I tried everything and I couldn't come up with a solution.
Basically I'm using activities with a NoActionBar style.</p>
<p>styles.xml:</p>
<pre><code><resources>
<style name="AppTheme" parent="Th... | <p>Nevermind, I solved creating a new style in the v21/styles to use in the activities that I want the transparency (setting the style in the manifest for each Activity):</p>
<pre><code><style name="AppTheme.NoActionBarTransparency">
<item name="windowActionBar">false</item>
<item name="wi... |
Using csv training data in tensorflow RNN <p>I am fairly new to tensorflow, and did the obligatory MNIST tutorial successfully.</p>
<p>I am trying to train a simple RNN with a set of CSV data. The data is 33 features and a binary output variable at the end (so 34 columns).</p>
<p>I have implemented a csv reader that ... | <p><code>Tensor</code> objects can not be values of <code>feed_dict</code>, it takes actual values, like <code>numpy</code> arrays, strings, etc as an input. See for example <a href="https://github.com/tensorflow/tensorflow/issues/3389" rel="nofollow">this issue.</a></p>
<p>Try to modify <code>nextline</code> method a... |
HTML5 and <table> "style" attribute <p>I´ve just started learining this new, wonderful skill (HTML5) and everything was going smooth up untill I got to able styling. OK, I know that CSS is made for that, but as it´s a little bit too early for me I use ´style´ attribute. OK, so I wrote this simple table:</p>
<pre><... | <p>you used ( â ).This is wrong.You must use ( " )
Like this</p>
<pre><code> <tr>
<td style="border:1px solid #000; witdh:100%;"> Camisetas </td>
<td style="border:1px solid #000; width:100%;"> 10 </td>
<td style="border:1px solid #000; widt... |
How to put an update notification for your android app then the users will be directed to Google Playstore? <p>For android mobile programmers I have a question. I want to put a notification for our mobile app, if the user click the update and agree to it. It will direct them to Google Playstore and then they will manua... | <p>Google Play already does this. Although the user has the option of disabling the alert.</p>
|
Create a float from two int numbers in JavaScript <p>How can I construct a float value from two whole values?</p>
<pre><code>var amountBeforeComma = 5;
var amountAfterComma = 234;
var amount = ?? //amount == 5.234
</code></pre>
| <p>There's the math way, using <a href="https://en.wikipedia.org/wiki/Common_logarithm" rel="nofollow">logarithms</a>:</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 am... |
Any hint to simplify this POST? (Java) <p>I implemented this POST operation in Jax-RS and it is working fine, however I am sure I can send the body in other way somehow. Any hint to simplify it? (<strong>By receiving an object for instance?</strong>)</p>
<p>Thanks! </p>
<pre><code>@POST
@Path("updateUser/{name}/{su... | <p>You can pass json string of object by using @consumes annotaion.</p>
<pre><code> @POST
@Path("/updateUser")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.TEXT_PLAIN)
public Response updateUser(User bean) {
usersService.updateUser(user);
return Response.ok(user).build();
}
</code... |
My Android Calculator app with swipe view with tabs is crashing <p>I have created two simple calculator apps, they are working well. I wanted to put that code in a new app (swipe view with 3 tabs) each app code in each tab. The app installing,opening & displaying the way i wanted in three tabs. I have two buttons i... | <pre><code>java.lang.IllegalStateException: Could not find method clickFun1(View) in a parent or ancestor Context for android:onClick attribute defined on view class android.support.v7.widget.AppCompatButton with id 'calcBtn'
</code></pre>
<p>You have a layout that has an <code>android:onClick</code> attribute, referr... |
How to select a class <p>I have a problem, I tried to select CLOSEST to <code>.search_box</code> element with class <code>.results</code> using jQuery and show list from PHP.</p>
<pre><code>$(".results").show().append(html)
</code></pre>
<p>This works bad, because list from PHP showed near all elements. I have few <c... | <p><code>$(this)</code> will not be same inside the ajax method' callback. Before the code which makes the call to <code>$.ajax</code> method, <code>this</code> represents the input box to which user entered some value. But inside the ajax method's success callback <code>this</code> represent the xhr object. So i sugge... |
regex for nested quotes <p>Pull-quotes are not uncommon in free range text. Suppose we want to identify pull-quotes even if they are nested within a single sentence. For example, suppose we have a string with nested pull-quotes of the form:</p>
<p><strong>one two "three four" five six "seven eight "nine" ten eleven"</... | <p>Taking Wiktor's advice I came up with the following. While not in any way elegant, this seems to do the trick:</p>
<pre><code>public List<String> parseNestedSingleQuotes(String text) {
return parseNestedQuotes(text,'\'','{');
}
public List<String> parseNestedDoubleQuotes(String text) {
return p... |
Binding tab controls with mahapps and prism - WPF <p>I am building a WPF application with <code>mahapps</code>, <code>prism</code>[modularity]. I have below <code>HomeWindow.xaml</code> code.</p>
<pre><code><Controls:MetroWindow x:Class="Project.Views.HomeWindow"
xmlns="http://schemas.microsoft.com/winfx/20... | <p>Your problem is not connected to MahApps or Prism but to how WPF works in general. In your case <code>Name</code> and <code>Content</code> are private fields and should be <strong>public properties</strong></p>
<pre><code>public string Name { get; set; }
public string Content { get; set; }
</code></pre>
<p>private... |
Detect overlapping date/time records and show which records it is overlapping with using SQL <p>The challenge here is to use SQL to detect overlapping bids using date/time and reveal which bids it is overlapping with.</p>
<p>Consider the table and records:</p>
<pre><code>----------------------------------------------... | <p>You can use <code>array_agg()</code> and a join:</p>
<pre><code>select b.person_id, b.bid_id, array_agg(b2.bid_id)
from bids b join
bids b2
on b2.person_id = b.person_id and
b2.end_at > b.start_at and
b2.start_at < b.end_at and
b2.bid_id <> b.bid_id
group by b.person_... |
Is this a recursive or iterative function? <p>I am using the SICP book which is build for Scheme/Racket (lisp family). In this exercise I had some problems:</p>
<p><em>1.11 A function f is defined by the rule that f(n) = n if n<3 and f(n) = f(n - 1) + 2f(n - 2) + 3f(n - 3) if n> 3. Write a procedure that computes f... | <p>The function that you reported is a recursive function.</p>
<p>The Wikipedia <em>Recursion</em> page sentences:</p>
<blockquote>
<p>Recursion in computer science is a method where the solution to a problem depends on solutions to smaller instances of the same problem (as opposed to iteration).</p>
</blockquote>
... |
Intrinsic Camera Matrix to OpenGL Projection. Unexpected Scaling Factor <p>I am having quite a hard time fixing some problems regarding AR projection matrices.
My base is the calibrated camera matrix. I'm trying to retrieve the projection matrix for OpenGL projection. I pretty much followed this article:
<a href="http:... | <p>Well, from the experienced impact of the near and far plane you can definetly derive, that there is something seriously wrong. What is wrong, you cannot deduct. In my case, I had a combination of different matrix math frameworks. One framework works column major, the other one row major. Therefore I transposed the m... |
JavaScript: How to convert multi-byte string array to 32bits int array? <p>I have a string which holds UTF-32 (but probably the higher 16bits will be always 0) code points. Each token is 1 of the 4 bytes of the code point of each char in a long string.
Note the bytes get interpreted as signed ints before turning into ... | <p>Since it's the nice simple UTF-32, yes, there's a simpler way: Just work in four-byte blocks. Also, the simple way to handle the possible negativity is <code>(value + 256) % 256</code>.</p>
<p>So:</p>
<pre><code>var intEncodedBytesString = "0,0,0,-31,0,0,0,-15,0,0,0,-31"; //3 char
var actualCodePoints = [];
var by... |
Jquery remove text/numbers inside of div <p>i have started learning JQuery and made script that when you press button it adds that button value into a div. I made a <strong>CLEAR</strong> text that when you press it clears the text / numbers from that div but the problem is when you press the <strong>CLEAR</strong> and... | <p><strong>Update</strong></p>
<p>So, based on your provided code on <code>jsfiddle</code>, you just need to add this: <code>count = 0;</code> after this: <code>$('.total').empty();</code></p>
<pre><code>$(".clear").click(function() {
$('.total').empty();
count = 0;
});
</code></pre>
<hr>
<p><em>I kept foll... |
How do I mock a private static final field initialized via a private constructor using Powermock and Mockito? <p>Here's my source class - </p>
<pre><code>public class ClassToTest extends AbstractSuperClass<Integer> {
private static final ClassToTest INSTANCE = new ClassToTest(); // (line 1) need to mock this... | <p>I don't believe that mocking the field is the right approach, I don't even believe that it is possible to do it as <strong>you cannot override a field</strong> only methods can be overridden which is actually how mocks do and work. Indeed mocks are only somehow proxies to which we override the methods. </p>
<p>You ... |
How do I access itextsharp methods using vbscript? <p>I have not been programming for a while and am used to com interface. I understand that itextsharp uses 100% managed code.
How do I access itextsharp 5.5.9 methods using vbscript?</p>
| <p>You don't. VBScript can't use .Net classes unless they expose a COM object. Either switch to PowerShell or find a PDF component with a COM interface.</p>
|
app.assets.get libgdx on a public static function <p>I have this function on my xml class is for puting the imagens on a texture , String ficheiro is the name of the file, SpriteCena is the sprite</p>
<pre><code>public class xml {
private static Texture TexturaCaixaDialogo;
private static Sprite SpriteCena;
private ... | <p>You are trying to get non-static field app from static method, but that is illegal as non-static variables belong to objects, not classes.</p>
<p>You have two ways to get this working:</p>
<ol>
<li><p>Make app field static <code>private static MyGdxGame app;</code></p></li>
<li><p>Make your method non-static <code... |
Create Azure API App without Swagger.io <p>I'm using Azure for the first time and wanting to make a very simple RESTful API, but trying to follow the <a href="https://azure.microsoft.com/en-gb/documentation/articles/app-service-api-java-api-app/" rel="nofollow">example using Swagger.io</a> feels like a lot of work for ... | <p>Service description stating that you can bring your API as is:</p>
<blockquote>
<p>Bring your existing API as-is - You don't have to change any of the
code in your existing APIs to take advantage of API Apps -- just
deploy your code to an API app. Your API can use any language or
framework supported by App ... |
Paycheck Calculator <p>Whenever I plug in my inputs it gives me the error: </p>
<p>Exception in thread "main" java.lang.NullPointerException</p>
<p>at Calculate.calculatePay(Calculate.java:13)</p>
<p>at Hours.main(Hours.java:30)</p>
<p>Why is this error coming up and what does it mean?</p>
<p>This is Hours.java:</... | <p><code>Didworksun</code> in Calculate is never initialized.</p>
<p><code>if (Didworksun.equals("y") || Didworksun.equals("Y")</code></p>
<p>You have to set <code>Didworksun</code> to something before you can use it.</p>
|
codenameone post request dont send argument <p>I tried to make a post rquest form codename one :</p>
<pre><code>ConnectionRequest r = new ConnectionRequest();
r.setPost(true);
r.setHttpMethod("POST");
r.setUrl(GlobalVariable.REST_HOSTNAME + "/api/newsfeed");
r.addArgument("content", mes... | <p>I'm guessing that the webservice above requires a JSON argument whereas Codename One defaults to standard post arguments (like HTML form). You can submit JSON using code such as this: <a href="http://stackoverflow.com/questions/39063909/how-to-post-json-to-a-rest-webservice-in-codenameone/39071037">How to post JSON ... |
Azure Service Fabric- Trigger Service/Actor when message arrives in Azure Storage Queue <p>I have a azure storage queue (Request Queue)that contains list of tasks to perform.
My Service fabric app consists of a public web api that enqueues tasks in this queue. There will be a stateless service which will process these... | <p>It is possible to run an Azure WebJob inside of a Service Fabric service. See an example <a href="http://stackoverflow.com/questions/39332081/webjob-sdk-not-working-when-running-in-a-service-fabric-application">here</a>.</p>
|
How to drop element from named list without assignment? <p>Suppose I have a named list like</p>
<pre><code>somelist <- list(a = 1, b = 5, c = 3)
</code></pre>
<p>I know that I can drop <code>somelist$b</code>, say, by assigning <code>NULL</code> to it:</p>
<pre><code>somelist$b <- NULL
</code></pre>
<p>I supp... | <p>You can do that removal on the fly with <code>replace()</code></p>
<pre><code>replace(somelist, "b", NULL)
# $a
# [1] 1
#
# $c
# [1] 3
</code></pre>
<p>It works for multiple variables as well ...</p>
<pre><code>replace(somelist, c("a", "b"), NULL)
# $c
# [1] 3
</code></pre>
<p>So just wrap that in <code>bar()</c... |
How can I access the 'this' field in plotOptions of highcharts <p>I am trying to achieve two things:</p>
<ol>
<li><p>Apply a green or red color based on the data point of a column chart in highcharts. Lets say if column is above 50, border is green else red.</p></li>
<li><p>I want to place a icon (if icon not possible... | <p>1) I'm not aware of a way to do this on chart creation. You can, though, loop over the series array after creating your chart to update each column's border color. Inside your loop, you'd use the <code>update</code> method after checking if the column value is above 50. Sample below:</p>
<pre><code>chart.series[i].... |
remove margins around main layout <p>I'm trying to make a tab widget in android that fills the layout width and is placed directly under the action bar of my activity but the white margins around my tab widget is preventing me from achieving my view, so could anyone please help me to remove these margins (marked by red... | <p>You should post you layout XML file, but these are most likely the default activity paddings (defined in <code>@dimen/activity_vertical_margin</code> and <code>@dimen/activity_horizontal_margin</code>). </p>
<p>Look for <code>android:padding*</code> or <code>android:margin*</code> values in your layout XML file an... |
Generate all strings within a given Hamming distance <p>I'm looking for an efficient <code>C++</code> function that given a <code>string</code> (of a given alphabet that happens to be: A,C,G,T,N) will generate all sequences that are at a certain Hamming distance from it. Ideally, the output will be a map with <code>key... | <p>The number of sequences depends on the length of original sequence and the hamming distance. If hamming distance is one, you could just scan through the sequence and change the character in every position.</p>
|
CodeIgniter safe_mailto function does not obfuscate email address <p>I've used <code>safe_mailto()</code> function in CodeIgniter 3.1.0 but it seems it does not work as it is described in documents. This is my code : </p>
<pre><code><?php
$this->load->helper('url');
echo safe_mailto('myemail@site.com');
?>... | <p>Yes it does work. Check your page HTML source.</p>
<p>Load your page with the safe mailto, then view the page source, find the link, it is not there. Javascript is decoding it for the screen, but a url scraper will not see it, as in the source it is all javascript.</p>
<p>Link coded as:</p>
<pre><code><?php ec... |
jQuery .slideToggle() repeating <p>So when I use a hover attribute to call a function that slides some text down. It works fine, But when you move your mouse over it multiple times it continues to repeat. Sliding up and down, until it equals the amount of times you moved the mouse over it.</p>
<p><a href="https://jsfi... | <p>JQuery animations on the same element queue up. That is, if you start an animation while the previous one has not yet finished, the previous animation will continue to run, and the new animation will not start until after the previous one has finished.</p>
<p>You can call <a href="https://api.jquery.com/stop/" rel=... |
What do empty braces mean in struct declaration? <p>Here is a cut-down definition of a <code>struct</code>, showing only the point at issue.</p>
<pre><code>struct Entry {
// bookkeeping record for managing solution search
std::array<std::array<bool, DIM>, DIM> filled; // which holes have been fil... | <blockquote>
<p>What do empty brackets mean in struct declaration?</p>
</blockquote>
<p><code>T object {};</code> is syntax for <a href="http://en.cppreference.com/w/cpp/language/value_initialization" rel="nofollow">value initialization (4)</a>. Without the curly brackets, the object would be <a href="http://en.cppr... |
Is there any path function in PHP for matching path mask? <p>I'm looking for a native solution for path mask matching like in console.</p>
<p>Let's say we have the path <code>/path/to/some_filename.txt</code>
Mask</p>
<pre><code>/path/*/some?file*.txt
</code></pre>
<p>will be matched.</p>
<pre><code>var_dump(test_p... | <p>Yes there is, it's called <a href="http://www.php.net/manual/en/function.fnmatch.php" rel="nofollow">fnmatch()</a></p>
<pre><code>var_dump(fnmatch('/path/*/some?file*.txt', '/path/to/some_filename.txt'));
</code></pre>
|
How to dynamically translate qt applications? <p>I have a program in two languages english and arabic, in files called app_en and app_ar. I am able to translate the program at the start in main using installTranslator in QApplication. My question is how can I change the language of the program with a push of a QAction?... | <p>the problem is you allocate your QtTranslator (Same for AppTranslator) in the stack, and it goes out of scope in the end of UpdateTranslations </p>
<pre><code>void MainCore::UpdateTranslations(QString Language)
{
//Setting the translation for the qt widgets.
QTranslator QtTranslator;
QtTranslator.load("qt_" +... |
Python paramiko: redirecting stderr is affected by get_pty = True <p>I am trying to implement an ssh agent that will allow me later, among other things, to execute commands in blocking mode, where output is being read from the channel as soon as it is available.<br>
Here's what I have so far: </p>
<pre><code>from par... | <p>Assuming you're running on a *nix system, you could try setting <code>TERM</code> in your command environment instead of creating a pty.</p>
<p>For example:</p>
<pre><code>def execute_command(self, command, out_streams = [sys.stdout], err_streams = [sys.stderr], poll_intervals = POLL_INTERVALS):
# Pre-pend req... |
Why I need to a refresh token for refreh access token <p>I'm implementing oauth automatic login via Asp.net Web API and OWIN . My question is ; Why I need for a refresh token to refresh access token .I think I can detect if access token has expired , then I can refresh it without any credential check and then I can re... | <p>A refresh token does not require going through any of the grant flows again, which requires (most of them anyway) interaction with the resource owner. The client is allowed to obtain access tokens whenever they want without the resource owner being involved.</p>
<p>For further reading and examples, check out Google... |
How to get array size within function? <p>I am having trouble finding a way to get the array size from within a function. Here is my code:</p>
<pre><code>#include <stdio.h>
void printBuff(char *buf);
int main()
{
char arr[12] = "csdlnclskjn";
printf("Array size: %d, element size: %d. ",sizeof(arr), size... | <p>so here are my answers for your questions:</p>
<ol>
<li>The array is "converted" into <code>char*</code> type when passed into the function (with the char* parameter).</li>
<li>AFAIK there is no such way. You could use <code>strlen</code> function for strings. Otherwise, you have to pass the length as parameter.</l... |
CSS/HTML Header Background Color Not Covering Entire Width of Page <p><a href="http://i.imgur.com/2La1xie.jpg" rel="nofollow">Image with visual aid for what I am trying to do</a></p>
<p>Hello,</p>
<p>I am working on designing a web page, and I am trying to get my background color to cover the entire header area. Howe... | <p>You are challenging the default margin of body. Just remove the default margin from body:</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>body
{
background-color:... |
s3.getObject inside lambda doesn't return anything <p>I have the following code, inside a lambda function, which is an Amazon echo skill:</p>
<pre><code>"AMAZON.HelpIntent": function (intent, session, response) {
var speechOutput ="Start";
// Try S3
var s3 = new AWS.S3({httpOptions: { timeout: 2000 }});
var p... | <p>You aren't waiting for the S3 call to complete. The last 3 lines in your code are executing before the <code>s3.getObject()</code> callback has been called. Try changing your code by moving those last 3 lines into the callback, like this:</p>
<pre><code>"AMAZON.HelpIntent": function (intent, session, response) {
... |
How to use nameFilters with QDirIterator? <p>In PySide, when I use <code>QDirIterator</code>, how I can filter on files by name?</p>
<p>In the documentation, it talks about the parameter <code>nameFilters</code>:</p>
<ul>
<li><a href="https://srinikom.github.io/pyside-docs/PySide/QtCore/QDirIterator.html" rel="nofoll... | <p>The <code>nameFilters</code> parameter is not a keyword argument.</p>
<p>Unfortunately, PySide never raises an error if you pass keyword arguments that don't exist, which is a very poor design. APIs should never fail silently when given invalid inputs.</p>
<p>Anyway, your code will work correctly if you use a posi... |
Split a 3D numpy array into 3D blocks <p>I would like to split a 3D numpy array into 3D blocks in a 'pythonic' way. I am working with image sequences that are somewhat large arrays (1000X1200X1600), so I need to split them into pieces to do my processing. </p>
<p>I have written functions to do this, but I am wonderi... | <p>Here are vectorized versions of those loopy implementations using a combination of permuting dims with <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.transpose.html" rel="nofollow"><code>np.transpose</code></a> and <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.reshape.html" r... |
Laravel printing @section <p>I have a problem with: 'Cannot end a section without first starting one.'</p>
<p>when I comment this:</p>
<pre><code>throw new InvalidArgumentException('Cannot end a section without first starting one.');
</code></pre>
<p>on factory.php</p>
<p>I get that the view is actually printing @s... | <p>Apparently when uploading it for some reason it was getting minified, everything in 1 line. And that caused an error in parsing. Not really sure why the code was getting minified, i'm using filezilla, sftp.</p>
|
SQL Server backup & restore daily strategy <p>We are in an environment where we need to restore the production db the size of around 600GB from daily backup to our UAT server. </p>
<p>We have currently do full backup and restore and as database grows it has slowed down the overall performance. Im not a DBA and wonder ... | <p>Some suggestions:</p>
<ol>
<li>Don't restore a daily backup every day. Your data won't change overnight if you aren't using it. </li>
<li>Use incremental backups(backups of files that have changed since the last backup) daily, and full backups(backups of everything) weekly or monthly. </li>
<li>Use a RAID for re... |
Nested namespaces for controllers in Rails <p>I refactored my rails app in a way that for every sub resources i create a controller is the according namespace. </p>
<pre><code>api/v1/app/controller/manager.rb
api/v1/app/controller/manager/user.rb
api/v1/app/controller/manager/controller.rb
api/v1/app/controller/admin.... | <p>you have mistake in controller code:</p>
<pre><code>class Api::V1::ManagerController << ApplicationController
</code></pre>
<p>must be:</p>
<pre><code>class Api::V1::ManagerController < ApplicationController
</code></pre>
<p>not <code><<</code>, should be <code><</code></p>
|
Excel VBA: Display Image from URL from another Sheet <p>need some help.</p>
<p>I have been searching around after a code in excel that would let me display and URL as an image. I have found a few good tips and codes but i'm not able to get it how i want.</p>
<p>The Image URL is located in Sheet1 B15 and i what do sho... | <p>You can use vba to insert a picture into a range</p>
<pre><code> Sub Button1_Click()
Dim myTng As Range, myPict As Picture
Set myRng = Range("B22:C36")
Set myPict = myRng.Parent.Pictures.Insert(Sheets("Sheet1").Range("B15").Value)
myPict.ShapeRange.LockAspectRatio = msoFalse
myPict.Top = my... |
watch with rsync fails with permission denied, while rsync alone just works fine <p>I'm trying to sync my files to cloud:</p>
<pre><code>rsync -avPze "ssh -i /path/to/my/key" [source] [destination]
</code></pre>
<p>this works successfully for me.</p>
<p>However, when I try to using the same command with <code>watch<... | <p>Enclosing the whole <code>rsync</code> command within quotes, does the trick.</p>
<pre><code>watch -n120 "rsync -avPze 'ssh -i /path/to/my/key' [source] [destination]"
</code></pre>
<p>Observed from <code>strace</code> output:</p>
<pre><code>execve("/usr/bin/watch", ["watch", "-n120", "rsync", "-avPze", "ssh -i ... |
Load jpg image as texture - freeimage, opengl <p>I tried to load jpg image with FreeImage Library. I used this code, but the result was only white window. I think to use this image like background and after that to load object file.</p>
<p>It`s the code, that i used:</p>
<pre><code>#include <windows.h>
#include... | <p>This is your display function:</p>
<blockquote>
<pre><code>void display(void)
{
glClearColor (0.0,0.0,0.0,1.0);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glutSwapBuffers(); //swap the buffers
}
</code></pre>
</blockquote>
<p>And what's immediately apparent is, that ... |
How can I access custom CSS property from JavaScript in Polymer? <p>I'm using Polymer and would like to be able get the value of a custom CSS property in JavaScript. </p>
<p>I thought I'd be able to do it using <code>this.customStyle["--my-style"]</code> but this was not the case (the result is <code>undefined</code>)... | <p><code>customStyles</code> is an empty object which you populate while updating the properties. If you need to retrieve any value <code>Polymer</code> has provided another api <a href="https://www.polymer-project.org/1.0/docs/api/Polymer.Base#method-getComputedStyleValue" rel="nofollow">getComputedStyleValue</a>.</p>... |
Global pointer to a statically allocated struct <p>I want a global pointer to a statically allocated struct.</p>
<p>This compiles</p>
<pre><code>struct sa{
int a, b;
char const* c;
};
struct sa* sap = &(struct sa){42,43,"x"};
</code></pre>
<p>but is it legal & portable C, or do I have to do something... | <p>Apparently, according to <a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf" rel="nofollow">http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf</a>, 6.5.2.5 Compound literals, 5:</p>
<blockquote>
<p>The value of the compound literal is that of an unnamed object
initialized by the initializ... |
Unable to Run application via Terminal but application working fine in XCode <p>I am working on <a href="http://garage.cse.msu.edu/software/lil-gp/">lilgp</a> which is a c language based tool for Genetic Programming. The problem that i am facing is that I am using XCode for the project and it is working fine and shows ... | <p>Without seeing the code, this is like repairing a car in absolute darkness. Try it.</p>
<p>However, I'll give it a try.</p>
<p>In the stack dump, it shows that you are using <code>fscanf</code> to read data from a file. Later, <code>strcmp</code> crashes.</p>
<p>The obvious idea is that <code>fscanf</code> reads ... |
Avoiding overlapping with fixed element <p>I'm creating a fixed navigation at the top of the webpage. But then the wrapper content would overlap. So I'm setting the margin-top with jQuery:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
... | <p>Set it on document ready and on window resize. For instance:</p>
<pre><code>function setWrapper() {
$('#wrapper').css('margin-top', $('nav').height() );
};
$(setWrapper);
$(window).resize(setWrapper);
</code></pre>
<p>You may also want to throttle or debounce the call to the function.</p>
<p>An alternative w... |
How to see if the two's complement of a number x can be represented in n number of bits <ul>
<li>fitsBits - return 1 if x can be represented as an </li>
<li>n-bit, two's complement integer.</li>
<li>1 <= n <= 32</li>
<li>Examples: fitsBits(5,3) = 0, fitsBits(-4,3) = 1</li>
<li>Legal ops: ! ~ & ^ | + << ... | <p>You want the log base 2. </p>
<pre><code>#include <stdio.h>
int fitsBits(unsigned int v, unsigned int n) {
unsigned int r = 0; // lg(v)
while (v >>= 1) {
r++;
}
if(r >= n) return 1;
return 0;
}
int main () {
printf(" 5,3 => %d\n", fitsBits( 5,3));
printf(" -4,... |
Why are we experiencing huge latency on one autoscaled Google App Engine instance when several others are available? <p>Our autoscaling parameters in app.yaml are as follows:</p>
<p><code>automatic_scaling:
min_idle_instances: 3
max_idle_instances: automatic
max_pending_latency: 30ms
max_concurrent_requests: 20
</cod... | <p>Idle instances aren't used to balance current load. They bridge the gap while new dynamic instances are spinning up. In your setup it might be worth trying just one or two idle instances and fiddle with min and max pending latency.</p>
<p>Pending latency is measured by how long a request stays in the queue before i... |
Add Controller using Entity Framework doesn't work? <p>I'm working on my first MVC project following along with the book C# 6.0 and .NET 4.6 framework by Andrew Troelsen and Philip Japikse.
In my solution there are two projects one for the MVC application and the other for the Data Access Library,</p>
<p>When I add a ... | <p>I commented out the <code>DatabaseLogger</code> lines in the context class, and this resolved the issue!</p>
<pre><code>//static readonly DatabaseLogger DatabaseLogger = new
DatabaseLogger("sqllog.txt", true);
public AutoLotEntities()
: base("name=AutoLotConnection")
{
//DbI... |
Are local variables not accessible within generator functions? <p>I'm learning Python and ran this piece of code in the python console earlier today:</p>
<pre><code>num = 0
def generator():
while True:
yield num
num += 1
for i in generator():
if i > 5: break
print(i)
</code></pre>
<p>... | <p>In the first code, you attempt to use num as a global variable: It is defined outside the function.</p>
<p>When the program reaches <code>num += 1</code>, you then attempt to assign to a local variable which happens to have the same name as the global that you referenced earlier. But since a local variable called n... |
How to scroll automatically StyledText (SWT) <p>I have a StyledText widget with both scrollbars.
The text inside is bigger than the client area (both scrollbars are active).
I iterate through every char from the text. </p>
<p>How to scroll automatically in order to show every char visible (char selected by iterator)... | <p>Call the <code>showSelection</code> method of <code>StyledText</code> to make sure the current selection is visible.</p>
|
Why is my function that I made getting the TypeError: f() takes 0 positional arguments but 1 was given <p>I am working with pandas DataFrames and I am adding new columns for more advanced analysis. My f function is giving me an error TypeError: f() takes 0 positional arguments but 1 was given. I can't figure out why, I... | <p>You're passing <code>f</code> as the function in <code>apply</code>. That function is called for each row in the dataframe, and needs to take the row as its parameter.</p>
<p>Note also that you're returning the function itself as the result; I'm pretty sure you meant to return <code>x</code> not <code>f</code>. Als... |
Android Studio [Install_Failed_Insufficient_Storage] <p>I have a problem with installing an apk of my app on my phone from Android Studio. Every time i tried i got this error message: </p>
<pre><code>09/10 22:40:00: Launching app
$ adb push C:\Users\pokef\AndroidStudioProjects\Runescape\app\build\outputs\apk\app-debug... | <p>Since you claim to have enough storage free on the phone (<strong>I would recommend to have at least 500MB free</strong>) As suggested also by Aenadon, the problem could be the "." at the end of the package name.</p>
<p>Google suggests to name the packages with a reverse URL. for example:</p>
<p><em>com.mycompanyn... |
Certain FormFiled not in body of email <p>Ok so I have this form made out, and it is set to go to my email. The form sends, but it only shows the bottom two fields in the emails. As you can see in the code below there are 5 fields. How can i make to where I recvieve the info for all of the field?</p>
<p>HTML:</p>
<pr... | <p>Do you see the missing concatenates/dots in here?</p>
<pre><code>// Build the email content.
$email_content = "Interested in: $option\n";
$email_content = "Name: $name\n";
^ there
$email_content .= "Email: $email\n\n";
$email_content = "Budget: $rdb_value\n";
^ and there
$email_conte... |
c++ - _mkdir giving false errors windows <p>Hi I am trying to make a directory in windows with this code</p>
<p>header</p>
<pre><code>#include <direct.h>
</code></pre>
<p>script</p>
<pre><code>int main() {
string local = "C:/Program Files (x86)/Mail";
try
{
_mkdir (local.c_str ());
... | <p><code>_mkdir</code> won't throw an exception. (This is not python or boost, or any smart middleware)</p>
<p>Read the documentation you were referring to: it returns a value. 0 is OK, -1: error, ask why to <code>errno</code></p>
<p>Don't ignore the return value. You probably have insufficient rights without UAC ele... |
How can I access properties of an object in js which starts with particular pattern? <p>How can I access properties of an object in js which starts with particular pattern?</p>
<pre><code> Object object {
s_id: 'sscdsdcksd',
name: 'xyz',
attachment_fdept: 'x.pdf',
attachment_xdept: 'y.pdf'
}
</code></pre>
<p... | <p>You can get the keys with <code>Object.keys()</code> and filter them with <code>.filter()</code>:</p>
<pre><code>Object.keys(obj).filter( key => key.startsWith('attachment') )
</code></pre>
<p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="true">
<div class="snippet-code s... |
sql searching a range of var(255) between 3000 and 3500 with out getting 3000558 <p>hello i am using sql with phpmyadmin and i have a database with barcodes i need to search ranges. i am using this code right now but it also picks up anything beyond the number given such as 30005548 or 3500777895. i am trying to only g... | <p>looks like more trial and error has proven a answer that works </p>
<p>"SELECT * from " & store & " Where Barcode between '3000' and '3500' and LENGTH(barcode) = 4"</p>
|
How to get the Image location from URI string in terms of integer <p><strong>What i have programmed</strong>: I am using camera which selects the image from camera or gallery and returns an <code>Uri</code> on <code>onActivityREsult</code></p>
<hr>
<p>I have a Uri location which i retrieved from the camera</p>
<p><c... | <p>With the help of <strong>Commonsware</strong> in one of the comments. I resolved this issue by converting back a string to URI object.</p>
<hr>
<p><code>Uri.fromFile(new File("/sdcard/cats.jpg"))</code></p>
|
New Apache setup sent email isn't always received - PHP Mail() - Sendmail <p>I recently purchased a cloud VPS service.</p>
<p>I've configured my website everything on that front is fine and well, however I noticed email isn't always being received.</p>
<p>Having inspected the log at: /var/log/maillog</p>
<p>I can se... | <p>This was resolved by simply installing and switching to postfix (Credit to Rocket_Doge_) for helping me with this!</p>
|
How to add create our custom filter in view drupal 7 <p>I am very new to drupal. I am using drupal 7. I have created a view and it is working fine. What i need to create my own custom filter in drupal view.I need to create my own custom filter in views. Please help me. </p>
| <p>There is a hook available i.e. hook_views_data_alter() It will help you to create custom filter type. Below us the code </p>
<pre><code>function my_module_views_data_alter(&$data) {
$data['node']['title_count']['title'] = 'Title word count';
$data['node']['title_count']['help'] = 'Count the number of words... |
Type 'Error' does not conform to protocol 'RawRepresentable' <p>Changing my playground code to Swift 3, Xcode suggested changing</p>
<pre><code>enum Error: ErrorType {
case NotFound
}
</code></pre>
<p>to</p>
<pre><code>enum Error: Error {
case NotFound
}
</code></pre>
<p>but now I get the title error and I ... | <p>The problem is that you've named your error type <code>Error</code> â which conflicts with the standard library <code>Error</code> protocol (therefore Swift thinks you've got a circular reference).</p>
<p>You could refer to the Swift <code>Error</code> protocol as <code>Swift.Error</code> in order to disambiguate... |
Java JFrame repaint() flickering <p>I'm learning java from the book called "Programming Video Games for the Evil Genius" by Ian Cinnamon and there's this racing game. I understand how it works but I have a problem: it's flickering everytime it refreshes <code>(Thread.sleep)</code>. How can I fix it? btw I saw a post fr... | <p>What you need is double buffering.
What is happening is the program draws one screen creating a flickering effect.
Double buffering is the concept where you draw to an on-screen canvas and then when it is ready place it on top of the previous.</p>
<p>Most Swing components have this functionality built in by using s... |
Swift / Firebase: How do I properly store a Facebook user into Firebase database when they create an account? <p>I'm trying to save users to my firebase database. I'm using a <code>FBSDKLoginManager()</code> to create an account / log in. Upon account creation, I want to store the users into my firebase database. I can... | <p>You should only update the values when the completion block "graphRequest.startWithCompletionHandler" is executed because that's when you will get your data from the Facebook!.
"usersReference.updateChildValues" needs to be inside "graphRequest.startWithCompletionHandler({ (connection, result, error) -> Void in" the... |
C decimal to binary converter (16 bits) <p>I'm trying to convert a decimal number into binary (16 bits max). My function works perfectly for up to 8 bits but when I want to print numbers up to 16 bits, it stop printing characters.
I used "int" as my data type for 8 bits but since I want to store 16 bits I'm using an un... | <pre><code>mask = 2^15;
</code></pre>
<p>does not set the value of <code>mask</code> to what you are expecting <code>2^15</code> is no 2 raised to the power 15. It is bitwise XOR of <code>2</code> and <code>15</code>.</p>
<p>You need something that is <code>1000 0000 0000 0000</code> in binary. That number will be <c... |
Loop to collect all the image properties from array of objects <p>What I am trying to do is "Get the image URLs from all numbers and display them in console" using a loop to collect all the image properties from each number.</p>
<p>What I have so far is: </p>
<pre><code>$.get("file.json", function(start){
fo... | <p>You can iterate the object using <code>Object.keys</code> </p>
<pre><code> Object.keys(start.data).forEach(function(key) {
console.log(key, start.data[key].image);
});
</code></pre>
<p>In case that you are unsure if the object has an <code>image</code> property then you can add a check to avoid errors:</p>... |
Selecting multiple hit-scoped custom dimensions with bigquery <p>I'm trying to get a list of customers who made at least one purchase on a given day. The bigquery below works when just selecting date and customer_id. However, city always returns null, though I know the data exists.</p>
<p>Do I need to use a different ... | <p>Don't have any data to test again, but visually assessing - below should work for you </p>
<pre><code>SELECT
date,
MAX(CASE WHEN hits.customdimensions.index = 5
THEN hits.customdimensions.value END) WITHIN RECORD AS customer_id
MAX(CASE WHEN hits.customdimensions.index = 50
THEN hits... |
How does throwing an error on submit allow the form to POST <p>I have a multi-step form which steps through using POST requests to pass state to each controller action. </p>
<p>New > Preview > Checkout > Create</p>
<p>Preview and Checkout are POST requests do not impact the database so form resubmission is perfectly ... | <p>Just use the <a href="http://www.w3schools.com/jsref/event_preventdefault.asp" rel="nofollow" title="preventDefault() method">preventDefault()</a> method <br /> <br />
<strong>HTML</strong></p>
<pre><code><form name="form" onsubmit="validate();">
</code></pre>
<p><strong>Script</strong></p>
<pre><c... |
How to dynamically load and call a function in a BPL package <p>It seems pretty straightforward but the code below doesn't work.</p>
<p>BPL:</p>
<pre><code>procedure DoSomething();
begin
LogEvent('Did');
end;
exports
DoSomething;
</code></pre>
<p>Main EXE:</p>
<pre><code>procedure CallModuleFunc;
var
H: THan... | <p>After hours of searches and trial and errors, I realized it had to be about something I do or did differently. The problem was that my very first version of mymod.bpl was put into Delphi's default BPL output directory (which had no export, no DoSomething() at all). Then, I had changed the BPL output directory to my ... |
Calculating precentage of a column with bool using two tables <p>Could somebody please help me create a view in SQL server to get a percentage in a new column. For example I have two tables as below.</p>
<pre><code>Table 1---> Subject | Table 2---->Exam
|
SubjectID ... | <p>Here:</p>
<pre><code>SELECT
Subject.SubjectId,
Subject.SubName,
(AVG(CONVERT(decimal,Exam.Result))*100) AS PassPercentage
FROM Subject
LEFT JOIN Exam on Subject.SubjectId = Exam.SubjectId
GROUP BY Subject.SubjectId, Subject.SubName
</code></pre>
<p>You can round percentage result (2 or without decimals) and ad... |
Button styles in Android <p>When I place a button in a layout, it has a standard gray background. However I want to make it more like the kind of button you see in the Dialogs where it's a background-less button (e.g. the white buttons with text).</p>
<p>Like this</p>
<p><a href="http://2.bp.blogspot.com/-WJfw35GAAPE... | <p>try this</p>
<pre><code>android:background="@android:color/transparent"
</code></pre>
|
Defining functions of a class in .cpp of a Dynamic-link Library <p>Recently I started working with c++ and I was wondering.
If I'm working on DLL, I first define all the classes and and their functions in the header and then write their functionality in <code>.cpp</code> file in the same project.
But what if I instead ... | <p>You have to declare your classes and functions in your header. That being said, you can use </p>
<p><code>using namespace <your_library_class>;</code></p>
<p>And then everything in your source file in <code><your_library_class></code> won't need to use <code><your_library_class>::</code> before ... |
Yii2 Select2 - selected value on update - junction table (many to many) <p>I am successfully inserting new rows in my junction table (userlocations) on action create and I successfully update them on action update but the problem is on ation update the location_id field is always empty. It should retrieve the location_... | <p>For multiple location select, use the plugin code as given below.</p>
<pre><code> <?= Select2::widget([
'name' => 'Userlocations[location_id]',
'value' => $location_ids, // initial value
'data' => ArrayHelper::map(Locations::find()->all(), 'id', 'name'),
'options' =>... |
How can I make the wheel scrolling distance 100% of page height? <p>Hey guys I have a page and I'm trying to capture the mouse wheel so when someone is at the top and scrolls just once the page scrolls to the 100% of what the browser shows sorry I have no idea how to explain this just visit <a href="https://mega.nz" re... | <p>Not a complete implementation, by any stretch, but should be enough to get you started.</p>
<p>HTML</p>
<pre><code><div id="head">Your top page...</div>
<div>All other content...</div>
</code></pre>
<p>CSS</p>
<pre><code>#head {
height: 100vh;
}
</code></pre>
<p>Javascript</p>
<pre><c... |
entry with new window <p>I want a new window appearing with simple entry to put one line of text and button ok to set value of variable. When I use simple entry command, it appear in my main window. I need something like tk_dialog with option to put text to some variable. Is there any predefined tk_* function?</p>
| <p>you have to create another window with tk toplevel command</p>
<pre><code>% set top [toplevel .top]
.top
% focus $top
% grab $top
% set entryBox [entry $top.ent -textvariable x]
.top.ent
% pack $entryBox
% set btn [button $top.btn -text "Click Me"]
.top.btn
% pack $btn
</code></pre>
|
Add an alias for a property in JavaScript <p>I think this is fairly simple,</p>
<p>Is there a simple way to add a secondary name for a property (I think this one is String specific â I'm not sure), i.e.,</p>
<pre><code>c = length // this line pseudo code
'hello world'.length // returns 11
'hello world'.c // t... | <p>You can access the property like so:</p>
<pre><code>'hello world'[c]
</code></pre>
<p>This does the same thing as <code>.length</code> if <code>c = 'length'</code> as a string.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre cl... |
lambda is replace with λ in racket-mode emacs <p>For example: <code>(define f (lambda (x) (* x 2)))</code> when I wrote <code>lambda</code> and pressed space, the word "lambda" is replaced with λ. How can I disable this replacement?</p>
| <p>Run this</p>
<p><code>M-x global-prettify-symbols-mode</code></p>
<p>to disable it for the current session. Or put this in your <code>init.el</code></p>
<p><code>(global-prettify-symbols-mode -1)</code></p>
<p>to disable it completely. It will kill the entire prettifying behavior, see <a href="http://stackoverfl... |
Heroku static site not loading the page data when switching to new pages <p>Created simple static site on Heroku using this: <a href="https://devcenter.heroku.com/articles/static-sites-ruby" rel="nofollow">https://devcenter.heroku.com/articles/static-sites-ruby</a>.</p>
<p>When I open the pages locally in my browser, ... | <p>What exactly will u like to do? do you wish to create a Rails project that you can host on Heroku?
If yes there is a better an easier way to do from your local machine using a <a href="https://github.com/heroku/rails_12factor" rel="nofollow">gem</a> created by heroku. If you need more help with the steps on pushing/... |
Get number of rows with values less than current row's value <p>My mysql table is:</p>
<pre><code>Id | value | count_of_past_lower_values
1 | 120 | 0
2 | 210 | 1
3 |150 | 1
4 |140 | 1
5 |200 | 3
</code></pre>
<p>Given id and values, I have to update 3rd col. I made a query using <code>SU... | <p>Issuing a self-left-join with conditional sum would suffice:</p>
<pre><code>select
a.id,
a.value,
sum(case when a.value > b.value then 1 else 0 end) as count_of_past_lower_values
from yourtable a
left join yourtable b on a.id > b.id
group by a.id, a.value
order by a.id
</code></pre>
<p>Result</p>
<... |
New vs old PayPal checkout pages, still random selected? <p>First of all, I know that this issue has been raised a few times on Stack Overflow the past couple of years. The problem is that sometimes I get the new PayPal checkout pages and sometimes I get the old pages. </p>
<p>I've made two test accounts in my sandbox... | <p>I believe it's based off of whether or not you're already logged into a PayPal account.</p>
<p>When ever I was logged into my merchant account, I would always get logged out and redirected to the old site. However if I was logged into my personal account, I was shown the the "new" design and asked to login first to... |
how can i correct this Regex phone number extractor in python <p>The results i'm getting when i run this after copying a set of UK phone numbers to the clipboard are coming out in a very bizarre kind of way.
(i have imported both modules before you ask)</p>
<pre><code>phoneRegex = re.compile(r'''(
(\d{5}|\(\d{5}\)... | <p>I see three issues:</p>
<ol>
<li><p>the python code joins the two parts of the phone number together with a <code>-</code> and then adds a space and the third part again:</p>
<pre><code> phoneNum = '-'.join([groups[1], groups[3]])
if groups[3] != '':
phoneNum += ' ' + groups[3]
</code></pre>
<p>Sin... |
Corona sdk display multi line notification <p>I have some notifications in Corona. The problem is, the text is too big, and I would need to show bigger (multi line) notifications, like the Gmail app, for example. Here is what the notifications look like now:
<a href="http://i.stack.imgur.com/KpmDv.png"><img src="http:/... | <p>The notifications by default are not provide multilines.</p>
<p>To use several lines, you have to <code>NotificationCompat.BigTextStyle()</code> in Java (<a href="http://stackoverflow.com/q/16266684/1979882">sample</a>) or use your custom or native custom View (<a href="http://stackoverflow.com/a/16168704/1979882">... |
Using Multiple SSL Cert on one Google Cloud Instance <p>Okay so I have multiple domains on one GCE Apache Web Server <code>example1.com</code>,<code>example2.com</code>, and <code>example3.com</code>. Each Domain has there own SSL certificate created and on the web server. I'm trying to figure out how I can do this. ... | <p>If you webserver is properly setup to handle multiple SSL certs on the same interface (SNI), you could just allocate an external IP to the instance and serve it from there.</p>
|
Save Video Using AVFoundation Swift <p>Hi I followed a course by Jared Davidson to create a custom camera view and save pictures using AVFoundation.
<a href="https://www.youtube.com/watch?v=w0O3ZGUS3pk" rel="nofollow">https://www.youtube.com/watch?v=w0O3ZGUS3pk</a></p>
<p>However I would like to record and save videos... | <p>You can save record your video to file by creating and adding an <code>AVCaptureMovieFileOutput</code> to your capture session, and making your <code>ViewController</code> conform to the <code>AVCaptureFileOutputRecordingDelegate</code>.</p>
<p>This example records 5 seconds of video to a file called "output.mov" i... |
If value = 0000 Insert and set value with max()+1 <p>I need to get the maximum value +1 for a field, if that filed as the 0000 value.</p>
<pre><code>IF
(acc_id = 0000)
FROM
crm_accounts;
INSERT
INTO
crm_accounts(acc_id)
SELECT MAX
(acc_id) + 1
FROM
crm_accounts;
</code></pre>
| <p>I think you're looking to do an <code>UPDATE</code> statement...</p>
<p>This should get it done for you:</p>
<pre><code>SELECT @id := MAX(acc_id) FROM crm_accounts;
UPDATE crm_accounts
SET acc_id = @id := @id + 1
WHERE acc_id = 0000;
</code></pre>
|
android soft keyboard: onReceiveResult fire with RESULT_SHOWN following immediately by RESULT_HIDDEN <p>I want to detect when the soft keyboard is show and hidden. For this i do like this :</p>
<pre><code>public class ALEditText extends EditText {
private ALSoftInputListener mSoftInputListener;
private static cla... | <p>I found the problem - it's because I forgot the break in the case.</p>
|
Access a local variable from one method a different method on a form <p>I have a very simple form that produces a Datagridview with 4 columns. No problem generating the form. Only the last column can be edited. After editing, I want to hit the OK button and join elements of the list in the last column into a string.... | <p>It wouldn't be too difficult to move <code>current</code> to be a field-level variable, but that isn't the best option. Now that C# has lambdas in the language, you can basically inline the event handler and remove the <code>OK_button_Click</code> method entirely. This kind of encapsulation is a more robust approach... |
Regex to filter characters in middle and end of string <p>I am trying to only select strings which have '300' in the middle of the string and '.txt' at the end using regular expressions. What would be the correct regex to use?</p>
| <p>Try this:</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 regexp = /^.*300.*\.txt$/
console.log("Abc 300 adef.txt".match(regexp))</code></pre>
</div>
</div>
</p>
|
Reading from file, but I'm not able to print the last line? <p>I'm attempting to read in from a file using fscanf (teacher's pretty much requiring this, I personally would use getline or something else) and I'm attempting to read until the end of the file - my code seems to work fine, except that it doesn't seem to pri... | <p>After the last line is read, the File <em>is</em> at the end. Your function still returns EXIT_SUCCESS (and the last line), but you additionally check for EOF: <code>... && !feof(infile)</code>, so processing ends before the last line is printed.</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.