Posts

Showing posts from September 4, 2018

Not able to connect to Oracle datasource using Spring Batch framework

Image
Clash Royale CLAN TAG #URR8PPP Not able to connect to Oracle datasource using Spring Batch framework I have a small project that I’m using to learn Spring Batch. I want to read data from Oracle Database and write to an XML file, but I got an error: Error creating bean with name 'step1': Cannot resolve reference to bean 'jobRepository' while setting bean property 'jobRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobRepository' defined in class path resource [Spring/batch/config/spring-batch-contextOriginal.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'dataSource' of bean class [org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean]: Bean property 'dataSource' is not writable or has an invalid setter method. Does the parameter type of the setter match the r...

convert a string into a dictionary

Image
Clash Royale CLAN TAG #URR8PPP convert a string into a dictionary What is one of the pythonic ways to convert a string which has a built-in dictionary formatting into a dictionary? I have tried regex but it isn't quite there to be the right formatting . string_dictable ="""name"":""Andrew,Carnegie"",""short_name"":""And,Car"", ""YOB"":1835,""Citizen"":""Scottish""" All the extra quotation paddings seem to be the problem and so far I haven't been able to work around them. My expected output is: dicted_string ="name":"Andrew, Carnegie","short_name":"And,Car","YOB":1835,"Citizen":"Scottish" I have also tried ast.literal_eval (string_dictable) to no avail. EDIT: I haven't touched the original formatting and unfortunately, the original question cannot be c...

List all indexes with included columns(nonkeys)

Image
Clash Royale CLAN TAG #URR8PPP List all indexes with included columns(nonkeys) I had tried sp_helpindex but it shows the columns that have index not the included columns. Please tell me how to list all indexes with included columns(nonkeys)? This question appears to be off-topic because no attempt made. – Mitch Wheat Aug 11 '13 at 13:23 Welcome to Stack Overflow! May I refer you to this: meta.stackexchange.com/questions/156810/… – Jonathan Root Aug 11 '13 at 13:26 3 Answers 3 Try this T-SQL query against the catalog views: SELECT IndexName = i.Name, ColName = c.Name FROM sys.indexes i INNER JOIN sys.index_columns ic ON ic.object_id = i.object_id AND ic.index_id = i.index_id INNER JOIN sys.columns c ON c.object_id = ic.object_id AND c.column_id = ic.column_id WHERE ic.is_included_column = 1 ORDER BY i.Name It basically checks all indexes ( sys.indexes ) and then links to their columns and checks to see which columns are designed ...

Error while running Jasper Report using Apache Tomcat 7 in Windows

Image
Clash Royale CLAN TAG #URR8PPP Error while running Jasper Report using Apache Tomcat 7 in Windows I have configured compiling Jasper Report in JSP page. I have done in connecting to database, collecting the JRXML file as well as the parameters for the report and given in below: JasperDesign jasperDesign = JRXmlLoader.load(reportFile); jasperDesign.setLanguage(language); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, jasperParameter, jdbcConnection); //line4 While the report is generating I get error in line 4 . line 4 What I get is: exception org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ExceptionInInitializerError org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java...

Can't convert postgresql table column from type varchar to int

Image
Clash Royale CLAN TAG #URR8PPP Can't convert postgresql table column from type varchar to int I have a database table of that I have used to store the data returned from a web spider. I have a column that contains ticket prices for different events all in the varchar type (as the scrapy spider has to scrape the data in unicode). I'm trying to return the min price of the column and since the min() function only works for data of type INT, I tried to convert the column to integers using a solution from this SO post: ALTER TABLE vs_tickets ALTER COLUMN ticketprice TYPE integer USING (ticketprice::integer); but I got the error: ERROR: invalid input syntax for integer: I also tried: change_column :vs_tickets, :ticketprice, 'integer USING CAST(ticketprice AS integer)' but that didn't work either. change_column :vs_tickets, :ticketprice, 'integer USING CAST(ticketprice AS integer)' What is the proper way to convert the column to type INT? Are only numbers...

Pyinstaller exectuable using data from other folders?

