input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Invalidate Guava cache by the part of the key <p>I am using Guava LoadingCache for caching auth requests for the external storage. The key is the object Auth:</p>
<pre><code>public class Auth {
private String username;
private String password;
public boolean equals(Object o);
}
</code></pre>
<p>and the re... | <blockquote>
<p>For example, I got two records in cache: Auth(user1, password1) = OK and Auth(user1, password2) = FORBIDDEN. So password1 is correct, and password2 is incorrect. If I'll receive more one request with Auth(user1, password2) , I just return FORBIDDEN without quering the external storage.</p>
</blockquot... |
Could not find gradle 3.1 <p>The latest version of gradle is 3.1 <a href="https://docs.gradle.org/current/release-notes" rel="nofollow">enter link description here</a></p>
<p>but Android Studio is only using 2.2?</p>
<p><a href="https://developer.android.com/studio/releases/gradle-plugin.html#updating-gradle" rel="no... | <p>Here is the Gradle Version Compatibility for Android Studio</p>
<p><a href="http://i.stack.imgur.com/Lw819.png" rel="nofollow">Gradle</a></p>
<p>refer to <a href="http://tools.android.com/tech-docs/new-build-system/version-compatibility" rel="nofollow">link</a></p>
|
File compression with zlib without saving to disk and send via socket <p>I have a server that receives client files, but the transfer in external networks is too slow, reading a bit i found the solution in file compression. I decided to use <a href="http://www.zlib.net/" rel="nofollow">zlib</a> for compression, i did a... | <p>One way is to use a <a href="http://www.boost.org/doc/libs/1_62_0/libs/iostreams/doc/index.html" rel="nofollow">Boost Iostream compressor</a> (they support zlib, gzip, bzip2 out of the box) and an <code>ip::tcp::iostream</code> socket from Boost Asio. Something like:</p>
<pre><code>#include <boost/iostreams/filt... |
Insert into Linked table in access without the primary key <p>Im trying to insert into a linked SQL table in access 2007, below is my query</p>
<pre><code>INSERT INTO tblProducts ( ProductPrefix, ProductCode, ProductDescription, MadeFrom, MadeFromDescription, SamFamilySort1, SamFamilySort2, SamFamilySort3, SamFamilySo... | <p>Notice that the very last item in the column list of the INSERT INTO clause is <code>ProductID</code>. So, you are trying to insert a new row with an existing Primary Key value, and that won't work. As a simplified example, </p>
<pre class="lang-sql prettyprint-override"><code>INSERT INTO tblProducts (ProductDesc... |
Can't submit App with Siri-Capability enabled (ITMS-90163) <p>I am currently trying to submit my app to the app store and the latest update will add siri capabilities to the app. So in the capabilities tab I enabled Siri, but now my app fails iTunes verification (ITMS-90163) and I have no clue what's wrong here. </p>
... | <p>Go to <a href="https://developer.apple.com">https://developer.apple.com</a>. Select identifier -> tap on your app identifier.</p>
<p><a href="http://i.stack.imgur.com/B0zf8.png"><img src="http://i.stack.imgur.com/B0zf8.png" alt="enter image description here"></a></p>
<ol>
<li>Enable Sirikit from here.</li>
<li>reg... |
Custom animation of segue is not played the first time tapping the button <p>I encountered an unusual behavior on which I am stuck a little, the problem is the following.</p>
<p>I'm using BWWalkthrough library in order to have a 4 slides as launch screen. So in my appdelegate i have the following code which initialize... | <p>The problem here lies in the BWWalkthrough library which is using a scrollview to present all the views of the various ViewControllers that you add.</p>
<p>As such, you add the dst.view at the beginning of the scrollview (at offset screenwidth,0) which you then transform to offset (0,0). </p>
<p>All of this is off... |
TypeError: Cannot read property 'contextTypes' of undefined <p>I'm trying to testing a React-app with Jest, I use Enzyme's shallow to render my <code>App.js</code> component in <code>App-test-js</code> but I'm getting this error: <code>TypeError: Cannot read property 'contextTypes' of undefined</code></p>
<p>This is m... | <p>The problem here is that you are redefining the the app component with the result of the shallow call</p>
<pre class="lang-js prettyprint-override"><code>// Redefining
// â
const App = shallow(<App />);
</code></pre>
<p>The solution here is to use a different name:</p>
<pre class="lang-js prettypr... |
Asp.net Facebook webhook Updates <p>I have created a Test Ad lead and I am trying to create webhook to consume real time updates. I was able to create a webhook sucessfully but when I try to create a Test lead my webhook is not triggering and I get Error code as 301</p>
<p>Below is my code:</p>
<pre><code>[HttpGet]
... | <p>Issue was my URL was not secured. Installed certificates and now I am able to receive updates</p>
|
How to change Textblock color when the ListViewItem is selected? <p>How to change the textblock's color when when the ListViewItem is selected in the Windows 8.1 store app?</p>
<pre><code><ListView>
<ListView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding text}" Nam... | <p>Set ListViewItem Style and change the color when selected:</p>
<pre><code> <Style x:Key="{x:Type ListViewItem}" TargetType="ListViewItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewItem">
<Grid SnapsToDevicePi... |
How to localize in a map a 3d object in a 2d image with ROS , C++ and OpenCV <p>Let suppose I have a stopped video camera that is recording in front of it, and in the left side of his visual there is a person stopped in his position. If I know the distance in meters between the person and the video camera( in diagonal)... | <p>Here is how I understood the question. Excuse my drawing skills.
<a href="http://i.stack.imgur.com/O7ZOl.png" rel="nofollow"><img src="http://i.stack.imgur.com/O7ZOl.png" alt="enter image description here"></a></p>
|
Symfony forms, guess required attribute in association fields <p>when I'm adding fields of my entity in Symfony forms, the entity annotations are mapped and based on this Symfony guess if my field can be nullable or not, so far so good, such as this dump:</p>
<pre><code>public 'fieldMappings' =>
array (size=5)
'... | <p>You can create a <a href="http://symfony.com/doc/2.8/form/type_guesser.html" rel="nofollow">TypeGuesser service</a>. That's a hell of a lot of work, though, so why not manually set the fields once and be done with it?</p>
|
Access search function: Display "No Match" if no records found <p>I have a search function implemented in my Access form. A user can search to see if there is an existing entry. I want to make it so that there will be a display of "No match found" if the user searches and no existing entry. </p>
<p>Below is my VBA cod... | <pre><code>IF strsearch.value = VbNullString Then
MsgBox "Not Found"
End if
</code></pre>
|
sql query for the fetching back the drop-down list selected option <p>I have drop down list in my website and the options are stored in database in a separate table and fetched back to drop down list. Now whenever I select any option from drop down list the value of option is stored in a main table. Now how do I fetch ... | <p>Could you provide some more detail? I assume that when the user loads the page you want the dropdown menu to display the same value it had the last time they logged in or something like that?</p>
<p>If such be the case, you need a few things. To start with your body tag needs an onload function that will get called... |
Why isn't std::move a keyword in C++? <p>Obviously, move semantics/r-value references were a much needed addition in C++11. One thing that has always bugged me though, is std::move. The purpose of std::move is to transform an l-value into an r-value. And yet, the compiler is perfectly happy to let you continue using... | <p>In C++, moved-from objects in are still objects. They can be used. They are usually in a defined state.</p>
<p>There are some optimizations you can do when you are willing to 'rip the guts' out of an object and use it elsewhere. The C++ committee decided these optimizations should be done implicitly and automati... |
C#: Console.WriteLine not printing out results <p>I'm trying to get the following bit of code to print out the "sum" to the console, it compiles fine and everything but never prints out the sum. Can someone give me a hint please? Thanks.</p>
<pre><code>class Program
{
static void Main(string[] args)
{
... | <p>To get this to work like you've got it:</p>
<pre><code>static void Main(string[] args)
{
ArraySum();
}
</code></pre>
<p>But if you try to compile this, you'll see an error message similar to <code>an object reference is required ... Program.ArraySum()</code>.</p>
<p>Why?</p>
<p><code>Main()</code> is <code>s... |
Angular select and ng-model <p>I'm trying to populate a select field with content from an array. I'm confused as to what exactly my "model" is.</p>
<p>I'm looking to access content from <code>ctrl.contents</code> which is an array of objects. I assume this is my "model".</p>
<p>ViewPage.html</p>
<pre><code><div&g... | <p>Your 'model' is a separate variable that will contain the selected value of your select menu - set it to something like <code>ctrl.selectedItem</code>.</p>
<p>Your <code>ng-options</code> parameters should look like this:</p>
<pre><code>ng-options="content.title.name for content in ctrl.contents"
</code></pre>
<p... |
Working out average reviews javascript <p>I am trying to loop through 3 places and select the place with the highest average reviews and rating.</p>
<p>Say i have the following.</p>
<pre><code>var places = [{
name: "place 1",
reviews: 100,
rating: 5,
},{
name: "place 2",
reviews: 10000,
rating: 5,
},{
n... | <p>Please check the code below and let me know if this works for you or not. Since I don't know how you are calculating the highest score, I assume it's <code>(rating * reviews) / rating</code> according to which you get the value. You may run the code snippet given and see the result for yourself. Basically, you have ... |
Calling a Query that Returns in MVC 5 <p>I am a beginner in MVC 5. I want to display a list of selected data from database .I've created a controller action that used raw query and an IEnumerable class or model. But the Controller returns an error:</p>
<blockquote>
<p>An exception of type 'System.Data.SqlClient.SqlE... | <p>It looks like the table name you're after isn't "tblProduct" - I'm guessing it's more likely to be "tblProducts", so if you amend your SQL query it should work.</p>
<p>This is assuming you've created that table in the sql database - hard to tell without looking at the schema</p>
<pre><code>string query = "select *... |
Cant create a admin session in CI <p>I want to create a login system in CodeIgniter.
I have this in my controller:</p>
<pre><code>public function user_login_process()
{
$data = array(
'username' => $this->input->post('username'),
'password' => $this->input->post('password')
... | <p>you are not comparing, you are assigning here:</p>
<pre><code>if( $username="admin"){ // will assign 'admin' to $username
</code></pre>
<p>Should be:</p>
<pre><code>if( $username=="admin"){ // will compare $username == 'admin'
</code></pre>
|
ASPX Cookies lost <p>I have an issue with ASP.NET cookies being lost between requests.</p>
<p>I have an ASCX control which has multiple filtering checkboxes. I can check/uncheck these checkboxes and then I click a . In this applyFilters method, I am setting cookies based on whether the checkboxes are checked/unchecked... | <p>You shouldn't be removing request cookies and adding response cookies with the same name multiple times. This should work.</p>
<pre><code> public void setFilterCookie(string name, string val)
{
var cookieValue = string.Empty;
var expires = 0;
if (!string.IsNullOrWhiteSpace(val) &&... |
Dynamic call to an Instance Variable <p>I have a dynamic string based on the current file's extension called "extension"</p>
<pre><code>fileextension = os.path.splitext(file.filename)[1]
extension = fileextension.replace(".","")
</code></pre>
<p>Lets say extension = "pdf"</p>
<p>How would I be able to call the Ext.p... | <p>You called the instance attribute correctly. To fix your issue do not assign the result to the <code>filetype</code> attribute:</p>
<pre><code>ext = Ext()
getattr(ext, extension)()
print(ext.filetype)
</code></pre>
<p>It did not work because you return <code>None</code> within <code>pdf()</code> and <code>txt()</c... |
"No Content-Security-Policy meta tag found" <p>First question here. I can't find a similar question for Nativescript (though I have found one for Ionic and Cordova).</p>
<p>I am getting this message when connected to an Android 6 device via livesync:</p>
<p>"No Content-Security-Policy meta tag found. Please add one w... | <p>So after running:</p>
<p><code>tns build android</code></p>
<p>This message seem to go away. Not really sure how that would make a difference, but hopefully that will help someone.</p>
|
Configure maintenance_template_path for 'capistrano-maintenace' gem <p>In the <code>capistrano/maintenance</code> gem, I'm having trouble setting the path for the <code>:maintenance_template_path</code> variable.</p>
<p>I've tried</p>
<pre><code># Set the maintenance file path
set :maintenance_template_path, '/views/... | <p>It requires an absolute path. Assuming you are using <code>config/deploy.rb</code>, then you could do this:</p>
<pre><code>set :maintenance_template_path,
File.expand_path("../../app/views/errors/maintenance.erb.html", __FILE__)
</code></pre>
|
Program hangs only on first run? <p>I'm trying to debug a low-level C program in gdb. The program in question is meant to act as a wrapper, launching another process and monitoring/interfering with its memory use.</p>
<p>When I load the program in gdb, everything seems normal (if not ideal) at first. I see the new pro... | <p>I found the cause, though I still don't understand why gdb acts this way. But I'll post it here in case it's useful to others.</p>
<p>I launched gdb:</p>
<blockquote>
<p>gdb --args ./mywrapper testers_exe/tester-2</p>
</blockquote>
<p>When run for the first time:</p>
<blockquote>
<p>/home/<em>username</em>/m... |
Is it possible to change npm user? <p>Editing profile is easy and intuitive but there seem to be username change feature missing. I am trying to find a way to change my npm username from npmjs.com.</p>
<p>The only thing I come up with so far is to register new user, add it to all packages and make it an owner of them.... | <p>I'd suggest to contact <a href="https://www.npmjs.com/support" rel="nofollow">npm support</a> for this. AFAIK there is no publicly available, official way to change your registered user name.</p>
<p>From my experience, they are very helpful and nice :-)</p>
|
How to make Q lookups in django look for multiple values <p>Currently I have a very simple search option which goes through my pages and looks up through several fields for requested query. If I input a single word in it it works just fine, however if I input multiple words in search query, I get nothing, even if a sin... | <p>You're asking for something like the following, where you filter by each individual word in the query:</p>
<pre><code>import operator
queryset = Page.objects.all().filter(archived=False).order_by("title")
query = request.GET.get("q")
if query:
words = query.split()
fields = ["title__icontains", "content__... |
Install cordova on mac osx el capitan <p>Is there anyway to install cordova on OSX El Capitan?
I run into all kinds of issues here, not able to install it.
Like a warn for mini match being a lower version then 2.0.3
But the version was the latest. I tried downgrading.
I tried to ask a question <a href="https://issues... | <p>This is what I got working so far, however with Warnings and not the latest versions.</p>
<p>OSX El capitan</p>
<p>Netbeans 8.1</p>
<p>Node.js and npm = V4.6.0 LTS</p>
<p>Xcode 8.0</p>
<p>Cordova 6.3.1</p>
<p>CLI:
sudo npm install -g cordova
Here i got warning about the version of mini match
sudo cordova creat... |
Excel VBA to filter Pivot Table and Pivot Chart for previous day - Pivot Filter Field <p>I've searched everywhere on google (and here) and have tried various combinations of code from all kinds of sources, including this site, Excelguru, excelexperts, ozgrid, dedicatedexcel, excelcampus, spreadsheetguru, etc..... so on... | <p>check this out.</p>
<pre><code>Dim prev_date As String
prev_date = Month(Date - 1) & "/" & Day(Date - 1) & "/" & Year(Date - 1)
Thisworkbook.Sheets("Sheet1").Activate
'change this line with your sheet where pivot table is present. Change Sheet name.
ActiveSheet.PivotTables("PivotTable1").RefreshTa... |
Is it possible to redirect specific messages to a recipient in Postfix? <p>Currently I have plenty of emails in my postfix "hold" queue. These are all emails returned when sending newsletters. (Messages due to mailbox full, invalid email, and so on).</p>
<p>The problem is that these email came back based on different ... | <p>I'm handling your problem differently. I'm parsing mail.log daily via bash script, getting permanent and temporary failures from it, then I unsubscribe them from newsletters depending on my policy. </p>
|
Playing music on loop until a key is released. Python <p>I'm making a little GUI with python, using cocos2d and pyglet modules. The GUI should play a sound while the "h" is pressed and stop when it is released. The problem here is that I can't find a solution to this. After searching this site I've found this question ... | <p>Nevermind, I have figured this out, all I had to do was move the line <code>player.queue(loop)</code> from the initialization function to the function that handles keypresses. The updated code looks like this: </p>
<pre><code>class Heartbeat (cocos.layer.Layer):
is_event_handler=True
def __init__ (self):
... |
Cannot connect Bluetooth via Multipeer Connectivity <p>Swift 3.0</p>
<p>I can share data from iPhone to iPhone over Wifi using Multipeer Connectivity but not over Bluetooth, and it looks to me that the Wifi is unstable. <br/>The Wifi will connect half of the time and the Bluetooth will see the peers but will not conn... | <p>The bluetooth issue is in the testing of the Bluetooth connection not the code.
I have found that in Swift 3.0 (which I am running) you cannot turn off Wifi and do the test you have to go into the Setting> Wi-Fi then choose the Wi-Fi/Network your connected to. Then select Forget This Network.</p>
<p>Even though y... |
On a Mac can Mono be used to build with winsock2.h? <p>Want to practice with some Microsoft specific tools; specifically winsock2.h. I know Mono can be used to make C# programs, but before doing the install I hope to find out if it does more than that.</p>
| <p>For APIs like <code>winsock2.h</code>, you're talking about the direct win32 API and related libraries.</p>
<p><code>Mono</code>/<code>C#</code> provides higher-level networking APIs via the language run-time which removes the need to use these low-level, platform specific APIs.</p>
<p>As a result, you can't use <... |
Handling commas in cells when creating a csv from two dimensional array in Javascript <p>Let's say i have the the following:</p>
<pre><code>var csv = [['name', 'comment'], ['foo', 'hello world, bar']];
</code></pre>
<p>When I try creating a csv string and opening that csv string in Excel, it becomes something like th... | <p>In Excel you can select which delmitiers you want to use.<br/>
Just use a semicolon or any other char that you dont use inside your text.</p>
|
Convert VBA to Google App Script <p>I have this VBA macro code in Excel and I need convert it to a Google Apps Script for Google Sheets.</p>
<p>How would I do that?</p>
<pre class="lang-vba prettyprint-override"><code>Function dOne(UnderlyingPrice, ExercisePrice, Time, Interest, Volatility, Dividend)
dOne = (Log(Unde... | <p>All you need to do is search for some documentation on JavaScript.</p>
<pre><code>function dOne(UnderlyingPrice, ExercisePrice, Time, Interest, Volatility, Dividend) {
var dOne;
dOne = (Math.log(UnderlyingPrice / ExercisePrice) + (Interest - Dividend + 0.5 * Math.pow(Volatility, 2) * Time) / (Volatility * (Math... |
python, multthreading, safe to use pandas "to_csv" on common file? <p>I've got some code that works pretty nicely. It's a while-loop that goes through a list of dates, finds files on my HDD that corresponds to those dates, does some calculations with those files, and then outputs to a "results.csv" file using the comm... | <p>Writing the file in multiple threads is not safe. But you can create a <a href="https://docs.python.org/3.6/library/threading.html#threading.Lock" rel="nofollow">lock</a> to protect that one operation while letting the rest run in parallel. Your <code>to_csv</code> isn't shown, but you could create the lock</p>
<pr... |
Log.wtf vs. Unhandled Exception <p>I just learned about <a href="https://developer.android.com/reference/android/util/Log.html#wtf(java.lang.String,%20java.lang.String,%20java.lang.Throwable)" rel="nofollow"><code>Log.wtf</code></a> ("What a Terrible Failure" lol) and I'm wondering when I should use it.</p>
<ol>
<li>W... | <p><strike>What <code>Log.wtf</code> does is write the exception and its stack trace in the log, and only that. It neither catches nor throws exceptions. So</p>
<ol>
<li><p>The difference is the exception is logged or not. The exception remains unhandled.</p></li>
<li><p>It doesn't affect crash reports.</p></li>
<li><... |
How to post only text to wall Facebook SDK? <p>I tried</p>
<pre><code>compile 'com.facebook.android:facebook-android-sdk:4.15.0'
</code></pre>
<p>this</p>
<pre><code>ShareLinkContent linkContent = new ShareLinkContent.Builder()
.setContentTitle("Hello Facebook")
.setContentDescription... | <p>Facebook share doesn't support text. You can only share link and that will show the text from that page with your link in Facebook.</p>
<p>also Facebook Policy for user message says to avoid pre-fill the user message parameter with any content the user didn't enter themselves, even if they can edit or delete that ... |
How to install Node.js on Windows 10? <p>I tried to install Node.js on the Windows 10 64 bit using installer.</p>
<p>When I run installe.exe I accept rules and push next button, in any case I get the following notification:
<a href="http://i.stack.imgur.com/WICfH.png" rel="nofollow"><img src="http://i.stack.imgur.com/... | <p><strong>@Babaev</strong> <em>From what you said, I guess its a problem related to path issue or rather the .msi file may have been corrupted on download. Try the windows binary that is .exe file from <a href="https://nodejs.org/en/download/" rel="nofollow">https://nodejs.org/en/download/</a> let's say we have the n... |
Split an object properties in two columns <p>I wanna split an object properties in two columns, when I was using bootstrap I was able to do it with the clearfix class like so:</p>
<pre><code><div class="clearfix" ng-if="$index % 12 == 0"></div>
</code></pre>
<p>But now I am using angular material and I wa... | <p>following will do what you want</p>
<pre><code><div layout="row" layout-wrap>
<span flex=50 ng-repeat="(key,value) in obj">
{{key}} : {{value}}
</span>
</div>
</code></pre>
<p>Always add <code>flex</code> to children of <code>layout</code>. Getting used to the layout rules/config ta... |
ScalaTest - How to verify a collection contains a sub class <p>With ScalaTest, it's straightforward enough to test that an object is of a particular class with something like:</p>
<pre><code>myPet shouldBe a [Dog]
</code></pre>
<p>But what I would like to do is verify that a collection of some base type has at least ... | <p><code>atLeast(1, myPets) shouldBe a [Cat]</code> should work, I believe (can't test at the moment, based just on an example from <a href="http://www.scalatest.org/user_guide/using_matchers#inspectorShorthands" rel="nofollow">http://www.scalatest.org/user_guide/using_matchers#inspectorShorthands</a>).</p>
|
Loopback relational model query <p>We have data model in loopback where the Customers will have a hasMany relation to Orders, and when i query customers the orders will come in an array for that particular customer and if i want to use existing options given by loopback what is the option i need to use to query to get ... | <p>If I understand correctly, you mean something like that
<code>Customers.find({where: {orderId = 1}}, function (err, cb)</code> ??</p>
<p>if you want to use the And/OR condition, here is an example:</p>
<pre><code>Post.find({where: {and: [{title: 'My Post'}, {content: 'Hello'}]}},
function (err, posts) {... |
issue with Div flip overlapping issue <p>I have two different div flip options. But each one is overlapping to another one. how to resolve it.</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 prettyprin... | <p>The lower vflipper1 flip is overlapping the top one due to the fact that you positioned the original elements relatively and then positioned the flipped versions absolutely within those. So, since the height of the first unflipped divs are smaller than the flipped versions they will show as overlapped since the flip... |
common lisp, how to mask keyboard input <p>This is a console program in Common Lisp for a Hangman type game. The first player enters a string to be guessed by the second player. My input function is below --- unfortunately the characters typed by the first player remain visible.</p>
<p>With JavaScript it's simple, jus... | <p>Each implementation supports this differently.</p>
<p>You might want to use an auxiliary library like <a href="https://github.com/marsijanin/iolib.termios" rel="nofollow">iolib.termios</a> or <a href="https://github.com/HiTECNOLOGYs/cl-charms" rel="nofollow">cl-charms</a> (interface to libcurses) if you want a port... |
Nesting classes as object and get results <p>I'm a beginner on OOP but i cant any related answer maybe im not searching the right way, am looking to do the following </p>
<pre><code>$country->city()->get_citizens ();
</code></pre>
<p>The basic idea is based on how laravel is doing its queries like </p>
<pre><c... | <p><code>$query->select()</code> is a function that returns an instance of a object that has the <code>from()</code> method</p>
<p>Example: works.</p>
<pre><code>class query {
private $thing;
public function __construct() {
$this->thing = new thing();
}
public function select() {
return $this-&g... |
Local variable referenced before assignment in if statement <p>This is the code that I am working on right now: </p>
<pre><code>def getWinner(userChoice, computerChoice):
if userChoice == "rock" and computerChoice == "scissors":
winner = userChoice
elif userChoice == "paper" and computerChoice == "rock... | <p>You just need to declare <code>winner</code> at the beginning of the function. You don't need global variable here. You also need to specify what should be the result if the <code>userChoice</code> or <code>computerChoice</code> have none of the expected values. You should return an error probably.</p>
<pre><code>d... |
Spring session with Oracle Coherence <p>We have a large-scale monolithic application which we are planing to decompose into microservices. The application runs on WebLogic and we wanted to use oracle-coherence with spring-session. However I could not find a srping-session-coherence project on github.</p>
<p>Is oracle... | <p>Spring Session does not provide first-class support for Oracle Coherence and, to my knowledge, there are no 3rd party extensions that offer such capability ATM.</p>
<p>You can however use Spring Session and its base session management support infrastructure using <a href="http://docs.spring.io/spring-session/docs/1... |
How not count blank spaces in StringTokenizer <p>I have this line</p>
<pre><code>StringTokenizer tk=new StringTokenizer (b=10," =",true);
</code></pre>
<p>my output is</p>
<pre><code>b
=
10
</code></pre>
<p>and this perfect but again if my line is this</p>
<pre><code>StringTokenizer tk=new StringTokenizer (DEFI b=... | <p>If you can, I suggest using String.split() method:</p>
<pre><code>String[] tokens = "DEFI b=10".split("(\\s|(?=\\=)|(?<=\\=))");
</code></pre>
|
How populate grid on EJS(Embedded JavaScript templates) with Express and Nodejs connected to MySql <p>I have Express with Nodejs connected to a MySql db
and I can populate a list on my ejs page but I am searching for an example where I can load a grid like slickgrid,datatable etc either passing rows or json</p>
<p>Tha... | <p>This should work for what you're looking for, although it would probably be better to set it up in the front end and manage it with javascript.</p>
<pre><code><table>
<% if(items.length){
for(var i = 0;i < items.length;i++) { %>
<tr>
<% for (var j in items[i]) { %>
... |
C free memory from struct array <p>The assignment is to create a struct array with 10 elements as "students" and each have a score and an ID. There are some things I am not allowed to change in the code (like anything in main).</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
struct student* allocat... | <p>You <code>(m)allocated</code> the 10-students array as 1 contiguous block of memory with 1 <code>malloc</code> call (this is correct).</p>
<p>To free this you only use <code>free</code> once on the first array element. This frees the whole contiguous block of memory which is the whole 10-students array.</p>
|
Why is octave parsing this string to give two numbers to a single value? <p>In the octave session below, why is a simple <code>strread</code> operation displaying two numbers for A and B (instead of just one)?</p>
<pre><code>octave:43> mystring = '18.0 8 307.0 130.0 3504. 12.0 70 1 "foo bar ba... | <p>Since you didn't specify how many times to repeat the provided format, it is reading until it hits the end of your string. The <code>%*f</code> consumes <code>"foo</code>, the first <code>%f</code> consumes <code>bar</code> and the <code>%d</code> consumes <code>baz"</code>. Since neither of those can be properly pr... |
How to select some columns of a stored procedure in Mysql <p>I have a stored procedure like this:</p>
<pre><code>CREATE PROCEDURE `RankAll`()
LANGUAGE SQL
NOT DETERMINISTIC
READS SQL DATA
SQL SECURITY INVOKER
COMMENT ''
BEGIN
select userID,sum(score) as score,@rank := @rank + 1 AS rank from
(
select u... | <p>Just use:</p>
<pre><code>call RankAll()
</code></pre>
<p>The call returs the result set as if you would run the same SQL query.</p>
|
Need jquery to wait on ajax but async : false isn't working <p>I have a view that opens on button click to display db results. I want to disable the button while the results are returned, then enable it once the section is filled. However, it disables then enables the button before the view gets filled out and people k... | <p>You should move the
<code>$("#ViewComments").prop("disabled", false); // re-enable View Comments button</code> into the success and error callbacks. Otherwise, the button just gets re-enabled as soon as the AJAX request is initiated, not when it completes. Here us my update to your code:</p>
<p><div class="snippet... |
API does not get any post data from ajax call <p>I am trying to send data in ajax post call. but this doesnot sent any data.</p>
<p>My html form is</p>
<pre><code><form>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label for="firstname">Firstnam... | <p>When you send data with <code>$.ajax</code>, it's not sent as JSON, it's sent in <code>application/x-www-form-urlencode</code> format. So there's no need to call <code>json_decode()</code>. Just use:</p>
<pre><code>echo $_POST['email'];
</code></pre>
|
IOS view updates to default IB layout whenever an action is fired <p>I have a project that has most of its layout logic in the IB. Some of the positioning I want to update dynamically so I put it in the viewDidAppear:</p>
<pre><code>- (void)viewDidAppear:(BOOL)animated{
// Fill array of button tools
buttonArray = [[N... | <p>You'll need to update the constraints, not the actual frames of your objects. So if you add your button frame y constraints as an <code>IBOutlet</code> you can edit it easily. </p>
<p>Here is a really cool tool to play with autolayout constraints:
<a href="https://autolayoutconstraints.com/" rel="nofollow">https://... |
Newtonsoft Json.NET Deserialize Setting Only Values in Json String <p><strong>Is it possible to have only values found in a Json string be assigned by the Newtonsoft Json.NET deserializer even if they are default and null values being assigned?</strong></p>
<p>Using the example below, I'm attempting to find values tha... | <p>You may make use of ShouldSerialize methods, e.g.</p>
<pre><code>bool ShouldSerializeName() {
return _values.ContainsKey("Name");
}
bool ShouldSerializeValue() {
return _values.ContainsKey("Value");
}
</code></pre>
<p>Not pretty but it should work. Another option is a custom serializer.</p>
|
Chef DataBag values not being used on chef run <p>Have a simple DataBag similar to:</p>
<pre><code>{
"dsa-key": {
"app-key": "xxxxxxxx"
},
"region": {
"dev": {
"app-db": {
"user":"xxxxx",
"pass":"xxxxx"
},
"app-test-u... | <p>Your wording is very vague but I'm guessing the issue is your search query for the vault is incorrect. I discourage use of that feature in the first place due to security concerns, but you can either add the node you are missing via <code>-A</code> or fix your search query. Use <code>knife search</code> to make sure... |
loadHTML & loadHTMLFile, which one is faster? <p>Between these two, which one is faster? Getting content directly by <code>loadHTMLFile</code> or first by <code>cURL</code> and then pass to <code>loadHTML</code>
<br /></p>
<pre><code>$doc = new DOMDocument();
@$doc->loadHTMLFile($url);
</code></pre>
<p>Or
<br /></... | <p>Add as the last line of your script and try each method at least 3 times to get an accurate idea of which is fastest.</p>
<pre><code>Page generated in
<?php echo round((microtime(TRUE)-$_SERVER['REQUEST_TIME_FLOAT']), 4); ?>
seconds on <?php echo date("M jS Y"); ?>
</code></pre>
|
How do i optimize android application? <p>I am making a android application not using complicated task but using ui controlling.
But, i saw the log of the android monitor of android studio.
It says something '41 frames below, warning blah blah...'</p>
<p>I want to extract the code from main thread(ui thread) to anothe... | <blockquote>
<p>why people use this ?</p>
</blockquote>
<p>it is used when lets assume you have a background task running and you want to update the layout then you call <code>runonuithread</code> method, since we can only update the layout on Main thread so we use this method.</p>
<p>That is only one use I told to... |
Password Checker in java with do while <p>I need to write a password checker which ensures that password correct.</p>
<p>Firstly I prompt the user enter the password</p>
<p>Secondly, I prompt the user to reenter the password</p>
<p>thirdly, I need to check that the passwords are identical</p>
<p>But this steps need... | <p>You can use below code which fulfills your requirement. There might be syntax errors as I didn't use the eclipse.</p>
<pre><code>import java.util.*;
public class Lab4Exercise1{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
double password, reentered;
do {
... |
64-bit app calling 32-bit Windows service - VS 2013 debug <p>64-bit C# app calls into a 32-bit C# Windows service. We can step through the 32-bit code after attaching to the service, but we cannot see the value of any variables. We need the 32-bit service to access legacy 32-bit dlls.</p>
| <p><a href="https://blogs.msdn.microsoft.com/visualstudioalm/2013/10/16/switching-to-managed-compatibility-mode-in-visual-studio-2013/" rel="nofollow">https://blogs.msdn.microsoft.com/visualstudioalm/2013/10/16/switching-to-managed-compatibility-mode-in-visual-studio-2013/</a></p>
<p>Explains the fix nicely, though th... |
(React) Axios is sending a GET request instead of a post <p>I'm just starting out with react and I'm trying to make a login model, I have this function firing when the login button is clicked:</p>
<pre><code>login() {
console.log("Hello. It's Me")
axios.post('https://crossorigin.me/http://requestb.in/w21igbw2'... | <p>Nevermind, I checked the network tab nad it was sending a post, not sure why request bin thought it was a get but its working properly</p>
|
Eclipse 4.6.1 JGit/EGit lo longer authenticating after upgrade <p>On Windows 10 Pro 64-bit Anniversary Edition I had a fresh Eclipse 4.6 installed from the Zip file (not from the installer). The upgrade functionality said that 4.6.1 was available and it upgraded. Now when I try to access a Git remote repository (using ... | <p>Sounds like you are running into a <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=501000" rel="nofollow">recently discovered bug</a> in Neon.1 (aka 4.6.1). The discussion in that bug gets pretty technical and in the weeds, but several options are being discussed to remedy the problem (see <a href="https://de... |
bootstrap tab inside sharepoint visual part <p>I have created a SharePoint visual web part which contains bootstrap tabs.
Everything is working fine,however when I select a tab, the content is displayed but the tab isn't set to active unless I double click on the tab item.
Any Ideas?</p>
<p>Thx,</p>
| <p>I forgot to mention that I was using Angularjs.
However, to make it work I had to use Angular ui Bootstrap.</p>
|
How to do autocomplete like IDE for my custom language on web? <p>I am try to make IDE on web ... My classes and it's fileds store in xml file ... I am using codemirror editor ...
My question is : </p>
<p>I need to algorithm similar to one follow in IDE like (eclipse / visual studio) for autocomplete... in my languag... | <p>Well at a very basic level you just need to bind a key stroke event listener that looks up the current word being typed in the xml file to see if there are any matching options. Then take all the matching items and display them in a ul or something that will float next to the cursor.</p>
<p>If you want fast perform... |
Distribution Transaction Completed - Error - SQL Server 2005 <p>Trying to execute a stored procedure to update a certain data warehouse, however when I execute the stored procedure I get an error message stating: </p>
<blockquote>
<p>error Msg 8525, Level 16, State 1, Line 1 Distributed transaction
completed. Eith... | <p>Found out it was a deadlock - rebooted the server and issue was resolved.</p>
|
SUM values from table 1 with ENUM condition from table 2 <p>I have this query</p>
<pre><code>$my_taxes = mysql_fetch_array(mysql_query("SELECT SUM(FEE) FROM clients WHERE EMAIL = '$EMAIL'"));
</code></pre>
<p>Also, I have a secondary table called payments with a column (PAID) with 2 ENUM options (pending and ready)</... | <p>Try query</p>
<pre><code>SELECT SUM(FEE) FROM clients
INNER JOIN payments ON payments.ID = clients.SID AND PAID = 'pending'
WHERE clients.EMAIL = '$EMAIL'
</code></pre>
|
OpenCV Makefile Error <p>I am new to OpenCV. I was trying to run the code in the link below on Ubuntu.</p>
<p><a href="https://bitbucket.org/kschluff/particle_tracker" rel="nofollow">Particle Tracker</a></p>
<p>I did as they said in the README file but I could not get it work.</p>
<p>I get the errors in the link bel... | <p>As requested, here is the makefile that worked on my system. Remember that you have to configure your build environment to find the shared libraries (e.g., either through ldconfig or LD_LIBRARY_PATH).</p>
<pre><code>CFLAGS = -O2 -Wall
LIBS = -lopencv_core -lopencv_imgproc -lopencv_highgui
SRCS = main.cpp condens.c... |
Swift 3 - SQLite wrapper <p>I'm new to swift and mobile and I'm starting an app in which I will use SQLite and I was looking for a wrapper, I really liked <a href="https://github.com/stephencelis/SQLite.swift" rel="nofollow">this one</a> but it seems not to be compatible with swift 3.</p>
<p>I'm looking for swift 3 co... | <p>To use <code>SQLite</code> with <code>Swift 3.0</code> add the the following to your <code>podfile</code>:</p>
<pre><code>pod 'SQLite.swift', :git => 'https://github.com/stephencelis/SQLite.swift.git',
:branch => 'swift3-mariotaku'
</code></pre>
|
How to change Jquery terminal cursor shape? I want it to be '|' not a block <p>How to change Jquery Terminal cursor shape ?
I have tried messing with the CSS described here
<a href="http://terminal.jcubic.pl/css/jquery.terminal.css" rel="nofollow">http://terminal.jcubic.pl/css/jquery.terminal.css</a>
But I could only ... | <p>You can use border-left to simulate bar cursor like this:</p>
<pre><code>.terminal .inverted, .cmd .inverted, .cmd .cursor.blink {
color: #aaa;
border-left: 1px solid #aaa;
background-color: black;
margin-left: -1px;
}
@keyframes terminal-blink {
0%, 100% {
border-left-color: #aaa;
}
50% {
... |
How to convert "timestamp_usec"? <p>How can I convert a "timestamp_usec" number, such as 1364774098689591 to an actual date/time?</p>
<p>I downloaded my <a href="https://support.google.com/accounts/answer/3024190?hl=en" rel="nofollow">entire Google Search history</a>. With each archived internet search (JSON File), Go... | <p>It's not a "different format". It's just a conventional unix timestamp in microseconds, which means you can use the TRIVIAL conversion:</p>
<pre><code>var d = new Date(1364774098689591 / 1000);
</code></pre>
<p>to load it up. JS <code>Date()</code> expects milliseconds (among other formats), and <code>microseconds... |
Depth Profiling visualization <p>I'm trying to create a depth profile graph with the variables depth, distance and temperature. The data collected is from 9 different points with known distances between them (distance 5m apart, 9 stations, 9 different sets of data). The temperature readings are according to these 9 sta... | <p><strong>[ REVISION ]</strong><br>
(Please comment me if you know more suitable interpolation methods, especially not needing to cut under bottoms data.)</p>
<p><code>ggplot()</code> needs long data form.</p>
<pre><code>library(ggplot2)
# example data
max.depths <- c(1.1, 4, 4.7, 7.7, 8.2, 7.8, 10.7, 12.1, 14.3... |
Looking for a more concise way to prefix match on multiple terms <p>I'm looking for a better way. </p>
<p>I have an arbitrary number of input terms (let's say they are last names) from the user. I want to perform a prefix search on each one and boost score for any matches. </p>
<p>The not-analyzed <a href="https://ww... | <p>I think the Edge NGram <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-edgengram-tokenizer.html" rel="nofollow">tokenizer</a> / <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-edgengram-tokenfilter.html" rel="nofollow">filter</a> will help.</p>
<p>... |
Set string in 'A' python script from 'B' python script <p>I have two scripts: </p>
<p>A.py (is TK window)</p>
<pre><code>def function():
string = StringVar()
string.set("Hello I'm A.py")
</code></pre>
<p>From B.py I wish change string that appear in Tk window.</p>
<pre><code>def changestring():
string.s... | <p>Variables have scopes. You cannot access variables which are in the scope of one function from another function.</p>
<p>There has to be some common point in the code which "knows" about A and about B. That code should pass the variables from one to the other.</p>
<p>Based on this comment:</p>
<blockquote>
<p>A.... |
Python dict key with max value <p>I have a dictionary with IP addresses and their free memory space.
I'm trying to save an IP to one variable and the next highest one to another variable. </p>
<pre><code>masterdict: {'192.168.100.102': '1620', '192.168.100.103': '470', '192.168.100.101': '1615'}
print masterdict
rm... | <p>The values in your dictionary are strings so <code>max</code> is comparing them as strings. If you want to compare them as integers, then you need to use the key function to convert the strings to integers...:</p>
<pre><code>rmip = max(masterdict, key=lambda key: int(masterdict[key])
</code></pre>
<p>Or change th... |
WooCommerce Place Order button not working <p>When clicking the âPlace Orderâ button, the user is scrolled to the top of the page but no errors are given and WooCommerce doesn't record a sale. Further, no JS errors are shown in the console. I've unchecked âForce SSLâ in WooCommerce settings. I've tried everythi... | <p>This could be a theme or plug-in conflict. In the first instance, check your theme for WooCommerce compatibility. If not sure, try with a different theme. If that works, you will either need to switch themes or contact the theme developer support. </p>
<p>If if is not a theme conflict, disable ALL plug-ins (other t... |
SUM using CASE WHEN SELECT <p>How can I re-write this query so that it doesn't trigger the following error:</p>
<p><em>"Cannot perform an aggregate function on an expression containing an aggregate or a subquery."</em></p>
<pre><code>SELECT
employees.loc_id
,SUM(CASE
WHEN
pos IN ... | <p>Without going into techniques to get around being able to SELECT inside an aggregate function. Let's step back and rethink your query all together. You are trying to solve it by aggregating the Lookup table but the aggregation is really on the Employee table with a join from the lookup table.</p>
<p>It also appea... |
Getting multiple socket response with every single socket.emit in socket.io <p>Here is my code sample, I am getting multiple socket response to the same user with single socket emit. Sometimes it is also increasing by +1 increment on every server restart.</p>
<pre><code>....
socket.emit('groupmessage', {
... | <blockquote>
<p>Its because your <code>socket.on(event, listener)</code> is executed multiple
times (for same event).</p>
</blockquote>
<p>Here's something which might be helpful.</p>
<p><strong>ABOUT:</strong> Response through a socket is received in a <strong>Listener</strong> attached to an <strong>Event</stro... |
Dealing with numeric (decimal) dates in R? <p>I have some numeric date data from Excel:</p>
<pre><code>> df <- data.frame(c(42613, 42612, 42614), c(42614.61, 42613.97, 42612.12))
> names(df) <- c("Closetime", "Opentime")
</code></pre>
<p>Both <code>Closetime</code> and <code>Opentime</code> are <code>nume... | <p>If you can use POSIXct, you can do for example</p>
<pre><code>df$Opentime <- as.POSIXct( df$Opentime*24*60*60,
origin="1900-01-01",
tz="UTC")
</code></pre>
<p>Reasoning: POSIXct is just number of seconds since origin</p>
|
basicHttpBinding with basic authentication send first request with no user/pass data <p>When using WCF basicHttpBinding with basic authentication, I notice that the first request after IIS reset is sent without user/pass data (without Authorization: Basic .... Header data)</p>
<p>Code:</p>
<pre><code>client.ClientCre... | <p>I found the solution and I thought I may share it with you, it may help.</p>
<p>The solution is here <a href="http://plainoldstan.blogspot.ca/2008/07/avoid-http-401-roundtrip-with-adding.html" rel="nofollow">http://plainoldstan.blogspot.ca/2008/07/avoid-http-401-roundtrip-with-adding.html</a> by Stanislav Dvoychenk... |
Django - filter model <p>I have a model with a field that is a list.
For example:</p>
<pre><code>mymodel.sessions = [session1, session2]
</code></pre>
<p>I need a query to get all <code>mymodels</code> that <code>session1</code> is exist their sessions.</p>
<p>The model`s field looks like that</p>
<pre><code>sessio... | <p>You can use reverse lookups that go back along the foreign key to query for values in the related model.</p>
<pre><code>MyModel.objects.filter(sessions__id=1)
</code></pre>
<p>That will filter all <code>MyModel</code>s that have a foreign key to a session with an <code>id</code> of 1.</p>
<p>For more information ... |
Sqoop function '--map-column-hive' being ignored <p>I am trying to import a file into hive as parquet and the --map-column-hive column_name=timestamp is being ignored. The column 'column_name' is originally of type datetime in sql and it converts it into bigint in parquet. I want to convert it to timestamp format thr... | <p>Before hive 1.2 version Timestmap support in ParquetSerde is not avabile. Only binary data type support is available in 1.1.0.</p>
<p>Please check the <a href="https://cwiki.apache.org/confluence/display/Hive/Parquet#Parquet-Hive1.1.0" rel="nofollow">link</a></p>
<p>Please upgrade your version to 1.2 and after ,it... |
passing parameter in has_many through association <p>I have a class <code>Test, Question, Testquestion</code> associated by <code>has_many through</code></p>
<pre><code>class Test
has_many :testquestions
has_many :questions, through: :testquestions
end
class Question
has_many :testquestions
has_many :tests, t... | <p>There's no way to do it that way, you will need to take a longer path.</p>
<ol>
<li>Don't forget to add <code>accepts_nested_attributes_for</code> to your assossiations, so that nested operations would actualy work. </li>
<li>Check that you have added <code>accepts_nested_attributes_for :question</code> to <code>Te... |
ObjectStore Bluemix connection java <p>I am tring to connect to the the Object Storage service in Bluemix. However, I keep getting an exception. Here is my code:</p>
<pre><code> public static void main(String[] args){
SwiftApi swiftApi;
String endpoint = "https://identity.open.softlayer.com/v2.0";
St... | <p>This blog will help you connect to Object Storage in Bluemix <a href="https://developer.ibm.com/recipes/tutorials/connecting-to-ibm-object-storage-for-bluemix-with-java/" rel="nofollow">https://developer.ibm.com/recipes/tutorials/connecting-to-ibm-object-storage-for-bluemix-with-java/</a></p>
<p>You can also access... |
Megaparsec, backtracking user state with StateT and ParsecT <p>Using Megaparsec 5.
Following <a href="https://mrkkrp.github.io/megaparsec/tutorials/switch-from-parsec-to-megaparsec.html" rel="nofollow">this guide</a>, I can achieve a back-tracking user-state by combining <code>StateT</code> and <code>ParsecT</code> (no... | <p>You could try sandwiching <code>ParserT</code> between two <code>State</code>s, like</p>
<pre><code>type MyParser a = StateT UserState (ParsecT Dec T.Text (State UsersState)) a
</code></pre>
<p>And write special-purpose <code>put</code> and <code>modify</code> operations that, after changing the outer state, copy ... |
Android - Cannot resolve symbol 'KmlLayer' <p>I am working on an app that uses Google Maps.
I want to load a polygon from a KML file.
To my understanding I should be using the KmlLayer class and a bunch of others, but I can't seem to find the dependency I have to add in order for it to happen. Help would be appreciated... | <p>this class is a part of this library
<a href="https://github.com/googlemaps/android-maps-utils" rel="nofollow">android-maps-utils</a></p>
<p>There is a demo project in github , that can help you </p>
|
Programmatically change slider value and update the Label <p>I have 3 sliders as show above:</p>
<p><a href="http://i.stack.imgur.com/5XZq6.png" rel="nofollow"><img src="http://i.stack.imgur.com/5XZq6.png" alt="Sliders"></a></p>
<p>And when the "Min tip" it's equal or greater than "Default tip", I add 1 to "Default t... | <p>After <code>defaultSlider.value = Float(valueMin+1)</code> update the text of the label, like so:</p>
<pre><code>defaultLabel.text = "Default tip: \(valueMin+1)%"
</code></pre>
|
Thread not printing out in correct order <p>I'm fairly new to threads in C. For this program I need to declare a thread which I pass in a for loop thats meant to print out the printfs from the thread.</p>
<p>I can't seem to get it to print in correct order. Here's my code:</p>
<pre><code>#include <stdio.h>
#inc... | <p>That's the classic example of understanding multi-threading.
The threads are running concurrently, scheduled by OS scheduler.
There is no such thing as "correct order" when we are talking about running in parallel. </p>
<p>Also, there is such thing as buffers flushing for stdout output. Means, when you "printf" som... |
Xamarin.Forms PCL & ServiceStack 4.5 <p>I have a Xamarin.Forms PCL project, profile 7. I'm trying to troubleshoot some errors coming up when I try to create a new instance of JsonServiceClient: </p>
<p><em>System.ArgumentException: PclExport.Instance needs to be initialized</em></p>
<p><em>System.TypeInitializationEx... | <p>The PCL abstracts it, that's correct. But you need to call the <code>IosPclExportClient.Configure()</code> in your <code>AppDelegate</code> or <code>Application.Main()</code> and <code>AndroidPclExportClient.Configure()</code> in your <code>MainActivity</code>, because they are initializing some platform specific ob... |
Error with 'Access-Control-Allow-Origin' <p>I have a webpage I made with angular 2 that is a form and at the end of it the form must be sent to my java server. But I'm unable to send, I get the error <code>Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is prese... | <p>I was finally able to solve my problem. The problem was in the communication between my page and my server. The CORS block is imposed by the browser and the server needs to send a header authorizing the access (the headers I put in the function in the question). What I was missing was the header in the <code>OPTION... |
Using a proxy to inject with a CDI Producer <p>I've tried to follow some of the suggestions I've found in previously posted questions, but I can't seem to get a complete solution. Using the following code:</p>
<pre><code>@Produces
@Dependent
@RestClientResourceConnector
public <T> RestClientProxy<T> getSt... | <p>Fortunately, the answer is pretty simple.</p>
<p>To solve your problem you should exclude your annotation members (<code>value</code> and <code>clientUrl</code>) from consideration when Weld compares two annotation instances. To achieve this use the <code>@Nonbinding</code> annotation.</p>
<pre><code>import javax.... |
How do I update my .RProfile on RStudio Server <p>I installed the free rstudio server on a digital ocean server. I got everything going, but I wanted to customize my .RProfile.</p>
<p>I ran:</p>
<pre><code>candidates <- c( Sys.getenv("R_PROFILE"),
file.path(Sys.getenv("R_HOME"), "etc", "Rprofile.s... | <p>That command finds an <em>existing</em> .Rprofile to edit. You probably want to create a <em>new</em> .Rprofile for your user account. This should do the job:</p>
<pre><code>file.edit("~/.Rprofile")
</code></pre>
|
concatenate next to string if string found <p>I'm trying to search through my strings then concatenate the string.</p>
<pre><code>string = ' <html><body><svg style="background: #40484b;" version="1.1" viewbox="0 0 400 150" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"&... | <p>For a string with multiple lines you should use triple single quotes or triple double quotes. And instead of "if" statement you better use a "for" loop.</p>
|
Incorrect grid in materializecss <p>I have
<a href="http://i.stack.imgur.com/213es.png" rel="nofollow">problem</a> with grid. Have holes between cards. How I can fix that?
Code of cards sample:</p>
<pre><code><div class="container">
<div class="col s12 m6 l4">
<div class="card hoverable ">
... | <p>You need ti make them not have a margin using CSS:</p>
<pre><code>div {
margin: 0;
}
</code></pre>
|
Sybase SQLAnywhere with NodeJS <p>I am trying to install Sybase SqlAnywhere using nodejs(v4.2.6).
But i keep getting the following error when I run this command:</p>
<pre><code>npm install sqlanywhere --save
</code></pre>
<p>I tried installing build.js, even then i keep getting this below error.
Please can anyone ad... | <p>It looks like you are running the 32-bit version of node on a 64-bit machine. The SQL Anywhere node.js driver comes with the 64-bit version of the Windows libraries, and node-gyp doesn't work well on Windows.</p>
<p>Can you upgrade to a 64-bit version of node?</p>
|
Jinja2 Specify Route REST Type <p>My question is can I specify the type of REST route in Jinja2, for example if I have the route:</p>
<pre><code>RedirectRoute('/<id>/somthing/<key>', myFile.Handler, name='name', strict_slash=True),
</code></pre>
<hr>
<pre><code>class Handler(JSONHandler):
def get(): ..... | <p>If I understand what you're asking, you have an endpoint which respond to the methods GET, POST, and DELETE and you want to know if you can make the HTML resulting from Jinja send a DELETE request your endpoint.</p>
<p>The short answer is no. DELETE must always be performed by JavaScript and AJAX. The only methods ... |
How to divide doubles in an array in java? <p>I have in array with some doubles in them. I want to divide them, for example with an array that contains 6.0, 3.0 and 2,0 the result should be 1 (6/3/2). I wrote the following code: </p>
<pre><code>System.out.print("How many numbers do you want to divide? ");
int division... | <p>Your code has three issues.</p>
<ol>
<li><p><code>resultDivision</code> is defined within the scope of the <code>for</code> loop, so it's not visible afterwards, when you print the result.</p></li>
<li><p>With #1 fixed, you'll get an <code>ArrayOutOfBounds</code> exception because the second <code>for</code> loop t... |
Excel If numbers end with '00' <p>Could you please help me write a IF formula so if a number end with '00' then output is A, else B. I wrote the following but it shows up as a #NAME?.</p>
<pre><code>=IF((RIGHT(J3,2))="00",A,B)
</code></pre>
<p>Thanks in advance.</p>
| <p>You need to put <code>""</code> around the A and B as they are text:</p>
<pre><code>=IF(RIGHT(J3,2)="00","A","B")
</code></pre>
|
How do I add an integer to an attribute using a form in rails? <p>I have a form that takes in an integer for a user attribute called <code>calories:</code> and I want the input integer to be added to the current value, not replace it. So my question is basically: how do I take the form input value and use it to increas... | <p>So presumably you have an @user object and a params[:calories] value(Your names may be different). In your update action you will do this: </p>
<pre><code>previous_calories = @user.calories
final_calories = previous_calories + params[:calories]
@user.update_attributes(calories: final_calories)
</code></pre>
<p>Tha... |
Google URL Shortener API - <p>New to APIs... I was looking to the documentation here (<a href="https://developers.google.com/url-shortener/v1/getting_started" rel="nofollow">https://developers.google.com/url-shortener/v1/getting_started</a>) and couldn't get the following command to work: </p>
<pre><code> curl https:... | <p>This is a correct example and you probably did something else wrong. The API is working correctly and shortening the URL with your provided example.</p>
<p>Are you sure that you did not finish executing the command at the first backslash (<code>\</code>), because if you do that it would return with the error what y... |
How to find element in XML Data Island using jquery? <p>How can I use jQuery to output an XML data island? Here is an example of my code:</p>
<pre><code><script id="XML" type="application/xml">
<designs>
<design id="17161" style="44DSW" image="/500.jpg"></design>
</designs>... | <p>You need to use <a href="https://api.jquery.com/jQuery.parseXML/" rel="nofollow"><code>jQuery.parseXML()</code></a> to parse string into XML document. Parsed xml is like HTML document and you can find your element in it. </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.