input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Java- Convert String Value to Integer <p>I am getting the json data from an API as String but I want to store it in DB and use it as integer. For example I am getting A=15K or 15M but I want 15000.</p>
<p>Here is my class</p>
<pre><code>public class JsonRestApi {
public JsonRestApi() {
try {
S... | <p>Replace K, M etc. with the appropriate number of zeroes.</p>
<pre><code>String yviews = (String)jsonObject3.get("Views");
yviews = yviews.replace( "K", "000").replace( "M", "000000");
System.out.println(yviews);
</code></pre>
<p>Edit: If your number of views can have floating point numbers, you can use the followi... |
Eclipse Code Refactoring - Junits <p>I want to refactor exisiting code</p>
<pre><code>String a = "Hi";
assertEquals(a, "Hi");
</code></pre>
<p>to</p>
<pre><code>String a = "Hi";
assertEquals("Hi", a);
</code></pre>
<p>I have like 2 million assert statements all over my project that need to be refactored. Are they a... | <p>You could try the following:</p>
<ol>
<li>Copy <code>org.junit.Assert.assertEquals</code> methods into a new class, let's say <code>temp.TempAssert</code></li>
<li>Search and replace <code>import static org.junit.Assert.assertEquals;</code> with <code>import static temp.TempAssert.assertEquals;</code> in all files<... |
Push local branch to remote <p>I have created local branch:</p>
<pre><code>git checkout -b tmp1
</code></pre>
<p>Now I would like to push this branch to server:</p>
<pre><code>git push remote_tmp1 tmp1
</code></pre>
<p>Got error:</p>
<pre><code>fatal: 'remote_tmp1' does not appear to be a git repository
fatal: Cou... | <p>The git push syntax is:</p>
<pre><code>git push <remote-name> <branch-name>
</code></pre>
<p>Therefore, replace your <code><remote-name></code> with the name of your remote (probably origin if you cloned from it).</p>
<p>If you don't know its name, just like them using <code>git remote</code></p... |
MYSQL and PHP where any related row contains string <p>I am having a small issue with MYSQL relations.</p>
<p>There is for every 1 value in table 1, there can be a multitude of values (0+) in table 2. </p>
<p>I am able to get all the data correctly, however, the issue comes when some values in table 2 differ, specifi... | <p>So, if you understand you correctly, if you have an account, that has a corresponding <code>qs_quotationinformation.takenup</code> value of 1, then the query should return "No" for <code>accounts_cstm.nolongercontact_c AS NLC</code> for <strong>all</strong> records with the same account id, regardless of the value o... |
SparkCLR java.sql.SQLException: No suitable driver <p>Mobius 1.6 Connect Oracle with the following command</p>
<pre><code>C:\spark-clr_2.10-1.6.200\runtime\scripts\sparkclr-submit.cmd --master local --jars C:\oracle\lib\ojdbc7.jar --exe WinFormMobius.exe D:\Mobius\Debug
</code></pre>
<p>[2016-09-29T08:31:24.3019737Z]... | <p>Thanks for @skaarthik suggestion.
The C# Code is</p>
<pre><code>var properties = new Dictionary<string, string> { { @"driver", @"oracle.jdbc.driver.OracleDriver" } };
</code></pre>
|
FastMap size > 0 but only one element <p>I use FastMap <code>shared()</code> in a multithread service. Sometimes map crash. It show <code>size > 1</code>, but when I try get an element I get <code>null</code>. I always get only element at first position and other elements is <code>null</code>. I try get <code>value(... | <blockquote>
<p>Sometimes map crash. It show size > 1, but when I try get an element I get null.</p>
</blockquote>
<p>To really answer this question, you are going to have to provide more details about the problem and probably provide some code samples. Specifically, you should provide an exceptions that you are se... |
HIVE - ALTER TABLE my_table CLUSTERED BY (my_field) INTO 32 BUCKETS - apply retroactively? <p>Is there a way to reorganize/reformat the data to be bucketed retroactively using the above statement?<br>
Insertion being made after the ALTER statement are indeed being bucketed.. but I want the data to be changed backwards ... | <p>These steps should do the trick:</p>
<ol>
<li>Create a new table with the right structure</li>
<li>Insert all your data into it</li>
<li>Replace the old table with the new table</li>
</ol>
<p>Maybe there is a way to mess around with the existing table, but these steps should be safer than that.</p>
|
Spring Security error in displaying custom page <p>I am working on Spring Security Integration,
My application with inbuilt security page works fine.
But for custom login page its giving error</p>
<pre><code>The localhost page isnât working
</code></pre>
<p>Here is my code for reference</p>
<p>inside spring-securi... | <pre><code>shazin its shows neither exception nor 404 its displays message saying, localhost redirected you too many times..that's it. thanks for your reply
</code></pre>
<p>That is because you have your <code>@RequestMapping</code> value and .jsp name as <code>login</code>. Change at least one like the following.</p... |
Javascript - generic function to display caller function name <p>I'm trying to create a generic function ('displayFuncName()' for example) that I could call in different function definitions (for example 'foo()'), so it will console.log the function name ('foo' in this example).
something like:</p>
<pre><code>var disp... | <p>Since <code>arguments.callee</code> throws an error in strict mode and <code>arguments.caller</code> is no longer supported, maybe something like that will be a better option for you:</p>
<pre><code>Function.prototype.logName = function() {
var fn = this;
return function() {
console.log(fn.name);
... |
how to get sql minsize property from file header via powershell? <p>I am interested in some way to grab the smallest size a sql log file can shrink to.
from reading this blog: <a href="http://social.technet.microsoft.com/wiki/contents/articles/22661.sql-server-misleading-database-initial-size-label.aspx" rel="nofollow"... | <p>To get all Databases and their initial size, via PowerShell, on some instance you can use this:</p>
<pre><code>Import-Module SQLPS -DisableNameChecking
$instance = 'SERVER\INSTANCE'
$results = @()
try {
$sqlres = Invoke-SQLcmd -Server $instance -Database master 'SELECT [name],(size * 8 / 1024) InitialSize FR... |
Hexagonal architecture with repository <p>I am trying to understand hexagonal architecture through an example of <code>Repository</code>.
In this setup I have the following layers: framework (infrastructure) -> application -> domain.</p>
<p>I have <code>User</code> in the domain part, lets say I want to validate the <... | <p>I think that the confusion you're facing comes from the fact that you are trying to approach an already existing Three-tier application from an Hexagonal Architecture point of view.<br/>
Let's go simple.<br/>
Let's forget for a moment of what the "Application Layer" it is.<br/>
You have your hexagon that, if I under... |
Get rid of unwanted lines from file <p>In bellow example ^[ - are escape characters to stain terminal output (just type ctrl+v+[).</p>
<p>1) My file:</p>
<pre><code>-------- just to mark start of file ----------
^[[1;31mbla bla bla^[[0m
^[[0;36mTREE;01;^[[0m
^[[1;31m^[[0m
^[[1;31m^[[1;31mapple tree:^[[0m^[[0m
^... | <p>The simplest and, probably, the stupidest solution that I have came up with:</p>
<pre><code>[steelrat@archlinux ~]$ awk '/TREE/ {f=$0;p=1} !/^ *$/&&!/TREE/ {if (p==1) {print f; p=0} print $0}' my_file
-------- just to mark start of results ----------
^[[1;31mbla bla bla^[[0m
^[[0;36mTREE;01;^[[0m
^[[1;31m^... |
How to get unique month from two arrays in a foreach loop <p>How can I get unique months from two arrays?
I have two arrays:</p>
<pre><code>$ar1 =Array
(
[0] => Array
(
[0] => 1
[month] => 1
[1] => -40964.49999999999
[total] => -40964.49999999999
)
[1] => Arra... | <p>Use array_diff, but since your array is multidimensional you'll need array_udiff where you provide the comparison function .</p>
<p>See the answer below for an example</p>
<blockquote>
<p><a href="http://stackoverflow.com/a/11822305">http://stackoverflow.com/a/11822305</a></p>
</blockquote>
|
multi bootstrap modal in one page issue <p>I have several card in a page, I rendered all of them with a loop, I want when user clicked on each one , related modal show to user, I implement that with following snippet</p>
<pre><code> {% for i,item in node.field_what_you_will_build %}
<div... | <p>I found the solution for this issue, the problem occur because Modal markup was inside the element cause modal triggered on click, I mean the the problem is </p>
<pre><code><div class="prj-box " data-dismiss="modal" data-toggle="modal" data-target="#projectcard-{{ i }}">
<div id="projectcard-{{ i }}... |
C# TreeView, event when childnode is selected <p>I have a question concerning TreeViews and their Nodes in C#.</p>
<p>What I currently try to do. I have a TreeView and next to it a TableLayoutPanel. When I click of the Nodes, I want to call a specific Method and display the Data
in the TableLayoutPanel. Displaying the... | <p>Use the Tag Property , put an ID in the tag property that is unique for every node</p>
|
How to unrender/detach/remove ZingChart library from specific div? <p>I used below code to <strong>render zingchart</strong> which works fine.</p>
<pre><code>zingchart.render({
id : 'myChart',
data : myConfig,
height: 400,
width: "100%"
});
</code></pre>
<p>Now in some occasion I want to <strong>u... | <p>Full disclosure, I'm a member of the ZingChart team.</p>
<p>Deleting the DOM element the chart is attached to will not delete the chart from memory. At this point you will have something along the lines of a dangling reference. You achieve proper destruction using our api method <a href="https://www.zingchart.com/d... |
C++ Socket Buffer Size <p>This is more of a request for confirmation than a question, so I'll keep it brief. (I am away from my PC and so can't simply implement this solution to test).</p>
<p>I'm writing a program to send an image file taken via webcam (along with meta data) from a raspberryPi to my PC.</p>
<p>I've w... | <p>This most likely has nothing to do with the socket buffers, but with the fact that <code>recv()</code> and <code>send()</code> do not have to receive and send all the data you want. Check the return value of those function calls, it indicates how many bytes have actually been sent and received.</p>
<p>The best way ... |
share data between iOS 10 Widget and Apple Watch <p>Let's say we have running widget on iPhone and app on Apple Watch at the same time. How to inform Apple Watch that we have made any changes to the model with widget?
App Groups are not longer supported by Apple Watch so we can't use MMWormhole nor Realm to share datab... | <p><a href="https://github.com/mutualmobile/MMWormhole#communication-with-watchconnectivity" rel="nofollow">MMWormhole apparently also supports the <code>WatchConnectivity</code> framework</a> of watchOS 2, so you should still be able to use it to send data.</p>
<p>Unfortunately, according to <a href="https://forums.d... |
Unable to apply UIBezierPath in CellForRowAtIndexPath before scroling the TableView <p>Using This code I got My Profile Picture in Proper D shape but after When i scrolling the tableView not when we are entering in to view controller.</p>
<pre><code>UIBezierPath *maskPath;
maskPath = [UIBezierPath bezierPathWithRou... | <p>Use D shape mask image with below code it may be work for you </p>
<p>CALayer *mask = [CALayer layer];</p>
<p>mask.contents = (id)[UIImage imageNamed:@âyour_D_ShapeMask.png"].CGImage;</p>
<p>mask.frame = CGRectMake(0, 0, 100, 100);</p>
<p>[cellimg.layer setMask:mask];</p>
|
Short cut Key for .axml code format in Xamarin Studio(Mac) <p>I find on SO. and Google but i couldn't find the solution. Whenever i write the code in <code>.axml</code> file the format is not well means the code putting space to it's format. I write code this format code is generated.</p>
<p><strong>Styles.Xml</strong... | <p>Are we talking about xaml or xml files? Try to press <code>Control + K</code>, keep pressing <code>Control</code> and press <code>D</code> (without <code>K</code>)</p>
|
How to find the documentation for Interpolation? <p>I'm trying to understand the second line in this code</p>
<pre><code>var line = d3.svg.line()
.interpolate(function(points) { return points.join("A 1,1 0 0 1 "); })
.x(function(d) { return x(d.x); })
.y(function(d) { return y(d.y); });
</code></pre>
<p>(... | <p>That string seems to be an SVG elliptical arc command:</p>
<p><a href="https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands" rel="nofollow">https://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands</a></p>
<p>So instead of calculating interpolating points, connecting the dots is apparently l... |
Dynamically adjust the height of a Select/Dropdown form field? <p>As we all know, forms are notoriously troublesome to style, especially the select menus. I've been given a particularly troublesome form to build which I've already run into trouble with. </p>
<p>I've got a select dropdown field with multiple options th... | <p>Add this to your css:</p>
<pre><code>option{
width: 100%;
}
</code></pre>
|
AngularJS Logout using $http then redirect <p>Right so I have a little dilemma here :). </p>
<p>I'm working on a project that is built with angularjs and Laravel. Login is done with laravel which is out of AngularJs "scope", should I say. </p>
<p>So in Front End I do not see that page. </p>
<p>What I'm trying to do ... | <p>This <code>location.replace</code> should solve your issue.</p>
<pre><code>$rootScope.logout = function () {
$http.get('/logout', function (response) {
console.log('redirect');
var origin = $window.location.origin;
$window.location.replace(origin + '/login');
});
};
</code></pre>
<... |
Bash - extract block of lines given keywords <p>I'm a beginner of bash.</p>
<p>Suppose I have a text file <code>sample.txt</code>, which contains</p>
<pre><code>mercury
venus
earth
mars
jupiter
saturn
uranus
neptune
pluto
</code></pre>
<p>and two keywords <code>earth</code> and <code>saturn</code>.</p>
<p>The gold ... | <p>You can use either awk or sed:</p>
<p>Using awk: </p>
<pre><code>awk '/earth/,/saturn/' sample.txt
</code></pre>
<p>Using sed:</p>
<pre><code>sed -n '/earth/,/saturn/p' sample.txt
</code></pre>
|
Bring View on top of Modal using zIndex style with React-Native <p><code>zIndex</code> has been introduced recently to React-Native to change the position of a <code>View</code> in the stack of layers.</p>
<p>Although, I'm not able to bring a <code>View</code> on top of a <code>Modal</code> component.</p>
<p>My code ... | <p>You have to change the z-index of the modal not the one of the view (and a z-index of value <code>1</code> would suffice):</p>
<pre><code>render() {
return (
<View>
<Modal visible style={{ zIndex: 1 }}>
{props.children}
</Modal>
<View>
<Text>Load... |
Am I looking at multithreading the wrong way? (Java) <p>For the past few weeks now I've been studying Concurrency(Multithreading) in Java. I find it difficult and rather different than anything I've encountered in the Java language so far(or in programming in general). Often I have to reread and reread over and over ag... | <p>Concurrency is a simple concept, really - you have several separate paths of execution, which can interact with each other. The stuff you mentioned, like syncing, blocks, waits and so on are technical details, tools.</p>
<p>I would suggest trying to do some coding :-) Come up with a multi-thread program idea and co... |
Firebase Ionic code implementation <p>I'm really stuck with this code and can't find the solution. I have created an Ionic app with connection to Firebase and my auth is working fine; can pass the data, but I can't see how should I pass the following code correctly. Form Structure: </p>
<p><img src="http://i.stack.img... | <p>It looks like you forgot to add 'Products' as a dependency in the controller you were working on.</p>
<p>Also you should try Firebase three-way-binding:</p>
<pre><code>.factory("Products", ["$firebaseObject", "$rootScope",
function($firebaseObject, $rootScope) {
return function() {
// crea... |
execute windows code in visual studio 2015 with xamarine plugin <p>I am newbie to the xamrine platform.</p>
<ol>
<li>I have source code which is developed in c# for windows develop in visual studio 2013</li>
<li>I have visual studio 2015(Profession) in my system 1st time.</li>
<li>Want to check my windows code is comp... | <p>You can absolutely reuse your existing C# code with Xamarin project. However, you will need to recompile the code to target Xamarin profiler, unless you're using Portable Class libraries</p>
<p>You can read more about code sharing options here: <a href="https://developer.xamarin.com/guides/cross-platform/applicatio... |
How do i get the status of my response when using fetch in react-native? <p>I am making Log In page for my react native application. My api sends different response when my username and password are valid and invalid. So I want to track and save the status of my response in some state variable and then later perform fu... | <p>As far as I understand you want to know the http status code of your fetch request.</p>
<p>Usually your response object includes a "status" property. So you should be able to receive the status code by using this:</p>
<pre><code>response.status
</code></pre>
<p>In case of a successful request this will return 200... |
how to fix the last div container on the bottom of the sidebar <p>i build a basic sidebar, with an navigation list inside. What i'm trying is to get the last div container <code>.sidebar-footer</code> on the bottom of the sidebar. When i gave the class a position absolute, it's overlaying over the list item, what shoul... | <p>Give your footer class this styles </p>
<pre><code>.sidebar-footer{
height: 50px;
position: absolute;
width: 100%;
bottom: 0;
list-style-type: none;
padding-bottom:5.5em;
}
</code></pre>
|
How to set data from ViewController to UITableView custom Cell <p>I have been trying to pass data from Viewcontroller to UITableView custom cell using custom delegate.There are answers for passing data from Custom cell to ViewController but none for the viceversa .Can anyone suggest me with some idea or sample code.</p... | <p>I am not sure if this is what you mean, but you can set the data in <code>function tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell</code></p>
<p><strong>For example:</strong></p>
<pre><code>func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) ->... |
Asynchronous Messaging Protocol compatibility outside Python (and twisted) <p>The Asynchronous Messaging Protocol is a simple protocol in python-twisted. I have a fairly complete app (python, twisted, kivy) using it. The client-server architecture implements a view-controller sort of relationship, with allmost all busi... | <ol>
<li><p>This isn't entirely accurate. Twisted just happens to use it the most. Other languages make use of AMP, it's just that AMP hasn't become very popular given popularity of other more robust options like AMQP (ZeroMQ, RabbitMQ, WebsphereMQ, etc).</p></li>
<li><p>AMP is about as simple as it can get. Also, it's... |
How to use volume keys to open a activity when device is locked? <p>Hi all i want make app which run over volume key for example when we press the volume down key it turn camera open( when device is locked) similarly i want the same in my app.</p>
| <h1>I don't think that's possible</h1>
<p>Those functionalities come from the factory OS you have, not from specific apps. The <em>only</em> way that could be possible is by rooting the device, in which case you may be able to listen to physical button clicks <strong>and</strong> modify their behaviour.</p>
<p><a hre... |
Lotus Note Mail signing using Java API via DIIOP <p>We are using DIIOP to send mail in a Java program, but when the recipient open the mail, although there is "This message is digitally signed" , there is a warning message on the status bar "This Document has been altered since the time it was signed! Intentional tampe... | <p>You can't sign email messages using the Notes Java API over DIIOP. </p>
<p>Encryption works because it requires the recipient's public key, which is in the Domino Directory on the server and is accessible to the API code which is remotely accessed on the server via DIIOP.</p>
<p>Digital signature, on the other han... |
how to get value from select query? <p>How to get value from select query without using while loop while we know that output is defiantly only one record</p>
<pre><code>$sql = "SELECT id FROM MyGuests";
$result = $conn->query($sql);
while($row = $result->fetch_assoc())
{
echo $row["id"];
}
</code></p... | <p>just delete the while loop!</p>
<pre><code>$sql = "SELECT id FROM MyGuests";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
echo $row["id"];
</code></pre>
<p>are you using mysql_* functions by any chance? please switch to PDO as soon as possible.</p>
|
How to enable anchor tag on a table row? <pre><code><div class="table-responsive">
<table class="table table-bordered">
<tbody>
<tr>
<th>head1</th>
<th>head2</th>
<th>head3</th>
... | <p>You can't add <code><a></code> tag in a <code><table></code>.
You can only add content in <code><td></code> tag.</p>
<p>Try to add a <code>onclick</code> attribute with <code>document.location.href+='#anchor'; return false;</code></p>
<p><strong>Example</strong></p>
<p><div class="snippet" data-... |
Swift 3 Custom Cell Changing on scroll <p>Sorry, I know this is a repeat question, but I have not been able to understand the answer from the other questions.</p>
<p>My custom cell is changing on scrolling. I know it is due to the reuse identifier, but I don't know how to fix it. Any help would be appreciated. I'm usi... | <p>so like the comments says the problem was the wrong vissibly setting of pokemon1 in every if. </p>
<p><strong>edit</strong></p>
<p>well because of the downvote i will be more precice:
In every if condition u set the pokemon1 to vissible. You need to use the Pokomen that your setting as image.</p>
<p>have fun cod... |
How to use num2date/ date2num with Tkinter mainloop() <p>I have this code inside a tkinter <code>mainloop()</code>:</p>
<pre><code>self.raw_start_date = num2date(date2num(dt.datetime.strptime(self.end_date, "%Y-%m-%d")) - self.period)
self.start_date = self.raw_start_date.strftime("%Y-%m-%d")
</code></pre>
<p>I get t... | <p>This is an artifact of subclassing <code>tkinter.Tk</code> and overriding the <code>__init__</code> method without ever calling <code>Tk.__init__</code>:</p>
<pre><code>import tkinter
class Application(tkinter.Tk):
def __init__(self):
"do out stuff, forget to call Tk.__init__(self) !"
pass
ap... |
which path should be given in shell comand? relative path or diretcory path? <p>For eg: I am executing a shell command:</p>
<pre><code>"ffmpeg -i input.flv -ss 00:00:14.435 -vframes 1 out.png"
</code></pre>
<p>here input.flv path should be like -> images\input.flv or D:\wamp\www\proj_name\public\images\input.flv ?</p... | <p>This depends on your current working directory. Generally speaking giving absolute paths is better as they are not ambiguous. </p>
<p>If your path is relative to your working directory (where you call the PHP script) it will work. However sometimes in production that value changes, leading to weird errors. If you c... |
How to write a sql statement to split the rows into several parts and sum the time by part <p>I'm using sqlserver. </p>
<pre><code> Table A:
-------------------------------------------------------
| id | starttime | endtime |
------------------------------------... | <p>This is tricky, dealing with times and datetimes and overlaps. Here is one method:</p>
<pre><code>select a.id, b.partno,
datediff(minute,
(case when b.dayHourStart > cast(a.starttime as time) then b.dayHourStart
else cast(a.starttime as time)
end),
... |
Getting wrong bytes order when using struct on network byte order <p>I am writing C code to read data from binary file written network byte order using GCC C compiler in Windows (codeblocks IDE) x64 intel PC. </p>
<p>The data bytes are following:</p>
<pre><code> 00 16 54 43 41 54 20 20 00 AA 00 00 00 00 00 00 B8 60 4... | <p>If you find a <code>struct</code> layout that completely matches some binary data you might happen to find somewhere, that's more or less pure luck (and might break with the next revision of your compiler). </p>
<p>C doesn't make any guarantee on struct member alignment or padding, although <code>packed</code> <em>... |
Category Blog Pagination URL Rewriting in Joomla 3.X <p>I have facing two issues in the Joomla 3.X regarding the rewrite the URL of Category Blog pagination.</p>
<p>Problem 1. "?start=6 OR ?limitstart=6" to "/page/6"</p>
<p>Problem 2: By default in category blog pagination url it uses limit value for eg. if i have to... | <p>Joomla! cannot do this out of the box. You will need an SEO plugin to accomplish this. <a href="https://weeblr.com/joomla-seo-analytics-security/sh404sef" rel="nofollow">sh404sef</a> should be able to handle it.</p>
|
SASS nesting best practise? <p>Is it mandatory to nest all child element to it's parent? Please take a look at my example code. I saw some articles, they warned to nest child elements only to 4 levels. But here I wrapped all childs to it's parent. Is it ok to code sass like this format?</p>
<pre><code><div class="c... | <p>The problem of this code is that you can't use <code>.ads</code> or <code>.profile-info</code> blocks in <em>right</em> sidebar or somewhere else. Your code is context depended.</p>
<p>To improve situation you can read about <a href="http://getbem.com/" rel="nofollow">BEM</a> (block element modificator). </p>
<p... |
Display php variable in real-time <p>I have a php code which reads a text file with email addresses and sends each email using a loop. How can I display, in real-time, the status of each email sent from within the loop? Currently, I can only write to a log file, which can only be accessed once the php code has complete... | <p>Flush the output if you want to echo to browser.</p>
<pre><code>http://php.net/manual/en/function.flush.php
</code></pre>
<blockquote>
<p>Flushes the system write buffers of PHP and whatever backend PHP is using (CGI, a web server, etc). This attempts to push current output all the way to the browser with a few ... |
Flask dev server limits <p>I implemented a REST API using flask and I am wondering what is the limit of the dev. server?</p>
<p>I mean why investing time and money to deploy the api on a prod server while the dev. server can support the traffic.</p>
<p>To avoid marking the question as duplicate, I am not asking for s... | <p>Besides performance you want an outfacing service (like a webserver) to be as secure as possible. The flask development server is not developed with high security as a goal, so there are probably sercurity relevant bugs.</p>
|
Jenkins doesn't trigger a TFS change <p>I've recently installed TFS plugins version 2.5.1 on Jenkins v.2.22.</p>
<p>I successfully configured <code>Team Project Collection URL</code> (Test connection works) and <code>Project Path</code>.</p>
<p>I also marked this build trigger: </p>
<pre><code>"Build when a change i... | <p>First, please update your TFS plugin version to latest. Also check Team Foundation Server polling log to see if there's some related info.</p>
<p>If you are going to trigger Jenkins with VSTS, there's also some configuration in VSTS:</p>
<ol>
<li><strong>Enable alternate credentials</strong> in your Visual Studio ... |
How to convert JSON deep object to URL params in JavaScript? <p>I want to convert deep JSON to URL params string. I have json:</p>
<pre><code>{ filter: { dir: 184}, b:'a'}
</code></pre>
<p>and </p>
<pre><code>{ filter: [1,2,3], b:'a'}
</code></pre>
<p>So I want the result string like this:</p>
<pre><code> filter[d... | <p>You could use an iterative and recursive style for the values.</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>function getString(o) {
function iter(o, path) {
... |
How to make an array of HTML FormData <p>I have got a HTML FORM with two fields a type text and input type file Fields </p>
<p>This is the below code </p>
<pre><code><form id="myForm" method="post">
First name: <input type="text" id="fname" name="fname"><br>
Files: <input type="file" id=... | <p>MAke use of serializeArray instead of formData as </p>
<pre><code>var formData = $(form).serializeArray();
</code></pre>
<blockquote>
<p>PS: serializeArray doesn't work for file uploads as JavaScript has no
access to the content of the file that is entered in that field. At
most the browser might allow acces... |
Get missing dates from table in Redshift <p>I have a table in Redshift that has a Date column plus some other data:</p>
<pre><code>+------------+-------+
| Date | Value |
+------------+-------+
| 2016-09-25 | 1 |
| 2016-09-28 | 2 |
| 2016-09-29 | 3 |
+------------+-------+
</code></pre>
<p>I want to... | <p>Redshift does not fully support generate_series, and I have found that you can use it on its own but then the data it generates fails to combine in any way with any other redshift feature.</p>
<p>Your best option is to create a redshift table with one row per day, and to use that table in a join as follows</p>
<pr... |
How one can run xgboost on hadoop cluster for distributed model training? <p>I am trying to built a CTR prediction model using XGBoost on 100 million of impressions for contextual ads and in order to achieve the same, I want to try XGboost on hadoop as I have all of the impressions data available in HDFS.</p>
<p>Can s... | <p>There are many ways to do it:</p>
<ol>
<li><p>If in case you have some lower level logical grouping say CTR for some item department and you want to make localized models for departments then you can go for map reduce type of setting. It will make sure all data belonging to single department will end up in single Y... |
After form submit in jsp, I want to see what values are sent to controller <p>I have a form that has a <code>modelAttribute</code> coming from a controller. I am displaying a form with the values that are coming through <code>modelAttribute</code>. But when a user makes changes to the form, and clicks on submit, I want... | <p>Go to web network in browser and check the request body and response body..</p>
|
How to properly get Aurelia's TypeScript type definition files (*.d.ts) after TS 2.0. release? <p>In the pre-release versions of Aurelia (for example, betas), JSPM install always got .js and .d.ts files, which was perfect. Now JSPM downloads only .js files. To fix(?) this, Skeleton Templates using Typings now, with a l... | <p>This is a known issue; its either going to be solved via the jspm side:
<a href="https://github.com/jspm/jspm-cli/issues/1344" rel="nofollow">https://github.com/jspm/jspm-cli/issues/1344</a> or the typescript side:
<a href="https://github.com/typings/typings/issues/579" rel="nofollow">https://github.com/typings/ty... |
Email address permissions not getting in Facebook through the JS SDK <p>I am trying this script:</p>
<pre><code>FB.api('/me?fields=id,name,email,birthday,first_name,picture{url},gender', function(response) {
if(response.status == 'connected'){
alert('I am connected');
... | <p>did you pass in email permission to scope when facebook login?
Example:</p>
<pre><code>FB.login(function(response) {
// handle the response
}, {scope: 'public_profile,email'});
</code></pre>
|
Is there a simple way to change the required message TEXT, not placement, for radio buttons when using the jQuery Validate plugin? <p>I have several dozen groups of radio buttons, named to group them together. Contender_1 has 3-5 options, Contender_2 also has 3-5 options, and so on up to 40 or so groups of radio button... | <p>Try this:</p>
<pre><code>$('#form_id').validate({
rules:{
radioname :
{
required: true
}
},
messages:{
radioname :
{
required: "Your message"
}
}
});
</code></pre>
|
Looping over a slice copy of a list <p>I am trying to understand the difference between <strong>looping over a list</strong> and <strong>looping over a "slice" copy of a list</strong>.</p>
<p>So, for example, in the following list, the element whose length is greater than 6 is appended to the beginning of the list:</p... | <p>The list <code>words</code> has three elements. The copy of <code>words</code> also does. You iterate over the copy, insert something in <code>words</code> if the current element is longer than 6 characters, and are done.</p>
<p>Now let's see what happens when you iterate over <code>words</code> directly:</p>
<p>T... |
Object org.mule.transport.sftp.SftpInputStream not of correct type error <p>I have setup a sftp endpoint in a Mule batch flow to pull a test.csv file from CrushFTP server I have setup locally on my laptop.</p>
<p>When I deploy the Mule project it deploys successfully but then I see this error message as it repeatedly ... | <p>This not the issue with your CSV or Configuration. Actually <code>batch:input</code> should generate iterable data. Put following DWL and it will work fine.</p>
<pre><code>%dw 1.0
%output application/java
---
payload
</code></pre>
<p>Hope this helps</p>
|
How can I get Swashbuckle to produce one Swagger Schema per path? <p>Is it possible to get Swashbuckle to produce a separate Swagger Schema per WebAPI Action (path)? I can only get a a single combined schema for all actions within the project (or permanently exclude endpoints)?</p>
<p>Otherwise, are there tools that ... | <p>SwashBuckle work on <strong>all</strong> controllers of a given Web API project.</p>
<p>2 ways to achieve this would be to:</p>
<ul>
<li><p>have <strong>one Web API project per needed Swagger schema</strong>; simple but requires multiple projects with potentially common references to objects.</p></li>
<li><p>"chea... |
Django messages framework not displaying message? <p>I'm trying to build a community portal and am working on displaying one-time message to the user such as "login successful" and the like; and am working with Django's messages framework. </p>
<p>My template has the following line which currently does nothing:</p>
<... | <p>Don't use <code>render_to_response</code> in your <code>test</code> view. It doesn't run context processors which are required to insert things like <code>messages</code> - and other useful items such as <code>user</code> - into the context.</p>
<p>Use <code>render</code> instead:</p>
<pre><code>return render(requ... |
Struggling with search google map places <p>MapActivity</p>
<pre><code>public class Agriculture extends AppCompatActivity implements
OnMapReadyCallback,
GoogleMap.OnInfoWindowClickListener,
GoogleMap.OnMarkerClickListener {
GoogleMap mMap;
Address address;
LatLng latLng;
Sup... | <p>Ignoring the fact that <code>location</code> can't be <code>null</code>... </p>
<p>You first set the list to null. </p>
<pre><code>List<Address> addressList = null;
</code></pre>
<p>Then continue on to check if the string is empty and do some try-catching. </p>
<pre><code>if (!TextUtils.isEmpty(location))
... |
How to register a Drools 6 custom operator programmatically in KieServices with Java <p>I have a few chains of objects like the following that I'd like to process using <strong>Drools 6.4.0</strong>:</p>
<pre><code>@Value
public final class Node {
private final String code;
private final Node prev;
}
</code></... | <p>The following code works, but uses <code>KnowledgeBase</code> which is deprecated (so this doesn't count as an answer):</p>
<pre><code>private KnowledgeBase base;
public void process(List<Node> nodes) {
initialise();
KieSession session = base.newKieSession();
nodes.forEach(session::insert);
s... |
How to reference one file from another in WEB-INF/classes folder in Tomcat? <p>I have two files (one <code>.properties</code> and another <code>.json</code>) in my webapps//WEB-INF/classes folder. I need to reference the <code>.json</code> file from the <code>.properties</code> file. As both are in same location, <code... | <p>What you should do is read your File.json exactly the same way as your properties file if you don't want to specify the absolute path.
If propertyName=File.json :</p>
<pre><code>String jsonFile = props.getProperty("propertyName");
</code></pre>
<p>Then you can do the following to have your file as URL object :</p>... |
my ECMA 6 Promises do not resolve in sync way <p>I am trying to understand ES6 Promises (and promises in general) but things are not clear for me. I tried to get this code running : </p>
<pre><code>var function1 = function() {
console.log("function 1 has started")
}
var function2 = new Promise((resolve, reject) =... | <p>Two things to keep in mind:</p>
<ul>
<li>When invoking a Promise constructor, the passed callback function always gets invoked IMMEDIATELY from inside of the constructor.</li>
<li>Callbacks that you pass to then() or catch() are NEVER invoked immediately.</li>
</ul>
<p>Therefore, in your scenario, the strings "fun... |
Does __bin__ (or __binary__) operator exists in python? <p>In Python, the <code>__oct__</code> and <code>__hex__</code> operators exists to implement specific bahavior for <code>oct()</code> and <code>hex()</code>. See <a href="https://docs.python.org/2/reference/datamodel.html?#object.__oct__" rel="nofollow">Emulating... | <p>You can use <a href="https://docs.python.org/2/reference/datamodel.html?#object.__index__" rel="nofollow"><code>object.__index__</code></a> to handle <code>bin()</code> calls in Python 2. From Python 3 onwards it works for <code>hex()</code> and <code>oct()</code> as well but not in Python 2.</p>
<p>From <a href="h... |
"One of the provided arguments is not acceptable" when Sending a sharing invitation <p>Following this guide:</p>
<p><a href="http://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/item_invite" rel="nofollow">http://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/item_invite</a></p>
<p>I do the following pos... | <p>The role should be <code>write</code> and not <code>edit</code> -- looks like we have a bug in the docs. Thanks for pointing this out! We'll get it fixed.</p>
|
How to put footer on bottom on page permanently <p>How do I write inside my <strong>footer</strong> and keep it at the bottom of the page?</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-... | <pre><code>.underbar {
bottom:0;
width:100%;
height:60px;
background:#000000;
position: fixed;
}
</code></pre>
<p>Add Property position:fixed;</p>
|
Instagram api not-working <p>I trying to use instagtram api. But endpoints: comments and likes not working.</p>
<pre><code>https://www.instagram.com/developer/endpoints/comments/
</code></pre>
<p><a href="http://i.stack.imgur.com/77v27.png" rel="nofollow"><img src="http://i.stack.imgur.com/77v27.png" alt="enter image... | <p>Instagram API after Jun'16 is so unusable.</p>
<p>Try fetch this <code>https://www.instagram.com/query/?q=ig_shortcode(BK07W-Xhq6S){comments.last(20){count,nodes{id,created_at,text,user{id,username,full_name}},page_info}}</code> and you receive JSON with comments data.</p>
|
Can't install psycopg2 package through pip install... Is this because of Sierra? <p>I am working on a project for one of my lectures and I need to download the package psycopg2 in order to work with the postgresql database in use. Unfortunately, when I try to pip install psycopg2 the following error pops up:</p>
<pre>... | <p>I fixed this by installing Command Line Tools</p>
<pre><code>xcode-select --install
</code></pre>
<p>then installing openssl via Homebrew and manually linking my homebrew-installed openssl to pip:</p>
<pre><code>env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2
</cod... |
.find() does not work on certain id's <p>In my website the clients can update their personal data. After the update is done on the database, I want the page updates itself and show the data as it is at that time. For doing this, I do an ajax call to an external php file to update the mysql database. After that, I do a ... | <p><code>Datos</code> is not a parent for <code>eltoken</code>. Just add eg. a common <code>div</code> for it. </p>
<pre><code>$.get(location.href, function (datos) {
datos = $('<div></div>').append(datos);
($(datos)).find("#eltoken").html());
...
</code></pre>
<p>See my similar example
<a hr... |
Segmentation error upon calling scanf in x86_64 AT&T <p>I am quite new to Assembly and I am trying to create a program that uses scanf to receive a number from the user. It then outputs "Result: (the number)"
I keep getting a segmentation error upon running the code.
This is the code I have got now:</p>
<pre><code>.gl... | <blockquote>
<pre><code>leaq -8(%rbp), %rsi
</code></pre>
</blockquote>
<p>In this instruction you are referring to the <code>%rbp</code> register but you forgot to actually initialize it!</p>
|
Redirecting to specific slug from textfield in ember <p>I am totally new to ember so please be nice :)</p>
<p>I have an Ember app where i want to redirect to a specific slug taken from an textfield input. In my .hbs i have the following code:</p>
<pre><code><div class="liquid-container">
<div class="liquid... | <p>You should never embed JavaScript in an Ember .hbs file. This code should really go in your controller for this class. First, generate your controller:</p>
<pre><code>ember g controller <name_of_route>
</code></pre>
<p>Then inside your controller, you want to define two things. The slugtxt variable, and the ... |
How to concatinate a lamda expression using a for loop? <p>I have a documentDb database where I store some names as the ID. Now, I would like to get the items from the documentDB using those names. </p>
<p>For instance </p>
<pre><code>foreach(var name in stringList){ //stringList is a list of strings
this.mydo... | <p>Try</p>
<pre><code>this.mydocumentDb.getDocuments(e=> stringlist.Contains(e.Id));
</code></pre>
|
CPU usage 100% in I/O operaitions <p>I have a theoretical question about CPU usage. When the CPU usage goes to 100%, what does it mean ? Does this mean, I have too large data ? Or does this mean I have too large files ? Or too large number of files ? or too much data on JVM ? </p>
<p>This is Java I/O operation done ... | <p>It means that your application makes more computations than what your <code>CPU</code> can manage such that your <code>CPU</code> is totally overloaded, proportionally it doesn't do much <code>IO</code> compared to computations because <code>IO</code> adds some latency that will consequently reduce the <code>CPU</co... |
How can i get the values of asp textbox control in UpdatePanel <p>I got a trouble with my ascx control. I cannot get the values of textbox normally when it in an Updatepanel.</p>
<pre><code><asp:UpdatePanel ID="UpdatePanel" runat="server">
<ContentTemplate>
<div class="modal-header">
... | <p>I tried your code and there is mistakes. so try following code. It works for me.</p>
<pre><code> <asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel" runat="server">
<ContentTemplate>
<div class="modal-he... |
Same directive with different message - angularJS <p>I have buttons like submit, reject and cancel. If i click on this button a small div with comment shows up and a ok and cancel button will be shown. On click of ok popup with 'are you sure' message popups up.</p>
<pre><code><button type="button" ng-click="showDiv... | <pre><code><input type="button" name="submit" ng-click="buttonclick('are you sure to submit')"/>
<input type="button" name="reject" ng-click="buttonclick('are you sure to reject')"/>
<div ng-show="showDiv">
<yes-no msg={{message}}></yes-no>
</div>
</code></pre>
<p><strong>In you ... |
Is there any equivalence between natvie windows DLL and Shared Linux Libraries .SO <p>I want to port an application written in C#. NET (which run on Windows) in linux. the first solution that I thought is to use Mono. I try to used Mono Migration Analyzer MoMa and the errors are the plateform invokation. The applicatio... | <p>If your Windows application is directly calling system APIs, then there will be no direct translation to Linux. The system library on Windows is completely different from that on Linux. Clearly there is a huge amount of common functionality and capability, but it is all exposed in a different way, bespoke to each pl... |
Using Ajax & php to get multiple data onload for items in a wishlist <p>I am trying to implement, an ajax function that will take the id's of products on load and checks against the db to see if that user has it in their wishlist, then use that information to change the color of wishlist icon.This happens on load of th... | <p>The jquery selector will only select the data first element matched. to do that to all elements you have to loop over them using jQuery <a href="https://api.jquery.com/each/" rel="nofollow">each</a> function: </p>
<pre><code>$(".add-wishlist").each(function() {
var link_data = $(this).data('data');
$.ajax(... |
Globbing in template path not working in nunjucks with gulp <p>I'm using this gulp plugin to use nunjucks to make HTML management easier.</p>
<p><a href="https://github.com/carlosl/gulp-nunjucks-render" rel="nofollow">https://github.com/carlosl/gulp-nunjucks-render</a></p>
<pre><code>gulp.task('default', function () ... | <p>I think the two <code>/**/**/</code> might be the issue. The <code>**</code> pattern matches multiple levels in a path string, so I'm not really sure what the behavior for two of those in are row should be. The following should match your directory:</p>
<pre><code>'src/pages/**/includes/'
</code></pre>
<p>That is,... |
Metrics in Row To Columns (and Dates from column to Rows) <p>Currently I have two reports and they are in different format and was hoping to use macro or formulas to convert either one of the reports to the same format as the other so as to merge the two reports together. </p>
<p>As the two reports provide different m... | <p>It's far from optimal, just a quick solution, but it does the job. It converts the upper table in your picture into the other one. Your original table must be on the first sheet, and you need an empty second sheet before you run the macro:</p>
<pre><code>Sub TableChanger()
Dim i As Integer, j As Integer, k As ... |
Decrypt returns empty value <p>Now I know this question has been asked before and I have tried implenting those solutions in my code but they don't seem to work as it still returns a empty value or it gives me all sorts of errors. </p>
<p>The decryption method</p>
<pre><code>public string DecryptString (string encryp... | <p>Try this</p>
<p>Encrypt</p>
<pre><code> public static string Encrypt(string clearText)
{
string EncryptionKey = "aX#%710p";
byte[] clearBytes = Encoding.Unicode.GetBytes(clearText);
using (Aes encryptor = Aes.Create())
{
Rfc2898DeriveBytes pdb = new Rfc2898DeriveByte... |
Duplicated enries in Select result on join in Postgresql <p>I have number of tables with sample data:</p>
<pre><code>CREATE TABLE public.languages (
"id" bigserial NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE public.goods (
"id" bigserial NOT NULL,
PRIMARY KEY ("id")
);
CREATE TABLE public.good_texts (
... | <p>Well, there are two rows in filtervariant_good with <code>goodid</code> equal to 385, that's why. I suspect that you don't care about having multiple rows in that table, and you are only interested whether a good exists in that table. If my guess is correct, then you can do something like the following instead:</p>
... |
Converting python tuple, lists, dictionaries containing pandas objects (series/dataframes) to json <p>I know I can convert pandas object like <code>Series</code>, <code>DataFrame</code> to json as follows:</p>
<pre><code>series1 = pd.Series(np.random.randn(5), name='something')
jsonSeries1 = series1.to_json() #{"0":0.... | <p>call <code>pd.DataFrame</code> on <code>seriesmap</code> then use <code>to_json</code></p>
<pre><code>pd.DataFrame(seriesmap).to_json()
'{"key1":{"0":0.8513342674,"1":-1.3357052602,"2":0.2102391775,"3":-0.5957492995,"4":0.2356552588}}'
</code></pre>
|
Ruby send_data to render an array as PDF in browser <p>I have an application where I show Fedex labels in my browser as PDF.</p>
<p>I have used <code>send_data</code> to render each label as follows and it works perfectly:</p>
<pre><code> @label_image = Base64.decode64(image_hex).html_safe #image_hex is a text fiel... | <p>It sounds like you need to first create a multi-page pdf, once you have that, you can pass it into <code>send_data</code>.</p>
<p>There are lots of pdf libraries in ruby there is a good list on <a href="https://www.ruby-toolbox.com/categories/pdf_generation" rel="nofollow">ruby-toolbox</a>.</p>
<p>Alternatively if... |
IgnoreDataMember attribute on MetaData class doesn't work <p>I am using entity framework v6.0 DB first.</p>
<p>I have a problem where a certain class breaks on serialization due to a certain navigation property.</p>
<p>When I'm adding to the auto generated cs class the attribute <strong><em>IgnoreDataMember</em></str... | <p>Sadly [IgnoreDataMember] doesn't work with EF6 proxy objects. Metadatatype only works with DataAnnotations. Doesn't work for serialization. Must be specified directly on the properties in entity. If you use T4 template for class generation, you may want to add some logic to create these attributes directly in the te... |
Implement feature branches in TeamCity VCS plugin <p>I'm currently adding support for feature branches in the Plastic SCM VCS Plugin. I think I have everything ready (clearly I'm wrong) but TeamCity detects all new changesets to belong to all branches. This renders the plugin unusable, since a new commit in the default... | <p>Make sure you include override:</p>
<pre><code>public boolean isDAGBasedVcs() {return true;}
</code></pre>
|
How to pass a type as parameter to a constructor when using Unity dependency injection <p>We use Unity dependency injection. We have a class that needs a type passed to it's constructor.</p>
<pre><code>public interface ITest
{
}
public class Test : ITest
{
public Test(Type myType)
{
}
}
</code></pre>
<p... | <p>The answer was contained in the code from the link posted by Haukinger:</p>
<pre><code>object actual =
container.Resolve<IDatarecordSerializer>(
new ParameterOverride(
"type",
new InjectionParameter(typeof(string))
)
);
</code></pre>
|
How to select one table column using user define function in sql <p>Create one user define function with some default inputs and return table.
the below function result used to another function.</p>
<pre><code>CREATE FUNCTION dbo.Splittext(@strArgs VARCHAR(4000))
RETURNS @tab TABLE
(
[Key] VARCHAR(25) NOT NULL,
... | <p>You are close, but in the second udf you are trying to assign the result into a table variable. The easier method would be: </p>
<pre><code>DECLARE @Table Table (keyss varchar(20), valuess varchar(20))
INSERT INTO @Table
SELECT * FROM dbo.Splittext('test')
SELECT keyss FROM @Table
</code></pre>
<p>Thanks,</p>
|
Redis Java Client: Do I need to buffer my commands into a pipeline for performance? <p>So I am just incrementing scores in a sorted set. That is the only command I am running, about 10-30 commands per second, from a Java application, using the Jedis client. Since I am just updating the scores, I don't care about the re... | <p>I think we need to dig a bit more into details here as you're mentioning different aspects here.</p>
<p>In general, all Java Redis clients (<a href="https://github.com/xetorthio/jedis" rel="nofollow">Jedis</a>, <a href="https://github.com/mp911de/lettuce" rel="nofollow">Lettuce</a>, <a href="https://github.com/redi... |
Selenium IDE - stop if a specific string was found <p>Is there a way to tell selenium IDE to stop if a specific text on a page was found?</p>
<p>For example if a page contains some MySQL / php Errors I want to get notified. (I would check for partial mysql strings like "near * at line")</p>
<p>What I use now is asser... | <p>You can use javascript evaluation and "!" (javascript -not- expression)</p>
<pre><code>storeElementPresent | //*[contains(text(),"searchedText")] | searchedTextpresent
verifyEval | !storedVars['searchedTextpresent'] | true
</code></pre>
<p>additionally you can collect more variables and combine the ver... |
touch events on apple devices <p>I use some third party software which creates an interactive book from a PDF. I can see how it works to a point but am not sure about making the mobile/tablet version work perfectly with links working on Apple devices.. </p>
<p>The initial PDF has links created within it (done in Acrob... | <p>Try <code>touchend</code> Event,<br>
It might work on pure JS as I am using it in <code>Backbone.js</code><br>
And it works perfectly in <code>Backbone.js</code> </p>
|
Hiding main category title on a unique category archive page <p>I'm building a site with many different categories and need to simply remove the category titles on just <strong>one</strong> archive page:</p>
<p><a href="http://redyearclients.co.uk/PandF/product-category/exterior-paving/paving-brands/" rel="nofollow">h... | <p>For that purpose you will need to use <strong><code>woocommerce_page_title</code></strong> filter hook and the WooCommerce conditional <strong><code>is_product_category( 'category' )</code></strong> together.</p>
<p>Here is that code:</p>
<pre><code>function removing_specific_category_page_title( $page_title ) {
... |
`__declspec(dllexport) extern std::string foo;` not found by linker <p>I ran into the same problem as mentioned here:
<a href="http://stackoverflow.com/questions/39280178/protobuf-refuses-to-link-vs2013-or-vs2015">Protobuf - Refuses to link vs2013 or vs2015</a></p>
<p>I figured out that these two lines in <em>generate... | <p>Make sure that your compiler flags and defined preprocessor symbols are set correctly.</p>
<p><code>__declspec(dllexport)</code> should be set for creation of the DLL, and your code needs to contain the definition. If you want to use the DLL, then you need <code>__declspec(dllimport)</code>.</p>
<p>See the <code>p... |
how to programmatically set action for barButtonItem in swift 3? <p>Here is what I used previously,</p>
<pre><code>var barButtonItem = UIBarButtonItem(image: backImgs, style: UIBarButtonItemStyle.plain, target: self, action: Selector("menuButtonTapped:"))
</code></pre>
<p>But there is some syntax changes for Swift 3.... | <p>ex:- </p>
<pre><code>navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Add", style: .plain, target: self, action: #selector(addTapped))
</code></pre>
|
pretty much lost : self.parent.parent.__class__ <p>I needed to serialize a self referencing hierarchy </p>
<pre><code>class Systm(models.Model):
...
parent = models.ForeignKey('self', on_delete=models.CASCADE, blank = True, null = True, related_name="children")
</code></pre>
<p>and I was able to achieve that ... | <p>This basically works by getting the top serializer class and instanciating it to return the serialized value of a child. The <code>parent</code> attribute of a serializer (or field) is the serializer instance that declared this as a field.</p>
<p><code>self.parent</code> is the List Serializer implicitly created wh... |
AdLoader always loads content ad <p>I have created a custom AdLoader for my application. But it always loads content ads and never install ads. If I remove <code>.forContentAd</code> I will get install ads but if I leave both I will only get content ads. Can anyone tell me why?</p>
<p>Here is my code:</p>
<pre><code>... | <p>Yes, I can tell you why.</p>
<p>When you make a request, AdMob's servers will always try to pick the ad that's going to make you the most money. They do this by conducting an auction in which different advertisers' campaigns compete to be the one shown in your app. It's possible (especially in some parts of the wor... |
How do I stop my Facebook share window from being blocked by popup-blocker? <p>I have my Facebook share window appearing when a function is called onClick of the Facebook share button. </p>
<p>The problem is that the Facebook window attempts to appear but is blocked by popup-blocker. </p>
<p>This is my first time cre... | <p>Right now you are trying to open a popup not on user interaction, but in an asynchronous callback function. Of course the popup blocker detects that and blocks the popup (for a good reason). You need to do two things:</p>
<ul>
<li>Load the JS SDK on page load, NOT on user interaction.</li>
<li>Call <code>FB.ui</cod... |
Declare variable in bash function? (BASH) <p>I have this:</p>
<pre><code>sum() for i in $@; do ((tot += 4)); echo $tot;done
</code></pre>
<p>Now, how do i reset the tot variable before the for-loop?</p>
<p>I tried:</p>
<pre><code>sum() tot = 0; for i in $@; do ((tot += 4)); echo $tot;done
sum() tot = 0;done; for i... | <p>You have to make the variable <code>tot</code> local to the function with the <code>local</code> keyword:</p>
<pre><code>sum() { local tot; for i in $@; do ((tot += 4)); echo $tot;done; }
</code></pre>
<p>optionally, when defining a local variable, you can also set an initial value:</p>
<pre><code>sum() { local t... |
How to center the buttons and make them same size <p>I am new to CSS and trying to make a page. I have 2 radio buttons but I am trying to make them appear like regular buttons using css.
They look pretty similar but I am unable to center them and they are not the same size. How can I fix this.</p>
<p><div class="snip... | <p>I would wrap the label and the input in a separate div. So it would be something like 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-css lang-css prettyprint-override"><code>input#quiz-question-one-yes ... |
What is the name of this design pattern using Performer? <p>What is the name of the pattern that used Retrofit 2.0 and some other libraries?</p>
<p><strong>The old version</strong></p>
<p>some manager can load data sync and async by two different methods </p>
<pre><code>SomeClass obj = someManager.getDataSync();
... | <p>This looks like Event-based Asynchronous pattern, as described here <a href="https://msdn.microsoft.com/en-us/library/wewwczdw(v=vs.110).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/wewwczdw(v=vs.110).aspx</a></p>
<p>It is basically a concurrency pattern allowing easy use of both synchronous and as... |
Expected resource type to be one of id, id <p>activity_criminals_list.xml</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_criminals_list"
android:... | <p>In this line you are passing the id of the whole layout:</p>
<pre><code>ListView listView = (ListView) findViewById(R.id.activity_criminals_list);
</code></pre>
<p>And you try to init <code>ListView</code> with it's ID, whose name is different from the layout name:</p>
<pre><code><ListView
android:id="@+id... |
Open modal content from a link on another page <p>Morning,
Can anyone shed any light on where I'm going wrong here please? I'm trying to anchor an image on index.html to modal content on mainportfolio.html. My link on index.html looks like this:</p>
<pre><code><div class="col-md-4 col-sm-6">
<a href="mainpor... | <p>Opening a Bootstrap modal is a javascript event. You'd need to add some javascript to detect that the page should open the modal, and then to actually open the modal.</p>
<h3>index.html</h3>
<pre><code><div class="col-md-4 col-sm-6">
<a href="http://test.dev/mainportfolio2.html#portfolioModal93">
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.