Image
Clash Royale CLAN TAG #URR8PPP Pyinstaller exectuable using data from other folders? I've written a program that generates a random name and displays a random image along with it using Python and tkinter. However, I want the user to be able to add and remove pictures as well as edit the names of students. That being said, I don't want to package these inside the executable where it can't be changed by the user. To use PyInstaller, I go into the command prompt and navigate to the working directory and type: pyi-makespec --windowed --onefile --icon=Assets\icon.ico random_student.py Then, in the spec file I change datas to: datas=[('Assets\icon.ico', 'Assets')], Then, I run pyinstaller random_student.spec The program runs just fine using PyCharm. And I've done this exact same method on a couple of other .py files an it works. However, they don't need to pull images/text into their programs. This will create an executable, but I can't run it. I...

Get only the Date portion of a date time column

Image
Clash Royale CLAN TAG #URR8PPP Get only the Date portion of a date time column In the set portion of the below query how would I get it to grab just the date portion of the datetime column in MS SQL 2012? update db.dbo.Prod set db.DBO.prod.code5 = l.datetime FROM db.DBO.ali l INNER JOIN db.dbo.prod p ON l.part = p.KEYCODE and p.code5 = '' and L.PREFIX = 'D' AND l.part like 'ACD%' 1 Answer 1 What is the type of code5 ? If it is a date, then your code is fine. If not, you can cast the value. code5 You should also be consistent in your use of aliases: UPDATE p SET code5 = CAST(l.datetime as DATE) FROM db.DBO.ali l INNER JOIN db.dbo.prod p ON l.part = p.KEYCODE and p.code5 = '' and L.PREFIX = 'D' AND l.part like 'ACD%' It is varchar(50) and I can't change it unfortunately. The cast worked perfectly. Thanks! – Kelly Peterson Aug 10 at 20:13 If it's a varchar, then you're going to have an implicit cast that con...

PHP code is not being executed, instead code shows on the page

Image
Clash Royale CLAN TAG #URR8PPP PHP code is not being executed, instead code shows on the page I'm trying to execute some PHP code on a project (using Dreamweaver) but the code isn't being run. When I check the source code, the PHP code appears as HTML tags (I can see it in the source code). Apache is running properly (I'm working with XAMPP), the PHP pages are being opened properly but the PHP code isn't being executed. Does someone have a suggestion about what is happening? Note: The file is already named as filename.php filename.php Edit: The Code..: <? include_once("/code/configs.php"); ?> Are you using short tags <? instead of <?php ? – Dan Grossman Feb 25 '11 at 19:09 <? <?php Yes, i'm using <? ... – Gui Feb 25 '11 at 19:12 Don't EVER use short tags. ( <? ). They are deprecated, don't really work in a lot of places, and are otherwise completely unneccessary. Saving three keystrokes is ...

How can I pause between two commands

Image
Clash Royale CLAN TAG #URR8PPP How can I pause between two commands I would like to pause in between two dos commands that stop and start a service. Here is the code: ( code was borrowed from How can a windows service programmatically restart itself? ) Process proc = new Process(); ProcessStartInfo psi = New ProcessStartInfo(); psi.CreateNoWindow = true; psi.FileName = "cmd.exe"; psi.Arguments = "/C net stop YOURSERVICENAMEHERE && net start YOURSERVICENAMEHERE"; psi.LoadUserProfile = false; psi.UseShellExecute = false; psi.WindowStyle = ProcessWindowStyle.Hidden; proc.StartInfo = psi; proc.Start(); basically, I want to put a 'pause' in between the stop and start: psi.Arguments = "/C net stop YOURSERVICENAMEHERE && timeout /t 10 /nobreak && net start YOURSERVICENAMEHERE" not any more... – user3174075 Aug 10 at 19:19 Why don't you simply stop the service, use the many sleeping methods available in NET and the...

Android gradle error when sync style attribute not found

Image
Clash Royale CLAN TAG #URR8PPP Android gradle error when sync style attribute not found I am getting a few errors when I try to sync gradle. I am extremely new to android coding. Gradle Console Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar] Configuration on demand is an incubating feature. :clean :app:clean :app:preBuild UP-TO-DATE :app:preDebugBuild :app:compileDebugAidl :app:compileDebugRenderscript UP-TO-DATE :app:checkDebugManifest :app:generateDebugBuildConfig :app:prepareLintJar UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources :app:createDebugCompatibleScreenManifests :app:processDebugManifest :app:splitsDiscoveryTaskDebug :app:processDebugResources AGPBI: "kind":"error","text":"error: style attribute u0027attr/roundSelector (aka com.example.adend.timetable:attr/roundSelector)u0027 not found.","sources...