FAQ Database Discussion Community


Catch specific exception vs general exception [closed]

c#,vb.net
One of my co-worker asked what exception would I get if you execute a query that has a wrong table name. I was not able to answer since I always catch exceptions like the code below, try { ExecuteQuery(); } catch(Exception ex) { //show an error message } so I...

in redis-py , is redis.StrictRedis.pipe thread safe?

python-3.x,redis,redis-py
short question. I'm using redis-py to set some keys on my redis server and I'm experiencing some weird behaviour. I suspect it has something to do with the StrictRedis.pipe. I have multiple threads pushing commands to the same pipe and after a while I run execute on this pipe and...

Replacing letters in Python given a specific condition

python
Original code: meds = [ "tuberculin Cap(s)", "tylenol Cap(s)", "tramadol 2 Cap(s)"] for i in meds: new_meds = i.replace(" Cap(s)", " 1 Cap(s)") print(new_meds) The output is: tuberculin 1 Cap(s) tylenol 1 Cap(s) tramadol 2 1 Cap(s) I'm trying to replace all the meds with just "Caps(s)" into "1 Cap(s)"...

artisan db:seed does not work and does not print an error

laravel,laravel-5,laravel-seeding
My seeder Class code is as follows: <?php use App\Category; use Illuminate\Database\Seeder; class CategoryTableSeeder extends Seeder { public function run() { DB::table('categories')->delete(); $cats = ['math', 'physics', 'calculus', 'eletronics', 'etc etc']; foreach ($cats as $cat) { Category::create(['category' => $cat]); } } } When I try to seed it using the following...

Grant Permission in Hive

hadoop,hive,metastore,hortonworks
I'm trying to set Grant Permissions on Hive 14.0 using Hortonworks Sandbox HDP2.2 as one-node-system. This questions goes similar to unanswered question from march: grant permissions in hive does not work on hdp2.2. I followed the configuration steps of the a Hive-Wiki. After log into hive shell (ssh with root)...

Is there some kind of limit to the amount of output Python 3.4 allows using the write() method at one time?

python,srt
I put trailing print() methods right next to my write() method lines at the end of my code to test why my output files were incomplete. But, the print() output is "all the stuff" I expect; while the write() output is off by a confusing amount (only 150 out of...

Doing a matrix multiplication in reverse

java,opengl,math,matrix,lwjgl
Follow-up for: Calculating world coordinates from camera coordinates I'm multiplying a 2D vector with a transformation matrix (OpenGL's model-view matrix) to get world coordinates from my camera coordinates. I do this calculation like this: private Vector2f toWorldCoordinates(Vector2f position) { glPushMatrix(); glScalef(this.zoom, this.zoom, 1); glTranslatef(this.position.x, this.position.y, 0); glRotatef(ROTATION, 0, 0,...

How to prevent multiple clicks triggering multiple animations

jquery,css,animation,jquery-animate
I was wondering how to prevent multiple clicks or that one event is triggered multiple time because of those multiple clicks. Let's say I have to animate an object. One button will trigger the animation, the other button will reset the animation. <div class="div"> Animate Me! </div> <div class="nav"> <div...

Rails, Redis and Sentinel

ruby-on-rails,redis,redis-sentinel,redis-rails
I have a Redis cluster of 4 nodes, 1 master and 3 slaves, monitored by Sentinel. Now in rails I need to connect to this cluster, reading from the nearest replica, and writing to the master, the same as I do with MongoDB. Using the redis-rails gem, how is it...

Ionic / Cordova : Upload image from phone's gallery

android,ios,cordova,ionic
I would like the user to be able to either take a picture or select an image from his phone's gallery. I successfully manage to take a picture and get the imageURI. I'm using Genymotion as emulator since i need to access to some functionalities such as camera. I know...

AngularUI Nested Routing Issue

angularjs,angular-ui-router,angular-ui
$stateProvider .state('dashboard', { url:'/dashboard', controller: 'MainCtrl', templateUrl: 'views/dashboard/main.html' }) .state('dashboard.exchange',{ templateUrl:'views/dashboard/exchange.html', controller: 'ExchangeCtrl', url:'/exchange/{exchangeId:[0-9]}', }) .state('dashboard.exchange.module',{ templateUrl:'views/dashboard/exchangeModule.html', controller: 'ExchangeModuleCtrl', url:'/module/{exchangeModuleHostName}', }) '/dashboard' correctly correctly routes to MainCtrl '/dashboard/exchange/1' correctly routes to...

isolation forest algorithm in python

python,r,algorithm,random-forest
I am trying to reproduce the algorithm described in the Isolation Forest paper in python. http://cs.nju.edu.cn/zhouzh/zhouzh.files/publication/icdm08b.pdf?q=isolation This is my current code: import numpy as np import sklearn as sk import matplotlib.pyplot as plt import pandas as pd from sklearn.decomposition import PCA def _h(i): return np.log(i) + 0.5772156649 def _c(n): if...

Perform bound javascript event handlers asychrounously

javascript,jquery
I bound two onchange events to my select box. var function = f1(e) { // Codes to run } var function = f2(e) { // Codes to run } $(document).ready(function() { var elmt = $("#select-box"); elmt.unbind("change"); elmt.bind("change", f1); elmt.bind("change", f2); }); I understand that upon onchange trigger my #select-box element,...

Angular directive default to checked

javascript,html,angularjs,checkbox,angularjs-directive
I have a directive (element) that I created for a "switch", that uses input[checkbox]. As long as the initial state of the checkbox is to be NOT checked, everything works fine. But if I want to set the initial state to checked (based on my controller value), then it's always...

SQL Comparing two dates after minipulation

mysql,sql
I have the following query. Its purpose is to find what time products were ordered, check they match the conditions for the current day and then provide a list. AND ( (NameType <> 'Salad' AND completeDate < DATE_FORMAT( NOW( ) , '%Y-%m-%d' ' 10:30:00' ) ) OR (NameType = 'Salad'...

Weird content behavior, doesn't fill its parent

html,css
I'm working on a one page website. I have a div called .INsobre and its parent wrapper .sobre The content I have in there are two columns, one floating left and another right but they are not filling up the .INsobre div. As you can see in this print, the...

Render partial to String in view helper

ruby-on-rails,ruby-on-rails-4,ruby-on-rails-4.2
How can I render a partial to a String in Ruby on Rails 4.2, since render_to_string is deprecated? Something like: rendered_string = render_to_string partial: 'forgotten_orders/soonest_manufacturing_date', locals: { forgotten_order: forgotten_order, soonest_manufacturing_date: soonest_manufacturing_date } ...

Cassandra - can't remove the nodes

java,cassandra,datastax
I've accidently added new nodes to the test cluster. I removed the nodes afterwards but they still appear when connecting to the cluster. The nodetool gossipinfo doesn't show them. The nodetool ring doesn't either but when connecting via the datastax Java client they do appear: LOG4J 2015-05-06 15:44:54.796 INFO :...

Convert TSQL XML field to multiple columns

xml,tsql
I have the following dataset: Index | xml A | <book><name>A book 1</name><book> B | <book><name>B book 1</name><book><book><name>B book 2</name><book> And have been working with this code: SELECT [Index], CAST([BookResults].query('data(/Book/Name)') AS VARCHAR(max)) AS BookName, FROM [BookCache] What I need in the end is this table: Index | BookName A |...

PayPal charged, but payment response is “INVALID”

paypal,response,paypal-ipn,payment,invalidate
several of the webshops from our customers provide a checkout via PayPal. Actually we have the problem, that when we're forcing a checkout, we get the answer, that something went wrong. But if we check the PayPal Account, then we see, that the charging still has taken place. Now we're...

Is it possible to use CORS or JSONP to access the OpenID Provider Configuration?

javascript,cors,pingfederate
I'm attempting to use a XHR/Ajax call to our PingFederate configuration (/.well-known/openid-configuration) but I'm getting a cross-domain error. Its imperative that JavaScript clients be able to call this URL since the entire OIDC flow is possible with a client side JavaScript application. Therefore, this endpoint needs to be accessible on...

preg_match with number PHP

php,regex,numbers,preg-match
When I use this : preg_match('/^[0-9]{1,10}(\.[0-9]{1,9})?$/', 0.0001); The return value is 1, and when I use this : preg_match('/^[0-9]{1,10}(\.[0-9]{1,9})?$/', 0.00001); The return value is 0. Somebody could say me why please ? Thanks !...

How do you save data into cookies with javascript?

javascript,cookies
so I wanted to create a HTML/Javascript project which could save little bits of data even after it was closed. I had considered web hosting it on a server, but I didn't think it was worth it. <script> var a = 1 </script> So, if I had a variable a...

Stored procedure unsure syntax

sql
I am trying to create a stored procedure that will determine if my customerid exists if it exists then my other parameter foundcustomer will be assigned to found otherwise not found. I am unsure how to assign found please help here is what i tried CREATE PROCEDURE procedure4 -- Add...

How to set relax controls on a LDAP context

java,ldap,jndi,openldap
I would like to set the relax control (as defined in https://tools.ietf.org/html/draft-zeilenga-ldap-relax-03) on a javax.naming.ldap.LdapContext, but I don't know how to construct the control correctly: LdapContext context = new InitialLdapContext(...); Control[] controls = { new BasicControl(/* What to put here? */) }; context.setRequestControls(controls); ...

I need some help in identifying button using CSS or Xpath from the HTML

python,css,xpath,selenium-webdriver,webdriver
I am automating our website using Webdriver with Python. I am having trouble identifying and clicking the Administration button. I was trying to switch to the iFrame and select the button. It wasn't finding the button. I have spoken to the Dev and the developer says it's not in an...

RabbitMQ into AWS Redshift using NodeJS

javascript,node.js,amazon-web-services,rabbitmq,amazon-redshift
I have a RabbitMQ consumer listening to a queue in RabbitMQ and receiving event data in NodeJS. I would like to have the consumer send each data event to AWS Redishit (possibly using their JavaScript SDK), but I cannot find any examples of how to do this, nor can I...

Character pointer access

c++,character
I wanted to access character pointer ith element. Below is the sample code string a_value = "abcd"; char *char_p=const_cast<char *>(a_value.c_str()); if(char_p[2] == 'b') //Is this safe to use across all platform? { //do soemthing } Thanks in advance...

TCP socket function recv() blocking program

python,sockets,tcp
I am writing a simple TCP server program. Everything is working properly, but the function recv() isn't. import socket import threading def connectionHandler(sock): data="#1111#Welcome on Server!" sock.sendall(data.encode('ascii')) username = sock.recv(1024) password = sock.recv(1024) print('{}, {}'.format(username, password)) conn.close() HOST = socket.gethostname() PORT = 8888 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)...

How to specify different feedback for different platforms if AC_CHECK_HEADER fails in autoconf/configure.ac?

linux,autotools,autoconf,m4
I have a check for a header file in configure.ac in the source root AC_CHECK_HEADER(log4c.h, [], [AC_MSG_ERROR([Couldn't find or include log4c.h])]) and I'd like to give different feedback on different platform to reflect different most straight forward ways of providing the header: on Debian it should error with the message...

C++ Endless Loop while recursing in a tree

c++,recursion
Working with the game "from SFML games development", I am optimizing collisions. All my entities are organized in a tree of SceneNode. To handle collisions, I go through all my scene nodes, check which are their collidable children and then check recursively all their children. I had messed up something...

Mysql variable count not increasing

mysql
I have the following MySQL query: SET @sum1 = 0; SELECT (@sum1 := @sum1 + 1),date_clicked FROM `documents_clicks_or_downloads` dclick JOIN `documents_repository` drep ON dclick.documentID = drep.ID WHERE accountID = 2304 ORDER BY dclick.ID ASC Here are the results I get: "(@sum1 := @sum1 + 1)" "date_clicked" "1" "2014-04-04" "2" "2014-04-04"...

JavaScript RegEx expression for interpolation to match “{0-99}”

javascript,regex
I wish to produce my own Interpolation method in an JSON object, like below: var exampleObj = { firstLabel: "Hello {0}, I like {1} & {2}", secondLabel: "Luke, I am your {0}", interpol : function (key, vals) { key = this[key]; return key.replace(/[0-9]/g, function myFunction(i){return vals[i];}); } }; console.log(exampleObj.interpol('firstLabel', ['World','Fish','Chips']));...

get data searching from radiobutton to combobox

java,swing,combobox,radio-button
I want to search an item, but I get troubled that radio button and combo box show nothing. If you want to get show combo box, radio button must get picked please. I confused what code that I must type for radio button. Can you help me? private void txtSearchKeyReleased(java.awt.event.KeyEvent...

Pattern matching with finite automata

c++,regex,algorithm,pattern-matching,finite-automata
Recently I was reading the famous Algorithm design book CLRS(Cormen, Leiserson, Rivest, Stain, 3-rd edition). And between the classical KMP and Rabin - Karp algorithm there is a part about string matching with finite automata. So the algorithm creates the automata according to the pattern and starts processing on the...

Filter Access 2010 Subreport by Criteria Not Used In Subreport

sql,ms-access,report,ms-access-2010,subreport
I have a subreport in Access 2010 that basically acts as an index/table of contents. The user can use a search form to filter projects by specific criteria. Only the matching reports should appear in the report and index. The report filters fine, but the Index doesn't. Some of the...

Writing zipped byte[] into file

java,nio,bytearrayoutputstream,zipoutputstream
I am trying to write a zipfile to a byte[] in memory, and then write that out to disk. The resulting zipfile is corrupt. This works: try (FileOutputStream fos = new FileOutputStream(Files.createTempFile("works", ".zip").toFile()); ZipOutputStream zos = new ZipOutputStream(fos)) { zos.putNextEntry(new ZipEntry("test.txt")); zos.write("hello world".getBytes()); zos.closeEntry(); } This is broken and creates...

iOS/Swift: Dynamically Resize a Toolbar

ios,swift
I'm trying to make an app with a toolbar that can be resized. Basically, the toolbar can alternate between being at the bottom of the view and being at the top. When a button is pressed, it switches from one to the other. The problem is that when it is...

struct storage size error not reported by GCC with optimization turned on

c,gcc,struct,compiler-optimization
In a file struct_test.c I write: static struct x x; and I compile with GCC (4.8.2, Ubuntu) gcc -c -O0 struct_test.c I get the understandable error: error: storage size of 'x' isn't known Then I recompile, this time with optimization turned on gcc -c -O struct_test.c and the file is...

WPF DataGrid different controls in the same column - incorrect binding

c#,wpf,xaml,datagrid
I am developing the application which performs checks on the list of items. Each item has the list of the checks that need to be performed on it. Each check can be one of 3 types: CheckBox, ComboBox, TextBox. I would like to have Datagrid with 2 columns (one for...

How to break a string, that was read using fgets(), using scanf(“%s”,..)

c,buffer,scanf,fgets
I am working on a program that takes a mathematical expression, transforms it to posfix notation and then solves it. First I am checking the expression to see if it is well formed ( Open brackets and parenthesis matches the closing ones ). To do the part of checking I...

why do we need to prevent Circular Object References

json.net,xmlserializer,datacontractserializer,serializer
I'm new to this. Can you please explain to me why the "Circular REference" is a bad thing, what's the bad result it may bring about?

Running async() from non async without waiting

c#,multithreading,asynchronous
In my code why does QueueTasks() not run asyncronusly to the main method? Is there a different way to call is so that it does? I want QueueTasks(thingsToProcess, cts.Token); to start the async method and then carry on executing code. When I google running async from non async everything suggests...

Calling WCF REST service using AngularJs giving error

jquery,.net,asp.net-mvc,angularjs,wcf
I am trying to call my WCF REST service(hosted in non PROD environment) from my local machine using AngularJS. But everytime i am getting SEC7119: XMLHttpRequest for http://XXX/XXX/Web/rest/GeDetails required CORS preflight. and SCRIPT7002: XMLHttpRequest: Network Error 0x80070005, Access is denied. Is there any way i can consume WCF REST service...

Missing assembly reference Microsoft.IdentityModel.Clients.ActiveDirectory

c#,xamarin,monodroid,azure-active-directory,assembly-references
I'm currently developing a Xamarin.Android application in VS2013. I want to implement Azure Active Directory in my app following this guide. Then I add Microsoft.IdentityModel.Clients.ActiveDirectory nuget package as described. Then I want to add an AuthenticationResult attribute, but then I got a missing assemble reference error. Even when I explicitely...

jQuery Show/Hide Not Functioning

javascript,jquery,html,css
I'm trying to show one Tweet at a time and have it cycle through. I have two types of pages, and on one page it works correctly, but the other they never show. Is there some sort of CSS precedence rule that could be overriding it? HTML: <div class="twitterFeed"> <p>Tweet...

Database connection phpmyadmin

php,mysql
I'm working for an e-commerce that has the db on phpmyadmin. In another website I'd like to connect to that database. I have password, username and db name, so I'm using this "connection string": <?php $nomehost = "localhost"; $nomeuser = "user"; $password = "pass"; // connection $conn=mysql_connect($nomehost,$nomeuser,$password); if (!$conn) exit...

PHP Database Filter

php,mysql
Im trying to have a simple select box that filters the database. I have successfully filled the database with all vallues on pageload, however I cant seem to get over the final hurdle of applying the filter. Also, once I have clicked the filter button, is it possible for the...

Random list element, multiple calls

javascript,jquery
I'm trying to randomise the background colour of ten containers. Using the current jQuery, the colour is randomised on load however the same colour is used for all of the containers. How would I alter the code to call separately for each instance of .box $(document).ready(function(){ var colors = ["#BF2642","#191B29","#366377"];...

How can I put Component into Module in Joomla! site?

joomla,module,components,joomla-extensions
I wonder if exists a way to put component into module without install plugin, neither component nor module. Thanks and my apologize for my bad English....

adding local .git via submodule failing

git
File structure: www |- project |- .git |- dist |- .git And the terminal: [email protected]:~/www/project$ git submodule add ../dist dist Cloning into 'dist'... conq: repository does not exist. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. Clone of...

Format string into Time from datatable C#

c#,datetime,time,datatable
I am creating a datatable from excel import and bulkcopying it to database, I need to put the Scheduled Start as start time into database as time hh:mm:ss but it keeps going into database as 30/12/1899 10:30:00, all I want is the 10:30:00 to go into database. How can I...

Select2 multiple initial pre-selected options

javascript,jquery,jquery-select2
I'm trying to get select2 working with multiple pre-selected options. I'm using it to let users choose several options then have them saved to then be able to come back and edit them. however I can't get the select2 initSelection to work correctly to populate the existing options the user...

difference between window and document in jQuery

javascript,jquery,html,css
i wanna know whats the difference between document && window in jQuery ?? These two are used quite often, but i hv never got the difference between them....

Ask for an algorithm

algorithm
I want to know what algorithm the following problem can refer to. I guess it can be represented in CSP but the actions are randomized. Assume I am playing monopoly. I can choose either 1, 2, or 3 dice for movement in each round. My goal is to skip other...

EntityManager not injected in Stateless Session Bean

java-ee,ejb,jboss7.x,entitymanager
I have been looking through a lot of similar questions which did not reflect my exact problem. If i overlooked that someone already had this problem solved, please let me know. I am currently migrating an old EJB 2.1 application on JBoss 3.x to EJB 3.x on JBoss 7.x. Due...

Mobile css loaded on chrome inspector but not working on phone

html,css,mobile,responsive-design,media-queries
So i have a website that I am working on, when I use the "phone icon" on google chrome inspector the site looks ok, it switches to the responsive mobile design, but on my phone it's showing the desktop version. The styles are in the same file desktop&mobile. I have...

Cordova Visual Studio 2015 RC Community : Remote Device iOS

ios,cordova,visual-studio-2015,visual-studio-cordova
I'm currently discovering Visual Studio 2015 RC Community to develop mobile applications with Cordova. I have a Mac (OS X Yosemite) with the necessary tools to use the iOS Remote Agent from within Visual Studio. I have an iPad connected to my Mac to deploy a basic Cordova application on...

Generate JAXB episode file with Gradle anttask

ant,gradle,jaxb,build.gradle
I set up a gradle task to generate java classes from XSD files: ant.taskdef(name: 'xjc', classname: 'com.sun.tools.xjc.XJCTask', classpath: configurations.jaxb.asPath) ant.jaxbTargetDir = jaxbTargetDir ant.xjc(destdir: '${jaxbTargetDir}', package: 'com.example') { schema(dir:'/home/bruckwald/proj/schema/xsd', includes: '*.xsd') } How can I pass the argument -episode my.episode to the ant task so that the episode file will be...

how do I query data from a user profile since getProfile() is removed?

django,django-models
My understanding is that since Django 1.5, Custom User Models are possible but not neccesary. In fact, Greenfeld and Roy argue in "Two Scoops of Django" that sometimes (like for creating a third party package) "Profile" models are still the way to go. Since getProfile() has been removed however, I...

How to check the barcode is 1D or 2D or 3D(QR code)?

vb.net,barcode
I am using the following code to get the barcode data. http://www.codeproject.com/Articles/42852/Reading-Barcodes-from-an-Image-III?msg=5052241#xx5052241xx But i don't know how to get the barcode type which means the barcode is 1D or 2D or 3D(QR code)....

Why I cannot put this operator overload in the same namespace as the struct?

c++,operator-overloading,ostream
I have the following code: #include <iostream> #include <vector> namespace X { std::ostream& operator<<(std::ostream& os,const std::vector<double>& v){ for (int i=0;i<v.size();i++){os << v[i] << " ";} return os; } namespace Y { struct A {std::vector<double> x;}; std::ostream& operator<<(std::ostream& os,const A& a){ os << a.x << std::endl; return os; } } }...

How to make an array of two strings dynamically

c++,arrays,string
i have a problem,i should use this two strings in the code in an array,i dont know how to do it. This is my code: #include <iostream> #include <string> #include <stdlib> using namespace std; class Employee { private: string name; string surname; int ID; float rate; public: Employee() { name="...

Mysql query to group by age, 3 months, 6 months, 9 months and 12 months

mysql,sql
+------+------------+ | cost | date | +------+------------+ | 44 | 2015-04-30 | | 39 | 2015-04-31 | | 18 | 2015-04-01 | | 71 | 2015-01-02 | | 69 | 2014-12-03 | | 62 | 2014-12-04 | | 89 | 2014-08-05 | | 72 | 2014-08-06 | | 46 |...

How to fix this mySQL code so as to show the correct output?

php,mysql
My mySQL table is as below id - hash - page - timestamp 1 - ig35sdf89 - page1 - 2015-05-06 12:03:54 2 - ig35sdf89 - page2 - 2015-05-06 12:06:54 3 - ig35sdf89 - page1 - 2015-05-06 12:08:54 4 - xgd98rgf - page1 - 2015-05-06 12:10:54 5 - aaaat43gr - page3...

Android Toolbar menu button click event

android,android-toolbar
I have a simple Toolbar in my fragment. The Toolbar has a menu associated to it (overflow menu under the 3 dots icon) and everything works pretty well - I get my click events when one of the menu items is selected. However, I need to do something when the...

How can I set the `OnFocus` property for a TextBox when creating them dynamically (on button click) at runtime in c#/XAML?

c#,wpf,xaml
I am currently creating new textboxes from a derived class (MyTextBox : TextBox) when the user presses a button at runtime. How do I set the OnFocus property for the newly created MyTextBox instances if I am creating them this way? Usually I would create them on the XAML designer...

Regex: How to search for a pattern but not include it in the output

regex,exclude
Is there a way to include a pattern in the search but then not include it in the final output? I'm trying to find a way to take out just the state in the source code of an address. So my input is <strong class="street-address"> <address itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"> <span...

Segmentation fault (core dumped) STACK

c,stack
I'm trying to implement a simple stack, but I have a segmentation problem: struct node { int key; struct node *next; }; static struct node *head, *z, *t; int main(int argc, char** argv) { push(5); push(9); push(8); push(pop()+pop()); push(4); push(6); push(pop()*pop()); push(pop()*pop()); push(7); push(pop()+pop()); push(pop()*pop()); printf("%d\n", pop()); return (EXIT_SUCCESS); }...

Delete Table row from the 2nd last

javascript,jquery
I have a table initially with two rows.Every cells of first row titled with word FIRST and every cell of last row titled with word LAST. JS FIDDLE I also have two button one button for adding rows and another for deleting rows. -On clicking Add Row it adds a...

How can I install Application Request Routing ARR 3.0 in Windows 10 Preview?

iis,arr,windows-10,arr-3.0
When I try to Install Application Request Routing I get an error "IIS Version 7.0 or greater is required to install Microsoft Application Request Rounting 3.0". Windows 10 has IIS 10.0, so it should be possible, but I guess that Microsoft hasn't fixed the version check yet. Are there any...

Spring Autowiring a property within an autowired bean

java,spring,spring-boot
I'm a newbie to Spring. I'm facing a problem with Spring-Boot. I'm trying to autowire a field from an external config file into an autowired bean. I have the following classes App.java public class App { @Autowired private Service service; public static void main(String[] args) { final SpringApplication app =...

Insert string after match in variable

bash,sed
I am trying to make some workaround to solve a problem. We have a gtk+ program that call a bash script who calls rdesktop. In a machine, we discover that the rdesktop call need on extra parameter... Since i didnt write anything of this code, and i can modify the...

Crop image in diagonal square

c++,opencv
I have the following image in a Mat: The black rectangle is created using the class rotatedRect. How can I have the following result? EDIT: I manage to do it with the following code: cv::Mat src, dst; float angle, x, y; cv::Mat imgRotated = cv::getRotationMatrix2D(Point(50,50), angle, 1.0); cv::warpAffine(src, dst, imgRotated,...

Convert to decimal direct

c#
I´m trying to convert this string value "153565" to this decimal "1535.65". I dont want to add a dot and then convert to decimal. It is possible to make a direct conversion with decimal? ...

Django: Extend context of class based view with Admin context

python,django
I have a class based view which just displays a list of configurations. This view is added to the Django Admin site by using the following code: @admin.register(ZbxHostConf) class ZbxHostConfListViewAdmin(admin.ModelAdmin): review_template = 'admin/admzbxhostconf_list.html' def get_urls(self): urls = super(ZbxHostConfListViewAdmin, self).get_urls() my_urls = patterns('', (r'^zbxhostconflist/$', self.admin_site.admin_view(self.review)), ) return my_urls + urls def...

Will Application pause during minor GC in java?

java,garbage-collection
Will the whole application stop serving the requests during Minor GC execution? I am able to configure GC paramaters for my application. Can you please help me in understanding below GC log format. 2015-03-30T10:51:08.157-0400: 25.583: [GC [PSYoungGen: 1572864K->198625K(1835008K)] 1670953K->296714K(6029312K), 0.4902390 secs] [Times: user=1.56 sys=0.21, real=0.50 secs] 2015-03-30T10:51:50.081-0400: 67.507: [GC [PSYoungGen:...

How do I split string of values in XSLT1.0?

xslt,xslt-1.0
I have a string of single values and ranges, and I want to split them and put them in order of single values together (comma separated) and ranges together (comma separated), using XSLT1.0. I don't want the result in form of XML nodes, I do want the result on the...

Is there a way to reuse subqueries in the same query?

teradata
See Update at end of question for solution thanks to marked answer! I'd like to treat a subquery as if it were an actual table that can be reused in the same query. Here's the setup SQL: create table mydb.mytable ( id integer not null, fieldvalue varchar(100), ts timestamp(6) not...

Blank line as block-data separator

r,data,block
I have a one-column dataset with blank lines. Each blank line defines a new data block, i.e. what I would plot with gnuplot (if blank line were doubled) like this: plot "datafile" i n where n is the n-th block. How could I implement a data import in R so...

QGraphicsScene does not have a function to remove QWidget

c++,qt,qgraphicsview
QGraphicsScene has an addWidget(QWidget *) function, but no corresponding removeWidget(QWidget *). It has only removeItem(QGraphicsItem *). How do I remove a QWidget?...

Big-O of Dijkstra's Algorithm with D-Ary Heap

algorithm,heap,big-o,dijkstra
I'm looking for a complete walkthrough on the runtime of Dijkstra's algorithm when implemented with a D-Ary heap. My best understanding as of now is that the depth of the tree is at most log_d(n), so the max time of insertion and bubbling up is log_d(n). Wouldn't bubble down be...

PostgreSQL window function issue: asking for GROUP BY

postgresql
I have a table storing pipes together with dates and cities. I need to calculate the pipes' length sum and percentage by city and installing year. Here is the result I'm looking for: city | install_year | length | percentage ---------+------------------+------------+--------------- A | 2014 | 90 | 32.14 A |...

Build docker image from rhel6.5 image

python,docker
I'm trying to build a python3-based container and install some requirements. But the build of python3 fails Here my Dockerfile FROM rhel6.5 ADD ./* /app/ WORKDIR /app/Python CMD ["./configure"] CMD ["make"] CMD ["altinstall"] WORKDIR /app CMD ["python", "-m", "pip", "install" , "-r" , "requirement.txt"] After the build when i run...

Joomla Front-End User Editing Content in One Area

joomla,wysiwyg,frontend
On my website, I have an area where a user can create a team profile page. On the top of this page, is a header area that is 960px width x 170px height. This header, I would like to make a customizable area (like a user WYSIWYG) for the users....

Validation is not visible

c#,asp.net-mvc-4
I hava a contact form, so that users can contact me. it is written in asp.net mvc, but the thing is that after submit without filled in any textbox, there comes no validation on the texboxes. This is my form: @using (Html.BeginForm("contact","Home", FormMethod.Post, new { @enctype = "multipart/form-data" })) {...

sum if greater than in r

r,sumifs
I have a dataframe (obs) with 145 rows and more than 1000 columns plus a numeric vector with 145 values (thr). I would like to derive another vector (sumifs) with 145 elements where each element is the sum of the values of obs[n,] >= thr[n]. I thought I could run...

Is divmod() faster than using the % and // operators?

python,performance,division,modulus,divmod
I remember from assembly that integer division instructions yield both the quotient and remainder. So, in python will the built-in divmod() function be better performance-wise than using the % and // operators (suppose of course one needs both the quotient and the remainder)? q, r = divmod(n, d) q, r...

scala-spark Array mapping

scala,apache-spark
I have a question about mapping Array in scala. I have the following Array: Array[(scala.collection.immutable.Set[String], com.trends.City, com.trends.State)] Basically, I want to map the Array such that each String in the Set will have com.trends.City and State attached to it. The result should look something like: Array[(String, com.trends.City, com.trends.State)] Which is...

How to get keys pressed before enter with jQuery

javascript,jquery
Sorry if this question has already been asked, I am trying to create an app where the user scans a bar code and the data is then shown on the screen. I don't want to use textbox's because I don't want the data to be editable. So far I've managed...

How are lambdas resolved in the .NET framework?

c#,.net,vb.net,lambda
For example, you can use lambda expressions in Visual Studio 2010, but still target .NET 2.0. How does the compiler resolve lambda expressions to work with an older framework that does not include this feature?...

parse multilines from a file and replace

parsing,powershell,multiline
I need to read a file where the content is like below : Computer Location = afp.local/EANG Description = RED_TXT Device Name = EANG04W Domain Name = afp.local Full Name = Admintech Hardware Monitoring Type = ASIC2 Last Blocked Application Scan Date = 1420558125 Last Custom Definition Scan Date =...

NonUniqueObjectException: A different object with the same identifier value was already associated with the session

java,hibernate,hibernate-mapping
I have the following mappings in 2 of my beans Parent Bean @OneToMany(fetch = FetchType.LAZY, mappedBy = "application") @Cascade({CascadeType.SAVE_UPDATE, CascadeType.DELETE}) @JsonIgnore private Set<ApplicationBuildVO> applicationBuilds = new HashSet<ApplicationBuildVO>(0); Child Bean @ManyToOne(fetch = FetchType.LAZY) @Cascade({CascadeType.SAVE_UPDATE}) @JoinColumn(name = "APPLICATION_ID", nullable = false) @JsonIgnore private ApplicationVO application; In my service method - I perform...

flicker when destroyComponents() and redraw c++builder

windows,c++builder
In c++Builder, I have a form with a TPageControl, which has several TTabSheet with ScrollBox alClient inside. In each of these ScrollBox are dynamically drawn several TStringGrid and their information is filled according to a binary file read by an OpenDialog. For dynamic create the components, I write the function...

Disable assertions while testing

ios,objective-c,xcode,unit-testing
I want to test the contract of my API so if, for example, an object is created with some parameter to nil an assertion is raised, but if the assertions are disabled (Release config) it simply returns nil. My test scheme has the build configuration to Debug, so in my...

3D Plot with a colormap - Python

python,matplotlib,plot
I am trying to make a 3D surface plot showing voltage vs. temp vs. power, and to scale the colour of each point to another array of values, known as bifurWidth. Below is my code. Problems with my code: I cannot make my code run for a 'bifurWidth' numpy.ndarray generated...

how do I toggle between the 2 between plus and minus element?

jquery
I have two ids one id ="231-plus " and second id="231-minus". I want to be able to change the plus to minus when open. When closed i want to switch back the minus back to plus. It does the toggle but its not cwitching back from minus to plus once...

Test if email is send in Meteor Velocity

testing,meteor,meteor-velocity
Is it possible to confirm emails are being sent in Meteor Velocity tests? I thought I could just have a method in tests with the same name that override/duplicates the method, but that doesn't work. I tried this: In my regular code: Meteor.methods( email: (parameters) -> sendAnEmail(parameters) ) In tests:...

Fortran Functions with optional arguments

function,fortran,optional
I want to use an operator .ef. however the operator does not accept optional arguments. Is it possible to keep the my function and be able to have the operator working too? Module Core Implicit None Interface Operator (.ef.) Module Procedure fes End Interface Operator (.ef.) Contains Function fes &...

Get network drive letter by name in PowerShell

powershell,network-drive
I'd like to remove network drives from the system using a PowerShell script. I need to find the drive by name, as the command $net.RemoveNetworkDrive('P:',1) needs the driveletter. Is there a command to find the network drive letter in PowerShell? My script: $Drive = "\\192.168.2.117\Blabla" echo $Drive cls if (((New-Object...