on-internet

Undefined subroutine &main::Query

I wrote a Perl module: package sql; use strict; use XML::Simple; use DBI; use DBD::mysql; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(DBImport DataFill); our @EXPORT = qw(DBImport DataFill); our $dbh; sub DBConnect() { my $platform = "mysql"; my $database = "databasename"; my $host = "localhost"; my $user = "user"; my $pw = "password"; my $dsn = "dbi:mysql:$database:localhost"; $dbh = DBI->connect($dsn, $user, $pw); $dbh->do('SET NAMES utf8'); return $dbh; } sub Query($) { my $sth = $dbh->prepare(shift); $sth->execute; while (my $ref = $sth->fetchrow_hashref()) { print $ref-

Join the discussion →

Can't call method "disconnect" without a package

I wrote a Perl module: package sql; use strict; use XML::Simple; use DBI; use DBD::mysql; require Exporter; our @ISA = qw(Exporter); our @EXPORT_OK = qw(DBImport DataFill); our @EXPORT = qw(DBImport DataFill); our $dbh; sub DBConnect() { my $platform = "mysql"; my $database = "databasename"; my $host = "localhost"; my $user = "user"; my $pw = "password"; my $dsn = "dbi:mysql:$database:localhost"; $dbh = DBI->connect($dsn, $user, $pw); $dbh->do('SET NAMES utf8'); return $dbh; } sub Query($) { my $sth = $dbh->prepare(shift); $sth->execute; while (my $ref = $sth->fetchrow_hashref()) { print $ref-

Join the discussion →

Importing CUnit sources

i'm having a problem to use Unit test in C, i've tried to install CUnit in my computer and after include the lib. i've followed steeps to install the CUnit: 1 - download the sources 2 - configure it using "./configure --prefix='/lib' " 3 - make (only make) 4 - sudo make install and this is my test source file, it's not making tests, but i can't compile this, i got this error before "CUnit.h: No such file or directory": #include "CUnit.h" #include <stdlib.h> #include <stdio.h> int main(){ print("Hello"); return 0; } I want to know, how can i install CUnit to use in my test source files! Thanks

Join the discussion →

Repeated arguments in a prepared statement

consider a query that looks something like this: my $query=<<QUERY; select * from foo1 where col < ? union all select * from foo2 where col < ? QUERY Assume that the actual query really needs unions and can't be efficiently solved another way. The variable in the where clause will always be the same. Is there any way I can structure this so that I only need to pass 1 argument to execute instead of passing the same argument twice?

Join the discussion →

Getting an exception "Failed to start service jboss.module.service" for spring portlets

Thanks for your time the version we are using liferay 6 - jboss 7 and here is the error exception getting when trying to avoid the lib folder consisting spring jars inside every spring mvc3 portlet war . Because the same set of spring dependency jars were added to all the portlets and deploying all the time, it actually increases the load . To get rid of this , created a folder inside modules [structure goes like this jboss/modules/com/spring/main/--jar files--] and added all the common libraries. this is the module.xml <module xmlns="urn:jboss:module:1.0" name="com.spring"> <resources> <resou

Join the discussion →

Consuming web service with SSL (https) in C#

I want to consume an ssl secured web service in C#. The request looks like this: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:biw="http://tempuri.org/ws_returnTable" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" > <soapenv:Header> <wsse:Security> <wsse:UsernameToken> <wsse:Username>sasdemo</wsse:Username> <wsse:Password>sasch.111</wsse:Password> </wsse:UsernameToken> </wsse:Security> </soapenv:Header> <soapenv:Body> <biw:meansclass /> </soapenv:Body> </soapenv:Envelope> The endpoint declaration in WSDL looks

Join the discussion →

Powershell script to run multiple batch files in order

Real n00b to powershell. I was wondering if the community could help me build a pretty simple script. Really, I can achieve everything I need in windows batch files - but these only complete one task at a time. I want a master script (a powershell script) to call each individual batch process in turn. That is, I want to run Batch_1 and then run Batch_2 only when a task from a program that Batch_1 calls has finished. Is this possible? Is it a case of using some form of IF THEN ELSE type scenario or is there a way to make powershell wait for some event to happen? Thanks! GPC

Join the discussion →

Try catch finally: Do something if no exception is thrown

I'm wondering, is there a way to only execute a block if no exception was thrown? The best I can come up with is this: bool exception = false; try{ // something }catch(Exception e){ exception = true; }finally{ if(!exception){ // i can do what i want here } } Is there a better way?

Join the discussion →

How to create a live scorer app for Android?

I am developing an android app where I will provide a button on which, when ever the user clicks, they will get the live score updates of the Soccer game. Are there any tutorials for that or, any Open-source code available for that I am trying to achieve some what like the image given below:

Join the discussion →

Add a site to Silverlight permissions tab

I have an intranet site that uses a Silverlight application to take pictures with the WebCam of the computer. Testing the site on a Development environment works fine but testing the site on a QA environment wont display any image. Looking more in deep on both sites I see that the Silverlight permissions tab has define "ALLOW" to the Development URL but the QA url does not appear at all on the permissions tab. How can I add the URL of the QA site to the permissions tab on the Silverlight Permissions tab ? I am using the Silverlight 4.0. Thanks for your replies.

Join the discussion →

Accessing data from a tab-delimited file

I have a tab-delimited file, for example: ID NAME FAMILYTAG EFFECT 001 John Black Positive 002 Kate Rhodes,Mich Positive 003 Aaron Sunders Negative 004 Shirley Rhodes Negative 005 Dexter Sunders,Hark Positive I want to input this file (which is actually much larger) and read in a name, for example Kate. Then I want the script to recognize its family tag, i.e. it contains Rhodes, and then output the other family member Shirley. Is there a way to do this? The output file will look like this. Kate Rhodes Shirley Rhodes

Join the discussion →

How to search for a string in JAR files

My application is built on Java EE. I have approximately 50 jars in this application. Is it possible to search for a particular keyword (actually I want to search for a keyword BEGIN REQUEST)?

Join the discussion →

How can I get the rotation between accelerometer's axis and motion vector?

I'm working on a Pedestrian Navigation System on Android. I am currently trying to get the rotation matrix between the 3-axis accelerometer referential and the motion that is applied to the device. Let's say you are walking straight forward with the device in your hand, but the Y axis of the accelerometer (thus the device's Y axis) is not oriented in the same direction as the one you're heading yourself (basically you're holding the device in an awkward way). Then if I want to apply distances (based on step detection), it would be wrong to apply them to the accelerometer referential (which I k

Join the discussion →

Math "pow" in Java and C# return slightly different results?

I am porting program from C# to java. I've faced a fact that Java Math.pow(0.392156862745098,1./3.) = 0.7319587495200227 C# Math.Pow( 0.392156862745098, 1.0 / 3.0) =0.73195874952002271 this last digit leads to sufficient differences in further calculations. Is there any way to emulate c#'s pow? Thanx

Join the discussion →

How to fetch the NATIVE resolution of attached monitor from EDID file through VB6.0?

I am developing a VB application in which i need to know the native resolution of the monitor and not the one set by the user(current resolution). So i need to read the EDID (extended display identification data) directly from the monitor. I did try to find the resolution of monitor through some programs...but all it returns is the current resolution. Any help to read the info directly from EDID of monitor is appriciable. Thanks in advance

Join the discussion →

How to mix jQuery Mobile and ASP.NET

I'm making a mobile website, using jQuery Mobile and ASP.NET 4.0 Webforms. I have made an initial login page (Default.aspx) in which the button calls an ajax JavaScript function, which calls a page method in the backend like so: Default.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="UCP.Default" %> <!DOCTYPE html> <html> <head> <title>UA Cover Plus</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" /> <script src="http://code.jquery.com/jquery-1.6.4.min.js"></script> <script src="http://code.jquery.co

Join the discussion →

Are pointers stable?

I want to use the actual pointer address (not marked volatile) to an object to uniquely identify the object. Is this a bad thing to do? In general, does system memory management move the objects and hence its address about or is the pointer stable?

Join the discussion →

How to access the result set data from a CodeIgniter query [duplicate]

I have my my model: $this->db->select('companyName,companySlogan,companyContact,companyEmail,companyWebsite,companyPhone,companyFax,companyAddress'); $result = $this->db->get('companyDetails'); How would I return my $result so that I can call it via my controller in the following form? $data['companyName'] = $this->quote->companyDetails->companyName

Join the discussion →

Why isn't this true/false implication function working in SML?

val implies = fn x y = case x of false andalso case y of false => true | fn x y = case x of false andalso case y of true => true | fn x y = case x of true andalso case y of false => false | fn x y = case x of true andalso case y of true => true; I can't get this to compile. I'm relatively new to SML so not quite getting the general language and syntax. What have I done wrong?

Join the discussion →

WebServices Calculator Example using Java

I have created an sample application of calculator for sum of two numbers using webservices in Java by using Jersey service. My code is : Calculator.java package p1; import javax.jws.WebService; import javax.jws.WebMethod; import javax.ws.rs.Path; @WebService @Path("/CalculatorService") public class Calculator { @WebMethod public String sum(int x,int y) { return ""+(x+y); } } Calculator.java: package mypack; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; /**

Join the discussion →

Principal Component Analysis and determinant of the total scatter matrix

Hi guys I'm reading a paper Eigenfaces vs. Fisherfaces: Recognition Using Class Specific Linear Projection, I'm wondering why in PCA the projection W is chosen to maximize the determinant of the total scatter matrix of the projected samples, i.e., arg max|W^T S_T W|(in latex form) where S_T is the scatter matrix of the original dataset. Thanks very much!

Join the discussion →

Json RPC error 32600

I am using jquery ajax to pass json rpc request to remote server. Here is my json string: {"jsonrpc":"2.0","method":"merchant_check","params":{"hostID":150999,"orderID":107,"amount":"7777","currency":"051","mid":15001038,"tid":15531038,"mtpass":"12345","trxnDetails":""},"id":107} I am getting this error: {"jsonrpc":"2.0","id":null,"error":{"code":-32600,"message":"Invalid JSON-RPC 2.0 request error (-32600)"}} What am I doing wrong? Thanks for help.

Join the discussion →

Why is it the number 9 in the 'kill -9' command on Unix? [closed]

I usually use kill -9 pid to kill the job. I always wondered the origin of 9. I looked it up online, and it says: "9 Means KILL signal that is not catchable or ignorable. In other words it would signal process (some running application) to quit immediately" (source: What does the command kill -9 do in Unix?) But, why 9? And what about the other numbers? Is there any historical significance or is it because of the architecture of Unix?

Join the discussion →

How can I ignore ValueError when I try to remove an element from a list?

How can I ignore the "not in list" error message if I call a.remove(x) when x is not present in list a? This is my situation: >>> a = range(10) >>> a [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> a.remove(10) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: list.remove(x): x not in list >>> a.remove(9)

Join the discussion →

Get all comments on a public Facebook post

I want to retrieve all comments of a public Facebook post via my application. My application is a service which uses an application_accesstoken to call the Graph API (so there is no possibility to authenticate from a user's perspective). I retrieve posts via the 'All public posts' search URL (https://graph.facebook.com/?q=[keywords]&type=posts. This URL only returns a few comments on a returned posts. Most of the times only 2 comments (which are the same you can see on the profile page before clicking 'View all XX comments'). Is there any way to retrieve all of those comments via my applicatio

Join the discussion →

How to make same layout for all web pages

I am currently working on HTML I want to ask a question about website development.I am developing a website in which the basic layout remains same like menu, side menu etc but only the content changes.Currently I have make separate .html file for all web pages. Can any one tell me is there a way through which I can make a separate file having etc common to all and call it in my html file.I have heard about CSS but it will only change the style and layout. thanks

Join the discussion →

Sending thousands of emails from a program?

A website that I used my password on was compromised and the monkeys in charge had stored everything in plaintext. The list was released publicly online. Needless to say, my password and email were among them. I would like to send emails to everyone else who was listed (thousands) and inform them that to continue using their password is unsafe. My language of choice would be C# and I would be sending them from my gmail with the help of this code: Sending email in .NET through Gmail I can pretty much assume gmail will lock me out before I finish 10 in under a minute. Apart from sending emails o

Join the discussion →

Failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request - OAuth 2.0 POST

I am working with YouTube APIs for my college project, and I keep getting an error. Here I send them to the authorisation page to log in, when they allow access it sends the $_GET['code'] string back. Then I send this along with some other data and it should send back a JSON object. Instead I am just getting Warning: file_get_contents(https://accounts.google.com/o/oauth2/token) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request in http://www.example.net/callback.php on line 27 I have replaced my domain with example.net just for security urlencode

Join the discussion →
Older stories