Search Results

Search found 1077 results on 44 pages for 'bill paetzke'.

Page 18/44 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Is there an equivalent to Lisp's "runtime" primitive in Scheme?

    - by Bill the Lizard
    According to SICP section 1.2.6, exercise 1.22: Most Lisp implementations include a primitive called runtime that returns an integer that specifies the amount of time the system has been running (measured, for example, in microseconds). I'm using DrScheme, where runtime doesn't seem to be available, so I'm looking for a good substitute. I found in the PLT-Scheme Reference that there is a current-milliseconds primitive. Does anyone know if there's a timer in Scheme with better resolution?

    Read the article

  • ANSI C blackjack assignment, linux GCC compiler, i'm stuck...

    - by Bill Adams
    Here's what i have so far... I have yet to figure out how i'm going to handle the 11 / 1 situation with an ace, and when the player chooses an option for hit/stand, i get segfault. HELP!!! #include <stdio.h> #include <string.h> #include <stdlib.h> #include <time.h> #define DECKSIZE 52 #define VALUE 9 #define FACE 4 #define HANDSIZE 26 typedef struct { int value; char* suit; char* name; }Card; typedef struct { int value; char* suit; char* name; }dealerHand; typedef struct { int value; char* suit; char* name; }playerHand; Card cards[DECKSIZE]; dealerHand deal[HANDSIZE]; playerHand dealt[HANDSIZE]; char *faceName[]={"two","three", "four","five","six", "seven","eight","nine", "ten", "jack","queen", "king","ace"}; char *suitName[]={"spades","diamonds","clubs","hearts"}; void printDeck(){ int i; for(i=0;i<DECKSIZE;i++){ printf("%s of %s value = %d\n ",cards[i].name,cards[i].suit,cards[i].value); if((i+1)%13==0 && i!=0) printf("-------------------\n\n"); } } void shuffleDeck(){ srand(time(NULL)); int this; int that; Card temp; int c; for(c=0;c<10000;c++){ //c is the index for number of individual card shuffles should be set to c<10000 or more this=rand()%DECKSIZE; that=rand()%DECKSIZE; temp=cards[this]; cards[this]=cards[that]; cards[that]=temp; } } /*void hitStand(i,y){ // I dumped this because of a segfault i couldn't figure out. int k; printf(" Press 1 to HIT or press 2 to STAND:"); scanf("%d",k); if(k=1){ dealt[y].suit=cards[i].suit; dealt[y].name=cards[i].name; dealt[y].value=cards[i].value; y++; i++; } } */ int main(){ int suitCount=0; int faceCount=0; int i; int x; int y; int d; int p; int k; for(i=0;i<DECKSIZE;i++){ //this for statement builds the deck if(faceCount<9){ cards[i].value=faceCount+2; }else{ //assigns face cards as value 10 cards[i].value=10; } cards[i].suit=suitName[suitCount]; cards[i].name=faceName[faceCount++]; if(faceCount==13){ //this if loop increments suit count once cards[i].value=11; //all faces have been assigned, and also suitCount++; //assigns the ace as 11 faceCount=0; } //end building deck } /*printDeck(); //prints the deck in order shuffleDeck(); //shuffles the deck printDeck(); //prints the deck as shuffled This was used in testing, commented out to keep the deck hidden!*/ shuffleDeck(); x=0; y=0; for(i=0;i<4;i++){ //this for loop deals the first 4 cards, dealt[y].suit=cards[i].suit; //first card to player, second to dealer, dealt[y].name=cards[i].name; //as per standard dealing practice. dealt[y].value=cards[i].value; i++; y++; deal[x].suit=cards[i].suit; deal[x].name=cards[i].name; deal[x].value=cards[i].value; x++; } printf(" Dealer's hand is: %s of %s and XXXX of XXXX. (Second card is hidden!)\n",deal[0].name,deal[0].suit,deal[1].name,deal[1].suit); printf(" Player's hand is: %s of %s and %s of %s.\n",dealt[0].name,dealt[0].suit,dealt[1].name,dealt[1].suit); printf(" the current value of the index i=%d\n",i); //this line gave me the value of i for testing d=deal[0].value+deal[1].value; p=dealt[0].value+dealt[1].value; if(d==21){ printf(" The Dealer has Blackjack! House win!\n"); }else{ if(d>21){ printf(" The dealer is Bust! You win!\n"); }else{ if(d>17){ printf(" Press 1 to HIT or 2 to STAND"); scanf("%d",k); if(k==1){ dealt[y].suit=cards[i].suit; dealt[y].name=cards[i].name; dealt[y].value=cards[i].value; y++; i++; } }else{ if(d<17){ printf(" Dealer Hits!"); deal[x].suit=cards[i].suit; deal[x].name=cards[i].name; deal[x].value=cards[i].value; x++; i++; } } } } return 0; }

    Read the article

  • How do php apps identify a user after the session has timed out?

    - by Bill Zimmerman
    I am trying to understand how PHP apps check to see if a user is logged in. I am specifically looking at mediawiki's code to try to help me understand, but these cases should be fairly common in all php apps. From what I gather, the main cases are: A user just logged in or was created, every time they visit the page PHP knows its them by checking data common to the $_SESSION variable and the cookie. A user had the 'remember me' option checked on the login page a long time ago. They have a cookie on there computer with a tokenID, which is checked with a token on the server to authenticate them. In this case, there is no session variable, because the time between accesses could be weeks. My question is, what happens when a user is logged in, but the PHP session times out and he wants to access a page? I would have assumed that there is no easy way for the server to know who the person is - and that they would have to be redirected to the login page. However, mediawiki does just that. I've verified that the session files are deleted after X minutes, but when I hit refresh in mediawiki, it knows which user I am, and the 'token' variable is not included in the cookie.

    Read the article

  • How can I browse source code on an iPhone?

    - by Bill
    I have a lot of downtime on the subway each morning and evening, and I'd like to be able to review source code for various projects I'm working on. Are there any apps that can help with this? I'd like something that lets me browse a hierarchical tree of source files and that does syntax highlighting.

    Read the article

  • Ending php sessions for debugging purposes

    - by Bill Zimmerman
    Hi, This might be very easy to do, but I haven't been able to figure it out. Basically, I have a loosely couple web-app written in python and php. The python code uses PHP sessions (generated from the PHP app when the user logs in) to check if the user is logged in/has permission to access the given python resource. My question is this: What is the easiest way to force all active sessions to timeout. I would like to do this for debugging purposes, to test out the python code. I tried changing the session.max_lifetime PHP variable, but that still doesn't guarantee that the session has ended and is removed. I tried just deleting the file, but this seems to cause problems (when i refresh the php page, errors show up in my apache logs and it won't reload quickly) Any ideas?

    Read the article

  • Colorbox with bxslider not working

    - by Bill K
    Hello I am trying to use bxslider with colorbox. My implementation of bxslider is like an example listed here. The difference is that I want only the pagers to be shown. Also when the user clicks one pager I want colorbox to open and have next and previous buttons. The problem is that I cant group the images with colorbox and next and previous button is not shown! The following code uses the rel option but with this way colorbox doesnt event start. What I have tried till now is: HTML <div class="slider_mini" style="position:relative;bottom:0px;"> <div id="bx-pager"> <a data-slide-index="0" href="image.jpg" class="imgz"><img style="width:130px;height:104px;" src="image.jpg"/></a> <a data-slide-index="1" href="image2.jpg" class="imgz"><img style="width:130px;height:104px;" src="image2.jpg"/></a> <a data-slide-index="2" href="image3.jpg" class="imgz"><img style="width:130px;height:104px;" src="image3.jpg"/></a> </div> </div> SCRIPT <script type="text/javascript"> $(document).ready(function(){ $('.imgz').colorbox({rel:'imgz'}); $('.bxslider.two').bxSlider({ pagerCustom: '#bx-pager' }); $('#bx-pager').bxSlider({ slideWidth: 130, minSlides: 2, maxSlides: 3, moveSlides: 1, slideMargin: 10 }); }); </script> Not working Fiddle. Feedback: The problem was in live website that I was calling colorbox before bxslider. I put the call after bxslider's and it works. Thank you.

    Read the article

  • SimpleModal -- Open OnLoad

    - by Bill Griffith
    I'm new to JQuery -- not new to javascript. Was able to open the OSX STYLE DIALOG using the hyperlink button provided in the demo index.html page, but would like to open it on the page load. I read a couple links on StackOverflow (http://stackoverflow.com/questions/1611727/how-do-i-invoke-a-simplemodal-osx-dialog-on-page-load), but still could not get it to work in the exact same index.html page. I finally resorted to a stopgap measure by programmatically invoking the button click of a hidden button element -- see following fragment: onLoad="document.getElementById('load_OSX_Example').click();"> <input type="hidden" id="load_OSX_Example" value="" class='osx'> <script type="text/javascript" language="javascript"> //#### open the OSX Modal ########## $(document).ready(function(){ $("#osx-modal-content").modal(); }); </script> So I have two questions: How can you invoke the class='osx' using javascript/html programmatically? Why won't this work using the $("#osx-modal-content").modal(); call in javascript (see fragment above)? I tried this in multiple browsers, and the only content that displayed on the screen was content of this tag: "div id="osx-modal-title", and there was no error in the jscript console.

    Read the article

  • How do laziness and I/O work together in Haskell?

    - by Bill
    I'm trying to get a deeper understanding of laziness in Haskell. I was imagining the following snippet today: data Image = Image { name :: String, pixels :: String } image :: String -> IO Image image path = Image path <$> readFile path The appeal here is that I could simply create an Image instance and pass it around; if I need the image data it would be read lazily - if not, the time and memory cost of reading the file would be avoided: main = do image <- image "file" putStrLn $ length $ pixels image But is that how it actually works? How is laziness compatible with IO? Will readFile be called regardless of whether I access pixels image or will the runtime leave that thunk unevaluated if I never refer to it? If the image is indeed read lazily, then isn't it possible I/O actions could occur out of order? For example, what if immediately after calling image I delete the file? Now the putStrLn call will find nothing when it tries to read.

    Read the article

  • How do I use SimpleRepository without the migration approach?

    - by Bill Sempf
    I am evaluating SubSonic for use in Phase 2 of a large project. This is an ASP.NET project, with 700 tables in a SQL Server database. We are planning for our domain model to consist of POCO classes to assist with an offline access requirements we have. I believe that the SimpleRepository pattern would be among my best options. Since I have a database already, however, the migration assistance doesn't help me. Are there T4 templates for SimpleRepository that I just overlooked? How do I 'turn off' migration? If I missed something in the Wiki, point me there, otherwise get me started and I'll write up a Wiki entry for y'all when we get there.

    Read the article

  • i had problem in adding the additional content in my pdf...using asp.net c#

    - by Ayyappan.Anbalagan
    I am converting my data set into a pdf document.My data set contains the product bill details.So,at the top of the pdf i need to added some more content like "my company name & address customer name, date of bill,bill no" Below code i am using to convert into pdf. public static void Exportdata(DataTable dataTable, HttpResponse Response, int val) { //String filename = String.Concat(name, "-", DateTime.Today.Day.ToString(), "/", DateTime.Today.Month.ToString(), "/", DateTime.Today.Year.ToString(), ".pdf"); Document pdfDoc = new Document(PageSize.A4, 30, 30, 40, 25); System.IO.MemoryStream mStream = new System.IO.MemoryStream(); PdfWriter writer = PdfWriter.GetInstance(pdfDoc, mStream); //int cols = 0; //int rows = 0; int cols = dataTable.Columns.Count; int rows = dataTable.Rows.Count; pdfDoc.Open(); iTextSharp.text.Table pdfTable = new iTextSharp.text.Table(cols, rows); pdfTable.BorderWidth = 1; pdfTable.Width = 100; pdfTable.Padding = 1; pdfTable.Spacing = 1; //creating table headers for (int i = 0; i < cols; i++) { Cell cellCols = new Cell(); Font ColFont = FontFactory.GetFont(FontFactory.HELVETICA, 8, Font.BOLD); Chunk chunkCols = new Chunk(dataTable.Columns[i].ColumnName, ColFont); cellCols.Add(chunkCols); pdfTable.AddCell(cellCols); } //creating table data (actual result) for (int k = 0; k < rows; k++) { for (int j = 0; j < cols; j++) { Cell cellRows = new Cell(); Font RowFont = FontFactory.GetFont(FontFactory.HELVETICA, 6); Chunk chunkRows = new Chunk(dataTable.Rows[k][j].ToString(), RowFont); cellRows.Add(chunkRows); pdfTable.AddCell(cellRows); } } pdfDoc.Add(pdfTable); pdfDoc.Close(); Response.ContentType = "application/octet-stream"; if (val == 1) { Response.AddHeader("Content-Disposition", "attachment; filename=Users.pdf"); } else if (val == 2) { Response.AddHeader("Content-Disposition", "attachment; filename=Customers.pdf"); } else if (val == 3) { Response.AddHeader("Content-Disposition", "attachment; filename=Materials.pdf"); } else { Response.AddHeader("Content-Disposition", "attachment; filename=Reports.pdf"); } Response.Clear(); Response.BinaryWrite(mStream.ToArray()); //Response.Write(mStream.ToString()); HttpContext.Current.ApplicationInstance.CompleteRequest(); Response.End(); }

    Read the article

  • JQuery iterating through textboxes and changing its color

    - by bill-nielsen
    I'm trying to iterate through all the empty textboxes in a table and change its background colour. I'm using the following JQuery code: $("#btn2").click(function() { var emptyTextBoxes = $('input:text').filter(function() { return this.value == ""; }); emptyTextBoxes.each(function() { this.css('background-color', '#ffff00'); // $('#Col3Txtbx').css('background-color', '#ffff00'); }); }); This does not seem to refer to the textbox which seems strange to me. When I uncomment out the particular textbox, it does reset the background colour. Can someone explain to me what 'This' is referring to?

    Read the article

  • What's a good Java API for creating Word documents?

    - by Bill James
    I have a new app I'll be working on where I have to generate a Word document that contains tables, graphs, a table of contents and text. What's a good API to use for this? How sure are you that it supports graphs, ToCs, and tables? What are some hidden gotcha's in using them? Some clarifications: I can't output a PDF, they want a Word doc. They're using MS Word 2003 (or 2007), not OpenOffice Application is running on *nix app-server It'd be nice if I could start with a template doc and just fill in some spaces with tables, graphs, etc. Thanks for the help. Edit: Several good answers below, each with their own faults as far as my current situation. Hard to pick a "final answer" from them. Think I'll leave it open, and hope for better solutions to be created. Edit: The OpenOffice UNO project does seem to be closest to what I asked for. While POI is certainly more mainstream, it's too immature for what I want.

    Read the article

  • Help with Role Based Security.

    - by Bill K
    Hello, I'm trying to understand role based security and I have the following method: [PrincipalPermission(SecurityAction.Demand, Role = "Administrators")] static void Test() { //administratos only can call this code } What I wanna do is that only users that are members of the Windows Administrators group can call this code, however, if I do the following, it works: GenericIdentity genericIdentity = new GenericIdentity("test", "test"); GenericPrincipal genericPrincipal = new GenericPrincipal(genericIdentity, new string[] { "Administrators" }); AppDomain.CurrentDomain.SetThreadPrincipal(genericPrincipal); Test(); So, how can I make it work only if the user is in the Administrators windows group? thanks!

    Read the article

  • Processing RSS/RDF via xml.dom.minidom

    - by Bill
    I'm trying to process a delicious rss feed via python. Here's a sample: ... <item rdf:about="http://weblist.me/"> <title>WebList - The Place To Find The Best List On The Web</title> <dc:date>2009-12-24T17:46:14Z</dc:date> <link>http://weblist.me/</link> ... </item> <item rdf:about="http://thumboo.com/"> <title>Thumboo! Free Website Thumbnails and PHP Script to Generate Web Screenshots</title> <dc:date>2006-10-24T18:11:32Z</dc:date> <link>http://thumboo.com/</link> ... The relevant code is: def getText(nodelist): rc = "" for node in nodelist: if node.nodeType == node.TEXT_NODE: rc = rc + node.data return rc dom = xml.dom.minidom.parse(file) items = dom.getElementsByTagName("item") for i in items: title = i.getElementsByTagName("title") print getText(title) I would think this would print out each title, but instead I get basically get blank output. I'm sure I'm doing something stupid wrong, but no idea what?

    Read the article

  • Monads and custom traversal functions in Haskell

    - by Bill
    Given the following simple BST definition: data Tree x = Empty | Leaf x | Node x (Tree x) (Tree x) deriving (Show, Eq) inOrder :: Tree x -> [x] inOrder Empty = [] inOrder (Leaf x) = [x] inOrder (Node root left right) = inOrder left ++ [root] ++ inOrder right I'd like to write an in-order function that can have side effects. I achieved that with: inOrderM :: (Show x, Monad m) => (x -> m a) -> Tree x -> m () inOrderM f (Empty) = return () inOrderM f (Leaf y) = f y >> return () inOrderM f (Node root left right) = inOrderM f left >> f root >> inOrderM f right -- print tree in order to stdout inOrderM print tree This works fine, but it seems repetitive - the same logic is already present in inOrder and my experience with Haskell leads me to believe that I'm probably doing something wrong if I'm writing a similar thing twice. Is there any way that I can write a single function inOrder that can take either pure or monadic functions?

    Read the article

  • jQuery UI datepicker will not display - full code included

    - by Bill Brasky
    I am having trouble displaying the jQuery datepicker as shown here: http://jqueryui.com/demos/datepicker/ I believe I downloaded all of the proper files, but to be certain, I started from scratch and ripped the demo site. Not all of it, but what I believed to be the important parts. The result is no datepicker to be shown and no javascript errors. Here is my full code sample: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" href="http://static.jquery.com/ui/css/base2.css" type="text/css" media="all" /> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css" type="text/css" media="all" /> <link rel="stylesheet" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" type="text/css" media="all" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script type="text/javascript" charset="utf-8" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script> <script type="text/javascript" charset="utf-8"> jQuery(function(){ jQuery("#datepicker").datepicker(); }); </script> </head> <body> <input type="text" id="datepicker" class="hasDatepicker" /> </body> </html> Any help would be very much appreciated. Thanks!

    Read the article

  • Debugging runtime error "Terminating app due to uncaught exception 'NSInternalInconsistencyException

    - by Bill
    I'm going through the Beginning iPhone Development book & stuck in chapter 9. I've spent a few hours trying to debug this error w/o avail: 2010-05-01 19:27:51.361 Nav2[4113:20b] *** Assertion failure in -[UITableView _createPreparedCellForGlobalRow:withIndexPath:], /SourceCache/UIKit/UIKit-984.38/UITableView.m:4709 2010-05-01 19:27:51.362 Nav2[4113:20b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:' 2010-05-01 19:27:51.364 Nav2[4113:20b] Stack: ( ... ) I'm not looking for help w/ the book, but tips for how to debug this error? Can I pin down which of my cellForRowAtIndexPath methods is the problem? And how to inspect the type? Or other things should I look at?

    Read the article

  • In SQL, what's the difference between count(column) and count(*)?

    - by Bill the Lizard
    I have the following query: select column_name, count(column_name) from table group by column_name having count(column_name) > 1; What would be the difference if I replaced all calls to count(column_name) to count(*)? This question was inspired by a previous one. Edit: To clarify the accepted answer (and maybe my question), using count(*) in this case returns an extra row in the result that contains a null and the count of null values in the column.

    Read the article

  • Very long strings as primary keys in a database for caching

    - by Bill Zimmerman
    Hi, I am working on a web app that allows users to create dynamic PDF files based on what they enter into a form (it is not very structured data). The idea is that User 1 enters several words (arbitrary # of words, practically capped of course), for example: A B C D E There is no such string in the database, so I was thinking: Store this string as a primary key in a MySQL database (it could be maybe around 50-100k of text, but usually probably less than 200 words) Generate the PDF file, and create a link to it in the database When the next user requests A B C D E, then I can just serve the file instead of recreating it each time. (simple cache) The PDF is cpu intensive to generate, so I am trying to cache as much as I can... My questions are: Does anyone have any alternative ideas to my approach What will the database performance be like? Is there a better way to design the schema than using the input string as the primary key?

    Read the article

  • What needs checking in for a Grails app?

    - by Bill James
    What parts of a Grails application need to be stored in source-control? Some obvious parts that are needed: grails-app directory test directory web-app directory Now we reach questions like: If we use a Grails plug-in (like gldapo), do we need to check in that plugin? Do Grails plugins install in the Grails directory, or your project? I'm not looking to start a religious war about .project, so please ignore that, but are there any "hidden" project files I need to worry about, along with the plugin issues? Converted to a community wiki, as new versions of Grails have changed some of these solutions, especially as regards plugins.

    Read the article

  • Git fatal: remote end hung up

    - by Bill
    So I thought I had finally got everything setup on Windows ... then ran into this issue. Current setup URL: ssh://user@host:port/myapp.git Already run Putty - and can connect using valid .ppk keys through the ~/.ssh/authorized_keys direct. In Git and TortoiseGIT - I set both to use "plink.exe". Putty works fine - no issues - but when I run that URL into bash I get for a git clone (url) fatal: the remote end hung up expectedly In a cygwin bash terminal - running "ssh user@host" - works no probs at all. Anyone suggest anything?

    Read the article

  • How do I write a constant-space length function in Haskell?

    - by Bill
    The canonical implementation of length :: [a] -> Int is: length [] = 0 length (x:xs) = 1 + length xs which is very beautiful but suffers from stack overflow as it uses linear space. The tail-recursive version: length xs = length' xs 0 where length' [] n = n length' (x:xs) n = length xs (n + 1) doesn't suffer from this problem, but I don't understand how this can run in constant space in a lazy language. Isn't the runtime accumulating numerous (n + 1) thunks as it moves through the list? Shouldn't this function Haskell to consume O(n) space and lead to stack overflow? (if it matters, I'm using GHC)

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >