input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Apache Camel Spring DSL, referring to an environment variable HOSTNAME <p>I am using Apache Camel 2.16.0 with Spring DSL
I have a Spring context XML in which I have defined a Property PlaceHolder to read the properties from various files as follows- </p>
<pre><code> <bean id="propertyPlaceholder" class="org.spr... | <p>I found a solution at <a href="http://camel.apache.org/using-propertyplaceholder.html" rel="nofollow">http://camel.apache.org/using-propertyplaceholder.html</a>
at Bridging Spring and Camel Property Placeholders</p>
<p>It mentions following - </p>
<p>The Spring Framework does not allow 3rd party frameworks such a... |
Android program connects to remote socket via Wifi but not via mobile data <p>I've used sockets to connect to my device which listens to port 8000. Also I've configured my router to forward requests on port 8000 to my device.</p>
<p>When android phone is connected to Wifi (both locally and remotely) every thing is fin... | <p>Maybe you're using local IP when connected to WiFi or a local scan or something and you have something like <code>192.168.1.102</code> , you'll need to use your public IP, the one your Internet provider assigns you.
Then, that connection will get to your router, if you need specific port connection, your router will... |
How to replace a string in a file only if the line containing it also contains a number found in another file using Bash? <p>I would like to replace all instances of <code>target</code> with <code>replace</code> in the following file.csv using Bash, but only if the line containing it also contains a number found in lis... | <p>It is a job suited more for <code>awk</code>:</p>
<pre><code>awk 'BEGIN { FS=OFS="," } # set input/output field delimiter to comma
FNR == NR { # for 1st file in the arguments i.e. list.txt
a[$1] # store each value of $1 in an array a
next ... |
Trying to find the dynamic iframe page in selenium webdriver <p>In my project there is an iframe whose id is changed every time we click on that</p>
<p>
</p>
<p>I tried numerous ways to work on that</p>
<pre><code>1) List<WebElement> frameList=driver.findElements(By.tagName("iframe"));
... | <p>If you have fixed number of <code>iframes</code>, you could use that specific index for accessing your specific <code>iframe</code>. Let, you have five <code>iframes</code> and you want to select 3rd <code>iframe</code> then switch to it by using</p>
<pre><code>driver.switchTo().frame(2);
</code></pre>
<p>I think,... |
VBA print a value in msg box <p>I'm stuck in an assignment for school, this is what i have to do:</p>
<p>This is the current code I have:</p>
| <p>You need to loop in the array you've loaded and :</p>
<pre><code>Sub Ratio()
Dim OperatingRatio() As Double
Dim j As Long
With Sheets("Summary")
OperatingRatio = .Cells("I80:M80").Value
For j = LBound(OperatingRatio, 2) To UBound(OperatingRatio, 2)
If OperatingRatio(1, j) > 100 Then
... |
Chrome Web notification 'MismatchSenderId' error <p>I have deployed the <a href="https://github.com/GoogleChrome/push-notifications" rel="nofollow">sample code</a> for Chrome push notifications and updated the <code>gcm_sender_id</code> to a newly configured project, the client is able to subscribe/unsubscribe without ... | <p>This was my own fault; the sample registration ID's were in a different format to the generated ones I was seeing and did not contain semicolons which I was using to strip the registration ID from the subscription endpoint string. Splitting the endpoint by a forward slash and taking the last instance returned the co... |
how to list all variables of function c# <p>i have a Function with a lot of parameters
how can do like this print all parmetrs Kay, Value</p>
<pre><code>public string GetCompatibility(int MediaId, int ProductsTypId, string id, string PreviousURL, HttpRequestBase Request, int? Width, int? Height, int? CampaignID)
{
... | <p>Mostly having so many parameters on a method shows that your method does too many things. You should consider to refactor it into smaller chunks of logic. </p>
<p>Anyway if you think your method already <em>is</em> as small as possible you should put all parameters into a single DTO:</p>
<pre><code>public class Pa... |
NotificationListenerService sendBroadcast not working? <p>I'm trying for well over 10 hours now and I can't seem to think about anyhting else. I tried every possible example on the internet, but to no avail.</p>
<p>I have NotificationMonitor class extending NotificationListenerService and I wanted to send message from... | <p>Oficially, I'm a moron. Answer is: I didn't set up <code>Category</code> filter in <code>IntentFilter</code> and this is why I received zero properly sent intents from my class. So, long story short, to "fix" this mistake all one needs to do is add:</p>
<pre><code>filter.addCategory("com.testpackage.test.TEST_CATEG... |
Unable to accept CA certificate though added to truststore <p>I am having problem with accepting self signed CA certificate with java.</p>
<p>The problem is that in some situations the certificate is accepted and everything goes great. in another ones things are not so good. </p>
<p>As the steps I can describe the fo... | <p>It turned out that the certificate wasn't really added to the store.
After fixing the problem with addition everything works fine.</p>
|
Swift 3 - Object type 'RealmSwiftObject' is not managed by the Realm exception <p>I am using <a href="https://realm.io/docs/swift/latest/" rel="nofollow">Realm</a> with Swift 3 in my iOS app. I have the following code</p>
<pre><code>//Find all records for the day
func findForToday<T: Object>() -> [T] {
le... | <p>The error message is indicating that <code>T</code> has been inferred as <code>Object</code> rather than <code>MyModel</code>, so you will need to adjust the call site to ensure Swift picks the correct type.</p>
|
From Angular2 Validation <p>Hello I would like to know if is possible to create a if statement within the form group of Angular2. </p>
<p>I want if the user click on the checkbox then the input field test should be considered(the field should be required) otherwise not. How can I realise it?</p>
<p><strong>Angular2 f... | <p>Try this:</p>
<pre><code>constructor(fb:FormBuilder){
this.recordform = fb.group({
name:['',Validators.required],
test:['',Validators.required]
}
});
this.recordform.controls.test.valueChanges
.subscribe(value => {
if(!value)
this.recordform.removeCo... |
Store existing buttons in a array in c# <p>so far I Have this code.</p>
<pre><code>Button[] buttons = this.Controls
.OfType<Button>()
.ToArray();
for (int i = 0; i < 25; i++) {
buttons[i].FlatStyle = FlatStyle.Flat;
buttons[i].ForeColor = Color.Red;
}
</code></pre>
<p>and it gives me a <code>Ind... | <p>Do not use <em>magic numbers</em> (<code>25</code>):</p>
<pre><code>Button[] buttons = this.Controls
.OfType<Button>()
.ToArray();
foreach (var button in buttons) {
button.FlatStyle = FlatStyle.Flat;
button.ForeColor = Color.Red;
}
</code></pre>
<p>If you insist on <code>for</code> loop (please, not... |
How to make a synchronous request using Alamofire? <p>I am trying to do a synchronous request using <code>Alamofire</code>. I have looked on Stackoverflow and found this question: <a href="http://stackoverflow.com/questions/36845356/making-an-asynchronous-alamofire-request-synchronous">making an asynchronous alamofire ... | <p>when you use completion handler do not use return. </p>
<pre><code>func loadData(completion: @escaping (_ number: Int, _ strArr1: [String], _ strArr2: [String], _ strArr3: [String]) -> ()){
Alamofire.request(url!, method: .get, parameters: nil, encoding: JSONEncoding.default, headers: nil).responseJSON { resp... |
How to handle templating with webpack and html webpack text plugin? <p>I have a project that uses Twig for templating. All the data in it is static, but I have separated out parts of the page within other twig files for clarity sake (otherwise there would be hundreds of lines of markup in one file).</p>
<p>I'm using w... | <p>You can use <code>ejs-render-loader</code>. <a href="https://github.com/tracker1/ejs-render-loader" rel="nofollow">see package</a>.</p>
<pre><code> // webpack
new HtmlWebpackPlugin({
filename: 'a.html',
hash: true,
template: 'ejs-render?a.ejs',
})
/... |
cannot get lighttpd configured to PHP 7 <p>Apart from logging to the wrong file (the error log defined for that vhost defined last),<br>
lighty does not let me use PHP 7. What am I missing?</p>
<p><code>cgi.fix_pathinfo</code> is enabled in <code>/etc/php/7.0/fpm/php.ini</code>.</p>
<p>How can I <code>make sure you'r... | <p>Tried a search engine?
<a href="https://www.google.com/?gws_rd=ssl#q=lighttpd+ubuntu+php+7" rel="nofollow">https://www.google.com/?gws_rd=ssl#q=lighttpd+ubuntu+php+7</a></p>
<p>The first hit:
<a href="https://www.howtoforge.com/tutorial/installing-lighttpd-with-php7-php-fpm-and-mysql-on-ubuntu-16.04-lts/" rel="nofo... |
How to disable a button if no checked boxes are clicked <p>I have checkbox column in my data table and I want to hide a button if none of checked boxes clicked.[including pagination].
below is my code I used to get the values when clicking button,pls advice,</p>
<pre><code>$('#button').click(function () {
var id =... | <p>You can add an event listener to all of your checkboxes. Whenever something changes, you check if all of them are un-checked => disable the button, else => enable the button.</p>
<pre><code>$(".groupCheckBox").on('change', function(){
if($(".groupCheckBox:checked", oTable.fnGetNodes()).length == 0){
$('... |
Implementing Fisher Yates Algorithm <p>there I have method in java which randomize a number of integers in a array. But it take too long, I am trying to find faster method to do this , I think the fisher Yates Algorithm is the solution but i am not sure how to implement this with my code. </p>
<pre><code>protected voi... | <pre><code>N = array.length;
for i in [0, 1, 2, ..., N - 1]:
random_index = random(i, N - 1);
swap(array[i], array[random_index]);
</code></pre>
|
multiple instances of react components not working? <p>Iam trying to create multiple instances of my react component, but only the first one is rendered. I guess iam doing some major fail here :)</p>
<p>Here is the component.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel=... | <p>Rather than use <code>id</code> attributes like you would with other frameworks, use <a href="https://facebook.github.io/react/docs/working-with-the-browser.html#refs-and-finddomnode" rel="nofollow"><code>ReactDOM.findDOMNode</code></a> inside a React component to get a reference to the real DOM node. Do that only w... |
In Multi-dimensional array products, how do I align axes with and without summation? <p>What is the best way to do array operations when there are some repeated indices which are summed over AND others which are not? It seems like I may have to use <code>einsum</code> for these operations, but it would be better if th... | <pre><code>In [85]: I,J,K,L=2,3,4,5
In [86]: a=np.ones((I,J,L))
In [87]: b=np.ones((J,K,L))
In [88]: np.einsum('ijl,jkl->ijk',a,b).shape
Out[88]: (2, 3, 4)
</code></pre>
<p>Playing around with the new <code>@</code> operator, I find I can produce:</p>
<pre><code>In [91]: (a[:,:,None,None,:]@b[None,:,:,:,None]).sh... |
Plotting points using Nested For Loops <p>I'm relatively new to C++ and we have been given this task to do:</p>
<blockquote>
<p>Write a C++ program which asks the user for a number n between 1 and 10. The program should then print out n lines. Each should consist of a number of stars of the same number as the curr... | <p>Step through the logic of your program using pen and paper.</p>
<p>For your "horizontal" loop, you go all the way up to <code>n</code> each time. Is that right? I think you meant to go only as far as <code>x</code>, as this is the value that increases with each line.</p>
<p>The other problem is that you have one t... |
SQL Server Join with Wildcard and stop on first match <pre><code> IF OBJECT_ID('tempdb..#TABLE1') IS NOT NULL DROP TABLE #TABLE1
IF OBJECT_ID('tempdb..#TABLE2') IS NOT NULL DROP TABLE #TABLE2
CREATE TABLE #TABLE1
(
CODE_NAME_T1 NVARCHAR(20)
)
CREATE TABLE #TABLE2
(
CODE_NAME... | <p>Here is one method using <code>OUTER APPLY</code>:</p>
<pre><code>SELECT T1.CODE_NAME_T1, T2.CODE_NAME_T2
FROM #TABLE1 T1 OUTER APPLY
(SELECT TOP 1 t2.*
FROM #TABLE2 T2
WHERE T1.CODE_NAME_T1 LIKE '%' + T2.CODE_NAME_T2 + '%'
) T2;
</code></pre>
<p>Note: You almost always want an <code>ORDER B... |
How can I see long stack traces in my tests? <p>When I run my test suite, failures will only include short stack traces.</p>
<p>bluebird supports generating <a href="http://bluebirdjs.com/docs/features.html#long-stack-traces" rel="nofollow">long stack traces</a>, but when I try to enable them, I suddenly get <em>only<... | <p>To see the full, long stack trace, you need to <em>both</em> enable long stack traces, as mentioned in the documentation <em>and</em> run mocha with <code>--full-trace</code>.</p>
<p>For example:</p>
<pre><code>$ BLUEBIRD_DEBUG=1 mocha --full-trace
</code></pre>
|
function template specialization is ignored <p>I have written a template function, which uses 2 other template functions (add & mul), in <strong>math_functions.h</strong> file :</p>
<pre><code>template <typename Dtype>
Dtype mulvadd(Dtype* pa, Dtype* pb, int size, Dtype c)
{
Dtype result = Dtype(0);
... | <p>The compiler will not know about the specializations when it compiles the file with the <code>main</code> function. All it knows are what is in the header file.</p>
<p><em>Declare</em> the specializations in the header file, so the compiler knows about them.</p>
|
JavaScript: show password on hold <p>I have 2 inputs for passwords. Each input field has 'show' button, which shows password on holding that button.</p>
<pre><code><form name="resetting_form" method="post" action="">
<div class="form-group has-feedback">
<input type="password" id="password_f... | <p>When you use <code>$(".form-control")</code>, jquery select all <code>.form-control</code> element. But you need to select target element using <code>this</code> variable in event function and use <a href="https://api.jquery.com/prev/" rel="nofollow"><code>.prev()</code></a> to select previous element.</p>
<pre cla... |
Circular radius intersection (like a circular cursor brush) - Three js <p>I'd like to be able to catch the faces of an object in the radius of a circular cursor (like in painting/photoshop).</p>
<p>I'll show you what is it for <a href="https://jsfiddle.net/Shaggisu/w7ufmutr/9/" rel="nofollow">https://jsfiddle.net/Shag... | <p>You can do this in javascript, modifying vertex color, like you do it in your sample but you will be quickly limited by the number of polygon.</p>
<p>That said, consider your brush like a cone, which start from the Ray.origin and extend in Ray.direction. The radius of the cone is driven by the radius of your brush.... |
FosMessageBundle: finding route for creating a new message <p>I have installed FOSMessageBundle. I think my installation is correct. No error on doctrine:generate:entities neither on doctrine:schema:update.</p>
<p>I see in ressources/routing.xml there is this route:</p>
<pre><code><route id="fos_message_thread_new... | <p>Maybe try use the <code>debug:router</code> command. It should shows you details for the route (including the full path of the route).</p>
<p><code>app/console debug:router fos_message_thread_new</code></p>
|
symfony ajax form dynamically modify <p>I have the following form that contains data from the database it still WIP ( i'm missing a few fields that i didn't add yet).
The form loads data in the first select and based on that select i use ajax to populate a second select with options based on the first select ( basicall... | <p>When you run the function <code>$form->isValid()</code>, it checks against the form it built in the <code>buildForm</code> function. Any extra fields/value that aren't there will cause this error.</p>
<p>You can change this behaviour by using <a href="http://symfony.com/doc/current/form/dynamic_form_modification... |
Array out of range with check function <p>I've got an array and a check function.</p>
<p>Function when tapped on button:</p>
<pre><code>// VARS
var workoutArray: [workout]!
var index = Int()
@IBAction func finishExerciseBtnPressed(_ sender: AnyObject) {
// reload tabledata with next exercise in array
print... | <blockquote>
<p>I am checking if the index is equal or lower to the count of the arrays.</p>
</blockquote>
<p>That's right. However, you are doing it before incrementing the index, and since indexing starts at zero, you should stop one index before the end:</p>
<pre><code>var index = 1 // Set the index to 1 initial... |
c++ char* + std::vector memory leak <p>The following code is reading a big object collection (95G of compressed objects that are uncompressed via the WriteObject streamer) from disk and prints their content as strings.</p>
<p>object.cxx:</p>
<pre><code>std::vector<char> ObjectHandler::GetObject(const std::strin... | <p>"Memory Leak" is a term that can encompass a few things; depending on who you talk to.
One is a new without matching delete.
The other, often looked over, is memory that's still referenced and in scope, but just not used or needed.</p>
<p>If you don't use a profiller, then you can't be sure which you have, but sinc... |
Lodash choose which duplicates to reject <p>I have array of objects, objects have properties say "a", "b" and "c".
Now I need to filter out objects which has unique values of "a & b".
However c plays role on which objects to keep and which ones to reject.</p>
<p>If I do uniqBy on properties a and b, I will be blin... | <p>According to Lodash documentation, the order of result values is determined by the order they occur in the array. Therefore you need to order the array using the 'c' property in order to get the expected result.</p>
<p>To do so, you can use _.sortBy. It orders a collection in asc order based on a property or an ite... |
How can I use two conditions in duplicate function? <p>I've got a data.frame with this data and 10 columns</p>
<pre><code>ID | sequence | modification| ... | nºproject
DAT | atggggg | NULL | ... | project
DAT | atggggg | 7.UN | ... | project
DAT | actgat | NULL | ... | project
DAT | atgta... | <p>If <code>new_data_frame_PEP</code> is a data frame and you want to retrieve the rows that have duplicates in <code>sequence</code>, you can <strong>instead</strong> use:</p>
<pre><code>res <- new_data_frame_PEP[duplicated(new_data_frame_PEP$sequence) |
duplicated(new_data_frame_PEP$sequ... |
Is it possible to change/update the company details for an Apple Developer Enterprise Program? <p>I have enrolled for Apple Developer Enterprise Program using the details of company ABC (Parent Company). Now there is a situation where we will need the Enterprise Program to have the details of company XYZ which is the s... | <p>I think, you don't have to enroll again.
I've never had an exact case. But it shouldn't be something different.</p>
<p>Whenever the company's info needs to be updated, the agent should contact the Apple's support. Apple will ask to provide legal documents which acknowledge the existing of the company and that the p... |
How to write streaming data to S3? <p>I want to write <code>RDD[String]</code> to Amazon S3 in Spark Streaming using Scala. These are basically JSON strings. Not sure how to do it more efficiently.
I found <a href="https://blog.knoldus.com/2016/02/08/saving-spark-dataframes-on-amazon-s3-got-easier/" rel="nofollow">thi... | <p>You should take a look into mode method for dataframewriter in <a href="http://spark.apache.org/docs/1.6.2/api/java/index.html" rel="nofollow">Spark Documentation</a>:</p>
<blockquote>
<p><code>public DataFrameWriter mode(SaveMode saveMode)</code></p>
<p>Specifies the behavior when data or table already exis... |
Positioning Table in Center of Page <p>It seems like there is a simple fix to this but I cannot figure it out, much less find an answer so I am going to ask. All I am trying to do is get the menu ".nav" centered horizontally on the page. The problem is, I want the logo on the left and it seems to be messing with me cen... | <p>is this output r u expecting </p>
<p>check output in <a href="http://jsbin.com/manife/edit?html,css" rel="nofollow">jsbin</a></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"... |
Error when creating an object with constructor <p>I ran into an error when using this code:</p>
<pre><code>class Box {
public:
Box (int);
};
Box::Box (int a) {
//sample code
}
int main() {
class Anything {
Box box (5); // error: expected identifier before numberic constant
... | <p>Inside <code>Anything</code>,</p>
<pre><code>Box box(5);
</code></pre>
<p>is not valid for declaring the member variable and initializing it.</p>
<p>You can use:</p>
<pre><code>class Anything {
Box box;
public:
Anything : box(5) {}
};
</code></pre>
<p>or</p>
<pre><code>class Anything {
Box b... |
DockerHub + GitHub with a team <p>I'm not sure I understand the point of DockerHub. I understand GitHub as a code repository, but DockerHub kinda throws me through a loop. When I share code with a team we use GitHub, but DockerHub would be for the images and volumes? So a new team member pulls that down from DockerHub,... | <p><em><a href="https://docs.docker.com/docker-hub/" rel="nofollow">From Docker Docs</a>: Docker Hub is a cloud-based registry service which allows you to link to code repositories, build your images and test them, stores manually pushed images, and links to Docker Cloud so you can deploy images to your hosts. It provi... |
Input validation between 0 and 100 <p>Im stuck in this activity, I need to test if a number input from the keyboard is valid, between 0 and 100. the problem is that, if someone types a negative number, it will print both "valid" and "not valid" I just want to print not valid, can someone help me?</p>
<pre><code> Scann... | <p>Such problems can be <em>easily</em> solved by ... just reading carefully what you wrote into your own program!</p>
<p>Meaning: you, as a human "run" that program. And you find:</p>
<p>First you check if the number is smaller than 100; to then print "Valid".</p>
<p>Afterwards you check if the number is bigger tha... |
Set media query based on number of children using SASS <p>I have the following media query in SASS to create a responsive menu: <a href="https://jsfiddle.net/0mL2vgo9/1/" rel="nofollow" title="jsFiddle">jsFiddle</a></p>
<p>It works great, but I'd like to make the <code>@media</code> query change <code>max-width</code>... | <p>I don't think css can be aware of children elements, and sass compiles to css so it follows the same rules. It might be best to edit your html server side, or add classes with javascript. For example give the menu a class of .has-4-children and then write sass something like...</p>
<pre><code>.menu
&.has-4-ch... |
Why the size of user tables is much less that the size of other objects in a PostgreSQL database <p>I need help in understanding my database's size. I suppose the question is kind
of simple for the database pros. I'm not a pro but I want to understand. I use
PostgreSQL. One more detail. My app is written in java and de... | <p>When's the last time you did a vacuum full? It can easily take the size down on a development DB.
Also, indexes are often larger than the data they index, the reason is because the data is aligned for speed, not space efficiency. </p>
<p>PG also has a collection of meta-data about your database and other "behind th... |
How does this sorting algorithm work? <p>hope you are having a good day and a good thanksgiving if you live in Canada or the US. </p>
<p>So I have this question that asks me to explain why this sorting algorithm properly sorts an array. However I don't really understand just how this algorithm really works. </p>
<p>C... | <p>The basic feature that you're missing in the sort rationale is that the are of overlap (middle third of the array) is as large as the amount left out in each pass. In the worst case, the three subsets of the array will be in opposite order: everything in the "b" third belongs in the "e" third, and vice versa. Howe... |
Verilog code to generate a periodic waveform <p>I'm writing a Verilog program which would repeatedly run and change the value of the varible clk from 0 to 1, back to 0 and so on, running infinite times. Here's the code of the module:</p>
<pre><code>module FirstQuestion(
output clk
);
reg clk;
initial
begin
while(... | <p>You can also define a clock generator with a CLK_PERIOD = 10 ns, like</p>
<pre><code>`timescale 1ns/1ps
`define CLK_PERIOD 10
....
initial
begin
clk = 0;
forever #CLK_PERIOD clk = ~clk;
end
</code></pre>
|
Why is BeautifulSoup not extracting all of HTML from a webpage? <p>I am trying to extract text from this website: <a href="https://www.searchgurbani.com/guru_granth_sahib/ang_by_ang" rel="nofollow">searchgurbani</a>. This website has some old scripture translated in English and Punjabi (an Indian Language) line-by-line... | <p>Remember you've suggested to do the following:</p>
<blockquote>
<p>Please do the following on that web page: Go to preferences -> Tick
"ranslation of Sri Guru Granth Sahib ji (by S. Manmohan Singh) -
Punjabi" under Additional Translations available on Guru Granth
Shahib: -> scroll down - submit changes</p>
... |
How to parse JSON dictionary <p>I have the following JSON response containing a JSON dictionary:</p>
<p><a href="http://i.stack.imgur.com/gN0ck.png" rel="nofollow"><img src="http://i.stack.imgur.com/gN0ck.png" alt="enter image description here"></a></p>
<p>What I need is to only extract the 3 categories names (only 1... | <p>For that particular JSON you could do the following</p>
<pre><code>guard let jsonData = JSON as? [String: Any],
let embedded = jsonData["_embedded"] as? [String: Any],
let categories = embedded["categories"] as? [[String: Any]] else {
return
}
</code></pre>
<p>Now categories should have the array o... |
WPF Button ControlTemplate Height binding returns NaN <p>I'm trying to dynamically set the corner radius of WPF buttons to half of the buttons' height, such that the ends are rounded entirely.</p>
<p>The entry in the Window resources looks like the following, however the <code>CornerRadius</code> binding doesn't bind,... | <p>Instead of binding to the control's <code>Height</code> (which is <code>Double.NaN</code> unless it is explicitly set), you should bind to its <code>ActualHeight</code> property:</p>
<pre><code>CornerRadius="{Binding Path=ActualHeight,
RelativeSource={RelativeSource TemplatedParent},
... |
Smallest markup for "eligibleRegion = All Countries" with schema.org <p>In a project about video website, I have to prepare the information about countries eligible for viewing the video materials.</p>
<p>The markup for providing this information is like:</p>
<pre><code><span itemprop="eligibleRegion" itemscope it... | <p>As the <a href="http://schema.org/eligibleRegion" rel="nofollow"><code>eligibleRegion</code></a> property also expects <code>Text</code> as value, you could use something like:</p>
<pre class="lang-html prettyprint-override"><code><meta itemprop="eligibleRegion" content="DE" />
<meta itemprop="eligibleRegi... |
import unicodecsv fails in jupyter <p>I tried to run
import unicodecsv
within jupyter by running a .ipynb file.
It failed.
Then I installed the unicodecsv file through the python install command and found it within c\python27 dir. But still the import did not happen.
How should it be installed. Does it need to be place... | <p>You should install it (from the command prompt) using:</p>
<p><code>conda install unicodescv</code></p>
|
Android Storing Polygon and LongLat values between activites <p>I am trying to create an android App which has 3 activities. The main screen contains a summary of information (static text currently) and one of the navigation links goes to a Map Activity.</p>
<p>When I navigate back to the main menu and them back to th... | <p>Looks like you are working on some geofancing or gps tracking application
and you want to keep running your location tracking or some process even he is not on map activity
and also you want to store your data at temporary location</p>
<p>I think you should use android services that starts with your first activity ... |
Why are only part of my form fields submitting? <p>I'm working on a dynamic form where users can add locations as they go and I'm very close to wrapping this up but now I'm realizing that only the first part of the arrays is being submitted. The submit button is at the end and all the fields are the same using the []. ... | <p>Ok I have this working now. The problem was with my HTML. After taking a step back from thinking the JS or PHP was the problem, I concluded that HTML might be the issue here. Using a tool like <a href="https://validator.w3.org/" rel="nofollow">https://validator.w3.org/</a> to look at the HTML identified a few issues... |
Are random effect variables automatically taken as factors in lmer (or lme) in R? <p>I understand that having a continuous or numeric variable as a <strong>random effect</strong> in a <strong>mixed effects model</strong> doesn't make much sense (e.g., see <a href="http://stats.stackexchange.com/questions/105698/how-do-... | <p>It doesn't seem to matter.</p>
<pre><code>library(lme4)
sl <- sleepstudy
sl$Subject <- as.numeric(levels(sl$Subject))[sl$Subject]
## subject as factor
m1 <- lmer(Reaction ~ Days + (1|Subject), data = sleepstudy)
## subject as numeric
m2 <- update(m1, data = sl)
all.equal(VarCorr(m1), VarCorr(m2))
# ... |
Google Forms Quiz Score Data Format <p>New quizzing mode for google forms provides the scores in the form of a ratio with spaces in between (like this 5 / 7). However, the format of the cell is a number. So when I use dataRange.getValues(), I get only the first number (that is 5 in this example.) I tried setNumberForma... | <p>I just found an answer. I used getDisplayValues() instead of getValues().</p>
|
Spring data JPA fetch data as stream of list of Object <p>I've a Spring web application which uses Spring Data JPA to interact with DB. I've a table consisting millions of records and I want to export a CSV consisting huge amount of data, for this I considered using Stream.</p>
<pre><code>@Query(value = "SELECT * FROM... | <p>You got ClassCastException because it fetches only first field in select query which may be a numeric type.
I have the same problem and updating spring-boot-starter-parent to version 1.4.1.RELEASE make it works.
(spring-data-jpa: 1.10.3.RELEASE
hibernate-core: 5.0.11.Final)</p>
|
Add a CompassOverlay and get errors <p>I want to add a compassoverlay, but I get some errors:</p>
<pre><code>this.mCompassOverlay = new CompassOverlay(context, new InternalCompassOrientationProvider(context), mMapView);
mMapView.getOverlays().add(this.mCompassOverlay);
</code></pre>
<p>Can not resolve Symbol 'mCompas... | <p>resolved:</p>
<pre><code>CompassOverlay mCompassOverlay = new CompassOverlay(this, new InternalCompassOrientationProvider(this), map);
mCompassOverlay.enableCompass();
map.getOverlays().add(mCompassOverlay);
</code></pre>
|
Image Support for Fabric.js and Socket.io Collaborative Whiteboard <p>I'm struggling with getting image supported added to my collaborative digital whiteboard project which is largely based on <a href="https://github.com/wearespindle/dotd/blob/master/lib/dotd.js" rel="nofollow">this existing project</a> (<a href="https... | <p>The fix was a combination. 1) make sure to set fabricObject.remote so it didn't fire the object:added events any longer and 2) use loadFromJSON's callback to render the canvas instead of rendering later to give image time to load. Link to fix commit here:</p>
<p><a href="https://bitbucket.org/dhildreth/ts-motd/com... |
Obtain the cut2 interval for numbers not previously included <p>Actually, I have solved this question, but I have problems because the solution is in two steps, which are really separated between each other (the first step is inside a function and the second step is inside another; this would imply me to make H as an o... | <p>I (think) the request is for determination of the interval number for a new value relative to a factor vector constructed with cut2. If that is what is needed then use as.numeric on a gsub construction of the first of the two cuts in each factor level:</p>
<pre><code>H = cut2(RN,g=4,onlycuts=FALSE)
attributes(H)
#... |
View is not getting updated sometimes after $http call <p>I know this question is asked many times, but none of the solution is working for me.</p>
<p><strong>Controller</strong></p>
<pre><code>app.controller('HomeController', function ($scope, $timeout, $http) {
$scope.eventData = {
heading: "",
... | <p>You load the data in <strong>asynchronous</strong> way which means that the HTML loads first (all the DOM elements are shown) and when you get the response from the server, then the object <code>$scope.eventData</code> gets values. </p>
<p>I believe the best way to handle this is by showing a <strong>loader png</st... |
WSO2 analytics datasource <p>I was trying to explore the analytics event & summary datasource.
I have installed a H2 client and found strange tables names (<strong>ANX___7LKA5XV8_</strong>!!)</p>
<p>Why using these names, I was expecting a more clear names (names like the ones used in the external DB,the one part... | <p>These tables represent the data that you've set to be persisted on the WSO2 Analytics product. For each stream definition that you have, there will be a corresponding table in the analytics datasource.</p>
<p>The reason the names look strange is because the table names are encoded. The records within these tables a... |
Can I use facebooks game service for leaderboards and to send push notifications <p>I'm making a mobile game in Unity.</p>
<p>I would like to have a leaderboard of high scores for a person and their facebook friends who have also played the game.</p>
<p>Also I would like for a push notification to be sent to a player... | <p>Facebook allows you to store 1 variable per user, so you could use that to store a score for each user and make a leaderboard based on that.</p>
<p>For push notifications there are two different kinds, one is actually called local notifications and you can make those for free without a server, but the user has to o... |
HTML/CSS Age verification <p>I'm relatively new to website development and haven't yet moved onto java script or PHP. I want to create a very basic age verification page that allows entry into a mock website for my portfolio that i can show to any potential employers for when i start my apprenticeship. </p>
| <p>You could use this input which does not require any scripts:</p>
<pre><code><input type="number" name="age" min="18">
</code></pre>
<p>Refer to the following link for more insight:
<a href="http://www.w3schools.com/html/html_forms.asp" rel="nofollow">http://www.w3schools.com/html/html_forms.asp</a></p>
|
Trouble generating multiple ranges of values using connect by <p>I know that from a start date and end date you can use <code>connect by</code> to select all dates within that range. But I'm having trouble generalizing this to multiple start and end dates. Here is a simplified example (using numbers instead of dates):<... | <p>Remedy: Don't use <code>connect by nocycle</code>. To break the cycle, add one more condition with PRIOR, which will force a unique additional (system provided) column in each row. Standard is <code>... and prior sys_guid() is not null</code></p>
<p>Explanation: rather than reinvent the wheel, <a href="https://com... |
Error in setting tooltip of ListBox Items <p>I want to set the tooltip for items present in the List Box when they are hovered over. I am using the following code from this question : <a href="http://stackoverflow.com/questions/192584/how-can-i-set-different-tooltip-text-for-each-item-in-a-listbox">How can I set differ... | <p>For example you can use a listview:</p>
<ul>
<li>Set the ListView's ShowItemToolTips property to true.</li>
</ul>
<p>example of code for creating new items with tooltip:</p>
<pre><code> public Form1()
{
InitializeComponent();
ListViewItem item1WithToolTip = new ListViewItem("Item with a to... |
Two-sample F-test for equal variances in Julia <p>I'm looking for an implementation of two-sample F-test for equal variances in Julia, similar to <code>vartest2</code> in MATLAB.</p>
<p>Is there such implementation? I've done a couple of searches but found nothing.</p>
| <p>AFAIK this test has not been implemented in Julia yet. However, looking at the <a href="https://en.wikipedia.org/wiki/F-test_of_equality_of_variances" rel="nofollow">Wikipedia page</a> it appears simple enough. Here is a first pass at it:</p>
<pre><code>#Function for testing equivalence of two variances assuming ii... |
Insert reference column from another table <p>I'm currently using simple script to create a new record into a table.</p>
<pre><code>insert into PRODUCT(name,color) values('product1','red');
</code></pre>
<p>But what if we change our table structure, ie. the column "color" will no longer be a varchar but a reference i... | <p>In case of SQL Server, if your <code>Product</code> table is not an in-memory table then you can add a new column to it with:</p>
<pre><code>ALTER TABLE PRODUCT ADD ColorID int
</code></pre>
<p>Then you just issue an <code>UPDATE</code> to populate the corresponding ID's for colors in the new <code>ColorID</code> ... |
How OOP languages differs from procedural languages in terms of memory utilization <p>I want to understand how OOP programming languages differs from procedural languages in terms of memory utilization. To be more specific, let's assume we are talking about <code>Java</code> and <code>C</code> as examples:</p>
<ol>
<l... | <blockquote>
<p>Is it true that objects are automatically stored in heap while in procedural languages you have to explicitly define the heap usage such as in C malloc?</p>
</blockquote>
<p>That depends upon the language. Some, such as Object Pascal, require all "objects" to be allocated on the heap. Others, such as... |
Grouping time-series data by time intervals <p>Let's say we are storing data for 1000s of devices that collect a single type of data every 10s. Each device can be located in a different timezone. The ability to query quickly to visualize the data is important. We can ask the system questions such as the following:</p>
... | <p>Yes, it's a reasonable design to create buckets by offset, and this occurs often in data warehousing (for example).</p>
<p>Though bucketing by 1 hour increments means ignoring many real places. As you pointed out, India is one location that uses a <code>:30</code> offset. If you want to cover every modern time zo... |
Android MenuItem setShowAsAction() not working <p>I have a menu item which is set to </p>
<pre><code>android:showAsAction="always|withText"
</code></pre>
<p>in the XML. It inflates correctly and shows properly in the menu bar on my phone. However, if I do the following programatically:</p>
<pre><code>item.setVisible... | <p>are you shure you are not mixing <a href="https://developer.android.com/reference/android/view/MenuItem.html" rel="nofollow">android.view.MenuItem</a> with <a href="https://developer.android.com/reference/android/support/v4/view/MenuItemCompat.html" rel="nofollow">MenuItemCompat</a>? can you show your imports and <c... |
Reading larger sftp files with ssh2 sftp Node <p>I'm trying to use the ssh2-sftp library to read/write a file in Node. When I do an sftp.get on a larger CSV file (but not too large -- like 2 MB only) on an sftp site, and then read data on the returned stream, the call is hanging on me after the 14th stream.on("data") c... | <p>The issue turned out to be that ssh2-sftp seems to be running an outdated version of the underlying ssh2 library. Switching from ssh2-sftp to the most recent (0.5.2) version of ssh2 and using that library directly fixed the issue (which might have been this one: <a href="https://github.com/mscdex/ssh2/issues/450" re... |
How to use custom model binder in Sitecore for a specific WebApi route to pass array? <p>I have my basic Sitecore WebAPI route working just fine. But when I need to pass an array of integers to a custom Sitecore WebApi route, I get 404. How can this be done? Following is what I've tried and works perfectly fine in a ty... | <p>To let Sitecore and WebApi work together in harmony you need to add a processor in the httpRequestBegin pipeline to get the routing to work. You can find information and even source code for this online, e.g. <a href="http://patrickdelancy.com/2013/08/sitecore-webapi-living-harmony" rel="nofollow">http://patrickdela... |
How to change HTML Base Element in Silverstripe ran site <p>I've got a Silverstripe ran site, which I recently added a SSL certificate to.</p>
<p>Because of this I need to change the HTML Base Element to https from http as now none of the images, stylesheets etc linking correctly and are being rejected as they're not ... | <p>Just add Director::forceSSL(); to your _config.php</p>
|
Java print PDF with embedded fonts <p>I've written code to print a PDF using a passed in printer name and PDF url. This works, except when I pass it a PDF that has Chinese characters on it, the characters are just boxes. The Unicode font is embedded with PDF, so ideally, I'd like to utilize that somehow. Here's the cod... | <p>Per the comment by mkl, I updated to version 2.0.3 and the Chinese characters printed correctly. Here is my new code in comparison to my old to see what was necessary to update:</p>
<pre><code>PrinterJob job = PrinterJob.getPrinterJob();
job.setPrintService(printer);
PageFormat pageFormat = job.defaultPage();
Pape... |
Configuring MySQL WordPress settings in wp-config.php for local build and live website <p>I am trying to edit the MySQL settings for WordPress located in <code>wp-config.php</code>. My database name, password, and username is different for the live version of my site and the local version of my site. I am trying to set... | <p>This if/else statement worked for me: </p>
<pre><code>if($_SERVER['HTTP_HOST'] === 'live.domain.url') {
define('DB_NAME', 'casestudies');
define('DB_USER', 'db_casestudies');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8mb4');
define('DB_COLLATE', ''... |
Implementing BFS on a graph <p>I have vertices in graph which represent towns. I am trying to find a shortest path from point A to point B.</p>
<p>I have created a graph class.</p>
<pre><code>struct Edge{
string name;
vector< Edge *> v;
Edge( string n ){
name = n;
}
};
class Graph{
publ... | <p>Without giving the explicit imlementational details, this can be done as follows.</p>
<ol>
<li><p>You could use a user-defined stack to explicitly store cities which are currently visited. When the target city is reached, the stack contains the path to the city.</p></li>
<li><p>Your implementation does not use a se... |
Including a Jquery file for form validation in a child theme <p>I've created a child theme and am running my site on that so that I can customise a form that I'm including on certain pages using the plugin 'contact-form-7". In my child folder I've placed a style.css, functions.php and js/custom_script.js. the style she... | <p>I believe that you haven't included the JQuery file? You have to download it first <a href="https://jquery.com/download/" rel="nofollow">https://jquery.com/download/</a>, and then register it as you did with "custom_script", you just have to put it before the "custom_script" in functions.php, inside "custom_script.j... |
Redirecting on login with Firebase Authentication and AngularFire <p><strong>Issue</strong>: On login, I would like to redirect the user to a new page. I am trying to pass <code>$state</code> to my controller, so I can do <code>$state.go()</code>, but I get an error of <code>Cannot read property 'go' of undefined</code... | <p><code>$firebaseArray</code> is missing.
Inject dependency <code>$firebaseArray</code> in the controller.</p>
<pre><code>app.controller("AuthCtrl", ["$scope", "Auth", "$firebaseArray","$rootScope", '$state',
function($scope, Auth, $firebaseArray, $rootScope, $state) {
// CODE
}
]);
</code></pre>
|
Event handling ignoring the param from URL <p>So Im trying to make a simple form and make it send and email based on the information on the form. This is a sub window where you are supposed to receive the parameter from the URL (messages.aspx?mail=mail@mail.com). So far I am capturing the value from the mail and displa... | <p>Add a "not Postback" into the Page-Load Event and request the value from querystring only once, by Page-Load.</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) {
loadList();
emailT.Text = Request.QueryString["mail"];
}
}
protected void SendMail(object send... |
Events are not rendered when retrieving them from Google Calendar JSON encoded <p>I'm using CodeIgniter to build an application with a Fullcalendar and I'm trying to integrate Google calendar.</p>
<p>I had trouble using the JS and preferred to use PHP, so I have a controller called <code>Calendar.php</code> to call th... | <p>What you are returning from the server is not a valid JSON and the issue doesn't have to do with the date. Just take a look at the screenshot you've posted, that has something like:</p>
<blockquote>
<p>{"events": {"description":"lobna elatreby @nrc", "start": "2010-03-23T14:30:00-04:00", "end": "2010-03-23T15:30:... |
I can't understand the workflow of this code <p>I am doing an online tutorial where they teach you to make a simple web-app using MEAN.The code below is for editing the given collection of JSON objects(Videos are JSON objects here)
The collection is at
<code>/api/videos</code>
So I have to click on a <code>href="/#/vi... | <p>Well, according to <a href="https://docs.angularjs.org/api/ngResource/service/$resource" rel="nofollow">AngularJS docs for $resouce</a>, $resource is:</p>
<blockquote>
<p>A factory which creates a resource object that lets you interact with
<a href="https://en.wikipedia.org/wiki/Representational_state_transfer"... |
How to fix libssl.so.0.9.8: cannot open shared object file: No such file or directory <p>How to fix error, error while loading shared libraries: libssl.so.0.9.8: cannot open shared object file: No such file or directory</p>
| <p>This is really outdated version of SSL libraries and as such you should discard any software that uses vulnerable components, specially crypto libraries. Latest version of SSL libraries is <code>1.1.0</code>, so request software vendor to upgrade the libraries.</p>
<p>With all that said you can get past this by run... |
React redirection and transfering info to another page <p>I have a react applictation with react-router for navagation. I try to create form that is update some data. After submit the data are send to server though ajax request and in case of ajex response is "Ok" than the user has to be redirected to another page (in ... | <p>Try importing browserHistory like:</p>
<pre><code>// Somewhere like a Redux middleware or Flux action:
import { browserHistory } from 'react-router'
// Go to /some/path.
browserHistory.push('/some/path')
</code></pre>
<p><a href="https://github.com/ReactTraining/react-router/blob/master/docs/guides/NavigatingOuts... |
How can I add an event listener for all events in javascript without listing them individually? <p>I'd like to accomplish the following code using a wildcard (that I don't think exists?)</p>
<pre><code>myObject.element = document.getElementsByClassName('js-myObject');
myObject.element.addEventListener('click', myObjec... | <pre><code>// but I want to do (and it doesn't work)
myObject.element.addEventListener('*', myObject.controller);
</code></pre>
<p>There is no such feature, and I doubt if you want hundreds of events on an element being listened for anyway.</p>
<p>By the way, instead of your roll-your-own architecture for a generic e... |
Scheduling UILocalNotification causing lagging and delay of user interface <p>I have a function <code>scheduleFutureLocalNotifications()</code> in Swift code that creates 64 <code>UILocalNotification</code> that fire in the future.</p>
<p>Originally the function was called at <code>viewDidLoad()</code>, but this cause... | <p>You can dispatch the function, asynchronously, onto another queue. This will ensure that the main queue isn't blocked performing the scheduling and will prevent the UI from becoming unresponsive:</p>
<pre><code>override func viewDidLoad() {
super.viewDidLoad()
dispatch_async(dispatch_get_global_queue(DISP... |
Is using Single as an Assert a bad practice? <p>I'm testing a method that manipulates a collection. Given a set of parameters it should contain exactly one element that matches a condition. <em>Edit: The collection might have several other elements not matching the condition aswell.</em></p>
<p>I'm using <a href="http... | <blockquote>
<p>I'm wondering if this is a bad practice and if there's a better way to do this.</p>
</blockquote>
<p>Yes and yes.</p>
<blockquote>
<p>it will fail the test by throwing an exception if there is no match at all or more than one match.</p>
</blockquote>
<p>Don't fail the test by throwing an exceptio... |
DataGridView Deleting/Updating problems <p>So, I've been doing some practice code for a few days. I'm working on using a DataGridView, without a database. Everything seems to work, save for one problem. Whenever I click the delete or update button without selecting a record, the form crashes. Here's the update function... | <p><code>SelectedCells</code> is a collection the system provides. </p>
<p>It is never null. </p>
<p>It can be emtpy though, so if (for some reason) you want to check you can write :</p>
<pre><code>if (dgvProfiles.SelectedCells.Count <= 0)..
</code></pre>
<p>or </p>
<pre><code>if (dgvProfiles.SelectedRows.Count... |
Crypto++ equivalent to PHP mcrypt_encrypt MCRYPT_3DES/MCRYPT_MODE_CBC <p>I have the following PHP code to encrypt a text using a key:</p>
<pre class="lang-php prettyprint-override"><code>function des_ed3_crypt($msg, $key) {
$bytes = array(0,0,0,0,0,0,0,0);
$iv=implode(array_map('chr', $bytes));
return mcrypt... | <p>Effectively, it was the padding. The PHP <code>mcrypt_crypto</code> function applies a zero-padding, so, I only have to specify to <code>cryptopp</code> that I want to apply a zero-padding to the encryption:</p>
<pre><code>std::string des_ed3_crypt(std::string const& msg, std::string const& key)
{
unsig... |
Change build configuration artifacts manually <p>I am using TC10.x and one of my build generates an artifact which is then loaded in one of my custom configuration tabs.</p>
<p>Now after 10 runs, I wanted to change something in that file, so i edited all the artifacts that are created in .buildserver/../../artifacts f... | <p>Restarting the apache web server resolved the issue. New files were taken up.
Could not see cache folder mention in the conf file, nor found any cache folder under apache or c:\program data etc.</p>
|
Copy a list of data.frame(s) to sqlite database using dplyr <p>I want to make an sqlite database from a list of data.frame(s) using the dplyr package. It looks like the <code>dplyr::copy_to</code> function is what I need to use. I think the problem I am having is related to <a href="https://cran.r-project.org/web/packa... | <p>The reason for this is because the default table name is based off of the name of the data frame in R. When using <code>lapply</code>, it does <strong>not</strong> take the index name.</p>
<p>The documentation for <code>dplyr::copy_to.src_sql</code> contains:</p>
<pre><code>## S3 method for class 'src_sql'
copy_to... |
Chef tutorial errors on node configuration [cannot load such file -- mysql2] <p>So here is the weird part. I'm using the <code>ubuntu-14.04</code> platform for my <code>test kitchen</code> setup, and I'm <strong>also</strong> using <code>bento/ubuntu-14.04</code> for my vagrant node.</p>
<p>They should be the same rig... | <p>You need to install the mysql2_chef_gem first before calling mysql_database</p>
<pre><code>mysql2_chef_gem "default" do
gem_version "0.4.4"
action :install
end
</code></pre>
<p>Somehow your TK node has gotten that installed.</p>
|
Is there some way to replace Doctrine in Symfony with some REST client? <p>I would like to rewrite Symfony project to JAVA, but we would like to start building REST services first, and somehow replace model with them. Some time it should work together with the Doctrine model. Later we would replace the core as well. Th... | <p>Yes, this is very possible. Your reasons for migration aside, I would advise you to look at <a href="https://github.com/facebook/graphql" rel="nofollow">Facebook's GraphQL</a>. It's a query language and execution engine tied to any backend service. There is already a bundle for this here <a href="https://github.com/... |
R: Catch errors and continue execution while logging the stacktrace (no traceback available with tryCatch) <p>I have many unattended batch jobs in R running on a server and I have to analyse job failures after they have run.</p>
<p>I am trying to catch errors to log them and recover from the error gracefully but I am ... | <p>The <code>traceback</code> function can be used to print/save the current stack trace, but you have to specify an integer argument, which is the number of stack frames to omit from the top (can be <code>0</code>). This can be done inside a <code>tryCatch</code> block or anywhere else. Say this is the content of file... |
Align UILabel text to a specific character <p>I'm using a UILaber showing a second countdown in a very large font (size 240). The displayed string is formatted "xxx.xx", with x's being characters 0-9. I want to align the text to the dot-chatecter (.) in the string that showing in the label. I use textAlignment as .Cent... | <p>Interesting Question mate:</p>
<p>Please find a solution below:</p>
<p><a href="http://i.stack.imgur.com/ZMufZ.png" rel="nofollow"><img src="http://i.stack.imgur.com/ZMufZ.png" alt="Storyboard using Stacks"></a></p>
<p>Basically what i've done here is:</p>
<ol>
<li>Using Storyboard i've taken 3 Vertical Stack Vi... |
getting ALAssets from photos library iOS <p>I am trying to get the time, date and location from a movie i took on my iPhone/iPad This is the code i used</p>
<p>//i get the video picked and then save it to app but i think i am getting the movie's asset data before i save it.</p>
<pre><code>- (void) imagePickerControl... | <p>So I figured this out here is the code</p>
<pre><code>- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
if (picker.sourceType ==UIImagePickerControllerSourceTypePhotoLibrary) {
NSURL * movieURL = [info valueForKey:UIImagePickerControllerMediaURL]... |
Sonata Product list error(Sonata E-Commerce Bundle) <p>I am working with sonata E-Commerce Bundle. After installing the bundle and it's dependencies successfully I get the admin dashboard page as expected. </p>
<p>However when I click on "Add new" option for the Product I get a blank block, with no fields or buttons. ... | <p>Figured it out:</p>
<p>Create a Product type (<a href="http://sonata-project.org/bundles/ecommerce/master/doc/reference/tutorials/create-product.html" rel="nofollow">http://sonata-project.org/bundles/ecommerce/master/doc/reference/tutorials/create-product.html</a>) php app/console sonata:product:generate Bowl sonat... |
How to get the values directly from a store filtered on the server side <p>I created a fiddle to illustrate what I try to achieve.</p>
<p><a href="https://fiddle.sencha.com/#fiddle/1i8e" rel="nofollow">https://fiddle.sencha.com/#fiddle/1i8e</a></p>
<p>On fiddle, there are two grids and a form.</p>
<p>When selecting ... | <p>Move the handler function to the viewController.</p>
<p>Create a function called for example onButtonClick. On the button config, add</p>
<pre><code>listeners: {
click: 'onButtonClick'
}
</code></pre>
<p>In the onButtonClick function, get a reference to your store using</p>
<pre><code>var store = this.getVie... |
Is there a way to shutdown Nodejs and restart my app from scratch? <p>The app needs to completely die so I don't end up with multiple node processes running. I need to kill node but I also need to start up a new node. Npm start would be great because it calls gulp and rebundles the project.</p>
<p>Is there a simple wa... | <p>You might want to check <a href="https://www.npmjs.com/package/pm2" rel="nofollow">pm2</a> which gives you the ability to start/stop/restart a node process.</p>
|
.Net MVC WebAPI: making some methods "admin only"? <p>.Net 4.6.1</p>
<p>I am still very new to .Net and MVC. Trying my hand at creating an API and then what will really be a javascript app that will consume the API. I've got a thousand questions but I will focus on one area for this. In the API code I see the metho... | <p>I would recommend reading these articles as a starting point (and some of the other articles in the same section!):<br>
<a href="https://www.asp.net/web-api/overview/security/authentication-filters" rel="nofollow" title="Authentication Filters in ASP.NET Web API 2">Authentication Filters in ASP.NET Web API 2</a><br>... |
regex: Match and replace all X400 addresses (delimited by semi-colons) within a line of other entities delimited by a semi-colon <p>I'm trying to parse an export of my corporate directory and am having trouble because of the semi-colon handling of the export. Each line of the export data contains a distinguishedName f... | <p>Use something like this:</p>
<pre><code>... -replace 'x400:([a-z]*=.*?\\;)*(;|$)'
</code></pre>
|
How can I remove the ng-repeats and ng-includes produced when compiling a templatecache <p>My goal is to produce an HTML string that will be saved in a database and can be displayed in other angular apps.</p>
<p>I was able to get that string but any ng-repeats and ng-includes are still a part of that markup so when I ... | <p>You can clean it by appending the html into a temporary element. Then manipulate those elements removing classes and attributes. When done return the innerHTML</p>
<pre><code>var $el = angular.element('<div>').append(yourHtmlString);
$el.find($el[0].querySelectorAll('[ng-repeat]').removeAttr('ng-repeat');
var... |
slim - how to make a node which contains both plaintext and other nodes <p>Here's my slim template:</p>
<pre><code> h5
span built by
a href='http://maxpleaner.com' maxpleaner
| with
a a href='http://github.com/maxpleaner/static' static
</code></pre>
<p>I was expecting this to render this:</p>
... | <p>If you start with text on the same line as the tag, Slim considers the whole nested block to be plain text. If you move âbuilt byâ down into the block it works like you want:</p>
<pre><code>h5
span
| built by
a href='http://maxpleaner.com' maxpleaner
| with
a href='http://github.com/maxplea... |
Instance variable name a reserved word in Python <p>I checked the Python style guide, and I found no specific references to having instance variable names with reserved words e.g. <code>self.type</code>, <code>self.class</code>, etc.</p>
<p>What's the best practice for this?</p>
| <p>Avoid it if possible.</p>
<p>You can get and set such attributes via <code>getattr</code> and <code>setattr</code>, but they can't be accessed with ordinary dot syntax (something like <code>obj.class</code> is a syntax error), so they're a pain to use.</p>
<p>As Aurora0001 mentioned in a comment, a convention if y... |
Counting Elements in an Array, Adding them to 2 Objects within an Array <pre><code>var arr = ['cat','cat','dog','penguin','chicken','chicken']
function orgAnimals(input)
var obj = {};
for (var i = 0 ; i < input.length; i++) {
obj[input[i]] = obj[input[i]] || 0;
obj[input[i]]++
}
return obj;
}
<... | <p>Golf time, I suppose</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var arr = ['cat','cat','dog','penguin','chicken','chicken']
function orgAnimals(input) {
retu... |
How to compute percentage of total based on Counts of 1 field and filtered by another field <p>Data and Desired Result:</p>
<p><a href="http://i.stack.imgur.com/2cxAR.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/2cxAR.jpg" alt="enter image description here"></a></p>
<p>I have the above data, i would like to... | <p>You can use a group by and a dinamic temp table for total</p>
<pre><code> select
a.name, a.status
, count(a.countKey) as CountKEy
, c2 as CountKeyTotal
, (a.count(*) / b.c1) *100 as percentage
from my_table as a
inner join( select name, count(*) as c1 , count(countKey) c2 from my_table
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.