on-internet

FAIL - Encountered exception org.apache.catalina.LifecycleException

I am unable to deploy .war on Tomcat 7. It is working fine on one of the servers but not working on the other. Following is the error that I get. FAIL - Encountered exception org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/AppAPIs]] Following are the content of catalina.out WARNING: Failed to retrieve JNDI naming context for container [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/AppAPIs]] so no cleanup was performed for that container javax.naming.NameNotFoundException: Name comp is not b

Join the discussion →

How to find the size of an array in postgresql

Is there any way to find a size of an array? For Example, CREATE TABLE example (id integer[]) ; INSERT INTO example VALUES ( '{}'); INSERT INTO example VALUES ( '{5,6,7}'); From this, is there any possibilities to get a result like following, size --- 0 3

Join the discussion →

Can one partially apply the second argument of a function that takes no keyword arguments?

Take for example the python built in pow() function. xs = [1,2,3,4,5,6,7,8] from functools import partial list(map(partial(pow,2),xs)) >>> [2, 4, 8, 16, 32, 128, 256] but how would I raise the xs to the power of 2? to get [1, 4, 9, 16, 25, 49, 64] list(map(partial(pow,y=2),xs)) TypeError: pow() takes no keyword arguments I know list comprehensions would be easier.

Join the discussion →

Does Python have a built-in function for unindenting a multiline string?

Say I have the string s = """ Controller = require 'controller' class foo view: 'baz' class: 'bar' constructor: -> Controller.mix @ """ Every line in the string now has a global 4 space indentation. If this string was declared inside a function, it would have a 8 space global indentation, etc. Does Python have a function for removing the global left indentation of string? I would like that function output to be: Controller = require 'controller' class foo view: 'baz' class: 'bar' constructor: -> Controller.mix @"

Join the discussion →

Why does InetAddress.getLocalHost().getHostName() return a value different from bash "hostname"?

I've got a build.gradle task that works like a champ on my dev box at producing a properties file that records the name of the machine that the build was generated on. The logic is simple enough... def hostname = InetAddress.getLocalHost().getHostName(); On my dev box this always produces the same value as if I did hostname from the bash shell. bobk-mbp:DM_Server bobk$ hostname bobk-mbp.local On our jenkins CI server, however, bash hostname returns one thing, but my call to InetAddress.getLocalHost().getHostName(); returns something else. What needs to change on the jenkins machine to get thes

Join the discussion →

Pipe output from shell command to a python script

I want to run a mysql command and set the output of that to be a variable in my python script. Here is the shell command I'm trying to run: $ mysql my_database --html -e "select * from limbs" | ./script.py Here is the python script: #!/usr/bin/env python import sys def hello(variable): print variable How would I accept the variable in the python script and have it print the output?

Join the discussion →

NGINX Header and Body Filter Modules

