input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Why is the * is not considered a MathSymbol? <p>I was answering this <a href="http://stackoverflow.com/questions/39515852/what-exactly-is-classified-as-a-symbol-in-c/39515957#39515957">question</a> and one guy commented in the thread that the '*' nor the '-' are not MathSymbol. If you execute this c# both return false:... | <p><a href="http://www.fileformat.info/info/unicode/category/Sm/list.htm" rel="nofollow">Unicode Math Symbols are listed here</a>.</p>
<p>Unless explicitly stated (which it is not) normal ASCII characters '*' and '-' and '/' are not in this range, even if they are conventionally used in text / programming languages to... |
How can I check for equivalent in javascript object keys <p>I have this object, I want to make such users don't add other items to database , when there is an item in object with the same key name.</p>
<pre><code>{
"0360841d73bd74b268dcc3abad2555c0": {
"file_dislikes": 0,
"file_likes": 0,
"slang": "mmmmmmmmm",
"slangD... | <p>You need a flag and exit the loop, if the slang is found and prevent an insert into the db.</p>
<pre><code>var unique = true;
for (var keys in vm.slangs) {
var getThisObject = vm.slangs[keys];
if (getThisObject.slang.toLowerCase() === "Damnit".toLowerCase()) {
console.log("there is a slang with tha... |
Share link in social auth app on click without login in android? <p>I want to share a link in social auth through the dialog box. How can I achieve it without login in to the app</p>
<p>Something like <a href="http://i.stack.imgur.com/QH19V.png" rel="nofollow">this</a>.</p>
| <p>check it for solution and may be helpful to you<a href="http://www.techrepublic.com/blog/software-engineer/get-social-using-android-intents-to-share-a-link/" rel="nofollow">http://www.techrepublic.com/blog/software-engineer/get-social-using-android-intents-to-share-a-link/</a></p>
|
Disable drag bubbling for nested sortable items in jQueryUI <p>Given a set of sortable/draggable containers, each of which contains draggable/sortable list items, how can list items be optionally non-sortable without allowing the drag event(s) to bubble up to the parent container?</p>
<p>In the example below, if you d... | <p>In order to stop the dragging event for non-sortable element you may disable the items not included:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(function () {
$(... |
How can I use 'puppetlabs/rabbitmq' module to set up HA rabbitMQ? <p>I am in no ways an expert on RabbitMQ, but I am trying to puppetize the setup of a RabbitMQ cluster. In the documentation a co-worker of mine wrote I need to implement the equivalent of executing ...</p>
<pre><code>rabbitmqctl set_policy HA '^(?!amq... | <p>Checking the source code here: <a href="https://github.com/puppetlabs/puppetlabs-rabbitmq/blob/master/lib/puppet/type/rabbitmq_policy.rb#L21-L24" rel="nofollow">https://github.com/puppetlabs/puppetlabs-rabbitmq/blob/master/lib/puppet/type/rabbitmq_policy.rb#L21-L24</a></p>
<p>we see that the name parameter for that... |
Using a one time login for my test suite in testNg <p>The code listed below is supposed to login in the 2nd <code>@Test</code> block and it will pick it up from the login file has been created. I extends the "Testbase" class. It is logging in fine, but the second code not able to pick it up from there, and again it per... | <p>It looks like you have two different tests. Once the first method runs, it closes (since you are extending the <code>tearDown()</code> method). So when the second method is going to run, there will be no login thus won't be able to perform its goal.</p>
<p>You should include the login method call in all tests(metho... |
Macro to rename multiple functions together <p>Following statement can be used to rename "expt" function to "power": </p>
<pre><code>(define-syntax power (make-rename-transformer #'expt)
</code></pre>
<p>Multiple functions can be renamed using above statement multiple times. </p>
<p>Can one rename multiple functions... | <p>Sure,</p>
<pre><code>#lang racket
(define-syntax-rule (renamer [old new] ...)
(begin (define-syntax new (make-rename-transformer #'old)) ...))
(renamer [expt power] [+ add] [- sub])
</code></pre>
<p>But as @AlexisKing says, it's more convenient to use <a href="http://docs.racket-lang.org/reference/require.html... |
"OpenSSL: EC_KEY_generate_key FAIL ... error:00000000:lib(0):func(0):reason(0)" on pyelliptic.ECC() <p>I'm getting the above error while using <code>pyelliptic</code> (versions given below).</p>
<p>The python code which triggers it: </p>
<pre><code>print("Salt: %s" % salt)
server_key = pyelliptic.ECC(curve="prime256v... | <p>Just added the following:<code>WSGIApplicationGroup %{GLOBAL}</code></p>
<p>in <code>/etc/apache2/sites-available/default-ssl.conf</code> file and all these errors got resolved. </p>
|
Javascript onblur not working properly <p>I'm trying to create a function that will allow a div to be edited and when no longer focused (like clicking outside the element), it should execute a function.</p>
<p>When testing this in a fiddle, the expected response does not occur. Instead, when the element is clicked, it... | <p><code>this.onblur(alert());</code> <strong>calls</strong> <code>alert()</code> and then passes its return value into <code>onblur</code>, exactly the way <code>foo(bar())</code> <strong>calls</strong> <code>bar</code> and then passes its return value into <code>foo</code>.</p>
<p>Instead, you'd assign a function to... |
How to tell that string is a json? <p>I have a string that I pull from a REST API that is actually a JSON. </p>
<p>I can't use <code>req.json()</code> as python doesn't format json correctly i.e. it is using single quotes and not double quotes, plus it puts a unicode symbol where there shouldn't be one. This means I... | <p>You can check if a string is valid json by catching the error.</p>
<pre><code>import json
def is_json(myjson):
try:
json_object = json.loads(myjson)
except ValueError, e:
return False
return True
</code></pre>
<p>Test cases:</p>
<pre><code>print is_json("{}") #prints True
p... |
Putting a requirement on the type of a member of a trait implementation <p>I have a trait that implements another trait:</p>
<pre><code>trait RandomAccessIterator : Sub + VariousOthers {}
</code></pre>
<p>How do I specify, that for all implementations of this trait, the result of the subtraction (the <code>Output</co... | <pre><code>trait RandomAccessIterator : Sub<Output = isize> + VariousOthers {}
</code></pre>
<hr>
<p>As discussed in <a href="https://doc.rust-lang.org/stable/book/" rel="nofollow"><em>The Rust Programming Language</em></a> chapter about <a href="https://doc.rust-lang.org/stable/book/associated-types.html" rel=... |
How do I get number of products for each tag <p>I am using loopback js with mongodb.
I have a product collection like:</p>
<pre><code>{
name:'prod 1',
tags:['tag1','tag3']
},
{
name:'prod 2',
tags:['tag2']
},
{
name:'prod 3',
tags:['tag2','tag3']
}
</code></pre>
<p>I need to find the number of products gr... | <p>Well there are couple of ways to get result you desired. However if you are expecting precise document format, try in mongo shell.</p>
<pre><code>var obj = {};
db.collection.aggregate([
{$unwind:"$tags"},
{$group:{_id:"$tags", count:{$sum:1}}}
]).forEach(function(doc){
obj[doc._id] = doc.count;
});
pr... |
I have a variable with a list of values that I would like to loop through & print value with a comment <p>Using #!/bin/bash</p>
<pre><code>variable
----------
abc123
abc1245
abc2390
</code></pre>
<p>I would like to do the following:</p>
<pre><code>for r in "$variable" ; do
if [ [ "$variable" != ""] ] ; then
ec... | <p>almost!</p>
<p>take the quotes off of <code>$variable</code>, otherwise it's treated as a single value:</p>
<pre><code>for r in $variable ; do
if [ "$r" != "" ] ; then
echo "$r OK"
fi
done
</code></pre>
<p>(also, your <code>if</code> was checking <code>$variable</code> instead of <code>$r</code> each time... |
How do I get a jQuery function to work with specific elements when they have the same class names? <p>I have sections (divs) with text in it, but when the text is too long I made it so the text "fades" (with css) and displays a "show more" button, which shows the full text for that specific div when clicked. The proble... | <p>When the user clicks on <code>.fade-anchor</code> you can use <code>this</code>to get the element currently selected, you should also use classes instead of ids for multiple elements, like so:</p>
<pre><code>$('.fade-anchor').click(function(e){
e.preventDefault();
$(this).parent('.fade-content').css('max-he... |
How can i easily handle numberseries formated with brackets? <p>I have a long list of numberseries formated like this:</p>
<pre><code>["4450[0-9]", "6148[0-9][0-9]"]
</code></pre>
<p>I want to make a list from one of those series with single numbers:</p>
<pre><code>[44500,44501,..., 44509]
</code></pre>
<p>i need t... | <p>Probably not the best solution, but you can approach it recursively looking for the <code>[x-y]</code> ranges and <a href="https://wiki.python.org/moin/Generators" rel="nofollow">generating</a> values (using <code>yield</code> and <a href="https://docs.python.org/3/whatsnew/3.3.html#pep-380" rel="nofollow"><code>yie... |
How do you trigger a custom script in FormB from a form submittal into SheetA though FormA? <p>How do you trigger a custom script in FormB from a form submittal into SheetA though FormA?</p>
<p>Or how could I script updating values to a list question in FormB after a response has been submitted in FormA?</p>
| <p>there are a couple ways to achieve that</p>
<ol>
<li><p>use <a href="https://developers.google.com/apps-script/guide_libraries" rel="nofollow">apps script libraries</a> to share the code in both scripts. might require changes if it uses the "current spreadsheet" or script properties.</p></li>
<li><p>in script1, p... |
Setting up client-specific overrides for SCSS project <p>I'm integrating SCSS into an existing product with a few dozen clients. I'm fairly new to the technology, and was wondering if there's a standardized way to accomplish what I'm trying to do.</p>
<p>I'd like to set up the project in such a way that I can have cli... | <p>You could do this with <code>@import</code> statements if you put all the default CSS in a partial and each client specific CSS in it's own partial. Something like this:</p>
<p><strong>client-one.scss</strong></p>
<pre><code>@import '_default-styles.scss';
@import '_client-one.scss';
</code></pre>
<p><strong>clie... |
Finding closest value in a dictionary <p>I have a dictionary, <code>T</code>, with keys in the form <code>k,i</code> with an associated value that is a real number (float). Let's suppose I choose a particular key <code>a,b</code> from the dictionary <code>T</code> with corresponding value <code>V1</code>âwhat's the m... | <p>Since the values for a given <code>a</code> are strictly increasing with successive <code>i</code> values, you can do a binary search for the value that is closest to your target.</p>
<p>While it's certainly possible to write your own binary search code on your dictionary, I suspect you'd have an easier time with a... |
BigQuery full table to partition <p>I have a 340 GB of data in one table (270 days worth of data). Now planning move this data to partition table. </p>
<p>That means I will have 270 partitions. What is the best way to move this data to partition table. </p>
<p>I dont want to run 270 queries which is very costly opera... | <p>I see three options </p>
<ol>
<li><p><strong>Direct Extraction</strong> out of original table:<br>
<strong>Actions</strong> (how many queries to run) = Days [to extract] = <strong>270</strong><br>
<strong>Full Scans</strong> (how much data scanned measured in full scans of original table) = Days = <strong>270</st... |
DataGridView DateTimePicker Column - add Long Format support (Date and the Time) <p>I'm trying to make gridview Datetimepicker column and i succeeded,
but i have a little problem that when the user edit the date in the gridview
the date appear in short "11/9/16" but what i want is the date and the time together"11/9/16... | <p>To show a date and time in custom format, you should assign format to <a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcellstyle.format(v=vs.110).aspx" rel="nofollow"><code>Format</code></a> property of <a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridv... |
Hibernate OneToOne BiDirectional Optional Relationship: Works when inserted without optional object, Breaks when updated with new optional object <p>I have the following OneToOne relational setup between the two object, ChecklistItem and ButtonAction (shown in code snippets below). It's kind of a unique setup, I suppos... | <p>To be honest, I'm still not sure why my original problem presented or why this solution works, so if anyone can shed some light on those things, PLEASE comment; I wish to understand better.</p>
<p>Kudos to @CarlitosWay and @Matthew for working with me to try and find a solution. CarlitosWay was on to something when... |
Logging Features/Functions Used In an Application <p>Here's the scenario: I am trying to keep myself and fellow employees from wasting time on programming fixes on features that are never used by users. I work on an application that has been around for 10 years and has a lot of features that may never be used by custom... | <p>Aspect Oriented Programming is a way to implement the idea.</p>
<p>You are not the first one that has such an idea. Analytics are usual on web pages and in web apps. This is probably mainly driven by business considerations.</p>
<p>There are also ideas around in the DevOps community. I think there is a good chance... |
IN MVC6 return Json(rows, JsonRequestBehavior.AllowGet) ISSUE <p>IN MVC6 return Json(rows, JsonRequestBehavior.AllowGet); method is changed and not allowing to set JsonrequestBehavior. What is alternative in MVC6</p>
| <p>That overload of <code>Json</code> method which takes JsonRequestBehavior does not exist in the aspnet core any more.</p>
<p>You can simply call the <code>Json</code> method with the object data you want to send back.</p>
<pre><code>public IActionResult GetJsonData()
{
var rows = new List<string> { "Item... |
Swift 3 Core Data <p>I am getting the following error while trying to do NSFetchRequest in Swift 3</p>
<pre><code>Generic parameter 'ResultType' could not be inferred
</code></pre>
<p>i checked lots of links and i have not been able to figure how to solve it.</p>
<p>this is what am doing </p>
<p><strong>ViewControl... | <p>Try this:</p>
<pre><code>let request = NSFetchRequest<NSFetchRequestResult>(entityName: "Grocery")
</code></pre>
<p>It should work :)</p>
<p><strong>Therefore your code should Look like:</strong></p>
<pre><code>func loadData(){
let request = NSFetchRequest<NSFetchRequestResult>(entityName: "Grocery"... |
Log4j2 LogManager.getLogger() with Spring <p>I know that a log4j logger instance is supposed to be created through LogManager.getLogger() that does some reflection magic to detect the calling class hence the name which is important for specific log level configuration.
But what if I don't like the logger to be created ... | <p>Nevermind. I actually realized that a logger should be kind of considered as a compositional dependency. So now I'm always creating a logger instance manually per class. In case I wanna hide the concrete logging technology I could inject some LoggerFactory and still create it inside the constructor to make the magic... |
Horizontal pod autoscaling in openshift <p>does open shift actively monitor cpu for all the running processes or just the first process that was run.</p>
<p>i am running a service that is configured to use horizontal auto scaling capabilities.
i have hawkuler metrics and heapster setup and working as expected
i have s... | <p>My understanding is that it's by pod. </p>
<p>Ex. Pod 1 goes over your CPU limit, so Pod 2 is deployed. 5 minutes later, Pod 2 goes over your CPU limit, and Pod3 is deployed.</p>
|
Preference fragment returns null on transaction <p>I'm trying to implement a preference fragment in my app, so I set preferences.xml file, fragment that is supposed to show preferences, and fragment transaction. When I try to show SettingsFragment, the app crashes with this error log:</p>
<pre><code>java.lang.NullPoin... | <p>Well from what I can tell you are passing a null fragment to your fragment manager. As you will notice:</p>
<pre><code>Fragment fragment = null;
Class fragmentClass = SettingsFragment.class;
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.frameLayoutFo... |
How to display sql table fields in codeigniter <p>I'm trying to display the content of the fields of my "projects" table on the index page but cant seem to get it working. What am I doing wrong here?</p>
<p><strong>Model:</strong></p>
<pre><code>public function prodView() {
$sql = 'SELECT * FROM projects'... | <p><strong>Model</strong></p>
<pre><code>public function prodView() {
$result = array();
$this->db->select("*")->from("projects");
$query = $this->db->get();
if($query->num_rows() > 0){
$result = $query->result_array();
}
return $result;
}
</code></pre>
<p><strong>Controller</... |
Find difference between timestamps in amount of custom intervals in PostgreSQL <p>I would like to find difference between two <code>timestamp</code>s (with timezone) in amount of custom <code>interval</code>s. So function should be like <code>custom_diff(timestamptz from, timestamptz to, interval custom)</code>.</p>
... | <p>You can get exact result after <a href="https://www.postgresql.org/docs/current/static/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT" rel="nofollow">extracting the epoch from both intervals</a>:</p>
<pre><code>SELECT EXTRACT(EPOCH FROM (timestamp '2016-08-01 10:00'
- timestamp '2016-08... |
log4net: How to define different logger levels per appenders <p>I'm trying to define 2 independedent appenders to log info to 2 files. I define
DEBUG level for the "DebugAppender" and then for the "RelevantAppender" I define different levels for the "Security" and "ServerStats" loggers.</p>
<p>The thing this loggers d... | <p>You're problem is, that the definition you make in Logger outweights all following levels. So here comes my solution:</p>
<pre><code><log4net>
<appender name="DebugAppender" type="log4net.Appender.RollingFileAppender">
<file value="plastic.debug.log.txt" />
<!--...-->
</appender>
... |
Searching for multiple values in a String array in Elastic <p>I have a field that I am indexing into Elasticsearch that is an array of strings. So, for example, here is what the string array will look like in two records:</p>
<pre><code>Record 1: {"str1", str2", str3", "str4", "str5"}
Record 2: {"str1", str2", str6",... | <p>You can index them as <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/array.html" rel="nofollow">an array</a>, such as:</p>
<pre><code>{
"myArrayField": [ "str1", str2", str3", "str4", "str5" ],
...
}
</code></pre>
<p>You would then be able to query a number of ways, the simplest ... |
i want to understand how this part of code works <p>I want to understand how this part of code works i know it seems simple but I'm not good the pointer notion so anything would be helpfull</p>
<pre><code> #include<stdio.h>
int main(){
int a,b;
int *ptr1,*ptr2;
a=5;
b=a;
... | <pre><code>#include<stdio.h>
int main(){
int a,b;
int *ptr1,*ptr2;
a=5; // Assigns value 5 to a
b=a; // Assigns value of a (i.e., 5) to b
ptr1=&a; // Assigns address of a to prt1 or ptr1 points to variable a
ptr2=ptr1; // ptr2 holds same address as ptr1 does (i.e, addres... |
How to check the response Status of Anchor tag decorated with data=ajax=true <p>Please excuse my error title as i couldn't find a better one. I have a anchor tag as following. This calls my MVC Action to bring and display Json data into Specified Div.</p>
<pre><code><a data-ajax="true" data-ajax-method="GET" data-a... | <p><a href="http://jsbin.com/qayuhe/1/edit?js,output" rel="nofollow">http://jsbin.com/qayuhe/1/edit?js,output</a></p>
<p>You can just using the HTML attribute,then just using the <code>XMLHttpRequest</code> function</p>
|
Android app - call google cloud endpoint - custom data type input parameter <p>I have a google cloud endpoint which adds users data to the table on mysql google cloud. I am calling this endpoint from my android app. I am passing user's data to the endpoint in the form of <code>User</code> object(custom data type create... | <p>You didn't paste imports, but I'm guessing that user class in your code is part of GAE api: <a href="https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/users/User" rel="nofollow">User class</a>
To confirm it please check your imports. I would suggest also to rename your own User class to s... |
Multiplication algorithm for 24 bit numbers on MCS-51 <p>I am trying to make a program in assembly language for an <a href="https://en.wikipedia.org/wiki/Intel_MCS-51" rel="nofollow">MCS-51 microcontroller</a> with <a href="http://datasheets.chipdb.org/Intel/MCS51/MANUALS/27238302.PDF" rel="nofollow">this Datasheet</a>... | <p>Based on a quick peek at the documentation, the MCS-51 has 8x8->16 multiply. You two 24-bit numbers <code>A</code> and <code>B</code>, which are equivalent to:</p>
<pre><code>A = a0 + (a1 * 256) + (a2 * 65536)
B = b0 + (b1 * 256) + (b2 * 65536)
</code></pre>
<p>Where a0 is the lowest byte of A, a1 is the middle by... |
conversion of np.array(dtype='str') in an np.array(dtype='datetime') <p>I have a very simple python question. I need to transform the string values within an np.array into datetime values. The string values contain the following format: ('%Y%m%d'). Does any one know how to this?
Here my test data:</p>
<pre><code>date... | <p>You can create a DataFrame, then <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.apply.html" rel="nofollow"><code>apply</code></a> to it <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.to_datetime.html" rel="nofollow"><code>pd.to_datetime</code></a>:</p>
<pre><c... |
how do I append the inserted URL into image after the inputed text? <p>I have written the code but the jquery code isn't getting executed.</p>
<pre><code>Enter URL :<input type="text">
<button id="btn"> continue
</button>
<div contenteditable="true"
id="bod">
Click on this text to start writtin... | <p>If i have understood your requirement correctly then JQuery code should be like this:</p>
<pre><code>$(document).ready(function(){
$("#btn").click(function(){
var bodElem = $("#bod");
var url = $("input").val();
$('<img alt="" src="'+ url +'">').insertAfter(bodElem);
});
});
</cod... |
Render iFrame video using YouTubes JS API with Reactjs <p>I've tried looking around for examples but all i have is <code>youtube-react</code> <code>npm</code> packages which I don't want since I want to do it and learn it myself.</p>
<p>My issue is on the docs here:
<a href="https://developers.google.com/youtube/ifram... | <p>You could probably create a React component like this:</p>
<pre><code>import { Component, PropTypes } from 'react'
let loadYT
export default class YouTube extends Component {
componentDidMount () {
if (!loadYT) {
loadYT = new Promise((resolve) => {
const tag = document.createElement('script... |
JQuery on change make ajax request <p>I have a bunch of selects as filters like this</p>
<pre><code><select name="color" data-options="katalog.php?cat=3" class="filter">
<option value="1">White</option>
<option value="2">Green</option>
</select>
</code></pre>
<p>but in Fire... | <p>The url you are requesting is <code>"katalog.php?cat=3&color=undefined"</code> because you should not be using <code>attr()</code> to read the value. Use jQuery's <code>val()</code> method so you get the value of the option that was selected.</p>
<pre><code>... '=' + $(this).val())
</code></pre>
|
LINQ SubmitChanges with join doesnt work <p>I cannot get the data from <strong>adc</strong> to update to database. I am using LINQ2SQL dbml.
I get no sql output from CAPcontext.Log, and Both tables have primary ID's
I feel it is an issue with the join in the LINQ query but couldnt find anything on the web regarding it... | <p>You are creating <strong>new</strong> CAPadultdaycare objects, which are not attached to your data Context and hence not submitted.</p>
<p>The following may work</p>
<pre><code>var adc = (from v in CAPcontext.AdultDayCares
join s in CAPcontext.States on v.state equals s.Name
select v).T... |
Error Code=-1005 "The network connection was lost." in Swift while consuming Web Service <p>I'm working on a iOS project in Swift 2.0, which has Web service calls, these services are slow to respond and that is normal, can be up to 1 minute or a little more, when i call the service 70% of the time it answers with the e... | <p>If you're expecting a socket to stay open for minutes at a time, you're in for a world of hurt. That might work on Wi-Fi, but on cellular, there's a high probability of the connection glitching because of tower switching or some other random event outside your control. When that happens, the connection drops, and ... |
How to use Gmail API from Lotus Domino to migrate mail? <p>We are migrating our mail from our local Lotus Domino server to Google Apps for Work.
There is a desire to move users mail from their domino mailboxes to google domain accounts.
Offered solution to use GAMIN to migrate mail is not appropriate because our server... | <p>You've seen there's a Google Apps Migration for IBM (Lotus) Notes tool, provided by Google, right? Search for that and there's links to docs and the tool.</p>
|
Spark Error: Unable to find encoder for type stored in a Dataset <p>I am using Spark on a Zeppelin notebook, and groupByKey() does not seem to be working. </p>
<p>This code: </p>
<pre><code>df.groupByKey(row => row.getLong(0))
.mapGroups((key, iterable) => println(key))
</code></pre>
<p>Gives me this error (... | <p>You're trying to <code>mapGroups</code> with a function <code>(Long, Iterator[Row]) => Unit</code> and there is no <code>Encoder</code> for <code>Unit</code> (not that it would make sense to have one).</p>
<p>In general parts of the <code>Dataset</code> API which are not focused on the SQL DSL (<code>DataFrame =... |
Manipulate data when exporting to CSV? <p>I'm using CodeIgniter v2.2.4</p>
<p>Consider the following code to export/download a CSV file representing results from a database query.</p>
<p><strong>CONTROLLER</strong>:</p>
<pre><code>public function export_csv($id = NULL)
{
$this->load->dbutil();
$this... | <p>Easiest way is to use a select statement along these lines</p>
<pre><code>$this->db->select(
"id AS `ID`,
full_name AS `Full Name`,
company_name AS `Company Name`,
phone AS `Phone Number`,
CASE select_list WHEN = 1 THEN 'foo' WHEN = 2 THEN 'bar' ELSE 'N/A' END
AS... |
Should i write all my function in an utility-class or in a service-class? <p>I am currently working on a project which dealing with XML in text file. I want to extract the content and i want to add it to the table tt_content. My question is where should I put the all functions (upload-file, extract-content,insert-tt_co... | <p>Utilities are for static functionality that does not depend on a state. Good examples are <code>PathUtility</code> and <code>StringUtility</code>. Once you call a function, it gets the job done and nothing further.</p>
<p>Services on the other hand can handle state and are usually more complex. You could have some ... |
Convert images to PDF before uploading with Paperclip <p>Using Paperclip for file upload in my Rails app and I need to convert images into separate PDFs before uploading to Amazon S3 servers. I know I can use Prawn for the image to PDF conversion and I can intercept the file using the answer to <a href="http://stackove... | <p>Was able to figure it out.</p>
<p>changed:</p>
<pre><code>before_file_post_process :convert_images
</code></pre>
<p>to:</p>
<pre><code>before_save :convert_images
</code></pre>
<p>and changed my <code>convert_images</code> method to:</p>
<pre><code>def convert_images
if file_content_type == 'image/png' || ... |
How Do I Search For AD Groups In Shiro Without A System User? <p>I am using Shiro to authenticate against Active Directory using <code>ActiveDirectoryRealm</code>. This part works fine and I can log in.</p>
<p>However, I am unable to search for Roles/Groups.</p>
<p>I suspect it is because I do not have a <code>system... | <p>At the moment it does not support this.</p>
<p>The current implementation could be improved to query role information when checking when authenticating. (which is the only point where the realm has access to the user's credentials)</p>
|
scraping and returning it as json in express <p>i'm scraping data from a website and then i want to show it as json in the browser, however even though when i <code>console.log()</code> recipes array it show the data, but it does not send anything to the browser how come it does not show the json array in browser?</p>
... | <p>You ScrapeURl is asynchronous function. </p>
<p>So to fix it do like this</p>
<p><code>router.get('/scrape', function(req, res, next) {
scrapeUrl("http://url", function(err, resp){
res.json(resp);
});
});</code></p>
<p>And add callback in scrapeUrl</p>
<pre><code>scrapeUrl (url, cb) {
request(url, fun... |
plsql - cursor to see if a record already exists <p>Using a pl sql procedure to insert from a temporary table into separate tables
how do I check if a record is duplicated by using an if statement </p>
<ol>
<li>if it doesnt exist then insert </li>
<li>if does exist then show the duplicate in a message (dbms_output.pu... | <p>The PLSQL block which you want is as below.</p>
<p><strong><em>Tables:</em></strong></p>
<pre><code>CREATE TABLE temp_table (
job_title VARCHAR2(20),
empname varchar2(30));
--------------------------
CREATE TABLE job (
job_id number,
job_title VARCHAR2(20));
------------------------------
CREATE TABLE emp... |
C: Unable to receive input using scanf() <pre><code>#include<stdio.h>
int main()
{
float p, r, t;
char ch = 'y';
do
{
printf("Enter principal: ");
scanf("%f", &p);
printf("Enter rate: ");
scanf("%f", &r);
printf("Enter t: ");
scanf("%f",... | <p><code>scanf</code> stops reading when the number is complete (at the first char that cannot be a part of it).</p>
<p>So the last of your <code>scanf</code> (for t) <em>stops</em> reading just before the <kbd>RET</kbd> you pressed after typing t's value. The <code>getchar()</code> then reads the next char, which is ... |
Kentico - Transformations to display text value of List box or Multiple choice <p>This looks like a simple question but I couldn't figure out after trying for hours. For my custom page type, I have a field called "Location", which displays a list of checkboxes with location names. I checked multiple boxes, but with Eva... | <p>What I typically do in this case (if it's a one off setup) is create a function right within the transformation. If you need to use this in other places, create a custom method for it and expose it via macro or transformation method.</p>
<p>You can add something like this (assuming your locations are in custom tab... |
AngularJS - how to include a template without a wrapper <p>For example I have a template like the following.</p>
<p>template.html:</p>
<pre><code><div>div1</div>
<div>div2</div>
</code></pre>
<p>I want to include it anywhere I want without a wrapper, so the result is like this:</p>
<pre><cod... | <p>You should modify the layout/styles. It is recommend to not use <code>replace:true</code>, because its deprecated and angular directives must have only one root element.</p>
|
Restore Xcode 7.3.1 after Xcode 8 upgrade <p>Last night I went into my Application directory and renamed the Xcode.app to Xcode7.app</p>
<p>I then upgraded to Xcode 8 overnight.</p>
<p>When I came back in the morning, Xcode7.app was gone!! Nowhere to be found.</p>
<p>Now my project doesn't work on Xcode 8, upgrading... | <p>I did not have this problem, and I also renamed Xcode (to Xcode-7.app) before updating.</p>
<p>I'm guessing it's because rather than choosing 'update' from the app store, I went to apple's downloads page and downloaded from there.</p>
<p>Try renaming your new Xcode to Xcode8.app, then go to <a href="https://develo... |
Delete all django.contrib.messages <p>I recently realized that a module in our Django web app was using django.contrib.messages. However, the template's context processor did not have the <code>django.contrib.messages.context_processors.messages</code> processor added.</p>
<p>I'm worried that when I push this to prod... | <p>Messages are usually stored either in sessions or cookies (check your <a href="https://docs.djangoproject.com/en/1.10/ref/contrib/messages/#storage-backends" rel="nofollow">storage backend</a>). You can clear them from there, but they'll be cleared when sessions/cookies are normally cleared anyway (on user logout at... |
Upgrading to ASP.NET Core 1.0.1 September update warning <p>The upgrade to <code>ASP.NET Core 1.0.1</code> seems to be simple based on this <a href="https://blogs.msdn.microsoft.com/webdev/2016/09/13/asp-net-core-sept-2016-patch/" rel="nofollow">official msdn blog</a></p>
<p><a href="https://www.microsoft.com/net/down... | <p>I resolved it by right clicking in the 'project.json' and selecting Sort Properties which changes the order. It seems the order is important.</p>
|
django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TAB LESPACE, but settings are not configured <p>Iâm using Django 1.9.1 with Python 3.5.2 and I'm having a problem running a Python script that uses Django models.</p>
<pre><code>C:\Users\admin\trailers>python load_from_api.py
Traceback (... | <p>I would recommend using <a href="https://docs.djangoproject.com/en/1.10/howto/custom-management-commands/" rel="nofollow">Django Custom Management Commands</a> - they are really simple to use, they use your settings, your environment, you can pass parameters and also you can write help strings so you can use <code>-... |
How to impure A* algorithm to support multi-searching in a maze <p>If I have a A* function that supports finding the optimal path from a starting point to a target in a maze, how should I modify the heuristic function to be admissible so that if there are multiple targets the function still return the optimal result. <... | <p>Assuming that the problem is to visit only one target:</p>
<p>The first solution that comes to mind is to loop over all possible targets, compute the admissible heuristic value for each of them, and then finally return the minimum of those values as the final heuristic value. That way you're sure that the heuristic... |
Retrieving JSON and extracting a specific value <p>I'm using jQuery <code>getJSON()</code> to make an ajax request of the Vimeo API to return JSON. The JSON looks like this (simplified):</p>
<pre><code>{
"total": 3,
"page": 1,
"per_page": 25,
"paging": {
"next": null,
"previous": null,
"first": "/videos/16... | <p>'data' is an array, so in this case <code>obj.data.sizes[0].link</code> should be <code>obj.data[0].sizes[0].link</code></p>
|
Symfony2: ContextErrorException: Warning: Missing argument 1 for FOS\UserBundle\Model\User::hasRole() <p>I'm trying to create a function that would allow me to delete users created thanks to FOS. But every time I'm getting this error:</p>
<blockquote>
<p>ContextErrorException: Warning: Missing argument 1 for
FOS\U... | <p>If you have a <code>User</code> entity with <code>roles</code> property then check your <code>UserType</code> form type code:</p>
<pre><code>class UserType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
// ...
$builder->add('role'); //<... |
Creating a generic class and parameter in Java <p>I have a general sendRequest() method that I use to get a json result back from the server. I'm parsing the result in an instance of the callback right now, but instead I'd much rather just pass in a type to the sendRequest() method so I can parse and handle exceptions ... | <p>First of all please note that out of the box you have <code>JsonObjectRequest</code> which will convert the response directly into a <code>JSONObject</code> which seems to be better than <code>StringRequest</code> in your case, but as you want to go a little bit further I would propose to create a <a href="https://d... |
How to add pug to angular-cli? <p>Anyone having luck adding .pug to angular-cli?</p>
<p>I tried to do npm install pug --save, but I don't know where to change the .pug rendering instead of .html.</p>
<p>Link for the angular-cli is <a href="https://github.com/angular/angular-cli">here</a></p>
<p>Please share a short ... | <p>So after reading on angular-cli git, implementing pug is not in the near future. </p>
<p>So here is my workaround: It's not the angular-cli, but its an updated generator that runs angular2 final.</p>
<p>Use angular2-webpack generator from AngularClass - <a href="https://github.com/AngularClass/angular2-webpack-sta... |
django getattr and issues with updating <p>In django I built a simple method that gets called and is passed a uniqueid, field specifier, and a value. It then does a simple addition to update the value in the field. I've coded it a number of ways and have come to the conclusion that getattr does not work when trying to ... | <p>I'm not sure what you're expecting here, but this is nothing to do with Django wanting anything, and nothing to do with <code>setattr</code>.</p>
<p>Integers are immutable. However you get the value of fieldname and store it in <code>call</code>, you cannot modify it. Doing <code>call += value</code> creates a new ... |
Using a ContentPresenter for a custom control (Thumb) <p>I created a custom control that allows for drag using the DragDelta of the Thumb control. I want to be able to insert a Shape, Image or TextBlock inside the custom control ContentPresenter.</p>
<p><strong>CustomControl.xaml (Thumb)</strong></p>
<pre><code><T... | <p>Since the <code>Content</code> property is <code>Object</code>, you can put anything in there that will go in a <code>ContentControl</code>: Visual tree elements, strings, a viewmodel with an implicit <code>DataTemplate</code> (pretty farfetched in this particular case, but it's the principle of the thing) -- you na... |
Select single item in MYSQLdb - Python <p>I've been learning Python recently and have learned how to connect to the database and retrieve data from a database using MYSQLdb. However, all the examples show how to get multiple rows of data. I want to know how to retrieve only one row of data. </p>
<p>This is my current ... | <p><code>.fetchone()</code> to the rescue:</p>
<pre><code>result = cur.fetchone()
</code></pre>
|
htaccess rewrite rules show an error in my error log file <p>I have a website which depends on htaccess rewrite rules, i rewrite my URL's with a sequence like this:</p>
<pre><code>www.example.com/games/car/play/123
</code></pre>
<p><strong>Actually there is no directories for:</strong></p>
<ol>
<li>games</li>
<li>ca... | <p>Try turning off MultiViews and also add some condition checks. </p>
<pre><code>Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^games/([a-zA-Z0-9-/]+)/play/(.*)$ details.php?slug=$1&id=$2 [L]
</code></pre>
|
XCode 8 / Swift 3 UserDefaults.standard set nil Error <p>This seems a bug - please help. I am trying to remove an existing value in the defaults.</p>
<pre><code>UserDefaults.standard.set(nil, forKey: "test-me")
let val = UserDefaults.standard.object(forKey: "test-me")
print ("val=\(val)")
</code></pre>
<p>I got the f... | <p>The comment from Rob in the other post looks correct. Setting the value to "nil" will save it as NSData. To remove the key, try this instead:</p>
<pre><code>UserDefaults.standard.removeObject(forKey: "test-date")
</code></pre>
<p>You will then probably get back "nil" when doing <code>object(forKey: "test-date")<... |
Having an array out of bounds exception. How do i fix this? <p>I am trying to write a Java program that reads in a data file and reads the integers into a standard integer array (not an ArrayList), sorts the array, and displays the values from lowest to highest. I also need to write a sort function that uses bubble sor... | <p>You're getting an array out of bounds exception due to your use of <code>j + 1</code>. Your inner loop counts up to <code>nums.length - 1</code>, which you then add one to. Thus, you're accessing the array at <code>nums.length</code>, which causes the exception. To fix this, adjust your bounds on the array, such as ... |
function to search in youtube <p>I write function for search in youtube.
I create project on "console.developers.google.com" . the name project is youtubesearch and I get apiKey.
I have the error </p>
<blockquote>
<p>"An unhandled exception of type
'Google.GData.Client.InvalidCredentialsException' occurred in
Go... | <p>Although the YouTube Data API (v2) has been officially deprecated, you can check in this <a href="https://developers.google.com/youtube/2.0/developers_guide_dotnet#Document_Structure" rel="nofollow">documentation</a> on how to properly authenticate your application using .NET client library. It also shows here how t... |
for loop in a switch-dictionary for interactive menu <p>I have a problem in a SWITCH /CASE Disctionary I am trying to implement. I got an example from <a href="http://www.pydanny.com/why-doesnt-python-have-switch-case.html" rel="nofollow">here</a> </p>
<p>I simply create an interactive menu in which you can choose mor... | <p>You actually make the function call, and not use the reference to those functions.</p>
<p>If you define your dictionary as following:</p>
<pre><code>switcher = {
1: func1(ips)
2: func2(ips)
}
</code></pre>
<p>You already made the call to <code>func1</code> and <code>func2</code>. The solution here is just... |
Google Maps Api --> One project works without API KEY but another not <p>i've got two PHP projects in which i use the Google Maps Api to convert adress data into geo coordinates. The first project uses this code (i post ir here in a shorted version) and works:</p>
<pre><code><script src="https://maps.googleapis.com... | <p>If the app has been running before google enforced the use of API keys the app should still run, apps published after the change will require the key ...read here : <a href="https://developers.google.com/maps/pricing-and-plans/standard-plan-2016-update" rel="nofollow">https://developers.google.com/maps/pricing-and-p... |
How to install the license when the library is being used in multiple projects <p>I've a main dll where i'm using postsharp, but many others references it. Where must be placed the postsharp.config file? </p>
<p>I do not want to install visual studio postsharp tools in every machine I edit my solution.</p>
| <p>As stated at <a href="http://doc.postsharp.net/configuration-system" rel="nofollow">http://doc.postsharp.net/configuration-system</a>:</p>
<blockquote>
<p>PostSharp will automatically load a few well-known configuration files if they are present on the file system, in the following order:</p>
<ol>
<li>Any ... |
Getting different resultset based on data type <p>I have a table tbl_item in which item_id is varchar. when i use the queries below 1 get different results.</p>
<ol>
<li>select * from tbl_item where item_id between 1 and 100 order by item_id</li>
<li>select * from tbl_item where item_id between '1' and '100' order by ... | <p>String comparison is not the same as integer comparison. For instance, this is how the first 100 numbers look when ordered as strings:</p>
<pre><code>1
10
100
11
12
. . .
</code></pre>
<p>The same thing is happening with <code>between</code>. Because you have single quotes around the constants, the database engi... |
Kendo UI Grid using OData returns "The query parameter '$count' is not supported." <p>I am trying to implement OData on a Kendo Grid to evaluate the performance (I've worked with using Entity Framework, inline sql, etc). In my api project, I'm using OData v4 as that seems to be what Telerik works with. In my api contro... | <p>I think you have to return this value from the server using the <code>ToDataSourceResult</code> extension method.</p>
<pre><code> using using Kendo.Mvc.Extensions;
public ActionResult Search(string id, [DataSourceRequest] DataSourceRequest request){
return !String.IsNullOrEmpty(id) ? oandpService.Ge... |
How to print info when 2 things are correct and to use the input fuction when the those two things are incorrect <p>I am doing a controlled assessment. I have this code : </p>
<pre><code># user Qualifications
print("\nQualification Level")
print("\n""\"AP\" = Apprentice",
"\n\"FQ\" = Fully-Qualified")
user_qual... | <p>You can try defining the qualification levels within a variable. In this simple case a <a href="http://openbookproject.net/thinkcs/python/english3e/tuples.html" rel="nofollow">tuple</a> suffices, but if there were to be more qualification levels, a <a href="http://openbookproject.net/thinkcs/python/english3e/diction... |
Using ConfigureAwait(false) for private async methods? <p>I have public <code>async</code> method which calls 3 different APIs to get some data and then post the response to the next API. Now based on Stephen cleary's article <a href="http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html" rel="nofollow">h... | <blockquote>
<p>I wanted to know if I need to use ConfigureAwait(false) on private methods or not?</p>
</blockquote>
<p>As a general rule, yes. <code>ConfigureAwait(false)</code> should be used for <em>every</em> <code>await</code> unless the method <em>needs</em> its context.</p>
<p>However, if you use <code>NoSyn... |
Swift Parse JSON As Array <p>i've been working with swift app. im stuck at parsing multiple data as an array, here's my json</p>
<pre><code> {
"error":0,
"success":1,
"kode_keranjang":"2",
"kode_produk":"1",
"kode_pelanggan":"USR-6cs42",
"jumlah":"1",
"nama_produk":"MacBook 2015",
"gambar":"MacBook.jpg",
"harga":"2... | <p>As far as i can understand you have an array of dictionaries and want to extract <code>nama_produk</code> fields into the array. Here is the safe way to do it in <strong>Swift 3, Xcode 8</strong>:</p>
<pre><code>var jsonString1 =
"{\"error\":0,\"success\":1,\"kode_keranjang\":\"2\",\"kode_produk\":\"1\",\"kode_pela... |
C# MetroTile backcolor/forecolor not changing during mouse enter/leave <p>I'm using the Win Form Metro Framework in VS 2015 to build a Metro Form with Metro Tiles in Windows 7. When a mouse enters a metro Tile I want the backcolor and forecolor to change and when the mouse leaves, change back. However, it's not working... | <p>You should apply it to your <code>caseCompassDevo</code>. use BackColor property of caseCompassDevo and assign your appropriate color to that.</p>
|
Children json elements Angularjs <p>Json code works fine if i call pages with <code>{{result.title}}</code> but if i want to call to the children of <code>author</code>, json elements does not work</p>
<p><strong>Controller</strong></p>
<pre><code> var app = angular.module('myApp', []);
app.controller('customersCtrl... | <p>You need to change <code>resultsauthor</code> to <code>resultauthor</code>.</p>
<pre><code><div ng-repeat="item in resultauthor">
{{ item.name }}
</div>
</code></pre>
|
Javascript Referencing variables out of scope <p>Here is an overly simplified example of what I want to do. Currently I have something like this:</p>
<pre><code>function foo(arg1, arg2) {
var obj ={
render:[arg1]
};
obj.render.forEach(function(theArg) {
console.log(theArg)
});
}
foo('on... | <p>change your function signature to include <code>obj</code></p>
<p><code>function foo(arg1, arg2)</code></p>
<p>to</p>
<p><code>function foo(obj)</code></p>
<p>then within your function loop through the <code>render</code> property like you are already.</p>
<p><code>obj.render.forEach(function(theArg)</code></p>... |
Special characters/kanji problems using Python unicode <p>I want to use videofileclip(), but a UnicodeDecodeError occurs.
The videofiles include japanese kanji or special characters.</p>
<p>My example code:</p>
<pre><code>#-*- coding: utf-8 -*-
import sys
from moviepy.editor import VideoFileClip
reload(sys)
sys.... | <p>Here's a workaround using the <a href="https://sourceforge.net/projects/pywin32" rel="nofollow">pywin32</a> extensions.
Basically, you use the <a href="http://timgolden.me.uk/pywin32-docs/win32api__GetShortPathName_meth.html" rel="nofollow"><code>GetShortPathName</code></a> function to generate a legacy <a href="htt... |
How to add paraeters in routing Laravel? <p>I tried to add parameters to route in Laravel for resource:</p>
<pre><code>Route::resource('place', 'Dashboard\PlaceController', ["parameters" => ["roles" => "Admin"]]);
</code></pre>
<p>Then I display route array:</p>
<pre><code>$actions = $request->route()->g... | <p>There's an artisan command you can use to check what routes you have and it's <code>php artisan route:list</code>.</p>
<p>I think the problem here is that you are using <code>Route::resource</code>, as per <a href="https://laravel.com/docs/5.3/controllers#resource-controllers" rel="nofollow">documentation</a> it fi... |
how to get value from returned instance of deferred <p>I use txmongo lib as the driver for mongoDB.
In its limited docs, the find function in txmongo will return an instance of deferred, but how can I get the actual result (like {"IP":11.12.59.119})?? I tried yield, str() and repr() but does not work.</p>
<pre><code>d... | <p>If you want to write asynchronous code in twisted looking more like synchronous, try using <code>defer.inlineCallbacks</code></p>
<p>This is from the docs:
<a href="http://twisted.readthedocs.io/en/twisted-16.2.0/core/howto/defer-intro.html#inline-callbacks-using-yield" rel="nofollow">http://twisted.readthedocs.io/... |
String with empty spaces in C gets truncated <p>I want to create an empty string with fixed length lets say 100 and then enter user input for that string , For some reason when I try to scan the string the code isnt showing me all the leading empty spaces after the user input .
If my empty string is of length 20 and in... | <p>Typically <code>scanf("%s", word);</code> reads but does not save leading white-space and then saves non-white-space characters to <code>word</code>. It then appends a null character and returns.</p>
<p>To read a <em>line</em> of user input, including space character, use <code>fgets()</code>. This will usually i... |
Akka actor message sequence <p>I have the following actor structure </p>
<pre><code>import akka.actor.ActorRef;
import akka.actor.UntypedActor;
public class ExampleActor extends UntypedActor {
ActorRef worker1;
ActorRef worker2;
@Override
public void onReceive(Object msg) throws Exception {
if (msg... | <p>You need to start building a state in your <code>ExampleActor</code>. When you receive any of the two responses you are waiting for from your <code>Workers</code>, you need save that response. Either the message, or just the relevant content of it. Something like:</p>
<pre><code>if (msg instanceof WorkerTaskResult)... |
How to remove undefined values from array but keep 0 and null <p>In javascript, I want to remove undefined values, but keep the values 0 and null from an array. </p>
<pre><code>[ 1, 2, 3, undefined, 0, null ]
</code></pre>
<p>How can I do it cleanly?</p>
| <p>No need for libraries with modern browsers. <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter" rel="nofollow">filter</a> is built in. </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">... |
How run Odoo 9.0 from source code in Windows 10 <p>i want to run odoo 9.0 directly from source code in windows 10. I done this:</p>
<pre><code>1.- I downloaded source code from [GitHub][1]
2.- I already installed all system requirements (Python 2.7, Node.js, etc)
3.- I already have an postgresql database in AWS (RDS)
... | <p>I think I had this problem and needed to install node js, and npm less</p>
|
cant call curl from python3 <p>I am trying to call this <code>curl</code> from <code>python3</code>. This, from <code>bash</code>, is working fine.</p>
<pre><code>curl -LH "Accept: text/bibliography; style=bibtex" http://dx.doi.org/10.1103/PhysRevLett.117.126802
</code></pre>
<p>yielding the expected result:</p>
<pr... | <p>You have 3 problems here:</p>
<ol>
<li>don't quote your arguments in <code>subprocess</code>, it already does that for you when necessary, since you pass the arguments and not the unsplitted command line (good practice, keep it on, but drop the unneccessary quoting).</li>
<li>then, <code>subprocess.call</code> does... |
Login/Register with Facebook button on iOS Safari. HOw do i use Iphone Facebook app for authentication <p>Problem:
1. My client has a simple website. They use login/register with Facebook. </p>
<ol start="2">
<li><p>The Register/Login is not smooth on iphones. The user is being redirected to www.facebook.com on Saf... | <p>It is not possible to use the "Single Sign On" feature in the browser afaik. I´m afraid you will have to let users login again.</p>
|
Why is the -i argument to supervisor important to get an interactive shell? <p>in order to impersonate as superuser1 I need to run command like this</p>
<pre><code>sudo -u superuser1 -i
</code></pre>
<p>I did try <code>sudo -u superuser1</code> which means switch to superuser1 and its totally making sense, but it doe... | <p>This is given, explicitly, in the man page content you quoted in the question itself:</p>
<blockquote>
<p>If no command is specified, an interactive shell is executed.</p>
</blockquote>
<p>That's behavior specific to <code>sudo -i</code>. If you want an interactive shell, then, you need to either run <code>sudo ... |
Factoring out attributes for reuse in D3 transition <p>In the minimal example below, an SVG element transitions to a different state and then reverts to the original. How can I factor out the original attributes so that they won't have to be repeated? <code>selection.each()</code> and <code>transition.each()</code> hav... | <p>One solution might be to leverage the power of D3's <a href="https://github.com/d3/d3-selection#joining-data" rel="nofollow">data binding</a>. You could define configuration objects containing both, the original values to be restored later on as well as the values to which the element should transition to. By bindin... |
How to take the shortest distance per person (with multiple addresses) to an origin point and sort on that value <p>I have People documents in my elastic index and each person has multiple addresses, each address has a lat/long point associated. </p>
<p>I'd like to geo sort all the people by proximity to a specific or... | <p>When sorting on distance from a specified origin where the field being sorted on contains a collection of values (in this case <code>geo_point</code> types), we can specify how a value should be collected from the collection using the <code>sort_mode</code>. In this case, we can specify a <code>sort_mode</code> of <... |
ParseError: Unexpected character '�' when importing image <p>I'm trying to load a png image into my component from an images folder. However, I keep getting this error:</p>
<pre><code>BROWSERIFY ERROR:
../../../src/js/images/001.png:1
�PNG
^
ParseError: Unexpected character '�'
</code></pre>
<p>I'm not sure w... | <p>An image file is not a javascript module, you cannot <code>import</code> it. You want a simple</p>
<pre><code>const path = "../../images/001.png";
</code></pre>
<p>where <code>path</code> is a string.</p>
|
Inserting a javascript variable into onclick window.open <p>I'm trying to insert a JavaScript variable into an href, and make it open in a new window. </p>
<p>Here is my code:</p>
<pre><code><a href="https://example.com" onclick="window.open(this.href+'?VALUE='+testVALUE;, '_blank'); return false;">Click Here&l... | <p>There's a <code>;</code> in the middle of the argument you pass to <code>window.open</code>. Just after <code>testVALUE</code></p>
|
Can't read property 'style' of null from dynamic html code <p>I am refactoring old code and am unable to find a solution to the typeerror (I understand the use of eval is frowned upon but in my case there is no need for security).</p>
<p>I have objects like:</p>
<pre><code>var Ansys = {key:'ansyskeys', loaded:0, disp... | <p>If <code>vendor</code> holds the object you need:</p>
<pre><code>var key = vendor.key;
var otherkey = vendor.otherkey;
var myDiv = document.createElement('div');
var html = '<select id="' + otherkey + '" size="5" onchange="selectOther('+ otherkey + ')"></select>';
myDiv.innerHTML = html;
myDiv.id = ... |
UIView animation vs gif. Which one should I choose if I want to get better performance? <p>I have a <code>UITableView</code>. I am adding a loader on each of its cells with custom animation. It is just an image of a ball which keeps bouncing.
Will adding a gif lead to better performance, or is using <code>CABasicAnimat... | <p>CABasicAnimation is a fine way of doing this. CA runs very close to the metal on iOS and you will get good performance out of it.</p>
<p>Practically speaking, performance considerations are probably not very important for this scenario, as the animation you describe shouldn't stress any modern iOS device. But if yo... |
Update dictionary if in list <p>I'm running through an excel file reading line by line to create dictionaries and append them to a list, so I have a list like:</p>
<pre><code>myList = []
</code></pre>
<p>and a dictionary in this format:</p>
<pre><code>dictionary = {'name': 'John', 'code': 'code1', 'date': [123,456]}... | <p>I would modify <code>checkGuy</code> to something like:</p>
<pre><code>def findGuy(dude_name):
for d in myList:
if d['name'] == dude_name:
return d
else:
return None # or use pass
</code></pre>
<p>And then do:</p>
<pre><code>def addGuy(row_info):
guy = findGuy(row_info[1])
... |
JSON Parsing Value Not Showing <p>So I am using <code>JSON.net</code> to parse my JSON, but I get wrong output for a <code>List of List</code> <strong>Values</strong> object. Here's my JSON.net code:</p>
<pre><code>var reader = new StreamReader(GenerateStreamFromString(decodedString));
var rootObject = Jso... | <p>It is a list of lists. You're currently only indexing one level deep. You need to index two levels deep. </p>
<pre><code>txtOut.Text = rootObject.Results.output1.value.ColumnNames[0].ToString() + " : " +
rootObject.Results.output1.value.Values[0][0].ToString();
</code></pre>
|
Convert Quill Delta to HTML <p>How do I convert Deltas to pure HTML? I'm using Quill as a rich text editor, but I'm not sure how I would display the existing Deltas in a HTML context. Creating multiple Quill instances wouldn't be reasonable, but I couldn't come up with anything better yet.</p>
<p>I did my research, an... | <p><a href="https://github.com/casetext/quill-render" rel="nofollow">quill-render</a> looks like it's what you want. From the docs:</p>
<pre><code>var render = require('quill-render');
render([
{
"attributes": {
"bold": true
},
"insert": "Hi mom"
}
]);
// => '<b>Hi ... |
How to programmatically set corner radius of MenuItem border <p>How can I access the border of a MenuItem in order to change the Corner Radius?</p>
<p>This is not working:</p>
<pre><code>Style menuitemStyle = new Style(typeof(MenuItem));
menuitemStyle.Setters.Add(new Setter { Property = Border.CornerRadiusProperty, V... | <p>I would use a style in XAML and overwrite the control template.</p>
<pre><code><Style TargetType="{x:Type MenuItem}">
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
... |
Spring Tags and JQuery validator <p>I have a form that I wish to validate with JQuery validator plugin.
After following the example using a plain jsp, I get this error once I add Spring tags.
Here is my JSP:</p>
<pre><code> <%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8... | <p>I think, it could be because of the attributes minlength, type and required. They are not in the TLD.</p>
<pre><code><sf:input class="form-control" id="uname" path="userName" name="uname" minlength="4" type="text" required />
</code></pre>
<p>You can see the TLD doc here:</p>
<p><a href="http://docs.spring.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.