Search Results

Search found 1500 results on 60 pages for 'peter smit'.

Page 6/60 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Enforce numbers in mobile web form

    - by Peter Smit
    I have a simple webform targeted for Opera Mini and Opera Mobile. I'm using just a HTML input element. Now I would like to restrict the element to only have integer numbers. Is there a way to enforce this in this browser (possible even that the phone will have it's number mode on when entering the form)? And if I wanted to allow floats, is something possible then?

    Read the article

  • How to synchronize a python dict with multiprocessing

    - by Peter Smit
    I am using Python 2.6 and the multiprocessing module for multi-threading. Now I would like to have a synchronized dict (where the only atomic operation I really need is the += operator on a value). Should I wrap the dict with a multiprocessing.sharedctypes.synchronized() call? Or is another way the way to go?

    Read the article

  • Install mod_jk with Apache 2.2

    - by peter
    I have downloaded mod_jk-1.2.28-httpd-2.2.X.so for Apache 2.2 running on CentOS, and set up as per http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html. When I try to start httpd it fails with the following error: "Starting httpd: httpd: Syntax error on line 993 of /etc/httpd/conf/httpd.conf: Syntax error on line 2 of /opt/apache-tomcat-6.0.26/conf/jk/mod_jk.conf-auto: Cannot load /etc/httpd/modules/mod_jk-1.2.28-httpd-2.2.X.so into server: /etc/httpd/modules/mod_jk-1.2.28-httpd-2.2.X.so: wrong ELF class: ELFCLASS32" Does that mean that mod_jk-1.2.28-httpd-2.2.X.so has not been properly compiled?. What can I do about that? Thanks Peter

    Read the article

  • Running SQL script through psql gives syntax errors that don't occur in PgAdmin

    - by Peter
    Hi I have the following script to create a table: -- Create State table. DROP TABLE IF EXISTS "State" CASCADE; CREATE TABLE "State" ( StateID SERIAL PRIMARY KEY NOT NULL, StateName VARCHAR(50) ); It runs fine in the query tool of PgAdmin. But when I try to run it from the command line using psql: psql -U postgres -d dbname -f 00101-CreateStateTable.sql I get a syntax error as shown below. 2: ERROR: syntax error at or near "" LINE 1: ^ psql:00101-CreateStateTable.sql:6: NOTICE: CREATE TABLE will create implicit sequence "State_stateid_seq" for serial column "State.stateid" psql:00101-CreateStateTable.sql:6: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "State_pkey" for table "State" CREATE TABLE Why do I get a syntax error using psql and not with PGAdmin? Kind regards Peter

    Read the article

  • Database design in blogging systems

    - by Peter
    As a learning exercise I'm trying to put myself a blogging system. The goal is to code something that will let me create multiple blogs, like blogger.com or wordpress.com, but much simplified. I would like to ask you, what do you think is best database design for this type of script. Is it better to have one big table, containing posts from all blogs of all users (like friendfeed) or would it be better to create separate table for each blog's posts? Big thanks in advance for your help, Peter.

    Read the article

  • How does TransactionScope guarantee data integrity across multiple databases?

    - by Bas Smit
    Hey guys, Can someone tell me the principle of how TransactionScope guarantees data integrity across multiple databases? I imagine it first sends the commands to the databases and then waits for the databases to respond before sending them a message to apply the command sent earlier. However when execution is stopped abruptly when sending those apply messages we could still end up with a database that has applied the command and one that has not. Can anyone shed some light on this? Edit: I guess what Im asking is can I rely on TransactionScope to guarantee data integrity when writing to multiple databases in case of a power outage or a sudden shutdown. Thanks, Bas Example: using(var scope=new TransactionScope()) { using (var context = new FirstEntities()) { context.AddToSomethingSet(new Something()); context.SaveChanges(); } using (var context = new SecondEntities()) { context.AddToSomethingElseSet(new SomethingElse()); context.SaveChanges(); } scope.Complete(); }

    Read the article

  • Connect Access 2007 to SQL Server 2008 Database

    - by Peter
    Hi, I've seen numerous answers to similar questions like this one. I haven't seen on the web many people have asked the seemingly simple question "How do I connect Access 2007 to an SQL server 2008 database" - but all of the answers describe how you can migrate from access 2007 to an sql server 2008 database, or they describe how to connect access 2007 to an sql server 2005 database. I can't find any simple solution to my problem (and probably this is a problem for many others). Here is the question (sorry for the over emphasis): How do I connect to an sql server 2008 database (and I mean 2008, not 2005 :) ) from access 2007? Apologies again for the over emphasis, but this very simple question, and what I thought should be a very simple task seems, yes, ... impossible! I tried running sql server browser, enabling pipes, TCP etc, but it seems that with 2008 SQLEXPRESS just isn't recognised! Please can someone help with this. Peter

    Read the article

  • Scala n00b: Critique my code

    - by Peter
    G'day everyone, I'm a Scala n00b (but am experienced with other languages) and am learning the language as I find time - very much enjoying it so far! Usually when learning a new language the first thing I do is implement Conway's Game of Life, since it's just complex enough to give a good sense of the language, but small enough in scope to be able to whip up in a couple of hours (most of which is spent wrestling with syntax). Anyhoo, having gone through this exercise with Scala I was hoping the Scala gurus out there might take a look at the code I've ended up with and provide feedback on it. I'm after anything - algorithmic improvements (particularly concurrent solutions!), stylistic improvements, alternative APIs or language constructs, disgust at the length of my function names - whatever feedback you've got, I'm keen to hear it! You should be able to run the following script via "scala GameOfLife.scala" - by default it will run a 20x20 board with a single glider on it - please feel free to experiment. // CONWAY'S GAME OF LIFE (SCALA) abstract class GameOfLifeBoard(val aliveCells : Set[Tuple2[Int, Int]]) { // Executes a "time tick" - returns a new board containing the next generation def tick : GameOfLifeBoard // Is the board empty? def empty : Boolean = aliveCells.size == 0 // Is the given cell alive? protected def alive(cell : Tuple2[Int, Int]) : Boolean = aliveCells contains cell // Is the given cell dead? protected def dead(cell : Tuple2[Int, Int]) : Boolean = !alive(cell) } class InfiniteGameOfLifeBoard(aliveCells : Set[Tuple2[Int, Int]]) extends GameOfLifeBoard(aliveCells) { // Executes a "time tick" - returns a new board containing the next generation override def tick : GameOfLifeBoard = new InfiniteGameOfLifeBoard(nextGeneration) // The next generation of this board protected def nextGeneration : Set[Tuple2[Int, Int]] = aliveCells flatMap neighbours filter shouldCellLiveInNextGeneration // Should the given cell should live in the next generation? protected def shouldCellLiveInNextGeneration(cell : Tuple2[Int, Int]) : Boolean = (alive(cell) && (numberOfAliveNeighbours(cell) == 2 || numberOfAliveNeighbours(cell) == 3)) || (dead(cell) && numberOfAliveNeighbours(cell) == 3) // The number of alive neighbours for the given cell protected def numberOfAliveNeighbours(cell : Tuple2[Int, Int]) : Int = aliveNeighbours(cell) size // Returns the alive neighbours for the given cell protected def aliveNeighbours(cell : Tuple2[Int, Int]) : Set[Tuple2[Int, Int]] = aliveCells intersect neighbours(cell) // Returns all neighbours (whether dead or alive) for the given cell protected def neighbours(cell : Tuple2[Int, Int]) : Set[Tuple2[Int, Int]] = Set((cell._1-1, cell._2-1), (cell._1, cell._2-1), (cell._1+1, cell._2-1), (cell._1-1, cell._2), (cell._1+1, cell._2), (cell._1-1, cell._2+1), (cell._1, cell._2+1), (cell._1+1, cell._2+1)) // Information on where the currently live cells are protected def xVals = aliveCells map { cell => cell._1 } protected def xMin = (xVals reduceLeft (_ min _)) - 1 protected def xMax = (xVals reduceLeft (_ max _)) + 1 protected def xRange = xMin until xMax + 1 protected def yVals = aliveCells map { cell => cell._2 } protected def yMin = (yVals reduceLeft (_ min _)) - 1 protected def yMax = (yVals reduceLeft (_ max _)) + 1 protected def yRange = yMin until yMax + 1 // Returns a simple graphical representation of this board override def toString : String = { var result = "" for (y <- yRange) { for (x <- xRange) { if (alive (x,y)) result += "# " else result += ". " } result += "\n" } result } // Equality stuff override def equals(other : Any) : Boolean = { other match { case that : InfiniteGameOfLifeBoard => (that canEqual this) && that.aliveCells == this.aliveCells case _ => false } } def canEqual(other : Any) : Boolean = other.isInstanceOf[InfiniteGameOfLifeBoard] override def hashCode = aliveCells.hashCode } class FiniteGameOfLifeBoard(val boardWidth : Int, val boardHeight : Int, aliveCells : Set[Tuple2[Int, Int]]) extends InfiniteGameOfLifeBoard(aliveCells) { override def tick : GameOfLifeBoard = new FiniteGameOfLifeBoard(boardWidth, boardHeight, nextGeneration) // Determines the coordinates of all of the neighbours of the given cell override protected def neighbours(cell : Tuple2[Int, Int]) : Set[Tuple2[Int, Int]] = super.neighbours(cell) filter { cell => cell._1 >= 0 && cell._1 < boardWidth && cell._2 >= 0 && cell._2 < boardHeight } // Information on where the currently live cells are override protected def xRange = 0 until boardWidth override protected def yRange = 0 until boardHeight // Equality stuff override def equals(other : Any) : Boolean = { other match { case that : FiniteGameOfLifeBoard => (that canEqual this) && that.boardWidth == this.boardWidth && that.boardHeight == this.boardHeight && that.aliveCells == this.aliveCells case _ => false } } override def canEqual(other : Any) : Boolean = other.isInstanceOf[FiniteGameOfLifeBoard] override def hashCode : Int = { 41 * ( 41 * ( 41 + super.hashCode ) + boardHeight.hashCode ) + boardWidth.hashCode } } class GameOfLife(initialBoard: GameOfLifeBoard) { // Run the game of life until the board is empty or the exact same board is seen twice // Important note: this method does NOT necessarily terminate!! def go : Unit = { var currentBoard = initialBoard var previousBoards = List[GameOfLifeBoard]() while (!currentBoard.empty && !(previousBoards contains currentBoard)) { print(27.toChar + "[2J") // ANSI: clear screen print(27.toChar + "[;H") // ANSI: move cursor to top left corner of screen println(currentBoard.toString) Thread.sleep(75) // Warning: unbounded list concatenation can result in OutOfMemoryExceptions ####TODO: replace with LRU bounded list previousBoards = List(currentBoard) ::: previousBoards currentBoard = currentBoard tick } // Print the final board print(27.toChar + "[2J") // ANSI: clear screen print(27.toChar + "[;H") // ANSI: move cursor to top left corner of screen println(currentBoard.toString) } } // Script starts here val simple = Set((1,1)) val square = Set((4,4), (4,5), (5,4), (5,5)) val glider = Set((2,1), (3,2), (1,3), (2,3), (3,3)) val initialBoard = glider (new GameOfLife(new FiniteGameOfLifeBoard(20, 20, initialBoard))).go //(new GameOfLife(new InfiniteGameOfLifeBoard(initialBoard))).go // COPYRIGHT PETER MONKS 2010 Thanks! Peter

    Read the article

  • Django Caught an exception while rendering: No module named registration

    - by Arno Smit
    I seem to have run into a bit of an issue. I am busy creating an app, and over the last few weeks setup my server to use Git, mod_wsgi to host this app. Since deploying it, everything seems to be running smoothly however, I had to go through all my files and insert the absolute url of the project to make sure it works fine. on my local machine from registration.models import UserRegistration on server from myapp.registration.models import UserRegistration Am I doing something wrong? And this has also caused an issue for me where I cannot access my django admin interface. All i get is this: Caught an exception while rendering: No module named registration Exception Value: Caught an exception while rendering: No module named registration As far as I am concerned my app has all the relevant urls, but it does not seem to work. Thank you in advance

    Read the article

  • Wrapping a C# service in a console app to debug it.

    - by Jack Smit
    I want to debug a service written in C# and the old fashioned way is just too long. I have to stop the service, start my application that uses the service in debug mode (Visual studio 2008), start the service, attach to the service process and then navigate in my Asp.Net application to trigger the service. I basically have the service running in the background, waiting for a task. The web application will trigger a task to be picked up by the service. What I would like to do is to have a console application that fires the service in an effort for me to debug. Is there any simple demo that anybody knows about? Thank you Jack

    Read the article

  • Postgresql 8.4 reading OID style BLOBs with Hibernate

    - by peter
    I am getting this weird case when querying Postgres 8.4 for some records with Blobs (of type OIDs) with Hibernate. The query does return all right but when my code wants to read the content of the BLOB with the simple code below, it gets 0 bytes back public static byte[] readBlob(Blob blob) throws Exception { InputStream is = null; try { is = blob.getBinaryStream(); return org.apache.commons.io.IOUtils.toByteArray(is); } finally { if (is != null) try { is.close(); } catch(Exception e) {} } } Funny think is that I am getting this behavior only since I've started adding more then one such records to the table. The underlying JDBC library is type 3 (postgresq 8.4-701). Can someone give me a hint as to how to solve this issue? Thanks Peter

    Read the article

  • [numpy] storing record arrays in object arrays

    - by Peter Prettenhofer
    I'd like to convert a list of record arrays -- dtype is (uint32, float32) -- into a numpy array of dtype np.object: X = np.array(instances, dtype = np.object) where instances is a list of arrays with data type np.dtype([('f0', '<u4'), ('f1', '<f4')]). However, the above statement results in an array whose elements are also of type np.object: X[0] array([(67111L, 1.0), (104242L, 1.0)], dtype=object) Does anybody know why? The following statement should be equivalent to the above but gives the desired result: X = np.empty((len(instances),), dtype = np.object) X[:] = instances X[0] array([(67111L, 1.0), (104242L, 1.0), dtype=[('f0', '<u4'), ('f1', '<f4')]) thanks & best regards, peter

    Read the article

  • Compile and optimize for different target architectures

    - by Peter Smit
    Summary: I want to take advantage of compiler optimizations and processor instruction sets, but still have a portable application (running on different processors). Normally I could indeed compile 5 times and let the user choose the right one to run. My question is: how can I can automate this, so that the processor is detected at runtime and the right executable is executed without the user having to chose it? I have an application with a lot of low level math calculations. These calculations will typically run for a long time. I would like to take advantage of as much optimization as possible, preferably also of (not always supported) instruction sets. On the other hand I would like my application to be portable and easy to use (so I would not like to compile 5 different versions and let the user choose). Is there a possibility to compile 5 different versions of my code and run dynamically the most optimized version that's possible at execution time? With 5 different versions I mean with different instruction sets and different optimizations for processors. I don't care about the size of the application. At this moment I'm using gcc on Linux (my code is in C++), but I'm also interested in this for the Intel compiler and for the MinGW compiler for compilation to Windows. The executable doesn't have to be able to run on different OS'es, but ideally there would be something possible with automatically selecting 32 bit and 64 bit as well. Edit: Please give clear pointers how to do it, preferably with small code examples or links to explanations. From my point of view I need a super generic solution, which is applicable on any random C++ project I have later. Edit I assigned the bounty to ShuggyCoUk, he had a great number of pointers to look out for. I would have liked to split it between multiple answers but that is not possible. I'm not having this implemented yet, so the question is still 'open'! Please, still add and/or improve answers, even though there is no bounty to be given anymore. Thanks everybody!

    Read the article

  • How to setup a Zend_Application with an application.ini and a user.ini

    - by Peter Smit
    I am using Zend_Application and it does not feel right that I am mixing in my application.ini both application and user configuration. What I mean with this is the following. For example, my application needs some library classes in the namespace MyApp_ . So in application.ini I put autoloaderNamespaces[] = "MyApp_". This is pure application configuration, no-one except a programmer would change these. On the other hand I put there a database configuration, something that a SysAdmin would change. My idea is that I would split options between an application.ini and an user.ini, where the options in user.ini take preference (so I can define standard values in application.ini). Is this a good idea? How can I best implement this? The idea's I have are Extending Zend_Application to take multiple config files Making an init function in my Bootstrap loading the user.ini Parsing the config files in my index.php and pass these to Zend_Application (sounds ugly) What shall I do? I would like to have the 'cleanest' solution, which is prepared for the future (newer ZF versions, and other developers working on the same app)

    Read the article

  • How should I use random.jumpahead in Python

    - by Peter Smit
    I have a application that does a certain experiment 1000 times (multi-threaded, so that multiple experiments are done at the same time). Every experiment needs appr. 50.000 random.random() calls. What is the best approach to get this really random. I could copy a random object to every experiment and do than a jumpahead of 50.000 * expid. The documentation suggests that jumpahead(1) already scrambles the state, but is that really true? Or is there another way to do this in 'the best way'? (No, the random numbers are not used for security, but for a metropolis hasting algorithm. The only requirement is that the experiments are independent, not whether the random sequence is somehow predictable or so)

    Read the article

  • Subsonic in a VS2008 Add-In woes

    - by Michael Smit
    Hi, I am writing a VS2008 add-in that connects to a remote database blah blah. I am having a problem with the app.config in this project. When I use SubSonic in my code, it moans that is cannot find the SubSonicServer section. This is because the .config file cannot be found. This appears to a problem with paths as the add-in is a DLL running in the context of VS2008 and the working directory is C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE. Is there a way to get the app.config to deploy properly with the application so my add-in (and SubSonic) can find what it needs in the .config file, or is there a way to get SubSonic to work without the need for the .config? I am very experienced in SubSonic projects now, but only winforms, web, web service, and WPF applications. This is the first time I have tried to use SubSonic in a VS2008 Add-In project. I also have AppSettings in the config file which the ConfigurationManager cannot read because it cannot see the .config file. 2AM now and brain is tired of trying to figure this one out. Hopefully there is an answer when I wake up :) TIA

    Read the article

  • How to set Atomikos to not write to console logs?

    - by peter
    Atomikos is quite verbose when used. There seems to be lots of INFO messages (mostly irrelevant for me) that the transaction manager writes out to the console. The setting in the transaction.properties that is suppose to control the level of messaging com.atomikos.icatch.console_log_level does not seem to have any effect, since even when set to WARN (or ERROR) the INFO messages are still logged. Also the log4j settings for com.atomikos and atomikos seem to be ignored. Does anyone manage to turn off the INFO logs on the console with Atomikos?. How? Thanks Peter

    Read the article

  • what's the story with the android XML namespace?

    - by Peter vdL
    When you first use a name from the android XML namespace, you have to say where to find it, with an attribute in XML like this: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" However, that URL is a 404 - nothing found there. The android: namespace is actually included under the locally-installed SDK. So what's going on here? Why do I need to include a dead URL? Why doesn't the build system pick it up from the SDK like all the other libraries? Thanks, just looking for the back story on this. Peter

    Read the article

  • How to post Arabic characters in PHP

    - by Peter Stuart
    Okay, So I am writing an OpenCart extension that must allow Arabic characters when posting data. Whenever I post ????? the print_r($_POST) returns with this: u0645u0631u062du0628u0627 I check the HTML header and it has this: <meta charset="UTF-8" /> I checked the PHP file that triggers all SQL queries and it has this code: mysql_query("SET NAMES 'utf8'", $this->link); mysql_query("SET CHARACTER SET utf8", $this->link); mysql_query("SET CHARACTER_SET_CONNECTION=utf8", $this->link); This is in my form tag: <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form" accept-charset="utf-8"> I can't think of what else I am doing wrong. The rest of the OpenCart framework supports UTF8 and arabic characters. It is just in this instance where I can't post anything arabic? Could someone please help me? Many Thanks Peter

    Read the article

  • C#: How to Make it Harder for Hacker/Cracker to Get Around or Bypass the Licensing Check?

    - by Peter Lee
    Hi all, Suppose that the user has saved the License file under the Application.StartupPath, where all users can read. And then, every time when the app starts, it will check if it can find and verify the license file. If the app can find and verify, we let the user to continue with full functinalities. If not, we prompt a MessageBox showing "Unlicencsed, continue to use with trial version, functionalities limited." My question is, if I'm a hacker/cracker, I would try to get around or bypass the licensing check instead of cracking the license file, because, if we use RSA signature, it's very difficult to crack a license file. So where should we put the license check? thanks. Merry Christmas and Happy New Year! Peter P.S.: and also, is it safe if I put a global variable IsLicensed (true / false) to limit the functionalities? Is it easy for a hacker to change IsLicensed = true?

    Read the article

  • WPF Validation of clipboard Data

    - by Peter
    Hello normal validation is always related to some control, but in my case there is no control to fire validation when its content changes and to show errortemplate to the user. because the data to be validated is in the cipboard. when the user presses "PASTE" button viewmodel processes the data and finds it to be invalid. but what is the best way to invoke WPF validation in this case? as far as i understand using IDataErrorInfo is the way to go, but what is the best way to start validation. and whst is the best way of displaying the error? errortemplate of the button element? Thanks a lot for help. Peter

    Read the article

  • Ubuntu Eye-Infinity across 3 displays

    - by Peter G Mac.
    So I purchased a computer recently and have been trying to customise the display. Radeon 6800 series Ubuntu 10.10 I have three 22inch 1080P lcd monitors that are mounted together. Everything is working smooth. How do I get the 'big-desktop' display where I have one enormous display across all monitors? Linux - ATI Catalyst Control Center 11.2 does not give me an option to 'group' my profiles like the pictures on their site show with Windows. I have been searching all over for help. Much Obliged, -Peter

    Read the article

  • quick check on use of map api (android)

    - by Peter vdL
    When you use the Google map api, it is not part of the Android SDK, and you have to mention it in your manifest xml file. Do you have to do anything to access the jar file containing the map api code? Or is that automatically present on the device or emulator, the way the SDK code is? Do you need put the map api jar file in your class path, either when compiling or when executing? Or is it kept somewhere where it is already visible, and the requirement of an XML mention is merely to remind you of the licensing issue? Thanks, Peter

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >