Search Results

Search found 1163 results on 47 pages for 'nick rtz'.

Page 29/47 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • J2EE: Default values for custom tag attributes

    - by Nick
    So according to Sun's J2EE documentation (http://docs.sun.com/app/docs/doc/819-3669/bnani?l=en&a=view), "If a tag attribute is not required, a tag handler should provide a default value." My question is how in the hell do I define a default value as per the documentation's description. Here's the code: <%@ attribute name="visible" required="false" type="java.lang.Boolean" %> <c:if test="${visible}"> My Tag Contents Here </c:if> Obviously, this tag won't compile because it's lacking the tag directive and the core library import. My point is that I want the "visible" property to default to TRUE. The "tag attribute is not required," so the "tag handler should provide a default value." I want to provide a default value, so what am I missing? Any help is greatly appreciated.

    Read the article

  • Lexing newlines in scala StdLexical?

    - by Nick Fortescue
    I'm trying to lex (then parse) a C like language. In C there are preprocessor directives where line breaks are significant, then the actual code where they are just whitespace. One way of doing this would be do a two pass process like early C compilers - have a separate preprocessor for the # directives, then lex the output of that. However, I wondered if it was possible to do it in a single lexer. I'm pretty happy with writing the scala parser-combinator code, but I'm not so sure of how StdLexical handles whitespace. Could someone write some simple sample code which say could lex a #include line (using the newline) and some trivial code (ignoring the newline)? Or is this not possible, and it is better to go with the 2-pass appproach?

    Read the article

  • How to do timer with Nios II assembly?

    - by Nick Rosencrantz
    I've got an assignment in a computer engineering course that I don't fully understand since it is so large. Anyway I started coding the parts of it and it seems we should make code for some sort of timer. I've started put together the subroutine for snaptime but I'm not sure what I want: .equ timer, 0x920 .global snaptime .text .align 2 snaptime: movia r8,timer # basadressen till timern stw r0,12(r8) # sparar 0 till snapl movi r9,0b0110 # spara 6 i r9 stw r9,16(r8) # spara r9 movi ... ? andi r10,r10,0xFFFF The manual for Nios II assembly is here and the C code for what I'm trying to do is: #define TIMER_1_BASE ((volatile unsigned int*) 0x920) int snaptime (void) { int snaphight; int snaplow; int snap; TIMER_1_BASE[4]=0; snaphigh = TIMER_1_BASE[5] & 0xffffff; snaplow = TIMER_1_BASE[4] & 0xffffff; snap = snaphigh*65536+snaplow; return (snap); } Perhaps you can inspect the C which should be properly defined and see how I make it with assembly since the spec says it should be assembly.

    Read the article

  • Scala newbie vproducer/consumer attempt running out of memory

    - by Nick
    I am trying to create a producer/consumer type Scala app. The LoopControl just sends a message to the MessageReceiver continually. The MessageReceiver then delegates work to the MessageCreatorActor (whose work is to check a map for an object, and if not found create one and start it up). Each MessageActor created by this MessageCreatorActor is associated with an Id. Eventually this is where I want to do business logic. But I run out of memory after 15 minutes. Its finding the cached actors,but quickly runs out of memory. Any help is appreciated. Or any one has any good code on producers consumers doing real stuff (not just adding numbers), please post. import scala.actors.Actor import java.util.HashMap import scala.actors.Actor._ case object LoopControl case object MessageReceiver case object MessageActor case object MessageActorCreator class MessageReceiver(msg: String) extends Actor { var messageActorMap = new HashMap[String, MessageActor] val messageCreatorActor = new MessageActorCreator(null, null) def act() { messageCreatorActor.start loop { react { case MessageActor(messageId) => if (msg.length() > 0) { var messageActor = messageActorMap.get(messageId); if(messageActor == null) { messageCreatorActor ! MessageActorCreator(messageId, messageActorMap) }else { messageActor ! MessageActor } } } } } } case class MessageActorCreator(msg:String, messageActorMap: HashMap[String, MessageActor]) extends Actor { def act() { loop { react { case MessageActorCreator(messageId, messageActorMap) => if(messageId != null ) { var messageActor = new MessageActor(messageId); messageActorMap.put(messageId, messageActor) println(messageActorMap) messageActor.start messageActor ! MessageActor } } } } } class LoopControl(messageReceiver:MessageReceiver) extends Actor { var count : Int = 0; def act() { while (true) { messageReceiver ! MessageActor ("00-122-0X95-FEC0" + count) //Thread.sleep(100) count = count +1; if(count > 5) { count = 0; } } } } case class MessageActor(msg: String) extends Actor { def act() { loop { react { case MessageActor => println() println("MessageActor: Got something-> " + msg) } } } } object messages extends Application { val messageReceiver = new MessageReceiver("bootstrap") val loopControl = new LoopControl(messageReceiver) messageReceiver.start loopControl.start }

    Read the article

  • Why '.png' files produced by ImageMagick are so much bigger than '.jpg' & '.gif' files?

    - by Nick Gorbikoff
    Hello. I'm using ImageMagick to convert some files from one format to another. I was always under the impression that .png files were supposed to be as big/small as .jpg if not smaller, and definitely smaller than .gif. However when I run convert photo.jpg photo.png The files I'm getting out is about 6 times bigger than the original jpg. Original jpg is a regular photo about 300x500 px, 52 kb. Output is a proper png of the same dimensions, but size is about 307 kb? Does anyoone know what the hack is going on? Am I doing something wrong? P.S.: I tried both on Debian and Windows with the same results.

    Read the article

  • What version of DataAnnotations is included with ASP.NET MVC 2 RTM

    - by Nick Thoresby
    I'm working on a project using Visual Studio 2008 and have moved from the the MVC 2 Preview to RTM version. We would like to use model validation such as: public class ViewModel { [Required(ErrorMessage="UserName is required.")] [StringLength(10, ErrorMessage="UserName cannot be greater than 10 chars.")] public string UserName { get; set; } } [HttpPost] public ActionResult Register(ViewModel model) { if (ModelState.IsValid){} // Always true } However the ModelState.IsValid always returns true. I have a suspicion that it might be something to do with the version of System.ComponentModel.DataAnnotations.dll that we are referencing, currently version 99.0.0.0, which seems rather odd. Does anyone know what version of this dll is included with the MVC 2 RTM for Visual Studio 2008?

    Read the article

  • Which Maven Glassfish plugin to use?

    - by Nick Klauer
    I've been trying to integrate deploying java .war's in Glassfish V3 through Maven. While I have found a few plugins, none of them look to be very active: Maven Glassfish Plugin Eskato's Wordpress Blog on Maven And I got the most information out of Eskato's Blog, it was written March 2008, so I don't know what the state of Glassfish Maven integration is, nor can I find a suitable plugin to work with. With the Maven Glassfish Plugin I have had some success, but it still doesn't work entirely well for all goals it says it supports, which makes some of the commands ineffective. Has anyone else been able to integrate Glassfish V3 and Maven successfully? If so, what resources did you use to get it done?

    Read the article

  • Parse string to create a list of element

    - by Nick
    I have a string like this: "\r color=\"red\" name=\"Jon\" \t\n depth=\"8.26\" " And I want to parse this string and create a std::list of this object: class data { std::string name; std::string value; }; Where for example: name = color value = red What is the fastest way? I can use boost. EDIT: This is what i've tried: vector<string> tokens; split(tokens, str, is_any_of(" \t\f\v\n\r")); if(tokens.size() > 1) { list<data> attr; for_each(tokens.begin(), tokens.end(), [&attr](const string& token) { if(token.empty() || !contains(token, "=")) return; vector<string> tokens; split(tokens, token, is_any_of("=")); erase_all(tokens[1], "\""); attr.push_back(data(tokens[0], tokens[1])); } ); } But it does not work if there are spaces inside " ": like color="red 1".

    Read the article

  • Recursive Binary Search Tree Insert

    - by Nick Sinklier
    So this is my first java program, but I've done c++ for a few years. I wrote what I think should work, but in fact it does not. So I had a stipulation of having to write a method for this call: tree.insertNode(value); where value is an int. I wanted to write it recursively, for obvious reasons, so I had to do a work around: public void insertNode(int key) { Node temp = new Node(key); if(root == null) root = temp; else insertNode(temp); } public void insertNode(Node temp) { if(root == null) root = temp; else if(temp.getKey() <= root.getKey()) insertNode(root.getLeft()); else insertNode(root.getRight()); } Thanks for any advice.

    Read the article

  • Printing to different printers using mozilla.

    - by Nick-ACNB
    I am currently creating a web application that will be deployed in an intranet environment. I chose firefox to be the browser that will run it. However, in the application I am building, I need to be able to print to different printers quickly since they use different paper size depending on what client is coming. To avoid many time-wasting mistakes that could occur, for instance someone choosing the wrong printer and wasting paper. Also, the time used to find the right printer for the job and then pressing print is considered too long in the current context. Is there any solution to this problem? I understand the potential security flaw behind this, but please be aware that this is solely an intranet project and that I can reduce the browser's security to the lowest since they don't access internet. I know there could be something doable behind IE (ActiveX or VBScript) but I am using firefox. Also, I guess there could also be something rather tricky that when you press print on the browser, it saves what needs to be printed to a DB and then there is an exe app that runs and fetch that DB every set ammount of time and print to the right printer. Any suggestion would be greatly appreciated. I doubt I am the only one to ever face this issue! :) Thank you very much.

    Read the article

  • Should I include the binary in a Rails plugin or not?

    - by Nick Gorbikoff
    Hello. I'm trying to roll out a little Rails plugin that is basically is just a wrapper to a 7zip archiver. Should I include the 7zip binaries for windows, mac and linux with it or explain to user that it's a dependency and they need to get it working. I know it's not that difficult to install a 7zip, but what is the best practice in general. The reason I'm asking is cause I've ran so many times into gems that need some sort of dependency that doesn't compile properly or is not available in ready form for the OS in question and then I end up spending have a day hunting down for a binary or a way to compile the program. (Have happened to me both on Mac and Windows, not on Debian so far. )

    Read the article

  • Python's asyncore to periodically send data using a variable timeout. Is there a better way?

    - by Nick Sonneveld
    I wanted to write a server that a client could connect to and receive periodic updates without having to poll. The problem I have experienced with asyncore is that if you do not return true when dispatcher.writable() is called, you have to wait until after the asyncore.loop has timed out (default is 30s). The two ways I have tried to work around this is 1) reduce timeout to a low value or 2) query connections for when they will next update and generate an adequate timeout value. However if you refer to 'Select Law' in 'man 2 select_tut', it states, "You should always try to use select() without a timeout." Is there a better way to do this? Twisted maybe? I wanted to try and avoid extra threads. I'll include the variable timeout example here: #!/usr/bin/python import time import socket import asyncore # in seconds UPDATE_PERIOD = 4.0 class Channel(asyncore.dispatcher): def __init__(self, sock, sck_map): asyncore.dispatcher.__init__(self, sock=sock, map=sck_map) self.last_update = 0.0 # should update immediately self.send_buf = '' self.recv_buf = '' def writable(self): return len(self.send_buf) > 0 def handle_write(self): nbytes = self.send(self.send_buf) self.send_buf = self.send_buf[nbytes:] def handle_read(self): print 'read' print 'recv:', self.recv(4096) def handle_close(self): print 'close' self.close() # added for variable timeout def update(self): if time.time() >= self.next_update(): self.send_buf += 'hello %f\n'%(time.time()) self.last_update = time.time() def next_update(self): return self.last_update + UPDATE_PERIOD class Server(asyncore.dispatcher): def __init__(self, port, sck_map): asyncore.dispatcher.__init__(self, map=sck_map) self.port = port self.sck_map = sck_map self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.bind( ("", port)) self.listen(16) print "listening on port", self.port def handle_accept(self): (conn, addr) = self.accept() Channel(sock=conn, sck_map=self.sck_map) # added for variable timeout def update(self): pass def next_update(self): return None sck_map = {} server = Server(9090, sck_map) while True: next_update = time.time() + 30.0 for c in sck_map.values(): c.update() # <-- fill write buffers n = c.next_update() #print 'n:',n if n is not None: next_update = min(next_update, n) _timeout = max(0.1, next_update - time.time()) asyncore.loop(timeout=_timeout, count=1, map=sck_map)

    Read the article

  • Escape doube and single backslashes in a string in Ruby

    - by Nick Gorbikoff
    Hello. I'm trying to access a network path in my ruby script on a windows platform in a format like this. \\servername\some windows share\folder 1\folder2\ Now If I try to use this as a path, it won't work. Single backslashes are not properly escaped for this script. path = "\\servername\some windows share\folder 1\folder2\" d = Dir.new(path) I tried everything I could think of to properly escape slashes in the path. However I can't escape that single backslash - because of it's special meaning. I tried single quotes, double quotes, escaping backslash itself, using alternate quotes such as %Q{} or %q{}, using ascii to char conversion. Nothing works in a sense that I'm not doing it right. :-) Right now the temp solution is to Map a network drive N:\ pointing to that path and access it that way, but that not a solution. Does anyone have any idea how to properly escape single backslashes? Thank you

    Read the article

  • what is wrong: "value Parsers is not a member of package scala.util.parsing.combinator"?

    - by Nick Fortescue
    I've got the above odd error message that I don't understand "value Parsers is not a member of package scala.util.parsing.combinator". I'm trying to learn Parser combinators by writing a C parser step by step. I started at token, so I have the classes: import util.parsing.combinator.JavaTokenParsers object CeeParser extends JavaTokenParsers { def token: Parser[CeeExpr] = ident } abstract class CeeExpr case class Token(name: String) extends CeeExpr This is as simple as I could make it. The code below works fine, but if I uncomment the commented line I get the error message given above: object Play { def main(args: Array[String]) { //val parser: _root_.scala.util.parsing.combinator.Parsers.Parser[CeeExpr] CeeParser.token val x = CeeParser.token print(x) } } In case it is a problem with my setup, I'm using scala 2.7.6 via the scala-plugin for intellij. Can anyone shed any light on this? The message is wrong, Parsers is a member of scala.util.parsing.combinator.

    Read the article

  • Parsing a simple XML from string in Cocoa?

    - by Nick Brooks
    I have a simple XML and I need to get the first 'id' from puid-list. I found lots of examples but none of them quite do that because of the namespace. How do get the id out as an NSString? <genpuid songs="1" xmlns:mip="http://musicip.com/ns/mip-1.0#"> <track file="/htdocs/test.mp3" puid="0c9f2f0e-e72a-c461-9b9a-e18e8964ca20"> <puid-list> <puid id="0c9f2f0e-e72a-c461-9b9a-e18e8964ca20"/> </puid-list> </track> </genpuid>

    Read the article

  • How to use dirent.h correctly.

    - by Nick
    Hello, I am new to C++ and I am experimenting with the dirent.h header to manipulate directory entries. The following little app compiles but pukes after you supple a directory name. Can someone give me a hint? The int quit is there to provide a while loop. I removed the loop in an attempt to isolate my problem. thanks! #include <iostream> #include <dirent.h> using namespace std; int main() { char *dirname = 0; DIR *pd = 0; struct dirent *pdirent = 0; int quit = 1; cout<< "Enter a directory path to open (leave blank to quit):\n"; cin >> dirname; if(dirname == NULL) { quit = 0; } pd = opendir(dirname); if(pd == NULL) { cout << "ERROR: Please provide a valid directory path.\n"; } return 0; }

    Read the article

  • Closing inputstreams

    - by Nick
    I have the below code to read from a URL object: URL url= new URL("http://datasource.com"); BufferedReader reader = new BufferedReader( new InputStreamReader(url.openStream())); After I am done getting the data, is this sufficient to close and release all the resrouces: reader.close(); I did not see a method for URL to close it, like URL.close()...but wondering if I shouldn't do something more like this: InputStreamReader inputStreamReader = new InputStreamReader(url.openStream()); BufferedReader reader = new BufferedReader(inputStreamReader); // Do Stuff inputStreamReader.close(); reader.close();

    Read the article

  • Deploying EAR file in Sun App Server having problem with proxy server setttings

    - by Nick Long
    When I am deploying certain vendor EAR file to Sun App Server, I encountered a connection timeout errror. I thought the reason might be proxy settings need to be defined so I actually defined the following -Dhttp.proxyHost=hostname -Dhttp.proxyPassword=password -Dhttp.proxyPort=8080 -Dhttp.proxyUser=username After setting these and restart domain then redeploy I encountered 407 error. Anyone have any idea what could be the issue here?

    Read the article

  • Control the size of points in an R scatterplot?

    - by Nick
    In R, the plot() function takes a pch argument that controls the appearance of the points in the plot. I'm making scatterplots with tens of thousands of points and prefer a small, but not too small dot. Basically, I find pch='.' to be too small, but pch=19 to be too fat. Is there something in the middle or some way to scale the dots down somehow?

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >