on-internet

How can I merge PDF files (or PS if not possible) such that every file will begin in a odd page? [closed]

I am working on a UNIX system and I'd like to merge thousands of PDF files into one file in order to print it. I don't know how many pages they are in advance. I'd like to print it double sided, such that two files will not be on the same page. Therefore it I'd the merging file to be aligned such that every file will begin in odd page and a blank page will be added if the next place to write is an even page.

Join the discussion →

What's a minimally valid HTML5 document?

I've just been reading the HTML5 author spec. It states that the <html>, <head> and <body> tags are optional. Does that mean that you can leave them out completely and still have a valid HTML5 document? If I'm interpreting this correctly, it means this should be completely valid: <!DOCTYPE html> <p>Hello!</p> Is this correct? You can check out the spec here: http://dev.w3.org/html5/spec-author-view/syntax.html#syntax "8.1.2.4 Optional tags" is the bit out about it being OK to omit <html>, <head> and <body>

Join the discussion →

TCP Server in VB.NET

I am not a software programmer but I have a task to create a TCP Server (a program that is listening on its network card interfaces for incoming data streams). I have searched on the internet and I found that I can use two methods: Socket or TCPListener class. I have created an example for the Socket class, but I was wondering how I can test it? If another computer in the network sends some string data to the listener computer, then the message should be displayed. Here is the example from Microsoft that I am using for the TCP server using a Socket: Public Shared Sub Main() ' Data buffer for i

Join the discussion →

2d trilateration

I am writing some code to participate in an AI challenge. The main objective for the AI challenge is to take a simulated robot and navigate it through a maze to a destination zone. The secondary objective which is optional is to find a recharger placed in the maze at an unknown location. This is all done in a 2D grid. My program can call a method to get a distance measurement from the recharger. So using trilateration I should be able to locate the recharger by calling this method, recording my ai's current position and the distance the recharger is away from that point 3 times over. I found t

Join the discussion →

Remove first and last quote (") from a variable

Below is the snippet of a shell script from a larger script. It removes the quotes from the string that is held by a variable. I am doing it using sed, but is it efficient? If not, then what is the efficient way? #!/bin/sh opt="\"html\\test\\\"" temp=`echo $opt | sed 's/.\(.*\)/\1/' | sed 's/\(.*\)./\1/'` echo $temp

Join the discussion →

Creating word document from a template using java

I want to create a word document which has a text part, checkboxes and tables in it. I want to create a template of this document and use the template to create a word document using java. Can anyone please suggest me an easiest way to do the same. I tried doing xml mapping but it only works fine with text and tables. I am more concerned about the checkboxes in the word document. Please help!

Join the discussion →

How to get the CUDA version?

Is there any quick command or script to check for the version of CUDA installed? I found the manual of 4.0 under the installation directory but I'm not sure whether it is of the actual installed version or not.

Join the discussion →

Disable scrolling on ``

Is it possible to disable the scroll wheel changing the number in an input number field? I've messed with webkit-specific CSS to remove the spinner but I'd like to get rid of this behavior altogether. I like using type=number since it brings up a nice keyboard on iOS.

Join the discussion →

Check glibc version for a particular gcc compiler

I have two gcc compilers installed on my system, one is gcc 4.1.2 (default) and the other is gcc 4.4.4. How can I check the libc version used by gcc 4.4.4, because /lib/libc.so.6 shows the glibc used by gcc 4.1.2, since it is the default compiler.

Join the discussion →

c-namespace and type conversion

I have a class with a constructor with 4 integer arguments. It is configured in Spring XML like so: <bean id="mySearchService" class="app.service.MySearchService" c:maxConnectionsPerHost="${maxConnectionsPerHost}" c:maxTotalConnections="${maxTotalConnections}" c:connectionTimeout="${connectionTimeout}" c:soTimeout="${soTimeout}" /> My properties file has: maxConnectionsPerHost=50 maxTotalConnections=50 connectionTimeout=500 soTimeout=100 But I get the following error: Error creating bean with name 'mySearchService' defined in class path resource [applicationContext.xml]: Unsatisfied dependency

Join the discussion →

sphotos.xx.fbcdn.net Issue With Full Size Profile Pictures

I'm stuck with what is causing this issue. If i'm logged in as my account, the code below does not show user: 100000920350966 but if i logout & back into my wife's account I can now see that users profile picture. Error I get logged into my FB account: http://sphotos.xx.fbcdn.net/hphotos-snc6/230962_10150332269178009_784368008_9751025_7802946_n.jpg An example of one that does work: http://a4.sphotos.ak.fbcdn.net/hphotos-ak-ash4/419763_10151360491990078_877370077_23594484_2739927_n.jpg the code I am using is the PHP SDK and this piece for getting an image: function randomUser() { $query = mysql

Join the discussion →

Using Named Captures with regex match in Ruby's case...when?

I want to parse user input using named captures for readability. When they type a command I want to capture some params and pass them. I'm using RegExps in a case statement and thus I can't assign the return of /pattern/.named_captures. Here is what I would like to be able to do (for example): while command != "quit" print "Command: " command = gets.chomp case command when /load (?<filename>\w+)/ load(filename) end end

Join the discussion →

Java File can't open certain files

I'm trying to open files from within Java with something like this: java.awt.Desktop.getDesktop().open(new File("c:\\coolfile.txt"); Of course, it all works fine and dandy in most cases. HOWEVER! When I have a file with the unicode character u3000, I cannot open it! Even if the file exists. For example: java.awt.Desktop.getDesktop().open(new File("c:\\coolfile\u3000withweirdname.txt"); I get an Exception, EVEN WHEN THE FILE EXISTS [java] java.io.IOException: Failed to open file:/E:/_prog/test%E3%80%80.txt. Error message: The system cannot find the path specified. Please help me! I tried pretty

Join the discussion →

How to set Java environment path in Ubuntu

I just installed JDK in Ubuntu with sudo apt-get install openjdk-6-jdk command, after the installation where's the Java bin directory located? And how can I set the environment path for that directory? I have little experience with Ubuntu, can anyone give some advice or suggest any good website for reference?

Join the discussion →

"IOException: There is not enough space on the disk." while there is enough space

I made sequence of operations (on local disk): Copy file to ###.bak Save file to ### Delete file ###.bak Code: File.Copy(filename, filename + ".bak"); TextWriter writer = new StreamWriter(filename); writer.Write(content); writer.Close(); File.Delete(filename + ".bak"); During deleting I got exception: IOException: There is not enough space on the disk. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite) Size of both files is maximum few MB. And I checked - there is enough free space

Join the discussion →

Default array values if key doesn't exist?

If I have an array full of information, is there any way I can a default for values to be returned if the key doesn't exist? function items() { return array( 'one' => array( 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, ), 'two' => array( 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, ), 'three' => array( 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, ), ); } And in my code $items = items(); echo $items['one']['a']; // 1 But can I have a default value to be returned if I give a key that doesn't exist like, $items = items(); echo $items['four']['a']; // DOESN'T EXIST RETURN DEFAULT OF 99

Join the discussion →

Set MySQL delimiter inside an sql-file

I want to set the delimiter inside an sql file (because I cannot rely on users to do that through the terminal). Is there a mysql statement that will allow me to set the delimiter? Using DELIMITER // throws an error. # Categories schema # --- !Ups CREATE TABLE IF NOT EXISTS `category` ( `id` INT NOT NULL AUTO_INCREMENT , `pid` INT NULL DEFAULT 0 , `label` VARCHAR(64) NULL , `active` TINYINT NULL DEFAULT 0, PRIMARY KEY (`id`) ); DELIMITER // CREATE FUNCTION hierarchy_connect_by_parent_eq_prior_id(value INT) RETURNS INT NOT DETERMINISTIC READS SQL DATA BEGIN DECLARE _id INT; DECLARE _parent INT;

Join the discussion →

locator equivalent in ggplot2 (for maps)

Note: This question is specific for mapping but I'd like to be able to use it when I plot in a standard Cartesian coordinate system. I love base graphics but also like ggplot2 for many things. One of my most used base functions for fine tuning a graph is locator(n) but this produces an error in ggplot2. library(ggplot2) county_df <- map_data('county') #mappings of counties by state ny <- subset(county_df, region=="new york") #subset just for NYS ny$county <- ny$subregion ggplot(ny, aes(long, lat, group=group)) + geom_polygon(colour='black', fill=NA) locator(1) Now grid.locator() as pointed out

Join the discussion →

Make your own certificate for signing files

Is there a way to make your own signing certificate in order to sign files, such as installation packages? Is the problem that the certificate supplier has to be a trusted source with Windows, otherwise you will get warning messages?

Join the discussion →

How can I find and count number of files matching a given string?

I want to find and count all the files on my system that begin with some string, say "foo", using only one line in bash. I'm new to bash so I'd like to avoid scripting if possible - how can I do this using only simple bash commands and maybe piping in just one line? So far I've been using find / -name foo*. This returns the list of files, but I don't know what to add to actually count the files.

Join the discussion →

How to prevent an abstract class with public derived classes from being inherited in other assemblies?

I want to write something like the following: internal class InternalData { } public class PublicData { } abstract internal class Base { internal Base() { } private static InternalData CreateInternalDataFromPublicData(PublicData publicData) { throw new NotImplementedException(); } abstract protected void DoProcess(InternalData internalData); public void Process(PublicData publicData) { InternalData internalData = CreateInternalDataFromPublicData(publicData); DoProcess(internalData); } } public sealed class Derived : Base { protected override void DoProcess(InternalData internalData) { throw ne

Join the discussion →

org.apache.commons.net.io.CopyStreamException: IOException caught while copying

I'm trying to copy some files created in my server to FTP using code in below method. But weird thing is i'm getting below error randomly and i couldn't figure out what is happening. Exception =org.apache.commons.net.io.CopyStreamException: IOException caught while copying. Below is the code by which i'm copying the files to FTP. public void copyDumpsToFTP() throws SocketException, IOException { FTPClient f= new FTPClient(); f.connect(dumpProperties.getProperty("ftpIPAddress")); boolean flag =f.login(dumpProperties.getProperty("ftpUser"),dumpProperties.getProperty("ftpPassword")); System.out.p

Join the discussion →

Non-blocking on STDIN in PHP CLI

Is there anyway to read from STDIN with PHP that is non blocking: I tried this: stream_set_blocking(STDIN, false); echo fread(STDIN, 1); and this: $stdin = fopen('php://stdin', 'r'); stream_set_blocking($stdin, false); echo 'Press enter to force run command...' . PHP_EOL; echo fread($stdin, 1); but it still blocks until fread gets some data. I noticed a few open bug reports about this (7 years old), so if it can't be done, does any one know any crude hacks that could accomplish this (on Windows and Linux)? https://bugs.php.net/bug.php?id=34972 https://bugs.php.net/bug.php?id=47893 https://bugs

Join the discussion →
Older stories