input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
How to Convert UInt8 to Anyobject in Swift 2.3 <p>I am trying in CryptoSwift and i tried to UInt8 to Anyobject .</p>
<p>How to Convert this </p>
<p>let encrypted:[UInt8]!</p>
<pre><code> encrypted = try AES(key: value, iv: iv, blockMode: .CBC, padding: PKCS7()).encrypt(myArray)
let mynObject:AnyObject = ... | <p><strong>Example</strong></p>
<pre><code>let anInt:UInt8 = 20
let anObject:AnyObject = anInt as AnyObject
</code></pre>
<p>The key part you want to pay attention to is <code>anInt as AnyObject</code> this is how you convert a Uint8 to AnyObject.</p>
|
Exponent has no digits <p>I m integrating google sign in my iOS app using manually installed SDK. I got the .plist file and the client id but when i put client id in appdelegte.m it shows an error "Exponent has no digits". Any Solution???</p>
| <p>From <a href="https://developers.google.com/identity/sign-in/ios/sign-in" rel="nofollow">your link</a>:</p>
<blockquote>
<p>Note: If you manually installed the SDK, you should instead configure the GIDSignIn object directly, using the client ID found in the GoogleService-Info.plist file:
[GIDSignIn sharedInstan... |
Populating a lookup table <p>I have a site set up to sell my photographic prints. The photos are in categories and are available in a number of sizes, so I have a photos, categories and sizes table, joined by a category_photo and photo_size table.</p>
<p>Up to now I have been adding new photos to the site using PHPMyA... | <p>In your <code>Category_Photo</code> model class add <code>protected $table = 'category_photo';</code> Because by default laravel use plural version of model for table.</p>
|
Python Django Template cannot get name from model function <p>While I understood that I can call a function definition from our models, I can't seem to extract the file name of my uploaded document. Below I tried the following template format but either results from my desired output:</p>
<p><strong><em>.html Version ... | <p>I think you got pretty close with <code>{{ document.filename }}</code>, except in your models you need to change </p>
<pre><code>def filename(self):
return os.path.basename(self.file.name)
</code></pre>
<p>into</p>
<pre><code>def filename(self):
# try printing the filename here to see if it works
prin... |
Send method in new Vue is not called when form is submitted <pre><code><!DOCTYPE html>
</code></pre>
<p></p>
<pre><code><head>
<meta charset=" UTF-8">
<title> Document</title>
</head>
<body id="chat">
<script src="https://cdnjs.cloudflare.com/ajax/libs/sock... | <p>Okay, what about this</p>
<pre><code><form @submit.prevent="send">
<input v-model="message">
<button>Send</button>
</form>
</code></pre>
<p>And then you can remove preventing default browser action from your <code>send()</code> method</p>
|
How to display images in pdf using fpdf library? <p>Currently I am working on opencart. And I have to display data in pdf for that I use FPDF.</p>
<p>my function looks like</p>
<pre><code>public function exportPDF(){
require_once(DIR_SYSTEM . 'lib/fpdf.php');
$pdf = new fpdf();
$pdf->AliasNbPages();
$pdf->AddPa... | <p>Try this, </p>
<pre><code>foreach($data2 as $row)
{
$pdf->SetFont('Arial','',10);
$pdf->Ln();
foreach($row as $key=>$column)
{
if($key == "image"){
$pdf->Cell(35,50,$this->Image($column,$this->GetX(),$this->GetY()),1);
}else{
... |
Haskell Record function constraints <p>What is the way in Haskell to express something like:</p>
<pre><code>data SinkBuilder
{ openSink :: MonadIO m => m Sink
}
data Sink = Sink
{ writeSink :: MonadIO m => Value -> m ()
, closeSink :: MonadIO m => m ()
}
</code></pre>
<p>I guess what I need is ... | <p>This compiles, but I have no clear idea about what you really want to do. I fear that this is not what you want.</p>
<pre><code>{-# LANGUAGE ScopedTypeVariables, RankNTypes #-}
import Control.Monad.Trans
type Value = Int
data SinkBuilder = SB
{ openSink :: forall m. MonadIO m => m Sink
}
data Sink = Sink... |
Hibernate Validator does not work with Jackson write_only access <p>I have an endpoint where a user can register with her email/password. However I, want to check that the password is not empty, but I also want to only deserialize the password, because I do not want to send it back to the client.</p>
<p>Domain</p>
<p... | <p>This can be done using validation groups. Here is how you would achieve this: </p>
<pre><code>public class GroupValidationTest {
public static void main(String[] args) {
Validator v = Validators.newValidator();
Model m = new Model();
m.user = "Harry";
m.password = "Potter";
... |
AJAX success response fires error callback <p>I spent yesterday wondering around in SO for something that would suit me i haven't found anything appropriate.
I'm having a quite common problem with the response of an ajax call from a razor view.
For test purpose i'm forcing a success response to be returned as a Json re... | <p>Your data in the <code>ajax</code> call should look like this:</p>
<pre><code>data : JSON.stringify({ order: $("#hid_order").val() }),
</code></pre>
|
How to restart particular IIS site from Multiple IIS sites? <p>In our company we have multiple projects in single IIS server and I am working on build automation via using CruisControl. My question is I have to restart a particular IIS site after deployment without entering into server or Via using CruiseControl jobs.<... | <p>You can start an individual Web site without affecting the operation of any other Web site that is being that is supported by a server that is maintained by Internet Services Manager. </p>
<p>To start an individual Web site that has previously been stopped:</p>
<ul>
<li><p>Log on to the Web server computer as an a... |
How to make a list without quotes from string? python3 <p>I want to make a program in which i input a string then make it into list and then use list.count. To do this i need list without colons.</p>
<pre><code>a=("44, 4, 5, 6, 7, 8 ")
a=[a]
print(a)
-> ['44, 4, 5, 6, 7, 8 ']
</code></pre>
<p>but i want this:</p>
... | <p>It's even easier than that:</p>
<pre><code>>>> a=("44, 4, 5, 6, 7, 8 ")
>>> my_list = [int(s) for s in a.split(", ")]
>>> my_list
[44, 4, 5, 6, 7, 8]
>>>
</code></pre>
|
How to add a sum of a column and all other rows of a table <p>I have table as </p>
<pre><code> name quentity
pramo 1000
ladkat 2000
</code></pre>
<p>And I want select output as total new row with sum </p>
<pre><code> name quentity
pramod 1000
ladkat 2000
total 3000
</code></pre>
| <p>Try using UNION like:</p>
<pre><code>(SELECT *
FROM your_table)
UNION
(SELECT sum(quentity) as "total"
FROM your_table)
</code></pre>
|
Reset svg fill in css <p>I want to have all my svgs to have the same plain color. So I use</p>
<pre><code>svg *{
fill: #ccc;
}
</code></pre>
<p>But I want to get default fills on :hover. How can I disable the fills and get defaults back?</p>
| <p>You can do this using <code>:not()</code> and effectively style "not hovered".</p>
<pre><code>svg *:not(:hover){
fill: #ccc;
}
</code></pre>
<p>The above might work, here's a quick CodePen that you can play with: <a href="http://codepen.io/anon/pen/rrqyAx" rel="nofollow">http://codepen.io/anon/pen/rrqyAx</a></p>... |
Linked list segmentation fault 11 <p>I'm having a problem with one of my homeworks. I need to do a linked list concat, but after redefining the operator+, I have segmentation fault.
Here is the code:</p>
<p>In main.cpp:</p>
<pre><code>case CONCAT:
do
{
std::cout << "Which two list do you want... | <p>The problem is </p>
<pre><code>lista operator+(lista& a, lista& b)
{
...
return a;
}
</code></pre>
<p>This creates a <em>copy</em> of <code>a</code> which is then immediately destroyed (because you don't save it anywhere). You haven't defined a copy constructor, so you get the compiler defined one... |
Fill texture brush using image, not tile <p>I have a texture brush that uses a certain image to make the texture to be displayed like this:</p>
<pre><code>Image image = new Bitmap("Untitled.png");
for (int i = 0; i < points.Count; i++)
{
using (TextureBrush tbr = new TextureBrush(image))
{
tbr.Rot... | <p>You need to scale using the correct numbers.</p>
<p>If you want an image with a size = width * height pixels to fill a circle of diameter you should scale like this:</p>
<pre><code> int diameter = 100;
Image image = new Bitmap(yourImage);
float scaleX = 1f * diameter / image.Size.Width;
float scaleY = 1f * dia... |
ELKI: Normalization undo for result <p>I am using the ELKI MiniGUI to run LOF. I have found out how to normalize the data before running by <code>-dbc.filter</code>, but I would like to look at the original data records and not the normalized ones in the output. </p>
<p>It seems that there is some flag called <code>-n... | <p>This functionality used to exist in ELKI, but <strong>has effectively been removed</strong> (for now).</p>
<ol>
<li>only a few normalizations ever supported this, most would fail.</li>
<li>there is no longer a well defined "end" with the visualization. Some users will want to visualize the normalized data, others n... |
Laravel complex query <p>I have the following tables:</p>
<p><strong>Dishes</strong></p>
<pre><code>id
name
</code></pre>
<p><strong>Customers</strong></p>
<pre><code>id
name
</code></pre>
<p><strong>Ingredients</strong></p>
<pre><code>id
name
</code></pre>
<p><strong>Dishes_Ingredients</strong> (table to put in... | <p>I don't know Laravel but if you just want to solve your problem:</p>
<pre><code>SELECT *
FROM Dishes d
WHERE d.id NOT IN
(
SELECT DISTINCT dish_id
FROM Dishes_Ingridients
WHERE ingredient_id IN
(SELECT DISTINCT ingredient_id FROM Customers_Allergic_Ingredients cai WHERE cai.c... |
Sass sourcemap on Firefox Ubuntu 16.04 <p>How can I set sourcemaps for sass files on Firefox - Firebug (I'm having Ubuntu 16.04 on VirtualBox), so I can inspect the sass code for ruby-on-rails or php projects? I 'm not entirely sure, but I guess would be a system or a firefox setting, right?</p>
| <p>Firebug does <strong>not</strong> have <a href="https://github.com/firebug/firebug/issues/5894" rel="nofollow">support for source maps</a> and it is <a href="https://blog.getfirebug.com/2016/06/07/unifying-firebug-firefox-devtools/" rel="nofollow">not working anymore once multi-process Firefox is enabled</a>.</p>
<... |
What is the difference between MessagePack, Protobuf and JSON ? Can anyone tell me which one to use when <p>I need to understand the difference between
- message pack
- protocol buffers
- JSON</p>
| <p>Without having jumped in deeply into the matter I'd say the following:</p>
<p>All three are data formats that help you serialize information in a structured form so you can easily exchange it between software components (for example client and server). </p>
<p>While I'm not too familiar with the other two, JSON is... |
alternately appending elements from two lists <p>I have three lists with elements :</p>
<pre><code>a = [[0,1],[2,3],...]
b = [[5,6],[7,8],...]
c = []
</code></pre>
<p>I want to append elements from <code>a</code> and <code>b</code> into <code>c</code> to get:</p>
<pre><code>c = [ [0,1],[5,6],[2,3],[7,8],.... ]
</co... | <p>Basic approach:</p>
<pre><code>>>> a = [[0,1],[2,3]]
>>> b = [[5,6],[7,8]]
>>> c = []
>>> for pair in zip(a,b):
... c.extend(pair)
...
>>> c
[[0, 1], [5, 6], [2, 3], [7, 8]]
>>>
</code></pre>
<p>This breaks if the lengths aren't equal. But you can deal with... |
Azure App Service Owin Instagram and other Auth providers <p>Ive just upgraded my old Azure mobile services app which had various other auth methods other than the facebook, google, twitter etc.. </p>
<p>I think it owin 2.01.</p>
<p>They looked like this : </p>
<p>So implemented Microsoft.WindowsAzure.Mobile.Service... | <p>If I understand you correctly, I assume that you provide three methods (Facebook, Instagram,Twitter) for Authentication. And you have implemented LoginProvider for Instagram by yourself in your old Azure mobile services app.</p>
<p>From <a href="https://azure.microsoft.com/en-us/documentation/articles/app-service-a... |
kendo mvc ajax grid sending Viewbag or ViewData variable as a parameter in client Template Column <p>I'm using Telerik Kendo MVC Grid ,and i need to use client template as a link.
The Question is : How to send ViewBag Variable or ViewData as a parameter within the link?</p>
| <p>Just the syntax for creating a ClientTemplate using a ViewBag field?</p>
<pre><code>@{
ViewBag.Data = "kendo-mvc-ajax-grid-sending-viewbag-or-viewdata-variable-as-a-parameter-in-clien";
}
@(Html.Kendo().Grid<GridViewModel>()
.Name("grid")
.Columns(cols =>
{
cols.Bound(c => c.Fiel... |
Unable to use custom post type taxonomy template in the plugin <p>I am working on a plugin and that creates a custom post type and <code>custom taxonomy</code> for that post type. I simple created single page template that worked fine and now trying to use <code>taxonomy template</code> and that's never working for me.... | <p>I believe your question is answered here:
<a href="http://wordpress.stackexchange.com/questions/51022/default-taxonomy-template-in-plugin-override-in-theme">http://wordpress.stackexchange.com/questions/51022/default-taxonomy-template-in-plugin-override-in-theme</a>, you only need to do something in reverse...</p>
<... |
Spark Naive Bayes Model - No such method error <p>I'm new to Spark and am trying to run the Naive Bayes Java example in Eclipse. It gives a <strong>No such method</strong> error when trying to save the model. </p>
<pre><code>SparkConf sparkConf = new SparkConf().setAppName("JavaNaiveBayesExample").setMaster("local");
... | <blockquote>
<p>Dependencies added for spark-core_2.11 and spark-mllib_2.10.</p>
</blockquote>
<p>Please use spark mllib compiled with Scala 2.11 to resolve the issue.</p>
|
Disable expired resharper and restore keybindings <p>I am waiting on licenses to arrive from licensing team for Resharper I have <code>suspended</code> it in <code>Tools -> Options -> ReSharper</code>.</p>
<p>However all the key combinations are still bound to ReSharper. </p>
<p><a href="https://i.stack.imgur.c... | <p>Just go to Visual Studio' Tools → Options → Keyboard and click Reset.</p>
|
Rule not recognized in makefile? <p>I have a basic makefile to compile C files necessary for compiling a shared library, I have an error because the makefile is not recognized: </p>
<pre><code> SOURCES=/home/test/project/sources
OBJECTS=/home/test/project/objects
$(OBJECTS)/%.o:$(SOURCES)/%.c
$(CC) -fPIC -c $^ -o ... | <p>The main problem is that nowhere you are <em>explicitly</em> telling make what your source files are. Start by doing that:</p>
<pre><code>SOURCEDIR=/home/test/project/sources
SOURCES=$(wildcard $(SOURCEDIR)/*.c)
</code></pre>
<p>Then, derive the object file names from the source file names by substituting <code>.c... |
How to convert properly weekly to shorter span data? <p>I have a data frame of containing weekly time series data.
i need to convert it in daily interpolated values with linear approx.</p>
<pre><code>DATE VALUE1 VALUE2 VALUE3 VALUE4 VALUE5 VALUE6 VALUE7 VALUE8 VALUE9 VALUE10
02-01-2014 95.58 -22.43 ... | <p>You could use <code>na.approx</code> function from <code>zoo</code> library for transforming weekly to daily frequency with linear interpolation
for intermediate values</p>
<p>Adapting an example from <code>?zoo</code> page:</p>
<pre><code>library("zoo")
weeklyDF = read.table(text="DATE VALUE1 VALUE... |
How can you do SQL joins on dates between specific dates? <p>This may be incredibly hard or incredibly simple, I don't know which but I'm stuck.</p>
<p>How do I join data that happened between specific days? How do I write that? The tricky thing is that every row would have a different time period, a unique period for... | <p>Below is for BigQuery Standard SQL (see <a href="https://cloud.google.com/bigquery/sql-reference/enabling-standard-sql" rel="nofollow">Enabling Standard SQL</a>) </p>
<pre><code>SELECT
a.User_Id, Start_date, End_Date,
(SELECT IFNULL(SUM(clicks),0) FROM TableB WHERE user_Id = a.User_Id
AND date BETWEEN Sta... |
Mail Merge several similar attachments in one email <p>I need to send request forms to GP Practices in the area for patient information, and many of them want it in email. There are usually more than one requests per practice.
I have an Excel file with the base demographics of the patients, the practices' code and emai... | <p>Partial answer to show the loop structure to add one or more attachments. This adds one or more reports to an email based on a <code>FileCell.Value</code> and builds the location and detail of the file in the first part of the code.</p>
<pre><code>For Each FileCell In Rng.SpecialCells(xlCellTypeConstants)
... |
Using lambda in default initializer gcc vs clang <pre><code>#include <cassert>
int main()
{
struct point_of_parabaloid
{
double x, y;
double z = [&] { return x * x + y * y; }();
};
point_of_parabaloid p = {1.0, 2.0};
assert(p.z == 5.0);
}
</code></pre>
<p>Works fine for <... | <p>That's a gcc bug.</p>
<pre><code>int main() {
struct A {
int x, i = [&] { return x; }();
} a{0};
}
</code></pre>
<p>This fails, but if weâ¦</p>
<ul>
<li>change <code>&</code> to <code>this</code>, or</li>
<li>declare <code>A</code> as having namespace scope,</li>
</ul>
<p>it works. Neith... |
One XMPP connection for more than one GCM/FCM app <p>I have a bunch of <code>FCM</code> projects and I'd like to use the same XMPP connection to send messages for all those projects. The <code>FCM</code> <a href="https://firebase.google.com/docs/cloud-messaging/server#implementing-the-xmpp-connection-server-protocol" r... | <p>I'm not sure what the question is here. Just use the corresponding Sender ID and Server Key from your Firebase Project. However, do note of the connection limitation mentioned in the docs you linked:</p>
<blockquote>
<p>For each sender ID, FCM allows 1000 connections in parallel.</p>
</blockquote>
<p>I don't rea... |
Relationship and referential integrity constraint using JPA <p>I started to design my Java EE application using MySQL and JPA for persistence, so I have a doubt to how implent it for database design.</p>
<p>So I defined my database tables e.g: employees and departments with his relationship</p>
<p>Using JPA I defined... | <p>In your code system will create a new table by name <code>employee_department_mapping</code> (with <code>employee_id</code>, <code>department_id</code> columns in it) which will contain a mapping of every employee to its department.</p>
<p>However, if you want to handle it as a foreign key in employee table, mark y... |
Rest api documentation automatic generation <p>I recently started recearching the Rest API documentation and i am really interested in automatic documentation of my APIs. </p>
<p>Are there any automatic tools that can generate documentation for standard methods of an API? I am particullary interested in open source to... | <p>There are many options available that will do this. <a href="https://opencredo.com/rest-api-tooling-review/" rel="nofollow">This article</a> provides a list of a small number of popular options:</p>
<ul>
<li><a href="http://swagger.io/" rel="nofollow">Swagger</a></li>
<li><a href="https://projects.spring.io/spring-... |
NSexception with sigbart error <p>I am trying to fetch the result from json web service. For string values it is working fine. When I try to fetch the integer value It throwing nsexeption with sigbart error.</p>
<p>My json result loos like this.</p>
<pre><code>[{"CaseId":81,"ApplicantName":"test","ApplicantContactNo"... | <p>This should work for you:</p>
<pre><code>NSString *caseIdValue = [NSString stringWithFormat:@"%@",[dataDict objectForKey:@"CaseId"]];
NSString *assignedAtValue = [NSString stringWithFormat:@"%@",[dataDict objectForKey:@"AssignedAt"]];
</code></pre>
|
Empty Multiple UILabel values <p>I have multiple uilabels values.
I need to empty the UILabels self.lbl_title when I click on button NEXT.</p>
<p>How can I do this?</p>
<p><code>self.lbl_title.hidden=true</code> not working in this case.</p>
<pre><code>-(void)fetchdata
{
int y=10;
if(arrayquestion.count!=0)... | <p>If you want to just clear the label text, you can use </p>
<pre><code>self.lbl_title.text = @"";
</code></pre>
|
Crash accesing a string inside pointer stored in vector <p>I cannot imagine a single reason for this... here is my base class</p>
<pre><code>class TextureElement
{
public:
TextureElement(std::wstring mname);
std::wstring file;
std::wstring name;
TexMode texmode;
};
</code></pre>
<p>And this is a basic... | <p>If you are inheriting from <code>Element</code>, you may want to declare a <strong><code>virtual</code> destructor</strong> for proper cleanup:</p>
<pre><code>virtual ~Element() {}
</code></pre>
<p>Moreover, pay attention when you put <em>raw owning pointers</em> in <code>std::vector</code>. Consider a vector of <... |
How to add property "Alternate" to an image file on server? <p>I'm using asp.net core and web api for uploading images.</p>
<p>On server:</p>
<pre><code>[Produces("application/json")]
[Route("api/Upload")]
public class UploadApiController : Controller
{
private readonly IHostingEnvironment _environment;
publ... | <p>It's not the answer for question <code>How to add property âAlternateâ to an image file on server?</code> but it seems like solving the problem (sending image file with alternate text).</p>
<p>On server:</p>
<pre><code>using Newtonsoft.Json;
[HttpPost]
public async Task Post(ICollection<IFormFile> files... |
Spring Boot - webservice: Connection Refused <p>I am trying to implement spring boot webservice application as given in spring docs :</p>
<p><a href="https://spring.io/guides/gs/consuming-web-service/" rel="nofollow">https://spring.io/guides/gs/consuming-web-service/</a></p>
<p>Build was successful, request and respo... | <p>The web Service URL you are trying to call may be not reachable or it gets timeout. Ensure the web Service URL path is correct and is listening. also verify the timeout duration set and the time taken from your request.</p>
<p><code>PS. Also check if there is some firewall issue at Server side.</code></p>
<p>For f... |
Rails 4, SQ Lite 3: Access model through model without an association <p>I've got two tables:<br><br>
<em>item</em><br>
<em>recipe</em><br><br></p>
<p>In this example I've got an item object <code>item</code> with the id <code>1</code>.
The <code>item</code> table has one column named <code>recipe_id</code>. For this ... | <p>you'd use your own SQL to find records in a tableusing find_by_sql. The find_by_sql method will return an array of objects even if the underlying query returns just a single record. For example you could run this query:</p>
<p>for example </p>
<pre><code> Recipe.joins("INNER JOIN item ON <your_conditions_to_ge... |
Retrieve Just A Element From Mongodb <p>I'm trying to retrieve just a lesson from a classes collection based on it's id. I put together the following from previous answers, but it doesn't return anything. Can someone point me in the right direction?</p>
<p><em>My Code</em></p>
<pre><code>Class.aggregate([
{$match... | <p>Shouldn't it be <code>lessons</code> instead of <code>lesson</code></p>
<p>on this line :
<code>cond: {$eq: ['$$lessons._id', id]}</code></p>
|
FFMPEG binaries throw error : Undefined Symbols for Architecture x86_64 <p>I have created a cocoa app that uses FFMPEG libraries for streaming.</p>
<p>Uptill now i was using FFMPEG version 3.1.1 and i had libraries available to me. Now i downloaded the latest FFMPEG version 3.1.4.</p>
<p>I executed the shell script a... | <p>I added Frameworks :</p>
<p>AudioToolBox.framework and VideoToolBox.framework</p>
<p>How i understood : Undefined symbol for architecture x86_64 : <strong>A</strong> referenced from <strong>B</strong> in <strong>xyz.o</strong></p>
<p>Add <strong>xyz.framework</strong></p>
<p>and its Done :)</p>
|
Cant get @media screen to work <p>Earlier I asked question about my profile design, I am said I was not gone use the same design on mobile phone but I've changed my mind, howere i use <code>height:10%;</code> on the banner in the main style but when using <code>@media all and (max-width:1024;){}</code> and having same ... | <p>These are the most universal media queries out there as they will help you to cover most of the different screen sizes decently:</p>
<pre><code>@media(max-width:767px){}
@media(min-width:768px){}
@media(min-width:992px){}
@media(min-width:1200px){}
</code></pre>
<p>So try these media queries for your banner:</p>
... |
php preg_match_all avoid quotation mark <p>inside Moodle core, when sending a query to the database there's a call to <strong>preg_match_all</strong> looking for : (colon), in order to find query's parameters. </p>
<p>I have a string (inside " ") composed of digits, a colon and a letter <strong>("102516101:t")</strong... | <p>According to the comments left above, you should explicity specify the variables used in your SQL statement. In other words you should not be constructing your SQL statement by hand, or the minimum required.</p>
<p>Example:</p>
<pre><code>$sql = "SELECT * FROM {groups} WHERE name = :name";
$params = array('name' =... |
[Ansible][Fedora 24] DNF Module Requires python2-dnf but it is Already Installed <p>I have computers on an internal network that is not connected to the internet, and have copied the relevant rpm packages into my local dnf repository. I'm trying to get ansible's DNF module to install a program on another computer but i... | <p>As pointed out by @GUIDO you need <code>python2-dnf</code> on the target host.</p>
<p><a href="http://docs.ansible.com/ansible/dnf_module.html" rel="nofollow">Ansible module documentation</a> states:</p>
<blockquote>
<p>Requirements (on host that executes module)</p>
<pre><code> python >= 2.6
python-d... |
Product files not deleting after WIX upgrade <p>We use a managed bootstrapper.</p>
<p>We have two products in our bundle (let's call it <code>BundleName</code>) - <code>ProductA</code> and <code>ProductB</code>.
We install both products and it works fine.</p>
<p>Next we change a version of <code>BundleName</code> fro... | <p>Found the problem.
<code>ProductCode</code> in <code>Product</code> element was fixed, not <code>*</code>.</p>
<p><a href="http://wixtoolset.org/documentation/manual/v3/howtos/updates/major_upgrade.html" rel="nofollow">How To: Implement a Major Upgrade In Your Installer</a></p>
<p><a href="http://wixtoolset.org/do... |
Mamp localhost on mac not working correctly <p>I need to make my localhost have openssl so i follow this steps here: </p>
<p><a href="https://gist.github.com/jonathantneal/774e4b0b3d4d739cbc53" rel="nofollow">https://gist.github.com/jonathantneal/774e4b0b3d4d739cbc53</a></p>
<p>After following steps the mamp home pag... | <p>Solved!
add this inside Applications/MAMP/conf/apache/httpd.conf</p>
<pre><code>Alias /Yoursite "/Applications/MAMP/htdocs/yoursite"
<Directory "/Applications/MAMP/htdocs/yoursite">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</code></pre>
|
Running R script in Java <p>I have a working R script which creates a .csv file and I want that script to run in java.
I'm using <code>Rcaller</code> for that. Somewhere on SO I got code similar to this.</p>
<pre><code>Random random = new Random();
RCaller caller = new RCaller();
RCode code = new RCode();
caller.setRs... | <p>Sure, you can do it with:</p>
<p><code>Runtime.getRuntime().exec("Rscript myScript.R");</code></p>
<p>Answered already <a href="http://stackoverflow.com/questions/8844451/calling-r-script-from-java">here</a></p>
|
Deserializing JSON Object containing another object <p>I'm trying to deserialize this JSON string using Newtonsoft.Json library. But the returned deserialized object allways returns null. I think it's related to the address object inside the player object.</p>
<p>This is the JSON string</p>
<pre><code>{
"player"... | <p>I was using Newtonsoft.Json 8.0.2.19309.
I had to add a JsonProperty attribute to the Address object inside the Player class. Then the object gets deserialized just fine.</p>
<pre><code>public class Player
{
public Guid id { get; set; }
public string firstName { get; set; }
public string lastName { get;... |
Turn textbox text into string with code in it <p>So I've made a function called <code>Something(string text)</code> that needs a <code>string</code>.
Now I have a button that onclick does <code>Something(textBox1.Text)</code>.</p>
<p>I want the <code>textBox.Text</code> to be able to be something like <code>"test " + ... | <p>You need to compile the string in your textbox and run the code before giving it to your <code>Something</code>-method. </p>
<p>Take a look at <a href="https://github.com/dotnet/roslyn/wiki/Scripting-API-Samples#expr" rel="nofollow">Roslyn</a> to easily evaluate the expression from the textbox.</p>
<p>Then you'll ... |
Javascript Count how many garages have carmake1 <p>I have an oject of data represented as garages.
I need to for example count the number of garages that have carmake1</p>
<p>I have tried this:</p>
<pre><code>count = obj.garages.filter(function(item) { return item === "carmake1" }).length;
</code></pre>
<p>but this ... | <p>You could count it with the check of the property.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var obj = obj = { "garages": [{ "id": "1", "carId": "1", "tags": { "483... |
synonym for active databaseconnection <p>In VB.NET (Visual Studio 2008) I want to scroll through the records of a datatable. I tried like this:</p>
<pre><code> Dim cnnNWind As New ADODB.Connection
Dim rstNwind As New ADODB.Recordset
Dim Test As String
cnnNWind.ConnectionString = "Provider=Microsoft... | <p>The suggestion adding cnnNWind.Open() eliminated the error. For my former question, if the already opened connection could be used I found the solution by trying different things. I can use:</p>
<p>Dataset.Tableadapter.property</p>
|
Using Javascript to change an image on a webpage <p>I've been working on this code for a while and for some reason I can't tell its not changing the image displayed when I press the change image button. Can anyone help?</p>
<p>This is the Javascript file</p>
<p><div class="snippet" data-lang="js" data-hide="false" da... | <p>Inside the outer <code>for-loop</code> check if the <code>img.src</code> is a part of <code>imgArray[i]</code></p>
<pre><code>if (imgArray[i].src.indexOf(img.src)!= -1) // notice the change here
{
//rest of the code remains same
}
</code></pre>
<p>or simply prepend the <code>images/img/</code> to img.src before ... |
Will my Apple Wallet Pass generator work after my Apple Developer subscription is expired? <p>I created an server side application which is generating PkPass files using Apple WWDRCA and Pass Type ID cert. My certificates are installed on the server and they are valid until end of 2017 but my Apple Developer account wi... | <p>You will continue to be able to issue and update passes until your certificate expires. However, we have experienced problems with clients who have let their developer account lapse and have subsequently lost the PassTypeID.</p>
<p>If you anticipate the need to issue or update these particular passes after the exp... |
Multiple file append in response object in node js <pre><code>gfs.files.find({}).toArray(function(err, file) {
if (!err) {
console.log('file length ', file.length);
if (file.length > 0) {
file.forEach(function(each) {
process.setMaxListeners(0);
var mim... | <p>If your target clients are web browsers, then you can't, as the http protocol does not allow for multiple downloads for a single request.</p>
<p>May be you can think of creating an archive(zip) with requested files and send it.</p>
|
How to fix this 400 Bad status error? <p>The following image shows the error and the <code>cfdump</code> output, </p>
<p><a href="http://i.imgur.com/SZLider.png" rel="nofollow"><img src="http://i.imgur.com/SZLider.png" alt="enter image description here"></a> </p>
<p>Here is my JSON Response :</p>
<pre><code>{
"pr... | <p>Create a structure instead of a string. Use CFDump to see it is correct. Like so:</p>
<pre><code><cfset stFields = {
"properties": [
{
"property": "email",
"value": "testingapis@hubspot.com"
},
{
"property": "firstname",
"value": "Adrian... |
How can I get rid of these extra entries in my lookup table? <p>I am making a simple back end to add photos to my website. Each photo can be in multiple categories and is available in multiple sizes, so I have lookup tables to join the photos, categories and sizes together.</p>
<p>Here is my code for populating the lo... | <p>You should not create a new entry in your pivot table. instead you can use <code>attach()</code></p>
<pre><code>foreach($request->category as $category)
{
$photo->categories()->attach($category);
// ----- OR ---------
$cat = Category::where('id',$category)->first();
$photo->categories... |
How do I DRY-ly handle multiple upload types with Carrierwave? <p>I want to allow my users to be able to upload videos, documents & images to s3.</p>
<p>I was thinking that rather than having a model for each and then having 3 different uploader classes, I would just have 1 generic uploader and just whitelist all ... | <p>You could create a generic type then have sub types using STI (<a href="http://eewang.github.io/blog/2013/03/12/how-and-when-to-use-single-table-inheritance-in-rails/" rel="nofollow">Single Table Inheritance</a>). Unless you feel that the sub types would be so different from one another that there will be a lot of e... |
finding a special path string in HTML text in python <p>I'm trying to extract a path in an HTML file that I read.
In this case the path that I'm looking for is a logo from google's main site.</p>
<p>I'm pretty sure that the regular expression I defined is right, but I guess I'm missing something.</p>
<p>The code is:<... | <p>this can help you:</p>
<pre><code>re.search(r'\"\/.+\"',Text).group(0)
</code></pre>
<p>result:</p>
<pre><code>>>> re.search(r'\"\/.+\"',Text).group(0)
'"/images/branding/googleg/1x/googleg_standard_color_128dp.png"'
</code></pre>
|
How to do multiple Select Where in Linq <p>I'm new in Linq, and I want to convert this sql Query to Linq Format.</p>
<p>This is the SQL format</p>
<pre><code>select *
from investorwallets iw
where transactionid in
(select investordepositid from investordeposits)
or transactionid in
(select withdrawalid from investor... | <p>The most direct is:</p>
<pre><code>from iw in investorwallets
where investordeposits.Any(iten => item.investordepositid == iw.transactionid) ||
investorwithdrawals.Any(iten => item.withdrawalid == iw.transactionid) ||
paymentdistributions.Any(item => item.paymentdistributionid == iw.transactio... |
Sequelize adding extra quotes to LIKE <p>It is a conditional query. So that's why the code begins with:</p>
<pre><code>var where = [];
</code></pre>
<p>Then I always put the ID for searching:</p>
<pre><code>where.push({myId: myId});
</code></pre>
<p>I then check if conditions are met and in that case add a LIKE:</p... | <p>By bad. I changed $like with like and all the quotes disappeared.</p>
|
Why cant first and last be used? <p>Hey guys I cant run due to the private strings "first" and "last" not being "used." </p>
<p>Any idea why to what is causing the problem? thanks!</p>
<pre><code>public class Bananas{
private String first;
private String last;
private static int members = 0;
publ... | <p>This isn't a compilation error, it's a runtime error. As it states, your <code>printf</code> formatting is incorrect - it expects three arguments (two strings and an int) while you're only passing onw (<code>members</code>). From the context, I assume you meant to pass <code>first</code> and <code>last</code> there ... |
Drawing the human silhouette with bezier point in Processing <p>I'm new here ... I need help with an issue Bezier Point in Processing, I apologize in advance for the English, I'm from Brazil, I write with the help of Google Translator ...</p>
<p>I tried to draw the "silhouette" of the human body, ie not need to have d... | <p>Instead of trying to hammer code you found on the internet into submission, I highly recommend you start a little smaller and try to focus on one small thing at a time.</p>
<p>Instead of trying to get your whole figure working, focus only on the head, or only on one line of the head.</p>
<p>The <code>bezier()</cod... |
My header image won't show <p>I am making a small website (school project), but my background won't appear at all! I have tried moving the image/path, adding it to the body instead. Is there something wrong with the code, or something else?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="tru... | <p>Try and change the background tag to background-image</p>
<pre><code>background-image: url(img/background.jpg);
</code></pre>
|
ASP .NET MVC 5 + Bootstrap modal with form POST <p>I've got problem with posting bootstrap modal in ASP .NET MVC 5 web application.
I'm using partial view for modal:</p>
<pre><code> @model Presentation.APP.MyAPP.Portal.Models.DocumentAndFilesManager.AddDocumentTypeModel
<script>
$(document).ready(functio... | <pre><code>$.ajax({
url: form.attr("action"),
method: form.attr("method"), // post
data: form.serialize(),
success: function (partialResult) {
$('#addDocumentTypeModal').modal('hide');
$('#addDocumentTypeModal').find("#errorMsg").hide();
$("#form-container").html(partialResult);
}
error... |
How to drop the response of an Observable <p>With the help of <a href="http://stackoverflow.com/questions/39994096/start-first-call-of-intervalobservable-instant">Observable.timer(0, 1000)</a> I am making continuous requests to my server in a defined time pattern. After I processed the content of the response it is pos... | <p>If I understand correctly, you are looking for the <code>switchMap</code> operator. </p>
<p>If no response arrives within 1 second (the specified interval) the HTTP request is silently canceled, and another one is started.</p>
<p>Update:</p>
<p>If you are looking to cancel the HTTP request manually, you have to c... |
guide to dependency ranges when developing a Haskell library <p>As a Haskell beginner, I'm working on a small library that I want to make public. One problem I have is that I don't know what I should do about the ranges of the dependencies I have. Does it make sense to set the range to the current MAJOR version, for ex... | <p>The <a href="http://pvp.haskell.org/" rel="nofollow">Package Versioning Policy</a> document specifies besr approaches to assigning versions for your own package.</p>
<p>If you don't want to get too deep into this, you can omit all version constrains on packages you are depending on and then ask <a href="https://www... |
Detecting gibberish in off_topic intent with IBM Watson Conversation service <p>When constructing an intent designed to capture off topic questions, should we include gibberish phrases (such as 'fgufeu ewe qeweuwe' or other non-valid English)? I'm unsure whether including such words increases or decreases the likelihoo... | <p>The best answer is to test your model after you have created it. I've seen some instances where people have done this and it appears to work. </p>
<blockquote>
<p>I'm pretty confident users will try mashing the keyboard to see how the bot responds,</p>
</blockquote>
<p>From experience you will find that what you... |
How to use function pointer inside arduino interrupt service routine to modify the ISR? <p>I'm trying to design a simple Arduino interrupt service routine that uses a function pointer in it so that it can effectively be modified from the <code>main()</code> function. The following is my code.</p>
<pre><code>#include &... | <p>As usual, you have to use <code>volatile</code> modifier for variable used in both <code>ISR</code> and rest of code.</p>
<p>The <code>void (* volatile interrupt)(void) = NULL;</code> should do the trick. </p>
|
unable to hit service from IIS <p>when i hit a service using localhost the application run properly but when i hit it with IIS it doesnot reach to that service code</p>
<p>code run properly when hit with localhost .. similarly when use iis , it doesnot even hit the service</p>
<p>1.var urlreport = "<a href="http://lo... | <p>i think incorrect url become
<a href="http://206.19.38.20/Service1.svc/" rel="nofollow">http://206.19.38.20/Service1.svc/</a>" as per "<a href="http://localhost:57451/Service1.svc/" rel="nofollow">http://localhost:57451/Service1.svc/</a>"
remove the report from given code.</p>
|
How to get read/write disk speed in Python? <p>In a Pyhton program I need to get the accumulated read/write speeds of all disks on the host. I was doing it with <code>subprocess.check_output()</code> to call the following Linux shell command:</p>
<pre><code>$ sudo hdparm -t /dev/sda
</code></pre>
<p>This gives as a r... | <p>According to <a href="http://unix.stackexchange.com/questions/55212/how-can-i-monitor-disk-io">http://unix.stackexchange.com/questions/55212/how-can-i-monitor-disk-io</a> the most usable solution includes the tool sysstat or iostat (same package).</p>
<p>But seriously, since you have sudo permissions on the host, y... |
SQL Server error when trying to connect <p>So I am having a problem connecting to my sql server.</p>
<p>I know 100% its working and accepting connections, but for some reason I keep getting an error.</p>
<p>I can browse the server just fine in Server Browser, and If I bind the datasource to a datagrid, I can preview ... | <p>Problem was within our network.</p>
<p>Our IT guy decided to have all our computers "My Documents" on a separate server and NOT on our own machines.</p>
<p>So Visual Studio by default saved my project to this server and not to my own computer. This was causing the block to the SQL Server.</p>
<p>I solved this by ... |
Android.SMSthief.A2e76 (PUP) in Classes.dex <p>I recently updated my Android Studio to the latest build and I am facing one issue
which is Android.SMSthief.A2e76 (PUP).</p>
<p>I don't know what does this mean but it's being detected by Quick Heal Total Security and I don't know what to do. please let me know what can... | <p>It looks a trajon .. see this :<a href="http://www.solvusoft.com/en/malware/trojans/android-smsthief-a/" rel="nofollow">http://www.solvusoft.com/en/malware/trojans/android-smsthief-a/</a></p>
|
Linkedin inbox API <p>I tried to search a lot but seems like what i am trying to do has not been done before. Here is what I am trying. I am trying to figure out a way to make a script that takes a linkedin profile url as input and checks if I have sent any message to that profile in past. If I have sent script gives ... | <p>Not sure what exactly you are asking.</p>
<p>But the Linkedin API is terrible and should be avoided, they have a track record of screwing over 3rd party apps. AFAIK you cannot get any data about a user except their basic profile info and even that is unpredictable, sometimes you'll get like 4 fields at most. Don't... |
how to add virtual host? <p>for windows open this path</p>
<pre><code>c:\Windows\System32\drivers\etc\hosts
</code></pre>
<p>open in notpad or texteditor
show hidden files Must be on to open this path</p>
<p>host file view some thing like this</p>
<pre><code># Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a s... | <p>Please find below url which might help you out for creating virtual host on window </p>
<p><a href="http://stackoverflow.com/questions/2658173/setup-apache-virtualhost-windows">ReferenceLink</a></p>
|
How do I set up ADB to send commands to mulitple Android devices WINDOWS <p>I build a script for work so that installing Android phones becomes automatic. The problem I encounter is that I can't run commands if I connect 2 or more phones to my computer. Is there a way that I can run the same script on multiple Android ... | <p>Okay i finally figured it out. </p>
<pre><code>@echo off
cls
FOR /F "tokens=1,2" %%a IN ('adb.exe devices') DO (
IF "%%b" == "device" (
start /b adb.exe -s %%a {Command}
)
)
</code></pre>
<p>When i remove the -r %1 the input tap command works. I'm happy to see it also works when i attach one device to my compute... |
Create rails routes only for localhost <p>I'd like certain rails routes to only be accessible from localhost. In other words if you attempted to access that url from a non localhost connection you would be given a response equivalent to the route not existing.</p>
<p>Optimally some way of specifying routes as local in... | <p>The file <code>routes.rb</code> contains special DSL for routes, but it's <em>still ruby</em>.
So, did you try put your routes in simple condition?</p>
<pre><code># routes.rb
if Rails.env.development?
# your special local routes definition
end
</code></pre>
|
How to hide SVG elements with JavaScript on a button click? <p>I have tried doing that with this code:</p>
<pre><code>svgElement.style.display = "none";
</code></pre>
<p>but it didn't work. How is it possible to do it with <code>getElementById</code>? </p>
| <p>Use the SVG visibility attribute.</p>
<p><a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/visibility" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/visibility</a></p>
<p>The visibility attribute lets you control the visibility of graphical elements. With a value of hi... |
Convert json column data into table in sql server 2012 <p>I have json stored in table with 3 million rows.
A single row contains json in below format</p>
<pre><code>[
{
"Transaction":[
{
"ProductInfo":[
{
"LINE_NO":"1",
"STOCKNO":"8907254... | <p>Well most efficient way will be to write a procedure and use open json in sql server
check below link:
<a href="https://msdn.microsoft.com/en-IN/library/dn921879.aspx" rel="nofollow">https://msdn.microsoft.com/en-IN/library/dn921879.aspx</a></p>
|
how to update all the keys in mongoDb document <p>Hi I have a collection that has a complex structure, and the documents in this structures are different in the structure. I want to update all the keys <code>V</code> to have value <code>0</code> in this collection.
Example:</p>
<pre><code> {
"_id" : ObjectId("5... | <p>You can do this with a short javascript. You need to iterate through each property of each document, checking the name of the property. If it matches the name "V" then update it with the value 0. This can be done recursively using a loop. The following javascript code should do the needful:</p>
<pre><code>funct... |
spark parallelize writes using list of dataframes <p>I have a list of dataframe created using jdbc. Is there a way to write them in parallel using parquet?</p>
<pre><code>val listOfTableNameAndDf = for {
table <- tableNames
} yield (table, sqlContext.read.jdbc(jdbcUrl, table, new Properties))
</code></pre>
<p>I... | <p>You can future to perform write actions asynchronously:</p>
<pre class="lang-scala prettyprint-override"><code>dfs.map { case (name, table) =>
Future(table.write.mode("overwrite").parquet(getStatingDir("name")))
}
</code></pre>
<p>but I doubt it will result in any significant improvement. In case like yours ... |
How does boost::multi_index work with member functions? <p>If I have a boost::multi_index as follows,</p>
<pre><code>typedef multi_index_container<
employee,
indexed_by<
hashed_unique<mem_fun<employee, std::string, &employee::getname> >,
hashed_unique<mem_fun<emp... | <p>From the <a href="http://www.boost.org/doc/libs/1_61_0/libs/multi_index/doc/tutorial/basics.html#iterator_access" rel="nofollow">documentation</a>:</p>
<blockquote>
<p>The iterators provided by every index are constant, that is, the elements they point to cannot be mutated directly. This follows the interface of ... |
How to represent a Mongo based NumberLong() in org.springframework.data.mongodb.repository.Query() <p>I need to fetch records from a MongoDB which has a set of documents. I am using Spring Boot and MongoRepository to do the CRUD operations. I am using a Query annotation to pass my Mongo query.But Spring is unable to pa... | <p>Try this:</p>
<pre class="lang-spring prettyprint-override"><code>@Query(value = "{ '_id.AID' : ?0 }", fields = {"_id.STS' : {'$gte': NumberLong(1475778600)}, '_id.ETS':{'$lte': NumberLong(1475781659)}}")
</code></pre>
|
How to include template file in ngcordova Isoffline()? <p>I am new to ionic app development . I am developing a app in which i am using ng Cordova network information plugin to check whether app is connected to internet or not . if internet is connected I want to display template file. is it possible to do it ?? if so ... | <p>You can do it from run method, more info in <a href="http://ionicframework.com/docs/api/service/$ionicPopup/" rel="nofollow">Ionic PopUp Service</a></p>
<pre><code>.run(function($window, $rootScope, $cordovaNetwork, $ionicPopup) {
if ($cordovaNetwork.isOffline()) {
var myPopup = $ionicPopup.show({
... |
Can we use `const` instead of `let` everywhere? <p>With <code>flowtype</code> we prefer <code>const</code> against <code>let</code></p>
<p>I have function that needs to be worked in most performant way and it's works well for me, it's compare two arrays, so it's cool example for my question:</p>
<pre><code>/**
* @fun... | <p>Instead of iterating the arrays by mutating index variables, you can use <code>forâ¦of</code> loops:</p>
<pre><code>function compare(arraFrom, arraTo, compareFunction) {
let notEqual = true;
if(arraFrom.length !== arraTo.length) return false;
for (const a of arraFrom) {
notEqual = true;
for (const b ... |
I want get checked multiple record id in yii2 <p>I am new here can anyone tell me how to get checked record id from index for remove selected record using <strong>Ajax</strong> and <strong>Jquery</strong> this is my form and ajax script for select this code does not do any action so let me know </p>
<pre><code><div... | <p>In your gridview add <code>id</code> option</p>
<pre><code>GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'id'=> your-id //set your id here and use this is in jquery
//'class' => ActionColumn::className(),
'columns' => [
... |
The Android build FFMPEG encounter problems <p>I write an Android test App on Ubuntu, the NDK - BUILD, appeared</p>
<p>/ home/lee/Work/Android/the NDK/Android - the NDK - r10e toolchains/arm - Linux - androideabi - 4.8 / prebuilt/Linux - x86_64 / bin /../ lib/GCC/arm - Linux - androideabi / 4.8 /../../../../ arm - Lin... | <p>This works with 3.1.4 although it doesn't build a single library.</p>
<pre><code>#!/bin/bash
NDK=$HOME/Android/Sdk/ndk-bundle
SYSROOT=$NDK/platforms/android-19/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64
CPREFIX=$TOOLCHAIN/bin/arm-linux-androideabi-
function build_it {
./co... |
Can I scan a website for all it's text articles? <p>Is it possible to scan every text news article of a specific website?
I mean, I known about text extraction techniques but can I do it for the whole website?</p>
<p><strong><em>For example</em></strong>: I have some sentences and I want to know if they match to a sp... | <p>with PHP the simplest way would be using the <a href="http://www.w3schools.com/php/func_filesystem_file_get_contents.asp" rel="nofollow">file_get_contents()</a> function, it would retrieve the page's source code and from there you could parse it to get the specific text you want.</p>
<p>Another possibility would be... |
magento 2 collection gives empty data? <p>below is my code:</p>
<p>$transObj = $this->_objectManager->create('Magento\Sales\Model\Order\Payment\Transaction');</p>
<pre><code> $order_id = 9706;
$trans_result = $transObj->getCollection()
->addAttributeToSelect(
'order_id'
... | <p>I'm pretty sure its within the attributes. Make it simpler.</p>
<pre><code> $order_id = 9706;
$trans_result = $transObj->getCollection()
->addFieldToFilter('order_id', array('eq' => $order_id))
</code></pre>
<p>You should the same value because you're using all columns from the ... |
How to implement styling in page? <p>I am making custom h1 styling menu for customize panel in wordpress site but I don't know how to include the custom h1 styles in html structure of page.</p>
<pre><code>$wp_customize->add_section( 'h1_styles' , array(
'title' => __('H1 Styles','wptthemecustomizer'),
'pan... | <p>You can do it directly in html outputing <code><style></style></code> and some css in there (which is faster than loading external files, and Google Speed Insights maybe not recommends, but approves that way). You can also wp_enqueue_style() if you want to.</p>
|
Painting a line out of circles <p>Im not having any type of syntax error, but more something on the mathematical/logic side. So Im trying to draw a line out of circles, giving only the start and the end point. My problem lies in getting the slope of the line. Here is my code for getting the slope and painting the line:... | <p>I noticed the dots get more spaced as the difference between difX and difY becomes large. adding this method then calling it after setting the vectors should fix it.
here is the method:</p>
<pre><code>public void rescale(){
double hyp = Math.sqrt(Math.pow(xVector,2) + Math.pow(yVector,2));
xVector /= hyp;
... |
SQl cmd.ExecuteReader() what does it return <p>I'm studying ASP.NET. I wondered if <code>cmd.ExecuteReader()</code>'s output could be temporally stored into something, like a temp variable, to later re-use it or alter it. I often use temp variables to store stuff.</p>
<p>How can I let a <code>dropbox</code> and a <cod... | <p><a href="https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader(v=vs.110).aspx" rel="nofollow">SqlDataReader</a> is a forward-only stream of rows from a SQL Server database.</p>
<p>You can bind a SqlDataReader to a GridView in the following ways:</p>
<p>Simple Examples:</p>
<pre><code> co... |
How to setup Netflix Eureka <p>is there any tutorial/example which shows me step by step how to setup a eureka server cluster and a eureka zuul cluster which forwards my requests to my microservices? The netflix documentation is sometimes a bit old and overall very bad and the spring cloud integration does not show any... | <p>I couldn't find one guide that showed both Zuul and Eureka but there were two Spring guides that cover both topics. With a little magic I don't think it would be too hard to understand how Zuul and Eureka can work together.</p>
<p><a href="https://spring.io/guides/gs/service-registration-and-discovery/" rel="nofoll... |
Typescript & Uglify Tasks <p>Ok, so I am playing around with typescript and was hoping to use it to minify my code but as I understand it, typescript does not do that. So I I built my Gruntfile like this, </p>
<pre><code>module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json... | <p>I think I have a solution to this issue. I added the TS task to my JSFiles watch task and added the typescript files to the list of files it should watch for, like so:</p>
<pre><code> 'JSFiles': {
files: ['/js/**/*.js', '/typescript/**/*.ts'],
tasks: ['ts', 'uglify'],
options: {
... |
java script html element scrape using a scrapy on phython 2.7.11 i get like these <pre><code>[root@Imx8 craigslist_sample]# scrapy crawl spider
/root/Python-2.7.11/craigslist_sample/craigslist_sample/spiders/test.py:1: ScrapyDeprecationWarning: Module `scrapy.spider` is deprecated, use `scrapy.spiders` instead
from s... | <p>your should set name='spider' in craigslist_sample/craigslist_sample/spiders/test.py </p>
<pre><code>class MySpider(Spider):
name = 'spider'
def parse(self,response):
#....
</code></pre>
|
Show dateTime column from MySql Database to GridView in C# <p>I am having problems with displaying a column from mysql database to a gridView. The column is DateTime in sql format is a such "2016-03-09 05:09:00". The problem i am facing is that other column gets displayed to the gridView but not the dateTime from Mysql... | <p>Please Use this Instead of your Text hope this works,</p>
<pre><code>Text='<%# Eval("app_datetime", "{0:dd/MM/yyyy}") %>' />
</code></pre>
|
Understaning of static objects in main function <p>I am trying to build application, where it will be choosen according to console argument if its gonna be gui application or console.</p>
<pre><code>int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QCommandLineParser parser;
parser.setAppl... | <p>Because when your code goes out of braces:"con" and "ui" objects will be destroyed because their scope limited by braces if they are not static.</p>
|
How to deal with logic error with async? <p>As I use async in my work. I will send a ajax requst, and then receive.</p>
<p>I will write like this.</p>
<pre><code>const API = {
init() {
this.initIndexData();
},
async initIndexData() {
try {
let data = await this.getData();
} catch (e) {
... | <p>You can use the ordinary <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch" rel="nofollow"><code>.catch</code> method</a> of promises:</p>
<pre><code>async initIndexData() {
let data = await this.getData().catch(e => {
console.log(e);
});
},
async get... |
DBPedia missing some English abstracts and comments <p>I'm aware that DBpedia had a new release last week. It appears as if that release is missing some English abstract and comment fields.</p>
<p>For example, last week I was able to get the abstract for George Washington, now there are eight abstracts but none are in... | <p>Short term, you might try the <a href="http://lod.openlinksw.com/sparql?default-graph-uri=&qtxt=PREFIX%20%20dbo%3A%20%20%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2F%3E%0D%0A%0D%0ASELECT%20%3Fabstract%0D%0AWHERE%20%7B%20%0D%0A%20%20%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FGeorge_Washington%3E%20dbo%3Aabstract%20%3Fa... |
Is there any tool through which i can join data from two tables - One in hive & Other in cassandra. Also I have to run this job through oozie <p>I have one table in hive & one table in cassandra.
I want to join them, then based on result, store some data into cassandra.</p>
<pre><code>Ques 1) Is it possible?
Ques ... | <p>Yes, this is possible.</p>
<p>You have to export the data from Hive(delimited data) and export them into cassandra and then apply join and vice versa.</p>
<p>These are possible in Oozie.</p>
|
allow user to change text in div <p>Hello guys I am trying to create a function in js that will allow user to edit a text inside a div. here's my view:</p>
<pre><code>@endsection
<div onload="InitEditable ();" id="content-link2"></div>
@show
</code></pre>
<p>Here's my HTML file loaded inside div id="cont... | <p>Why don't you try <code>contenteditable</code>. </p>
<p>For example:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><div contenteditable="true">Type to edit..... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.