query_id stringlengths 4 64 | query_authorID stringlengths 6 40 | query_text stringlengths 66 72.1k | candidate_id stringlengths 5 64 | candidate_authorID stringlengths 6 40 | candidate_text stringlengths 9 101k |
|---|---|---|---|---|---|
c12c68953f449373c835716785a3a178f3011ddaedcfdf1eabf1c5e23eeab802 | ['12258b8ae8524accb75b0083148c3c53'] | I'm assuming you're using the standalone version of Ripple. We have not switched back to a Chrome extension model with significantly improved performance and stability. You can download the latest version from here:
https://developer.blackberry.com/html5/download/ripple
Ripple should auto-update for future releases from that point on.
| 02c0a606d86c3ae09559808485baa08e12da652c9f2c9aab1851cf089e6dad9c | ['12258b8ae8524accb75b0083148c3c53'] | This is a little misleading. Ripple actually tries to support the latest version of Cordova, so the version should really say 2.x. We are working on fixing the way we manage platform version.
Short answer, selecting version 2.0.0 should work for you with a 2.5.0 app. Sorry for the confusion.
|
cbfd4bb525836491fbd0a9bb3b2c7c5fed698899e8c749fb4ba4902d615043b6 | ['122747622e0f404caf0012cb249cc0c0'] | Check out this code see if it is what you want.
window.imagePreview = function (t) {
if (t.files && t.files[0]) {
for (var i = 0; t.files.length > i; i++) {
var reader = new FileReader();
reader.onload = function (e) {
var thumbnail = '<div>';
thumbnail += '<img class="image" src="' + e.target.result + '"/>';
thumbnail += '<button class="removeButton">Remove File</button>';
thumbnail += '</div>';
$('#image-preview').append(thumbnail);
$(".removeButton").on("click", function(){
$(this).closest('div').remove();
document.getElementById("file").value = "";
});
};
reader.readAsDataURL(t.files[i]);
}
}
}
By the way, the error you got is because you set t.files.length >= i, which cause the loop runs one more time and the last time it runs there is no file data available.
JSfiddle
| 0ea5891e78d15e626e76829c82542c7ae1e623b1e51e794b6968e5e5a885865c | ['122747622e0f404caf0012cb249cc0c0'] | Check out if this works for you:
var commentTable = $('.commentTable').DataTable({
aoColumns: [
{"mData": "date", "className": "commentDate"},
{"mData": "name", "className": "commentUser"},
{"mData": "comment", "className": "commentComment"},
],
bSort: false
});
$('.addComment').on('click', function () {
var newCom = $('.newCommentArea').find('input').val();
var dateInput = moment().format("dd MM, YYYY");
var dataSet = {
"date": dateInput,
"name": 'name',
"comment": newCom
}
commentTable.rows.add(dataSet).draw();
...
});
|
a2e95b11dbbbecff8bece62a4c9eff7ea6cd81a7a760c4ddccc8658f9ee90687 | ['124d0a5c42384acc9690f2a38a19a39c'] | im using href to pass parameter from one page to other but getting error.
Notice: Undefined index: $table in /var/www/html/download/get_file.php on line 3
Error! Query failed:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id = 1' at line 3
what i want to pass table name in href to other script to executed it, so for that i have many tables.
hope this explain what i want.
href='get_file.php?id={$row['id']}&$table'>Download
here is my code
<?php
if(isset($_POST["dropdown"]))
{
$table = $_POST['dropdown'];
// Connect to the database
$dbLink = new mysqli('localhost', 'sqldata', 'sqldata', 'balhaf');
if(mysqli_connect_errno()) {
die("MySQL connection failed: ". mysqli_connect_error());
}
// Query for a list of all existing files
$sql = "SELECT id, name, mime, size, created FROM $table";
$result = $dbLink->query($sql);
// Check if it was successfull
if($result) {
// Make sure there are some files in there
if($result->num_rows == 0) {
echo '<p>There are no files in the database</p>';
}
else {
// Print the top of a table
echo '<table border="1" align="center">
<H2 align="center"> Report Table</H>
<tr>
<td><b>Name</b></td>
<td><b>Mime</b></td>
<td><b>Size (bytes)</b></td>
<td><b>Created</b></td>
<td><b>Download</b></td>
</tr>';
// Print each file
while($row = $result->fetch_assoc()) {
echo "
<tr>
<td>{$row['name']}</td>
<td>{$row['mime']}</td>
<td>{$row['size']}</td>
<td>{$row['created']}</td>
<td><a style='text-decoration:none;' href='get_file.php?id= {$row['id']}&$table'>Download</a></td>
</tr>";
}
// Close table
echo '</table>';
}
// Free the result
$result->free();
}
else
{
echo 'Error! SQL query failed:';
echo "<pre>{$dbLink->error}</pre>";
}
// Close the mysql connection
$dbLink->close();
}
?>
my second code
get_file.php
<?php
$table =$_GET['$table'];
// Make sure an ID was passed
if(isset($_GET['id'])) {
// Get the ID
$id = intval($_GET['id']);
// Make sure the ID is in fact a valid ID
if($id <= 0) {
die('The ID is invalid!');
}
else {
// Connect to the database
$dbLink = new mysqli('localhost', 'sqldata', 'sqldata', 'accounts');
if(mysqli_connect_errno()) {
die("MySQL connection failed: ". mysqli_connect_error());
}
// Fetch the file information
$query = "
SELECT mime, name, size, data
FROM $table
WHERE id = {$id}";
$result = $dbLink->query($query);
if($result) {
// Make sure the result is valid
if($result->num_rows == 1) {
// Get the row
$row = mysqli_fetch_assoc($result);
// Print headers
header("Content-Type: ". $row['mime']);
header("Content-Length: ". $row['size']);
header("Content-Disposition: attachment; filename=". $row['name']);
// Print data
echo $row['data'];
}
else {
echo 'Error! No image exists with that ID.';
}
// Free the mysqli resources
@mysqli_free_result($result);
}
else {
echo "Error! Query failed: <pre>{$dbLink->error}</pre>";
}
@mysqli_close($dbLink);
}
}
else {
echo 'Error! No ID was passed.';
}
?>
| 8f66b02d817e40b3b5dd93da59e791fdd5d02eace1d86ada8d455f31e5a0a861 | ['124d0a5c42384acc9690f2a38a19a39c'] | i have interface which have drop down list, you have to select an item and click on submit button to view the database in mysql but doesn't work, it give error "Table 'balhaf.$table' doesn't exist"
here is my code
the interface
<html>
<body>
<form method="post" action="list_files.php">
<input name="go" type="submit" value="submit" / >
<?php
$dbname = 'balhaf';
if (!mysql_connect('localhost', 'sqldata', 'sqldata')) {
echo 'Could not connect to mysql';
exit;
}
$sql = "SHOW TABLES FROM $dbname";
$result = mysql_query($sql);
if (!$result) {
echo "DB Error, could not list tables\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
echo '<select name="dropdown" style="width:150px">';
echo '<option value="">Select</option>';
while ($row = mysql_fetch_row($result)) {
echo '<option value="'.$row[0].'">'.$row[0].'</option>';
}
echo '</select>';
echo '</form>';
mysql_free_result($result);
?>
</body>
</html>
my second code
"list_files.php"
<?php
if(isset($_POST["dropdown"]))
{
echo "ok";
}
$table = $_POST['dropdown'];
// Connect to the database
$dbLink = new mysqli('localhost', 'sqldata', 'sqldata', 'balhaf');
if(mysqli_connect_errno()) {
die("MySQL connection failed: ". mysqli_connect_error());
}
// Query for a list of all existing files
$sql = 'SELECT `id`, `name`, `mime`, `size`, `created` FROM $table';
$result = $dbLink->query($sql);
// Check if it was successfull
if($result) {
// Make sure there are some files in there
if($result->num_rows == 0) {
echo '<p>There are no files in the database</p>';
}
else {
// Print the top of a table
echo '<table border="1" align="center">
<H2 align="center"> Report Table</H>
<tr>
<td><b>Name</b></td>
<td><b>Mime</b></td>
<td><b>Size (bytes)</b></td>
<td><b>Created</b></td>
<td><b>Download</b></td>
</tr>';
// Print each file
while($row = $result->fetch_assoc()) {
echo "
<tr>
<td>{$row['name']}</td>
<td>{$row['mime']}</td>
<td>{$row['size']}</td>
<td>{$row['created']}</td>
<td><a style='text-decoration:none;' href='get_file.php?id= {$row['id']}'>Download</a></td>
</tr>";
}
// Close table
echo '</table>';
}
// Free the result
$result->free();
}
else
{
echo 'Error! SQL query failed:';
echo "<pre>{$dbLink->error}</pre>";
}
// Close the mysql connection
$dbLink->close();
?>
|
949103f3a548a20dd87a0d9059edc4391fe12840958d832ad0d6307b13d93488 | ['12534fd3989a43649b27c761fcde872d'] | Generally speaking your flow will be similar to this:
"Validate" data client side - you don't want to trust this validation since you should never trust anything coming from the client, this is done to make the user experience better.
Validation on the server - make sure the data given to you is valid. Examples might be: validate type (int, string, etc.), validate value (users can't order a negative amount of an item), etc. If you're using some kind of MVC-ish framework this is done in the Model layer.
Store the data in the database - you'll use prepared statements to protect yourself from SQL injection but you don't want to manipulate the data in any way (no htmlentities or the like).
Whenever you're taking data out of the database that's when you decide if you need to convert HTML entities or do some other processing based on whether you're outputting HTML, JSON, XML, etc.
If you need to use htmlspecialchars or something like that on data in a JSON array, execute that before you put the data in the JSON array.
| f8a78ac3306265e43b75f5a77ffb4040fad24f5e7a48a1415346bf962a1a282e | ['12534fd3989a43649b27c761fcde872d'] | For this particular application I would model it as below:
Ingredients are the basic things you need to make a recipe.
ingredients
id unsigned int(P)
name varchar(15)
...
+----+-----------+-----+
| id | name | ... |
+----+-----------+-----+
| 1 | Flour | ... |
| 2 | Olive oil | ... |
| .. | ......... | ... |
+----+-----------+-----+
Now you have to define what nutrients are found in each of your ingredients.
ingredients_nutrients
id unsigned int(P)
ingredient_id unsigned int(F ingredients.id)
nutrient_id unsigned int(F nutrients.id)
grams double
+----+---------------+-------------+-------+
| id | ingredient_id | nutrient_id | grams |
+----+---------------+-------------+-------+
| 1 | 1 | 1 | 3.0 |
| 2 | 1 | 2 | 15.3 |
| 3 | 2 | 3 | 20.0 |
| .. | ............. | ........... | ..... |
+----+---------------+-------------+-------+
Define all the possible nutrients (do some searching on the USDA website and you can find a complete list). It's trivial to add a records to this table.
nutrients
id unsigned int(P)
name varchar(15)
...
+----+--------+-----+
| id | name | ... |
+----+--------+-----+
| 1 | Sodium | ... |
| 2 | Iron | ... |
| 3 | Fat | ... |
| .. | ...... | ... |
+----+--------+-----+
Define your recipes.
recipes
id unsigned int(P)
name varchar(50)
...
+----+-------+-----+
| id | name | ... |
+----+-------+-----+
| 1 | Pizza | ... |
| .. | ..... | ... |
+----+-------+-----+
Indicate what ingredients go into each recipe.
recipes_ingredients
id unsigned int(P)
recipe_id unsigned int(F recipes.id)
ingredient_id unsigned int(F ingredients.id)
+----+-----------+---------------+
| id | recipe_id | ingredient_id |
+----+-----------+---------------+
| 1 | 1 | 1 |
| 2 | 1 | 2 |
| .. | ......... | ............. |
+----+-----------+---------------+
|
6d0238d023e55c7d80406144c7cd0fd1e65e02793580ac5c12bc2ff7a5394331 | ['1256f44ba3074d1a9260b69adf95e576'] | I am working with Xamarin.Android with MvvmCross 5.1.1 .
My App mostly consumes REST Api and uses ListViews & RecylerViews. I am getting frequest crash reports from stores and the frequest crashes Says
MvxLayoutInflater.java with java.lang.OutOfMemoryError
I have also set the Java Max Heap size to 1G .
but the same is also not fixing this issue. Is there a better way to handle or fix this?
| 17a8d66bb5ab3cadc9658bc514c267fc34cf72dc57f907fb00ae03db1d493a05 | ['1256f44ba3074d1a9260b69adf95e576'] | My Xamarin.native project targetting Android & iOS. I am not able to show Alert in Xamarin.iOS; thou the following code works fine on Xamarin.Android.
In PCL:
public interface IDialogProvider
{
void ShowMessage(string title, string message, string dismissButtonTitle, Action dismissed);
void Confirm(string title, string message, string okButtonTitle, string dismissButtonTitle, Action confirmed, Action dismissed);
}
======================================
In Xamarin.iOS
public class TouchDialogProvider : IDialogProvider
{
public void ShowMessage(string title, string message, string dismissButtonTitle, Action dismissed)
{
var alert = UIAlertController.Create(title, message, UIAlertControllerStyle.Alert);
alert.AddAction(UIAlertAction.Create(dismissButtonTitle, UIAlertActionStyle.Default,
action => { if (null != dismissed) { dismissed.Invoke(); } }));
}
public void Confirm(string title, string message, string okButtonTitle, string dismissButtonTitle, Action confirmed, Action dismissed)
{
var alertView = new UIAlertView(title, message, null, dismissButtonTitle, okButtonTitle);
alertView.Clicked += (object sender, UIButtonEventArgs e) => {
if (e.ButtonIndex == 1 & null != confirmed)
{ confirmed.Invoke(); }
if (e.ButtonIndex == 0 & null != dismissed)
{ dismissed.Invoke(); } };
alertView.Show();
}
}
|
70b439d1e19074f0ecb048da0865ed980f5ac85348237f55fae1d5115ed6516e | ['12578114caf547e1a9e5218c6fe4ff80'] | I'm trying to write a templated function taking an Eigen<IP_ADDRESS>Tensor as an argument. The same approach that works for Eigen<IP_ADDRESS>Matrix etc. does not work here.
Eigen recommends writing functions using a common base class. https://eigen.tuxfamily.org/dox/TopicFunctionTakingEigenTypes.html
A minimal example for Eigen<IP_ADDRESS>Matrix that compiles:
#include <Eigen/Dense>
template <typename Derived>
void func(Eigen<IP_ADDRESS>MatrixBase<Derived>& a)
{
a *= 2;
}
int main()
{
Eigen<IP_ADDRESS>Matrix<int, 2, 2> matrix;
func(matrix);
}
And the minimal example for Eigen<IP_ADDRESS>Tensor that does not compile:
#include <unsupported/Eigen/CXX11/Tensor>
template <typename Derived>
void func(Eigen<IP_ADDRESS>TensorBase<Derived>& a)
{
a *= 2;
}
int main()
{
Eigen<IP_ADDRESS>Tensor<int, 1> tensor;
func(tensor);
}
$ g++ -std=c++11 -I /usr/include/eigen3 eigen_tensor_func.cpp
eigen_tensor_func.cpp: In function ‘int main()’:
eigen_tensor_func.cpp:12:16: error: no matching function for call to ‘func(Eigen<IP_ADDRESS>Tensor<int, 1>&)’
func(tensor);
^
eigen_tensor_func.cpp:4:6: note: candidate: ‘template<class Derived> void func(Eigen<IP_ADDRESS>TensorBase<Derived>&)’
void func(Eigen<IP_ADDRESS>TensorBase<Derived>& a)
^~~~
eigen_tensor_func.cpp:4:6: note: template argument deduction/substitution failed:
eigen_tensor_func.cpp:12:16: note: ‘Eigen<IP_ADDRESS>TensorBase<Derived>’ is an ambiguous base class of ‘Eigen<IP_ADDRESS>Tensor<int, 1>’
func(tensor);
| b7d38034a33ec8102a8f04f2a0b026a31ec048e62de074fafcf7df6a8005d6c8 | ['12578114caf547e1a9e5218c6fe4ff80'] | SparseMatrix has an optional template parameter that defines the storage order (cf. eigen documentation). By default, SparseMatrix uses column-major. So instead of Eigen<IP_ADDRESS>SparseMatrix<double> use Eigen<IP_ADDRESS>SparseMatrix<double, Eigen<IP_ADDRESS>RowMajor>.
It would be beneficial to use an alias for this
using MyMatrix = Eigen<IP_ADDRESS>SparseMatrix<double, Eigen<IP_ADDRESS>RowMajor>;
MyMatrix mat(5,5);
|
9c2b7ddba5fce7af02e425a8416cfb3bc47713414725b583c7cd4d07605eec9e | ['125a17255f7146a19dc88ea3e7f05120'] | Beginner to ruby on rails and I completely stuck on this problem I have in my nested form.
What I am trying to accomplish: I want to setup a form where the user can set the closing and opening time for the days in the week. I have a child model: Availability and a parent model: Parking, and each parking will have 6 rows in availability for each day of the week, 0-6.
The error I get when I submit:
Started PATCH "/parkings/12/availabilities" for ::1 at 2020-10-07 14:24:44 -0700
Processing by AvailabilitiesController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"MmyvqkUkM+YSPO4PZRB/baB8BmXaCFsPFoMm/RC7mAmPnxT9tBXnF4dL5dbMahCAldakWqMyvWaiDMutFTjxjw==", "parking"=>{"availabilities_attributes"=>{"0"=>{"open_time"=>"", "closing_time"=>"", "id"=>"55"}, "1"=>{"open_time"=>"9", "closing_time"=>"8", "id"=>"56"}, "2"=>{"open_time"=>"9", "closing_time"=>"8", "id"=>"57"}, "3"=>{"open_time"=>"9", "closing_time"=>"8", "id"=>"58"}, "4"=>{"open_time"=>"9", "closing_time"=>"8", "id"=>"59"}, "5"=>{"open_time"=>"9", "closing_time"=>"8", "id"=>"60"}, "6"=>{"open_time"=>"9", "closing_time"=>"8", "id"=>"61"}}}, "commit"=>"Save", "id"=>"12"}
Parking Load (0.1ms) SELECT "parkings".* FROM "parkings" WHERE "parkings"."id" = ? LIMIT ? [["id", 12], ["LIMIT", 1]]
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 1], ["LIMIT", 1]]
Availability Load (0.3ms) SELECT "availabilities".* FROM "availabilities" WHERE "availabilities"."parking_id" = ? [["parking_id", 12]]
(0.2ms) begin transaction
(0.1ms) rollback transaction
Completed 500 Internal Server Error in 10ms (ActiveRecord: 0.9ms)
ActiveModel<IP_ADDRESS>UnknownAttributeError (unknown attribute 'availabilities_attributes' for Availability.):
app/controllers/availabilities_controller.rb:31:in `update'
Rendering /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-<IP_ADDRESS>/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-<IP_ADDRESS>/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-<IP_ADDRESS>/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.9ms)
Rendering /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-<IP_ADDRESS>/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-<IP_ADDRESS>/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.1ms)
Rendering /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-<IP_ADDRESS>/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-<IP_ADDRESS>/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (2.3ms)
Rendered /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-<IP_ADDRESS>/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (127.7ms)
Finished "/cable/" [WebSocket] for ::1 at 2020-10-07 14:24:45 -0700
MessagesChannel stopped streaming from conversation_
NotificationsChannel stopped streaming from notification_1
Avalability.rb:
class Availability < ApplicationRecord
belongs_to :parking
def day
Date<IP_ADDRESS>DAYNAMES[read_attribute(:day)]
end
end
create_availabilities.rb
class CreateAvailabilities < ActiveRecord<IP_ADDRESS><IP_ADDRESS>1 at 2020-10-07 14:24:44 -0700
Processing by AvailabilitiesController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"MmyvqkUkM+YSPO4PZRB/baB8BmXaCFsPFoMm/RC7mAmPnxT9tBXnF4dL5dbMahCAldakWqMyvWaiDMutFTjxjw==", "parking"=>{"availabilities_attributes"=>{"0"=>{"open_time"=>"", "closing_time"=>"", "id"=>"55"}, "1"=>{"open_time"=>"9", "closing_time"=>"8", "id"=>"56"}, "2"=>{"open_time"=>"9", "closing_time"=>"8", "id"=>"57"}, "3"=>{"open_time"=>"9", "closing_time"=>"8", "id"=>"58"}, "4"=>{"open_time"=>"9", "closing_time"=>"8", "id"=>"59"}, "5"=>{"open_time"=>"9", "closing_time"=>"8", "id"=>"60"}, "6"=>{"open_time"=>"9", "closing_time"=>"8", "id"=>"61"}}}, "commit"=>"Save", "id"=>"12"}
Parking Load (0.1ms) SELECT "parkings".* FROM "parkings" WHERE "parkings"."id" = ? LIMIT ? [["id", 12], ["LIMIT", 1]]
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? ORDER BY "users"."id" ASC LIMIT ? [["id", 1], ["LIMIT", 1]]
Availability Load (0.3ms) SELECT "availabilities".* FROM "availabilities" WHERE "availabilities"."parking_id" = ? [["parking_id", 12]]
(0.2ms) begin transaction
(0.1ms) rollback transaction
Completed 500 Internal Server Error in 10ms (ActiveRecord: 0.9ms)
ActiveModel::UnknownAttributeError (unknown attribute 'availabilities_attributes' for Availability.):
app/controllers/availabilities_controller.rb:31:in `update'
Rendering /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
Rendering /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
Rendered /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.9ms)
Rendering /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
Rendered /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.1ms)
Rendering /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
Rendered /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (2.3ms)
Rendered /Users/zein/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/actionpack-5.0.7.2/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (127.7ms)
Finished "/cable/" [WebSocket] for <IP_ADDRESS>1 at 2020-10-07 14:24:45 -0700
MessagesChannel stopped streaming from conversation_
NotificationsChannel stopped streaming from notification_1
Avalability.rb:
class Availability < ApplicationRecord
belongs_to :parking
def day
Date::DAYNAMES[read_attribute(:day)]
end
end
create_availabilities.rb
class CreateAvailabilities < ActiveRecord::Migration[5.0]
def change
create_table :availabilities do |t|
t.references :parking, foreign_key: true
t.integer :day
t.time :open_time
t.time :closing_time
t.timestamps
end
end
end
Parking.rb
class Parking < ApplicationRecord
enum instant: {Request: 0, Instant: 1}
belongs_to :user
has_many :photos
has_many :reservations
has_many :availabilities
accepts_nested_attributes_for :availabilities
The 6 records in the availability is automatically created in the parking_controller when a User creates a parking spot.
Parkings_controller.rb
class ParkingsController < ApplicationController
before_action :set_parking, except: [:index, :new, :create]
before_action :authenticate_user!, except: [:show]
before_action :is_authorised, only: [:listing, :pricing, :description, :photo_upload, :amenities, :location, :update]
def index
@parkings = current_user.parkings
end
def new
@parking = current_user.parkings.build
end
def create
# if !current_user.is_active_host
# return redirect_to payout_method_path, alert: "Please Connect to Stripe Express first."
# end
@parking = current_user.parkings.build(parking_params)
if @parking.save
redirect_to listing_parking_path(@parking), notice: "Saved!"
else
flash[:alert] = "Something went wrong."
render :new
end
# the availability record is created here:
(0..6).each do |i|
@availabilities = @parking.availabilities.create(day: i)
end
end
availabilities_controller.rb
class AvailabilitiesController < ApplicationController
before_action :set_parking
before_action :authenticate_user!
before_action :is_authorised, only: [:index, :update]
def index
end
def new
end
# def create
# @parking = Parking.find(params[:id])
# # @availabilities = @parking.availabilities.new
# @availabilities = @parking.availabilities.build(availabilities_params)
# @availabilities.day = 0
#
# if @availabilities.save
# redirect_to listing_parking_path(@parking), notice: "Saved!"
# else
# flash[:alert] = "Something went wrong."
# render :new
# end
# end
def update
@availabilities = Availability.where(:parking_id => @parking.id)
if @availabilities.update(availabilities_params)
redirect_to listing_parking_path(@parking), notice: "Saved!"
else
flash[:alert] = "Something went wrong."
render :new
end
end
private
def availabilities_params
params.require(:parking).permit(availabilities_attributes: [:id, :open_time, :closing_time])
end
def set_parking
@parking = Parking.find(params[:id])
end
def is_authorised
redirect_to root_path, alert: "You don't have permission" unless current_user.id == @parking.user_id
end
end
views/availabilities/new.html.erb
<div class="container">
<div class="row">
<div class="col-md-3">
</div>
<div class="col-md-9">
<div class="card border shadow">
<div class="card-header bg-white h3">
Availability
</div>
<div class="card-body">
<%= form_for @parking, :url => availabilities_parking_path(@parking) do |f| %>
<%= f.fields_for :availabilities do |p| %>
<div class="form-group">
<label>Opening Time</label>
<div class="col-md-6">
<%= p.text_field :open_time, readonly: false, placeholder: "9:00 AM", class: "form-control datetimepicker-input"%>
</div>
<div class="form-group">
<div class="col-md-6">
<label>Closing Time</label>
<%= p.text_field :closing_time, readonly: false, placeholder: "8:00 PM", class: "form-control datetimepicker-input"%>
</div>
</div>
</div>
<% end %>
<br/><br/>
<div class="text-center">
<%= f.submit "Save", class: "button button-large curb-color" %>
</div>
<% end %>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$('#opening_time').datetimepicker({
format: 'LT',
ignoreReadonly: true,
useCurrent: false
});
$('#closing_time').datetimepicker({
format: 'LT',
ignoreReadonly: true,
useCurrent: false
});
});
</script>
routes.rb (the parking section)
resources :parkings, except: [:edit] do
member do
get 'listing'
get 'pricing'
get 'description'
get 'photo_upload'
get 'amenities'
get 'location'
get 'preload'
get 'preview'
get 'availabilities' => 'availabilities#new'
post 'availabilities' => 'availabilities#create'
patch 'availabilities' => 'availabilities#update'
end
resources :photos, only: [:create, :destroy]
resources :reservations, only: [:create]
resources :calendars
end
I approached this implementation after researching a lot online but I am open to any suggestion that will get me to the end result and fix this issue.
Thanks for your help.
| be2c2467f8387984970b30b77bb7ec3de3e9efca9c58f80ee61c7ff26502886b | ['125a17255f7146a19dc88ea3e7f05120'] | I am creating a booking system that reserves down to the hour slot using this datetimepicker : https://eonasdan.github.io/bootstrap-datetimepicker/
I am in the process of disabling hours that are already booked but I cannot seem to find the way to do it. In the options, disabling hours just disables those hours for every single day and disable date just disables that date completely.
What I need is: If 06/30/2020 5:00pm is booked, it should be disabled but there is no option to do that. Does anyone have an idea on how to attack this? or is there a datetimepicker with that options?
Thanks.
|
465b44ec20d5c4f7111850a3a62384055b5024becf4e0a4d0fe317c3eb33591f | ['125e6d7c140047ebb319385b13e51fcc'] | I have a peculiar problem with a OpenVPN tunnel on my Linux-server (RoadWarrior config). I can login perfectly with Tunnelblick 3.0 on my Mac, I can access all services on the server hosting the OpenVPN daemon, however, I am unable to access any other machine on the server's subnet.
I am pushing the route to the client and netstat -rn shows that the route exists.
My client-config is as following
port 500
dev tun
remote {secret}
tls-client
ca ca.crt
cert client.crt
key client.key
comp-lzo
pull
verb 4
and the server's configuration is following
port 500
dev tun
local <IP_ADDRESS>
tls-server
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key
dh /etc/openvpn/keys/dh1024.pem
mode server
ifconfig <IP_ADDRESS> <IP_ADDRESS>
ifconfig-pool <IP_ADDRESS> <IP_ADDRESS>
route <IP_ADDRESS> <IP_ADDRESS>
push "route <IP_ADDRESS> <IP_ADDRESS>"
push "route <IP_ADDRESS> <IP_ADDRESS><PHONE_NUMBER>
push "route 10.84.0.1 255.255.255.255"
push "route 10.81.0.0 <PHONE_NUMBER>"
comp-lzo
keepalive 10 60
inactive 600
user vpndaemon
group vpndaemon
persist-tun
persist-key
verb 4
I can't find any obvious mistake and I also verified that there are no IP clashes on the client-side.
Any hints or ideas are greatly appreciated!
| a2a80c5ea0f235d6203664a99d135f16f778ca3c463a63485d82bc1d438c9cab | ['125e6d7c140047ebb319385b13e51fcc'] | Sentence 2 is incorrect - 'to' is essential because of the 'classical music' that follows it. We can say 'Listen!' without the 'to' or 'I'm listening.', but as soon as we mention whatever the listening refers to, we need the 'to'! So, 'Listen to that storm!',
'I want you to listen to me, please', 'Listen to the announcements', and so on.
|
9cde25091c0db37117b9ff3aac8539f4c9a38f06276dc48ae25f42a0ec3d62bc | ['1262d2f9236e446da56c2cced484350c'] | You can do it by using HTML5 FileAPI. But it is neccessary, that u or user should select the file for reading. After uploading file, remains only to parse the necessary variables in the correct manner. Short example:
function readSingleFile(e) {
var file = e.target.files[0];
if (!file) {
return;
}
var reader = new FileReader();
reader.onload = function(e) {
var contents = e.target.result;
displayContents(contents);
};
reader.readAsText(file);
}
function displayContents(contents) {
var element = document.getElementById('file-content');
element.innerHTML = contents;
}
document.getElementById('file-input')
.addEventListener('change', readSingleFile, false);
<input type="file" id="file-input" />
<h3>Contents of the file:</h3>
<pre id="file-content"></pre>
| 66ca4988fcb8a4f0956d9420bc677602ee70dc16328bd4865f7125f02b3fe9ba | ['1262d2f9236e446da56c2cced484350c'] | You can try write your own color resourse file.
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!--Color for checked state-->
<item android:color="@android:color/white"
android:state_checked="true"/>
<!--Color for unchecked state-->
<item android:color="@android:color/darker_gray"
android:state_checked="false"/>
And use this in your menu
app:itemIconTint="@color/your_colors"
app:itemTextColor="@color/your_colors"
|
23462fcf1d2f8fcae10644532e8a5e0220af9ef196722060d93423a579c4be1b | ['126bb8744cb94622a06a56aedcda6f34'] | I write a python network application which have 2 component agent and server. Agent connect to Server to send data. I use pyinstaller to covert agent script to .exe file. If i don't add option -w which will help hide Console, the code work fine. But when i add option -w , the code failed to run.
Here is my Agent code :
def SocketConnect(Server_IP,PORT):
# Create Socket
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
except socket.error, e:
log_file.write(time.ctime() + " : Error creating socket : %s\n" %e)
log_file.close()
sys.exit(1)
# Connect
try:
s.connect((Server_IP, PORT))
except socket.error, e:
log_file.write(time.ctime() + " : Connect : %s\n" %e)
log_file.close()
sys.exit(1)
# Send Data
data = pickle.dumps({'OS':[OS()], 'CPU':[CPU()], 'DISK' : [DISK()], 'MEMORY': [MEMORY()], 'NETWORK': [NETWORK()], 'FIREWALL' : FIREWALL()})
try:
s.send(data)
except socket.error, e:
log_file.write(time.ctime() + " : Error sending data: %s\n" % e)
log_file.close()
sys.exit(1)
# Close Socket
s.close()
if __name__ == "__main__" :
config_file = open('AgentConfig.cfg', 'r') # Open Config File - Read
log_file = open('Log.txt', 'a') # Open Log File - Write
Server_IP = config_file.readline().rstrip()
PORT = int(config_file.readline().rstrip())
FREQUENCE = config_file.readline()
# Check valid Server_IP & PORT
parts = Server_IP.split(".")
if Server_IP == '' or PORT == '' :
log_file.write(time.ctime() + " : Server IP or Connect Port is not config !\n")
log_file.close()
sys.exit(1)
elif len(parts) != 4:
log_file.write(time.ctime() + " : Server IP is not a valid IP !\n")
log_file.close()
sys.exit(1)
else :
for item in parts:
if not 0 <= int(item) <= 255:
log_file.write(time.ctime() + " : Server IP is not a valid IP !\n")
log_file.close()
sys.exit(1)
elif PORT not in range(0,65536) :
log_file.write(time.ctime() + " : Port must be in range 0-65535 !\n")
log_file.close()
sys.exit(1)
else :
while True :
log_file = open('Log.txt', 'a') # Open Log File - Write
log_file.write(time.ctime() + " : Connect to Server at " + Server_IP + " : Port " + str(PORT) + "\n")
SocketConnect(Server_IP,PORT)
log_file.write(time.ctime() + " : Send data Success !\n")
log_file.close()
time.sleep(int(FREQUENCE))
When i run Agent, it failed to run and the error below show up on Server site :
----------------------------------------
Exception happened during processing of request from ('<IP_ADDRESS>', 21672)
Traceback (most recent call last):
File "C:\Python27\lib\SocketServer.py", line 290, in _handle_request_noblock
self.process_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 318, in process_request
self.finish_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 331, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python27\lib\SocketServer.py", line 652, in __init__
self.handle()
File "Server.py", line 116, in handle
temp_list = pickle.loads(self.data).values()
File "C:\Python27\lib\pickle.py", line 1388, in loads
return Unpickler(file).load()
File "C:\Python27\lib\pickle.py", line 864, in load
dispatch[key](self)
File "C:\Python27\lib\pickle.py", line 886, in load_eof
raise EOFError
EOFError
----------------------------------------
And here is the related code on Server. It use to receive data from client.
def handle(self):
# self.request is the TCP socket connected to the client
try:
self.data = self.request.recv(4096)
except socket.error, e:
log_file.write(time.ctime() + " : Error receive: %s" %e)
log_file.close()
sys.exit(1)
temp_list = pickle.loads(self.data).values()
I don't know why this happen. How can option -w of pyinstaller can efect to my code ?
| 05543208eb5561e64bbf6e1a7b3fc281a1f888023333017a3d2a69c486ad81fe | ['126bb8744cb94622a06a56aedcda6f34'] | I try to write a network application. And stuck in how to write info to db (sqlite).
I collected systeminfo :
C:\Users\lnhqu>systeminfo
Host Name: DESKTOP-OIC0B0G
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.16299 N/A Build 16299
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
Registered Owner: Windows User
Registered Organization:
Product ID: 00330-50366-57669-AAOEM
Original Install Date: 02/12/2017, 12:22:29 SA
System Boot Time: 11/04/2018, 8:25:00 SA
System Manufacturer: LENOVO
System Model: 20EQS1TQ00
System Type: x64-based PC
Processor(s): 1 Processor(s) Installed.
[01]: Intel64 Family 6 Model 94 Stepping 3 GenuineIntel ~2712 Mhz
BIOS Version: LENOVO N1EET62W (1.35 ), 10/11/2016
Windows Directory: C:\WINDOWS
System Directory: C:\WINDOWS\system32
Boot Device: \Device\HarddiskVolume2
System Locale: vi;Vietnamese
Input Locale: en-us;English (United States)
Time Zone: (UTC+07:00) Bangkok, Hanoi, Jakarta
And then i put it in a list like this :
['Host Name: DESKTOP-OIC0B0G\r', 'OS Name: Microsoft Windows 10 Pro\r', 'OS Version: 10.0.16299 N/A Build 16299\r', 'OS Manufacturer: Microsoft Corporation\r', 'OS Configuration: Standalone Workstation\r', 'OS Build Type: Multiprocessor Free\r', 'Registered Owner: Windows User\r', 'Registered Organization: \r', 'Product ID: 00330-50366-57669-AAOEM\r', 'Original Install Date: 02/12/2017, 12:22:29 SA\r', 'System Boot Time: 11/04/2018, 8:25:00 SA\r', 'System Manufacturer: LENOVO\r', 'System Model: 20EQS1TQ00\r', 'System Type: x64-based PC\r', 'Processor(s): 1 Processor(s) Installed.\r', ' [01]: Intel64 Family 6 Model 94 Stepping 3 GenuineIntel ~2712 Mhz\r', 'BIOS Version: LENOVO N1EET62W (1.35 ), 10/11/2016\r', 'Windows Directory: C:\\WINDOWS\r', 'System Directory: C:\\WINDOWS\\system32\r', 'Boot Device: \\Device\\HarddiskVolume2\r', 'System Locale: vi;Vietnamese\r', 'Input Locale: en-us;English (United States)\r', 'Page File Location(s): C:\\pagefile.sys\r', 'Domain: WORKGROUP\r']
I plan to write each element to an corresponding colum. But there is some issue with the Processor(s) row :
Processor(s): 1 Processor(s) Installed.
[01]: Intel64 Family 6 Model 94 Stepping 3 GenuineIntel ~2712 Mhz
The infomation not store in one line so when i put it in a list. It become two different element. If there is 2 Processor(s). It will become tree element in list. And i can't write to db correctly.
The db format look like this :
DB Format.
There is only 1 colum to write processor infomation in db. So if there is 2 or 3 element for processor infomation in list. I can't write it to database.
Please give me some advices to solve this.
|
651585f83e2a4c9dc6fd204bd012d4711bd93a27296f07ad9a945f35b0628040 | ['1271edfcc37b46709650f94b3669e1ea'] | My system configuration is Windows 7 service pack1, 64 bit operation system and IE version is 11.0.9600.17843 (update version 11.0.20).
Kindly check this url provided by MSDN for double click event:
http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/ondblclickEX.htm
To reproduce issue on Windows 7 + IE 11 follow below step:
Move focus to address bar by clicking on address bar.
Now double click on text box, double click event does not fire.
This issue does not reproduce on Windows 8 + IE 11 OR Windows 7 + IE version < 11.
Below is the code copied from:
https://msdn.microsoft.com/en-us/library/ms536921(v=vs.85).aspx
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function addItem()
{
sNewItem = new Option(txtEnter.value)
selList.add(sNewItem);
}
</script>
</head>
<body>
<p>Enter text and then double-click in the text box to
add text to the list box.</p>
<input type="text" name="txtEnter" value="Enter_text"
ondblclick="addItem()"><br><br>
<select name="selList" size="5"></select>
</body>
</html>
I'm also getting this double click issue for ActiveX control created in VB6 for environment Windows 7 + IE 11.
My ActiveX application working fine on Windows 8 + IE 11.
Kindly provide me any solution or workaround for this issue.
| 9686dba859b43decabe6fec0ccafaaed8b766d4d896c180a0cf1cd2c6ce2ca4c | ['1271edfcc37b46709650f94b3669e1ea'] | since it is a bug in Kendo UI, do not use NoRecords method of grid. Instead use DataBound event and call below JS function:
function onGridDataBound(e) {
if (!e.sender.dataSource.view().length) {
var colspan = e.sender.thead.find("th:visible").length, emptyRow = 'No Record Found.';
e.sender.tbody.parent().width(e.sender.thead.width()).end().html(emptyRow);
}
}
|
25b49dab62dcf55ab5b03cb95b98199a8a671a6a522a98ac3e7e67ee1294c679 | ['1273fc808dbf47e6a12eee76c946184b'] | I have a simple form like this:
I open the combobox and at the time dropdown is open, I click the button. On button click I show a simple message but the message is not shown at that time.
It shows when I click it again.
The same problem for textbox. When the dropdown is open, the textbox click is not working.
Why does combobox prevent clicking other controls when it is open?
| 10686ee95d86a5683467375311c5c99d5ebcff98bc3bd1dfd4de95baffeee8ff | ['1273fc808dbf47e6a12eee76c946184b'] | I figured out the problem.
Just set
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
and test the result. for me it is this:
Maximized
Location: {X=0,Y=0}
Size: {Width=1280, Height=800}
PointToScreen(0,0): {X=0,Y=0}
Normal
Location: {X=0,Y=0}
Size: {Width=477, Height=321}
PointToScreen(0,0): {X=0,Y=0}
It is all about the border.
|
77f17e4ea296e360a47564ecb329b992a940aa2110310b918e7c5aa94fcfd6a8 | ['1279ab43e3254bcb9e4a965471a75781'] | I want to check the product is available on the online store on Shopify or not. While adding the product in the Shopify we have an option in the sales channel -> 'online store'. I want to check that my product is available in online sales or not. Also list of products available in online sales.
I have reviewed below Links to get online store means sales channels products. But not it's not working.
https://shopify.dev/docs/admin-api/rest/reference/sales-channels/productlisting
https://help.shopify.com/en/manual/online-sales-channels#available-online-sales-channels
I have also attached the reference images below.
enter image description here
| 32844732caed1e8339e8db9d6337ec5e4a852f4121370ed8c5f8f63593d1624d | ['1279ab43e3254bcb9e4a965471a75781'] | Finally found the answer:
Select CONCAT(MID(phone, 1, LENGTH(phone) - 3), '***') as new_phone,
CONCAT(LEFT(name,1),REPEAT("*",LENGTH(name)-2),RIGHT(name,1)) as new_name,CONCAT(CONCAT(left(email,1),REPEAT("*",LENGTH(SUBSTRING_INDEX(email, "@", 1))-2),RIGHT(SUBSTRING_INDEX(email, "@", 1),1)),'@',SUBSTRING_INDEX(email,'@',-1)) as new_email from employee
Thanks all. :)
|
f5ad2fdc647ccc132658b9736d5ba281e3c36bb3bb7595764f349e38f5f3d8bb | ['129a6ebab714460a925a4d4c72a8d917'] | If I'm given a 2D array with unknown parameters, I have to combine the rows together to create a 1D String with those values for example:
2 3 4 1
8 1 1 2
returns
[2341, 8112]
How do you convert a 2D array into a 1D array and set it as a String?
This is what I have so far:
public static String[] stichEachRow(int[][] matrix)
{
int[] answer = new int[1];
for (int r = 0; r < matrix.length; r++)
{
for (int c = 0; c < matrix[0].length; c++)
{
answer = "[" + matrix[r][c] + ", ";
}
}
return answer + "]";
}
I get errors that say I can't convert from String to an int[]
| 4c25a342d2fd7787f9d20a9ba5140c107a77980323b3b9e402640838000ffa28 | ['129a6ebab714460a925a4d4c72a8d917'] | I need to set all of the values in a 2D array to zeros except for three of the values. 42 is in the top left corner, 3rd row 3rd column is -2, and 4th row 6th column is -3. The size of the array is unknown, for example:
[0,0,0,0,0,0,0]
[0,0,0,0,0,0,0]
[0,0,0,0,0,0,0]
[0,0,0,0,0,0,0]
[0,0,0,0,0,0,0]
[42,0,0,0,0,0,0]
[0,0,0,0,0,0,0]
[0,0,-2,0,0,0,0]
[0,0,0,0,0,-3,0]
[0,0,0,0,0,0,0]
This is what I have so far:
public static void setThreeNumbers(int[][] arr)
{
int[][] arr1 = arr;
for (int r = 0; r < arr.length; r++)
{
for (int c = 0; c < arr[0].length; c++)
{
if (arr[r][c] == arr[0][0])
{
arr1[r][c] = 42;
}
if (arr[r][c] == arr[2][2])
{
arr1[2][2] = -2;
}
if (arr[r][c] == arr[3][5])
{
arr1[3][5] = -3;
}
}
}
}
I'm getting an ArrayIndexOutOfBounds for the -3 because on one of the tests because there isn't enough rows in the array for the value to be changed to -3 and my if statement isn't working for this value.
|
7f0bf4217f1cf98bb8fa5f95911d76e1d4d4db6825b89fe915f1aba355cab03c | ['129de201406d4c17803dc50455bdec59'] | I downloaded the Quickblox SDK and followed these steps to connect QuickBlox SDK to existing IOS project using this below link :-
http://quickblox.com/developers/IOS-how-to-connect-Quickblox-framework
But Project is not able to build and it is showing compilation error.
i.e "Quickblox/Quickblox.h file not found"
Please refer below screenshot and let me know how can i resolve it
Also i tried removing the Quickblox framework and added again but it is not working.
| 7a0a18ea79d3b9c8543118ad076dc1d9b66f304d5ba87701deacc7db2513ec33 | ['129de201406d4c17803dc50455bdec59'] | I have downloaded the quickblox sample chat application and sending text messages are working fine. But how to send attachment like picture, video or else?
According to Quickblox's documentation.
There is class named QBChatAttachment having properties as type, url and id but how to attach files like picture, video or else?
|
ec667963fa12bfc6ed3dae8dd8060367987dfdf8684116a379420d292756d48b | ['12a1487f4e20403cbed760dd4447b5dd'] | I have a jpa Entity which already have a id generated as uuid and one more unique human readable id was required. so I generated a ref_key with ValueGenerator.
@Id@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Type(type = "uuid-char")@Column(name="ID")
private UUID id;
@GeneratorType(type = UniqueIdGenerator.class, when = GenerationTime.INSERT)
@Column(name = "REF_KEY", updatable = false, insertable = true, unique = true, nullable = false)
private String refKey;
For generating this unique ref_key, I used timestamp and a simple counter. The code is below
public class UniqueIdGenerator implements ValueGenerator {
private static volatile String lastTimestamp = "";
private static volatile int counter = 1;
private String valuePrefix = "UNI_";
@Override
public String generateValue(Session session, Object owner) {
return generateUniqueId(valuePrefix);
}
private static synchronized String generateUniqueId(String prefix) {
String id;
Date dNow = new Date();
SimpleDateFormat ft = new SimpleDateFormat("yyMMdd_HHmmss");
String datetimeId = ft.format(dNow);
if (lastTimestamp.equalsIgnoreCase(datetimeId)) {
id = prefix + datetimeId + "_" + counter;
counter++;
} else {
id = prefix + datetimeId;
counter = 1;
}
lastTimestamp = datetimeId;
return id;
}
}
All this working fine with one instance. But multiple instances are getting deployed for this application for load balancing, so Its very high probability that same id would be generated and inserted in DB at very same moment. How can I avoid getting duplicates in DB ? What could be a better approach ?
DB used Oracle 11g.
I tried few different things before coming to this approach like using sequence from DB end but it didn't worked out and whole model/entity part is getting packaged separately, I was not able to hit DB from This portion. What else can be done to have a unique counter value generated and inserted in DB as per instances. Please help.
| 1c7227adf1613cb18bfdbfafb678adce8eaf652e49a8e5c25dc128a077cbd62e | ['12a1487f4e20403cbed760dd4447b5dd'] | As per documentation of Facebook of Using App Access Token,
While an App Access Token is largely for the purposes of publishing information back to Facebook on behalf of the user, there is a limited set of information that can be retrieved from Facebook using an App Access Token.
Basic Profile Info of a User (ID, Name, Username, Gender)
A User’s Friends and their IDs
Permissions granted by the User to your App
ref : developers.facebook.com/docs/opengraph/using-app-tokens/
But I am not able to get mostly fields by application access_token.
I provide all user and friends permissions and extended permissions to a user with ID UID1
checked as : https://graph.facebook.com/UID1/permissions?access_token=APP_ACCESS_TOKEN
and I got : ( 1 signifies permission granted and 0 signifies permission not granted.)
{
"data": [
{
"installed": 1,
"read_stream": 1,
"manage_friendlists": 1,
"read_mailbox": 1,
"publish_checkins": 1,
"status_update": 1,
"photo_upload": 1,
"video_upload": 1,
"create_event": 1,
"rsvp_event": 1,
"email": 1,
"xmpp_login": 1,
"create_note": 1,
"share_item": 1,
"publish_stream": 1,
"ads_management": 1,
"read_insights": 1,
"read_requests": 1,
"manage_notifications": 1,
"read_friendlists": 1,
"publish_actions": 1,
"user_birthday": 1,
"user_religion_politics": 1,
"user_relationships": 1,
"user_relationship_details": 1,
"user_location": 1,
"user_likes": 1,
"user_activities": 1,
"user_interests": 1,
"user_education_history": 1,
"user_online_presence": 1,
"user_groups": 1,
"user_events": 1,
"user_photos": 1,
"user_notes": 1,
"user_questions": 1,
"user_about_me": 1,
"user_status": 1,
"friends_birthday": 1,
"friends_religion_politics": 1,
"friends_relationships": 1,
"friends_relationship_details": 1,
"friends_location": 1,
"friends_likes": 1,
"friends_activities": 1,
"friends_interests": 1,
"friends_education_history": 1,
"friends_online_presence": 1,
"friends_groups": 1,
"friends_events": 1,
"friends_photos": 1,
"friends_notes": 1,
"friends_questions": 1,
"friends_about_me": 1,
"friends_status": 1
}
]
}
Then I make a API call to following URL with APP_ACCESS_TOKEN to retrieve all possible information
https://graph.facebook.com/UID1?fields=id,name,picture,gender,locale,languages,link,username,third_party_id,installed,timezone,updated_time,verified,bio,birthday,cover,currency,education,email,hometown,interested_in,location,political,religion,website,work,relationship_status&access_token=APP_ACCESS_TOKEN
As a result I got only
{ id, name, gender, locale, username, third_party_id, installed, cover, email and picture }.
Out of which I am able to get
{ id, name, gender, locale, username, cover and picture } without any access_token.
But Facebook server is not at all sending me all other fields
{ location, birthday, relationship_status,languages,link,updated_time,bio,education,hometown,political,religion,work }
for which user has authorized the application. Now app_access_token is working fine (I hope so), Thats why I am able to get
{ email, installed and third_party_id }
but how to get rest fields. Please help me out of the same.
|
5fe8637d5d2eca8b49fbe4f1ab8c01434285bf531c6a0d4fcb422c4855535de3 | ['12a28dcb93914a508da70441d655cddb'] | I have Angular app currently consist of one project and multiples modules regarding that project.But my question is when ERP base application is developed in Angular ( as back end we are using .Net Core) then how to manage each ERP module because each module(Project) consist of angular modules so that at run main.js size remain small. From server side we can manage it as micro-services but how to handle them in front end side so that we easily manage main.js ( to remain safe from increasing main.js size )
Any help will be very much appreciated
| 7e07a6885dfdf9ec0b3ccff6d8e2d30e0b7423a5914028e6205d93e70131cc54 | ['12a28dcb93914a508da70441d655cddb'] | I am using this in my project and this logic is working fine for me.
$scope.o.DateOfBirth = "31/03/2021";
var currentDate =moment($scope.o.DateOfBirth, 'DD/MM/YYYY').format('YYYY-MM-DD');
var futureMonth = moment(currentDate ).add(24, 'month').format("YYYY-MM-DD");
console.log(currentDate.format('DD-MM-YYYY'));
console.log(futureMonth.format('DD-MM-YYYY'));
output : "2023-03-31"
|
c2c252b8d3f9eff678a0bbb3eb1744424200d5cb08821eac765d7e31e8d5199a | ['12a43fb79a594caea94feab72cea0200'] | Есть база в которую записываются письма других людей. При появлении нового письма нужно узнать не похоже ли оно на другие присутствующие в базе и на сколько процентов совпадение. Письма находятся в типе поля TEXT. Я так понимаю можно как-то через MATCH, но все примеры только для поиска одной фразы в тексте, а мне надо целый текст сравнить с другими текстами. Поделитесь пожалуйста идеями.
| 7f1af0a767406e17488521681f98a12e1ec4d503bd2e99ebd41261cd9af331ea | ['12a43fb79a594caea94feab72cea0200'] | I've been reading about FMCW radar, and I understand that a chirped signal can be de-chirped by mixing it with a copy of itself, which yields a beat frequency which is much easier to process and is proportional to the time delay between the transmitted and received signals. However, a lot of the implementations that I've seen have used a frequency ramp with discrete frequency steps, presumably because it is much easier to implement.
Initially I assumed that stretch processing would not work with a SFCW radar, since the discrete frequency steps would create two beat frequencies instead of one when the frequency steps didn't line up (I made this model for myself). But after doing more research on how one would actually create a continuous, wideband chirp, I could only find the VCO based solution in the MIT coffee can radar (which is only as linear as the VCO) and this implementation, which uses a DDS IC with discrete frequency steps as a reference. I'm certain that I must be missing something.
Is stretch processing possible with SFCW chirps? If so, does it come at a cost of decreased range resolution? Why or why not? If it isn't possible, how are wideband continuous chirps actually generated?
|
9bbadbb8cc03a2a7f69b4291ad2a6f69f0a76c1c18bbc72a8a115c71b0376d55 | ['12b5378fb198407189a69f13e83d5312'] | The "location" parameter is relative to a resource located in your app. Therefore it can not access an external file.
And the plan B is not the best solution because in case you redeploy your app, you should also recrate the symlink.
You may try for a plann C, using a simple jsp page (in every application) that redirects where you like.
Eg:
web.xml:
<error-page>
<error-code>404</error-code>
<location>404.jsp</location>
</error-page>
404.jsp
<% response.sendRedirect("http://host:port/error/NotFound.html"); %>
| 4b2e79d5e4bf0dc0bc1c8d4e9c7cc468145205145c5a7b4ea59559f8f3a5381c | ['12b5378fb198407189a69f13e83d5312'] | First of all you should set up your web.xml to redirect errors 404 to a specific page:
<error-page>
<error-code>404</error-code>
<location>/error404.jsp</location>
</error-page>
at this point, you can implement your error404.jsp as follows:
<%@ page language="java" isErrorPage="true" %><%
String url = (String) request.getAttribute("javax.servlet.forward.servlet_path") ;
if ( url!=null && url.indexOf("restRequest")!=-1 ) return ;
%>
<html><head><title>Error 404</title></head><body>Error 404<br>The requested URL <%=url%> was not found on this server.</body></html>
|
7a8a76b8b4f47c8f74fe12f674ea9c36fd9c4cdecaf9acd76f5a4aa597d9f57b | ['12bfc933e61b42a1ab9173da750234c9'] | To start learning BASH scripting, I've created a trivial script that curls down a stock price from YAHOO and prints it to STDOUT. I've set the permissions to rwx for everyone, and moved the file into my path:
Script:
root@raspberrypi:~/code/scripts$ cat quote
#!/bin/bash
while getopts "s:" opt; do
case $opt in
s)STOCK="$OPTARG";;
\?) echo "ERROR"; exit 1;;
esac
done
PRICE=$(curl -s "http://download.finance.yahoo.com/d/quotes.csv?s=${STOCK}&f=l1")
echo "${STOCK}: ${PRICE}"; exit 0
exit 0
I then set the permissions for all users:
root@raspberrypi:~/code/scripts$ chmod 777 quote
Here is my $PATH:
root@raspberrypi:~/code/scripts$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
I now move it into my path in what I read was the appropriate location for custom user scripts:
root@raspberrypi:~/code/scripts$ ls -la /usr/local/bin
total 12K
drwxrwsr-x 2 root staff 4.0K Apr 30 01:28 ./
drwxrwsr-x 10 root staff 4.0K Jan 1 1970 ../
-rwxrwxrwx 1 root root 433 Apr 30 01:22 quote*
The which command will find it (expected):
root@raspberrypi:~/code/scripts$ which quote
/usr/local/bin/quote
PROBLEM: when I run the script, it returns the first option on the next line followed by my prompt:
root@raspberrypi:~/code/scripts$ quote -s aapl
'-s'root@raspberrypi:~/code/scripts$
But, when I run the script with a full path, it works just fine:
root@raspberrypi:~/code/scripts$ /usr/local/bin/quote -s aapl
-s: 592.33
Apologies if this less a programming question and more a Unix question, but I want to make sure I rule out a problem with my code before I do anything else.
I'm sure this is something very easy, so thanks in advance for the extra set of eyes.
| d6e1875477f3c1009a896c7def544b9337058be47f547819b71b9ef4e1fb9541 | ['12bfc933e61b42a1ab9173da750234c9'] | #include <stdio.h>
#include <string.h>
#define BUFFERSIZE 1024
int main() {
char buffer_a[BUFFERSIZE];
char buffer_b[BUFFERSIZE];
char *concat;
printf("Enter the first string: \n");
if(fgets(buffer_a, BUFFERSIZE, stdin)){
char *p = strchr(buffer_a, '\n');
if (p){
*p = '\0';
}
}
printf("Enter the second string: \n");
if(fgets(buffer_b, BUFFERSIZE, stdin)){
char *p = strchr(buffer_b, '\n');
if (p){
*p = '\0';
}
}
int len_a = strlen(buffer_a);
int len_b = strlen(buffer_b);
int len_both = (len_a + len_b);
printf("First string: %s", buffer_a);
printf("Length of first string: %i\n", len_a);
printf("Second string: %s", buffer_b);
printf("Length of second string: %i\n", len_b);
if(len_both < 70){
concat = strcat(buffer_a,buffer_b);
printf("Concatenated string: %s\n", concat);
} else{
printf("Length of combined strings > 70\n");
}
return 0;
}
|
9abe28d203f34ee1784e28721d7e77e4a0bf4e241a86d1ace4652e6e22e96616 | ['12c1bedc495e4cf4ae3ad8ccf4425243'] | There must be an easier way to add customized ticks and labels in a plot using ggplot2 than creating custom function to do it like some answers in the forum...
Here's my code,
data<-data.frame(WS_Spd_WVT=c(0.5,1.2,4.2,0.3),C_E=c(100,200,150,50))
plot8 <- ggplot(data=data,aes(x=WS_Spd_WVT,y=C_E)) + geom_point(color='blue') +
scale_y_continuous(breaks=seq(-200,500,by=100)) +
ylim(-100,500) +
theme(panel.background = element_rect(fill='white',color='black'),panel.grid.major=element_line(size=0.5,color='gray'),panel. grid.minor=element_line(size=0.25,color='gray')) +
ylab(expression('C'[E])) + xlab('U') + scale_x_continuous(breaks=seq(0,14,by=1),minor_breaks=seq(0,14,by=0.5))
plot8
I just need to add 0.5 tick marks with labels (e.g., 1.5,2.0,2.5, etc) for the x-axis and (50, 100,150, 200, etc.) for the y-axis. Is it possible to add even minor ticks to the minor tick marks for the y-axis?
While I am at it, anyway to change the major axis label size and the minor axis label size separately instead of using 'base_size?'
| d7e9b821201e4a4bd7d738859c602074010a0857abf08794fd53cfcd2fc3d27c | ['12c1bedc495e4cf4ae3ad8ccf4425243'] | I managed to figure it out myself on how to do this.
I am using a Macbook Pro 13" mid-2012 running OS X Yosemite ver. 10.10.2
Python has already been installed on the Mac regardless of QGIS (QGIS Python console uses the original Mac Python installation), so to install a "module" (similar to "package" in R) you would have to download the module first. So in the case of "geojson":
Download the tar module from: https://pypi.python.org/pypi/geojson/
After downloading, the tar file would normally be in the Downloads folder.
Run the "Terminal" app from the applications folder.
Within the terminal app, navigate to the Downloads folder and type python setup.py install by using cd, for example cd Downloads/. Note that you might need to use sudo such as sudo python setup.py install if the folder is password-protected where you need to input the admin's password to proceed.
The module would be installed in the appropriate folder i.e. the "site-packages' folder within the hidden python folder (either version 2.6 or 2.7). For me it was 2.7.
Now you can use the geojson module in QGIS. Test it by typing import geojson in the QGIS Python console.
|
36471f422d4572f0967ddc15aea19985feb51b08c0ead35427c1acdca039b6cc | ['12cba57866eb43a6b78064c62acbe2a3'] | Got it working by breaking each function into its own functional component, then render these from the main class (signup) using conditionals. Swapping between pages are handled by callback to "handlesubmit" in this function. Pass history as the final page routes back to main. Feel like this isn't the best way of doing this tho =D, but it avoids the issues with re-renders while typing.
So now the Signup just return ...
export default function SignUp(props)
{
const [activeStep, setActiveStep] = React.useState(0);
const handleSubmit = props => form =>
{
form.preventDefault()
console.log(form)
setActiveStep(activeStep + 1);
}
return (
<div>
{activeStep == 0 ? <CreateAccount handleSubmit={handleSubmit} /> : <CreateAccountACK handleSubmit={handleSubmit} history={props.history}/>}
</div>
)
}
And each function, hooks/variables exist in their own file/function.
| 42ef1e1e42f17e1c849637be25442ef7a48a2276ec079d3b0725803074a06f90 | ['12cba57866eb43a6b78064c62acbe2a3'] | I'm making a small game for android and currently use a pooling system e.g. for enemies, projectiles etc.
As for now I'm Async loading in levels as you play the game which means no loading scene when venturing into a new zone.
Pool is created when new game is started or old save is loaded. It works fine but leaves one issue! With no loading scenes while playing, there's no time to populate pool other than at the beginning. As player could potentially play all the way though in one sitting, that means all pooled objects needs to be loaded and instantiated.
I realize "Dynamically" filling a pool kinda miss the whole idea of pooling in the first place, but I'm curious what solutions people have come up with. Instantiating enemies at level 1 that won't see use until level 10 seem wasteful.
Cheers :)
|
0c382fc6af31f41917b4c6c46be9373dde8bd379e06bfa6bcf37e62cf74d1f50 | ['12d48336ce1a4e1da874b2688bea888a'] | Note that FileWriter starts empty everytime you instantiate a FileWriter with the Filename only, and then starts writing the data to the beginning of the file.
There's a second constructor that takes a boolean append flag that starts at the end of the file, appending data to the current file's contents.
This means that your code erases the whole pdf file and then close()s it, saving an empty PDF file, with zero bytes.
This simple change will fix your issue:
String pathSrc = "C:\\Users\\me\\Desktop\\somefile.pdf";
//should just check if file is opened by someone else
try {
FileWriter fw = new FileWriter(pathSrc, true);
fw.close();
}
catch (IOException e) {
System.out.println("File was already opened");
return;
}
| e5245433eeac55049a7bc6ef36229a0a2c4bc037f036bb4a5c77496c138ed570 | ['12d48336ce1a4e1da874b2688bea888a'] | So, I was reading some book and it had source code with a single cpp file, no classes and a bunch of static functions.
After some searches, I mostly see material about static member functions, which I know what they do and doesn't provide me any answer.
I also found something about anonymous namespaces vs static functions, but didn't quite understand the point.
So, can anybody out there provide me some insights on what are static non member functions, what's their uses or why to use them?
|
4c5bc91cff6e70d2f1c713f60f28336a8e14eeeac52a18efe556f9fb1d444567 | ['12d65f868661461899d8f2159076f995'] | No, I pay the mortgage. They had agreed to pay a rental fee, in January, that is less than the mortgage payment, which they paid for 2 months. I'm currently going the eviction route, unfortunately, but with all of their claims and lies to their attorney (saying they paid the homeowners insurance, which is lender-paid, meaning I have always paid it with the mortgage payment), we decided enough was enough.
What is the tenancy in common? | 8d359228309017d0d13f21699dc798658673ff9946b4b04184f265e889301d47 | ['12d65f868661461899d8f2159076f995'] | You can think of it like this:
The envelopes have fixed positions $1, 2, 3, 4, 5, 6, 7, 8$. Now which letter gets which envelope is described by an 8-tuple. The 8-tuple $(2, 1, 3, 4, 5, 6, 7, 8)$ means that he gets every letter right, except for letter 1 and 2.
Your sample space is the set of all permutation of the number 1, ... 8:
$$\Omega = \{(x_1, \dots, x_8) | x_i \in \{1, \dots, 8\}, i \neq j \Rightarrow x_i \neq x_j\}$$
$$|\Omega| = 8! = 40320$$
How many ways are there to get exactly 6 right? 6 out of 8...
$$\binom{8}{6} = \frac{8!}{6! (8-6)!} = \frac{7 \cdot 8}{2} = 7 \cdot 4 = 28$$
This makes
$$P(\text{get exactly 6 letters right}) = \frac{28}{40320} = \frac{1}{1440} \approx 0.06944 \%$$
|
1269e4d37aff692183cb2a64adb955aefd1085b412186289e2c5c6d1329ad7ae | ['12d96ba9d55f425db601862a11e92e56'] | I believe when you call e.preventDefault();, you prevent CKEditor from automatically updating the contents of the <textarea />.
As quoted from this page:
Please note that the replaced <textarea> element is updated automatically by CKEditor straight before submission. If you need to access the <textarea> value programatically with JavaScript (e.g. in the onsubmit handler to validate the entered data), there is a chance that the <textarea> element would still store the original data. In order to update the value of replaced <textarea> use the editor.updateElement() method.
You'll need to call:
CKEDITOR.instances.subject.updateElement();
after e.preventDefault();
| 6d82bdc68a0813265728acaa98b580c17c38dd8c720826d3c9537b25053b33ea | ['12d96ba9d55f425db601862a11e92e56'] | I did some tests.
The two longest tasks (no surprises here), were the fetching of URLs, and decoding of JSON.
To optimise it further, you'd probably need to share some usage patterns with us.
But briefly, URLs could be fetched concurrently or even as a batch job somewhere else.
For JSON decoding, well, that's a bit more tricky. I notice that the JSON returned is formatted quite nicely (visually). Perhaps instead of decoding the JSON, you could jump to the line number and read the value directly (haven't tested timing for this yet).
Or, again depending on usage patterns, if the batch job could re-format the data and store it somewhere for retrieval later, there could be some time savings.
|
13b477989f570296c099b0a8d601236b6c394138c136dd79a714f2402d0aba25 | ['12f0dd7337214afc9bb05ee1ab01f452'] | I import an Angular Element in an Angular 6 project. The @Input works well but the @Output doesn't. When I try to receive the message, I get the return {"isTrusted":false}
angular element html:
<button (click)="handleClick()">{{show}}</button>
angular element component:
@Input() show = '';
@Output() action = new EventEmitter<string>();
handleClick() {
this.action.emit('test');
}
project html declaring element:
<menu-test show="John" (action)="receiveMessage($event)"></menu-test>
project component:
receiveMessage($event) {
// here $event returns {"isTrusted":false}
}
| 2714da905b8e112dd724351debf3f6d90f97f03c4af47c5a14d99188b05bd5b7 | ['12f0dd7337214afc9bb05ee1ab01f452'] | (Angular 6) My problem:
Route A has canDeactivate, when I try to go to Route B I need to confirm.
Route B has canActivate and I dont have authority to access.
Then redirect to Route C but in this moment canDeactivate from Route A asks again for confirmation.
How to skip this second confirmation?
export interface PendingChangesComponent {
canDeactivate: () => boolean | Observable<boolean>;
}
@Injectable()
export class PendingChangesGuard implements
CanDeactivate<PendingChangesComponent>, OnInit, OnChanges {
constructor(private confirmationservice: ConfirmationService,
private translate: TranslateService) {
console.log('construtor d');
}
ngOnInit() {
console.log('init d');
}
ngOnChanges() {
console.log('on changes d');
}
canDeactivate(component: PendingChangesComponent): boolean | Observable<boolean> {
debugger
if (component.canDeactivate()) {
return true;
}
return Observable.create((observer: Observer<boolean>) => {
this.confirmationservice.confirm({
message: this.translate.instant('can.deactivate'),
accept: () => {
observer.next(true);
observer.complete();
},
reject: () => {
observer.next(false);
observer.complete();
}
});
});
}
}
|
04ece04e244b515ff14fd9e76a7de998f5f4ac3631c7a5a091af8b0406c97de6 | ['12f3c160aab341d7966e5087ecfad206'] | I can't comment yet, but here's a couple possibilities:
Edit script1.ps1
You don't mention if you need the first set of results. If you don't, just simply delete or comment out this line $response| ConvertTo-Json -depth 100 from the Renew_Token function.
Parse the output of script1.ps1 as json
You're passing the output of script1 to script2 as plain text. Simply change $second_response = & ".\Script1.ps1" to $second_response = & ".\Script1.ps1" | ConvertFrom-Json. Then when you want to access the second response, use $second_response[1] as both sets of JSON get added to a custom PS Object and can be accessed individually like you would an array.
| 99fcf843abdb8d828b13c1bf7ffbdf03798e8d3558512be6c19ed944e1172ae8 | ['12f3c160aab341d7966e5087ecfad206'] | I became a member of a GitHub organization for an application, and was working to enable automated builds on Docker Hub. The main application code is in a separate repository from the dockerfile, and other related files.
Ideally, I would like the image to be built when commits are pushed to the main application repository, using the dockerfile from the other repository so that everything is automated, without having to push changes to the dockerfile repo to build new images.
My question is if this is even possible. It doesn't appear to be, at least without setting up a really complicated workflow.
|
6f5fce065acbcb9978e8fc231b8c043a344d13c352b1bfc6b42f99dfc2781634 | ['12fbaf0254964339b955d10b4103fbab'] | Someone shared an interesting article about Canary build.
Canary Deployments are where you roll out the new version of your service while keeping the older one alive. Some customers will be routed to the new version while others will be routed to your existing version.
https://stackify.com/canary-deployments/
| b4a21fbf574150b870ed0fffaf93939de409f265d9ce13c7dc8d396678621d02 | ['12fbaf0254964339b955d10b4103fbab'] | I have the following code:
<TextField
InputProps={{
readOnly: true
}}
value={5000}
multiline={false}
autoFocus
/>
I want the keyboard to not popup when the user taps on the InputField. The cursor should blink as it is. The readOnly prop only makes it uneditable but the keyboard still pops up in mobile browsers.
|
4e8ee01b9c1bd0c487c3ce45738ad81d823bac180a4e37356b48f63566d5f569 | ['13060d701559474f8242113febad263e'] | Using path.join to build a URL is not a good idea since the path separators will differ between platforms, on Windows you'll end up with something like file://\dirname\index.html#\message\chat_id\child-window, whereas on Mac/Linux you'll get file://dirname/index.html#/message/chat_id/child-window. What you should do instead is something like:
url.format({
protocol: 'file',
pathname: `${__dirname}/index.html#/message/${chat_id}/child-window`
})`
| 2d84424e447293b09b93bda9c208535cc4f0700a9d511c74525ec8af643724b1 | ['13060d701559474f8242113febad263e'] | The BrowserWindow module is only available in the main process, the ipcRenderer module is only available in the renderer process, so regardless of which process you run this code in it ain't gonna work. I'm guessing since ipcRenderer is not available you're attempting to run this code in the main process.
|
0f2eab172ad5ef84dd13c5c5936d06cfb607dae2a1fd073153bfb38bbed397b4 | ['131edd274efd439797d215b868b4889e'] | I want to get the cover photo from audio file
the application work for android 10+ and android 9 but in android 10 it give me an error
//this is my code
private byte[] getAlbumArt(String uri) {
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(uri);
byte[] art = retriever.getEmbeddedPicture();
retriever.release();
return art;
}
error :
Unknown bits set in runtime_flags: 0x8000
2020-09-18 22:19:53.826 <PHONE_NUMBER>/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.MusicPlayer.musicplayervip, PID: 23193
java.lang.IllegalArgumentException
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:77)
help, please
| e7c72ea41840859adf512d14ce28cdab002a2b1800900a1a5540ddff6c688777 | ['131edd274efd439797d215b868b4889e'] | i'm trying to make an api to return a json with symfony 4
i create a entity and it's work fine but it do not convert data for database to json
so the Serializer from "Symfony\Component\Serializer\Serializer" give me error
serialization for the format json is not supported
so i tried the Jms_Serializer but in the official website they work with a old version of symfony
i installed the bundle with
composer require jms/serializer-bundle
this the code in controller
class ProduitsController extends AbstractController
{
/**
* @Route("/api/produits/cuisine")
*/
public function index()
{
$dc = $this->getDoctrine();
$Produits=$dc->getRepository(Article<IP_ADDRESS>class)->findAll();
$data= $this->get('jms_serializer')->serialize($Produits,'json');
return new JsonResponse($data);
}
}
i got this error : ServiceNotFoundException
Service "jms_serializer" not found: even though it exists in the app's
container, the container inside "App\Controller\ProduitsController" is a
smaller service locator that only knows about the "doctrine", "form.factory",
"http_kernel", "parameter_bag", "request_stack", "router",
"security.authorization_checker", "security.csrf.token_manager",
"security.token_storage", "serializer", "session" and "twig" services. Try
using dependency injection instead
a simple json_encode() to the result
give me a empty json
|
977224d5e3488fec905280967d2ef3180a4ce98f57f313624838b48dcedf5055 | ['13268209b4ed4774a5f5ef5217f6b800'] | The experiment on kxy has not been done yet, to my knowledge, but there are several (recent) experiments which are closely related and probe the heat flow through the edge channels of a Hall bar in the fractional regime: http://www.nature.com/nature/journal/v466/n7306/abs/nature09277.html or http://www.nature.com/nphys/journal/v8/n9/full/nphys2384.html?WT.ec_id=NPHYS-201209 are two examples. Measuring temperatures on a 2D sheet of material embedded in a substrate (as in GaAs/GaAlAs heterostructures) is a challenging task, and the signals for kxy are usually smaller than the ones for "simple" kxx measurements.
| 655ca43b1268574a6239db267d2363be1865d8c810e8b6e9723373a4646b17ef | ['13268209b4ed4774a5f5ef5217f6b800'] | I would like to install Apps from the MS Store to my on-premise SharePoint 2013 installation. I do not want them connecting to the outside world once installed. However the terms and conditions always seem to say that the app "may" connect to the internet without warning me. How can I be sure that any App I install truly is stand-alone. Or do all Apps "phone home"? Thanks.
|
4eaab7e459966651851f6181a0ca0e02d8b9f234b4e295ccd7804ffa2e7ea651 | ['132b4c58c52b4669859b9a5b904fd27c'] | We have two types of components we develop in VB6. Latent common components that we reference across projects and volatile application components that we build daily. The common components are packed as merge modules (using WiX) while the application components map to components of the application setup. This is a snippet of our main .wxs file
<Component Id="MyFile15.ocx" Guid="YOURGUID-BCB7-451C-B07D-D205AEAE1EB9" >
<File Id="MyFile15.ocx" Name="MyFile15.ocx" LongName="MyFile15.ocx" KeyPath="yes" src="$(var.SrcAppBinnPath)\MyFile15.ocx" DiskId="1" />
<?include Registry_MyFile15.wxi ?>
</Component>
We are still using WiX 2.0 so we are using a tweaked version of tallow to produce the registry .wxi files for all the ActiveX DLLs/OCXs/EXEs we are building daily. Instead of com/typelib entries we are shipping all of the COM registration as direct registry table entries. We are targeting legacy Windows Installer 2.0 because we dont need any of the newer features.
We are using custom actions (VC6 DLLs) for some special cases -- MSDE setup, database patching, DCOM download/setup. We are using a Platform SDK bootstrapper that downloads instmsiX.exe and prepares Windows Installer on virgin systems (mostly 9x and NTs). We are using 7-zip self-extractor to unpack bootstrapper and msi on client machine. In some cases we are using UPX --lzma on executables but these do not scale very well on Terminal Servers where the non-packed versions are reused across sessions.
Lately we've been migrating our clients to portable builds using reg-free COM. We are using our in-house UMMM tool to produce registration-free COM manifests. SxS COM has limitations (no DCOM, no ActiveX EXEs) but allows us to change builds while the application is live -- no reinstall downtime.
| 3d4ef9908ecaeae8c66b6811d305e5049100a93613d62cf61efc2f96470bf5d5 | ['132b4c58c52b4669859b9a5b904fd27c'] | Property Let is more versatile than Property Set. The latter is restricted to object references only. If you have this property in a class
Private m_oPicture As StdPicture
Property Get Picture() As StdPicture
Set Picture = m_oPicture
End Property
Property Set Picture(oValue As StdPicture)
Set m_oPicture = oValue
End Property
Property Let Picture(oValue As StdPicture)
Set m_oPicture = oValue
End Property
You can call Property Set Picture with
Set oObj.Picture = Me.Picture
You can call Property Let Picture with both
Let oObj.Picture = Me.Picture
oObj.Picture = Me.Picture
Implementing Property Set is what other developers expect for properties that are object references but sometimes even Microsoft provide only Property Let for reference properties, leading to the unusual syntax oObj.Object = MyObject without Set statement. In this case using Set statement leads to compile-time or run-time error because there is no Property Set Object implemented on oObj class.
I tend to implement both Property Set and Property Let for properties of standard types -- fonts, pictures, etc -- but with different semantics. Usually on Property Let I tend to perform "deep copy", i.e. cloning the StdFont instead of just holding a reference to the original object.
|
78dbb80f5c00d14c0209664bcf594c8ffad50f288e2c3a52fcca6acd30539ae0 | ['132c0c0f28964b11be373b397d832b8e'] | If you don't want to mess up with your ApplicationController as <PERSON> indicated, you can just add few addtional CSS clases, accordingly:
in app/assets/stylesheets/custom.scss:
/*flash*/
.alert-error {
background-color: #f2dede;
border-color: #eed3d7;
color: #b94a48;
text-align: left;
}
.alert-alert {
background-color: #f2dede;
border-color: #eed3d7;
color: #b94a48;
text-align: left;
}
.alert-success {
background-color: #dff0d8;
border-color: #d6e9c6;
color: #468847;
text-align: left;
}
.alert-notice {
background-color: #dff0d8;
border-color: #d6e9c6;
color: #468847;
text-align: left;
}
Step by step tutorial, how to approach flash messages with devise and bootstrap, you can find here
| 9fb682207820e0313147c8d32ca0abd0d71710ea581246dd21897204a6659dff | ['132c0c0f28964b11be373b397d832b8e'] | As of mid 2017, we have one more, in my opinion better opprotunity to integrate devise in our Rspecs. We are able to utilize stub authentization with helper method sign in defined as described below:
module ControllerHelpers
def sign_in(user = double('user'))
if user.nil?
allow(request.env['warden']).to receive(:authenticate!).and_throw(:warden, {:scope => :user})
allow(controller).to receive(:current_user).and_return(nil)
else
allow(request.env['warden']).to receive(:authenticate!).and_return(user)
allow(controller).to receive(:current_user).and_return(user)
end
end
end
You should also append in spec_helper.rb or rails_helper.rb reference to newly created file:
require 'support/controller_helpers'
...
RSpec.configure do |config|
...
config.include Devise<IP_ADDRESS>TestHelpers, :type => :controller
config.include ControllerHelpers, :type => :controller
...
end
Then in method just place at the beginning of the method body sign_in for context for authenticated user and you are all set. Up to date details can be found in devise docs here
|
a76bd58a362d4b9707ca781587cc7b4b869ee09aa0cdae51a49d7db966c39e71 | ['132dd31db13f45ca8632b36c85156a90'] | So, I tried this out locally.
I have two files, both in same folder:
test.html
test.css
HTML:
<!DOCTYPE html>
<html>
<head lang="de">
<title>Example</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="./test.css">
</head>
<body>
<div class="test_style">
</div>
</body>
</html>
CSS:
.test_style {
width: 50px;
height: 50px;
background: red;
opacity: .3;
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.test_style:hover {
opacity: 1;
-webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
transition: opacity 0.3s, transform 0.3s;
-webkit-transform: scale(1.6);
-ms-transform: scale(1.6);
transform: scale(1.6);
}
It is working like a charm. Don't know what you are doing wrong, but it is working!
| 268b9e9a7f1f8685a8715ec3b1af46077a77dc790ad08044ff9c719ded19284a | ['132dd31db13f45ca8632b36c85156a90'] | I would like to have a line item that delivers 5 banners and rotates through them. So far, so good. That is easy.
Now I do not want to annoy the user and would like to have some sort of advertisement pause. Like every 1 of 5 times, NO AD is displayed.
I tried creating an empty creative and call collapseEmptyDivs(true), but I cannot create an empty creative. Does anyone have an idea on how to create a blank/empty creative in DFP
|
cdf9e9369dc0d6ed23d8dd363c9929c8aea17bc3d6957e2d3c6d72606e38ca84 | ['13353a0b31d040c89a689fafb28906e7'] | I can't get Safari on ipad to recognize the cookies I send.
It works on OSX Safari, on iPad Chrome but just not iPad Safari.
I have set Accept Cookies to "Always" in Safari's iPad settings to no avail.
I am using GWT and can see Web Inspector that the response header of contains Set-Cookie as usual with the value I expect(1). It does not get set by Safari though.
If this were an iFrame issue, doesn't setting Accept Cookies to "Always" deal with that?
What can I do to work around this?
(1) nick_name=me;Path=/;Expires=Mon, 11-Feb-13 02:32:22 GMT, xzy=25002, promoid=7b54c1ae-e76a-4f65-aebd-c8496132672a;Path=/;Expires=Mon, 11-Feb-13 02:32:22 GMT, rememberMe=25002:58322d58-b1b8-4f15-be68-11b610cf8c86;Path=/;Expires=Mon, 11-Feb-13 02:32:22 GMT
| 8619a664a2726025235b9427664c5d8cc338e0ab4d7559c8b8fe3460aa8ac929 | ['13353a0b31d040c89a689fafb28906e7'] | I have an entity with an embedded entity.
@Entity @Cache public class UserOFY implements Serializable {
@Id @Index private Long id;
@Unindex public LessonScheduleOFY lessonSchedule;
}
@Entity public class LessonScheduleOFY implements IsSerializable, Serializable {
@Id @Index private Long id;
}
In Objectify V4.1.3, if I tag the LessonScheduleOFY with @Embed, it works fine.
@Embed @Entity public class LessonScheduleOFY implements IsSerializable, Serializable {
@Id @Index private Long id;
}
When I try to upgrade to V5, I run ofy().factory().setSaveWithNewEmbedFormat(true);
and then load my UserOFY entities, and save the LessonScheduleOFY entities as well as the UserOFY entities.
However, when I change to V5 (removing V4 from my classpath) and remove the @Embed tag, I get an error:
Caused by: com.googlecode.objectify.LoadException: Error loading
UserOFY(19001): At path 'lessonSchedule': Expected property value but
found: {reviewing={true}, index={1}, completedLessons={}, timesAllCompleted={0}, ongoingReviewSchedule={}, revScheduleQueueResetSize={4}, ongoingReviewStats={}, id={19001}, reviewScheduleQueue={},
reviewSchedule={}, lessonSchedule=[{911}, {912},
{2676}, {2681}, {2696}, {2699}, {2700}, {12001}, {14001}, {17001},
{4644337115725824}, {4785074604081152}, {5207287069147136},
{5348024557502464}, {5910974510923776}, {6192449487634432},
{6333186975989760}, {5488762045857792}, {6614661952700416}],
nextScheduledLesson={912}, completedLessonDate={},
READY_TO_ADVANCE={true}}
Questions:
1) can things like @com.googlecode.objectify.annotation.Serialize private HashMap<Long, Long> completedLessonDate; not be used in an embedded class in V5?
2) If I can't find a way to use LessonScheduleOFY as an embedded class anymore, how can I migrate it to it's own Entity? Use Ref<?>s and @Load? to form a Relationship?
|
78c7f444c2ce8fbd1de65ffeb0b3e94c1773b9762cfecb2d458a2f75cf39b9a4 | ['133e62051d994e7a81c166f353d1ea29'] | I'm trying to analyze each element that has been placed into my array from a txt file of chars for a maze game. The array must be checked so we can determine where in the maze the walls are, players are, ghosts, keys and ladders, entrance, etc. So I need to check for certain characters (such as #, P, K, D, G, E). I'm not sure how to set this up though?
Here are the functions to get the Floor files and place each character in the array called tiles.
const int ROWS = 20;
void Floor<IP_ADDRESS>Read (const char * filename)
{
size_t row = 0;
ifstream input(filename);
while (row < ROWS && input >> tiles[row++]);
}
void Game<IP_ADDRESS>readFloors()
{
m_floor[0].Read("FloorA.txt");
m_floor[1].Read("FloorB.txt");
m_floor[2].Read("FloorC.txt");
}
Then here is what one of the floors looks like with each char:
##############################
# K #
# ############## ### ### # #
# K # # #C# #K# # #
# ######### # A # # # # # # #
# K # # # #
# ############D#####D####### #
# #
# C G C #
# #
# ######D##############D#### #
# # C #K# # #
# #### ######## # # # #
# #K # # ### # # #### #
# # ## # #### # # # # # #
E # ## # # ### # # #### # #
# # # #K D # #
# #D#### ################### #
# K #
##############################
header file with the two classes used with the functions above:
class Floor {
char tiles[20][30];
void printToScreen();
public:
Floor();
void Read (const char * filename);
};
class Game {
private:
Floor m_floor [3];
vector<Character> characters;
public:
void readFloors();
};
Looked for similar questions, but most aren't analyzing many different options. Thanks for the help!
| f2f3f2d57e695f87ca77a8566159ca9df67d004f169d15e43d93133f5b9bd856 | ['133e62051d994e7a81c166f353d1ea29'] | I'm simply trying to check if the card is high, so the hand can be evaluated. Also, similar for checking pairs, straight, etc. But right now, these are recursive, so I'm not sure how to check the rank. Thanks for help!!
functions.cpp
int Hand::find_high_rank() const
{
int high_rank = 0;
for (unsigned i = 0; i<m_hand.size(); i++)
high_rank = max(high_rank, m_hand[i].get_rank());
return high_rank;
}
bool Hand::is_straight()
{
if (! (is_straight()))
return false;
m_high_rank = find_high_rank();
return true;
}
//these functions are similar for flush, two pair, full house, etc.
header file
class <PERSON>{
public:
Card(int value, char suit) : value(value), suit(suit) {}
Card ();
private:
int value;
char suit;
};
class <PERSON> {
public:
void createDeck();
void shuffleDeck();
Card Draw();
Deck();
void Print() const;
private:
vector<Card> deck;
};
enum hand_kind
{ HIGH_CARD,
ONE_PAIR,
TWO_PAIR,
THREE_OF_A_KIND,
STRAIGHT,
FLUSH,
FULL_HOUSE,
FOUR_OF_A_KIND,
STRAIGHT_FLUSH,
};
class Hand {
vector<Card> m_hand;
hand_kind m_kind;
int m_high_rank;
bool is_straight_flush ();
bool is_four();
bool is_full_house();
bool is_flush ();
bool is_straight ();
bool is_three();
bool is_same_rank (int rank);
bool is_two_pair ();
int find_high_rank () const;
int how_many (int rank) const;
public:
Hand ();
void add_card_to_hand (const <PERSON> & card);
hand_kind classify_hand ();
bool operator < (const <PERSON> & rhs) const;
friend ostream & operator << (ostream & os, const <PERSON><IP_ADDRESS>find_high_rank() const
{
int high_rank = 0;
for (unsigned i = 0; i<m_hand.size(); i++)
high_rank = max(high_rank, m_hand[i].get_rank());
return high_rank;
}
bool Hand<IP_ADDRESS>is_straight()
{
if (! (is_straight()))
return false;
m_high_rank = find_high_rank();
return true;
}
//these functions are similar for flush, two pair, full house, etc.
header file
class Card{
public:
Card(int value, char suit) : value(value), suit(suit) {}
Card ();
private:
int value;
char suit;
};
class Deck {
public:
void createDeck();
void shuffleDeck();
Card Draw();
Deck();
void Print() const;
private:
vector<Card> deck;
};
enum hand_kind
{ HIGH_CARD,
ONE_PAIR,
TWO_PAIR,
THREE_OF_A_KIND,
STRAIGHT,
FLUSH,
FULL_HOUSE,
FOUR_OF_A_KIND,
STRAIGHT_FLUSH,
};
class Hand {
vector<Card> m_hand;
hand_kind m_kind;
int m_high_rank;
bool is_straight_flush ();
bool is_four();
bool is_full_house();
bool is_flush ();
bool is_straight ();
bool is_three();
bool is_same_rank (int rank);
bool is_two_pair ();
int find_high_rank () const;
int how_many (int rank) const;
public:
Hand ();
void add_card_to_hand (const Card & card);
hand_kind classify_hand ();
bool operator < (const Hand & rhs) const;
friend ostream & operator << (ostream & os, const Hand & hand);
};
Also here is where the deck is setup:
void Deck<IP_ADDRESS>createDeck() {
deck.clear();
static const char suits[] = {'C','D','H','S'};
for (int suit=0; suit < 4; suit++)
for (int val=1; val <=13; val++)
deck.push_back(Card(val,suits[suit]));
}
|
6e150c516487940a949720c4e263c0ede0a57819555712001b2aa3fbc24f0281 | ['1349a2f91a514cfb9db16ead563d7ec2'] | I am trying to add or remove applications from Ubuntu Software Center but ending up with the following error
Software can't be installed or removed because the authentication service is
not available.
(org.freedesktop.PolicyKit.Error.Failed: ('system-bus-name', {'name': ':1.74'}):
org.debian.apt.install-or-remove-packages
apt-get install or apt-get remove works good from command line, but doesn't in USC
Any help ???
| f54b344bf4e6f193a316db682fbccc35253812c2bddbdfa1427b29d6f55f06d9 | ['1349a2f91a514cfb9db16ead563d7ec2'] | The formula I'm trying to write is relatively simple. I'm looking for a number that is a certain percent between two numbers, i.e:
6 is 50% between 2 and 10.
8 is 75% between 2 and 10.
Subtracting the two numbers, then multiplying by the percentage, then summing the smaller of the two numbers gets me the correct answer. However, I can't use subtraction because I'm working with coordinates and subtraction has too many quirks.
Is there any other way to achieve this result?
|
9570c52fda91bcbab215672784f9d232adcfb874375e8cbe34dcdb2290c5636a | ['134e85b0bdba4932b4469394e5ba4642'] | I am having a hard time trying to setup checkbox filters for the following code, which is reduced because the whole thing is massive. Everything works, except these checkbox filters. The markers are all being pulled from a php generated xml file like in Googles example.
I think it's because of the marker file being a object HTMLCollection and I'm getting markers[i].setVisible is not a function I've tried many things but it's beyond my knowledge. I'd really appreciate some help with this one, the last step for me.
Example XML data
<marker name="Some Shop" id="2" type="shops" description="Great shop" street_number="350" street_name="Main Road" suburb="Lovely ville" lat="-23.9544011" lng="156.1895873" from="2014-01-01 01:00:00" to="2015-10-01 01:00:00"/>
Javascript
downloadUrl("xml_generator.php", function (data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var type = markers[i].getAttribute("type");
var marker = new google.maps.Marker({
map: map,
position: point,
icon: icon.icon
});
bindInfoBox(marker, map, ib, myOptions);
}
$(document).ready(function(){
// == shows all markers of a particular category, and ensures the checkbox is checked ==
function show(category) {
window.alert("Show " + category + markers);
for (var i=0; i<markers.length; i++) {
if (markers[i].getAttribute("type") == category) {
markers[i].setVisible(true);
}
}
}
// == hides all markers of a particular category, and ensures the checkbox is cleared ==
function hide(category) {
window.alert("Hide " + category);
for (var i=0; i<markers.length; i++) {
if (markers[i].getAttribute("type") == category) {
markers[i].setVisible(true);
}
}
}
$(".toggle").click(function(){
var cat = $(this).attr("value");
// If checked
if ($(this).is(":checked"))
{
show(cat);
} else
{
hide(cat);
}
});
});
});
Then the HTML checkbox
<input value="shops" class="toggle" type="checkbox" checked="yes">
| 4ce170129cb423159e8b9b0a6ef7ab3e486c7157f73d620119d7d7acb5242ab7 | ['134e85b0bdba4932b4469394e5ba4642'] | Thanks to <PERSON> and much fiddling the following code fixed all my problems
array('v' => 'Date(' . date('Y,n,d,H,i,s', strtotime($res['TIME'])).')'),
array('v' => floatval($res['TEMP'])),
array('v' => floatval($res['HUMID']))
I found a streamlined way to convert MySQL Datetime to javascript using the PHP Date function and although the Temp and Humid values were stored as Decimals in MySQL, javascript didn't like it so I used floatval to make those work also. Now I have a happy, working Annotation Chart!
|
af7c64baae3a27514aa1010735253a76b6891b1cc7623ca6fc06f4c844d7b11b | ['136c57b652ae4e72b17fb360b9289996'] | Try to do it like this:
public static int [] quickSort (int [] array, int first, int last){
int pivot = array[last/2];
while (!isSorted(array)) {
int left = first;
int right = last;
while (true) {
while (array[left] < pivot && left < last) {
left++;
}
while (array[right] >= pivot && right > first) {
right--;
}
if (array[left] > array[right]) {
swap(array, left, right);
System.out.println(Arrays.toString(array));
}
if (left >= right)
break;
if (right - left == 1)
break;
}
}
return array;
}
this method checks if the array is sorted or not yet:
private static boolean isSorted(int [] array){
for (int i = 0; i < array.length; i++){
if (array[i] > array[i+1])
return false;
}
return true;
}
| 5257d0097c2b58559d5945b7d096ea6ffc4de802eda8dd5e7a4192ec7269b222 | ['136c57b652ae4e72b17fb360b9289996'] | Consider using callbacks in your code to achieve what you want.
letting the program wait for a thread is not good (generally) and using asynchronous threads will not achieve what you want, because you won't get the results from the thread by the time your function is called.
So, by using callbacks, you will ensure that everything will work the way you want and methods will only be called when your parameters are ready.
Have a look at this and this answers.
|
46469639d63d231216232e75b09821dc2a7c43a4524bdf321617faf8bc8fb1e9 | ['13727bc0d87b4b0fad7ba8436f4cb55c'] | Hello <PERSON>, I've checked your code examples:
According to your code I saw that you're trying to load a file from a string.
This puzzles me a bit because I immediately received an error. Do you have enabled error_reporting and error_log and checked your logs? Anyway you only need to put the string into the right variable and everything else works. Below you'll find my changes to your code.
Before:
$fileatt = $pdf->Output('Profile.pdf', 'S'); // S = Means return the PDF as string
// ... code ...
$pdf_content = file_get_contents($fileatt);
// .. code
$mail->AddStringAttachment($pdf_content, "Prodile.pdf", "base64", "application/pdf");
After:
$pdf_content = $pdf->Output('Profile.pdf', 'S');
// ... code ...
$mail->AddStringAttachment($pdf_content, "Prodile.pdf", "base64", "application/pdf");
I've just tested your script with SES credentials and a custom PDF and also a previously generated PDF.
Let me know if this helps.
| 37eb52d3698bd43bccaa2a8c2257273ed1ba0a3d7207d60109a1920dae8dccc8 | ['13727bc0d87b4b0fad7ba8436f4cb55c'] | the mentioned TXT record which starts with "ca3-" is a CloudFlare internal record which they use for TLS validation. I guess since they need it to make their services available to you, there is no chance to delete it.
There is several posts inside the CloudFlare community about it: https://community.cloudflare.com/t/unable-to-see-and-remove-txt-record/44179/5
|
15578eefd2bca84a731ae88421bb785e1e2bf8ed9f291efa4c72c3eeaec467f6 | ['1377a9bcfbae41ff9d4cb7b14e249bc4'] | Currently, I'm making android and ios application with ionic..
I get difficulties when I want to access external API..
The thing is my code works just fine and smooth when I run on android device, but when I run on ios device, error "Bad Request 400 Missing request parameter" appear when I want to access API for login. I pass loginData that contains email, password, and device token into loginService and bad request error appear and it only happens on ios, it doesn't happen with android.
Lets's say this is my API_PATH: http://128.XXX.XXX.XX:3002/ and below is my loginService:
app.factory('loginService', function($rootScope){
return {
login: function(data){
return $.ajax({
url: constant.API_PATH+'user/authenticate',
method: 'POST',
data: data
});
}
}
}
and this is code at my loginController:
app.controller('loginController', function($rootScope, $scope){
$scope.loginData = {
email: '',
password: '',
remember: true,
token: ''
}
$scope.doLogin = function(){
$scope.loginData.token = $rootScope.deviceToken;
if($scope.loginData.email != "" && $scope.loginData.password != ""){
loginService.login($scope.loginData)
.then(function(response){
console.log(response);
})
.catch(function(err){
console.log(err);
});
}
}
});
I've tried to add whitelist, cordova plugin add cordova-plugin-whitelist
and put this
<allow-navigation href="http://*/*" />
and this
<platform name="ios">
<config-file platform="ios" target="*-Info.plist" parent="NSAppTransportSecurity">
<dict>
<key>NSAllowsArbitraryLoads</key><true/>
</dict>
</config-file>
on my config.xml, I also add this
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
on my index.html, but that doesn't help at all.
Does anyone face the same issue with me?
| 0e30645908cfcef528f1ca322a8a2602ced516448239c40ce37a4bdabcb67453 | ['1377a9bcfbae41ff9d4cb7b14e249bc4'] | I'm still newbie with angular js
I get difficulties to change profile picture
<img src="images/avatar.jpg" ng-click="changeProfilePicture()">
How can I change my profile picture using ng-click,
all i know is when we click then there will be a pop up, then we choose our image, then the image will be converted to base 64 string to be saved in database, then the base 64 string will be converted to image again, then the profile picture will be changed.
How to do that?
|
6e18a137b6beb58c764229f8f908b20634d2a97786d90b72c5f7ac3a2fce3258 | ['1378391846e04c96b165725366b26ff0'] | I want to display a photograph in my THREE.js scene. The size of the geometry is based on on the window and the photograph, which added as Texture should cover the geometry. Basically what I want is background-size: cover in CSS, but in THREE.js, so that I can add some more transformations to this geometry.
This is my code so far:
const txture = this.loader.load('/site/themes/pride/img/home_1.jpg');
const material = new MeshBasicMaterial({
map: txture,
transparent: true,
opacity: 1,
});
const geom = new BoxBufferGeometry( window.innerWidth, window.innerHeight, 0.0001 );
const plane = new Mesh(geom, material);
plane.overdraw = true;
plane.position.set(0,0,0);
Is this even possible or should I do it in a complete other way?
| 78e9082d973194e80b33b4ddaa43f8a70da7e0ef47bb37d94c809ae294632d52 | ['1378391846e04c96b165725366b26ff0'] | I'm trying to add less-loader to my Laravel Mix configuration because some of my imported modules need it.
I've tried the following way, but when starting the dev environment, it looks like my less file is processed twice:
ERROR in ./node_modules/antd/es/style/index.less (./node_modules/css-loader!./node_modules/postcss-loader/src??ref--12-2!./node_modules/less-loader/dist/cjs.js!./node_modules/style-loader!./node_modules/css-loader!./node_modules/less-loader/dist/cjs.js??ref--15-2!./node_modules/antd/es/style/index.less)
Module build failed (from ./node_modules/less-loader/dist/cjs.js):
var content = require("!!../../../css-loader/index.js!../../../less-loader/dist/cjs.js??ref--15-2!./index.less");
Unrecognised input
Does anybody know where the issue is or what I'm doing wrong?
mix.reactTypeScript('resources/js/app.tsx', 'public/js')
.less('resources/css/app.css', 'public/css')
.copyDirectory('resources/img', 'public/img')
.webpackConfig({
module: {
rules: [
{
test: /\.less$/,
loader: [
'style-loader',
'css-loader',
{
loader: 'less-loader',
options: {
javascriptEnabled: true
}
}
]
}
]}
})
.version();
|
654cb056991bbb6376c6827658ed6c7326aaa4a65c17c54d07eb222c99015ac6 | ['1390511dc6ad4e519279f35e1af7ce22'] | I am trying install ionic with npm install -g cordova ionic on my notebook with windows 7 x64, but no matter what I do returned an error ECONNRESET. I tried using various solutions here the stackoverflow but could not.
I'm trying:
npm config set registry https://registry.npmjs.org/. also I uninstalled it x64 and install the x84, nothing works.
npm-degub. *This very large, the only place I could put in was jsFiddle.
C:\Users\User>node -v
v4.2.2
C:\Users\User>npm -v
2.14.7
| 727b51106d4d059b83596fe65329a7c1e1e24d6c4b5683ac8841eaae6bb00f2d | ['1390511dc6ad4e519279f35e1af7ce22'] | I'm try to use tooltip in a element inside a iframe(generated by htmleditor component).
This is i'm trying:
Ext.tip.QuickTipManager.init();
Ext.create('Ext.form.HtmlEditor', {
width: 750,
height: 250,
renderTo: Ext.getBody(),
listeners: {
afterrender: function () {
this.getToolbar().add([{
xtype: "combobox",
flex: 1,
displayField: "name",
valueField: "value",
store: {
data: [{
name: "#NAME# (User's name)",
value: "#NAME#"
}]
}
}, {
xtype: "button",
text: "Add",
handler: function () {
var value = this.prev().getValue();
var htmlEditor = this.up("htmleditor");
if (value) {
var id = Ext.id();
value = "<span id=\"" + id + "\" style=\"cursor:pointer;\">" + value + "</span>";
htmlEditor.insertAtCursor(value);
var doc = htmlEditor.getDoc();
var elSpan = doc.getElementById(id);
var tTip = Ext.create("Ext.tip.ToolTip", {
html: "User's name tooltip.",
shadow: false,
scope: doc
});
elSpan.addEventListener("mouseover", function () {
tTip.showAt(elSpan.offsetLeft, elSpan.offsetTop)
});
elSpan.addEventListener("mouseleave", function () {
tTip.hide();
});
}
}
}])
}
}
});
But, when the component is shown, it appear in wrong position. See on the fiddle.
Sencha Fiddle: https://fiddle.sencha.com/#view/editor&fiddle/1vj4
|
1793169f821456eb27104d0921239e46f4ecf4f001e27611a484b7d148ef66c4 | ['13a5aacb1feb4fad9b19adb8c4547326'] | There's no way, currently, to rotate the vertical axis title, sorry.
As far as transforming the titles in the horizontal axis, you're in an edge case whether your graph is continuous or discrete. If your data is discrete, you can use the slantedText option. So, to summarize, make sure you have discrete data, and set the above option.
| d5399083a20b3ec903f5a30df45365a5a42d71c8e73f702c263049801633dd79 | ['13a5aacb1feb4fad9b19adb8c4547326'] | I assume you want the animation the first time you draw the google chart. Google charts really only support animation well when you're changing the values. Try the following:
var data = google.visualization.arrayToDataTable([
['Yıl', 'Toplam Satış Miktarı (Ton)'],
['2007', 153888],
['2008', 37634],
['2009', 21835],
['2010', 80929],
['2011', 137699],
['2012', 313837],
['2013', 1050000], ]);
var options = {
title: '<PERSON>',
'width': 850,
animation: {
duration: 1000,
easing: 'out'
},
'height': 400,
hAxis: {
title: '<PERSON>',
titleTextStyle: {
color: 'red'
}
},
vAxis: {minValue:0, maxValue:1200000}
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
var data1 = google.visualization.arrayToDataTable([
['Yıl', 'Toplam Satış Miktarı (Ton)'],
['2007', 0],
['2008', 0],
['2009', 0],
['2010', 0],
['2011', 0],
['2012', 0],
['2013', 0], ]);
chart.draw(data1, options);
chart.draw(data, options);
You can modify the code to be a bit more readable, but I was trying to be explicit.
|
75014d34a6a9f719e3fa9f194cf8ed6dd64ca4b1b317b8bf3e16fd035e49c6a6 | ['13a9cf20637044459fe2826818dab3e8'] | I see this is a pretty old question, but I think there is an easier way to accomplish background scrolling. Just use the Sprite class. Here is a snippet I use for layered background images that scroll from right to left.
public class LevelLayer
{
public float speedScalar = 1;
private List<Sprite> backgroundSprites = new ArrayList<Sprite>();
public LevelLayer()
{
}
public void addSpriteLayer(Texture texture, float startingPointX, float y, int repeats)
{
for (int k = 0; k < repeats; k++)
{
Sprite s = new Sprite(texture);
s.setX(startingPointX + (k*texture.getWidth()));
s.setY(y);
backgroundSprites.add(s);
}
}
public void render(SpriteBatch spriteBatch, float speed)
{
for (Sprite s : backgroundSprites)
{
float delta = s.getX() - (speed * speedScalar);
s.setX(delta);
s.draw(spriteBatch);
}
}
}
Then you can use the same texture or series of textures like so:
someLayer.addSpriteLayer(sideWalkTexture1, 0, 0, 15);
someLayer.addSpriteLayer(sideWalkTexture2, 15 * sideWalkTexture1.getWidth(), 0, 7);
I change background repeating sections randomly in code and make new ones or reset existing sets when they go off screen. All the layers go to a pool and get pulled randomly when a new one is needed.
| 31083b42c092757acf4af8179c57c7fee0980d006d70877f9e4cb652c777c4e8 | ['13a9cf20637044459fe2826818dab3e8'] | For those not interested in USB debugging or using adb there is an easier solution. In Android 6 (Not sure about prior version) there is an option under developer tools: Take Bug Report
Clicking this option will prepare a bug report and prompt you to save it to drive or have it sent in email.
I found this to be the easiest way to get logs. I don't like to turn on USB debugging.
|
dc197b18297b92affac2e9b7362972b9699070e9bdba0dca845e85c81399c2ba | ['13c8518482ed4ff388ce3470af456ef2'] | It can be optimized by constructing the resulting linked list from back-to-front:
int aval = getValue(a);
int bval = getValue(b);
int result = aval + bval;
LinkedListNode answer = null;
while (result > 0) {
int val = result % 10;
LinkedListNode prev = answer;
answer = new LinkedListNode(val);
answer.next = prev;
result /= 10;
}
if (answer == null) {
// Assuming you want to return 0 rather than null if the sum is 0
answer = new LinkedListNode(0);
}
return answer;
This avoids the repeated Math.pow calls.
I think the overall algorithm you used should be fastest. One alternative that comes to mind is doing some kind of add-with-carry operation on each pair of digits (i.e. doing the addition "manually"), but that would very likely be slower.
| 9703fac7f9dcda8b49156b9f99218ca7fd09b23f664a56f9680f3e2371c9d586 | ['13c8518482ed4ff388ce3470af456ef2'] | The problem is that once you iterate fully through $query2, that's the end of your results. The next time through your $row1 loop, you're still at the end of $query2 and have no results left. Try using mysql_data_seek to go back to the start of your results:
while($row1 = mysql_fetch_object($query1)) {
echo "*".$row1->id."*";
mysql_data_seek($query2, 0);
while ($row2 = mysql_fetch_object($query2)) {
echo "%".$row2->id."%";
}
}
|
3f189729421cd0a600ca32e794fc3645d814aa00dae431d4f4c372f3822465a2 | ['13ce3b7921514bc199eede8a3535721f'] | well,in my case this error has occured when i was using ubuntu 18.04.
All you need is to go to the installation directory (in ubuntu - opt/lampp/phpmyadmin)
and create a folder tmp with all the suitable read/write permissions.
Follow these steps in case of ubuntu-
1.go to the PMA installation directory by typing following commands in cmd-
cd opt/lampp/phpmyadmin
2.Then type the following command-
sudo mkdir tmp && chmod 777 tmp
and then you are done..!!
I hope it helps..
| 97561e4c5585cc766dced052a6ea3a5e69c35258027424a687c663addd222d08 | ['13ce3b7921514bc199eede8a3535721f'] | 1.First of all,don't mix drivers as you are using mysqli and mysql at the same place. Prefer mysqli as mysql has deprecated.
Change your code from
$result = mysqli_query($connection, 'query');
To
$result = mysqli_query($connection, $query);
because you have stored your sql query in $query variable.
3.avoid "where 1" --simply use SELECT * FROM markers
although it seems to work in phpmyadmin but avoid it using in php code.
Hope it works..!!!
|
7486c0df39bf2e999a08c4da82f4869ae4cde657da930dc71b2989bd08790ae5 | ['13dea255fc164d52967f0a2da5a0f023'] | I was able to solve: Thank you for your responses
> library("tidyverse")
> set.seed(111)
> rainTime = runif(n=4000, min=1, max = 2)
> Wash = runif(n=4000, min=2, max=3)
> A=Wash
> preWash = runif(n=4000, min=1, max=2)
> B=preWash
> rainFlag = rbern(n=4000, prob=0.5)
> x = rainFlag*rainTime
> C=A+B+x
> result =ifelse(C >6, 1,0)
> count1 = sum(result==1)
> length(result)
> proportion6 = round(sum(result==1)/length(result),3)
> proportion6
| 021e8ebfc48d473a95756986106de6c54a91bfbea785acd4da3bb75550696511 | ['13dea255fc164d52967f0a2da5a0f023'] | I am importing data from a SQL database using query. There is a 'createDateTime' column in table that I am importing data from. I want to import data into steps -
From yesterday 5:00:00 PM to today 5:00:00 AM on a daily basis
Perform incremental data refresh after import every hour from today 6:00:00 AM to Today 5:00:00 PM
While creating the RangeStart and RangeEnd parameters, I want to pass the DateTime values as in 1 and 2 above.
I tried using :
Date.ToText(Date.AddDays(Date.From(DateTime.FixedLocalNow()),-1), "yyyyMMdd")&& Time.FromText("17:00:00")
Not sure what the best way is of setting these parameters
|
0c4ca14be2f804c73ee4881d9dbd32aec8384a06f58fd4986984e1c030679227 | ['13e5972a2fcb48f0b6ab236137c7e662'] | unfortunately I am unsure as to whether or not it was previously fully cooked by the meat processing company. We are having another half hog processed soon so I will certainly be asking them for clarification next time so I know! I went ahead and disposed of the ham to stay on the safe side and now I learned to not underestimate how much time to allow for a full ham to cook in my new grill.. | ff138dba2e6386d9dc1e3ebdec0d7ea4163b1bc11f53fa3d2cedb9a07416991a | ['13e5972a2fcb48f0b6ab236137c7e662'] | I'm sorry if this question is off topic, but I'll give it a shot:
I have a VPS running Ubuntu 12.04, a LAMP stack, and Mediawiki. After installing Mediawiki I noticed that my wiki site was spiking, i.e. every couple of pages loads would take much longer than necessary.
I connected to the server through SSH to find the same problem: I manage to type 4-5 characters perfectly well, but then it takes around 10 seconds to revive and continue reading my keyboard input.
I ran the top command and I see mysql jumping to the top of the list every 5 seconds, taking up apx. 20-40% of CPU.
The VPS has 20 GB of SSD, 512 Mb of main memory.
Is there an obvious fix to this?
p.s. If this is off topic here, would anyone point me to an appropriate site to ask this question?
|
1a4a2882ee397dfd2aeead690ee07337ce9b99b941431216e8c88f32caeadfb2 | ['13f52d45cef1457ebfe48a9b496f2bd1'] | Your string of inequalities should go this way:
\begin{align*}
\left|\int_\gamma (e^z-\overline z)\,dz\right|&\leq\int_\gamma |e^z-\overline z|\,|dz|\\
&\leq\int_\gamma \left(|e^z|+|z|\right)\,|dz|\\
&\leq\int_\gamma (e^0+4)\,|dz|\\
&=5\int_\gamma |dz|.
\end{align*}
Notice that the $|dz|$ is now a real differential. While $\int_\gamma\,dz=0$, $\int_\gamma |dz|$ is equal to the arc length of $\gamma$.
| a2c9255586660219b11bf283ad7af1df7d9c62809a67cee714f4ad7350cc5d33 | ['13f52d45cef1457ebfe48a9b496f2bd1'] | Observe that $I_0(a)=1-a$. For $n>0$ we can use integration by parts to find, $$I_n(a)=\int_a^1\ln^n(x)dx=-a\ln^n(a)-n\int_a^1\ln^{n-1}(x)dx=-a\ln^n(a)-n I_{n-1}(a).$$ By <PERSON>'s rule, $$\lim_{a\to 0}-a\ln^n(a)=\lim_{a\to 0}\frac{-\ln^n(a)}{1/a}=\lim_{a\to 0}\frac{n\ln^{n-1}(a)}{1/a}=...=(-1)^nn!\lim_{a\to 0}\frac{1}{1/a}=0.$$
Thus,
$$\lim_{a\to 0} I_n(a)=-n\lim_{a\to 0}I_{n-1}(a)=n(n-1)\lim_{a\to 0}I_{n-2}(a)=...=(-1)^nn!\lim_{a\to 0} I_0(a)=(-1)^nn!.$$
|
86bebe0b1f2981a78bacc8e987e9d057e6bfdaf0907611bb4bfd5e894435efea | ['13f81576c89549c9bf7aa4ae5fca40b8'] | Hey can you check the animation type for the clip. Make sure it is not legacy while using it with mecanim. Make the animation clip mode to loop (helps while testing).
Also click on Walking_test and check the inspector if the anim clip is assigned properly. If you already have checked for these things then while playing with mecanim try removing the animation component instead of just disabling it. It will be great if you can provide more information about the animation clip.
| 080daf5c3d36f54c551b2cd2b98a23cdc09636479743b2e6e54fb75ba11abff1 | ['13f81576c89549c9bf7aa4ae5fca40b8'] | Whenever I see HTML formatting on any StackExchange site I wince. Mainly because the tools to assist in formatting are really right in front of you. Yes, there are some formatting codes that are not part of the editor, but raw HTML will always lead to issues. So best to just nip that in the bud when possible.
|
5ce8cd326431e78af6c6f2e4ed2cdfe03a4ae6aa45e00413ebd6abe946d9d90c | ['140160f8107e449da1ee050178d99ecb'] | As previously mentioned, yes Application Settings is reliable and well explained by <PERSON>. However, I want to share with you some considerations regarding to app settings that happened here.
We are currently using an external file and we load it in the web.config. Pretty simple:
<appSettings file="DIR\Configuration\AppSettings.config"></appSettings>
This code is spread out in our 15 web sites. The file is something like this:
<?xml version="1.0"?>
<appSettings>
<add key="CacheEnabled" value="0"/>
...
</appSettings>
Then we realized that this file was growing and now it has 600 keys, cool isn't it? But this is not the worst part, each server has to have it's own configuration, so we spread this file through 7 servers... And some of them have different keys... Imagine that you have to change the path of one specific key, in all servers... We created a monster =)
Doing a code review we decided to store it in the database. A simple table with the machine IP as key and a key value JSON as the document. Not 600 columns of course.
When I told to my team I was doing that, one guy said: "Are you crazy? You will have to change 1k of this code":
ConfigurationManager.AppSettings["KEYNAME"];
Indeed yes I had to change it, but I thought in a simple way, creating my own ConfigurationManager that has a NameValueCollection AppSettings inside:
public static class ScopeManager
{
private static NameValueCollection _appSettings;
public static NameValueCollection AppSettings
{
get
{
if (_appSettings.IsNull())
{
//GET FROM DATABASE, CACHE OR SOMEWHERE ELSE
}
return _appSettings;
}
}
}
And the changes became:
ScopeManager.AppSettings["KEYNAME"];
I don't think we had reinvented the wheel. But we've done a way much better to deal with lots of keys/websites/servers... Seems more real world.
| 16b0e9b70a4af80970fd35032fcac44f1f5a05ba68e033378f0a1bd90f1d9b16 | ['140160f8107e449da1ee050178d99ecb'] | I understand that it's very difficult in the beginning. However, have you read the introduction to MVC? There you will understand the basics and go further.
Even though you need to read that, the answer to you question is: this
You will see the default router and the "/sirushti" is the ID. In the controller you will likely to have something like this:
public JsonResult GetUser(string alias) { ... }
Take a look on the links I've sent you and you will get what it takes to use MVC!
|
864c0e018ec5a1e9ccb394f79fcce5039b083ccc0af038b74559b395ffaa8714 | ['1404c2c8b35641b9b21f482f0fac0758'] | Since SweetAlert2 behaves different from it's t4t5 contemporary, I rewrote part of the functionality:
swal({
text: '@lang('global.message.not_visited')',
content: {
element: 'input',
attributes: {
placeholder: '@lang('global.app.reason')',
type: 'text'
}
},
icon: 'info',
buttons: [ '@lang('global.app.cancel')', '@lang('global.app.ok')'],
closeModal: false,
})
.then(function(result) {
if(result === '' ) {
console.log('back');
$('button.notvisited').click();
return false;
}
else if (result) {
console.log($('button.notvisited'));
axios.post('{{ route('mobile.order.setstatus') }}',
{
order_id: $('button.notvisited').attr('data-id'),
user_id: $('button.notvisited').attr('data-usr'),
remark: result,
order_status: 'ORDER_STATUS_NOT_VISITED'
}).then((res) => {
if( res.data ) {
swal({
text: res.data.message,
icon: ( res.data.success ? 'info' : 'error' ),
}).then( function(result) {
if (result) {
document.location.href = '{{ route('mobile.order.overview') }}';
}
});
}
});
}
});
| 38cafe4db5e232a692c5a2e7086e4fd4e1ed278a3f55b5d529c1f729f6fa60cd | ['1404c2c8b35641b9b21f482f0fac0758'] | xml:
<lev:Locatie axisLabels="x y" srsDimension="2" srsName="epsg:28992" uomLabels="m m">
<gml:exterior xmlns:gml="http://www.opengis.net/gml">
<gml:LinearRing>
<gml:posList>
222518.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</lev:Locatie>
I need to get to the gml:posList. I tried the following
SimpleXML:
$xmldata = new SimpleXMLElement($xmlstr);
$xmlns = $xmldata->getNamespaces(true);
$retval = array();
foreach( $xmldata as $attr => $child ) {
if ( (string)$child !== '' ) {
$retval[$attr] = (string)$child;
}
else {
$retval[$attr] = $child->children( $xmlns['gml'] );
}
}
var_export( $retval );
xpath:
$domdoc = new DOMDocument();
$domdoc->loadXML($xml );
$xpath = new DOMXpath($domdoc);
$xpath->registerNamespace('l', $xmlns['lev'] );
$xpath->registerNamespace('g', $xmlns['gml'] );
var_export( $xml->xpath('//g:posList') );
If I query the attributes for lev:Locatie, I can get them, however, I seem unable to retrieve the gml:posList's value or the attributes for e.g gml:exterior. I know I'm doing something wrong, I just don't see what ...
|
ae275ae50a00927d6172f81f5c82bc533fcbbb6aab14aca9f379952fcdd431f7 | ['140e737356104a358c3c404425d108c5'] | If you run this command in a MEL tab in your Maya Script Editor, you'll get:
whatIs createNCloth;
// Result: Script found in: C:/Program Files/Autodesk/Maya2018/scripts/others/createNCloth.mel //
Looking through the createNCloth.mel script briefly, it looks somewhat involved. You can call this script yourself from python via the maya.mel module, which unfortunately is often the way things go with some of these specialised Maya integrations.
Keep in mind that the createNCloth(<worldSpace>) proc expects your mesh to be selected, and will not let you pass an object as a parameter.
| 751df919373aefe234442daf61e70586ee349add8bbc2f7d314cccfec125553f | ['140e737356104a358c3c404425d108c5'] | This isn't much in terms of helping you answer your specific question, but based on the discussion in comments, please use something like this code to help you test your JSON I/O:
import json
from datetime import datetime
jsonFile = 'D:/test.json'
data = []
print('Generating data...')
for i in range(1000000):
data.append({
'star-date': datetime.now().microsecond,
'captains-log': 'This is entry #{:,}. More later, must go.'.format(i+1)
})
print('Done!')
print('\nNum rows (in-memory): {:,}'.format(len(data)))
print('First (in-memory): {}'.format(data[0]))
print('Last (in-memory): {}'.format(data[-1]))
print('\nSaving JSON...')
with open(jsonFile, 'w') as f:
json.dump(data, f)
print('Done!')
print('Loading JSON...')
jsonData = []
with open(jsonFile) as f:
jsonData = json.load(f)
print('Done!')
print('\nNum rows (from file): {:,}'.format(len(jsonData)))
print('First (from file): {}'.format(jsonData[0]))
print('Last (from file): {}'.format(jsonData[-1]))
For me this particular script resulted in a ~85mb JSON file (1 million entries), which took a few seconds to generate and almost as long again to read back. There was no difference in total list count and both the first and last entries seemed to match fine, as expected.
Do you get different results? If not, could there perhaps be an issue with the JSON file you are currently using? How is it generated? Can you try parsing it in one of the many available online JSON formatter/parser tools, to validate?
Cheers
|
c1f7df50bcd0dc28007de1541aaa6320cd41d9327ffac74f77f0107dfadabffa | ['140ed0ce72ee41babed9e612386528fb'] | As <PERSON> answered, move the SOP statements outside the while loop to get the desired output.
As to other ways to get the data types, I feel your implementation is good enough and widely used. But if you want to do it in an another way then try using regex patterns to validate the string and determine the data type (not reliable) OR use the Scanner class API to determine the data type like below.
@SuppressWarnings("resource")
Scanner s= new Scanner(new File("src/inputs.txt")).useDelimiter("\\s+");
ArrayList<Long> itr= new ArrayList<Long>();
ArrayList<Double> dub = new ArrayList<Double>();
ArrayList<String> str = new ArrayList<String>();
while(s.hasNext())
{
if(s.hasNextLong()){
itr.add(s.nextLong());
}
else if(s.hasNextDouble()){
dub.add(s.nextDouble());
}
else{
str.add(s.next());
}
}
s.close();
System.out.println("Long values are <IP_ADDRESS>" + itr);
System.out.println("Double values are <IP_ADDRESS>" + dub);
System.out.println("String Values are" + str);
| 4f23504672c5b48e12b4b8142f67d5d4547c6c29416dd29aaf3ef97bde7328a4 | ['140ed0ce72ee41babed9e612386528fb'] | I am unsure about what Appery is, but if it is a normal HTML or JSP page that you are working on then, the form will submit on click of the submit button irrespective of what the above code returns.
I assume you are using a normal button for submitting the form on click on which the above code will run and signupService.execute({}); submits the form.
Did try checking with alerts that whether the control actually goes inside the last if loop?
|
76d363419c14c7c74b83dd70a35795d0917c2e199662decaa898e29475869e3e | ['140fbc667eb74edb9802d5b71a5ee67c'] | It's probably worth adding that these sections _must_ be in the standard config files (php.ini and conf.d/*) and not the _fpm_ config files (php-fpm.conf and pool.d/*). The _fpm_ config files are specifically for configuring pools so any [HOST=] sections will be creating a new pool not just adding some config. | b34b59fb64ae20e3d79743a3fa328c80c342cf018a08bcad1c5008a9cacd34ab | ['140fbc667eb74edb9802d5b71a5ee67c'] | I'm trying to setup replication between two SQL Servers and I'm almost there but stuck on a permission error (it appears). The servers are connected via VPN.
Publisher/Distributer = W2003 + SQL2005 (Domain Controller)
Subscriber = W2008 + SQL2008 (Stand Along Server not on a domain)
I have set it up to Pull rather than push only because that's the way I got past the logins issue.
Current status is that both agents are running and the snapshot has completed but it doesn't start replicating. There error is below which seems to indicate that the Subscriber does not have permissions to the Snapshot folder but I have set Everyone (Full control) just to try and get it working.
I'm thinking is there some issue with trust or something. I can bring up the snapshot share on the Publisher from Subscriber and access files without any permission issues. But SQL seems to be having some kind of issue.
Any thoughts on the next steps here to trouble shoot? Thanks.
This is the end of the log:
2009-07-22 23:34:47.838 Initializing
2009-07-22 23:34:49.263
Snapshot will be applied from the alternate folder '\[MachineName][share]\unc\SYDNEY_MIRRORMIRROR_MIRRORMIRRORPRODUCT\20090722085146\'
2009-07-22 23:34:50.809 Agent message code 20143. The process could not read file '\[MachineName][share]\unc\SYDNEY_MIRRORMIRROR_MIRRORMIRRORPRODUCT\20090722085146\TRProductImages_8.pre' due to OS error 5.
2009-07-22 23:34:51.524 Category:OS
Source:
Number: 5
Message: Access is denied.
|
78a667fc7881d28e9722bcd323feaaf2348fa3ffe081dad05dc82ec6579c68d6 | ['141ae86c25b84aa3ac76a27b3cbe0791'] | So, I've started studying Calculus less than a month ago but now I've been stuck for two days trying to prove the extreme value theorem and it's really stressing me out. I've searched on other Calculus books but none seems to provide a proof for it, and trying to look for a proof on the internet has only gotten me to study yet other theorems which seem hardly within the scope of Calculus.
So far I've managed to prove that if $f$ is continuous in $[a,b]$, then it must also be bounded in that interval. I also know how to prove that $f$ attains its least upper bound in $[a,b]$, provided that it exists. Basically, all I want to prove now is that if $f$ is continuous and bounded in $[a,b]$, then it must also have a least upper bound. But however obvious it may seem to me, I can't seem to come up with a proof. Is there a way to prove it?
Thank you very much for any help.
| ec21122354caf3ade54f69f9cb2b3e28b411b500cb29489d9759120e475fc895 | ['141ae86c25b84aa3ac76a27b3cbe0791'] | <PERSON> I'm not sure if that's what you asked, but I've always thought of the area of a 2d shape as being the number of square units that can ben fit into it. I know <PERSON> has already answer my question, but I couldn't stop thinking about your comment. Would you care to post your proof if the area comes from an approximation by unions of rectangles, if it's not too much trouble? I think that seeing it proven two different ways would be really profitable for my understanding. Thanks. |
b05aba80a076f083db1197b413cea0d7de1aba199576afdc59e6a5fb2b7d73fe | ['141cafc5156446fa9537400cdb19a766'] | As mentioned in the comment, you can get the absolute path from the saved image and pass it through an intent to the Activity that it needs it.
To achieve this, you might want to convert your image file to a BitMap first, which will give you the actual path of the image (sometimes .getAbsolutePath() method returns a wrong file path, so it is a better solution to convert your image to a bitmap first).
This can be achieved:
String filePath = file.getPath();
Bitmap imgBitmap = BitmapFactory.decodeFile(filePath);
Then to obtain the real path of the image you saved you need to
1) Obtain the Uri of the created Bitmap:
public Uri getUri(Context context, Bitmap imgBitmap) {
ByteArrayOutputStream bOutputStream = new ByteArrayOutputStream();
String path = MediaStore.Images.Media.insertImage(context.getContentResolver(),
imgBitmap, "Title", null);
return Uri.parse(path);
}
2) Fetch the real path from Uri:
public String getRealPath(Uri uri) {
String [] proj={MediaStore.Images.Media.DATA};
Cursor cursor = getContentResolver().query(uri, proj, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
String path = cursor.getString(column_index);
cursor.close();
return path;
}
In your first activity you can pass the path of your image through an intent to the other activity, then fetch it and display it/etc.
Intent intent = new Intent(context,OtherActivity.class);
intent.putExtra("PATH",path);
startActivity(intent);
Receive the data you passed:
Intent intent = getIntent();
String path = intent.getStringExtra("PATH");
//convert the path to image/bitmap and display the image
You can also pass the entire Bitmap to the Activity you need it, but I strongly recommend that you don't, because it will use a lot of memory.
| 5a07ebdc5bf9d228525ed1293f9ee5974d72db4cf856dd4314788642276d46ed | ['141cafc5156446fa9537400cdb19a766'] | Another option is to create a slot "name" then go to the instance you created and give the name you wish.
To display the instance with the name you just gave go to the instance browser->menu->select display slot->choose name.You can see here a screenshot which will make it clear!
|
8f63376c73f5cbd777914754a7467240ba0da9a6595578dd019f08ca546cfa45 | ['141de159ce0c465ba03ee350e9c287a3'] | This is an evolution of this question.
Basically I am having trouble getting all the solutions to a SPARQL query from a remote endpoint. I have read through section 2.4 here because it seems to describe a situation almost identical to mine.
The idea is that I want to filter my results from DBPedia based on information in my local RDF graph. The query is here:
PREFIX ns1:
<http://www.semanticweb.org/caeleanb/ontologies/twittermap#>
PREFIX dbo: <http://dbpedia.org/ontology/>
SELECT *
WHERE {
?p ns1:displayName ?name .
SERVICE <http://dbpedia.org/sparql> {
?s rdfs:label ?name .
?s rdf:type foaf:Person .
}
}
And the only result I get is dbpedia:John_McCain (for ?s). I think this is because <PERSON> is the only match in the first 'x' results, but I can't figure out how to get the query to return all matches. For example, if I add a filter like:
SERVICE <http://dbpedia.org/sparql> {
?s rdfs:label ?name .
?s rdf:type foaf:Person .
FILTER(?name = "<PERSON> || ?name = "<PERSON>)
}
Then it correctly returns BOTH dbpedia:Jamie_Oliver and dbpedia:John_McCain. There are dozens of other matches like <PERSON> that do not come through unless I specifically add it to a Filter like this.
Can someone explain a way to extract the rest of the matches? Thanks.
| dceb560eea51af456ad6fef588f0c63f931f81428d235176eadd48a681369eeb | ['141de159ce0c465ba03ee350e9c287a3'] |
As you can see in the image, the AlphaGo Zero neural network uses a loss function which uses the MCTS probabilities and value as ground truth labels. I am trying to understand whether the outputs of the neural network are treated as logits (e.g. real-valued) or raw probabilities ([0,1]). In the loss function, it looks like the MCTS probabilities (which I am confident lie in [0,1]) are vector-multiplied by the log of the NN probabilities. This is a negative term in the loss, but what does the magnitude of this term indicate about the similarity of the two vectors? Why does a larger value indicate more similarity?
|
f17f6b879c589570834e2a911bfe4fd93722e1efa366db953a88be803b83192b | ['1454d6b4c6eb4182ab9e686adbb3a6f7'] | This only applies to Toad for Oracle.
You should be able to Log in to TFS with the Trial Version. If you can browse TFS Projects in Toad, you should be already logged in to TFS correctly.
The most likely reason that the button is disabled, is that you are attempting to logon to a remote workspace. I am assuming you can see your local WorkSpaces (Namespaces ?) in the Logon Window. Does the word (Remote) appear in parentheses next to the workspace name. If this is the case, then you are selecting a remote workspace. This workspace was set up for a different machine.
You will need to select or set up a workspace that was created for this machine. The quickest way to test this is to select 'New' from the workspace selection and create a new workspace mapped to a local folder (you can always delete later). Then you should be able to log in to TFS.
Hope this helps
P.S
We do not typically monitor postings on StackOverflow, so if you might want hop on over to the Toad Yahoo Groups with any follow up questions
| 29a6626b697fbeda575aec2d4eee36e1bf52c58d0c604c18ac210fc896234ffa | ['1454d6b4c6eb4182ab9e686adbb3a6f7'] | I have recently started to experience a similar issue. We also host TFS on a different domain. Twice in the last week TFS has stopped authenticating users, and I have received messages similar to above. I have no idea what is causing this, but on each occasion SQL Server Agent service was stopped. A reboot of the server and a manual restart of SQL Server agent seems to fix the problem temporarily. I'm not sure if this information is helpful, but I would also really appreciate any help in getting to the bottom of this.
|
5489337cdc8b7efbb30cce3f0d276f64c35739771e30523c9ab0e59303c7d633 | ['1456ffcdee28403b84db1f251a4d3946'] | I'm trying to use accelerometer from react-native-sensors, but numbers don't seem to change relative to the position. They're changing, but kind of randomly.
I need to detect when the user picks up the phone from this screen-down position, and when he turns it back.
It's my first RN app, so may be you know some good articles on how to read those numbers?
I'm testing the app on Android.
| d48132083316b4c26a76756f96eec8279bb0796e610f882867a6589196a324e8 | ['1456ffcdee28403b84db1f251a4d3946'] |
const products = [
{
id: 1,
name: 'product 1',
materials: [
{
id: 1,
name: 'material 1'
},
{
id: 7,
name: 'material 7'
},
{
id: 5,
name: 'material 5'
}
]
},
{
id: 2,
name: 'product 2',
materials: [
{
id: 1,
name: 'material 1'
},
{
id: 2,
name: 'material 2'
},
{
id: 3,
name: 'material 3'
}
]
}
];
const materials = [3, 4];
console.log(
products.filter(product => {
for (let i = 0; i < product.materials.length; i++) {
if (materials.includes(product.materials[i].id)) return true;
}
})
);
I would do it like this:
products.filter(product => {
for (let i = 0; i < product.materials.length; i++) {
if (materials.includes(product.materials[i].id)) return true;
}
})
|
5e4df2f40e35d7953fcc8e1bd454dbfe20e2e686c91a0816d4baab3d6e104dda | ['14576914317b4cc389f115c60ca48a51'] | Try This. Scroll view only handle one direct class and then give imageview height matchparent
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e6e6e6"
android:orientation="vertical"
android:padding="1dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#868585"
android:padding="0dp"
android:text="Basic Information"
android:textColor="#ffffff" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="9"
app:srcCompat="@mipmap/ic_launcher" />
<TextView
android:id="@+id/textView7"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Addhhhhhhhhhhhhhhhhhhvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhress" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
| c93164b56f4e943bdc69b4f86f305f147b7a1765756b397b743a73a65b535870 | ['14576914317b4cc389f115c60ca48a51'] | In onItemClick you can pass Like this
Toast.makeText(getActivity(),"Item Clicked",Toast.LENGTH_LONG).show();
Intent intent=new Intent(getActivity(),DetailActivity.class);
//what should i pass in putExtra of intent
intent.putExtra("IMAGE",photos.get(position).getLink());
startActivity(intent);
In DetailsActivity you can retrieve it by
if (getIntent().getStringExtra("IMAGE") != null) {
imageurl = getIntent().getStringExtra("IMAGE");
}
|
e5e6641c4af5c22ec56465be59266dacdd4de0bb2d15710d82479e886d5c0323 | ['14588d328d0849eabd23d7658953b7c0'] | I am still new in docker and all container things.
I have server with full access at
<IP_ADDRESS> and I installed docker there. (without docker compose)
In the other place my friend have server <IP_ADDRESS> and he installed docker and docker compose there.
At <IP_ADDRESS> server, my friend build 3 container : container A (Git), container B(unknown), container C(unknown).
I can access content of container A (Git) with browsers.
My question is: can I import container A to my server in <IP_ADDRESS>? I have user access to download Git, but what I want is to import the container, not Git (content inside the container).
Any hint? what should I do? Or it is impossible to do if I don't have access to the command console?
| 3d6a79b2603fc8fc23244f3cd0897637a9ad4b02df895c4d6aed435eb257e38b | ['14588d328d0849eabd23d7658953b7c0'] | I tried to install Gitlab with docker compose. I set docker-compose.
gitlab:
image: 'gitlab/gitlab-ce:latest'
volumes:
- '/srv/docker/gitlab/data:/var/opt/gitlab'
- '/srv/docker/gitlab/config:/etc/gitlab'
- '/srv/docker/gitlab/logs:/var/log/gitlab'
ports:
- "10080:10080"
- "10443:443"
- "10022:22"
restart: always
hostname: '<IP_ADDRESS>'
dns:
- xx.xx.xx.xx
environment:
GITLAB_OMNIBUS_CONFIG: |
gitlab_rails['gravatar_enabled'] = false
gitlab_rails['time_zone'] = 'Asia/Tokyo'
When I run docker-compose up it failed said
gitlab_1 | If this container fails to start due to permission problems try to fix it by executing:
gitlab_1 |
gitlab_1 | docker exec -it gitlab update-permissions
gitlab_1 | docker restart gitlab
gitlab_1 |
gitlab_1 | Installing gitlab.rb config...
gitlab_1 | cp: cannot create regular file '/etc/gitlab/gitlab.rb': Permission denied
gitlab_gitlab_1 exited with code 1
as written I tried to run
docker exec -it gitlab update-permissions
But error said
Error response from daemon: No such container: gitlab
Anyone can help?
Just info docker ps
Result:
CONTAINER ID IMAGE COMMAND CREATED
xxxxxxx gitlab/gitlab-ce:latest "/assets/wrapper" 24 hours ago
And permission file
ls -la /etc/gitlab/gitlab.rb
-rw-------. 1 root root 0 Dec 12 17:00 /etc/gitlab/gitlab.rb
|
30446ad2ef0160d8cebb0ea1864315d9da8d3aaaf93f6a5433cda64743e9be31 | ['145af640002249a58ce29188b716da14'] | In linux, many drivers (and some parts) can be compiled directly in the kernel or as a module. Is there any difference between compiling a driver (or some parts) as a module and compiling it directly? They seem to work either ways. Also, Are there some pros and cons in compiling it as a module or compiling it directly
| ab6d5f399773f6470295c39e478f6f93cc0f1b81fd6c0dcb35c5f1df7e651bdf | ['145af640002249a58ce29188b716da14'] | I'm trying to apply a sliding animation on the box I created via with some help from css. The box is hidden at first but when the mouse hovers to the that area, the box will slide to its position. Because the box is big 600px, I tried the following to trigger the animation when the mouse is pointed at about 40 px from the edge of the browser:
CSS:
.lumpia-wrapper {
position: relative;
overflow: hidden;
width: 100%;
height: 100%;
}
.box {
width: 600px;
height: 600px
background-color=blue;
}
#reveal {
position:absolute;
top:-100%;
transition: 5s;
}
.box2{
width: 40px;
height: 600px;
border: 4px solid black;
}
.box2:hover ~ .box:hover #reveal{
top:0;
transition: 5s;
}
HTML:
...
<div class=lumpia-wrapper>
<div class="box" id="reveal>Once upon the time...</div>
<div class="box2></div>
...
IT Did not work...
What have I done wrong? Is there something missing to make it work?
|
a2ce3b4edcc28fb47809e4266ca6610eb8d870a2e5c801324b3d3d7e419082d1 | ['146588400a434d86ae8a29f8cb164d70'] | The simple code snippet speaks for itself.
[error] Form<User> userForm = Form.form(User.class).bindFromRequest();
[error] ^
[error] symbol: method form()
[error] location: class Form
I've checked documentation : http://www.playframework.com/documentation/2.1.0/JavaForms
Doesn't understand what's going on...
The documentation is clear about that :
http://www.playframework.com/documentation/2.1.0/Migration
and the Java API is clear too :
http://www.playframework.com/documentation/api/2.1.0/java/play/data/Form.html#form(java.lang.Class)
| 048ad02d03c5c502ad1e709f8ac40fe9ef7ae2e86adfbf7396439d85995b7d85 | ['146588400a434d86ae8a29f8cb164d70'] | I'm building a simple web app using jsp and servlets. The application is deployed on Glassfish server and use JPA / Hibernate.
I need to create a Quartz Job that work with JPA (select / update...). I've tried to add :
@PersistenceUnit
private EntityManagerFactory emf;
into my Job but it's null. By the way it works for my servlets and ServletContextListener.
I don't see how I can force glassfish to inject the persistence unit.
Any idea ?
THX
|
06187168138d566ccae92ac54cc27e09b03c94134675c3be20918abb932175c9 | ['1474793ebdbf4e72b8f5ea2a327a2ede'] | According to your example, given the range 1 - 100, the return value should be 5 when you pass in a 105, you use 100 as a 0 in the range 101 - 200. It means the length of your range is 100 but not 99 because you actually overflow 100 numbers.
So here you use the length = (range.max - range.min) + 1 but not (range.max - range.min).
But when the pass-in value is below the minimum, what's your "expected behavior"? For example, given the range 30-100, which number should be returned when you pass in a 29? According to your exception "If the range is 30 - 100 and the integer is - 40 I expect the return value to be 30", then it should return 30+(29-(-40))=99 given a 29, which means that 30 and 100 represent the same number. Therefore, in this example you overflow 69 numbers but not 70, that means you use length = (range.max - range.min) here. Here conflict happens! You should not change the range length like this!
| df2df4a87e049c0a6d5d925a89fdd1bd2292ce17a7a9858403bfdac4f2f1df0d | ['1474793ebdbf4e72b8f5ea2a327a2ede'] | I observe the red lines you want to keep. Are they the edges that far away to the sites that are not the junction sites? You can set a distance threshold d, if the distance between the edge to its closest site is smaller than d and the site is not a junction, then remove this edge.
|
cab21347c96c84fd3fed902ecca17573c0bb8fd40fd1bafa00fc5c6ccfb3e2b8 | ['1476a9b80e3040ef83889e147a039479'] | I have an App which I do not use Auto Layout. I only use the Autoresizing constrains to adjust the position of the objects on different devices display sizes.
I have a table view in my app with static cells and I've added a couple of switches and a custom button but the constrains aren't working inside the cell.
Example:
image
As you can see, the switch has a locked constrain to the right but it's not aligning to the right.
Is this a bug of Xcode 8? Is there an workaround?
| 56b6be55438f7b7e5d53d83072ff975c64e368768c043802df5eccaa453aee44 | ['1476a9b80e3040ef83889e147a039479'] | I have two views in my app and a plist file to store some values.
In the first view I've created a button called frequenciesButton that opens the second view and another button to restore the default values.
In the second view there is a pickerView and a "Done" button.
On the .m of the first view:
- (void)viewDidLoad {
[super viewDidLoad];
//
self.gameSettings = [[NSMutableDictionary alloc] initWithContentsOfFile:gameSettingsFilePath];
}
-(void)viewWillAppear:(BOOL)animated {
[self refreshView];
}
- (void)refreshView {
[self.frequenciesButton setTitle:[NSString stringWithFormat:@"%@ hz and %@ hz", [self.gameSettings objectForKey:@"freq-freq1"], [self.gameSettings objectForKey:@"freq-freq2"]] forState:UIControlStateNormal];
...
}
- (IBAction)setDefaultValues:(UIButton *)sender {
[self.gameSettings setValue:@880 forKey:@"freq-freq1"];
[self.gameSettings setValue:@1122 forKey:@"freq-freq2"];
...
[self.gameSettings writeToFile:gameSettingsFilePath atomically:YES];
[self refreshView];
}
When the first view is loaded, the button title is changed to the default values stored in the gameSettings dictionary. The method setTitle: works.
When I click on the frequenciesButton it opens the second view with the pickerView, I select the two new values for the freq-freq1 and freq-freq2 and it saves to the plist file on done button.
The problem is that the frequenciesButton title is not changed when the second view is dissmissed and the first view appears. The refreshView method is called but the button setTitle: does not work.
In this case, if I go back one screen, and return to this view, the button title is updated.
And when I click on defaultValuesButton, the frequenciesButton title changes. The method setTitle: also works.
Any ideas of what must be happening?
|
45f49c65500ad4465c473aee970973a0b2ce48aee46d91cf5c6f037c645e6862 | ['1480b85a4d2d4a0bab8b36c2ab34ce92'] | Sobre todo gracias. Lo que trato de hacer es recoger el nombre de un archivo file, y mostrar el nombre de este archivo en el panel del usuario, tantas veces que el usuario introduzca un archivo file. El problema es que la funcionalidad que realiza el input file la realiza mediante una API (converAPI), por lo que los archivos que el usuario introduce en el input file nunca los registra nuestra bbdd.... Por lo que no conozco la forma de hacer que el nombre de ese archivo file se guarde y lo muestre en forma de listado en el panel usuario. Por ahora mi script es este : | e95afe675f1844a5d860f20b07f46abd199ce80d982e26a156137651424a8edb | ['1480b85a4d2d4a0bab8b36c2ab34ce92'] | I have a client application that consumes a number of services. It's not always immediately obvious when a service is down or incorrectly configured. I own the service side code and hosting for most of the services, but not all of them. It's a real mixed bag of client proxies - different bindings (basichttp/wshttp/nettcp), some have been generated using svcutil.exe, while others are made programatically with ChannelFactory where the contract is in a common assembly. However, I always have access to the address, binding and contract.
I would like to have a single component in my client application that could perform a basic check of the binding/endpoint config and the service availability (to show in some diagnostic panel in the client). As a minimum I just want to know that there is an endpoint at the configured address, even better would be to find out if the endpoint is responsive and supports the binding the client is trying to use.
I tried googling and was surprised that I didn't find an example (already a bad sign perhaps) but I figured that it couldn't be that hard, all I had to do was to create a clientchannel and try to open() and close() catch any exceptions that occur and abort() if necessary.
I was wrong - in particular, with clients using BasicHttpBinding where I can specify any endpoint address and am able to open and close without any exceptions.
Here's a trimmed down version of my implementation, in reality I'm returning slightly more detailed info about the type of exception and the endpoint address but this is the basic structure.
public class GenericClientStatusChecker<TChannel> : ICanCheckServiceStatus where TChannel : class
{
public GenericClientStatusChecker(Binding binding, EndpointAddress endpoint)
{
_endpoint = endpoint;
_binding = binding;
}
public bool CheckServiceStatus()
{
bool isOk = false;
ChannelFactory<TChannel> clientChannelFactory = null;
IClientChannel clientChannel = null;
try
{
clientChannelFactory = new ChannelFactory<TChannel>(_binding, _endpoint);
}
catch
{
return isOk;
}
try
{
clientChannel = clientChannelFactory.CreateChannel() as IClientChannel;
clientChannel.Open();
clientChannel.Close();
isOk = true;
}
catch
{
if (clientChannel != null)
clientChannel.Abort();
}
return isOk;
}
}
[Test]
public void CheckServiceAtNonexistentEndpoint_ExpectFalse()
{
var checker = new GenericClientStatusChecker<IDateTimeService>(new BasicHttpBinding(), new Endpointaddress("http://nonexistenturl"));
// This assert fails, because according to my implementation, everything's ok
Assert.IsFalse(checker.CheckServiceStatus());
}
I also tried a similar technique with a dummy testclient class that implemented ClientBase with the same result. I suppose it might be possible if I knew that all my service contracts implemented a common CheckHealth() method, but because some of the services are outside my control, I can't even do that.
So, is it even possible to write such a simple general purpose generic service checker as this? And if so how? (And if not, why not?)
Thanks!
|
40080ebada45da7d16bb9cc605f21f02f09d72a09bd5db0ea19842c6156e8892 | ['148a27bab98f4f8685a5e5579da1551b'] | I can't find anything online about making a linked list with individual nodes that hold arrays.
struct node{
string list[];
string var;
node* next = NULL;
node* previous = NULL;
};
void insertion(node*& start, string name, string words[]){
node* temp = new node;
temp->var = name;
temp->list = words;
if (!start) {
start = temp;
return;
} else {
node* tail = start;
while(tail->next) {
tail=tail->next;
}
tail->next = temp;
temp->previous = tail;
}
The code above gives me the error:
web.cpp: In function ‘void insertion(variable*&, std<IP_ADDRESS>__cxx11<IP_ADDRESS>string, std<IP_ADDRESS>__cxx11<IP_ADDRESS>string*)’:
web.cpp:18:16: error: incompatible types in assignment of ‘std<IP_ADDRESS>__cxx11<IP_ADDRESS>string* {aka std<IP_ADDRESS>__cxx11<IP_ADDRESS>basic_string*}’ to ‘std<IP_ADDRESS>__cxx11<IP_ADDRESS>string [0] {aka std<IP_ADDRESS>__cxx11<IP_ADDRESS>basic_string [0]}’
temp->list = words;
| e8b3c2c2609e74322fa1d08b49b8baaef9b8983d193228087a4b0563a1feb7d6 | ['148a27bab98f4f8685a5e5579da1551b'] | What is the best way to go about storing doubly linked lists inside of one doubly linked list? Preferably, I would like to use only one struct, like so:
struct node{
string data;
node* next = NULL;
node* prev = NULL;
};
and use this to be able to store a doubly linked list inside of a doubly linked list to hold all of my doubly linked lists.
I have an ordinary insert function, but that wouldn't work because the parameters are (node*& start, string data). So I've created another insertion method that attempts to store a doubly linked list into a node of a larger doubly linked list, but it gets cloudy from there. Any help would be appreciated.
|
df15fd2ffc949affb3e83659c3398227aca46381595d091c67038359fd1ef799 | ['148a3fea4e8c45bd986232aa1db3a648'] | I found the answer!
First of all it only works with livestreams such as
https://demo-hls5-live.zahs.tv/sd/master.m3u8
Next, perform a swipe from the edge of the remotes trackpad to the center,
it will flip to the next or previous channel, by calling the delegate methods.
| cd57dbcdca6ba476deb37804e54fab9650d5ed04dba6c947e6dd2ed7bbe19c81 | ['148a3fea4e8c45bd986232aa1db3a648'] | I have a Flex 4 TabBar component with a custom skin. In this skin, the item renderer is defined with an ButtonBarButton with a custom skin.
All the tabs in the itemrenderer have now the same width.
The client however wants me to make the tabs width dynamically, so a smaller tab for a smaller label, a bigger one for a long label.
Does anybody know how to adjust the width of Tab (ButtonBarButton)?
Thanks a million!
|
a53ffc867bf895f941feb6348f414cb3b5ab04d8d6ec46788586cbdecc21fe32 | ['1491e0f5ffaf464591b34f42b09f720f'] | There are many date formats and informats available in SAS to change the date format being presented. A full list of the formats can be found here in the SAS documentation. The format you want is ddmmyyd. and you can just apply the format to the date value (see col1_ example).
For datetime values, you need to use the DATEPART function to extract the date value before applying the format (see col2_ and col3_ examples below).
If your date is provided as text, you need to apply an informat to it to convert it to SAS date value and then you can apply your desired date format to the value using PUT statements. Including converting this value back to text (see col4_ examples below).
data date_infile;
infile datalines delimiter=',';
input col1_date :date9. col2_dtime :datetime18. col3_dtime :datetime18. col4_text $18.;
format col1_date date9. col2_dtime col3_dtime datetime18.;
datalines;
21jun2012,21JUN2012:00:00:00,21JUN2012:12:34:56,21JUN2012:00:00:00
11aug2012,11AUG2012:00:00:00,11AUG2012:01:23:45,11AUG2012:00:00:00
05oct2019,05OCT2019:00:00:00,05OCT2019:01:23:45,05OCT2019:00:00:00
;
run;
data date_results;
set date_infile;
format col1_date col2_date col3_date col4_date ddmmyyd.;
col2_date = datepart(col2_dtime);
col3_date = datepart(col3_dtime);
col4_date = datepart(input(col4_text, datetime18.));
col4_date_as_text = put(put(datepart(input(col4_text, datetime18.)), ddmmyyd.), $8.);
run;
| faf6d23f147c45a1acc4903129cad48075a7383e73ade1bc53e27d9f1b311b03 | ['1491e0f5ffaf464591b34f42b09f720f'] | You can use the TRNWORD function to replace/remove specific words like and or.
Be sure to include leading and trailing spaces so that you don't mess with variable name you want to keep untouched.
You can use the COMPRESS function to remove the operators, decimal points and all numbers.
This will work so long as your variable names do not contain numbers. If they do, drop the 'd' modifier from the COMPRESS function and amend the macro to use TRNWORD to remove numbers with leading spaces (e.g. ' 5'), as variables cannot start with digits.
the following macro will extract a specified word from your text string, report the result to the log, and provide the result in a macro variable :
%macro extract_word(txt_string, w_num);
option nonotes;
data _null_;
_rule = "&txt_string.";
_var1 = tranwrd(_rule, ' and ', ' ');
_var2 = tranwrd(_var1, ' or ', ' ');
_var3 = compress(_var2, '^=<>.', 'd');
_word = scan(_var3, &w_num.);
call symputx("word&w_num.", _word, 'G');
run;
options notes;
%put NOTE: Word&w_num. = &&word&w_num..;
%mEnd extract_word;
Here are the results:
%extract_word(%str(&rule.), 1);
NOTE: Word1 = limit
%extract_word(%str(&rule.), 2);
NOTE: Word2 = amount
%extract_word(%str(&rule.), 3);
NOTE: Word3 = debt
|
4bd0e7bf25b328e37806992bb10aa9359f9c891be4f68a56befbf712f8a08f46 | ['149794e49e844e09a68c326f9b79ed8b'] | Deliberately breaking transactions into smaller units to avoid reporting requirements is called structuring and may attract the attention of the IRS and/or law enforcement agencies. I'm not sure what the specific laws are on structuring with respect to FBAR reporting requirements and/or electronic transfers (as opposed to cash transactions). However, there's been substantial recent publicity about cases where people had their assets seized simply because federal agents suspected they were trying to avoid reporting requirements (even if there was no hard evidence of this). It is safer not to risk it. Don't try to structure your transactions to avoid the reporting requirements.
| 5200a58aff29b7f112c893fff3a6403300d62f4c458b6354a81ffd94548f577c | ['149794e49e844e09a68c326f9b79ed8b'] | I'm fully aware of the issues with conflicting files with DFS-R (I've had more than my fair share of issue with it, as we have been using it for several years), and I can appreciate why offline files is bad in this situation, but I can't understand why it the conflict resolution appears to do nothing. |
4496261e3e76fb5dab286267d5eb10fc928d96f057a7e27f1adb54d325a3a86b | ['14d10273bfec4d519dda936b81a0df46'] | In our office we have 30 PCs, 2 WiFi and 6 VoIP phones connected to the network that consumes bandwidth. Basically 30 PCs are simultaneously using the Internet (like Facebook, surfing the web and using trading platforms on the desktops).
Employees are also handling phone calls using IP phones, which also consume bandwidth.
Currently we are subscribing to DSL that offers "up to" 4 Mbps bandwidth. Would that be enough for our purposes? If not, how do I calculate how much bandwidth I need for a given number of workstations and phones?
| fc25541a0b845166ac33be1cc42b25f6a011497c15047126f8e319c595483898 | ['14d10273bfec4d519dda936b81a0df46'] | MadHatter, Thank your for your elaborate suggestion and it may give me precise idea how should I increase my internet speed. One more thing, Do you know any software that might you've already used to do this instead of buying an equipment? I have already Peplink load balancer and unfortunately it does not have real-time bandwidth monitoring. |
e394ad0764155c0703a2627e1b30a5dffc9eef5bdb8f8cd2276c2cf166254339 | ['14d2694619aa41f88e5b011404e4fab9'] | Okay, so I found the cause of the problem.
Turns out it was a tap gesture that seemed to be interfering with things. To select tab bar items I had to long press. I can only assume that the short tap gesture (that was there for dismissing the keyboard) was confusing it.
Anyway, removed the tap gesture and it works fine.
| 4aa48f4b654ac519debf816108ec459a597a33e81ddea11a52da8e3e284f4a2a | ['14d2694619aa41f88e5b011404e4fab9'] | I'm an iOS lead on an app and trying to fix some API bugs whilst our dev is 'unavailable'. I'm almost completely new to Laravel and trying to check what the request method is. I have followed some guidance from another question but have been unable to get it working:
public function defaults(Request $request, User $user){
$follow_ids = explode(',', env('FOLLOW_DEFAULTS'));
if ($request->isMethod('post')) {
return ['user' => $user];
}
$user->follows()->syncWithoutDetaching($follow_ids);
return ['user.follows' => $user->follows->toArray()];
}
Do you know where I might be going wrong here? Thanks in advance.
When the request is returned it always just seems to skip over and return ['user.follows' => $user->follows->toArray()]
|
b16ddae86976e2a185d934f040ec819a0e03a3791c31a82b9be54c5ff8aec3c9 | ['14d7d7c9f99949b0948120959555d598'] | I'm currently working on an assignment that requires me to take an input file, separate it and store the contents into two different arrays.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char DataMem[32][3];
int RegMem[32][10];
char line[100][21]; //Holds the value for each line in the input file
int i = 0;
int j = 0;
while(fgets(line[i], 20, stdin) != NULL)
{
line[i++];
if(line[i] == " ")
DataMem[j] = line[i];
//printf("%s", line[3]);
}
return 0;
}
Suppose the input file looks something like:
95864312
68957425
-136985475
36547566
24957986
1
45
98
where the first values before the 1, are stored into the array named line, and the lines following the blank line need to be put into the array DataMem.
Can anyone point me into the direction as to how to do this? I can fill in the array line correctly, however I am having a hard time stopping the fill at that point and subsequently filling the rest of the file into the array datamem.
Thank you
| 36c66a00ec9685c2f6efd723d9825eb7fa977e150f1f72f638c10b2e1d2b860b | ['14d7d7c9f99949b0948120959555d598'] | Attempting to break up the line
#!/usr/bin/perl -w
with the following code
use strict;
use warnings;
my %words;
while (my $line = <>)
{
foreach my $word (split /:|,\s*|\/|!|\#|-/, $line)
{
$words{$word}++;
}
}
foreach my $word (keys %words)
{
print "$word: $words{$word}\n";
}
Is there an easier way to have the split command only split at words, numbers and underscores? Rather than setting all of these delimiters.
Attempting to get the output
usr: 1
bin: 1
perl: 1
|
d4cb271941525e9f68c380a5134be77deb348453d0ee98e1354d6633e7e9bb8e | ['14dfc9244a984c4695dee4ba6e4e4e4c'] | Do it the way Rails does it.
# rails/actionpack/lib/action_controller/metal/http_authentication.rb
def http_basic_authenticate_with(options = {})
before_action(options.except(:name, :password, :realm)) do
authenticate_or_request_with_http_basic(options[:realm] || "Application") do |name, password|
name == options[:name] && password == options[:password]
end
end
end
All that http_basic_authenticate_with does is add a before_action. You can just as easily do the same yourself:
# application_controller.rb
before_action :http_basic_authenticate
def http_basic_authenticate
authenticate_or_request_with_http_basic do |name, password|
name == 'xxx' && password == 'yyy'
end
end
which means you can use skip_before_action in controllers where this behavior isn't desired:
# unprotected_controller.rb
skip_before_action :http_basic_authenticate
| e5d960236f9b08d20c1e3c9589c64fa29400c8fe3b82df3515ce48b17c12c50c | ['14dfc9244a984c4695dee4ba6e4e4e4c'] | Checking for the prior existence of message_id seems to have solved the problem in my particular case:
after_commit on: :create do
unless self.message_id
if email = Mailer.email(self).deliver
self.update message_id: email.message_id
end
end
end
But I imagine there could be a scenario where I couldn't get away with that, so it'd still be good to understand why an on: :create callback is being called on update.
|
3d8770441f3ebef6de6a74ab9bed0a6a5c64e3aadc81c4d1d87da2f0ce2809e5 | ['14e7783aab8a45f2b8c3b5bca2d69d98'] | @JPhi1618 Curiously, the previous owners did claim that a particular switch controls it. But when I flip that switch, all I get is that another lamp in the neighboring room flickers wildly. I have no idea what that means and have been assuming it's unrelated, but if that sounds like a lead to you, I'd be happy to follow it further... | 447288fdd7f24019e606b33dbf210da0af9cd901d6cea89f5449e99542b00f17 | ['14e7783aab8a45f2b8c3b5bca2d69d98'] | I was able to get the goodle ip address, but still am having issue's connecting to the internet with either Google Chrome, or Firefox. I am still receiving the dns error. Not sure how to proceed at this point. I can still connect to my router wired, or wirelessly. |
1ab955cd41034a69f772aae8ee60684ecac99546e50cfcf0aaa03a03a849bf63 | ['150bebf6b60e4c6cbdea633362e96a1e'] | Need some help related to create a custom filter for custom app which is websocket server written in node.js . As per my understanding from other articles the custom node.js app needs to write a log which enters any authentication failed attempts which will further be read by Fail2ban to block IP in question . Now I need help with example for log which my app should create which can be read or scanned by fail2ban and also need example to add custom filter for fail2ban to read that log to block ip for brute force .
| 9bf4ad990bb76f1c276b724ef4d1b83691750f123286df833b62d97b48eb1cae | ['150bebf6b60e4c6cbdea633362e96a1e'] | Hi I am new to nginx I am tying to use the mpdule http_realip_module with similar configuration . But when I add the "real_ip_recursive on;" on restarting nginx it gives me error :- nginx: [emerg] unknown directive "real_ip_recursive"
set_real_ip_from <IP_ADDRESS>/24;
set_real_ip_from <IP_ADDRESS>;
set_real_ip_from 2001:0db8<IP_ADDRESS><PHONE_NUMBER>;
set_real_ip_from 192.168.2.1;
set_real_ip_from 2001:0db8::/32;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
The module is added i checked with nginx -v it gave me out put as follow which shows nginx :
--prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_perl_module --with-mail --with-mail_ssl_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --with-ld-opt=-Wl,-E
|
cb019f392373db199542f6e6233f602c92ffa7b55d4e23abc394fabc4729b555 | ['15139160d4e644a8b48e6c121e8fba5c'] | I am writing a code which is to copy from data from another workbook to the current open workbook. However, I am encountering the Application-defined or object-defined error which I kept thinking but unable to find a reason as to why. That is why I decided to post my problem here and hopefully get some help. Please find my code below:
Option Explicit
Sub copyDataSEA()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Dim destWs As Worksheet
Set destWs = ThisWorkbook.Worksheets("Sheet1")
Dim Report As Workbook
Set Report = Workbooks.Open(Filename:="C:\Users\John\Documents\My Docs\Report 2020 EMEA_SEA_SA Region.xlsx")
Dim sourceWs As Worksheet
Set sourceWs = Report.Worksheets("Raw")
Dim lastRow As Long
lastRow = sourceWs.Range("A" & sourceWs.Rows.CountLarge).End(xlUp).Row
Dim outRow As Long
outRow = 2
'Copying Header of source
destWs.Rows(1).EntireRow.Value = sourceWs.Rows(1).EntireRow.Value
Dim i As Long
For i = 2 To lastRow
If sourceWs.Cells(i, 6) = "INDONESIA" Or sourceWs.Cells(i, 6) = "MALAYSIA" Or sourceWs.Cells(i, 6) = "THAILAND" Or sourceWs.Cells(i, 6) = "VIETNAM" _
Or sourceWs.Cells(i, 6) = "CAMBODIA" Or sourceWs.Cells(i, 6) = "MYANMAR" Or sourceWs.Cells(i, 6) = "PHILIPPINES" Or sourceWs.Cells(i, 6) = "SINGAPORE" Then
destWs.Rows(outRow).EntireRow.Value = sourceWs.Rows(i).EntireRow.Value
outRow = outRow + 1
End If
Next i
Report.Close False
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
I am getting an error on this row
destWs.Rows(outRow).EntireRow.Value = sourceWs.Rows(i).EntireRow.Value
The value of outRow was 25728 and i was 44246 when the error encountered. The number of columns of the source document is 74518.
| 87452a11e9712afbf3c2a0b548cbcb2a376737c6e99727caa44948e93c68681d | ['15139160d4e644a8b48e6c121e8fba5c'] | I am trying to create a temporary table in postgres by copying the column names and types from an existing table.
CREATE TEMPORARY TABLE temporary_table LIKE grades;
Typing the query into Postgre, it tells me about an error in LIKE. Is "Like" keyword not usable in Postgre or am I doing something wrong?
|
4b95b7931a892868d9a813718d317f05c5e97c1f914ccad0f13e157e5dceec0e | ['1514d4bb11384fa8a3930c0476a666b7'] | I am considering the Integral $$\int_{0}^{\infty}dt\frac{e^{-t}t^{s}}{1+\lambda x t}$$
I am trying to have an asymptotic expansion of the above said integral. The process of integration by parts somehow is not working for me. If any other methods for the asymptotic expansion of the integral works, please help me out.
| 21758064abddabcaa18b358209af89973f669cc172cec7f9195b6cb2ec25f977 | ['1514d4bb11384fa8a3930c0476a666b7'] | Combining your attempt and <PERSON>'s answer this should work for you:
sudo find / -type d -exec du -h -s {} \; | grep '[0-9]G'
This is find all directories, sum the size of the files that they contain in a human readable format, and filter them for any lines that contain #G.
Couple caveats:
It will give dupes in that if a given directory has more than 1G, then all parent directories will also show in the list.
If you want to use this in the root directory you'll have adjust your System Integrity Permissions otherwise you'll get "operation not permitted" errors (even with sudo).
To adjust: System Preferences > Security & Privacy > Privacy Tab > Select Full Disk Access > + > Terminal.
Reference:
https://appletoolbox.com/seeing-error-operation-not-permitted-in-macos-mojave/
|
ab8e9847afcf66a55eea724e1cc5be002684440ef56cde48edb0fa77d50d956f | ['15226c7b3c404972a3bd6ea6ade5cdd5'] | I had an image upload script that worked on my little shared hosting, but just as I switched to Virt Ded, it immediately stopped working. After some research I determined the culprit to be the PHP function imagejpeg() - which was the last bit of code in the script.
It allows me to specify null as the filepath (in which case it prints it to the screen), but does not allow me to enter ANY filepath without return false.
Anybody know what is going on?
| c48aef753b6220ba660d00b5ab16ad674efdb57aad38ee28854a3fbaef9966fa | ['15226c7b3c404972a3bd6ea6ade5cdd5'] | I have a site that operates in different geographical locations. Some example URLs for my site would be:
http://losangeles.example.com
http://sandiego.example.com/post/blog/travel/
http://sfbay.example.com/blog/read/12/
In these examples, my URL structure is translated to the following:
http://[location code].example.com/[controller]/[event]/[extra parameters]
The script strips off the subdomain and checks it against the db for an acceptable location match, and then the blogs etc. in that location are displayed.
This is all fine and great, but now I am making a Terms of Use page, and I'd like it to have the URL:
http://about.example.com/tou
/* which is translated to: */
http://[controller].example.com/[event]
So essentially, I'd like the subdomain to sometimes be a location code and sometimes a controller.
Any idea how I might do this? Or is this just stupid?
|
dab67c861adb785c41f412ca041e343ea81534576a85ba645d34cf78c3c09323 | ['1536e495b84f43df9fe0cdc8b51510bc'] | So I wrote a python script that iterates over a list of URLs and records the time it takes to get a response. Some of these ULRs can take upwards of a minute to respond, which is expected (expensive API calls) the first time they are called, but are practically instantaneous the second time (redis cache).
When I run the script on my windows machine, it works as expected for all URLs.
On my Linux server it runs as expected until it hits an URL that takes upwards of about 30 seconds to respond. At that point the call to requests.get(url, timeout=600) does not return until the 10 minute timeout is reached and then comes back with a "Read Timeout". Calling the same URL again afterwards results in a fast, successfull request, because the response has now been cached in redis. (So the request must have finished on the server providing the API.)
I would be thankful for any ideas as to what might be causing this weird behavior.
| 8b31de394b2ee3db53d429baee4ff328746b08312fa4b2038006bf7f2bc003ad | ['1536e495b84f43df9fe0cdc8b51510bc'] | I have a small django app running inside a vagrant virtual machine. The app provides an API that is supposed to make predictions using a random forest model. The model is provided to me as an .rds file, so I have to use R to work with it.
I set up rpy2 to execute a simple R script using the model:
# R Script
make_prediction <- function() {
model <- readRDS("PATH/TO/MODEL.rds")
dfInput <- data.frame(a = 1, b = 2, c = 3)
library (ranger) # R library for random forest
prediction <- predict(model, dfInput)
return (prediction)
}
The corresponding python code looks something like this:
# Python code
from rpy2.robjects.packages import SignatureTranslatedAnonymousPackage
def predict(r_file_path):
with open(r_file_path, 'r') as f:
r_string = '\n'.join(f.read().splitlines())
self.model = SignatureTranslatedAnonymousPackage(r_string, 'model')
return self.model.make_prediction()
}
When I call the API I get a 502 Bad Gateway Error, which I have traced down to bad_alloc in the uswgi logs:
terminate called after throwing an instance of 'St9bad_alloc'
what(): std<IP_ADDRESS>bad_alloc
Fri May 5 10:13:05 2017 - DAMN ! worker 4 (pid: 2484) died, killed by signal 6 :( trying respawn ...
Fri May 5 10:13:05 2017 - Respawned uWSGI worker 4 (new pid: 2495)
Fri May 5 10:13:05 2017 - mapping worker 4 to CPUs: 1
If I vagrant ssh into the virtual machine and run the R script form the command line it executes without a problem.
Also if I change the R script by outcommenting the line prediction <- predict(modelProd, dfInput) (and just return a constant value) it works from within the django API.
So it seems to boil down to a problem with rpy2 and the model I was provided. Am I using it wrong or is this a legitimate bug / memory leak in rpy2?
|
95c82504348345000fc43f42b149982c9b7b2824b8d1dd37b9e1b83926c2daec | ['155979f9c39b4dc482cd6d04db584aed'] | Excerpt from mockup XML file:
<person>
<i>
<book>
<author id="mj">Margret Jane</author>
<author id="ms">Michael Scott</author>
<author id="sj">Sarah Jane</author>
</book>
</i>
<i>
<book>
<author id="mj">Margret Jane</author>
<author id="tw><PERSON>>
<journal>ABC</journal>
</book>
</i>
<i>
<article>
<author id="mj">Margret Jane</author>
<author id="tw">Tim Wind</author>
<journal>DEF</journal>
</article>
</i>
</person>
Say the XML file is 20x the size of this and there's over 100 variations of possible journals. Is there a way I can get all possible variations and store them in an array list? Is it possible by using XPath?
In the end I want to use it like this - where the user types a journal name and if it exists in the xml doc, the journal name will be printed:
<?php
$magazineSelect = $_GET['MagazineSelector'];
if (in_array($magazineSelect, array("ABC", "DEF", "HIJ"))) {
echo $magazineSelect;}
else {
echo "Unknown magazine - showing all results";}?>
Currently I have written out some of the possibilities by hand, but it's impossible to write out all of them.
| 4077bb2f38c4204793d09e78fe2fde346cb2396d9f46189d9a1f8616f6f765d0 | ['155979f9c39b4dc482cd6d04db584aed'] | I'm tying to create a program that will count every time someone inputs the number '100' and the program will end when '0' is inputted, but the code keeps counting '0' too.
getnumber = int(input())
result1 = 1
while True:
getnumber = int(input())
if getnumber == 100:
result1 = result1+1
if getnumber == 0:
print(result1)
What has gone wrong here?
|
0e9362b90e69eb0730bee16b3ebc0fd9646c6d42d493f5e426d7bda8716c1cf4 | ['156640de196846fabf0293d25b25b855'] | I have a content structure like this:
<a href="#" class="toggle_button">Click me.</a>
<p class="hidden_content">This content is toggleable.</p>
<a href="#" class="toggle_button">Click me.</a>
<p class="hidden_content">This is a different section.</p>
<a href="#" class="toggle_button">Click me.</a>
<p class="hidden_content">This section is also different.</p>
I have already discovered how to make this work with one section, but how can I make it so that when I click on a toggle_button it opens only the nearest hidden_content class.
| d9a79f95ab24716fe6c2982256ae8d97fa7a75ad915cb4d8ac482fb26123f1af | ['156640de196846fabf0293d25b25b855'] | NOTE: I am not in any way asking whether or not I should learn JavaScript before jQuery. I understand that jQuery is simply a framework for JavaScript and as such JavaScript should be learned first.
I currently know HTML and CSS and I'm looking to expand into JavaScript. I have used several resources from tuts+ to treehouse to learn HTML and CSS, but recently I stumbled across a website called code school that I really enjoy using.
When I go to their JavaScript section, it appears they skip JavaScript all together and jump right into jQuery. My question is - should I learn JavaScript on some other website before learning jQuery on code school? Or do you think it's a good idea to just learn jQuery right out of the gate like they basically force you to do on their site?
|
d19271a999dfe29c021b5aa85dc538c09fa7a0cdb721f01208dbdb86c05a9da2 | ['15873ad4ca224f7cab717ec30aa9e309'] | Problem: Suppose $R$ is a finite (associative) ring with 1 such that every unit of $R$ has order dividing 24. Classify all such $R$.
My attempt: I had to quotient out the jacobson radical $J(R)$ so that since $R$ is finite and hence artinian, $R/J(R)$ is semisimple. Hence, $R/J(R)$ is a product of matrix rings, and by analyzing their general linear groups (and using the fact that all the units have order dividing 24) I am able to classify all such $R/J(R)$.
But now I am stuck. I have no clue how to go from $R/J(R)$ to $R$. I have no information about $J(R)$. My brainstorming has this to say: Since $R$ is artinian, $J(R)$ is the double sided ideal of all nilpotent elements. Also, $\forall x \in J(R)$, $1+x$ is a unit. This defines an injective map from $J(R)$ to the set of units in $R$. But this is not a group homomorphism, so I cannot take advantage of the fact that the units have order dividing $24$.
| 2dcab8dda4735e95f2baa1ba56a47a18d3edbc26447486ac946eacf58fb93ddd | ['15873ad4ca224f7cab717ec30aa9e309'] | I'm preparing for an analysis qualifying exam so I am answering some old exam questions. Here's part of one stated below:
Suppose that $(X, \mathcal{B}, \mu)$ is a finite measure space, and that $\{f_n\}_{n \geq 1}$ and $f$ are measurable functions on $X$ such that $f_n \rightarrow f$ a.e.
Suppose there exists $C < \infty$ such that $\int f_n^2 d\mu \leq C$ for all $n \geq 1$. Show that $f_n \rightarrow f$ in $L^1$
I got to the point where I proved that $\{f_n\}$ and $f$ are $L^1$ functions whose integral is bounded by some $M < \infty$, taking into account that these functions possibly map to $\mathbb{C}$. So at the very least these functions exist in $L^1$ space.
|
0966149e5e7ef698ec5ca1df1c7f033a94434df52ad983eaff5191604a203ebb | ['1589a574be394489a5bf2b2ddd7189d2'] | I have a php page where I load stripe checkout buttons for 12 subscription options. The page takes up to 10 seconds to load. Is there a way to speed it up?. I can't demonstrate it as it requires the user to be logged in before the buttons will load.The code that loads the buttons is in a for loop and looks like this:
<form action="https://www.example.com/plans/subscribe.php" method="post">
<input type="hidden" name="customer" value="<? echo $stripeID ?>">
<input type="hidden" name="plan" value="<? echo $thisPlan['id'] ?>">
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="<?php echo $stripe['publishable_key']; ?>"
data-name="www.breakoutwatch.com"
data-image="https://www.example.com/images/eyeLogo.png"
data-description="<? echo $thisPlan['name'] ?>"
data-amount="<? echo $thisPlan['amount'] ?>"
data-locale="auto"
data-panel-label="Subscribe Now"
data-label="Subscribe"
data-allow-remember-me="false">
</script>
</form>
| 100bf876a780d60c35d47ae1873b96ce997b6448d9d4fbcb937fde0d80afacc0 | ['1589a574be394489a5bf2b2ddd7189d2'] | I am instantiating stripe with composer and attempting to subscribe a customer to a subscription plan in test mode using the card number 4000 0000 0000 0341. The documentation says this will be accepted but then throw an error when used to create a subscription. My questions is, why does the create subscription step always return success with this card number?
My charge code is
<form action="subscribe.php" method="post">
<input type="hidden" name="customer" value="<? echo $stripeID ?>">
<input type="hidden" name="plan" value="<? echo $thisPlan['id'] ?>">
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="<?php echo $stripe['publishable_key']; ?>"
data-name="www.example.com"
data-description="<? echo $thisPlan['name'] ?>"
data-amount="<? echo $thisPlan['amount'] ?>"
data-locale="auto"
data-panel-label="Subscribe Now"
data-label="Subscribe"
data-allow-remember-me="false">
</script>
</form>
and my subscribe.php is
try {
$result = \Stripe\Subscription<IP_ADDRESS>create(array(
"customer" => $_POST['customer'],
"plan" => $_POST['plan']
));
echo "Subscription successful";
}
catch (Stripe\Error\Base $e) {
// Code to do something with the $e exception object when an error occurs
echo($e->getMessage());
} catch (Exception $e) {
// Catch any other non-Stripe exceptions
}
|
033452e19c5473605178bbfe0f8ab68d96c01c1ed816f00bbb694816adf27a02 | ['1599a09cfeb640b0ad61baf3920161f0'] | I want to try the bidirectional_rnn to predict time series. code is :
#BiRNN_model.py
import tensorflow as tf
class BiRNN(object):
"""
a bidirection RNN
"""
def __init__(self, in_size, out_size, num_steps=20, cell_size=20, batch_size=50,
num_layers=2, keep_prob=0.5, is_training=True):
"""
:param in_size: int, the dimension of input
:param out_size: int, the dimension of output
:param num_steps: int, the number of time steps
:param cell_size: int, the size of lstm cell
:param batch_size: int, the size of mini bacth
:param num_layers: int, the number of cells
:param keep_prob: float, the keep probability of dropout layer
:param is_training: bool, set True for training model, but False for test model
"""
self.in_size = in_size
self.out_size = out_size
self.num_steps = num_steps
self.cell_size = cell_size
self.batch_size = batch_size
self.num_layers = num_layers
self.keep_prob = keep_prob
self.is_training = is_training
self.__build_model__()
def __build_model__(self):
"""
The inner method to construct the BiRNN model.
"""
# Input and output placeholders
self.x = tf.placeholder(tf.float32, shape=[None, self.num_steps, self.in_size])
self.y = tf.placeholder(tf.float32, shape=[None, self.num_steps, self.out_size])
# Add the first input layer
with tf.variable_scope("input"):
# Reshape x to 2-D tensor
inputs = tf.reshape(self.x, shape=[-1, self.in_size]) # [batch_size*num_steps, in_size]
W, b = self._get_weight_bias(self.in_size, self.cell_size)
inputs = tf.nn.xw_plus_b(inputs, W, b, name="input_xW_plus_b")
# inputs = tf.matmul(inputs,W)+b
# Reshep to 3-D tensor
#inputs = tf.reshape(inputs, shape=[-1, self.num_steps, self.cell_size]) # [batch_size, num_steps, in_size]
inputs = tf.reshape(inputs, shape=[-1, self.in_size])
# Dropout the inputs
if self.is_training and self.keep_prob < 1.0:
inputs = tf.nn.dropout(inputs, keep_prob=self.keep_prob)
#Construct birnn cells
biRNN_fw_cell = tf.contrib.rnn.BasicRNNCell(num_units = self.cell_size)
biRNN_bw_cell = tf.contrib.rnn.BasicRNNCell(num_units = self.cell_size)
if self.is_training and self.keep_prob < 1.0:
fw_cell = tf.contrib.rnn.DropoutWrapper(biRNN_fw_cell, output_keep_prob=self.keep_prob)
bw_cell = tf.contrib.rnn.DropoutWrapper(biRNN_fw_cell, output_keep_prob=self.keep_prob)
cell_Fw = tf.contrib.rnn.MultiRNNCell([fw_cell] * self.num_layers)
cell_Bw = tf.contrib.rnn.MultiRNNCell([bw_cell] * self.num_layers)
#the initial state
self.init_state_fw = cell_Fw.zero_state(self.batch_size, dtype=tf.float32)
self.init_state_bw = cell_Bw.zero_state(self.batch_size, dtype=tf.float32)
#add biRNN layer
with tf.variable_scope("BRNN"):
outputs,final_state_fw,final_state_bw = tf.contrib.rnn.static_bidirectional_rnn(cell_Fw,cell_Bw,inputs,
initial_state_fw =self.init_state_fw,
initial_state_bw = self.init_state_bw
)
self.final_state_fw = final_state_fw
self.final_state_bw = final_state_bw
# Add the output layer
with tf.variable_scope("output"):
output = tf.reshape(outputs, shape=[-1, self.cell_size])
W, b = self._get_weight_bias(self.cell_size, self.out_size)
output = tf.nn.xw_plus_b(output, W, b, name="output")
self.pred = output
losses = tf.contrib.legacy_seq2seq.sequence_loss_by_example([tf.reshape(self.pred, [-1, ])],
[tf.reshape(self.y, [-1, ])],
[tf.ones([self.batch_size * self.num_steps])],
average_across_timesteps=True,
softmax_loss_function=self._ms_cost)
self.cost = tf.reduce_sum(losses) / tf.to_float(self.batch_size)
def _ms_cost(self, y_pred, y_target):
"""The quadratic cost function"""
return 0.5 * tf.square(y_pred - y_target)
def _get_weight_bias(self, in_size, out_size):
"""
Create weight and bias variables
"""
weights = tf.get_variable("weight", shape=[in_size, out_size],
initializer=tf.random_normal_initializer(mean=0.0, stddev=1.0))
biases = tf.get_variable("bias", shape=[out_size, ], initializer=tf.constant_initializer(0.1))
return weights, biases
but, if i run the code ,this is a error that:
File "../model/BiRNN_model.py", line 70, in build_model
initial_state_bw = self.init_state_bw
File "/home/lucas/.local/lib/python3.5/site-packages/tensorflow/contrib/rnn/python/ops/core_rnn.py", line 328, in static_bidirectional_rnn
raise TypeError("inputs must be a sequence")
TypeError: inputs must be a sequence
the inputs parameter in static_bidirectional_rnn is not a sequence. I'm new for tensorflow and Deep Learning, I have spent many days to try to fix this error, but i failed. Can someone to help me? thx.
| d068a1a99c800f0a3391f86f28038d2a1bdef4ab33e72e8d254d05e03176aeb7 | ['1599a09cfeb640b0ad61baf3920161f0'] | I have the latest mac pro(OS:10.12.2) ,with intel intergrated GPU HD 530(Gen9) which runs the OpenCL code. In my OpenCL code, I use vloadx and atomic_add instruction. change my OpenCL kernel code into bitcode like https://developer.apple.com/library/content/samplecode/OpenCLOfflineCompilation/Introduction/Intro.html#//apple_ref/doc/uid/DTS40011196-Intro-DontLinkElementID_2
. and create the program with clCreateProgramWithBinary. But when clBuildProgram, it returns error with -11 .and build log is "
error: undefined reference to _Z6vload2mPKU3AS1h()'
undefined reference to_Z8atom_addPVU3AS3ii()'
"
But in my mac air with HD 5500(Gen8), the code is ok.
Can someone tell me what should I do?
|
4954928dd7e88554ed4432862d7a91af0279433952f2cb992c09d945ce87e68f | ['159bf4ff5dc0422083272fbc2d11440b'] | regarding to documentation of how to manage repos you cannot
You cannot remove a repo if it is the only Git repo in the Team Project. If you need to delete the only Git repo in a Team Project, create a new Git repo first, then delete the repo.
You must have Delete Repository permissions to delete a repo from a team project.
take a look for this link : https://www.visualstudio.com/en-us/docs/git/delete-existing-repo
| 8a64ee75d7d1eb86f1f9fd106142de964df2e7d45fcaed88493e1e6e6ab2dce5 | ['159bf4ff5dc0422083272fbc2d11440b'] | thanks for reply guys,
i just discover the problem it was little strange.
actually when i define these fields (which will filled by ajax call), i define it as the following :
@Html.EditorFor(model => model.CurrentLoyalPoints, new { htmlAttributes = new { @class = "form-control", @disabled = "disabled", @PlaceHolder = Resources.Captions.CurrentLoyalPoints} }) ,
and the issue is using the disabled, i just replace it with @readonly = "readonly".
Things work very fine now as expected.
|
925154ebacdecfa9fbf64e6605b45cbd11a7130947d8c8b56f7de8d517f115e2 | ['15a0037b18174d689755f551d4206fa6'] | Dei uma lida na documentação, o Guzzle espera o username no index(0) e a senha no index(1) do método Auth. Apenas removi os campos "username" e ''password'', deixando apenas os valores dos mesmo. Funcionou, mas agora estou com um erro de SSL certificate, mas acredito ter a ver com a rede interna que utilizo. No mais, resolveu meu problema :-) | 2520d4622993da1bc306b9354d1377e7b29c90de45a6dabf07110eae51338789 | ['15a0037b18174d689755f551d4206fa6'] | Meu sistema consiste em uma tela principal, a qual possui um scroll-pane que estou populando com uma lista de outras cenas FXML, código do qual peguei em um exemplo na internet, segue o código:
@FXML
private Label label;
@FXML
private VBox pnl_scroll;
@FXML
private void handleButtonAction(MouseEvent event) {
refreshNodes();
}
@Override
public void initialize(URL url, ResourceBundle rb) {
refreshNodes();
}
private void refreshNodes() {
pnl_scroll.getChildren().clear();
Node[] nodes = new Node[15];
for (int i = 0; i < 10; i++) {
try {
nodes[i] = (Node) FXMLLoader.load(getClass().getResource("Item.fxml"));
pnl_scroll.getChildren().add(nodes[i]);
} catch (IOException ex) {
Logger.getLogger(HomeController.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
O problema é, preciso setar os dados de cada item.fxml do scroll-pane antes de adiciona-los, como posso fazer isso?
Obrigado!
|
5093e366c3e1e135f0a5311abe525acc0cae039e0c03657a5816054796f2ab81 | ['15b59b53c1214e80b0ffde3e4514e115'] | I'm trying to make a 2D top-down perspective game in which I want to try and implement a shoving mechanic as a way of the player interacting with the environment or even enemies, but I can't seem to nail down the physics behind it.
(Player object (P) and interactive object (O))
My Question is: what is necessary to make this work properly? I've tried a few things out, such as having the information to add the force to the Rigidbody2D on P first and then on O and I'm trying to get it so that the player pushes the object in the direction it's facing, which I have a script for transform.up to face the mouse. I did also try to implement a dash mechanic to see if it would push an object further, however the physics meant that P would dash in a random direction as opposed to being towards the mouse
| 8092e7fb6019efd83a7733ecad6f14c65876320b7db92a816f669b83563de64a | ['15b59b53c1214e80b0ffde3e4514e115'] | I'm currently looking at getting a soundboard in Discord.js by using emojis to act as the controls to the soundboard, it should then respond with an appropriate sound based on the emoji sent. However, I'm having issues with at least testing if I can receive different types of emojis based on the emojis array.
main.js
var soundBoard;
client.on('message', async message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
switch (command) {
...
case 'soundboard':
client.commands.get('soundboard').execute(message, args, soundBoard);
break;
...
}
}
soundboard.js
module.exports = {
name: 'soundboard',
description: "Soundboard",
async execute(message, args, sb) {
const emojis = [
'',
'✋'
];
if (!sb) {
sb = await message.channel.send('Soundboard Active');
const filter = (reaction, user) => {
return emojis.includes(reaction.emoji.name);
};
sb.awaitReactions(filter)
.then(collected => {
console.log("Collected: " + collected);
sb.react('✅');
})
.catch(console.error);
for (let e of emojis) {
sb.react(e);
}
}
else {
console.log(sb);
}
}
}
sb is passed from a global variable declared in my main.js. Unfortunately at the moment all that seems to happen is the message appears but whenever I click the emojis to respond the expected result of adding a ✅ to the original message fails.
|
50f81c6281afbe3f0aa2532f48753e4dcffdb5c4ab3bc250a7771eec17cac792 | ['15cca6e8a8d14876950f13651eea86e9'] | I want to refer users to a custom page upon 401/404 errors etc using something like the fragment code.
I want to use one page ie error.html
that calls elements specific to that error, ie
error.html#401
without having to create error401.html, error404.html etc - however I can't seem to use the fragment code to this effect.
i have been trying:
<a name="401">
<title>401 - Authorisation Required</title>
<h1>Authorisation Required</h1>
<p>
<h2>Blah blah sorry</h2>
</a>
<a name="404">
...etc
</a>
Does anyone have any tips?
Thanks!
| df7f1299634b9be34729fe7d81b780aac42f78b1fc03f41b90c40c03ffb9d42b | ['15cca6e8a8d14876950f13651eea86e9'] | I run a site that redirects to a 'We're Sorry' page for users of IE 7 or less until I create a IE downgraded version of the website.
What I really want is a button on the page that when pressed, sends an email to me with the users operating system and browser version.
Any ideas how I could make this happen?
|
7dc4bda38179e9e67abdb7a08c4558847f1e2ea83b7c5bfe1eb192e563676d8f | ['15dea93376d34890959efe892a2c604c'] | I have tried successfully to add all the cell number in a table. What I want to do is to add on the cell which will be checked (using a check box).
I want to do it using JavaScript
/here is the code/
<html>
<head>
</head>
<body>
<form name="addValue">
<table id="countit" border="1px">
<tr>
<td><input type="checkbox" name="choice"/></td>
<td>Some value</td>
<td>Some value</td>
<td class="count-me">12</td>
</tr>
<tr>
<td><input type="checkbox" name="choice"/></td>
<td>Some value</td>
<td>Some value</td>
<td class="count-me">2</td>
</tr>
<tr>
<td><input type="checkbox" name="choice"/></td>
<td>Some value</td>
<td>Some value</td>
<td class="count-me">17</td>
</tr>
</table>
</form>
<script language="javascript" type="text/javascript">
function myFunction()
{
var tds = document.getElementById('countit').getElementsByTagName('td');
var sum = 0;
for(var i = 0; i < tds.length; i ++) {
if(tds[i].className == 'count-me'){
sum += isNaN(tds[i].innerHTML) ? 0 : parseInt(tds[i].innerHTML);
}
}
document.getElementById('countit').innerHTML += '<tr><td>' + sum + '</td><td>total</td></tr>';
}
</script>
<button onclick="myFunction()">Click me</button>
</body>
</html>
| ffcca1b2a667ec9b9e71ad27089392df6f767f44e4ee5093e7f9154e67ceeac3 | ['15dea93376d34890959efe892a2c604c'] | Dear ALL I am java developer and I would like to understand properly the use of SPring?Hibernate?Struts?EJB? 1. Before LEarning Spring is it a matter to know about EJB, or JavaBeans? 2.I realy want to know Spring and always get stacked?is there an efficient way to learn it or could you please provide some link or website5(free or not). 3.which framework is the best today to work with java?
Thank all..
|
49f96edb9e7aaf68d0dd38d1b7524746296b4be0ff541123785c980e5f8963b3 | ['15f1c853b7f64b0b8c678ecae50aff97'] | I am trying to open links from UIWebView and open it to the another app.
I'm testing it first on social media, Facebook and Twitter are working well but Instagram and Youtube are not. See my code below.
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if (navigationType == UIWebViewNavigationTypeLinkClicked ) {
if ([request.URL.scheme isEqualToString:@"https"]) {
if ([request.URL.host isEqualToString:@"www.facebook.com"]) {
NSLog(@"FB FROM WEBVIEW BUTTON");
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"fb://profile/FlawlessFaceandBody"]];
}
else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.facebook.com/FlawlessFaceandBody/"]];
NSLog(@"No FB APP");
}
[self homepage];
}
return YES;
}
else if ([request.URL.scheme isEqualToString:@"https"]) {
if ([request.URL.host isEqualToString:@"twitter.com/myflawless"]) {
NSLog(@"TW FROM WEBVIEW BUTTON");
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"twitter://"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"twitter://profile/myflawless"]];
}
else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://twitter.com/myflawless?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor"]];
NSLog(@"No TW APP");
}
[self homepage];
}
return YES;
}
else if ([request.URL.scheme isEqualToString:@"https"]) {
if ([request.URL.host isEqualToString:@"instagram.com/myflawless"]) {
NSLog(@"IG FROM WEBVIEW BUTTON");
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"instagram:/user/"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"instagram://profile/myflawless"]];
}
else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.instagram.com/myflawless/"]];
NSLog(@"No IG APP");
}
[self homepage];
}
return YES;
}
}
else if ([request.URL.scheme isEqualToString:@"https"]) {
if ([request.URL.host isEqualToString:@"youtube.com/FlawlessFaceandBody"]) {
NSLog(@"YT FROM WEBVIEW BUTTON");
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"youtube://"]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"youtube://profile/FlawlessFaceandBody"]];
}
else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.youtube.com/user/FlawlessFaceandBody"]];
NSLog(@"No YT APP");
}
[self homepage];
}
return YES;
}
return YES;
}
Also, after this I will try opening different chosen links from UIWebView and pass it to Safari, I hope you can give answers for this as well.
Thanks!
| a642649b0ef325a97b0b1129789d16b9dc82ea0741f97477591c6b16c524c358 | ['15f1c853b7f64b0b8c678ecae50aff97'] | I'm trying to upload my app to itunesconnect using my xCode but I'm stuck with 2 Errors "The port of Signiant is unknown" and "ERROR ITMS-90096" (It says my binary is not optimized for iPhone 5, and is telling about Launch Images). All my Launch Images are working well in all devices, I don't know what's wrong.
Please see the image below:
|
70600d0c4cd729ee25664d696ece2827dff7b62a4270782d431cf7a2ea541db3 | ['15fa5274b32a47c7bb16259c0a7b0115'] | String.split splits the given string using a delimiter and stores it in an array. In your case, its space. So using it on the 2nd line would provide you this array s[] = { 1300, 1500, 1200, 1600, 1800, 900, 1400 }
From javadoc
String.split(String regex)
Splits this string around matches of the given regular expression.
(Next time read the docs)
| db4f42bd2610ae9ca517adf4562c4e75774e7fdd76b3f489de3490b201406e27 | ['15fa5274b32a47c7bb16259c0a7b0115'] | I can't find the answer to my question because I don't know how to form the right question. With my current code, my gridview has its own scroll and the imageview is fixed (1st link). How can I make it so that the view outside the GridView or ListView moves with it while scrolling? (2nd link).
http://i.stack.imgur.com/llWhI.png
http://i.stack.imgur.com/neroJ.png
|
556aee732930e38b0b2ad1cd2286b83266fd488534ce381ff208e34e847f7d0f | ['16014491522d483da8912067e9f7d285'] | Historically, satellite uplinks used to provide high bandwidth ( but also high latency ) compared to trans oceanic cables, so at some point, it would have been somewhat likely that trans oceanic traffic would use such a route. With the proliferation of fiber, that isn't really true these days. Also there is a *big* difference between a satellite relay and say, unencrypted local wifi, which I'm guessing is the kind of thing this classmate was alluding to. | c340bdd8ebf582f2425ed293035977a038879ce329adbd0967e1a48309e8f268 | ['16014491522d483da8912067e9f7d285'] | @BonGart, then the bios needs to spin it in order to find the boot loader. Mine seems to do that though I wish it wouldn't since my OS is on an SSD and it is my old HDs that I rarely use now that I like to keep spun down. |
9138a7ad6bfa8c88f55cce0a630f630999113d13ecd2587c0b7c79966e30618e | ['160506b5149e4dd080433944ff4c17d1'] | i am aware of android BROADCAST_PACKAGE_REMOVED for notify when any application is uninstalling from device.
Now it is possible that when i uninstall one application and that application do some work before and uninstall.
e.g: my application work with android contact if application uninstall at that time i want to change in contact data.
can i get any event for uninstalling app?
Thanks.
| 3cee9020ac0abfaa1d0a4b2b976269078d9e8d36b46963bf7be78e4940cb9643 | ['160506b5149e4dd080433944ff4c17d1'] | Thank you very much for the answer. I am able to ssh from one VM to another VM, but I couldn't telnet from one VM to another VM on port 32000-32200. While running my program, I checked the output of netstat -ant command. The server is showing the status of tcp port 32000 as LISTEN. The client is showing the corresponding status as SYN_SENT. So, I assume the server is listening, but they couldn't establish connection due to some reason. |
eac0cb91724bf31856aabc07ad96bdac4a634e0ca2825798dc49f9f65ab0f442 | ['160ec7042479452bb09c8650cd50fc30'] | So your Model Class is just like:
public class Example {
@SerializedName("name")
@Expose
private String name;
@SerializedName("height")
@Expose
private String height;
@SerializedName("mass")
@Expose
private String mass;
@SerializedName("films")
@Expose
private List<String> films = null;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getHeight() {
return height;
}
public void setHeight(String height) {
this.height = height;
}
public String getMass() {
return mass;
}
public void setMass(String mass) {
this.mass = mass;
}
public List<String> getFilms() {
return films;
}
public void setFilms(List<String> films) {
this.films = films;
}
}
And yes, You can go with Retrofit. It will be easy and efficient.
| a90940972174c888bede8ee54ef611ec818a63a3b3cdb27dfd9e99a1b250d921 | ['160ec7042479452bb09c8650cd50fc30'] | May this helpful to you....
With Join of Three Tables
public function get_details_beetween_dates()
{
$from = $this->input->post('fromdate');
$to = $this->input->post('todate');
$this->db->select('users.first_name, users.last_name, users.email, groups.name as designation, dailyinfo.amount as Total_Fine, dailyinfo.date as Date_of_Fine, dailyinfo.desc as Description')
->from('users')
->where('dailyinfo.date >= ',$from)
->where('dailyinfo.date <= ',$to)
->join('users_groups','users.id = users_groups.user_id')
->join('dailyinfo','users.id = dailyinfo.userid')
->join('groups','groups.id = users_groups.group_id');
/*
$this->db->select('date, amount, desc')
->from('dailyinfo')
->where('dailyinfo.date >= ',$from)
->where('dailyinfo.date <= ',$to);
*/
$q = $this->db->get();
$array['userDetails'] = $q->result();
return $array;
}
|
cb33b5c452cf1a16119b3f8b9f54cb17bedf20a715c7dc9a6ccc3a96ba0d0f47 | ['161214657df6457b91fab8bee9f7b1ae'] | VSCode mainly saves all of the preferences and user choices in the settings.json file. Moreover, you can actually set your preferences in VSCode Settings. But if you want to copy/paste your workspace settings to different workspaces, I guess the best choice would be to look at your settings.json layout settings.
Go to File > Preferences and adding them in the right pane, in "User Settings" if you want to keep them for all workspaces or in "Workspace Settings" for this workspace only.
To see settings for layouts and explorer, search for explorer.
You can read more about settings.json defaults and attributes exposed here
| e16c8974d19d22dcff4d8518a3d50cfdd4a0f7b9a95787206d4c20093f5a0bf4 | ['161214657df6457b91fab8bee9f7b1ae'] | I am migrating from ruby-2.5.7 to jruby-<IP_ADDRESS>, when I run bundle install after the changing ruby-version & gemfile I get an error in pg-gem.
Installing pg 1.2.3 with native extensions
Gem<IP_ADDRESS>Ext<IP_ADDRESS>BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/kush/.rvm/gems/jruby-<IP_ADDRESS>/gems/pg-1.2.3/ext
/Users/kush/.rvm/rubies/jruby-<IP_ADDRESS>/bin/jruby -I
/Users/kush/.rvm/rubies/jruby-<IP_ADDRESS>/lib/ruby/stdlib -r
./siteconf20200707-6808-16ipijl.rb extconf.rb
checking for pg_config... yes
Using config values from /usr/local/bin/pg_config
RuntimeError: The compiler failed to generate an executable file.
You have to install development tools first.
try_do at
/Users/kush/.rvm/rubies/jruby-<IP_ADDRESS>/lib/ruby/stdlib/mkmf.rb:456
try_link0 at
/Users/kush/.rvm/rubies/jruby-<IP_ADDRESS>/lib/ruby/stdlib/mkmf.rb:541
try_link at
/Users/kush/.rvm/rubies/jruby-<IP_ADDRESS>/lib/ruby/stdlib/mkmf.rb:556
<main> at extconf.rb:40
*** extconf.rb failed ***
I have already installed developer-tools & also have Xcode in my mac.
Any help is highly appreciated!
|
748a1c1e2270bc1d8cb4c5d70b5b9c2149310e895f19a11c1faaf303a75c4638 | ['161d9441eb1a4974b7d7a072e762a676'] | I'm having trouble updating my WPF-Window-Forms.
Basically, I want to trigger different content in my "Console-TextBox" depending on the current connected Network-SSID.
[xml]$xaml = Get-Content -Path $PSScriptRoot\Pattern.xaml
$manager = New-Object System.Xml.XmlNamespaceManager -ArgumentList $xaml.NameTable
$manager.AddNamespace("x", "http://schemas.microsoft.com/winfx/2006/xaml");
$xamlReader = New-Object System.Xml.XmlNodeReader $xaml
[Windows.Markup.XamlReader]<IP_ADDRESS>Load($xamlReader)
}
$window = Load-Xaml
$textbox = $window.FindName("textbox")
$textbox_console = $window.FindName("textbox_console")
Get-EventSubscriber | Unregister-Event
Register-EngineEvent -SourceIdentifier 'MyEvent' -Action {$textbox_console.Text += "ManualInput"}
$networkChange = [System.Net.NetworkInformation.NetworkChange];
Register-ObjectEvent -InputObject $networkChange -EventName NetworkAddressChanged -SourceIdentifier NetworkChanged -Action {
$textbox_console.Text += "`nNetworkChanged"
}
$textbox.Add_TextChanged({
New-Event -SourceIdentifier 'MyEvent'
})
$window.ShowDialog() | Out-Null
XAML:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Pattern" Width="600" Height="400" WindowStyle="None" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen">
<StackPanel>
<TextBox x:Name="textbox" HorizontalAlignment="Left" Height="70" Margin="124,104,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="262"/>
<TextBox x:Name="textbox_console" HorizontalAlignment="Left" Height="70" Margin="124,104,0,0" TextWrapping="Wrap" Text="console" VerticalAlignment="Top" Width="262"/>
</StackPanel>
</Window>
I'm new to Event Handling and not sure whether this issue is caused by Thread/Process-handling or wrong EventHandling...
Maybe somebody could point out some hint and tell me, how to use the NetworkChange-Event to update the text of the textbox?
| 880fcf15545cd247dfba01ea6a027a101e18becdb5581b635b5cb3dfdac0da46 | ['161d9441eb1a4974b7d7a072e762a676'] | I'm pretty new to docker containers and played around a little bit.
During this, I played with portainer too and was wondering, how to create own App Templates without uploading files to GitHub.
Is there any Container Software?
Searching for a container local store where I can "upload" my docker-compose files to.
So I only need to change the Repository Link at Template creation in portainer.
Thanks
|
4a5e2c35899bbce428da628e89f8a70d33a3b867eb02737ca020fdf01add551f | ['162f9d70d6594c2bb5d7dea42c135ce8'] | i have just a problem with my MKPolyLineView. I simply try to make a color gradient to the Polyline, but with CAGradient it doenst work. I subclasses MKPolylineView and redrawing in
- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context
UIColor *darker = [UIColor blackColor];
CGFloat baseWidth = self.lineWidth / zoomScale;
// draw the dark colour thicker
CGContextAddPath(context, self.path);
CGContextSetStrokeColorWithColor(context, darker.CGColor);
CGContextSetLineWidth(context, baseWidth * 1.5);
CGContextSetLineCap(context, self.lineCap);
CGContextStrokePath(context);
// now draw the stroke color with the regular width
CGContextAddPath(context, self.path);
CGContextSetStrokeColorWithColor(context, self.strokeColor.CGColor);
CGContextSetLineWidth(context, baseWidth);
CGContextSetLineCap(context, self.lineCap);
CGContextStrokePath(context);
[super drawMapRect:mapRect zoomScale:zoomScale inContext:context];
}
but even that is not working (StrokeColor = red). Any ideas how to get a gradient into
the Polyline? (Highcolor, centercolor, lowcolor)
Thanks everyone.
| 50399067ddfb4d67ecdf2b25660bf76353f9b145c38388c6c03443268093308a | ['162f9d70d6594c2bb5d7dea42c135ce8'] | i have a issue with my rails code, i try to create a new location based on the input.
So the create method looks like this:
def create
@location = Location.new(params[:location])
respond_to do |format|
if @location.save
# format.html { redirect_to @location, notice: 'Location was successfully created.' }
format.html { redirect_to admins_root_path, notice: 'Location was successfully created.' }
format.json { render json: @location, status: :created, location: @location }
else
format.html { render action: "new" }
format.json { render json: @location.errors, status: :unprocessable_entity }
end
end
end
It ends up with the following error output:
undefined local variable or method `admins_root_path' for #<LocationsController:0x007fa18917f278>
app/controllers/locations_controller.rb:47:in `block in create'
app/controllers/locations_controller.rb:45:in `create'
Any help would be very helpful.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.