input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
MySQL : selecting minimum value from one table and country details from another and grouping them according to country code <p>I have two tables in my database:</p>
<pre><code>1. venprices
+---------+---------+--------+
| concode | rate | vendor |
+---------+---------+--------+
| 1234 | 1.23402 | a |
| 1... | <p>You could use a suquery </p>
<pre><code>select v.concode,c.conname, v.rate, v.vendor
FROM venprices v
inner join country c on c.conid = v.concode
where (v.concode, v.rate) in ( select v.concode, min(v.rate)
from venprices v
group by v.concode)
... |
Create a database for init,insert,delete,median <p>I need to create a data base that works in this time complexity:</p>
<ol>
<li><p>Init O(1)</p></li>
<li><p>Insert O(logn)</p></li>
<li><p>Delete O(logn)</p></li>
<li><p>Find Median O(1)</p></li>
</ol>
<p>I'm struggling with finding the median in O(1).</p>
<p>I creat... | <p>There are multiple solutions for this problem, based on what you already have:</p>
<ol>
<li><p><a href="https://en.wikipedia.org/wiki/Order_statistic_tree" rel="nofollow">Order Statistics tree</a>, which is a variant of a binary search tree that allows you fast (logarithmic time) access to an element by its order s... |
Navbar content doesn't stay on same line when opening in mobile <p>This bootstrap navbar looks fine on desktop, but doesn't stay on the same line when viewed on mobile. Here's my code:</p>
<p>HTML:</p>
<pre><code> <div class="container-fluid"> <!--div1-->
<div class="row"> <!--div3-->
... | <p>Problem in <code>.navbar-nav { }</code></p>
<p><strong>Before</strong></p>
<p><a href="http://i.stack.imgur.com/ZRMP3.png" rel="nofollow"><img src="http://i.stack.imgur.com/ZRMP3.png" alt="enter image description here"></a></p>
<p><strong>After</strong> i added </p>
<pre><code>.navbar-nav {
margin: 0 !importan... |
How to preview multiple images before upload? <p>I have a page with four images for the user to select. I want the user to be able to preview each image on the site before upload.</p>
<p>The JavaScript code below works for only one image but I would like it to work for multiple images uploaded via <code><input type... | <p>Firstly add the <strong>attribute</strong> <code>multiple</code> to your <code>input</code> element.</p>
<h3>Pure <strong>JavaScript</strong> (no jQuery)</h3>
<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 la... |
Add custom "number" images to SKLabelNode in as a Score in SpriteKit with Swift <p>I basically want to add custom font numbers (with images) in Singles and add them for my score in my game with SpriteKit.</p>
<p>This is the font image style </p>
<p><img src="http://i.stack.imgur.com/96pyy.png" alt="Number 9"> </p>
<... | <p><code>SKLabelNode</code> would not allow for bitmap fonts. If your custom font was TTF, you would be able to use the custom font with <code>SKLabelNode</code>. An explanation how is here: <a href="http://stackoverflow.com/questions/21368283/sklabelnode-custom-font">SKlabelNode custom font</a></p>
<p>In your case, s... |
Create a new user in Azure Active Directory (B2C) with Graph API, using http post request <p>I have previously been adding users programmatically using Active Directory Authentication Library (ADAL), but now I need to define "signInNames" (= users email), and that doesn't seem to be possible with ADAL (please tell me i... | <p>Did you grant the app sufficient permission to operate users? The create user REST API works well for me for the B2C tenant.</p>
<p>Here are the steps I tested:</p>
<p>1.Create the app via the PowerShell below</p>
<pre><code>PowerShell:
$bytes = New-Object Byte[] 32
$rand = [System.Security.Cryptography.RandomNu... |
Connection between R and qlikview with opencpu <p>I want to create connection between R and QlikView using 'opencpu' package R.
I've seen some examples but I did not understand how to use the opencpu R package to create the connection between R and QlikView.</p>
| <p><a href="http://www.computerworld.com/article/3118350/business-intelligence/qlik-to-add-r-python-support.html?token=%23tk.CTWNLE_nlt_computerworld_enterprise_apps_2016-09-09&idg_eid=300cd4d26427f9ff9d2002a69cc842d9&utm_source=Sailthru&utm_medium=email&utm_campaign=ENTAPPSsept9&utm_term=computerwo... |
Accepting a range as an array parameter <p>I have a function that takes an array and outputs another array. Its internals are more complicated than the toy example below.</p>
<pre><code>Public Function divide_by_2_5(ByRef coeffs() As Double) As Double()
Dim Columns As Integer
Columns = UBound(coeffs, 2) - LBou... | <pre><code>Public Function divide_by_2_5(coeffs As Variant) As Double()
Dim v() As Variant
If TypeName(coeffs) = "Range" Then
v = coeffs.Value
Else
v = coeffs
End If
Dim output() As Double
ReDim output(LBound(v, 1) To UBound(v, 1), LBound(v, 2) To UBound(v, 2))
Dim r As Long
... |
OSX kill processes by port except PIDs <p>I want to kill all processes listening to port </p>
<pre><code>kill -kill `lsof -t -i tcp:3000`
</code></pre>
<p>Now the problem is I want to exclude certain PIDs, -p option is not working for me.</p>
<pre><code>kill -kill -p `pidof chrome` `lsof -t -i tcp:1337`
</code></pre... | <p>You can leverage a <code>while</code> loop here:</p>
<pre><code>cpid=$(pidof chrome) && lsof -t -i tcp:3000 | while read pid; do \
[[ $cpid != $pid ]] && kill "$pid"; done
</code></pre>
<p>Getting the PID of <code>chrome</code> is variable <code>cpid</code> and then iterating over the output o... |
How can I have two models relate to one generic model? <p>Model "A" is a generic model, meaning any model can relate to it. Model "B" and "C" are models that want to establish a foreign key relation with Model "A". How can this be done?</p>
<pre><code>class A(models.Model):
content_type = models.ForeignKey(Content... | <p>This is completely the wrong design for what you are asking for. Your structure only allows one single item to be related to each A, whether it is a B or a C.</p>
<p>Instead you need an intermediate model, which contains the GenericForeignKey and which also has a (normal) ForeignKey to A. That is how tagging applic... |
Storing a (string,integer) tuple more efficiently and apply binary search <p><strong>Introduction</strong></p>
<p>We store tuples <code>(string,int)</code> in a binary file. The string represents a word (no spaces nor numbers). In order to find a word, we apply binary search algorithm, since we know that all the tuple... | <p>I assume you're trying to optimize for speed & space (in that order).</p>
<p>I'd use a different layout, built from 2 files:</p>
<ol>
<li><strong>Interger + Index file</strong><br>
Each "<em>record</em>" is exactly 8 bytes long, the lower 4 are the integer value for the record, and the upper 4 bytes are an int... |
Display information from d3.js to web inspector <p>Could you tell me why after declare the variables x and y, the <code><svg></code> tag and all that follows no longer appears in the inspector of my web browser? When I remove the variables just mentioned the <code><svg></code> tag and its id = bar atribute ... | <p>You are using D3 v4.x. in that version, there is no <code>scale.linear()</code>. Instead of that, it should be:</p>
<pre><code>var x = d3.scaleLinear()
</code></pre>
<p>And the same for the <code>var y</code>.</p>
<p>As this line comes before your <code>var svg</code> (which appends the SVG element), it throws an... |
Spring Task Scheduler consecutive tasks <p>I am new to using the Spring Task Scheduler for executing tasks, so this may be a basic question. I have a list of items that I would like to process within a class that implements <code>Runnable</code>. Here is my task class:</p>
<pre><code>public class ProcessTask<T>... | <p>So you don't know when the task will end, but 10 seconds later, you want the next task to run. So planning it can only be done when that task is done.
So, have a base abstract class, which does the plumbing.</p>
<pre><code>public abstract class ScheduleTaskAfterRun<T> implements Runnable {
protected void ... |
Finding the highest number in an array of length 5 <p>This should be really simple, but I'm used to higher level languages and am missing something. I'm just trying to make sure the input is five numbers long, and then find the highest number. Unfortunately, something goes wrong in that second part.</p>
<pre><code>#in... | <p>You cannot pass a pointer into a function and get the size of it without template deduction. At runtime, all the function receives is a pointer. When you call <code>sizeof(nums)</code>, you are not getting the size of the original array. You are simply getting the size of the pointer, which is the same as saying <co... |
How can I make this code not print an entire list and just a single name and time <pre><code>from lxml import html
import requests
page = requests.get('http://www.runningzone.com/wp-content/uploads/2016/09/Turtle-Krawl-Overall-Results-2016.html')
tree = html.fromstring(page.content)
x=2
while True:
xpathName = "/... | <p><code>'x'</code> does not interpolate the <code>x</code> variable into the string. You need to do something like this:</p>
<pre><code>xpathName = "/html/body/div[2]/table/tbody/tr[%d]/td[4]//text()" % (x,)
xpathTime = "/html/body/div[2]/table/tbody/tr[%d]/td[9]//text()" % (x,)
</code></pre>
<p>Also, as @grael men... |
Overflow text after it takes up certain amount of screen? <p>I'm attempting to have text overflow down once it has taken up 80% of it's DIV. I'm wanting the dots to take space between the item name and price. However when the item name is too long it cuts of the words. I would like the words to wrap or flow down. I can... | <p>Possible solution is to use a center flex container that grows, and allow h4 tags to wrap by default....</p>
<p>This would require some additional alteration for specific uses, but overall the theory may work.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<di... |
How to do getWritableDatabase() in asyncTask <p>I have been doing my database transactions on the UI thread and it've working without any noticeable UI freezing because the database is small, but I am worried because database transactions are not supposed to be done on the UI thread.</p>
<p>I found here on SO that Asy... | <p>1) AsyncTask isn't difficult, Google it and there are plenty of tutorials.</p>
<p>2) Once you understand AsyncTask, put your call to <code>getBookDb()</code> into the AsyncTask's <code>doInBackground()</code> method.</p>
<p>3) Try to refactor your code so you don't have to update any UI elements until <code>doInBa... |
A workaround for Python's missing frozen-dict type? <p>In Python, when you want to use lists as keys of some dictionary, you can turn them into tuples, which are immutable and hence are hashable.</p>
<pre><code>>>> a = {}
>>> a[tuple(list_1)] = some_value
>>> a[tuple(list_2)] = some_other_va... | <p>You can try <a href="https://docs.python.org/2/library/collections.html#collections.OrderedDict" rel="nofollow">ordered dict</a> or look on these answers:</p>
<ul>
<li><a href="http://stackoverflow.com/questions/2703599/what-would-a-frozen-dict-be">What would a "frozen dict" be?</a></li>
<li><a href="http... |
How to make a portion of loop repeat itself in ruby? <p>I'm trying to code a nim game in ruby and while I have gotten the most of it. I'm facing problems in what to do when exceptions rise such as a user takes out more objects than are present in a heap and the computer does the same.</p>
<p>You can find the code belo... | <p>You can put it in a while loop pending a valid selection...</p>
<pre><code>valid_selection = false
until valid_selection
puts "Player #{player_name} enter the number of objects (Y) to take from heap (X) in order: Y X"
y, x = gets.split.map(&:to_i)
valid_selection = true if filled_heap[x-1] >= y
puts ... |
Ruby - OCI Library Initialization Error <p>Does anyone have any suggestions as to why I might be getting the error below?</p>
<p>This is on a windows 10 machine with both 32 and 64 bit oracle 12c clients installed (not the instant client).</p>
<p>I have looked at this post, but I am not sure if it is similar or not a... | <p>Turns out my problem was that the ORACLE_HOME was set to the 64 bit home directory. I removed both the 32 and 64 bit clients then did a fresh install of the 32 bit. Seems to work now.</p>
|
Replacing an item in list with items of another list without using dictionaries <p>I am developing a function in python. Here is my content:</p>
<pre><code>list = ['cow','orange','mango']
to_replace = 'orange'
replace_with = ['banana','cream']
</code></pre>
<p>So I want that my list becomes like this after replacemen... | <p>This approach is fairly simple and has similar performance to @TadhgMcDonald-Jensen's <code>iter_replace()</code> approach (3.6 µs for me):</p>
<pre><code>lst = ['cow','orange','mango']
to_replace = 'orange'
replace_with = ['banana','cream']
def replace_item(lst, to_replace, replace_with):
return sum((replace... |
Deforming plane mesh to sphere <p>Good day,</p>
<p>currently I'm trying to bend a plane to a sphere.
I've all ready tried the <a href="http://wiki.openstreetmap.org/wiki/Mercator" rel="nofollow">Mercator projection</a> together with <a href="http://stackoverflow.com/questions/10473852/convert-latitude-and-longitude-to... | <p>Use <strong>spherical coordinate</strong> system. The angles <code>long,lat</code> are the <strong>2D</strong> linear <code>u,v</code> coordinates in your plane and output is <strong>3D</strong> <code>x,y,z</code>.</p>
<ol>
<li><p><strong>Convert vertexes (points) of your planar mesh to sphere surface</strong></p>
... |
Htacess regex dash dot underscore alphanumeric <p>I want my htaccess to accept Alphanumeric(A-z,0-9),dash(-),dot(.),underscores(_).</p>
<p>When im just using with <strong>only</strong> underscores its working fine.
<code>RewriteRule ^/([A-Za-z0-9_]+)/?$ index.php?id=$1 [L]</code> </p>
<p>But when using this code it d... | <ol>
<li>As I've already <a href="https://stackoverflow.com/questions/39440400/htacess-regex-dash-dot-underscore-alphanumeric#comment66203576_39440400">commented</a>, <code>[A-Za-z0-9_]</code> is same as <code>\w</code></li>
<li>The paths received by <code>htaccess</code> files do not contain a leading <code>/</code></... |
Another scala Futures composition puzzler <p>I am migrating code from a synchronous to an async style. The problem is fairly simple: call a series of functions, and stop with the first one to return a non-error result (returning that value, otherwise the last computed value). I started with:</p>
<pre><code>def find(fs... | <p>Here's why it doesn't type-check: <code>findBad</code> returns a <code>Future[Int]</code>, but mapping <code>res</code> into an invocation of <code>findBad</code> would result in a <code>Future[Future[Int]]</code>. You need to change <code>map</code> into <code>flatMap</code>. Note that now you also need to wrap <co... |
PostgreSQL how to find what is causing Deadlock in vacuum when using --jobs parameter <p>How to find in PostgreSQL 9.5 what is causing deadlock error/failure when doing full vacuumdb over database with option --jobs to run full vacuum in parallel.</p>
<p>I just get some process numbers and table names... How to preven... | <p>Completing a <code>VACUUM FULL</code> under load is a pretty hard task. The problem is that Postgres is contracting space taken by the table, thus any data manipulation interferes with that.</p>
<p>To achieve a full vacuum you have these options:</p>
<ul>
<li>Lock access to the vacuumed table. Not sure if acquirin... |
Migrating from Eclipse to AndroidStudio: Attribute has already been defined <p>I'm currently trying to migrate my android project from Eclipse to Android Studio. Building the projects fails with following errors:</p>
<blockquote>
<p>:app:processDebugResources</p>
<p>.../app/build/intermediates/res/merged/debug/... | <p>You're targeting SDK 24 and using compact library v24 as well, try setting <code>compileSdkVersion 24</code> as</p>
<pre><code>compileSdkVersion 24
buildToolsVersion '24.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
...
targetSdkVersion 24
...
}
</code></pre>
<p><em>make sure you have the l... |
Is there a way to synchronize clocks with the Microsoft Band using the SDK? <p>I'm working on a project where I need sensor data readings from the Band and a connected smartphone to be synchronized. Thus, I need to be able to find out the clock difference between both devices. Events contain a timestamp, which I could ... | <p>Grab a sensor and hook the appropriate timestamp? Don't have band with me but I believe ISensorReading:: Timestamp comes from the device?</p>
<p>As defined, pulled out of object browser...</p>
<p>Let us know if this works...</p>
<pre><code>namespace Microsoft.Band.Sensors
{
public class BandSensorReadingEventArg... |
Why "format.json { render :show }" doesn't work? <p>I've been following along with the book Agile web development with rails4. The following code is a little confusing:</p>
<pre><code>respond_to do |format|
if @line_item.save
format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.... | <p>In the <code>respond_to</code> block, only one of those <code>format...</code> lines will run and it depends on the type of request. The <code>format.json</code> line will only run if the initial request was an ajax request. If the request was a normal form submission, then only the <code>format.html</code> line is ... |
Is there space overhead to using a hash map instead of an array? <p>I was trying to implement a trie and read in an example implementation that it would be more space efficient to use a small array of size 26 to store the children because then you wouldn't have to waste space with a HashMap (the code was in Java, if th... | <p>A hashmap stores keys and values, so if you were to implement a trie using a hashmap, you would be storing not only the values, but also the keys. If you use an array, then the key is actually the index of the value in the array, so you do not have to store it anywhere.</p>
<p>Besides that, hashmaps are less space... |
Add integers 20, 30, 50 and 160 using register 8-bitAL in assembly using MOVZX <p>I am rather confused with how to find the sum of integers using an 8-bit register AL? Any hint would be great. Thank you. </p>
<pre><code>TITLE Add (AddSub.asm)
; This program adds and subtracts 32-bit integers.
;Problem 1... | <p>When you add a number to <code>AL</code> and there is an overflow, what you get is the low-order 8 bits of the result in <code>AL</code>, and the Carry Flag is set. If you view the Carry Flag plus the AL register as a 9-bit quantity, it is the sum you are looking for. (And a 9-bit quantity is large enough to repre... |
Laravel Pass Authenticated to Every View <p>I need to pass a collection to every view; the collection contains the IDs of the items in the user's shopping cart. I've tried Service Providers and a BaseClass but neither worked as (apparently) <code>Auth</code> hasn't been registered at those points and only returns <code... | <p>Found the answer <a href="https://laracasts.com/discuss/channels/general-discussion/l5-service-provider-for-sharing-view-variables" rel="nofollow">on Laracasts</a> and it seems to work quite well.</p>
<p><a href="https://laracasts.com/discuss/channels/general-discussion/l5-service-provider-for-sharing-view-variable... |
"feature not supported" error when executing a PreparedStatement in UCanAccess <p>I am trying to populate my combobox in a GUI using ResultSet (supported on UCanAccess)</p>
<pre><code>package Vegan;
import java.sql.Connection;
import java.sql.DriverManager;
public class connectionString {
static Connection connect... | <p>The exception is caused by the statement</p>
<pre class="lang-java prettyprint-override"><code>rs = ps.executeQuery(query);
</code></pre>
<p>It is a common error for people starting to work with PreparedStatement objects.</p>
<p>You supply the SQL command text when you call <code>.prepareStatement</code>, e.g.<... |
CNContactPickerViewController in popover (iOS) <p>Is there any way to get a popover showing a Contact picker ?</p>
<p>I tried this (and many other variants) with no results...
(this is an IBAction method in my controller that should show the popover when "sourceView" is tapped)</p>
<p>I always get a full screen moda... | <p>Not specific to <code>CNContactPickerViewController</code> but you would need to set the view controller's <code>modalPresentationStyle</code> to <code>UIModalPresentationPopover</code>.</p>
|
Change color of one face of the cube - THREE.js <p>I am learning OOP while using Three.js. I know, a hard way to do it. So i created a box in the scene. Now i want to change color of one face of that cube.</p>
<pre><code>var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera( 100, window.innerWidth/wi... | <p>In your case, if you want to change the color of one face of the cube, you will need to specify <code>vertexColors</code> in your material.</p>
<pre><code>var geo = new THREE.BoxGeometry( 5, 2, 5 );
var mat = new THREE.MeshBasicMaterial( { color:0xff0ff0, vertexColors: THREE.FaceColors } );
var mesh = new THREE.M... |
java.lang.exception.getCause() gets null everytime <p>In one of the softwares that I develop, I am trying to manage an exception mechanism.</p>
<p>At somewhere of the programme, I do something like;</p>
<pre><code>IF(my condition not allowed){
throw new Exception("My condition not allowed", null)
}
</code></pre>
... | <p>You should <strong>never</strong> throw an instance of <code>Exception</code> (or its unchecked child <code>RuntimeException</code>). You should always find an appropriate subclass to throw, or create your own subclass if there isn't already a suitable one.</p>
<p>Catching <code>Exception</code> will catch every t... |
AttributeError: 'NoneType' object has no attribute 'find_all' (Many of the other questions asked weren't applicable) <p>I've seen this Error asked on here a few times but the solutions really weren't clear to me. </p>
<p>I am just starting out with BeautifulSoup so this question may be a bit trivial.</p>
<p>I am look... | <p>It means you try to call <code>find_all</code> on the value <code>None</code>. That could be <code>row.tbody</code> for example, perhaps because there is no <code><tbody></code> in the actual HTML.</p>
<p>Keep in mind that the <code><tbody></code> element is <em>implied</em>. It'll be visible in your br... |
How to write chunks with HDF5 in julia when ndims can vary at runtime? <p>If I had 1000 slices of a 64x64 image, I could write in 64x64x1 chunks like this:</p>
<pre><code>using HDF5
filename = "test.h5"
# open file
fmode ="w"
# get a file object
fid = h5open(filename, fmode)
# matrix to write in chunks
B = rand(64,64... | <p>So I got the answer from the julia users group on Google after a couple of misfires here. It's delightfully simple:</p>
<pre><code> using HDF5
filename = "test.h5"
# open file
fmode ="w"
# get a file object
fid = h5open(filename, fmode)
# matrix to write in chunks
B = rand(64,64,1000... |
EntityManager not injected in a @Stateless EJB, when I restart the app <p>My entry point is a @Singleton scheduled to be run twice a minute.</p>
<pre><code>@Startup
@Singleton
public class MyScheduledProcess {
@Resource
protected TimerService timerService;
@Inject
private OutgoingMessageProvider pro... | <p>The problem has been resolved by replacing the @Inject by a @EJB in my singleton :</p>
<pre><code>@Startup
@Singleton
public class MyScheduledProcess {
@Resource
protected TimerService timerService;
@EJB
private OutgoingMessageProvider provider;
...
</code></pre>
<p>Yes, it seems logic that it w... |
GADTs, unparametrized types and instance Eq for them <p>I have a container type, called <code>X</code>. Since I want heterogeneous lists over <code>X</code>, its constructor is existentially typed over some type variable <code>a</code>. However, I want it to be an instance of the <code>Eq</code> type class. A hackish s... | <p>Add <code>Typeable</code> so that you have a runtime representation of the type; then use <code>cast</code> to cast one of them to the appropriate type.</p>
<pre><code>{-# LANGUAGE GADTs #-}
import Data.Typeable
data X where X :: (Eq a, Typeable a) => a -> X
instance Eq X where
X x == X y = Just x == c... |
What does `void f(void())` mean? <p>Consider the following snippet:</p>
<pre><code>void f(void());
</code></pre>
<p>What does that <code>void()</code> as an argument type mean exactly?<br>
If it's (as it probably is) a function pointer or function reference, is it legal code?</p>
<p>As far as I know, I cannot define... | <p>It puzzled me for a while the first time I encountered it.</p>
<p>I was already accustomed to the fact that the functions below have the same type:</p>
<pre><code>void f(int[]);
void f(int*);
</code></pre>
<p>Something similar applies in case of function pointers.</p>
<p>As mentioned in <a href="http://eel.is/c+... |
Subscribe to last value after completed on RxSwift PublishSubject <p>I'm looking for something like this:</p>
<pre><code>let observable = PublishSubject<String>()
observable.onNext("1")
observable.onCompleted()
_ = observable.subscribeNext { s in
print(s)
}
</code></pre>
<p>So I want to subscribe to the Ob... | <p>You're using the wrong <code>Subject</code> to get what you want. <a href="https://github.com/ReactiveX/RxSwift/blob/72122e3e435b35a1d72f256a5b6e3929cbd223f1/Rx.playground/Pages/Working_with_Subjects.xcplaygroundpage/Contents.swift#L33" rel="nofollow">Take a look at the descriptions of the Subjects</a>:</p>
<p><str... |
How do i point a subdomain with GoDaddy domain manager? <p>How to point a subdomain (<a href="http://example.com/subsite" rel="nofollow">http://example.com/subsite</a>) with GoDaddy domain manager?</p>
<p>The domain and host is registered with âbluehost indiaâ and it is shared hosting with cpanel.</p>
| <p>You can add an A record of your subdomain in your main domain hosting control panel and point it to your Godaddy hosting account.</p>
|
spring boot not registering optional GET parameter <p>I am following a tutorial and I have the following method:</p>
<pre><code>@RequestMapping(value = "/viewstatus", method = RequestMethod.GET)
ModelAndView viewStatus(ModelAndView modelAndView, int pageNumber) {
System.out.println();
System.out.p... | <p>Add a <code>@RequestParam</code> annotation to map the url variable to the method argument</p>
<pre><code>public ModelAndView viewStatus(ModelAndView modelAndView,
@RequestParam("p") int pageNumber) {
</code></pre>
|
The await operator can only be used within an async method <p>I have an interface <code>ISFactory</code> as follows.</p>
<pre><code>namespace MyApp.ViewModels
{
public interface IStreamFactory
{
Stream CreateSPStream(string sPName);
}
}
</code></pre>
<p>On Windows non-universal version the above f... | <p>The <em>best</em> approach is to make the method <code>async</code>, as the compiler error indicates:</p>
<pre><code>public async Task<Stream> CreateSerialPortStreamAsync(string serialPortName)
</code></pre>
<p>This will require the interface to change as well:</p>
<pre><code>Task<Stream> CreateSerial... |
Issue with ROC curve where 'test positive' is below a certain threshold <p>I am working on evaluating a screening test for osteoporosis, and I have a large set of data where we measured values of bone density. We classified individuals as being 'disease positive' for osteoporosis if they had a vertebral fracture presen... | <p>The easiest solution (although inelegant) might be to use the negative values (rather than reversing your classification):</p>
<pre><code>pred <- prediction(-df$measure, df$fx)
perf <- performance(pred, "tpr", "fpr")
plot(perf,
print.cutoffs.at=-c(50,90,110,120),
cutoff.label.function=`-`,
po... |
Python lambda function "translation" causes recursion error <p>While attempting to understand python lambda functions, I "translated" this function:</p>
<pre><code>s = lambda y: y ** y; s(3)
</code></pre>
<p>Into this regular, defined function:</p>
<pre><code>def power_of_self(y):
return y ** y
power_of_self(3... | <p>The <code>...</code> means the python shell was waiting for more statements as part of the function. You need a blank line to end the function when entering an indented block from directly into the python shell.</p>
<pre><code>>>> def power_of_self(y):
... return y ** y
...
>>> power_of_self(... |
socket.io events and custom events <pre><code>connection
disconnect
custom-event
</code></pre>
<p>Are these string available somewhere on the <code>socket</code> object on the server-side? in case the socket object is passed around, otherwise I'll passing another param with event as well and function signature would b... | <blockquote>
<p>Are these string available somewhere on the socket object on the server-side?</p>
</blockquote>
<p>No. If you want an event name passed to your function, you need to pass it yourself like your own example shows. It is not part of the <code>socket</code> object because (with async operations in-flig... |
if multiple variable are empty jquery <p>Help why is this not working. Im trying to check lots of inputs if they are empty, Im getting SyntaxError error.</p>
<pre><code>if (fname === '') || (lname === ''){
alert('Text-field is empty.');
return false;
}
</code></pre>
| <pre><code>if ((fname === '') || (lname === '')) {
alert('Text-field is empty.');
return false;
}
</code></pre>
<p>All if-statement conditions must be wrapped in parentheses.</p>
|
How is AndroidManifest.xml validated in android studio? <p>How does android studio validate AndroidManifest.xml and any activity xml? I have read <a href="http://stackoverflow.com/questions/10242929/validating-androidmanifest-xml-file">this</a> post and <a href="http://stackoverflow.com/questions/605325/where-are-the-s... | <blockquote>
<p>there isn't an actual schema for android manifest</p>
</blockquote>
<p>I don't think this is correct. According to <a href="http://stackoverflow.com/a/617716/1440565">this answer</a>:</p>
<blockquote>
<p>The schemas don't exist as an xml file. Schemas are dependent upon what UI classes your progra... |
Move camera so that selected object is in focus <p>I have a Unity scene with 6000+ game objects (text meshes) that are searchable, and when the user searches for one, I want the camera to zoom in and focus on that object. I've been using LookAt to have the camera "look at" the searched object, however the camera still ... | <p>Make your text mesh a child node of the camera gameObject. Then adjust the transformation of the node to put it in the center of the screen.</p>
|
Writing a JavaFX project in Clojure <p>I'm trying to understand how to properly setup JavaFX to work with a Clojure project. By reading various sources this is what I've come up with:</p>
<p>This is project.clj:</p>
<pre><code>(defproject cljfx "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http:/... | <p>There may be other problems, but the root problem in the pastebin log is:</p>
<pre><code>Caused by: clojure.lang.ArityException: Wrong number of args (2) passed to: core/-start
</code></pre>
<p>When using gen-class and providing method implementations, every method needs to take the instance itself as the first pa... |
Codeigniter 3.1.0: Only default route is working <p>I will preface my question by saying I have searched high and low for a solution to my problem, including, but not limited to, Stackoverflow, YouTube and Google.</p>
<p>My issue: Only my default route is working in Codeigniter. My default route is set to a controller... | <p>Default controller name should be like this <code>$route['default_controller'] = 'home';</code> not like your <code>$route['default_controller'] = 'home/home';</code></p>
<p>And then try it the url www.site.url/pages/contact is working or not if working then try <code>
$route['contact'] = 'pages/contact';</code></p... |
Ruby - Program navigator module <p>I have a Ruby program that uses a webdriver (Watir) to walk a page and perform tests alongside a BDD suite called RSpec.</p>
<p>I'm trying to optimize it for a slow server by improving its ability to navigate efficiently. Thus far It has been creating a new browser session for each t... | <p>You are exactly correct about the difficulties of maintaining state in your tests. Shutting down a browser between each session is the best way to make sure that you always know the state of the browser at all times for a test. Saucelabs goes so far as to spin up a new virtual machine for each of the tests they run... |
Trying to run a simple Selenium signup test ERROR <p>Getting this error while running a simple test.</p>
<p>Java version-- java -version
java version "1.8.0_102"</p>
<p>compiler version javac -version
javac 1.8.0_102</p>
<blockquote>
<p>Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/... | <p>Had same issue. Removed older Java JDKs from the system, set to build with Java8 and worked like magic.</p>
|
Selenium 3 - Selenium Jar issue error is "The jar file Selenium-server-standalon-3.0.0-beta3.jar has no source attachment" <p>Not sure why I am seeing this error.</p>
<p>I installed the new java 8_101. Have the jre and jdk present in the machine</p>
<p>Selenium - Eclipse Luna 64bit. </p>
<p>In my ref library I have:... | <p>Bro, try changing this:</p>
<pre><code>System.setProperty("webdriver.firefox.marionette", "C://Selenium driver//geckodriver.exe");
</code></pre>
|
rtweet error message "data is not a data frame" <p>I am trying to use the tweetR package but get the following message when trying to use the <code>search_tweets()</code> function like so:</p>
<pre><code>> x <- search_tweets(q="football", n=100)
Searching for tweets...
Collected tweets!
Error: data is not a dat... | <p>I'd currently recommend installing the development version on Github (<a href="https://github.com/mkearney/rtweet" rel="nofollow">https://github.com/mkearney/rtweet</a>). Without seeing your session info and script, I wouldn't be able to tell you exactly what the problem is. My guess is something went wrong with you... |
Construct a layer with tensorflow to normalize a matrix/tensor <p>Using <code>conv2d_transpose()</code> function, a matrix could be generated with size m*n (only 1 channel/filter). I just wonder how to normalize this matrix by column to make sure the sum of each column is one. It is very similar as <code>softmax</code>... | <p>I just figure this out using <code>tf.reduce_sum()</code> and <code>tf_div()</code>. If you have the same question, please let me know.</p>
|
How to create tuples from a single list with alpha-numeric chacters? <p>I have the following list with 2 elements:</p>
<pre><code>['AGCTT 6 6 35 25 10', 'AGGGT 7 7 28 29 2']
</code></pre>
<p>I need to make a list or zip file such that each alphabet corresponds to its number further in the list. For example in list[0]... | <p>Use tuples splitting once to get the pairs, then split the second element of each pair, <em>zip</em> together:</p>
<pre><code>l =['AGCTT 6 6 35 25 10', 'AGGGT 7 7 28 29 2']
pairs = [zip(a,b.split()) for a,b in (sub.split(None,1) for sub in l]
</code></pre>
<p>Which would give you:</p>
<pre><code>[[('A', '6'),... |
Can't get styles to dynamic content <p>I'm facing strange behaviour: bootstrap somewhat works on my pages, but doesn't style my for forms.</p>
<p>I can see that it loads and all because of buttons, flexbox, grid system. However I can't get it to style forms. Here I'm showing dynamic form with the same code as static f... | <p>I think you forgot to apply CSS for your dynamic form controls. Try adding <code>form-control</code> class to all of the controls in your form would help.</p>
|
determining foreign, primary keys, 1nf, 2nf, 3nf given table and functional dependencies <p>first and foremost i would like to say that this is for a past homework assignment that i could not figure out and have come here to ask for clarification. I am having trouble with normalization for this specific question. </p>
... | <p>The assignment isn't structured well. Questions a, b and c refer to "this relation", and if it's interpreted as referring to the original given relation, the answer to b and c will start with "because it's not in 1NF". It would be a better test of a student's understanding if b and c referred to the answer to the pr... |
former form fields no longer found by mechanize python script <p>Let me start by apologizing for my utter newbness. I was asked by a friend a couple years ago if I could write a program to automatically grab substitute teaching openings. It wasn't an area I knew anything about, but a couple tutorials allowed me to bang... | <p>Try something like this if that html code is exactly what is on that page. When you put b.select_form(nr=0) there is the possibility that for some reason the first form is not what you are selecting. By looking for the form name in the b.select_form() you can ensure you find the correct form. Test it out and see if ... |
How use raw Gryoscope Data °/s for calculating 3D rotation? <p>My question may seem trivial, but the more I read about it - the more confused I get... I have started a little project where I want to roughly track the movements of a rotating object. (A basketball to be precise)
I have a 3-axis accelerometer (low-pass-f... | <h2>Short answer</h2>
<p>Yes, go for quaternions and use a first order linearization of the rotation to calculate how orientation changes. This reduces to the following pseudocode:</p>
<pre><code>float pose_initial[4]; // quaternion describing original orientation
float g_x, g_y, g_z; // gyro rates
float dt; // time ... |
stylus (css) calculation based on current screen width <p>I want to do something like <br/></p>
<pre><code>.findcol1 > img
max-width 1.5em
max-height 1em
@media screen and (min-width 700px)
max-width [1.5 + Math.floor("current_screen_width"/700)]em
max-height ... | <p><strong>Option 1 -</strong> <br/></p>
<pre><code>.findcol1 > img
width 1.5em
height 1em
@media screen and (min-width 700px) and (max-width 1399px)
width 2.5em
height 2em
@media screen and (min-width 1400px) and (max-width 2099px)
wid... |
Is an operating system kernel an interpeter for all other programs? <p>So, from my understanding, there are two types of programs, those that are interpreted and those that are compiled. Interpreted programs are executed by an interpreter that is a native application for the platform its on, and compiled programs are t... | <p>They run on the "bare metal", but they do contain operating system-specific things. An executable file will typically provide some instructions to the kernel (which are, arguably, "interpreted") as to how the program should be loaded into memory, and the file's code will provide ways for it to "hook" in to the runni... |
VLC plugin blocks Modal Popup on Firefox <p>I have embedded a VLC plugin for video streaming on a HTML web page. The trouble is that it blocks the HTML popups like follows:
<a href="http://i.stack.imgur.com/7AqNc.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/7AqNc.jpg" alt="enter image description here"></a></... | <p>Use <code>embed</code> instead, this way (with windowless parameter):</p>
<pre><code><embed
type="application/x-vlc-plugin"
pluginspage="http://www.videolan.org"
width="430"
height="250"
target="rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov"
windowless="true"
/>
</code></pre... |
How can I convert a Jsoup Document[] array to a String[]? <p>My question is the same as <a href="http://stackoverflow.com/questions/6865090/how-do-i-convert-a-document-made-in-jsoup-the-java-html-parser-into-a-string">this one</a> except that instead of a single <code>Document</code> I have an array (<code>Document[]</... | <p>it is assumed that serves is an array of String containing the URL to connect, you do not need to create another array of Document</p>
<pre><code>String[] result = new String[strvec.length];
for(int n=0; n < strvec.length;n++)
result[n]=Jsoup.connect(strvec[n]).get().html();
</code></pre>
|
Getting external variables inside Angular.js factory <p>I am giving my first steps with Angular.js and I am facing a little problem which I don't know how to deal with Angular. I know many jQuery ways for solving it, but I am sure that it may exists an Angular way:</p>
<p>Firstly, I have an select element set with <co... | <p>Pass the value in the ngclick:</p>
<pre><code> <button ng-click='loadTowers(currentPlant)'>
</code></pre>
<p>Then add it in the factory args:</p>
<pre><code> o.towers = function(currentPlant){
}
</code></pre>
|
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.Bitmap.isRecycled()' on a null object reference <p>I am trying to implement swipe to delete in RecyclerView. Everything seems to be working fine except drawing a delete icon below the item that's being swiped. </p>
<p>This is h... | <blockquote>
<p>I don't understand why it;s null since I've already assigned it a value.</p>
</blockquote>
<p>Yes. You did => <code>null</code>. The problem is elsewhere. See docs for <a href="https://developer.android.com/reference/android/graphics/BitmapFactory.html#decodeResource(android.content.res.Resources,%20... |
Regular expression for permutation of M characters of length N <p>I need a regular expression that represents permutation of given M characters and the permutation string should be in length N. For example, I have 1 and 0, so <code>M=2</code> and the length of permutation string need to be 3 (ie. <code>N=3</code>), the... | <p>Heres a Regex to match the digits <code>1-n</code>. You can tinker with it to do what you want.</p>
<pre><code>^(?=[1-n]{n}$)(?!.*(.).*\1).*$
</code></pre>
<p><strong>Sample input for n = 4</strong></p>
<pre><code>1234
2431
abcde
4321
1231
3412
</code></pre>
<p><strong>Output</strong></p>
<pre><code>1234 *MATC... |
Search using Thread in Lucene 6.2 using Scala <p>I'm trying to index the data from MySQL(using Slick in Scala) using Lucene 6.2. Here is the code below</p>
<pre><code>package oc.api.services
/**
* Created by sujit on 9/7/16.
*/
import org.apache.lucene.document._
import org.apache.lucene.analysis.standard.Standar... | <p>Finally I found the answer researching long time:</p>
<p>Using Thread: </p>
<pre><code>def setI = {
val NUM_THREADS = Runtime.getRuntime().availableProcessors()
val curNotes = notesService.getNotes()
val totalRows = Await.result(curNotes, Duration.Inf).length
var totalPages = totalRows / NUM_THRE... |
Hover a specific cell and change background color and font color <p>I'm building a menu and using a table.</p>
<p>Two columns, one for the icon and a second for the text.</p>
<p>My question is how to fix, that on mouseover on the text cell the background changes?</p>
<p>I can use CSS hover action but it have effect ... | <p>You can use a CSS selector like this:</p>
<pre><code>td:nth-child(2):hover {
background-color: red;
}
</code></pre>
<p>I'm assuming your table looks like:</p>
<pre><code><table>
<tr><td>Icon</td><td>Text</td></tr>
<tr><td>Icon</td><td>Text</... |
PayPal Express Checkout without logging in <p>Is it possible to use Paypal express checkout without signing in even if the user has a Paypal account present? </p>
<p>We have noticed that some folks forget their credentials and don't want to login to Paypal, thus causing us to lose their donation. The Account optional ... | <p>Paypal provide optional guest checkout. <a href="https://www.paypal.com/webapps/mpp/express-checkout#overview" rel="nofollow">https://www.paypal.com/webapps/mpp/express-checkout#overview</a></p>
|
C++: Getline stops reading at first whitespace <p>Basically my issue is that I'm trying to read in data from a .txt file that's full of numbers and comments and store each line into a string vector, but my getline function stops reading at the first whitespace character so a comment like (* comment *) gets broken up in... | <p>This is for the very simple reason that your code is not using <code>std::getline</code> to read the input file.</p>
<p>If you look at your code very carefully, you will see that before you even get to that point, your code constructs an <code>istream_iterator<string></code> on the file, and by passing it, an... |
Inserting An "Array" between Rows in Excel <p>I have the below macro which inserts an array of data on each alternative row. </p>
<p>This works well, however, my data changes all the time so it is not the best method.</p>
<pre><code>Sub inserttexteveryonerow()
Dim Last As Integer
Dim emptyRow As Integer
... | <p>Assuming your request is to insert the range on Sheet2 <strong>from cell A1 to cell F1</strong>, the following should work:</p>
<pre><code>Sub inserttexteveryonerow()
Dim Last As Integer
Dim emptyRow As Integer
Last = Range("A" & Rows.Count).End(xlUp).Row
For emptyRow = Last To 2 Step -1
... |
JavaScript errors not showing up in console? <p><code>fields</code> is undefined in the following code snipped, but it is not logged to the console when the error happens. In this specific instance, why, and what is the de facto way to handle this?</p>
<p><code>"Testing"</code> is logged to the console (Line #2), but ... | <p>The automatic logging to console is a mechanism for <em>unhandled</em> exceptions. Because Promises automatically catch exceptions in the callbacks, the exceptions are no-longer unhandled, so nothing will be automatically logged.</p>
<p>If you want it to be logged, you could perhaps add a <code>throw err</code> at... |
How to manage and review multiple, large size git branches? <p>So we have a big problem here. There are multiple user stories for each sprint and a new branch is created off the develop for each user story. </p>
<p>In the middle of the development, the developer notices that they need a code/method or something from a... | <p>I would suggest you to try out <em>Source Tree</em> for managing your Git repositories. It offers a useful UI interface to visually show who is working on what branch and how the branches are laid out. It offers many features and works pretty well for large-scale projects where there are several branches in your rep... |
how to make a bat file to delete all hidden and non hidden files from a folder <p>My question is how to make a bat file that deletes all files, hidden and non hidden from a folder, this is my script so far:</p>
<pre><code>cd "C:\Users\%USERNAME%\Documents"
del . /Q
</code></pre>
<p>the problem is that it only deletes... | <pre class="lang-dos prettyprint-override"><code>del /a /q "C:\Users\%USERNAME%\Documents\*"
</code></pre>
<p><code>del</code> command includes the <code>/a</code> switch to allow filtering by file attributes (see <code>del /?</code> for a list of available switches and options). If you include the switch but don't in... |
Openshift server crashe while executing jira <p>Im using openshift with a DIY cartridge, i set up tomcat8 (with jdk8) and deploy JIRA 7 on it, but each jira tries to load its add-ons, the server crashes.
Here are the tomcat logs: <a href="http://pastebin.com/6NMgZ1VQ" rel="nofollow">http://pastebin.com/6NMgZ1VQ</a></p>... | <p>More than likely you are probably using a small gear to try to run Jira in Tomcat8, and you are most likely running out of memory on that small gear. Especially if you are also running a database as part of the application. You can check this by sshing into your gear and running the following commands:</p>
<pre><c... |
Is it best practice to put all PHP functions in separate files if you want to use them in combination with jQuery (Ajax) and get responses? <p>I normally put all functions in separate files, but I'm imagining ways to put everything in one file.</p>
<p>You could probably send the name of the needed PHP function along w... | <p>If your project is really big and has lots of people engaged to the project, separating files for each functions would be a nice option to work together.</p>
<p>But if it's not the case like that, putting every functions in one file will make your project looks more simple and productive.</p>
<p>Please note that t... |
What is wrong with the following quadratic equation code? <p>I am trying to make a program that converts standard form quadratic equations to factored form using the quadratic formula, but I'm getting an error on the part where I begin to do math. It seems like it has a problem with the floats I am using, but I do not ... | <p>The <code>^</code> operator probably doesn't do what you expect. It's a binary XOR, or e<strong>X</strong>clusive <strong>OR</strong> operator. The XOR operator doesn't work with floating point numbers, thus producing the error. The error basically says it can't do the operation on two floats. With exponents, use a ... |
How do I stop Appium/Python script hanging when connecting to app? <p>I have an Appium script (written in Python) which freezes when connecting the web driver.</p>
<p>It is at the following line of code:</p>
<pre><code>self.driver = webdriver.Remote(self.webdriver_url,
desired_capabilities=self.desired_capabi... | <p>I think you should deal with it , not Appium.You should design the test cases run independently,i mean test case 002 should not depend on test case 001.You will need clean installation for each testcase.</p>
<p>Eg: u want to test order test case (005),you should repeat the actions from test case login (001).It will... |
fit exponential or hockey stick decay <p>I'm trying to find an equation to fit my data. I recognize the shape to be <code>y=-exp(x)</code> but <code>nls(y~-a*exp(x*b))</code> with various parameter start values fail. <code>y</code> is negative so the "easy" fit of log(y)~log(a)+b<em>x doesn't work well. I tried log(y+2... | <p>It's little wonder it doesn't converge. Your model doesn't allow the fit to go above 0.</p>
<p>You need an asymptote parameter in your nls model rather than forcing it to be 0.</p>
<p>If you try something like </p>
<pre><code>nls(y~c-a*exp(x*b),start=list(a=.1,b=.1,c=0.2))
</code></pre>
<p>you get a reasonable f... |
Vectorized approach to creating a matrix with 1s in indices given by a column vector in MATLAB <p>Let's say I'm given a <code>1000x1</code> column vector of with values ranging from 1-10. Now I want to turn this into a <code>1000x10</code> matrix, where for each row there is a 1 in the column given by the value in the ... | <p>We can access any subset of the entries in ymat all at once using the "<a href="http://blogs.mathworks.com/steve/2008/02/08/linear-indexing/" rel="nofollow">linear index</a>" of those entries. Since we already have y that contains the column coordinates, and the row coordinates are simply 1:100, We can easily obtain... |
How to create separate lists if multiple strings are passed into a method? <p>I have a <code>list<String></code> in my constructor method. I want to account for the possibility of multiple words being entered. For example, someone could pass in "bike" and that would be searched, or "Sally" and that would be searc... | <p>If I understand what you are asking, consider using a <code>Map</code>:</p>
<pre><code>import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class WordInAssay {
Map<String,List<Integer>> wordsMap;
public WordInAssay(List<String> words) {
//check that... |
How to read large text files on Android? <p>How do I read large text files as GTFS files (<a href="https://developers.google.com/transit/gtfs/?hl=pt-br" rel="nofollow">Google Transit</a>) and put these on Firebase database? The problem is that I've used various forms and all my application returns the error OutOfMemory... | <p>Cutting the file into several pieces may help.</p>
|
After navigate to another page using routerlink in Angular2 URL change but page is not refreshing <p>I created this project by using Angular-Cli webpack. And I build the project and hosted in AWS with IIS</p>
<p>Here is the github url : <a href="https://github.com/igkmahesh/InihilPhotography" rel="nofollow">https://gi... | <p>All the content is there, you are just seeing right through it to the background :)</p>
<p>You have a "opacity: 0;" in your CSS class right-content.</p>
|
Rails DateTime format can't be corrected <p>I have two columns in my app that are of type DateTime.</p>
<p>When editing an entry in the application, I am pasting </p>
<pre><code>12/09/16 10:39
</code></pre>
<p>But when it goes to the show page, it shows:</p>
<pre><code>16/09/12 10:39
</code></pre>
<p>When showing ... | <p>In your controller <code>require 'date'</code> and then you can pass the formatted <em>DateTime</em> to your view:</p>
<p>Controller:</p>
<pre><code>require 'date'
def index
@user_date_time = current_user.your_date_time
@formatted_date = @user_date_time.strftime('%d/%m/%Y %I:%M').to_s
end
</code></pre>
<p>Vi... |
Check if string (between // and /) contains a colon and a dot <p>I have a string that is between <code>//</code> and <code>/</code>, ie. <code>{sub1}//{string}/{sub2}</code></p>
<p>How can I tell (possibly the fastest way) if this string contains both a colon (one or more) and a dot (one or more)? For example:</p>
<p... | <p>Use preg_match as follows:</p>
<pre><code>$string = "testsomething//apple:phone./hello";
preg_match("/\/\/((.*?[:].*?[.].*?)|(.*?[.].*?[:].*?))\//", $string, $match);
print_r($match);
</code></pre>
<p>Since you don't care about the order of <code>:</code> or <code>.</code>, <code>[:]</code> and <code>[.]</code> ... |
Unable to upload file on OpenShift <p>I'm using the CKEditor plugin to upload images to my OpenShift application but the application will not upload the files. It works fine locally, but I cannot determine what is causing the issue. It seems like it can't find the directory.</p>
<p>==> app-root/logs/nodejs.log <==
... | <p>Not sure how OpenShift works but perhaps you didn't add your public/uploads directory to the project/repo/however it gets installed in the OpenShift servers.</p>
|
JDBC - The result set has no current row error <p>I'm having the following error whenever I run my program.</p>
<blockquote>
<p>com.microsoft.sqlserver.jdbc.SQLServerException: The result set has
no current row.</p>
</blockquote>
<p>The program is supposed to print off user selected data from my MySQL database. I... | <p>It does not mean that the result set returned no registration. This means that the set of records is not set to the row you want to read. </p>
<p>The first time you load the set of records is not positioned for any row. So <code>rs.next()</code> will position the result set of the first row (ie, make the first row ... |
R Studio: ctrl+shift+enter runs the entire code instead of the selected lines only <p>I am using R Studio and I have encountered a problem: ctrl+shift+enter is running the entire code instead of the selected lines only. I can always use "Run", but I am used to ctrl+shift+enter... Anybody has any clue on how to fix th... | <p>Documentation <a href="https://support.rstudio.com/hc/en-us/articles/200711853-Keyboard-Shortcuts" rel="nofollow">here</a></p>
<p><code>Run current line/selection Ctrl+Enter</code><br>
<code>Run current line/selection (retain cursor position) Alt+Enter</code></p>
|
What is the recommended way to do multithreading in Scala <p>I am rather confused about what approach to take while writing multithreading code in Scala. I see three options:-<br></p>
<ol>
<li>Use Java style.. and use Scala where there are syntax issues.. e.g. there is no volatile keyword in Scala but fields can be ma... | <p>My advise would be to start with Futures and then move to Actors if there is a need.</p>
|
SQLDateTime Overflow and All DateTime fields are Valid <p>The exception message I receive is straightforward:</p>
<blockquote>
<p>SQLDateTime overflow must be between 1/1/1753 12:00:00 AM and 12/31/9999 12:59:59 PM``</p>
</blockquote>
<p>This is the VB 2013 code which uses Linq to SQL:</p>
<pre><code>Dim BQCust = ... | <p>Please be noted that if you are having <code>VoidedDate = NULL (Nothing)</code> in the debugger, that means <code>0001-01-01</code> in .NET.</p>
<p>There is no null for DateTime object in .NET</p>
<p>If you would like to debug, try select data into a datatable and then update with the <strong>exact same datatable<... |
Insert function for BST with strings in C <p>This is BST NODE </p>
<pre><code>struct BST_node{
char *name1;
char *data1;
struct BST_node* left;
struct BST_node* right;
};
struct BST_node* Insert(struct BST_node *rootptr, datatype_t *d){
if(rootptr == NULL){
char name[66];
char data[1466];
... | <p>This code works. The primary change is making sure that you return immediately after setting the root node. (Note that in your trace, you get told that the first node you insert is a 'duplicate' â that's because you don't do the early return.) I used an <code>else</code> on the subsequent <code>if</code> stateme... |
Project references from Unit Test project <p>My Unit Test project (NUnit) is created to test Business Logic only. The vast majority of this logic is in my Business Logic project. I have a separate DLL with all of this. My application is layered and has a project for UI, Service Layer, Business Logic and Data Access lay... | <p>You could solve this by extracting DB-related interfaces from the Database layer into the BL, and inject those in constructors, instead of the actual implementations. This is in fact recommended, for example if you wanted to be able to plug in a different layer instead of DB (other DB, file/external service etc) - t... |
Infinite loop checker crashes - Jquery <p>So I wrote this short code for a small project of mine, here's the code:</p>
<pre><code>while(true){
if(PremiumExchange.data.stock["wood"]>=64){
var x = PremiumExchange.data.stock["wood"];
document.getElementsByName('buy_wood')[0].value = x;
document.getElementsByClassNa... | <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 test() {
if (document.getElementById("test").value) {
console.log("Success!");
clearInterval(int);
}
}
... |
How does this date and time snippet work? <p>I just started taking a computer science class a week ago, and I found this code to get the date and time. But I don't fully understand what everything in this means. If anyone could clarify that would be awesome! :)</p>
<pre><code>long yourmilliseconds = System.currentTime... | <p><code>long yourmilliseconds = System.currentTimeMillis();</code></p>
<p>get the number of milliseconds from the System</p>
<p><code>Date resultdate = new Date(yourmilliseconds);</code></p>
<p>Creates a date from it. These two lines could be changed to</p>
<p><code>Date resultdate = new Date();</code></p>
<p>As... |
If condition in Emal Callback - Graylog Opensoure <p>Anyone that have exp about configuring email callback on <code>Graylog</code>, please advise me this case.
In log that we receive have field: protocol-id. Now I can using it in email by using syntax: </p>
<pre><code>${message.fields.protocol-id}.
</code></pre>
<p>B... | <p>You can create a stream which contains only those messages (e. g. by adding a stream rule "Field <code>protocol-id</code> must be equal to 17"), call it "Protocol-Attack: UDP", and then create an alert condition for this specific stream which will fire if there are any messages in this stream.</p>
|
error :reason: '-[UITextField mas_makeConstraints:]: unrecognized selector <p>error comes out when this code runï¼
<code>[ageInputTextFiled mas_makeConstraints:^(MASConstraintMaker *make){}];
</code>
I have searched several similar problem to me ,most answer say that masonry is not link to the project successfully ,... | <p>You need <code>addSubview</code> first then set constraints.</p>
|
Returns HTTP 500 code when accessing resource using HTTPS <p>I wrote a sample Java REST Client application to access a resource, but it gives the 500 error. Here resource can be accessed through HTTPS only.</p>
<pre><code>Client client = ClientBuilder.newClient();
WebTarget target = client.target("https://<... | <p><a href="http://www.bhaveshthaker.com/24/calling-invoking-secure-restful-web-service-over-https-with-jax-rs-in-java-without-keystore-truststore-information/" rel="nofollow">http://www.bhaveshthaker.com/24/calling-invoking-secure-restful-web-service-over-https-with-jax-rs-in-java-without-keystore-truststore-informati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.