I've been coding an NGINX filter module that can read/write cookies for incoming requests. If a particular cookie isn't set correctly (i.e. authentication cookie), it will set the outgoing header status to the appropriate error code. This works fine per the directions of Evan Miller's tutorial. The next part I'm trying to get working (and haven't thus far) is having the body filter be invoked so I can insert/replace body response text when error responses are encountered. I again followed Evan Miller's tutorial on body filters, and I cannot for the life of me get this working. Here's my setup:

Join the discussion →

Climate in Peru in September

My girlfriend and I want to travel in South America in September, and we were thinking Peru. How is the climate in Peru's interest points this time of year? What will we wear there? And also, if we're lazy and don't want to sleep outside in a sleeping bag, can we still enjoy our trip?

Join the discussion →

How to write or append string in loop in a file in java?

I'm having memory problem as working with very large dataset and getting memory leaks with char[] and Strings, don't know why! So I am thinking of writing some processed data in a file and not store in memory. So, I want to write texts from an arrayList in a file using a loop. First the program will check if the specific file already exist in the current working directory and if not then create a file with the specific name and start writing texts from the arrayList line by line using a loop; and if the file is already exist then open the file and append the 1st array value after the last line

Join the discussion →

Debugging android device over the Internet

I am looking for a way to debug a device remotely over the Internet. I am getting a lot of bug reports from my users which I can't even reproduce. It would be easy to solve them if I could debug the device over the Internet as if it were connected to my PC. Is this possible? I heard about debugging over wifi in local network, maybe there is similar way to achieve it over the Internet?

Join the discussion →

Emacs: Combine iseach-forward and recenter-top-bottom

In Emacs, I like to use iseach-forward (C-s) but I'd like it ever more if the highlighted fount words would be centered in the middle of the screen instead of at the very bottom. I find myself doing this continuously: C-s foo C-s C-s C-s... oh! that's the 'foo' I was looking for! C-l Is there a way to center the search results in the middle of the screen?

Join the discussion →

How to handle self signed certificate error in IE8 using Selenium Webdriver + Java

I am literally stuck to this problem for two days now. Scenario: The website that needs to be tested has a self signed certificate. So Internet Explorer (8 in windows XP_ shows "The security certificate presented by this website was not issued by a trusted certificate authority. The security certificate presented by this website was issued for a different website's address." Now this is perfectly natural in case of IE8 and self-signing certificates so I took the following measures to no use Manually added/installed the certificate as a Trusted Root Certificate in IE. But it doesn't get shown i

Join the discussion →

How do I write a TDBCtrlGrid VCL Style custom class?

There are lots of questions here about XE2 VCL Styles and custom colors for Buttons, Panels, edits, etc, and VCL Styles. As much as I wish the existing questions covered it, they don't... So DB Control Grids appear to be Yet Another Special Case. In the DB Control Grid VCL sources, it registers a style hook thusly: TCustomStyleEngine.RegisterStyleHook( TDBCtrlGrid, TScrollingStyleHook); However, that's not what you would descend from if you want to write your own DB Control Grid VCL style hook. If you do, you get the whole control painted like a very large scrollbar. So how do you custom-theme

Join the discussion →

COUNT the related rows from a JOINed table in CodeIgniter [duplicate]

I have a query which grabs all users from the wait table based on $oneid. This works just fine but I would like to count how many messages a user leaves. These are in another table one_msg. function waiting_users($oneid) { $query_str = "SELECT a.user_id, b.email, b.username, b.fbook, c.user_id as saved_user, d.type as user_type, FROM wait a LEFT JOIN users b ON a.user_id=b.id JOIN user_profiles d ON a.user_id=d.user_id LEFT JOIN save_one c ON a.user_id=c.user_id AND c.one_id=? WHERE a.post_id = ? ORDER BY a.date ASC"; } $query = $this->db->query($query_str, array($oneid, $oneid)); one_msg tabl

Join the discussion →

Free tool to convert HTML to PDF file using .NET

I'd need to create a pdf version of my HTML pages using .NET 4.0. Is there any good free tool I can use? I've seen some commercial tools but not any good free ones; ITextSharp doesn't seem to be performing well or able to handle table formats, etc.

Join the discussion →

How do I ensure a select statement returns null values for specific columns?

I have a query that joins two tables. I'm using an IF statement that dictates what to return. One path runs the query/join as is, the other needs to return all of the data from the first column, but only return column names with null values. Here's the query I have now for that: declare @Date DATE = '06/07/2012' IF @DATE >= GETDATE() BEGIN SELECT DisplayName, '' [RegularHours], ''[OvertimeHours] FROM Sites ORDER BY DisplayName END ELSE SELECT sites.DisplayName, hrs.SiteDate, hrs.RegularHrs, hrs.OverTimeHrs FROM Sites sites left join SiteHours hrs on sites.SiteID = hrs.SiteID ORDER BY DisplayNa

Join the discussion →

Why can't I specify an environment variable and echo it in the same command line?

Consider this snippet: $ SOMEVAR=AAA $ echo zzz $SOMEVAR zzz zzz AAA zzz Here I've set $SOMEVAR to AAA on the first line - and when I echo it on the second line, I get the AAA contents as expected. But then, if I try to specify the variable on the same command line as the echo: $ SOMEVAR=BBB echo zzz $SOMEVAR zzz zzz AAA zzz ... I do not get BBB as I expected - I get the old value (AAA). Is this how things are supposed to be? If so, how come then you can specify variables like LD_PRELOAD=/... program args ... and have it work? What am I missing?

Join the discussion →

Using multiple libraries in Codeigniter

I'm trying to load multiple libraries in CI but I'm getting an error. Here is my controller function index() { $this->load->library('materials_library/File_Manager'); $this->load->library('materials_library/Layout'); $data = array(); // Send content to template $this->layout->view('materials_library/file_manager', $data, 'ml_cms'); } The error says view is an undefined property. If I comment out the first load->library, I don't get an error. How do I load multiple libraries in CI? EDIT: class File_manager { private $CI; public function __construct() { $this->CI =& get_instance(); } }

Join the discussion →

How do I declare and use variables in PL/SQL like I do in T-SQL?

In Sql Server, often times when I'm testing the body of a stored procedure, I copy the body into SSMS, DECLARE the variables at the top of the page, set them to some sample values, and execute the body as-is. For Example, if my proc is CREATE PROC MySampleProc @Name VARCHAR(20) AS SELECT @Name Then my test sql would be DECLARE @Name VARCHAR(20) SET @Name = 'Tom' SELECT @Name What is the Oracle PL/SQL equivalent to this? This is the closest that I've come up with, but I'm getting "PLS-00428: an INTO clause is expected in this SELECT statement" DECLARE myname varchar2(20); BEGIN myname := 'Tom';

Join the discussion →

Run C++ Code Online? [closed]

Is there a website I can go to to run C++ code online? I have seen a few compilers, but is there one that can also receive input from cin? I want one that can basically host a C++ .exe online, and even more preferable is if it is like the VC++ platform.

Join the discussion →

The member with identity ' ' does not exist in the metadata collection.\r\nParameter name: identity

I simplified the code a little while trying to debug: [HttpPost] public ActionResult Register(User model) { DateTime bla = new DateTime(2012, 12, 12); try { User user = new User { gid = 1, cid = 1, firstName = model.firstName, lastName = model.lastName, email = model.email, username = model.username, password = model.password, creationDate = bla, active = 1 }; myContext.Users.AddObject(user); myContext.SaveChanges(); } catch (Exception ex) { throw ex; } return View(); } The values are transmited accordingly. Users table: [id] [int] IDENTITY(1,1) NOT NULL, [cid] [int] NULL, [gid] [int] NULL, [f

Join the discussion →

Ant: How to set Environment Variables Using Ant

I have environment variables in a file called release.com as follows, echo "<<< OpenSplice HDE Release V5.5.1OSS For x86.linux2.6, Date 2012-05-23 >>>" if [ "$SPLICE_ORB" = "" ] then SPLICE_ORB=DDS_OpenFusion_1_6_1 export SPLICE_ORB fi if [ "$SPLICE_JDK" = "" ] then SPLICE_JDK=jdk export SPLICE_JDK fi OSPL_HOME="/usr/local/covidien/HDE/x86.linux2.6" OSPL_TARGET=x86.linux2.6 PATH=$OSPL_HOME/bin:$PATH LD_LIBRARY_PATH=$OSPL_HOME/lib:$LD_LIBRARY_PATH CPATH=$OSPL_HOME/include:$OSPL_HOME/include/sys:$CPATH OSPL_TMPL_PATH=$OSPL_HOME/etc/idlpp OSPL_URI=file://$OSPL_HOME/etc/config/ospl.xml . $OSPL_HOM

Join the discussion →

gnuplot to group multiple bars

I am using gnuplot to generate graphs for multiple benchmarks. For each benchmark I have many configurations to plot. I want to plot a graph hit-rate(my y-axis) vs benchmark(x-axis). There will be multiple columns for each benchmark differentiated by their color. I generated the same type of graphs some time back using some python script, but I don't know how to do this in gnuplot.

Join the discussion →

How are low-level libraries made?

When I go and make a C++ application I generally use libraries like SDL or WxWidgets and so on. But if I were to make a library would I need to use a library to make a library? Or can I make the entire library out of core C++ code, is this even possible? My point is that there must be a point were a library has nothing to base itself on and so the only things it can use are core C++. Am I right with this theory? If not, how are low-level libraries really made?

Join the discussion →

Importing data using SQLBulkCopy

We have a legacy application that is dumping large volumes of data to tab delimited files. Each file contains a single record type and all fields are fixed length. These files can readily be imported into corresponding tables in our SQL server database using the BCP utility from the command line. We have a VB.Net program written in VS 2003 that imports these files using the SQLDMO.BulkCopy routine. We are updating the system to use VS 2010 with SQL Server 2008 and according to the Microsoft documentation SQLDMO is no longer available. I have searched on the internet and have rewritten the impo

Join the discussion →

Implement PowerShell PSProvider *in* PowerShell

I'm looking to implement a PowerShell Provider in PowerShell. I keep thinking that if I just define the types, then import them into my session (import-module), I should be able to have them available. For example, this does not work but its along the path of what I'd like to implement. I'm obviously missing quite a bit...anyone know if this is possible? # EnvironmentProvider.ps1 $reference_assemblies = ( "System.Management.Automation, Version=1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" # "System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3

Join the discussion →

What do querySelectorAll() and getElementsBy*() methods return?

Do getElementsByClassName (and similar functions like getElementsByTagName and querySelectorAll) work the same as getElementById or do they return an array of elements? The reason I ask is because I am trying to change the style of all elements using getElementsByClassName. See below. //doesn't work document.getElementsByClassName('myElement').style.size = '100px'; //works document.getElementById('myIdElement').style.size = '100px';

Join the discussion →

Error in readRDS(file) : unknown input format

I am trying to install custom packages in my Rprofile.site file. I want to install packages in the site file because I have to install these packages on several users' computers. However, I am getting the following the error whenever I launch R. Error in readRDS(file) : unknown input format I have the following code added to the end of my Rprofile.site file. if(length(grep("customPackage", installed.packages()))==0) { install.packages("customPackage", repos=NULL, type="source") } The error keeps repeating itself as well until I stop the R session. If I remove that code from the site file and j

Join the discussion →

sgslufread: Hard error on read, OS error = 104 Linux

I'm getting an issue in LINUX when I do ldapsearch -p 6567 "iispsid=BBEU68843256" iispoffername Its giving error sgslufread: Hard error on read, OS error = 104 ldap_bind: Can't contact LDAP server The same works well in UNIX. What does this hard error mean?

Join the discussion →
Older stories