input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Reset select border radius on Chrome (Mac) <p>I am trying to reset the <code>border radius</code> of <code>select</code> tag in chrome (Mac) but its still showing after applying my <code>CSS</code>, how do I reset the <code>border-radius</code> in chrome (mac), it works fine in windows and fireFox in Mac.</p>
<p>Here ... | <p>Try adding this to your css, and style select then according to your needs.</p>
<pre><code>-webkit-appearance: none;
</code></pre>
|
Where to find auth.token data, inside firebase objects <p>I am using <code>signInWithCustomToken</code>, after authentication I can not find where is stored my custom claims data which I have set in the server side(createCustomToken).</p>
<p>I can see them in firebase rules via auth.token, but how can I access them t... | <p>The information in the token is not automatically available to your application code. But it is embedded in the token, so you can decode it yourself:</p>
<pre><code>function parseJwt (token) {
var base64Url = token.split('.')[1];
var base64 = base64Url.replace('-', '+').replace('_', '/');
return JSON.pa... |
Creat treeview array or sub array <p>These are the data as they are in mysql table</p>
<p>Table A (Tasks)</p>
<pre><code>task_id | name | description
-----------------------------
1 | soccer| fora
-----------------------------
2 | sussam| forb
-----------------------------
3 | sosssi| forc
-----... | <p>You can do it following way but it is not good for performance. I don`t know exact requirement and fretwork are you using. So i am giving basic idea.</p>
<pre><code>$sqlparent = "select * from tasks";// get your task details from database.
$parentData = $sqlparent;// result from sql function.
foreach($parentData as... |
Calling SQL Server stored procedure from vb.net 2008 error <p>I am trying to execute a SQL Server stored procedure from vb.net 2008. But I get the error </p>
<blockquote>
<p>Procedure or function 'Sp_Messages_Display' expects parameter '@MsgSno', which was not supplied.</p>
</blockquote>
<p>Here is my code</p>
<pr... | <p>You need to add parameters to the <code>Command</code>, the <code>CreateParameter</code> only creates a new instance without adding it to the collection of the <code>Command</code>:</p>
<pre><code>With Com
CommandType = ADODB.CommandTypeEnum.adCmdStoredProc
.CommandText = "Sp_Messages_Display"
.Paramete... |
Create database in mongoDB using php <p>I am on mongoDB 3 and php version 5.6. I want to create a database for adding data in it. I am trying in this way. </p>
<pre><code><?php
require 'vendor/autoload.php';
// connect to mongodb
$db = new MongoDB\Client("mongodb://localhost:27017");
echo "Connecte... | <p>I hope you have installed Mongodb driver for PHP and you are not receiving any exception while executing your code.<br><br></p>
<p><strong>After the db connection is established you need to save something in collection so that the db comes to existence. This is missing in your code.</strong><br><br></p>
<p>Try be... |
YII2 UrlManager wrong route <p>On my site I have this urlManager rule:
<code>'city/<id:\d+>-<alias:\S*>' => 'city/view'</code>,
On page of module "user", for example this <a href="https://example.com/user/profile" rel="nofollow">https://example.com/user/profile</a>, there is a link for rule </p>
<pre><c... | <p>You need to add module ID in the route as well. In the simplest case it's</p>
<pre><code>'user/city/<id:\d+>-<alias:\S*>' => 'user/city/view'
</code></pre>
<p>If there are more than one module using similar route you can use wildcard</p>
<pre><code>'<module>/city/<id:\d+>-<alias:\S*&... |
Why is code first migrations changing table name? <p>I am trying to make a forein key relation (one ---to----many)</p>
<p>And have the applicationUser have a foreinKey to an existing person table.</p>
<p>my code.</p>
<pre><code>public class ApplicationUser : IdentityUser
{
[Required]
public long PersonId { ... | <p>By default Entity Framework pluralizes the entity name to name the DB table. You can switch off this behavior in the <code>OnModelCreating</code> method by adding the following code:</p>
<pre><code>modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
</code></pre>
|
Javascript smooth window scrolling via scrollbar <p>I would like my webpage to have smooth browser scrolling via the window scrollbar. That is, if you drag the window scroll bar down and stop, I want the webpage to start scrolling immediately and then decelerate to the stop point.</p>
<p>I've seen implementations of ... | <p>I achieved the results I want with mcustomscrollbar. But it took me a while to figure out how to use it within a react project, which I explained here:</p>
<p><a href="http://stackoverflow.com/questions/38490303/reactjs-jquery-custom-content-scroller-with-reactjs/39938434#39938434">Reactjs: jQuery custom content s... |
Mouse & Touch horizontal div sliding <p>I'm trying to make a feature for my website which allows user to horizontally scroll div content using mousemove and touchmove events (it's similar to Apple AppStore <a href="https://itunes.apple.com/us/app/itunes-movie-trailers/id471966214?mt=8" rel="nofollow">any app Screenshot... | <p>Can you just get what you want without Javascript by creating a second wrapper element around the images?</p>
<pre><code><div class="collage">
<div class="wrapper">
<img /> ....
</div>
</div>
</code></pre>
<p>Then CSS</p>
<pre><code>.collage {
overflow-x: scroll;
-webkit-o... |
404 error while searching for twilio available phone number <p>I'm using Twilio trial account to know the compatibility of twilio with our project, I've tried to search for Twilio phone number using NodeJS API but, it is throwing 404 error for all the locations every time. Is it the problem with trial account or code.<... | <p>Twilio developer evangelist here.</p>
<p>We don't actually have a distinction between mobile and local numbers in the US, since the number format is the same and all numbers are voice and SMS capable.</p>
<p>So, I'd just use <code>.local</code> instead of <code>.mobile</code>.</p>
<p>Let me know if that helps.</p... |
How to read editor text before cursor position to match specific words? <p>I am trying to detect when the cursor has moved somewhere immediately after a specific strings ... I can do it only for I have one string , But when I have more than one I cant't matched ... If I have one string like : "color:" then the code to ... | <p>You could use a regular expression for matching one of several words:</p>
<pre><code>var line = e.doc.getCursor().line, //Cursor line
ch = e.doc.getCursor().ch, //Cursor character
// Select all characters before cursor
stringToTest = e.doc.getLine(line).substr(0, ch),
// Array with search w... |
PHP session.save_path ignored <p>I was having problems with my PHP website (SuiteCRM) not being able to log users in and I found it was due to not being able to write on the sessions directory.</p>
<p>I am able to fix it by creating the directory <code>/tmp/php_sessions</code> and giving it write permissions for the A... | <p>Ok, I solved my own problem and the <strong>general answer</strong> is as follows:</p>
<p>There are two more things that can be changing the path and need to be checked, </p>
<ol>
<li><p>the PHP code of the application might be changing the <code>ini</code> directive, search the code for <code>ini_set(session.save... |
Transition effect not working when added display attribute <ul>
<li><p>Requirement is to put <code>transition</code> effect on redeem now button. Initially redeem now button is hidden, on hover it will display the redeem now button with transition</p></li>
<li><p>Problem is I have added <code>display: none</code> for r... | <p>You can try this instead of dispaly property </p>
<p><strong>CSS CODE:</strong></p>
<pre><code>.wpf-demo-3:hover .view-caption {
-moz-transform: translateY(-100%);
-o-transform: translateY(-100%);
-ms-transform: translateY(-100%);
-webkit-transform: translateY(-100%);
transform: translateY(-100%);
position: absolu... |
Parsing this JSON in HIVE <p>I'm completely new to JSON. I have below JSON in one of the HIVE columns. I am not sure, how to arrange {} and [] ,but tried my best.</p>
<pre><code>{
"main_key":
[
{
"type":"RESPONSIBLE",
"lastName":"John"
},
{
"ids":
[
{
"i... | <p>You can use <code>get_json_object</code> or <code>json_tuple</code></p>
<p>Example: src_json table is a single column (json), single row table:</p>
<pre><code>+----+
                               json
+----+
{"store":
  {"fruit":\[{"weight":8,"type":"apple"},{"weight":9,"type":"pe... |
Why isn't TaskCanceledException stored in Task.Exception property when I execute multiple tasks? <p>I have an application that executes several consequent HTTP requests to RESTful API for each of the different items.</p>
<p>The code I have to handle exceptions from executing these requests is similar to the one descri... | <p>You can get some more info about this by reading <a href="https://msdn.microsoft.com/en-us/library/dd997396(v=vs.110).aspx" rel="nofollow">this documentation</a> about task cancellation, especially this part:</p>
<blockquote>
<p>If you are waiting on a Task that transitions to the Canceled state, a
System.Threa... |
Word VBA: ConvertToShape method makes image disappear <p>I wrote some code for a client which isn't working correctly on his machine (Win 10, Office 365) but is on mine (Win 10, Office 2016). The code inserts an image to the header then positions it and resizes it. I use the ConvertToShape method so I can access proper... | <p>Answer provided to cross-post at <a href="https://answers.microsoft.com/en-us/msoffice/forum/msoffice_word-msoffice_custom/word-vba-converttoshape-method-makes-image/900c4e6d-23e3-4c84-a5ad-4b47e8c9d848" rel="nofollow">Microsoft Community</a></p>
<p>There is a way to do this with only an inline shape, by setting up... |
"incompatible types" in foreach with jdk 1.7 - no error with 1.6 <p>I have code similar to the following which compiles with jdk 1.6.0_22 but not with jdk 1.7.0_79:</p>
<pre><code>for(Entry<A, B> entry: aBean.getData().entrySet()) { }
</code></pre>
<p><code>getData()</code> returns a <code>Map<A, B></code... | <p>Have you already tested this with Java 8? If the issue still exists with the latest â and only supported â Java version, I suggest you create a <a href="http://bugs.java.com" rel="nofollow">bug report</a>.</p>
<p>Otherwise use the solution you already provided in your question.</p>
|
Passing data from controller function to controller function before redirect <p>I am using <strong>codeigniter</strong> I have an edit page which shows me all information of a vacancy.
The (Vacancy) controller method to load this view looks like this, it makes sure all data is preloaded.</p>
<pre><code>public functio... | <p>Instead of using <code>set_header</code> you can use simple <code>redirect</code> function for it.</p>
<pre><code>redirect("dashboard/vacancy/editVacancy/".$vacancyid);
</code></pre>
|
PHP: replace words from list in .txt-file with * <p>I've searched around the web for days now, and I can't get an answer for my problem...<br><br><b>So this is what I need to do:</b><br>
I have an .txt-file which contains one word per line. Let's say it's called <code>list.txt</code>.<br>And I have another .txt-file ca... | <p>Consider this as a kind of pseudocode, although it's PHP. It should guide you for your desired solution:</p>
<pre><code>$content = file_get_contents('text.txt');
$censored = explode("\n", file_get_contents('list.txt'));
$content = str_replace($censored, '*****', $content);
file_put_contents('text.txt', $content);
<... |
How to make a form in excel <p>I don't know much about Excel. But, I want to make a form in Excel. Some items are fillable, and then others will have a drop-down menu for choices that is linked to another page that I can update from time to time. And, then I want the form to output all the items selected and items fill... | <p>This is as good a starting point as any for forms in Excel:
<a href="https://www.youtube.com/watch?v=lV9X2K8uEYE" rel="nofollow">https://www.youtube.com/watch?v=lV9X2K8uEYE</a></p>
<p>(It's worth continuing down the google forms route though as they provide an excellent interface and Google has already done most of... |
R: how to resample intraday data at the group level? <p>Consider the following dataframe</p>
<pre><code>time <-c('2016-04-13 23:07:45','2016-04-13 23:07:50','2016-04-13 23:08:45','2016-04-13 23:08:45'
,'2016-04-13 23:08:45','2016-04-13 23:07:50','2016-04-13 23:07:51')
group <-c('A','A','A','B','B','B','... | <p>With latest <a href="https://github.com/Rdatatable/data.table/wiki/Installation">devel version</a> (1.9.7+) of <code>data.table</code>:</p>
<pre><code>library(data.table)
# convert to data.table, fix time, add future time
setDT(df)
df[, time := as.POSIXct(time)][, time.5s := time + 5]
# use non-equi join to filte... |
Creating Topics on AzureServiceBus using MassTransit <p>I have a namespace created in AzureSerivceBus. Directly, using Azure APIs, am able to create Topics and send-receive messages to it.</p>
<p>Now, I want to be able to create Topics using MassTransit as an abstraction layer. This is because for local installations,... | <p>As you noted correctly, MassTransit is an abstraction on top of the messaging service you choose to use. RabbitMQ or Azure Service Bus, doesn't matter. The whole point is that it will provide you the features you need w/o burdening with details. Topic are commonly used for pub/sub (publishing events). While document... |
How can I use the package.json to pull private git-repository from a certain branch when using Jenkins? <p>We have a main project, that loads sub-projects and then bundles them into one file with npm. Here is the package.json:</p>
<pre><code>{
"name": "my-project",
"version": "1.0.0",
"description": "",
"main"... | <p>First off, npm will pull what ever branch you tell it to pull. Format is like this:</p>
<pre><code>"devDependencies": {
"project-a": "git+ssh://git@bitbucket.org/project-a.git#branchName"
}
</code></pre>
<p>And if there's no branch defined, it will default to master. </p>
<p>So, this gives a starting point t... |
Bootstrap DateRangePicker language on Range setting <p>I know I can use the <code>locale</code> setting to define Bootstrap DateRangePicker plugin language, although I can't figure out how do I define the language for the <code>range</code> setting.</p>
<pre><code>$('#my-calendar').daterangepicker(
{
ranges:
{
... | <p><strong>Solved</strong> in a non-fashion way.</p>
<p>Basically, the DateRangePicker plugin creates a div which contains an list with <code>Today</code>, <code>Yesterday</code>, etc. </p>
<pre><code><div class="ranges">
<ul>
<li>Today</li>
<li>Yesterday</li>
... |
Excel Graph from text Input <p>I have table in Excel with 2 Columns. </p>
<p>My Column Headers are: "Company Name" and "Company Status."</p>
<p>I want to make a graph of these two columns showing the following data:</p>
<ol>
<li><p>How many % of companies or how many companies have value "Success"</p></li>
<li><p>Ho... | <p>Refer to <a href="http://www.techrepublic.com/blog/microsoft-office/displaying-percentages-as-a-series-in-an-excel-chart/" rel="nofollow">http://www.techrepublic.com/blog/microsoft-office/displaying-percentages-as-a-series-in-an-excel-chart/</a>
and consider pass as a value of 100, and a fail as a value of 0. You ca... |
Android - Connecting Android Phone and Gain Span Module <p>I am connectiong a Gain Span wifi module to an android phone and I need the android phone connected as the Group Owner. Currently I am starting the group negotiations from the device that has the Gain Span module connected.</p>
<p>This works with devices such ... | <p>Per the <a href="https://developer.android.com/reference/android/net/wifi/p2p/WifiP2pConfig.html" rel="nofollow">documentation</a>, the higher the number, the higher the odds that you will be the group owner, however this might not be 100% sure. Has the group information been persisted on the phone? Check the WiFi D... |
#1449 - phpMyAdmin (The user specified as a definer ('***'@'localhost') does not exist) <p>I am currently transferring all of my 'Views' from a VPS hosted with 123-reg to another VPS provided by Heart Internet.</p>
<p>Here is the View:</p>
<pre><code>CREATE ALGORITHM=UNDEFINED DEFINER=`etd`@`localhost` SQL SECURITY D... | <p>The user does not exist, so you either need to create it or to use another user, which exists and has the necessary privileges.</p>
<p>etd is a user used at the original source as a definer.</p>
|
Codeigniter Foreach within an Email Message <p>When using the <code>foreach</code> within the message:</p>
<pre><code>$this->email->message('The following orders have backorders:<br><br>'.foreach ($backOrdersArray as $row2)
{
echo $OrderNumber.
'<br>Kind Regaards,<br>Merchant Lite');
};
<... | <p>Try this</p>
<pre><code>$this->load->library('email');
$this->email->from($CustomersEmail);
$this->email->to($NoReply);
$this->email->subject('Back Orders');
$msg = "The following orders have backorders:<br><br>";
foreach ($backOrdersArray as $row2)
{
$OrderNumber = $row2-&... |
Sprite Kit Modifying Attribute of a Child SKShapeNode Does Not Work <p>I have a class named <strong>Node</strong>,</p>
<p><strong>Node</strong> is a subclass of <strong>SKNode</strong>,</p>
<p>I have created and added a <strong>SKShapeNode</strong> object as a child in the <em>init</em> method of the <strong>Node</st... | <p>I suppose your problem is in the line:</p>
<pre><code>SKShapeNode *circ = (SKShapeNode *)[self childNodeWithName:@"/c"];
</code></pre>
<p>that could be:</p>
<pre><code>SKShapeNode *circ = (SKShapeNode *)[self childNodeWithName:@"//c"];
</code></pre>
<p>Differences according to <a href="https://developer.apple.co... |
Lotus Notes Attachments export <p>Did anyone find a solution how to export attachments from the .NSF file?
And how to export Lotus Notes Forms into PDF files?</p>
<p>Able to export Body in a Rich Text format into separate MS Word files.
But cannot get Attachments from the database body. </p>
<p>Tried Kernel for Lotu... | <p>Below, there's an agent code taken from official domino designer documentation. It iterates over all documents in a mail database and processes every document. In every document it gets a rich text item object from the field <code>Body</code>:</p>
<pre><code>RichTextItem body = (RichTextItem)doc.getFirstItem("Body"... |
How can I make child waiting parents to return (not exit) and then suicide? <p>I want to write such a function, which is called from other place. Which use fork to make a child and wait main process to return to its main function. I tried this method and also tried to set one flag to tell child parents return. But they... | <p>You say you want the child to</p>
<blockquote>
<p>wait main process to return to its main function</p>
</blockquote>
<p>. That's a bit hard to follow, but I think you mean that you want the child to wait until its <em>parent</em> process returns to the <em>caller</em> of the function in which the <code>fork()</... |
Datatables columns don't get fit width when it first loads? <p>I wonder why my datatables don't get fit width columns when it first load, but when I do any change like ordered, sreach, or select, it gets fit columns width. here's my datatables when it first load (<a href="https://postimg.org/image/vw4lvp3db/" rel="nof... | <p>Is your table visible when you first initialize the DataTable? If not, you may need to call the following as soon as it becomes visible:</p>
<pre><code>$("#laporan_temuan").DataTable().columns.adjust().draw()
</code></pre>
<p>Also, I notice that you are defining your column widths on initialization. If you want th... |
Need to read registry value from both 32 bit and 64 bit machine Windows machine <p>I need to read some registry values using a .cmd file. I am using the following command for that purpose.</p>
<pre><code>FOR /f "tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Looptest" /v "tscFile"') do set "TSCFile=%%b"
</code></pre>
<... | <p>Do REQ QUERY /? and notice the /reg:32 and /reg:64 switches. Then add something like this to the beginning of your bat file (before you do any reg operations) so that it works on 32 or 64 bit machines.</p>
<pre><code>set "Reg32="
set "Reg64="
if defined Programfiles(x86) set "Reg64=/reg:64" & set "Reg32=/reg:32... |
AFNetworking 3.0 The data couldnât be read because it isnât in the correct format <p>There are other questions with similar titles but none of them helped me. I've to send a <code>PUT</code> request to server in order to change the status of appointment so I've made this method <code>-(void)appointmentStatusChanged... | <p>try to use below code:</p>
<pre><code>AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
AFJSONRequestSerializer *serializer = [AFJSONRequestSerializer serializer];
[serializer setStringEncoding:NSUTF8StringEncoding];
manager.requestSerializer=serializer;
manager.responseSerializer = [AFHTTPResponseS... |
How do I use Broadcast Receiver that toasts when an SMS is received? <p>This is the <code>MainActivity.java</code>:</p>
<pre><code>package tagit.aj.com.broadcastreceiverforsms;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle... | <p>I think his problem is that his code is not working, due to changes made in SMS Provider in Android 4.4</p>
<p><a href="https://developer.android.com/about/versions/android-4.4.html#SMS" rel="nofollow">SMS Provider in Android 4.4</a></p>
|
How to read from text file in Map specific data? <p>I need the read from the data file of the form:</p>
<p>1,14.23,1.71,2.43,15.6,127,2.8,3.06,.28,2.29,5.64,1.04,3.92,1065
2,12.72,1.81,2.2,18.8,86,2.2,2.53,.26,1.77,3.9,1.16,3.14,714
2,12.08,1.13,2.51,24,78,2,1.58,.4,1.4,2.2,1.31,2.72,630
................................. | <p>Everytime <code>put</code> is called, the value for the speficied key is being replaced.</p>
<p>You want to store the result in a <code>Map<String, List<String>></code>:</p>
<pre><code>String parts[] = line.split(",");
List<String> values = map.get(parts[0]);
if(values == null) { // first time ... |
Line break or Carriage return in a Delimited Field in Sql <p>I have an email column that stores a minimum of more than 10 emails in a row. Now, I want to write a query that puts each email on a separate line, e.g:</p>
<pre><code> hay@line.com
u@y.com
live.gmail.com
</code></pre>
<p>How do write this?</p>
| <p>If you mean rows of data... Any Parse/Split function will do if you don't have 2016. Otherwise the REPLACE() as JohnHC mentioned</p>
<pre><code>Declare @YourTable table (ID int,Emails varchar(max))
Insert Into @YourTable values
(1,'hay@line.com,u@y.com,live.gmail.com')
Select A.ID
,EMail=B.RetVal
From @Yo... |
Converting a string into array in phpGrid for inserting into postgresql <p>I am trying to insert a string into an integer array using phpGrid with a PostgreSQL database. I had to convert the array to a string to remove the brackets when displaying data inside the grid for viewing, but when I try to convert the string b... | <p>Can you echo sqlCrud and find out the SQL Insert statement by setting its <a href="http://phpgrid.com/documentation/debug/" rel="nofollow">DEBUG</a> set to true? It's likely the Insert statement has an error during conversion. </p>
<p>Your PostgreSql should be something similar to the following:</p>
<pre><code>IN... |
Post sign & to another php file <p>How do i post a string with sign '&' to a php file.</p>
<p>I have a jscript:</p>
<pre><code>function saveRow(oTable, nRow) {
var jqInputs = $('input', nRow);
oTable.fnUpdate(jqInputs[0].value, nRow, 0, false);
oTable.fnUpdate(jqInputs[1].value, nRow, 1, false);
o... | <p>You need to encode the values you are sending in your datastring correctly so that they won't be interpreted as special characters in a url (a <code>&</code> separates key-value pairs...):</p>
<p>The easiest way to do that, is to let jQuery handle that by sending an object instead of a string:</p>
<pre><code>/... |
UWP and InkToolbar: how to draw basic shapes <p>I work on a UWP app where the user must be able to take a photo from the camera, and add details by drawing some shapes. I think the simplest way to do this is using the <strong>InkToolbar</strong>. So I've donwloaded the official sample: <a href="https://github.com/Micro... | <blockquote>
<p>add a background image to the InkCanvas: I would like get a BitmapImage containing the original photo and the items drawed by the user</p>
</blockquote>
<p>The <code>InkCanvas</code> doesn't contain a <code>background</code> property directly. You can create an <code>InkCanvas</code> overlays a back... |
C# unit test boolean <p>I need help on writing a unit test for this</p>
<pre><code>Public static Boolean InList(byte value, Type t)
{
if (!Enum.IsDefined(t, value))
{
return false;
}
return true;
</code></pre>
<p>This is what i written so far but it keep given me error "out of bound"</p>
<pre><code> ... | <p>This will test your method:</p>
<pre><code>public enum TestEnum : byte {
One = 1,
Two = 2
}
[TestMethod()]
Public void InListTest()
{
Assert.IsTrue(ValidationUI.InList(1, typeof(TestEnum));
Assert.IsFalse(ValidationUI.InList(100, typeof(TestEnum));
}
</code></pre>
|
ASP.NET MVC - prevent submit of invalid form using jQuery unobtrusive validation <p>I have an ASP.NET project that automatically wires up client side validation using <a href="https://jqueryvalidation.org/" rel="nofollow">jQuery.Validate</a> and the <a href="https://github.com/aspnet/jquery-validation-unobtrusive" rel=... | <h2>The Problem</h2>
<p>It turns out this happens when you don't include a <code>@Html.ValidationMessageFor</code> placeholder for a given form element.</p>
<p>Here's a deeper dive into where the problem occurs:</p>
<p>When a form submits, <code>jquery.validate.js</code> will call the following methods:</p>
<pre cl... |
Laravel blade template showing html even when the condition is false <p>I have setup if conditions in my blade template with an if condition that consists of an or operator, but it is showing html even when the condition is false. Not sure how to fix that? </p>
<pre><code>@if(count($images) || count($videos) > 1)
... | <p>You write or (||) condition in if statement that means if one condition (count($images)) or count($videos) is true then if statement will work.
If two condition is false then your if statement will not work</p>
|
Averaging two time points <p>I have a time series spanning two years. I need to average the two values for each month to create a new value to assign to each month. Is there a way to do so in R? </p>
<p>Thanks</p>
| <p>Without a data set it is hard, but here is the general framework:</p>
<pre><code>library(dplyr)
library(lubridate)
data %>% group_by(year(date), month(date)) %>% summarize(value = mean(value))
</code></pre>
|
Column appended in a pandas dataframe malfunctions <p>I have a dataframe named df1</p>
<pre><code> df1.columns
Out[55]: Index(['TowerLon', 'TowerLat'], dtype='object')
df1.shape
Out[56]: (1141, 2)
df1.head(3)
Out[57]:
TowerLon TowerLat
0 -96.709417 32.731611
1 -96.709500 32.731722
2... | <p>The <code>AttributeError</code> occurs due to the fact that <code>labels</code> is not part of the original <code>DataFrame</code>. You can however access the data by using the following method:</p>
<pre><code>df1['labels']
</code></pre>
<p>This will give you the following output:</p>
<pre><code>0 1
1 1
2 ... |
Calculate moving average in numpy array with NaNs <p>I am trying to calculate the moving average in a large numpy array that contains NaNs. Currently I am using:</p>
<pre><code>import numpy as np
def moving_average(a,n=5):
ret = np.cumsum(a,dtype=float)
ret[n:] = ret[n:]-ret[:-n]
return ret[-1:]/n
<... | <p>I'll just add to the great answers before that you could still use cumsum to achieve this:</p>
<pre><code>import numpy as np
def moving_average(a, n=5):
ret = np.cumsum(a.filled(0))
ret[n:] = ret[n:] - ret[:-n]
counts = np.cumsum(~a.mask)
counts[n:] = counts[n:] - counts[:-n]
ret[~a.mask] /= co... |
Android game Multi Screen Resolution <p>If I design a game for 3:2 screen ratio, and another device has 4:3 or 16:9, how can I make the game look the same? I can scale the resolution for same aspect ratio, but when it's different what can I do?</p>
| <p>The best approach is to design your game with biggest screen possible (3:2 i think), and then check it with the smallest screen(16:9 i think). if your game is portrait then scale when height changed and if your game is landscape then scale your game when width changes.</p>
|
Node.js - read and download all files in directory from server and save locally <p>I have a Node Webkit Desktop App and need to download files from the server and save locally for when users are offline. I can download and save a file when I know what the file name is, but how do I read the contents of a directory on ... | <p>The following code doesn't read a remote file system, it's used for reading files on your local hard drive.</p>
<pre><code>import fs from 'fs'
import path from 'path'
fs.readdir(path.resolve(__dirname, '..', 'public'), 'utf8', (err, files) => {
files.forEach((file) => console.info(file))
})
</code></pre>... |
matplotlib scatter plot: How to use the data= argument <p>The matplotlib documentation for <code>scatter()</code> states:</p>
<blockquote>
<p>In addition to the above described arguments, this function can take a data keyword argument. If such a data argument is given, the following arguments are replaced by data[]:... | <p>In reference to your example, I think the following does what you want:</p>
<pre><code>plt.scatter(data[:, 0], data[:, 1], **props)
</code></pre>
<p>That bit in the docs is confusing to me, and looking at the sources, <code>scatter</code> in <code>axes/_axes.py</code> seems to do nothing with this <code>data</code... |
Compile typescript without transpiling async functions <p>Is there a way to use the TypeScript compiler only to remove type annotations, but not transpiling async functions? Something like a <code>{ target: 'esInfinite' }</code> option? The reason is: There are browsers that already support async functions, so I wish t... | <p>This feature was already requested <a href="https://github.com/Microsoft/TypeScript/issues/5361" rel="nofollow">here</a>. Targeting es2016 and es2017 should be available in the <a href="https://github.com/Microsoft/TypeScript/milestone/2" rel="nofollow">Community</a> milestone and in <a href="https://github.com/Micr... |
ASP.NET Core & EntityFramework Core: Left (Outer) Join in Linq <p>I am trying to get a left join working in Linq using ASP.NET Core and EntityFramework Core.</p>
<p>Simple situation with two tables:</p>
<ul>Person (id, firstname, lastname)</ul>
<ul>PersonDetails (id, PersonId, DetailText)</ul>
<p>The data I try to ... | <p>If you need to do the <strong>Left joins</strong> then you have to use <code>into</code> and <code>DefaultIfEmpty()</code> as shown below.</p>
<pre><code>var result = from person in _dbContext.Person
join detail in _dbContext.PersonDetails on person.Id equals detail.PersonId into Details
f... |
Unity3D 5.4.1 - Can I get object transformations at different times from animation? <p>I'm trying to export levels created in Unity for a school project, and I would like to export a path that the player will fly along. My plan was to create an animation and store positions along the path and then export the transforma... | <p>Yes it's possible using <a href="https://docs.unity3d.com/Manual/animeditor-AnimationEvents.html" rel="nofollow">Animation events</a>. Write a method to record the data you want at various points in the animation timeline. Be advised though there is <a href="https://www.google.co.uk/search?q=unity%20animation%20even... |
Deprecation warning: moment construction falls back to js Date This is discouraged and will be removed in upcoming major release <p>I am using <code>Moments</code> but get a <strong>depreciation</strong> warning. Can anyone advise where my code is causing this, and what it should change to please?</p>
<p><a href="http... | <p>It seems that "createdAt" property contains a string and not a date. Is the object retrieved from server? if it is, most probably you have a date formatted to text (something like "2012-04-21T18:25:43" or "\"\/Date(1335205592410)\/\"").</p>
<p>Please remember that with typescript you can specify the types of the va... |
Jar file contains no class files after bintrayUpload <p>I am trying to publish my lib to bintray. But the jar file that is created only contains a META-INF folder and no class files.</p>
<p>I have followed the guide at <a href="https://github.com/bintray/gradle-bintray-plugin#readme" rel="nofollow">https://github.com/... | <p>I managed to fix it.
Biggest difference was I used configurations instead of publications when pushing to bintray. Below is the gradle files I setup for it to work.
Then just run gradlew bintrayUpload. I got some error messages that I did not manage to fix, but they were not necessary to fix as it worked to upload a... |
delete text without element inside div after some button <p>here the code</p>
<pre><code><div
id="user-alert"
class="alert alert-danger col-md-offset-1 col-md-10 alert-dismissible"
role="alert"
>
<button type="button" class="close" data-hide="alert" aria-hidden="true">
<span aria... | <p>Selector for the last node of element is <code>$('#user-alert').contents().last()[0]</code> and using that selector you can remove the text of it.</p>
<pre><code>$('#user-alert').contents().last()[0].textContent='';
</code></pre>
<p><strong>Working snippet:</strong></p>
<p><div class="snippet" data-lang="js" data... |
Need help debugging SSLHandshakeException in Android Nougat <p>I have an app that downloads documents from 3rd party sites (to browse offline).</p>
<p>I am using a standard HttpUrlConnection.</p>
<p>It used to work like a charm, but since upgrading to Nougat, one of the site produces a very consistent SSLHandshakeExc... | <p>Same thing on Nexus 6 updated to Nougat.
My application worked and now doesn't work anymore.</p>
<p>I tried using an alternative libary (OkHttp) but it ends up in the same result.
javax.net.ssl.SSLHandshakeException: Connection closed by peer</p>
<p>The app work against other servers but not this particular one (s... |
Java: Closing Streams: Streams non-NULL even after close() <p>In my finally clause I clean up any streams, e.g.,</p>
<pre><code> finally // Clean up
{
if (os != null) {
try {
os.close();
}
catch ... | <p>The stream "object" is a reference to a instance of a stream. Whether the stream is open or not is part of its state. The close function is a function that runs in the objects state and thus will not affect references to it.</p>
<p>The reference will stay non-NULL until you set it null, but the stream's state is cl... |
Create akka message listener without extending Actor class <p>As I have seen from samples that one should be an actor in order to catch a message. But I need a custom listener in order to listen messages without creating a new actor class etc. I want something like this:</p>
<pre><code>throw message
listen Response{
... | <p>You can subscribe to the event-bus. You just need to implement the traits defined here: <a href="http://doc.akka.io/docs/akka/current/scala/event-bus.html" rel="nofollow">http://doc.akka.io/docs/akka/current/scala/event-bus.html</a></p>
|
rxjs and angular 2 and the use of the "take" operator <p>I am trying to use the "take" operator in my code (learning rxjs) but it is not sending the top 5 like I want. my simple code is below, anyone have any idea how to help?</p>
<pre><code>countries: Observable<Country[]>;
private searchTerms = new Subject&l... | <p>After reading your comment, I understand you need the first 5 countries. Now note that your observable emits arrays of countries and not countries. The reason you use Observable.of instead of Observable.from. So, the right syntax should be:</p>
<pre><code>this.countries = this.searchTerms.debounceTime(300).distinct... |
How to Check if Arrays in a Object Are All Empty? <p>So I need to pass in a object where each of its properties are arrays. The function will use the information held in each array, but I want to check if the whole object is empty empty (not just having no properties) by checking if each of its arrays are empty/null a... | <p>So if we want to go through the object and find if every key of that object passes a check, we can use <code>Object.keys</code> and the Array#extra <code>every</code> like so:</p>
<pre><code>var allEmpty = Object.keys(obj).every(function(key){
return obj[key].length === 0
})
</code></pre>
<p>This will set <code>al... |
Pandas: calculating the mean values of duplicate entries in a dataframe <p>I have been working with a dataframe in python and pandas that contains duplicate entries in the first column. The dataframe looks something like this:</p>
<pre><code> sample_id qual percent
0 sample_1 10 20
1 sample_2 ... | <p><code>groupby</code> the <code>sample_id</code> column and use <code>mean</code></p>
<p><code>df.groupby('sample_id').mean().reset_index()</code><br>
<strong><em>or</em></strong><br>
<code>df.groupby('sample_id', as_index=False).mean()</code></p>
<p>get you </p>
<p><a href="http://i.stack.imgur.com/nw7e9.png" rel... |
Using a dynamic variable in an ajax query <p>I'm struggling to pass a GET variable into a jquery file.</p>
<p>My code is</p>
<pre><code>function upload(files){ // upload function
var fd = new FormData(); // Create a FormData object
for (var i = 0; i < files.length; i++) { // Loop all files
... | <p>You can use PHP and export the variable:</p>
<pre><code>var orderId = <?php echo json_encode($_GET['order']); ?>;
function upload(files) {
...
url: 'ajax/tuto-dd-upload-image.php?order=' + orderId,
</code></pre>
<p>Or you could parse it directly in javascript:</p>
<pre><code>var orderId = self.loca... |
Javascript replace not working in Angular JS <p>I'm trying to iterate through a list of titles and replace an escaped '&' character with the single character '&'. </p>
<p>For some reason I'm getting a console error saying that 'replace' is not a function and I don't know why.</p>
<p>Here is the code:</p>
<pr... | <pre><code>angular.forEach(result.data, function(value, key){
// replacing escaped charater (&) from endpoint
this.push(key + ':' + value.replace(/&#038;/g,'&'));
</code></pre>
<p>You are trying to iterate over <code>key</code>, rather than <code>value</code>. Look at the argument order, first goes <code>... |
Constructing an object of class type 'ClassName' with a metatype value must use a 'required' initializer XCode8 Swift 3 changes <p>I'm struggling with this particular error as a result of XCode 8 swift 3 changes, and can't find anywhere a detailed explanation as to why this is happening. </p>
<p>Error:</p>
<p><strong... | <p>This compiled:</p>
<pre><code>public convenience init() {
self.init(backgroundTapCancels: true)
}
</code></pre>
<p>Still would like to know why.</p>
|
Access nested structures without moving <p>I've got these structs:</p>
<pre><code>#[derive(Debug, RustcDecodable)]
struct Config {
ssl: Option<SslConfig>,
}
#[derive(Debug, RustcDecodable)]
struct SslConfig {
key: Option<String>,
cert: Option<String>,
}
</code></pre>
<p>They get filled ... | <p>What is the definition of <code>Option::unwrap</code>? <a href="https://doc.rust-lang.org/std/option/enum.Option.html#method.unwrap" rel="nofollow">From the documentation</a>:</p>
<pre><code>fn unwrap(self) -> T
</code></pre>
<p>it consumes its input (<code>cfg.ssl</code> here).</p>
<p>This is not what you wan... |
Set sort order of MySQL query using dropdown options <p>I want to allow site users to change the sort order of results that are returned by an existing query.
The query is currently</p>
<pre><code>$searchList = 'select distinct pa.products_id, pd.products_name,
p.products_model
FROM ' . T... | <p>First of all if you want some kind of "auto submit" you need to handle the onChange event, so your select could look like the following:</p>
<pre><code><select id = "SortBy" name="SortBy" onchange="submitForm()">
</code></pre>
<p>jQuery style</p>
<pre><code>$("#SortBy" ).change(function() {
//submit the ... |
npm: using 'npm uninstall' vs. just removing the folder <p>I wanted to try grunt-babel, so I opened up a terminal in my Home folder and did npm install --save-dev grunt-babel babel-preset-es2015 according to the plugin's instructions.</p>
<p>I was doing this too hastily, and realized I should probably have done this i... | <ul>
<li>npm uninstall removes the module from node_modules, but not package.json. </li>
<li><p>npm uninstall --save to also delete the dependency from package.json.</p></li>
<li><p>npm rm remove the packages when uninstall not working</p></li>
<li><p><a href="https://docs.npmjs.com/cli/prune" rel="nofollow">npm pru... |
How to use patterns to ignore certain part of an input string in lua? <p><strong>Background Information</strong></p>
<p>I have a csv file with lines that look like this: </p>
<pre><code>+11231231234,13:00:00,17:00:00,1111100,12345,test.net
+11231231234,,,0000000,23456,test.net
+11231231234,18:00:00,19:00:00,1111100,0... | <pre><code>local id, start_time, end_time, asd, int, domain =
line:match("(%+%d+),(%d*:?%d*)[%d:]*,(%d*:?%d*)[%d:]*,(%d*),([%d%*#]*),(%S*)")
</code></pre>
|
How Can i Import example application from developer.android.com into Android Studio <p>I have downloaded the CustomView.zip from <a href="https://developer.android.com/training/custom-views/index.html" rel="nofollow" title="developer android">developer android page</a>.
I've tried to import this into Android Studio 2.... | <p>Looking at the sample file, stupidly, it doesnt include any of the standard android framework files (gradle, manifest etc), so Android Studio will not be able to automatically import it.</p>
<p>To get round this you should create a new blank project, leave the mainactivity that is generated.</p>
<p>Then go in to t... |
Spotfire: Date filtering with action control <p>I am working on a spotfire app and I am trying to create an action control that filters dates. I am new to ironpython and can't figure out what is wrong with my script:</p>
<pre><code>from Spotfire.Dxp.Application.Visuals import *
import datetime as dt
visual = viz.As[V... | <p>I figured out what was going on here, you need to use spotfire functions inside of the WhereClauseExpression string. The following code fixes the issue:</p>
<pre><code>from Spotfire.Dxp.Application.Visuals import *
visual = viz.As[VisualContent]()
visual.Data.WhereClauseExpression = '[Agreement End Date] < Date... |
Plotting Curves from Data Frame Columns <p>i am facing a problem in plot ols estimations in a scatterplot:</p>
<p>I have this data frame: With 9 columns and 99 rows:</p>
<pre><code>structure(list(Y = c(-0.145442175, 0.291096141, 0.489923112,
-2.038363166, 1.180430664, 0.188114666, 0.850922634, 1.172142766,
-3.98083... | <p>Basically you want</p>
<pre><code>data <- data[order(data$X), ] ## reordering so that `X` is increasing
plot(data$X, data$Y)
for (i in 4:9) {
lines(data$X, data[,i], col = i) ## remember to set `x-coordinates`
}
legend("topright", legend = names(data)[4:9], col = 4:9, lty = 1) ## add legend
</code></p... |
SQL query doesn't select the data that I need with 'where' conditions <p>I am trying to get the records from my database where studentID, and lessonDate are equal to specific results. The StudentID seems to work fine, but lessonDate does not. Because of date formats, I have converted all dates to strings to be put into... | <p>Your parameters are not being quoted correctly.</p>
<p>This is why you should not use string interpolation to add data into your queries. You should use the db-api's parameter substitution instead:</p>
<pre><code>self.cur.execute("""SELECT b.roadExerciseName, a.rating
FROM lessonExercises a LEF... |
Find element and see if its active/hasClass <p>I am trying to access a button in my leaflet map. The button is created using a plugin "easy-button".
My main goal is to see if the button has been clicked (is active), I will use it for validation in another function, not shown here. </p>
<p>This is how the html for the ... | <p>This</p>
<pre><code>if($('span').hasClass('fa fa-crosshair fa-lg'))
</code></pre>
<p>Will not target the <code>span</code> you are expecting it to.</p>
<p>You wanted</p>
<pre><code>if($('span',this).hasClass('fa fa-crosshair fa-lg'))
</code></pre>
<p>To target the child span of the span you clicked on</p>
|
Design a multi client - server application, where client send messages infrequent <p>I have to design a server which can able to send a same objects to many clients. clients may send some request to the server if it wants to update something in the database. </p>
<p>Things which are confusing:</p>
<ol>
<li><p>My serv... | <p>Putting every connection on a thread is very bad, and is apparently a common mistake that beginners do. Every thread costs about 1 MB of memory, and this will overkill your program for no good reason. I did ask the very same question before, and I got <a href="http://stackoverflow.com/questions/31503638/c-boost-asio... |
npm not finding a js file <p>Im making a little angular2 app, which uses the ng2-slugify package, and for some reason it doesn't find one of the slugify required files which is in the same folder (The file name is charmaps.js, and it's there 100%).</p>
<p><a href="http://i.stack.imgur.com/zutVV.png" rel="nofollow"><im... | <p>You need to tell <strong>systemjs.config.ts</strong> to load <strong>slug</strong> module.</p>
<pre><code>map:{
"ng2-slugify": "node_modules/ng2-slugify/ng2-slugify.js"
}
</code></pre>
<p>Then,</p>
<pre><code>import {Slug} from 'ng2-slugify';
</code></pre>
|
Riak Search 2 not indexing bucket <p>I'm using Riak as a key-value store backend for a graph database implemented in Python.</p>
<p>I created a custom <a href="https://github.com/linkdd/link.graph/blob/master/etc/link/graph/schemas/node.xml" rel="nofollow">search schema</a> named <code>nodes</code>.
I created and acti... | <p>First, you should take into account that Riak automatically adds suffix <code>_set</code>, so that you don't have to name yours <code>type_set</code> but <code>type</code>. Otherwise you will have to query for <code>type_set_set:*</code> instead of <code>type_set:*</code>.</p>
<p>Second, according to <a href="https... |
Capybara: How to set files names and directory for save_and_open_page_path <p>I am trying to set the directory where all screens shots will be saved. Because currently it saves to the root folder, but I would like to save files (.img and .html) to another one folder. I tried to use</p>
<pre><code>CapybaraScreenshot.sa... | <p>As documented in the capybara-screenshot README - <a href="https://github.com/mattheworiordan/capybara-screenshot#custom-screenshot-directory" rel="nofollow">https://github.com/mattheworiordan/capybara-screenshot#custom-screenshot-directory</a> and <a href="https://github.com/mattheworiordan/capybara-screenshot#cust... |
How to control appearance of EditText box? <p>I intend to have an EditText box where a user can input data appear after a timer ends. To do this, I placed in in the onFinish section of my timer. This didn't work, because as soon as I access the screenview, the EditText box appears before the timer even starts (timer st... | <p>As Justin said, you need to set the visibility of your EditText to android:visibility="gone"
in XML. You could get the reference of your EditText before the counter function and set input.setVisbility(View.GONE);</p>
<p>Just make sure this is done before the timer counts down to 0</p>
|
How can I keep the values in a column of 2 separate rows adjacent using the boostrap grid when they collapse? <p>I have a bootstrap grid that looks like this ( <a href="https://jsfiddle.net/h81jka6y/" rel="nofollow">jsfiddle</a> ):
<a href="http://i.stack.imgur.com/37CVR.png" rel="nofollow"><img src="http://i.stack.img... | <p>You need to add </p>
<pre><code><label></label>
</code></pre>
<p>Checkout the JSFiddle below</p>
<p><a href="https://jsfiddle.net/sg05vdj8/1/" rel="nofollow">https://jsfiddle.net/sg05vdj8/1/</a></p>
|
VBA Type mismatch error on Do While ActiveCell.Value <> "" <p>Hey I've got code moving rows out to another sheet with the name of the cell, a loop until it hits a blank at the end of the data, an extract of the code here;</p>
<pre><code>Range("AF2").Select
Do While ActiveCell.Value <> ""
strDestinationSheet ... | <p>I personally do not like Do Loops to iterate through a group of cells. I prefer the For Each loop.</p>
<p>Also as was stated by @bruceWayne, avoid using Select as is slows down the code.</p>
<p>Proper indentation makes the code easier to read and avoid simple mistakes.</p>
<pre><code>Dim cel As Range
With Sheets... |
TFS / Visual Studio 2015 : how to compare file changes between 2 commits <p>We're currently testing git as source control for our new projects. We're using TFVC for many years and we're used to the way it works. So far, pretty much everything works as expected but there's something really simple I cannot figure out : i... | <p>The reason for this is that git is designed around many different branches and combining them back into coherent code, while tfvc is designed around having a coherent history of modifications. If you develop a project with enough collaborators using git, you will have a branch that starts at one commit on the main ... |
Apache POI - reading modifies excel file <p>Whenever I open a excel file using the Apatche POI the file gets modified, even though I'm just reading the file and not making any modification.</p>
<p>Take for instance such test code.</p>
<pre><code>public class ApachePoiTest {
@Test
public void readingShouldNot... | <p>Your problem is that you're not passing in the readonly flag, so Apache POI is defaulting to opening the file read/write.</p>
<p>You need to use the <a href="http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/WorkbookFactory.html#create(java.io.File,%20java.lang.String,%20boolean)" rel="nofollow">overloaded ... |
Type mismatch error returned due to different type of messages being returned in Mule <p>I have a Mule workflow that can either receive a response message or an business error message as input into the transform message connector.</p>
<p>When it moves from the transform message connector to object to string it hits th... | <p>You can use when/otherwise in this situation. You were close, just use <em>{</em> and <em>}</em> instead of parens. Something along the lines of:</p>
<pre><code>%dw 1.0
%input payload application/json
%output application/xml
---
{
Data: {
userId: flowVars.queryParams.userId,
Message: "User creat... |
http get request returns different values in curl than it does in ionic2/angular2 <p>When I do a get request with curl like this:</p>
<pre><code>curl https://api.backand.com:443/1/objects/todos?AnonymousToken=my-token
</code></pre>
<p>I am returned the correct information:</p>
<pre><code>{"totalRows":2,"data":[{"__m... | <p>I know nothing about Curl, but HTTP calls in Angular 2 return <strong>observables</strong>, so you need to use RxJS methods to operate on them. In order to get the response, you need to subscribe to it so that you can <em>observe</em> values that are returned.</p>
<pre><code> this.http.get('https://api.backand.com:... |
Form submission doesn't work - PHP <p>I'm working on a form validation and I'm currently doing some debugging on my code. I'll insert the necessary code snippets below:</p>
<p>Form code:</p>
<pre><code>echo '<h1> Seismic Recording </h1>
<div>
<form action="validate2.php" method="POST">';
echo... | <p>Why check for a 'submit' post variable when you're working with latitude?</p>
<pre><code>if(isset($_POST['latitude']))
{
echo "t";
$latitude=$_POST['latitude'];
}
else
{
echo "Please insert a latitude . <br>";
$error = $error + 1;
}
</code></pre>
<p>Also there is no need for a name on the... |
Unable to set context when rendering child components <p>I'm trying to test a custom <a href="https://github.com/callemall/material-ui" rel="nofollow">Material-ui</a> React component with Enzyme but getting the following error:</p>
<p><code>ERROR: 'Warning: Failed context type: Required context 'muiTheme' was not spec... | <p>I'm not sure this is the solution but it's one step closer to the goal.</p>
<pre><code>const root = mount(<RootComponent />, {
context: {muiTheme},
childContextTypes: {muiTheme: React.PropTypes.object}
})
const child = root.find(ChildComponent)
</code></pre>
<p>Notice, I use <code>mount</code> instead of... |
How to adjust web layout along with header, navigation etc to maximum width using css? <p>As I was looking at websites, I've noticed that when you zoom out in your browser. The design of the header, navigation, content area and footer expands along with the layout. I've also found out that most of the website follow th... | <p>I assume you are talking about responsive web design </p>
<p><a href="http://www.w3schools.com/html/html_responsive.asp" rel="nofollow">http://www.w3schools.com/html/html_responsive.asp</a></p>
<p><a href="https://www.youtube.com/watch?v=BIz02qY5BRA" rel="nofollow">https://www.youtube.com/watch?v=BIz02qY5BRA</a>
(... |
Redirecting output of a script to a file as a background job does not output anything <p>I have a line:</p>
<p><code>RAILS_ENV=production bundle exec rake mentions:stream > mention.log</code></p>
<p>It outputs text to <code>mention.log</code> file.</p>
<p>When I try to run it as background job:</p>
<p><code>RAIL... | <p>have you tried to run it while its part of a script:</p>
<p>a_script:</p>
<pre><code>RAILS_ENV=production bundle exec rake mentions:stream > mention.log
</code></pre>
<p>then run:</p>
<pre><code>a_script &
</code></pre>
|
Wordpress: Strange permission issue <p>all I struggle with one permission problem with my wordpress.
As you can see </p>
<pre><code>ls -la wp-content/themes/impreza/
total 144
drwxr-xr-x 9 root root 4096 Oct 7 16:49 .
drwxr-xr-x 4 root root 4096 Oct 7 11:21 ..
-rwxr-xr-x 1 root root 330 Oct 7 10:33 404.php
... | <ol>
<li><p>try to make images 777 to see if you can access them.</p></li>
<li><p>for plugin, you should check your "wp-content/plugins" folder permission, not themes.</p></li>
</ol>
|
Dockerfile: Permission denied during build when running ssh-agent on /tmp <p>So I'm trying to create an image, which adds a SSH private key to /tmp, runs ssh-agent on it, does a git clone and then deletes the key again.</p>
<p><a href="http://blog.cloud66.com/pulling-git-into-a-docker-image-without-leaving-ssh-keys-be... | <p>I did it. What I did is, I got rid of ssh-agent. I simply copied the <code>~/.ssh</code>- directory of my docker-host into the <code>/root/.ssh</code> of the image and it worked. </p>
<p>Do not use the <code>~</code> though, copy the <code>~/.ssh</code>-directory inside the projectfolder first and then with the doc... |
NSNotification for all views at once <p>I am trying to <code>addObserver</code> to all my views, when I start my application.
When there is a post coming I want to display a Modal View on top of the current <code>ViewController</code>.</p>
<p>Is there a way to install it directly on every View or do I need to do the</... | <ol>
<li>You could have created one superclass for all you view controllers and override viewWillAppear/viewDidDisappear there.</li>
<li>If there is no exception and you want to present a modal view controller no matter what view controller is currently on screen, you can present it over self.window.rootViewController ... |
WSO2 MB an exception after admin psw change <p>I tried to make a production set up (WSO2 MB 3.1.0 and WSO2 ESB 4.9.0) on the same VM.
in order to secure my production environment I changed the default admin psw for the admin user to more secure one. At the same time I created a new MB user (ESB) which I used as "a tech... | <p>AFAIU, Following are the steps you have followed.</p>
<ol>
<li>Changed MB default username/password.</li>
<li>Created new user("a technical user") in MB and add these username/password in ESB "jndi.properties" file.</li>
<li>Restarted servers and ESB start throwing auth exceptions.</li>
</ol>
<p>Things would have ... |
API (curl)Command to Approve a promoted build Job in Jenkins <p>Is there any way can an Approver approve a specific build using curl command?</p>
<p>I am using Promoted Builds Plugin for manual approval for builds. </p>
<p>when i am trying below curl command it is giving "Error 400 Nothing is submitted". I searched e... | <p>Yeah finally got a solution after much plug n play.. thought to share as it could help others.
First of all the Json Values i am passing are not correct and it doesn't have all the parameters the promotion expecting. Second as i have enabled CSRF protection the HTTP request should have a valid crumb. So What i did ... |
using phantomjs to get jscript output <p>I have an internal webpage that I want to pull a piece of data from at time intervals.</p>
<p>I used curl to scrape the page but discovered the data i want is in a jscript. So now I am trying to automate the jscript so i can get the output to text file, i can then parse the te... | <p>Not phantomjs but nodejs. PhantomJS is a headless browser and I dont think it would help much. Following code can demonstrate in better way: <a href="https://runkit.com/pankaj/periodic-ajax" rel="nofollow">https://runkit.com/pankaj/periodic-ajax</a></p>
<p>Or if you wanna do it on a HTML page with jQuery then follo... |
If you have a string of characters, is it possible to substract each one? Java <pre><code>for (int i= length-1;i>=0; i--){//reverses order of string.
password_2 = password_2 + password.charAt(i);//store in new string
System.out.print(password.charAt(i));
</code></pre>
<p>basically after I inverse th... | <p>Do you want to subtract 7 from the location of the letter i the alphabet and then produce that? for example h - 7 = a.</p>
<p>You could fill an <code>map<int, String></code> with the alphabet and then use <code>.equals(theLetterEntered)</code> in a loop to get the location, then just do addition on the maps k... |
Find/Delete and Update record MongoDB using C# <p>This my doument</p>
<pre><code>{ "_id" : ObjectId("57f65ed25ced690b5408a9d1"), "fbId" : "7854", "Name" : "user1", "pass" : "user1", "Watchtbl" : [ { "wid" : "745", "name" : "azs", "Symboles" : [ { "Name" : "nbv" } ] }, { "wid" : "8965", "name" : "bought stock1", "Symbo... | <p>You will want to use builder.And to join clauses for your filter</p>
<pre><code>var filter = builder.And(builder.Eq("_id", id), builder.Eq("wid", wid))
</code></pre>
<p>For updating the individual fields, you can achieve this using the </p>
<pre><code>Builders<BsonDocument>.Update.Set
</code></pre>
<p>I ho... |
Variable i cannot be read at compile time <p>I have this code:</p>
<pre><code>class Set(T){
private T[] values;
T get(uint i){
return ((i < values.length) ? T[i] : null);
}
...
</code></pre>
<p>And when I try use this class this way:</p>
<pre><code>set.Set!(int) A;
</code></pre>
<p>compiler ... | <p>That is the answer: the code simply referenced the wrong variable. The reason it gave the error it did is that T[i] is trying to get an index out of a compile-time list of types... which needs i to be available at compile time too. However, since i is a regular variable, it isn't. (You can have compile time variable... |
Guice CreationException due to missing implementation for java.util.Optional <p>I'm upgrading an application written for Java 7 to version 8. It uses Guice to inject config values into the constructor of an object. However, after the upping the Java version, I'm now getting this mysterious error when running unit tests... | <p>Trivially, you're missing a binding of <code>@Config(AsyncHttpClientConfigProvider.allowPoolingConnection) Optional<Boolean></code>, which is different from <code>@Config(AsyncHttpClientConfigProvider.allowPoolingConnection) Boolean</code>. For a more specific answer, we'll need to see more of your previous wo... |
esc_url on WordPress ACF oEmbed <p>I'm using the <a href="https://www.advancedcustomfields.com" rel="nofollow">ACF</a> WordPress plugin to create an oEmbed field. The field accepts a URL from Vimeo and outputs an iframe on the front end.</p>
<p>I usually escape urls and attributes within my theme like so:</p>
<pre><c... | <p>Have you tried using the_field() instead of get_field()?</p>
<pre><code><?= esc_url( the_field('video') ); ?>
</code></pre>
<p>The oEmbed actually returns more than just a url so that could be the issue as well. I haven't worked with esc_url() much in the past but it could be breaking because whatever is ge... |
Merging rows with shared information <p>I have a data.frame with several rows which come from a merge which are not completely merged:</p>
<pre><code>b <- read.table(text = "
ID Age Steatosis Mallory Lille_dico Lille_3 Bili.AHHS2cat
68 HA-09 16 <NA> <NA> <NA> ... | <p>While I'm sure that it's possible with <code>dplyr</code> or <code>tidyr</code>, here's a <code>data.table</code> solution:</p>
<pre><code>b <- read.table(text = "
ID Age Steatosis Mallory Lille_dico Lille_3 Bili.AHHS2cat
68 HA-09 16 <NA> <NA> <N... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.