I am using this redisManager.redisClient.keys('*example*', function (err, keys) { }) But it only gives keys from only one of the redis cluster. How can I get keys from all cluster? 1 AnswersAnswers 1 You can't get keys for all nodes using a single command. You have to get keys for all nodes and merge them. Reference - https://github.com/antirez/redis/issues/1962 You can do something like. var redis = require('redis'); redisConfig = new Array( {"port": 1234, "host": "192.168.1.2"}, {"port": 5678, "host":...
Wednesday, August 31, 2016
What's the best practice to ensure atomic read of a database table using JDBC?
I have an java application reading from a database table for jobs to process, and I may have multiple instances of this application running on different servers as each job is independent. Once a job is picked up for processing, its status will be update to "running". What I want to make sure is the retrieval of to be processed jobs from each instance to be atomic, how can I achieve this using JDBC? 6 AnswersAnswers 1 One approach that would be completely generic*, though perhaps slightly inefficient, would be to use...
PHP / Mongo geoJSON Loop is not valid
I'm passing in some coordinates to mongo to do a geo search. It works fine if the coordinates don't intersect (for instance a figure eight). But when two lines intersect it gives the loop is not valid. Is there any way to find the intersection and split all these loops up? Note there could be many. EDIT: I added the sample query and error. Note that I understand why it's happening, I'm just wondering if there is some known way to split those loops up into separate polygon's (some algorithm or within Mongo). Query: db.items.find({...
Tuesday, August 30, 2016
Nokogiri XSLT transform using multiple source XML files
I want to translate XML using Nokogiri. I built an XSL and it all works fine. I ALSO tested it in Intellij. My data comes from two XML files. My problem occurs when I try to get Nokogiri to do the transform. I can't seem to find a way to get it to parse multiple source files. This is the code I am using from the documentation: require 'Nokogiri' doc1 = Nokogiri::XML(File.read('F:/transcoder/xslt_repo/core_xml.xml',)) xslt = Nokogiri::XSLT(File.read('F:/transcoder/xslt_repo/google.xsl')) puts xslt.transform(doc1) ...
How can I check transcluded form's validity in directive?
Rewriting this question for clarification How can I check transcluded form's validity in directive ? I would like to check myForm.$valid in link function of directive. I will inject different sort of forms into my directive or use my directive in different forms you can say Difficulty is that scope is isolated and non of following answer worked for me. Please find complete code here, https://plnkr.co/edit/K3IrE5KVehWXFM9JEMvE?p=preview I want to disable "Save" button when form is not valid. 4 AnswersAnswers 1 ...
Monday, August 29, 2016
Ipython notebook link to external notebook
I do not really know why, but I cannot link to files which are in a parent folder of the current working directory. I do start the notebook in the folder 04_documentation and would like to refer to a notebook in 02_calculations The folder structure is: Experiment #12345 01_data 02_calculations sma_fit.ipynb 03_plots 04_documentation current working directory The link looks like [Link to working example](../02_calculations/sma_fit.ipynb) If the file is in the same folder or a subfolder, everything works fine....
FPS drops in SpriteKit
I'm developing a simple game with Swift & SpriteKit, and I've noticed FPS drops from 60 to 58-59 (and back). There is a noticeable lag when the drop occurs — it looks like 1 or 2 frames are dropped. CPU load is about 20-25% and does not change a lot, memory usage is permanently about 8 MB. Screenshot: There are 6 object on screen: label, red object (Sprite), 2x green objects (Sprite), one box (Sprite) and "ground" (Rect shape...
Sunday, August 28, 2016
store info and pull out in array
I have a database with a row 'genre' this contains all types of genres for the movie seperated by a space like an example of this would be Animation Comedy Horror They are all different genres so they need to be pulled out of the database and put in an array based on their genres I originally began coding this: <? sql = "SELECT moviename,genre FROM movieHosting"; $query = mysql_query($sql); $row = mysql_fetch_object($query); ?> But I soon realized shortly after that every genre is going to be needed to be put...
Why can't my Core 1 library be seen in my ASP.NET Core 1.0 (MVC6) project?
I have a little class library (Core 1), separate so that other apps may also use it, and all those reasons. It has only POCO model classes and a DbContext derivative. Its project file looks as follows: { "version": "1.0.0-*", "dependencies": { "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0", "NETStandard.Library": "1.5.0-rc2-24027", "System.ComponentModel.Annotations": "4.1.0" }, "frameworks": { "netstandard1.5": { "imports": "dnxcore50" } } } ...
checkbox get disabled in ng-repeat of accordions
I have build a list of accordions, each accordion represent a group of items. I have used ng-repeat to iterate through group names,each group has a checkbox which indicate if it is chosen or not. The example works fine for single group of accordion, but the moment I am putting the accordion inside ng-repeat, the checkbox can't be selected at all. Here is the code, the main checkbox of each group title doesn't work apparently, I am try to figure out the reason for this. My main Question is: 1.How can I make the checkboxes...
Friday, August 26, 2016
Best practice for storing ASP.NET Core Authorization claims when authenticating users against Active Directory?
I am creating an enterprise intranet ASP.NET Core MVC application. I want my users to authenticate using Active Directory and I want user authorizations (claims) stored in ApplicationDbContext. I assume that I need to use Microsoft.AspNetCore.Identity and Microsoft.AspNetCore.Identity.EntityFrameworkCore to accomplish my goals. What is the best practice for storing ASP.NET Core Authorization claims when authenticating against Active Directory? The following code will give me access to the current windows user security...
Thursday, August 25, 2016
Mongoose text index on nested schema field
I have the following schema: const Schema = ({ metadata: { title: String, ... }, ... }); and I'm looking to create a a text index on metadata.title. I can create a text index successfully on any first level property, but I'm running into trouble with the nested title. I've tried the following code, to no avail. Is my syntax wrong? I've had no luck with docs... Schema.index({ 'metadata.title': 'text' }); Searching: Schema .find( { $text : { $search : req.params.query } }, { score : { $meta:...
CSS3 Animation Trigger with JQuery Click to Other Element
I have a reddit-like upvote/downvote situation going on in my Rails app and I'm trying to make a CSS3 animation so that when the user clicks any of the downvote links it triggers the animation. I'm using JQuery like this: <div class="animations"> <%= image_tag "ballerino.png", class: "fixed no-display", id: "to-animate", style: "margin-top: 80px; width: 40%" %> <script> $("#downvote").on('click',function() { $('#to-animate').removeClass('fixed'); $('#to-animate').removeClass('no-display');...
Wednesday, August 24, 2016
Unique popup window using window.open in an iframe
I have an iFrame with a window open(url,uniqueID,windowparams). The iFrame is located on a single page app and hosted in another server. Everytime I refresh or change the page then return to the IFrame page, then try to initiate the same window.open. Instead of refreshing the already opened window, it creates an instance of the same window. Upon checking the window.name of each popup, it returns the same uniqueID as its window name. If the url is set blank it behaves as expected. But when a url is set, it creates a new...
How to keep “new solution explorer views” after reload a project in Visual Studio 2015?
Every time I load my project I do organize my workspace into 3 "new solution explorer view". One Solution Explorer for the views folder, one for the models folder and the last one for the controllers folder. However when I close and reopen my project it is set back to the default workspace. Is possible to keep those created solution explorer views ? The Save workspace option don't work with multiples solutions explorers. 1 AnswersAnswers 1 Unfortunately, the short answer is "you can't". I have been attempting to...
Can't import LDAP query feed data
I've set up an LDAP query that successfully pulls all data from the field physicaldeliveryofficename from our Windows Active Directory: I also setup a View that uses the query to further refine the list, so I am confident that the query itself is working: The problem occurs when I try to use Feeds Importers to grab that data and add it to my Offices content type. Here are my settings: Basic settings Name: Offices Attach to...
hive auto increment after certain number
I have a to insert data into a target table where all columns should be populated from different source tables except the surrogate key column; which should be maximum value of the target table plus auto increment value starting 1. I can generate auto increment value by using row_number() function, but in the same query how should I get the max value of surrogate key from target table. Is there any concept in HIVE where I can select the max value of surrogate key and save it in a temporary variable? Or is there any other...
Rewriterule .htaccess in subfolder
I need to perform a rewrite in a subfolder using the .htaccess file. The current url has a form like: domain.com/subfolder/chapter.php?urlkey=name It needs to be rewritten to: domain.com/subfolder/chapter/name In the subfolder I have a .htaccess file with the following code: <IfModule mod_rewrite.c> Options -Indexes RewriteEngine On RewriteBase /subfolder/ RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^chapter/([a-z0-9]+)/?$ chapter.php?urlkey=$1...