on-internet

How to call a stored procedure from a Spring Batch Tasklet?

It is mentioned that a TaskletStep in Spring Batch can be used to call a stored procedure. Could anyone provide an example of how to invoke a Stored Procedure from a TaskletStep? So far I have done this but it throws an exception saying "Configuration problem: The element [callStoredProcedure] is unreachable" <job id="job1"> <step id="step1"> <tasklet ref="myTasklet"/> </step> </job> <bean id="myTasklet" class="MyClass"> <property name="dataSource" ref="dataSource"/> <property name="sql" value="call stored_procedure()"/> </bean> Java Class class MyClass implements Tasklet{ @Override public Rep

Join the discussion →

How to detect the terminal that is running python?

I've already tried sys.platform, platform.system() and os.name but none of them return something related to cygwin (I always get win32, Windows and nt as output). Maybe because my python was installed on windows (8.1) and not through cygwin. I need to detect if my python file is being executed by cygwin or cmd.

Join the discussion →

How to make an Auto Clicker with Java?

So I wanted to make a program that holds down the mouse button for me. So far I've got this: http://pastebin.com/UTJwdHY7 What I'm wondering is how I can stop it. Also, what I realise is that stopping the button makes no sense as I wouldn't be able to click it anyway. Also some tips on how I've done so far would be nice. Edit (Adding code): package main; import javax.swing.*; import javax.swing.border.LineBorder; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.beans.PropertyChangeListener; public class cl

Join the discussion →

How to list Docker mounted volumes from within the container

I want to list all container directories that are mounted volumes. I.e. to be able to get similar info I get from docker inspect --format "{{ .Volumes }}" <self> But from within the container and without having docker installed in there. I tried cat /proc/mounts, but I couldn't find a proper filter for it.

Join the discussion →

Save worksheet as PDF on Mac

I am working on a macro to save the active sheet as a PDF file with a special name. The macro I created runs but saves every sheet in several PDF and puts the name of the sheet at the end of the file name. Sub PrintPDF() Dim wksSheet As Worksheet Dim strFile As String Set wksSheet = ActiveSheet 'strFile = Format(Now(), "yyyymm") _ & ".pdf" strFile = "blabla" _ & "_" _ & Format(Now(), "yyyymm") _ & "_" _ & "name2" _ & " " _ & Replace(Replace(wksSheet.Cells(1, 2).Value, " ", ""), ".", "_") _ & ".pdf" strFile = ThisWorkbook.Path & ":" & strFile wksSheet.SaveAs Filename:=strFile, FileFormat:=xlPDF

Join the discussion →

How to implement the jQuery mcustomscrollbar plugin to create a parallax effect

I wanted to add parallax effect (different scroll speed) to jQuery custom scroll bar plugin (mCustomScrollbar). I'm combining two examples of code: http://codepen.io/JTParrett/pen/BkDie - different scrolling speeds http://manos.malihu.gr/tuts/custom-scrollbar-plugin/full_page_demo.html - Full page scroller See also - http://manos.malihu.gr/jquery-custom-content-scroller/ (plugin callbacks / functions) I have managed to make both examples work separately, but not together, I have end up with this: j(window).load(function(){ j("body").mCustomScrollbar({ scrollButtons:{ enable:true }, callbacks:{

Join the discussion →

C# Post JSON with Authentication Header

I have problem with post JSON with authentication/Authorization.. Below is my code.. opponent said that they didnt receive the header...and i have no idea why... ASCIIEncoding encoding = new ASCIIEncoding(); byte[] data = encoding.GetBytes(stringData); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(serverURL); req.Method = "POST"; req.ContentType = "application/json"; req.ContentLength = data.Length; req.Headers.Add("Authentication", merchantID); req.Headers["Authentication"] = merchantID; Stream newStream = req.GetRequestStream(); newStream.Write(data, 0, data.Length); newStream.Close

Join the discussion →

Networkx Finding communities of directed graph

I am currently graphing and visualizing a directional social network. There is a statistic (modularity) in an open source visualization tool called Gephi (http://gephi.github.io/) that allows me to partition nodes by separating them into communities. I'd like to accomplish this task (finding communities) with my graph before I visualize it with Gephi so that I can run various statistics on each community that the algorithm finds. However, each community algorithm that I have found does not operate on directed graphs. I found two different algorithms to work with that won't work with diGraphs:

Join the discussion →

JQuery Datatables not working on ASP.NET MVC 5

I've used the nuget Package Manager Console with the command install-package jquerydatatablesmvc to install jquery datatables to my MVC 5 project and it installed version 1.9.4. However, after including the required scripts and css files, the data table is not still working. Here is what I've added to the page: <link href="~/Content/DataTables-1.9.4/media/css/jquery.dataTables.css" rel="stylesheet" /> <script src="~/Scripts/DataTables-1.9.4/media/js/jquery.js"></script> <script src="~/Scripts/DataTables-1.9.4/media/js/jquery.dataTables.js"></script> And the jquery code: <script type="text/java

Join the discussion →

Rails environment how to find out in code?

Are there any solutions how I can find out in which environment my application is running? I have some rake calls which need to have the environment like this: system "RAILS_ENV=development rake crons:dosomething" But this should not only work in development I want to use this in test production and development? how can I do this? second task where I need this is in config/schedule.rb the should also run in all environments rake "crons:dosomething", :environment => :development rake "crons:dosomething", :environment => :production this doesn't work

Join the discussion →

.htaccess redirect + rewrite: Prefix uri with language code while keeping initial uri

I am trying to rewrite/redirect incoming requests so that they will always be prefixed by a language code but would like to keep the originally requested path: example.org/de/ -> rewrite to example.org?lang=de example.org -> redirect to example.org/de/ which will then be rewritten to example.org?lang=de example.org/en/ -> rewrite to example.org?lang=en example.org/foo/bar -> redirect to example.org/de/foo/bar which will then be rewritten to example.org/foo/bar?lang=de These were my thoughts on this: RewriteBase / # No 'lang' key in query string RewriteCond %{QUERY_STRING} !lang=(en|de) # AND r

Join the discussion →

MDX Group Dimensions y new Dimension

I'm brand new in Cube world and I need to do a query extending some values form dimensions. For example: Having dimension [time].[Numeric Month], with values [time].[Numeric Month].&[1]..[time].[Numeric Month].&[12] What I need is group that values like this [time].[Numeric Month].&[1]...[time].[Numeric Month].&[4] = A [time].[Numeric Month].&[5]...[time].[Numeric Month].&[12] = B (is an example) and perform a query which result show be like this on Rows A |->1 |->2 |->3 |->4 B |->5 |->6 |->7 |->8 |->9 |->10 |->11 |->12 I could do the grouping but when I tried to use the same hierarchy used fo

Join the discussion →

How to replace a fragment and change TextView in the new one in the same procedure?

I am not a native English speaker, so hope you understand me anyway. In my application I have an activity with a RelativeLayout which I use as Fragment-container. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <RelativeLayout android:id="@+id/fragmentContainer" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" /> </FrameLayout> At the time I have two different Fragments, one will be sh

Join the discussion →

How to optimize collection subscription in Meteor?

I'm working on a filtered live search module with Meteor.js. Usecase & problem: A user wants to do a search through all the users to find friends. But I cannot afford for each user to ask the complete users collection. The user filters the search using checkboxes. I'd like to subscribe to the matched users. What is the best way to do it? I guess it would be better to create the query client-side, then send it the the method to get back the desired set of users. But, I wonder : when the filtering criteria changes, does the new subscription erase all of the old one? Because, if I do a first sear

Join the discussion →

Difference between Application servers and standalone frameworks

I would like you guys to give me some feedback, on my understanding about the difference between Application Servers such as JBoss and frameworks such as Axis and CXF. CXF is a standalone, web-app based framework that implements JAX-RS, JAX-WS API which, in turn, are part of the larger API set of JEE. Being a web-app based implementation, it can only be used to host "SOAP on HTTP" services even if the standard JAX-WS defines other possible channels for SOAP messages, such as SMTP. Application servers, such as JBOSS, instead implement JAX-WS as well as all the other JEE APIs in a more "native"

Join the discussion →

Seamless Handover in Windows CE 5.0 and higher using WLAN and VPN over GPRS

I have a little tricky problem using network under Windows CE with .net compact framework. I will try to describe... First of all there are three types of connections established while starting my application. First one is a WLAN Connection to company network Second one is a GPRS connection Third one is a OpenVPN connection that should use GPRS underlying. Default way is that the user is in WLAN area and connects to company network. But some times the user has to leave WLAN area but needs network connection, so the connection should seamless switch to GRPS over OpenVPN. If the user enters the

Join the discussion →

VBA Class : Collection.item member is a collection . How to retrieve sub collection item elements

I have this template data Header of file ((string1, string2...) group1 header (string1, string2...) group1/line1 (string1, string2...) group1/line2 (string1, string2...) group2 header (string1, string2...) group2/line1 (string1, string2...) group2/line2 (string1, string2...) Note: The data belonging to group header and group line are different type even if they are on the same 'column' (raw data comes from text file) I create my main class (populate collection) and data class (populate item : cData_Nomination), everything works individually BUT I need to create: -1 file collection (I have mult

Join the discussion →

Access Violation Error when TChart is docked

I get an AV when I dock a Form, which contains a TChart, into another Form. The error does not occur when the AutoPaint property of the TChart is set to True. I have tested this with C++Builder XE6, XE7 and Delphi Builder XE6 with the standard version of TeeChart. Steps to reproduce: Create a new application with two Forms (Form1 and Form2). Both Forms should be shown. In the constructor of Form1 set DockSite = true Paste the following code in the constructor of Form2: DragMode = dmAutomatic; DragKind = dkDock; TChart* Chart1 = new TChart(this); //don't forget to delete Chart1->Parent = this;

Join the discussion →

Draggable blocks glued with each other

Here is the sample on codepen. I use rails application and mongoDB at back end, jQuery and Draggability library at front end. Every time dragEnd or focusout events are triggered app tries to save card data to DB via ajax request. If there an error it return 422 code status with error message which it displays in alert. In that sample I emulate error message from app so that alert is always shown when focusout triggered from the input in the new card. Problem: Add a new card Write some test name And then click to other card to trigger focusout Click 'OK' in alert Click back to the previously ad

Join the discussion →

LEFT JOIN with WHERE in a first table's field OR second table's field

SELECT COALESCE(tb2.number_new, tb1.number_original) as number FROM tb1 LEFT JOIN tb2 ON tb2.id = tb1.id WHERE tb1.number_original = <PARAM> OR tb2.number_new = <PARAM> The above query generates a full table scan. How to optimize it? EXPLAIN: +----+-------------+-------+-------+----------------+----------------+---------+------+----------+----------------------------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+-------+-------+----------------+----------------+---------+------+----------+------------------

Join the discussion →

Which would be an efficient way to work with an array of polynomials?

I have a function which given two polynomials, p and q, calculates the integral of p/q between the real numbers a and b. The function I have is$\phi$: import numpy as np def integrate_pdivq(a, b, P, Q, r): """ Calculates the definite integral of P(x)/Q(x) between a and b, assuming gr P<gr Q and that Q have all different roots, all of which have nonzero imaginary part. Parameters: P: list with coefficients of polynomial P. Q: list with coefficients of polynomial Q. r: list with the roots of Q. """ Q_deriv = np.polyder(Q) fracc = ( np.polyval(P, r)/np.polyval(Q_deriv, r) ) inte = ( 0.5 * np.log(

Join the discussion →

Primary key design and partitioning for large sets

I'm currently designing a database for SQL server and I need to handle a large set of data. The context is the following one I have: substrats composed of 4680 chips as a unique ID each chip is composed of 66 spots and has a pass/fail Boolean each spot as 3 values (x,y,radius) So every 20 minutes I need to insert 1 substrat which correspond to 308'880 spots and this 24/24h 7/7d for 10 years resulting in 8bn spots (I know it sounds a lot..) I thought about using composite key like this: SUBSTRAT(INT ID) CHIP(INT FK_SUBSTRATID, ROWNUMBER INT, COLNUMBER INT) SPOT(INT FK_SUBSTRATID, CHIPROWNUMBER

Join the discussion →

How to increase ng-repeat performance using Smart-Table?

I have a problem of performance and I haven't found the solution. Context: I need to display a lot of data (500 lines, 8 columns) in a table. To displayed this data I chose to use Smart-table because it offers good functionality but the problem is that I have a lot of data and the time of displaying data is very long (5 - 9 second, this depends on device performance). Important thing: I need to display all data so I don't want pagination method, limit filter. So this code is working: <ion-scroll class="scrollVertical" direction="xy" overflow-scroll="true" > <table st-table="tableaux" class="ta

Join the discussion →

Which CSS rules are ignored when flexbox is active?

How can I configure flexbox to have a nice fallback? Say I have this: .parent{ display: flex; flex-flow: row wrap; width: 320px; border: 1px solid black; } .children{ text-align: center; flex: 1; background: #DDD; } <div class="parent"> <div class="children">1</div> <div class="children">2</div> <div class="children">3</div> </div> What rules am I allowed to add to have a nice fallback for older browsers and that they get completely ignored and don't disturb flexbox. Notice I don't ask for a polyfill or anything, I just want something that fallbacks to something similar. It would be nice to kn

Join the discussion →

Can you give helpers a variable and change the function it uses in CodeIgniter

I am creating a form and I want to make a custom error log, for example when the user leaves e-mail empty, I want to give my error_helper the variable email, sending to the user that they did not fill in this variable and log that they left this empty. I am a starter with codeIgniter and I've read the manual but I did not find anything helpful. Here is my code: public function submitCheck() { $this->load->model("User"); if(empty($post['email'] || 'email'=="")) { echo "Email is empty."; //This will be changed to a view for user $this->load->helper('error'); //Loading the helper errorLog('Firstn

Join the discussion →

How to upgrade apache 2.2.15 to apache 2.4.12 on CentOS 6.6?

I tried ,but didn't work for me. Apache 2.4 on CentOS 6.6: Step 1: cd /etc/yum.repos.d/ wget http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo Step 2: yum install httpd24.x86_64 Step 3: $ /opt/rh/httpd24/root/usr/sbin/httpd -version Server version: Apache/2.4.6 (Red Hat) Server built: Sep 25 2013 05:25:46 NOTE: config files are in: /opt/rh/httpd24/root/etc/httpd $ ls conf conf.d conf.modules.d logs modules run EDIT: in case you want to switch off Apache 2.2 $ chkconfig httpd off $ chkconfig --list | grep httpd httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off httpd24-httpd 0:

Join the discussion →

Why GoogleAuthUtil.getToken() method generate two types of tokens?

I am integrating Google sign in my Android app. I am using newly mentioned Google+ signin API and am able to get user name, email, profile photo for my app. But when I call the GoogleAuthUtil.getToken() with different parameters I get two kinds of tokens. One is base64 encoded idToken (I think it is JWT or JSON Web Token) but another one generate a token looks different and shorter. Why this this happening? If I use String accountName = Plus.AccountApi.getAccountName(mGoogleApiClient); Account account = new Account(accountName, GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE); String scopes = "audience:ser

Join the discussion →

Implicit conversion of TEXT to varchar/nvarchar

I have a rather large historical table that is now slowing down my users. One of the big things I did that will alleviate the issue is converting the text fields to nvarchar(max) or varchar(max) fields. I am going with nvarchar because of Unicode/conversion issues that may arise. My question is, will the front end, if declaring an explicit TEXT value, be implicitly converted when inserting into the table? I am wondering as the fields are implicitly converted using an ALTER TABLE statement that I used for the initial conversion. This table is used in rather a great many places and putting a CON

Join the discussion →

Parse markdown indented code block gets stuck in recursion

I am trying to parse Markdown using a grammar written with Parslet. However, I cannot get past indented code blocks because everything I tried so far got stuck in recursion. They look like this: This is a indented code block. Second line. Code block continues after blank line. There can be any number of chunks, separated by not more than one blank line. In order to solve this I wrote a minimal example which replaces the lines (including \n) with a and blank lines (\n\n) with spaces, eg: a aaa aa. # recurring_group_parser.rb require 'parslet' require 'rspec' require 'parslet/rig/rspec' class Re

Join the discussion →
Older stories