input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Where is the exception caught? (Try/Catch) <p>When using the back ground worker class to call a method within a try catch statement, and a try catch statement is in the method, which one catches the exception? </p>
<pre><code>private void backgroundWorker1_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)... | <p>The inner one since this catch is "closer" to the "error"</p>
<p>this one : </p>
<pre><code>private void Do ()
{
try
{
//Do something, open a file etc.
FileStream fs = new FileStream("file.txt", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
}
catch (Exception e)
{
System... |
vstset.console.exe assembly resolution fails <p>I have a <code>UnitTests.dll</code>, to which <code>Common.dll</code> is referenced (both built with VS2015).</p>
<p>I have following directory structure:</p>
<pre><code>C:\Test\
- UnitTests.dll
- UnitTests.runsettings
C:\Bin\
- Common.dll
</code></pre>
... | <p>Set the <a href="https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.deploymentitemattribute.aspx" rel="nofollow">DeploymentItemAttribute</a> for all required files:</p>
<pre><code>[DeploymentItem("Common.dll")]
[DeploymentItem("Common2.dll")]
[TestMethod]
public void TestFoo()
{
... |
Themes reset after deploying vaadin maven project <p>We have vaadin maven project and every time after deploying themes are not working.
There are:
1) styles.scss file with </p>
<pre><code> @import "mytheme.scss";
@import "addons.scss";
.mytheme {
@include addons;
@include mytheme;
}
<... | <p>I've removed this line from pom.xml and everything is working good</p>
<pre><code> <goal>compile-theme</goal>
</code></pre>
|
Can we use AWK and gsub() to process data with multiple colons ":" ? How? <p>Here is an example of the data:</p>
<pre><code>Col_01:14 .... Col_20:25 Col_21:23432 Col_22:639142
Col_01:8 .... Col_20:25 Col_22:25134 Col_23:243344
Col_01:17 .... Col_21:75 Col_23:79876 Col_25:634534 Col_22:5 Col_24... | <p>Here is another alternative...</p>
<pre><code>$ awk -v OFS='\t' '{for(i=1;i<NF;i+=2) # iterate over name: value pairs
{c=$i; # copy name in c to modify
sub(/:/,"",c); # remove colon
a[... |
Prioritize the jQuery before script <p>I have the problem with my script in html file. The problem is about updating variables by jQuery and then creating a chart from it.</p>
<p>I am using angular for chart creation so it is impossible to put it into different jQuery. </p>
<p>Part of the code:</p>
<pre><code>var ch... | <p>Why don't you use <code>$http</code> service inside a controller to get data and then put it on the scope:</p>
<pre><code>angular.module("app", ["chart.js"]).controller("BarCtrl", function ($scope, $http) {
$scope.data = [];
$http.get('../json/testData.json').then(function (response) {
for (var i = ... |
Java ASM Manipulate IntInsnNodes <p>I'm kind of new to ASM.</p>
<p>I'm trying to disallow int searching in decompilers, so I'm trying to negate a mathematical operation multiple times.</p>
<p>Example: <code>int i = 10;</code> --> <code>int i = 2 + 8;</code></p>
<p>I've already done that, but I want to do it like thi... | <p>You would need to replace a single <code>BIPUSH 10</code> (<code>IntInsnNode</code>) instruction with a chain of</p>
<pre><code>ICONST_2 // InsnNode
BIPUSH 8 // IntInsnNode
IADD // InsnNode
INEG // InsnNode
INEG // InsnNode
</code></pre>
<p>If your goal is that the <code>BIPUSH 10</code> should not be ... |
How to use nav drawer in multiple activities <p>I want to define a single nav drawer I can use throughout my application. I followed the instructions of the chosen answer here as my first approach: <a href="http://stackoverflow.com/questions/19451715/same-navigation-drawer-in-different-activities#">Same Navigation Draw... | <p>I think you are missing a drawer with id <code>drawer_layout</code> in your <code>activity_log_workout</code> layout.</p>
<p>In order for this approach to work, you must have a DrawerLayout with id <code>drawer_layout</code> in all your activity layouts that should have the drawer.</p>
<p>I also noticed something ... |
HQL returns duplicate entities on simple query when ordering by EnumType.ORDINAL <p>I'm trying to fetch a list of entities using Hibernate HQL in Spring MVC. The query looks like this:</p>
<pre><code>SELECT m FROM MyEntity m where property =:property ORDER BY otherProperty desc
</code></pre>
<p>The problem is that I'... | <p>OK, this was probably the dumbest problem I've faced (my fault). My <code>equals(Object o)</code> method in the <code>MyEntity</code> class, which I had overridden, wasn't working properly, so Java couldn't actually tell one entity from another. Fixed that part, fixed the whole problem.</p>
<p>So, just in case this... |
Type or namespace name could not be found (missing using directive or assembly reference?) <p>With this code:</p>
<pre><code>using System.Web.Http;
class MyClass : IHttpActionResult
{ ... }
</code></pre>
<p>I get the error:</p>
<blockquote>
<p>The type or namespace name 'IHttpActionResult' could not be found (are
... | <p>Fixed this problem (strictly related to <a href="http://stackoverflow.com/questions/39878296/c-sharp-cannot-call-a-httpconfiguration-extension-methods">this one</a>) specifying in Project > Reference Manager:</p>
<pre><code>Microsoft.Owin 2.0.2.0
Owin 1.0.0.0
System.Net.Http.Formatting 5.2.3.0
System.Web 4.0.0.... |
Using array.prototype.fill instead of array.prototype.push <p>I am trying to use the following prototype to <code>fill</code> an empty array with integers from 1-100. As per MDN's documentation:</p>
<p><code>array.prototype.fill(value, [optional start & end index])</code></p>
<p>If my understanding is correct if ... | <p><strong>No</strong>, <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/fill" rel="nofollow">fill</a> method, doesn't take a function or an iterator as an argument to change the static value with every iteration.</p>
<p>try this approach</p>
<p><div class="snippet" data-la... |
PHPExcel row break not working <p>. . . .
I am using Codeigniter 3.1 and PHPExcel 1.8. </p>
<p>I have a function that creates a PHPExcel Object and returns it and the other function outputs the Excel to browser</p>
<p>Everything is working perfectly fine. Now on specific rows I need to add page breaks.</p>
<pre><co... | <p>Problem solved. Initially I was using the setbreak function while inserting rows. and whenever the condition meets, call the function. I was going through the code, got an idea, implemented it and solved. Instead of calling the function setbreak during row generation, i stored the row reference in an array, and then... |
Multiple Not Like Statements <p>Is there an easier(cleaner) way to accomplish the following:</p>
<pre><code>AND Prov_Credentialing not like ('%AS%') AND Prov_Credentialing not like ('%CI%')
AND Prov_Credentialing not like ('%DI%') AND Prov_Credentialing not like ('%FQ%')
AND Prov_Credentialing not like ('%EM%') AND Pr... | <p>Store the patterns in a separate table:</p>
<pre><code>CREATE TABLE NOT_LIKES (pattern VARCHAR(4));
INSERT INTO NOT_LIKES VALUES ('%AS%');
...
SELECT ...
WHERE ...
AND NOT EXISTS (SELECT * FROM NOT_LIKES WHERE Prov_Credentialing LIKE pattern)
</code></pre>
|
ORA-32033: unsupported column aliasing : Oracle 10g <p>I am new in sql . When I am going to use this query , it occurs error . Here is my query :</p>
<pre><code>with new_table (loan,customer_city) as (
select loan.loan_number , customer.customer_name, customer_city
from loan,borrower,customer
where custo... | <p>Column aliasing in the declaration of a CTE was introduced in Oracle 11.2. In 10g, you must create the aliases within the subquery itself, something like</p>
<pre><code>with new_table as (select loan.loan_number as loan, .....)
</code></pre>
|
Rename application.properties in spring boot, also for use with spring boot test <p>I have a project that uses Spring Boot. I need to rename the application.properties file to something else (i.e. othername.properties). The reason I need to rename it is because we have a bunch of other scripts that rely on that naming ... | <p>Didn't try it, but I think it should be </p>
<pre><code><systemPropertyVariables> <spring.config.name>othername</spring.config.name> </systemPropertyVariables>
</code></pre>
<p>Without .properties</p>
|
To pass a component variable as parameter or assign it as a global variable <p>I am in the process of refactoring my Angular2/Ionic2 code and wanted to know what is the best practice for my situation. </p>
<p>I have defined a variable in my component (this.questions) and need to use it in my service method. There are ... | <p>Better way would be,</p>
<p>declare <strong>questions object</strong> in <strong><em>service</em></strong> itself. <em>I assume here that you want to use questions object in other components too</em>.</p>
<p><strong>service.ts</strong></p>
<pre><code>questions:Object;
doPrint(){
console.log(this.questions)
}... |
Losing messages between logstash and elasticsearch <p>I'm set up as follows while we're testing out the ESK stack and learning how all this works:</p>
<ul>
<li><p>Client server (CS) running filebeat sends output to logstash running on site aggregator node (AN).</p></li>
<li><p>AN runs logstash with some filters and th... | <p>The problem is that you are parsing the date of the log with the date filter, which, by default, replace the <code>@timestamp</code> field, which is used to filter according to the date. </p>
<blockquote>
<p>I get basically nothing during timeframes when I know these messages are flowing.</p>
</blockquote>
<p>So... |
Summing numbers in parallel takes twice as long as the serial version <p>I have a <code>const LONGLONG UPPER = 1000000000;</code> in my code, and I'm trying to calculate the sum of all the numbers from 1 to <code>UPPER</code> (yes, I know there's a formula for this).</p>
<p>These are my globals:</p>
<pre><code>const ... | <p>There are a few things that represent potential culprits. </p>
<p>First of all (and this is usually the big one), check which Compiler Optimizations you have enabled. Two things are often extremely true when it comes to Compiler Optimizations:</p>
<ul>
<li>They are very good at optimizing "Accumulation loops", whi... |
Combine shell boolean conditions with selective precedence <p>I have two conditions at the beginning of a script to verify arguments. The intention is that exactly two arguments should be passed and the first argument must be <code>"FOO"</code> or <code>"BAR"</code>. What I have below works, but I want to know how to m... | <p>You can use <code>||</code> between 2 conditions:</p>
<pre><code>if [ "$#" -ne 2 ] || [ "$1" != "FOO" -a "$1" != "BAR" ]; then
echo "Usage: $0 <FOO or BAR> <Removed for SO>"
exit
fi
</code></pre>
|
Get all the records from left table with computed column value <p>I have master table with structure :</p>
<p>T1</p>
<pre><code>ID Name
1 Cricket
2 Football
3 Golf
</code></pre>
<p>T2</p>
<pre><code>ID T1-ID SomeNumber
1 1 180
2 2 180
3 1 195
4 3 195
... | <p>You can use <code>left join</code>:</p>
<pre><code>select t1.*,
(case when t2.id is null then 'False' else 'True' end) as ComputedColumn
from t1 left join
t2
on t1.id = t2.t1_id and t2.somenumber = 180;
</code></pre>
<p>Actually, that assumes that a row with <code>180</code> occurs at most once fo... |
custompostback __dopostback not firing from anchor tag <p>So I've built a live search box that updates on keyup. It populates a span with items that match the string input as the user types.</p>
<p>I am trying to dynamically create links using anchor tags so that when a user clicks one of the results in the pop up res... | <p>So it looks like your quotes are a little screwy. Take a look at your last snippet:</p>
<pre><code>onclick="CustomPostBack(" 845169");"
</code></pre>
<p>Your <code>onclick</code> is being cut short because you're using double-quotes for your parameters. The browser sees it as <code>onclick="CustomPostBack("</code>... |
Is there a better way to get String[] from an Enum in Java? <p>I have an enum </p>
<pre><code>public enum UnitSystem {
ImperialSystem("Imperial", "in.", 1),
MetricSystem("Metric", "cm.", 2.54);
private String unitSystemName;
private String lengthSuffix;
private double lengthCoeff;
</code></pre>
<p... | <pre><code> public enum UnitSystem {
ImperialSystem("Imperial", "in.", 1),
MetricSystem("Metric", "cm.", 2.54);
UnitSystem(String unitSystemName, String lengthSuffix, double lengthCoeff) {
this.UNITE_SYSTEM_NAME = unitSystemName;
this.LENGTH_SUFFIX = lengthSuffix;
this.LENGTH_CO_EFF... |
excluding directories from aws cp <p>A current project directory on Mac machine, having some files and directories, needs to be copied over to aws s3 bucket but without some directories some of which are hidden.<br>
I could not figure out from <a href="http://docs.aws.amazon.com/cli/latest/reference/s3/cp.html" rel="no... | <p>From <a href="http://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters" rel="nofollow">s3's Use of Filters</a>:</p>
<blockquote>
<p>Any number of these parameters can be passed to a command. You can do
this by providing an --exclude or --include argument multiple times,
... |
How do you make two turtles draw at once in Python? <p>How do you make two turtles draw at once? I know how to make turtles draw and how to make two or more but I don't know how you can make them draw at the same time.
Please help!</p>
| <p>Here's a minimalist example using timer events:</p>
<pre><code>import turtle
t1 = turtle.Turtle(shape="turtle")
t2 = turtle.Turtle(shape="turtle")
t1.setheading(45)
t2.setheading(-135)
def move_t1():
t1.forward(1)
turtle.ontimer(move_t1, 10)
def move_t2():
t2.forward(1)
turtle.ontimer(move_t2, 1... |
Template Specialization of class method. "Function template already defined" <p>I've seen lots of SO questions about specialization in the context of methods, but not functions belonging to classes. I'm having a hard time translating the knowledge passed on from those questions to my problem here.</p>
<p>I'm mucking a... | <p>The default here:</p>
<pre><code>template<typename T = XXX>
inline Vector3<T>::operator std::string() const { ... }
</code></pre>
<p>doesn't matter at all, there's no deduction going on at this point, and <code>T</code> is already defined. It's legal, but it's just noise. </p>
<p>Now, you can't partia... |
out of memory issue while parsing and building hash of array data structure from a flatfile <p>I am trying parse through a flat file and aggregate some columns based on certain columns which are considered as keys. I do this by building a hash of array data structure. Once the HoA data structure is built I would iterat... | <p>This might be a solution, though I'm not real familiar with the <a href="https://metacpan.org/pod/DBD::CSV" rel="nofollow">DBD::CSV</a> module. This approach would avoid having to load in you data to a hash and there should be no out-of-memory problems. You would have to have DBD::CSV and <a href="https://metacpan.o... |
How to count DbSet rows added to in a DbContext <p>Looked high and low but cannot find the syntax to count the number of rows in a [DbContext].[DbSet Entity] by the change status of the row. Specifically, I would like to know how many rows in one entity/table were added and are pending SaveChanges().</p>
| <p>You can use one of the <code>DbContext.ChangeTracker.Entries</code> method overloads (similar to <a href="https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k(System.Data.Entity.Infrastructure.DbChangeTracker.Entries%60%601);k(TargetFrameworkMoniker-.NETFramework,Version%3Dv4.6.1);k(DevL... |
apache 2.4.6 proxy https to http Tomcat 7.0.68 <p>I have a Tomcat application running at context "/mycontext". Apache 2.4.6 is handling the front end via a proxy in httpd.conf. I am unable to render pages at /mycontext using https with CA signed certificate.</p>
<pre><code><VirtualHost *:80>
ServerName www.exa... | <p>The SSL virtualhost is not proxying correctly, and you must match slashes or the lack of them. So you must use:</p>
<pre><code>ProxyPass /mycontext http://example.com:8081/mycontext
</code></pre>
<p>This is what you are using in the non-SSL virtualhost, not sure why you changed it in the SSL virtualhost since as y... |
Mapbox GL JS - Data Driven Styling - Finding Min & Max or Range of Data in a Layer <p>I am using data driven styling to create choropleth maps, with the ability to use a dropdown to select a different field and change the <code>property</code> within <code>'fill-color'</code> when styling <code>'paint'</code> of a laye... | <p>I'm happy to hear you're building cool things with data-driven styling in GL JS. </p>
<p>There is no built-in solution to pull the min / max values from within a particular field in a layer. This is an unfortunate technical limitation. If you were to have a 1TB vector tile set that spans the whole world, we would n... |
Keep my IntentService alive when phone is off <p>My IntentService checks the user's location. I need to keep it alive while the phone is turned off. In this Service I have an infinite while loop. The OS will shut it down after 8 minutes.</p>
<p>What other ways can I do this instead of the AlarmManager?</p>
| <p>IntentService is supposed to be executed once. When job is done, it terminates. You may try using ordinary Service and do all work on background thread. But, system can stop this service anyway if it is low on resources. To prevent that, you can use .setForeground() method in Service and Service will not be stopped ... |
Visual C++ error with two projects: name followed by '::' must be a class or namespace name <p>I'm new to Visual C++. I have two separate projects (let's call the first Converter and the second TreeGridView). I have this line of code in the Converter project:</p>
<pre><code>private: AdvancedDataGridView::TreeGridView^... | <p>You're trying to XOR a type with a variable? Pointers are declared using <code>type*</code>, not <code>type^</code>.</p>
<p>See <a href="http://www.cplusplus.com/doc/tutorial/pointers/" rel="nofollow">http://www.cplusplus.com/doc/tutorial/pointers/</a> for a tutorial on C and C++ pointers.</p>
|
Counting end value of multiple arrays - swift <p>I have a hard time finding out how to count the ending value of multiple arrays. Let me give you an example:</p>
<p>Here I have four arrays:</p>
<pre><code>let numberOne: [string] = ["...", "...", "car"]
let numberTwo: [string] = ["...", "...", "bike"]
let numberThree:... | <p>One way:</p>
<pre><code>func countLastEelement(){
let numberOne: [String] = ["...", "...", "car"]
let numberTwo: [String] = ["...", "...", "bike"]
let numberThree: [String] = ["...", "...", "car"]
let numberFour: [String] = ["...", "...", "car"]
let numbers:[[String]] = [numberOne, numberTwo, n... |
Rails Association Convention <p>There are three models that are relevant to this question <code>Transaction</code> <code>Bid</code> and <code>Auction</code>. An auction is created and then bids are created in that auction obviously. A transaction is created once the buyer has chosen a bid and checked out, so after auct... | <p>Your associations are backwards.</p>
<p>If an Auction is created first, and then Bids are created for an auction, then your <code>Bid</code> needs an <code>auction_id</code> foreign key.</p>
<p>If a Transaction is created <em>after</em> a series of bids happen for an auction, your <code>Transaction</code> should h... |
Filling an array[m][n] with sum of elements at m==n <p>I need your help.</p>
<p>I got this interesting problem, looks more like homework, but it is really complicated.</p>
<p>I need to fill the elements in this array of numbers where, given certain list of numbers, I need to put them in the diagonals of the array, an... | <p>You only need to solve half of it and put same number in the mirror image by changing the indices.</p>
<p>You can do this:</p>
<ul>
<li>fill the diagonal</li>
<li>Loop through rows: r = 1 -> colmax -1 //square matrix!
<ul>
<li>Loop c = r -> colmax-1 times again</li>
<li>set value at [c][c+1] = [c][c-1] + [c][c+1... |
How to pass model attributes trough two Servlets? <p>I have the following setting:</p>
<p>Request Made -> <strong>Controller gets Request and prepares response</strong> -> Response is sent -> Response is intercepted by a InternalResourceView Class that redirects to a Template jsp that makes a CompositeView (Header, Ma... | <p>In Controller, set value into <strong>Session attribute</strong> and get it wherever you want.</p>
<pre><code> request.getSession().setAttribute("name", "value");
</code></pre>
<p>and to get it in JSP,</p>
<pre><code>${sessionScope.name}.
</code></pre>
|
SQL Query Optimization with GUID and Varchar column in its where clause <p>Hi I am trying to optimize the below query.</p>
<p>The query is working fine, but taking huge time to get the result.
Data is huge in our tables
MessageCorrelationId is a GUID
OrginatingEventName is varchar(50)</p>
<p>Currently no index is cre... | <p>One possible way is </p>
<pre><code>Select MessageCorrelationId,BridgeName,ServiceName,OriginSystemName,CreatedDate,ErrorFlag,ErrorMessage
from (
select *,
COUNT(*) OVER (PARTITION BY MessageCorrelationId) as CountSteps,
ROW_NUMBER() OVER (PARTITION BY MessageCorrelationId ORDER BY CreatedDate DESC)... |
angular 2 how to get inyected data from controller <p>I've this component:</p>
<pre><code><element skillType="tec"></element>
</code></pre>
<p>I need to get the <code>skillType</code> param in my controller, i'm doing it like this:</p>
<pre><code>@Component({
selector: 'element',
template: `
... | <p>I believe this has got something to do with importing your component into the component that you actually use it in and how you are not referring to the class variable using <code>this</code>. </p>
<p>For example - to use the element component in, say, upload component you need to import it and then add it to the d... |
C# Extracting numbers from a string <p>I have a string that contains two different numbers:</p>
<pre><code>string number = "25";
</code></pre>
<p>I need to extract the first number into <code>int x</code>, and the other number into <code>int y</code>.</p>
<p>Is there a quick way to do this?</p>
| <pre><code>string number = "25";
int x = number[0] - '0';
int y = number[1] - '0';
</code></pre>
|
How to enable button if data grid view has one or more rows in C# <p>I have billing form in which items with their details inserted as rows in data grid view , the form also contains a <strong>save button</strong> which must be enabled if there is one or more rows in data grid view I tried to write this code in <strong... | <p>Your program compile with that line?
I'd use:</p>
<pre><code>if(pBilldgv.Rows.Count>1) this.pBillSavebtn.Enabled=true;
</code></pre>
|
How to get a count of checkboxes checked on pagination Jquery dataTables <p>Below is my code, I want to get the count of checked checkboxes of all pages in my DataTable. Please advice how to proceed</p>
<pre><code> <td align="center"><input type="checkbox" align="center" id="all" class="groupCheckBox" name="e... | <pre><code>var table = $("#userTable").DataTable();
var countchecked = table
.rows()
.nodes()
.to$() // Convert to a jQuery object
.find('input[type="checkbox"].groupCheckBox:checked').length;
</code></pre>
<p>Uses the most recent API</p>
<p>"...please be aware that using deferRender will cause some... |
how to get previous date based on day of date in java <p>I have an ArrayList of integer numbers that represent day-of-month.For example my list contains 2,8,15(always in increasing order) so it will represent dates 2nd ,8th and 15th of any month.On these dates i have to generate some invoice.So like if I am generating ... | <p>You need to use java8+ or jodatime. Java 8 adopted jodatime so that's why there's a distinction. Jodatime's api is exactly what you are looking for.</p>
|
Selenium- Tag traversal Xpath for facebook First name not working <pre><code><div id="reg_form_box" class="large_form">
<div class="clearfix _58mh">
<div class="mbm _3-90 lfloat _ohe">
<div id="u_0_0" class="_5dbb">
<div class="uiStickyPlaceholderInput uiStickyPlaceholderEmptyInput">
<d... | <p>Ideally unless you have a case of multiple modes that match the same xpath, you don't have to traverse through the entire hierarchy.</p>
<p>This will work:</p>
<pre><code>//input[@name='firstname']
</code></pre>
|
Move multiple elements (based on criteria) to end of list <p>I have the following 2 Python lists:</p>
<pre><code>main_l = ['Temp_Farh', 'Surface', 'Heater_back', 'Front_Press',
'Lateral_Cels', 'Gauge_Finl','Gauge_Relay','Temp_Throw','Front_JL']
hlig = ['Temp', 'Lateral', 'Heater','Front']
</code></pre>
<p>I need to m... | <p>You could sort <code>main_l</code> using whether each element contains a string from hlig as a key:</p>
<pre><code>main_l.sort(key=lambda x: any(term in x for term in hlig))
</code></pre>
|
Dynamically added TextView has zero width and height <p>I have a programatically created RelativeLayout as shown in code below. The RelativeLayout has same width and height of an EditText and lies above the EditText. I add a programatically created TextView to it with certain width and height. </p>
<pre><code>overlay ... | <p>Try below code : </p>
<pre><code> XTextView textView= new XTextView(this);
textView.setLayoutParams(new RelativeLayout.LayoutParams(100,500));
textview.setText("Sample");
textview.setX(location[0]);
textview.setY(location[1]);
textview.setLayoutParams(lp);
overlay.addView(textview)... |
How to grab featured image URLs from posts with custom taxonomies? <p>I had a look at this post which and copied some code which helped a little bit (the page isn't totally blank any more)</p>
<p>I'm trying to grab two URLs: The url to the full size image and the thumbnail version</p>
<p>From every post with a specif... | <p>It looks to me that you're not looping through the results of the get_posts() call. Try changing the code to match the updated code I posted below. </p>
<p>What it does is it loops through each 'post' stored in the <code>$gallery</code> variable. </p>
<p>Apologies for not having enough time to give a more in-depth... |
Throttle server bandwidth by percentage using Netty <p>Is it possible to limit the server's global or channel bandwidth using Netty?</p>
<p>I can set explicit read or write rate limits via <a href="https://netty.io/4.1/api/io/netty/handler/traffic/GlobalChannelTrafficShapingHandler.html">GlobalChannelTrafficShapingHan... | <p>Have you considered using <code>GlobalTrafficShapingHandler</code> and periodically letting it go full throttle to figure out the server max bandwidth and then limiting it to half of that?</p>
<p>I would periodically do the following (on a schedule, maybe 1 second out of every minute)</p>
<ul>
<li>Increase the <co... |
Using OpenSAML to create and sign response (in Java) but having trouble validating the signature <p>I am able to create a SAMLResponse using OpenSAML, but as a sanity check I wanted to validate the signature. The recipient wants the Assertion to be signed but not the Response, which looks just fine:</p>
<pre><code>&l... | <p>Solved this. The Assertion requires an ID value that is different from the Response ID. I just needed to add the following line of code and it worked.</p>
<pre><code>assertion.setID("1111111112");
</code></pre>
|
SQL Response to JSON for non-trivial query <p>I have this query that works in studio, which for a given worker, returns those other workers that recommend them.</p>
<p>[Worker:V] -> [RecommendedBy:E] -> [Worker:V]</p>
<p>Im constructing SQL to return some selected data from the E and the V that is recommending. So b... | <p>I'm not sure I understand what you need, is this useful?</p>
<pre><code>SELECT @this.toJson() FROM (
SELECT out('RecommendedBy').firstName as recommendedByFirstName,
out('RecommendedBy').lastName as recommendedByLastName,
out('RecommendedBy').@rid as recommendedByRID,
outE('RecommendedBy').... |
Join with inner list <p>I have this linq query:</p>
<pre><code>var investorData = from investor in db.Investors
join investorLine in db.InvestorStatementLines
on investor.InvestorID equals investorLine.InvestorID
where investor.UserId == userI... | <p>This is how you can do that with navigation properties</p>
<pre><code>var investorData = from investor in db.Investors
where investor.UserId == userId
select new InvestorViewModel()
{
InvestorId = investor.InvestorID,
... |
Laravel : How to send variable from one page to another in blade <p>I'm building a laravel application where from The first page I want to send a variable or say value to second page in a form ..How do I do it?
Let's say In my first page I have several buttons so when a user click on any one button, he will be redirec... | <p>So you want to create page with multiple course links and each link redirects to registration page with the course id to be used in the registration form.</p>
<p>Your a href link should look like this</p>
<pre><code>{!! link_to_route('registration',
$title = 'Course 1', $parameters = ['1'], $attributes =
['class... |
I am trying to format a horizontal navigation list <p>So I want to format a horizontal navigation list. In my HTML page it says: </p>
<pre><code> <nav class="horizontal">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">News &amp; Events</a... | <p>This should do the trick:</p>
<pre><code>nav.horizontal li {
display: inline-block;
}
</code></pre>
<p>Also <code>a:Nav.horizontal</code> is an incorrect selector. In CSS, the <code>:</code> selector is used to select elements in a special state, like a visited link or a checked input. See <a href="https://dev... |
How do I duplicate a Git repository including submodules? <p>I want to duplicate a repository, that also has a submodle - which is it's own repository.</p>
<p>When I duplicate the top-level repository (using the method described in <a href="//help.github.com/articles/duplicating-a-repository/" rel="nofollow">GitHub's ... | <p>You would want to create a fork of both the repo and any Sub modules into a private repo. Then you would just remove the submodule from the original repo, then add a new submodule from your fork.</p>
<p><a href="http://stackoverflow.com/a/28191261/6763316">HERE</a>'s a link that covers how to fork a public repo in... |
Cannot Link GLSL Program <p>I can't get the following Code to work. I want to render the triangle I describe in <code>position[]</code>.</p>
<p>The program gives me sometimes a shader compile error or a program linking error and sometimes even both without me changing the code in between.</p>
<p>Program:</p>
<pre><c... | <p>I think there are a few typos in your code. You write "vertexShaderID = glCreateShader(GL_Vertex_SHADER)", but macros are indicated in capital letters -> "GL_VERTEX_SHADER". Try glShaderSource(vertexShaderID, 1, vertexShaderCodeString, NULL), instead of passing 3 parametrs.</p>
|
NSUnknownKeyException error because of UIImageView and UITextField <p>I am getting NSUnknownKeyException error:</p>
<blockquote>
<p>this class is not key value coding-compliant for the key" for this line of code: @IBOutlet weak var UsernameTextField: UITextField!.</p>
</blockquote>
<p>However, I did check that ther... | <p>did you rename @IBOutlet weak var UsernameTextField: UITextField! to @IBOutlet weak var usernameTextField: UITextField! (lower case u) in your code file? That will cause this error. Its case sensitive.</p>
|
What is this blank area in tableview? <p>There is a large blank area at the top of my tableview. I can scroll the rows up into this area. I'm not sure what is causing it.</p>
<p><a href="http://i.stack.imgur.com/BHQ4B.png" rel="nofollow"><img src="http://i.stack.imgur.com/BHQ4B.png" alt="enter image description here">... | <p>You can try this:</p>
<p>YouStoryboard.storyboard > YouViewController > Attributes inspector > Uncheck - Adjust scroll view insets.</p>
|
Segmentation fault of pointer&char <p>Im trying to make the program that extract filenames by inputing some folderpath. </p>
<p>The outcome is fine, but the problem is at the end of outcome, there's some segmentation fault that i cant figure out. </p>
<p>Here's what I wrote in.</p>
<pre><code>#include <stdio.h>... | <p>When you call <code>scanf</code> with the <code>%s</code> format specifier, it expects a pointer to an array of characters. What you're passing is the address of a single character. So it writes past the memory location of that variable into whatever happens to be next to it. This invokes <a href="https://en.wiki... |
Nested Horizonal Menu updatable <p>I want make a 2-level horizontal menu updatable. I will have available the data previously loaded (php) and I want create this "effect". I sure this exists but I dont found anything using my mother language or searching in english.</p>
<p>My data structure is like this:</p>
<pre><co... | <p>It's entirely up to you. If you enjoy the experience of coding with JavaScript and CSS then definitely feel free to make it yourself. However, you might find that it is easier to use a template. In fact, you can do it entirely using CSS.</p>
<p>Try out this link and see if it's what you're looking for. Basically yo... |
Presto SQL - Converting a date string to date format <p>I'm on presto and have a date formatted as varchar that looks like - </p>
<pre><code>7/14/2015 8:22:39 AM
</code></pre>
<p>I've looked the presto docs and tried various things(cast, date_format, using split_part to parse and then cast) and am not getting this to... | <p>try this :</p>
<pre><code>SELECT convert(datetime, '7/14/2015 8:22:39 AM', 101)
</code></pre>
<p>output : </p>
<blockquote>
<p>2015-07-14 08:22:39.000</p>
</blockquote>
|
Cant i store 4294967295 in unsigned int ? Int is 4 bytes on my machine <p>Why am i getting 0 ?? And compiler warning:</p>
<blockquote>
<p>format â%dâ expects argument of type âintâ, but argument 3 has type âlong unsigned intâ</p>
</blockquote>
<p>Here is the code :</p>
<pre><code>#include <stdio.h&g... | <p>If your <code>int</code> or <code>unsigned int</code> is 32-bits, neither can store the value <code>4294967296</code> since this is <code>2**32</code> which would require a 64-bit type.</p>
<p>Even <code>uint32_t</code> can only store the max value <code>2**32 - 1</code> so your value is just <code>1</code> out of ... |
SQLite Code Analysis C# <p>I was wondering, how can i parse a SQLIte Query, and tokenize it in order to get the future to be affected entries after the execution of the query, to be able to set policies on a single SQLite database? </p>
<p>So far i have created a project that accepts modules. And there is a single SQL... | <p>A library? Probably not. Software you wish for rarely exists. That usually means you have to build it yourself or go without.</p>
<p>What you need is </p>
<ul>
<li>a parser of SQL queries, </li>
<li>a parser of user-capabilities (which user is allowed to update which tables/columns,</li>
<li>a SQL analyzer that c... |
Selecting/Uploading Image to Userform <p>I'm creating a userform that has an image box. It has the capability of browsing for file when the user clicks on the box. Ideally, I want the user to be able to upload a picture without having to navigate to Properties. I tried ImageBox.Picture = LoadPicture(PicPath) to upload ... | <p>Credit where credit is due: Thanks <strong>ccollins48</strong> on the vbaexpress forums! </p>
<p>Private Sub Screenshot_Click()</p>
<pre><code>Dim PictFileName As String
PictFileName = Application.GetOpenFilename
PicPath = PictFileName
If Len(Dir(PicPath)) = 0 Then
MsgBox PicPath & "Error"
Else
Me.Screenshot.... |
Updated to Swift 3 broke my swifty json code <p><a href="http://i.stack.imgur.com/DN956.png" rel="nofollow"><img src="http://i.stack.imgur.com/DN956.png" alt="enter image description here"></a>I am new in Swift and I have been developing my first ios Application. Would you please advice me what to do? Today I converted... | <p>Just add this pod row <code>pod 'SwiftyJSON', '3.0.0'</code> in your pod file to add <code>SwiftyJSON</code> for <code>Swift 3.0</code>.</p>
|
Am I guaranteed a single pair of constructor and destructor calls when returning an object initialized with braced init list? <p>Take the following class for example</p>
<pre><code>#include <iostream>
using namespace std;
class A{
private:
int a_;
int b_;
A(const A&) = delete;
A& opera... | <p>When you <code>return {a,b};</code> you directly construct the return value.</p>
<p>No temporary, logical or otherwise, is created. No elision occurs.</p>
<p>This return value is available in the returned context in <code>main</code>. You can call its <code>.ephemeral()</code> operation. At the end of the full-... |
Dynamic vector of objects in java <p>how to create a vector of objects inside a loop, What I mean is, I want to create multiple objects inside a loop and store them in a vactor so I can access them and their methods later.</p>
<p>I know I can do this with Array or list, but I'd like to know how using vectors.</p>
<pr... | <p>First of all my advice is start reading Java from first chapter.</p>
<p>Assume that you have a class called <code>User</code>.</p>
<pre><code>import java.util.*;
public class User{
// Two variables
int id;
String name;
// Constructor to create Object of User with id and name
public User(int id, St... |
std::move on a stack object <p>I know this is a very basic, probably even embarrassing, question, but I'm having trouble understanding this. If I std::move from something on the stack to another object, can the other object still be used when the original goes out of scope?</p>
<pre><code>#include <iostream>
#in... | <p>Yes it's still valid, the innerscope object loses ownership of the content it previously had, and outerscope becomes the owner. std::move is like a vector swap. If you swap outer and inner, destroying inner won't affect the content now owned by outer.</p>
|
how to count output and make newline every 7 characters? <p>I just learned the basics of Python , when searching google for cool thing to do with Python found this pdf : <a href="http://usingpython.com/dl/Binary_Images.pdf" rel="nofollow">Binary_Image</a>
(converting 1/0 to * and spaces) this pdf has a Challenge sectio... | <p>Change:</p>
<pre><code>if len(img_out) >= "7":
img_out = img_out + "\n"
</code></pre>
<p>To:</p>
<pre><code>if len(img_out) >= 7:
img_out = img_out + "\n"
</code></pre>
<p><strong>UPDATE</strong>:</p>
<pre><code>#get a binary number from the user
img_in = input("Enter your b&w bitmap i... |
Compute the median of dynamic time series <p>If I have a pandas series [a1,a2,a3,a4,...] with length = T. Each value corresponds to one day. For each day, I would like to compute the historical median. For example, the first day compute the median of [a1]; the second day compute the median of [a1,a2]; the nth day compu... | <p>For a Series, <code>ser</code>:</p>
<pre><code>ser = pd.Series(np.random.randint(0, 100, 10))
</code></pre>
<p>If your pandas version is 0.18.0 or above, use:</p>
<pre><code>ser.expanding().median()
Out:
0 0.0
1 25.0
2 50.0
3 36.5
4 33.0
5 36.0
6 33.0
7 36.0
8 33.0
9 36.0
dtype: fl... |
In GORM, Object is not modified in database when the object property is modified at Controller <p>In my Grails App, I have bootstrapped an object of a domain class as:</p>
<pre><code>def user1 = new Users(userID: 1, name: "John Doe")
user1.save()
</code></pre>
<p>In my dashboard controller i have retrieve... | <p>You need to consider two things:</p>
<ol>
<li><p>If you do <code>save()</code>, it only retains in hibernate session, until you flush it the changes does not persist in database. So, better do <code>save(flush:true, failOnError: true)</code> and put in <code>try/catch</code> block and print exception.</p></li>
<li>... |
image not drawn first time javascript <p>I know this question has been asked many times. However, I have used img.onload to properly execute what will be drawn to the canvas after the image is loaded. I am new to javascript and having trouble figuring it out. I have done the whole code in a function and calling it from... | <p><em>General advice:</em></p>
<p><strong>Are both the <code>onload</code> callbacks being triggered?</strong></p>
<p>If not, check the image <code>.src</code>. </p>
<p><strong>Also, check the values you are sending into <code>drawImage</code>.</strong></p>
<p>Are the resulting <code>x,y</code> off the visible can... |
PHP saveHTML function is not saving HTML properly <p>I have been trying to save the source code of a section of a <a href="https://www.searchenginejournal.com/google-fights-fraud-cracking-plumbers-locksmiths/175362/" rel="nofollow">webpage</a> using PHP. When I extract the content of whole webpage, the source code orde... | <p>First of all, your code should be triggering a good bunch of warnings like these:</p>
<blockquote>
<p>Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in
Entity<br> Warning: DOMDocument::loadHTML(): Unexpected end tag :
strong in Entity<br> Warning: DOMDocument::loadHTML(): Tag header
inv... |
Python Flask Sqlalchemy Subst Query <p>I am working on an internel search engine at my company written in python utilizing flask and sqlalchemy(sqlite). My current problem is that I would like to.</p>
<p>A.) Query on a certain amount of information for the description field
B.) Preferable query before it 50 character... | <p>This has nothing to do with the <code>mid</code> function. The error message says <code>'BaseQuery' object is not callable.</code> Where are you calling <code>BaseQuery</code>? Here:</p>
<pre><code>Item.query(...)
</code></pre>
<p>The correct incantation is:</p>
<pre><code>db.session.query(func.mid(...))
</code><... |
GAE python: success message or add HTML class after redirect <p>I've a website with a contact form running on a google App Engine. After submitting I'd like to redirect and show a message to the user to let him know the message was sent, this can eighter be a alert message or adding a class to a html tag. How can I do ... | <p>After the redirect a request <strong>different</strong> than the POST one for which the email was sent will be served.</p>
<p>So you need to <strong>persist</strong> the information about the email being sent across requests, saving it in the POST request handler code and retrieving it in the subsequent GET request... |
How to, drop down menu that returns values from another workbook. <p>I would like to create a dropdown menu that populates certain cells from another worksheet.
My reference sheet is like this.
<a href="http://i.stack.imgur.com/ydsPB.png" rel="nofollow">Reference sheet</a></p>
<p>Now I would like to select a curren... | <p>Assuming that the Prices data is located at <code>Sht(13)</code> range <code>B1:AD8</code> and that the currency combination is at <code>C2</code> try these formulas:</p>
<p>Proximal Zone Price: <code>=VLOOKUP($C$2,'Sht(13)'!$B$1:$AD$8,27,0)</code></p>
<p>Distal Zone Price: <code>=VLOOKUP($C$2,'Sht(13)'!$B$1:$AD$8... |
Where is the array stored when I used initialisation as int array[10] = {0}; <p>By default, the local arrays are stored in <strong>stack</strong>. Uninitialised local arrays would be allocated garbage values.
But why does this syntax <code>int array[10] = {0};</code> initialises all array elements to zero by default? E... | <p>Whether or not a local array is initialized has no bearing on whether or not it is stored on stack. </p>
<p>If the implementation uses a stack, then the array will be on the stack, initialized or not.</p>
<p>From section 6.7.9 of the <a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf" rel="nofollo... |
Pass element as argument when creating event via DOM - JS Javascript <p>I'm trying to create HTML elements usingn DOM. I need to pass the <code><li></code> element to the <code>toogle</code> method as follows:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<... | <p>This:</p>
<pre><code>li.onclick = toogle(this);
</code></pre>
<p>actually EXECUTES that <code>toogle</code> function, and assigns its return value to the onclick. If you want your function to be called AS the click handler, then it should be</p>
<pre><code>li.onclick = toogle;
</code></pre>
|
Need help grouping multiple rows into single string based on GROUP BY? <p>This question may have been asked before but I've been doing some digging and can't find anything quite like it. Thanks in advance</p>
<p>EDIT: Totally forgot. We're using SQL 2005 (otherwise I'd likely just use GROUP_CONCAT)</p>
<p>Sample Tabl... | <p>Use GROUP_CONCAT()</p>
<pre><code>SELECT ID,CATEGORY,GROUP_CONCAT(ATTRIBUTE)
FROM TABLENAME
GROUP BY ID,CATEGORY
</code></pre>
|
Terminate loop at any given time <p>I have the following code which turns an outlet on/off every 3 seconds.</p>
<pre><code> start_time = time.time()
counter = 0
agent = snmpy4.Agent("192.168.9.50")
while True:
if (counter % 2 == 0):
agent.set("1.3.6.1.4.1.13742.6.4.1.2.1.2.1.1",1)
... | <p>You can put the loop in a thread and use the main thread to wait on the keyboard. If its okay for "something to be entered" can be a line with line feed (e.g., type a command and enter), then this will do</p>
<pre><code>import time
import threading
import sys
def agent_setter(event):
start_time = time.time()
... |
How are generated ids on trello? <p>I'm studying the Trello api and had the following doubts:
How is generated the id of the cards, boards and lists on trello?
Is it used some kind of hash?
thanks in advance.</p>
| <p>You must not make any assumptions on how id's are generated because if you rely on them, your code will eventually break. It is a good tone to generate id's in such a way, that it will be impossible to predict them or make any assumptions. Hashes or random numberas are a good way to achieve that. One of common way... |
How to get access to the update immutability helper in ReactJS <p>I've found on <a href="https://facebook.github.io/react/docs/update.html" rel="nofollow">this documentation page</a> that there is an update immutability helper that I can make use of. The only thing is that I'm confused about how to get access to it wi... | <p>Looks like because I'm including <code>react-with-addons.js</code> I am able to access the helper through the following code:</p>
<pre><code>var update = React.addons.update;
</code></pre>
|
MVC show message on object tag has error <p>I have the following code to retrieve a pdf file and display in the view (it's a bootstrap modal partial view). Things are good except when the PDF is empty, or any error is being thrown, I only see an empty modal. Does anyone know if there's a way that I can post a short mes... | <p>Use <code>TempData</code> to store error message and in the View place JavaScript so that if error message is not null, then show an alert</p>
<pre><code> if ( memStream.Length <= 0 )
{
// I want to throw a simple error msg back, what to do?
TempData["CustomNullError"] = "sorry, error";
}... |
Correct usage of Decimal objects in this expression <p>I need to calculate the area of any regular polygon. I acquired this formula from a good ol' google:</p>
<pre><code>(n * l**2) / (4 * math.tan((180/n) * (math.pi/180)))
</code></pre>
<p>No matter how I use <code>decimal.Decimal</code> with these values I can neve... | <p>You need to set the precision for the decimal object. Pi is an infinite decimal number, so the precision won't be a whole number.</p>
<p>You can do</p>
<pre><code>from decimal import *
getcontext().prec = 1
</code></pre>
<p>or add to the decimal object by rounding down.</p>
<pre><code>>>> Decimal('7.32... |
exception in application start method even though i have saved image in resource folder at src level <p>I have saved the imgserver.png in resources folder at src level but still i get this error.can any anyone tell me the exact solution.</p>
<pre><code> package javafxapplication1;
import com.sun.javaws.Main;
... | <p>try :</p>
<pre><code>Image image = new Image(getClass().getResourceAsStream("/resources/imgserver.png"))
</code></pre>
<p>and move the resources folder inside src.</p>
<p>and may i know the IDE you are using ?</p>
|
Does Apache's ContextMap Need To Be Explicitly Cleaned Up? <p>As I was poking around in the ThreadContext documentation I noticed this gem:</p>
<p><a href="https://logging.apache.org/log4j/2.0/log4j-api/apidocs/org/apache/logging/log4j/ThreadContext.html#removeStack()" rel="nofollow">removeStack()</a></p>
<blockquote... | <p>The ThreadContextMap and Stack are maintained in a ThreadLocal variable. In a servlet environment (such as Tomcat) if you don't clear up the items in the Map then the next request will still have those values even if they don't apply to that request. So in an environment like that you definitely want to clear the Ma... |
Redirecting anything in a subdirectory to an absolute directory path <p>Using a RewriteRule I'm trying to redirect every url in a subdirectory to another subdirectory as an absolute path, trimming anything that came after the first directory. Example:</p>
<p>www.domain.com/store/search<br>
www.domain.com/store/search... | <p>If the .htaccess is in the root directory you can do something like this</p>
<pre><code>RewriteEngine on
RewriteRule ^store/search(.*)?$ ./newdir/$1 [R=301,NC,L]
</code></pre>
<p>Or if the .htaccess is in the "store" directory you could do this...</p>
<pre><code>RewriteEngine on
RewriteRule ^search(.*)?$ http://w... |
XQuery multivalued fields (IDREFS) <p>In my XML file I have this element</p>
<pre><code> <subtopics>tr1 tr2</subtopics>
</code></pre>
<p>which I retrieve in XQuery using the following query</p>
<pre><code>doc("data.xml")/expert_schema/topic/data(subtopics)
</code></pre>
<p>How can I retrive <code>tr1</c... | <p>If performance is not a problem, then you can simply tokenize the values as you query them:</p>
<pre><code>doc("data.xml")/expert_schema/topic/tokenize(subtopics, '\s')
</code></pre>
|
NSMetadataQuery returns nothing <p>Using xcode 8 running on iOS 10. Trying to put together a super simple NSMetadataQuery. Waisted almost a day on this now. Managed to get this to do a query, but it doesn't return any documents from My iCloud, none.</p>
<pre><code>class ViewController: UIViewController {
var meta... | <p>Ok,</p>
<p>After much searching I think I found the answers. This app created its own iCloud subdirectory [with the same name] and if I copy files into it; I can see them. It works.</p>
<p>But I can only see files and not directories, a limitation of NSMetadataQuery it seems.</p>
<p>My investigations also took me... |
How could I write a C program that takes an integer from command line? <p>I want to write a C program that takes positive integer n from standard input, and outputs n+1. It is supposed to work like this</p>
<pre><code>./myprog 3
--> returns 4
./myprog -2
--> crashes
</code></pre>
<p>I tried using scanf. But... | <pre><code>#include <stdio.h>
#include <stdlib.h>
int main(int argc, char * argv[])
{
int n = atoi(argv[1]); // n from command line
n = n + 1; // return n + 1
printf("%d", n);
return 0;
}
</code></pre>
|
changing Background color when swiping left or right <p>I have <code>RelativeLayout</code> which have three <code>TexView</code>. I want change Background colour of <code>RelativeLayout</code>(only change background all other views inside Relativelayout are same) when swipe left or right. </p>
<p>i tried with <code>Vi... | <p>You have to use some methods of viewPage and RelativeLayout.</p>
<pre><code>switch(mView.getCurrentItem()){
case 0: mRelativeLayout.setBackgroundColor(Color.Red);break;
case 1: mRelativeLayout.setBackgroundColor(Color.Blue);break;
case 2: mRelativeLayout.setBackgroundColor(Color.Black);break;
}
</code></pre>
<p>I ... |
SQL : Currency Conversion from given currency to destination currency <p><a href="http://i.stack.imgur.com/I0H77.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/I0H77.jpg" alt="enter image description here"></a></p>
<p>I have two tables, Table1 with amount , amountCurrency and destination currency and Table2 ha... | <p>All you need is one query with an instance of your base table and two instances of your conversion table, one joined on <code>base.amountCurrency = rate.currency</code> and the other joined on <code>base.destinationCurrency = rate.currency</code>. If you need to add <code>conversion_date</code> criteria in, you can... |
Multiple directives asking for new/isolated scope - Angular Material tabs <p>I'm getting this error:</p>
<pre><code>Multiple directives [ngController, mdTab (module: material.components.tabs)] asking for new/isolated scope on: <md-tab label="Usuários" ng-controller="AccountCompanySearchController">
</code></pre... | <p>The issue is that ng-controller creates an isolated scope. This is mentioned in the official Angular documentation.</p>
<p>Your third party component also creates an isolated scope as they probably require for the component to be able to store variables without polluting your scope data.</p>
<p>The solution is to ... |
pip error after upgrading pip & scrapy by "pip install --upgrade" <p>Using debian 8(jessie) amd64 with python 2.7.9. I tried following commands:</p>
<pre><code>pip install --upgrade pip
pip install --upgrade scrapy
</code></pre>
<p>after that, I am getting following pip error</p>
<pre><code>root@debian:~# pip
Trace... | <p>Got the exact same error today, but in a different situation. I suspect this is related to <code>cryptography</code> module.</p>
<p>What helped me was to install a specific version of <code>cffi</code> package:</p>
<pre><code>pip install cffi==1.7.0
</code></pre>
|
c: freeing an mallocated object error <p>Okay, so I have a method which I call. The called method returns a <code>char*</code>, which is allocated inside the called method. After having assigned the returned <code>char*</code> to a new <code>char*</code>, I want to free this, after using it. But Xcode complains and thr... | <pre><code>ret = "no";
</code></pre>
<p>That overwrites the pointer. Change to:</p>
<pre><code>strcpy(ret, "no");
</code></pre>
<p>Same applies for the <code>"yes"</code> case.</p>
<p>Also, as pointed out by @DavidSchwartz, for your purposes it is probably not necessary to use dynamically allocated memory. Could ju... |
Law of Sines in Java <p>So I am trying to write a program for my AP comp sci class in High School, and we are told to find the angle measures of a triangle with only the side lengths given, I have used the law of cosigns to find the first angle and am trying to use the law of sines to find the second, however it doesn'... | <p>Math.acos returns a value already in radians, so just remove the Math.toRadians and it will work fine:</p>
<pre><code>angles2 = Math.asin(Math.sin(angles1) * s2 / s3);
</code></pre>
|
Angular directive receiving object as attribute using Typescript <p>I am developing using Angular 1.5.8 and Typescript
I have a directive which is used under the scope of another directive (and another controller of course). Let's say Directive1, Controller1 and Directive2, Controller2.
Given the Controller1 already h... | <p>If you want to share data between different locations in your application, just put it in a service and use DI wherever you need the data.</p>
<p>That is, fetch the data, store it in a service and use DI to make the data available in different locations. There is no need to pass data through bindings over several ... |
convert dictionary keys in playbook <p>I have an existing playbook variable dictionary defined like:</p>
<pre><code>vars:
resource_tags: {
Name: "some name"
Service: "some service"
}
</code></pre>
<p>This is used in various calls to tasks in this form. But in another task, I need it in a different format... | <p>If you don't mind a bit of hackery:</p>
<pre><code>- debug: msg="{{ resource_tags | to_json(indent=0) | regex_replace('\n\"','\n\"tag:') }}"
</code></pre>
<p>This will convert your dict into JSON-formatted string with <code>indent=0</code>, meaning each key will start from new line; then insert <code>tag:</code> a... |
Custom WPF window style <p>I'm trying to make a custom window style. The goal is to create a template that migth be used by every window in my application. Template contains the toolbar, title and "the area which will be used by window". The problem is: When I use my style I can no longer add grid and conrols.</p>
<p>... | <p>You need to add a <code>ContentPresenter</code> where the <code>Content</code> of your <code>Window</code> goes. Try this.</p>
<pre><code><Style x:Key="CustomWindowStyle" TargetType="{x:Type Window}">
<Setter Property="WindowStyle" Value="None"/>
<Setter Property="AllowsTransparency" Value="True"... |
Month to year Aggregation in plsql <p>I have a fact table where I have each kpi name, value for the kpi and the month it belongs to. I need to do the aggregation from the month level to year level. For rolling up from month to year, I will use the confirmed dimension table (time dimension) to get to know the year for e... | <p>I have no idea what a KPI is; here is a "proof of concept" of how this may work.</p>
<pre><code>with
dim ( kpi, agg_type ) as (
select 1, 'max' from dual union all
select 2, 'avg' from dual
),
facts ( kpi, val ) as (
select 1, 100 from dual union all
select 1, 300 from d... |
How to configure teamcity build agent to use include files on system? <p>I've a project that uses boost headers/libraries for which I would like to create a build configuration for a team city build agent (TeamCity 10.0.2 / Windows 10 / Visual studio 2015). The boost headers/libraries are not part of the project (that ... | <p>In your build configuration create a <strong>new build step</strong> before <code>sln</code> build which copies boost headers into proper folder. Use <a href="https://confluence.jetbrains.com/display/TCD10/Command+Line" rel="nofollow"><em>Command Line Runner</em></a> together with <code>xcopy</code> command to do th... |
Cant run sudo npm install -g typescript <p>Getting unintelligible problems. Darwin 16.1.0 is a problem? not sure what these web pack things are or how to validate them.</p>
<pre><code>ian$ sudo npm install -g typescript
/usr/local/bin/tsc -> /usr/local/lib/node_modules/typescript/bin/tsc
/usr/local/bin/tsserver -&... | <p>It has nothing to do with Typescript, NPM is telling you that your Webpack version is not compatible with other modules you have, type <code>npm install webpack</code> to install current Webpack version (non beta) to fix the problem.</p>
<p>BTW even with EPEERINVALID Typescript should be installed, try <code>tsc --... |
Using local system as ssh client and server <p>I am using local system to learn ssh and what I am trying to do is execute a command on the remote server.
I have ssh server running on terminal1 and client on terminal2.
I used the following command on terminal2:</p>
<pre><code>ssh user1@127.0.0.1 echo Display this.
</co... | <p>It worked correctly. It ssh'd into the server, executed the command, and returned the stdout of that command back to you. </p>
<p>SSH gains access to the server, but not necessarily any TTY's active on it. You would have to jump through some hoops to send text to a specific TTY, such as your Terminal1.</p>
<p>A be... |
Is it possible to have two variables point to the same memory address in C#? <p>So I'm playing around with C# right now, coming from the world of C++.</p>
<p>I'm trying to make two object variables point to the SAME memory address, in a way that if I edit variable 1, variable 2 is also being changed.</p>
<p>Is this p... | <p>Rick -
If you're coming from the world of C++, the most important thing to remember is that any time you have an instance of a <code>class</code> or an <code>interface</code> in your code, this is roughly equivalent to a pointer in C++. We call these reference types. When you assign one class reference to another cl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.