Search Results

Search found 196 results on 8 pages for 'stan the fart'.

Page 7/8 | < Previous Page | 3 4 5 6 7 8  | Next Page >

  • Revision, Quadratic Time

    - by stan
    I am not sure if you can post revision programming questions in here but i am stuck with some algorithms revision If an algorithm is quadratic it takes time proportional to the number of n^2 ? So if the slides say its almost 1/2 the square of n records is this the same as saying (n^2 * 0.5) Thanks

    Read the article

  • Is it possible to create a throttle function that can take in as parameters another function (that also has parameters), and the time delay

    - by Stan Quinn
    So I've already written a function that works (based on underscores throttle) for functions that don't take in a parameter, but I'd like to make it generic enough to pass in a function with a variable number of parameters. Here's what I have: (function () { var lastTime = new Date().getTime(); function foo() { var newTime = new Date().getTime(); var gap = newTime - lastTime; // Travels up scope chain to use parents lastTime. Function has access to variables declared in the same scope console.log('foo called, gap:' + gap); lastTime = newTime; // Updates lastTime //console.log(x); //x++; } var throttle = function(func, wait) { var result; var timeout = null; // flag updated through closure var previous = 0; // time last run updated through closure return function() { //func, wait, timeout, previous available through scope var now = new Date().getTime(); var remaining = wait - (now - previous); if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(this, arguments); //func is available through closure } return result; }; }; document.addEventListener("scroll", throttle(foo, 1000)); //document.addEventListener("scroll", throttle(foo(5), 2000)); }()); But I'd like to modify foo to foo(x) and get this to work (function () { var lastTime = new Date().getTime(); function foo(x) { var newTime = new Date().getTime(); var gap = newTime - lastTime; // Travels up scope chain to use parents lastTime. Function has access to variables declared in the same scope console.log('foo called, gap:' + gap); lastTime = newTime; // Updates lastTime console.log(x); x++; } var throttle = function(func, wait) { var result; var timeout = null; // flag updated through closure var previous = 0; // time last run updated through closure return function() { //func, wait, timeout, previous available through scope var now = new Date().getTime(); var remaining = wait - (now - previous); if (remaining <= 0) { clearTimeout(timeout); timeout = null; previous = now; result = func.apply(this, arguments); //func is available through closure } return result; }; }; document.addEventListener("scroll", throttle(foo(5), 2000)); }());

    Read the article

  • php - Loop output in two diffrent divs?

    - by Stan
    I want to output my sql rows on each side of a line, without breaking the line. Forexample the html/css code i would like to end up with is something like this: <div id='container'> <div style='float:left;'> Even loops here.. </div> <div id='line' style='float:left;'> </div> <div style='float:right;'> Uneven loops here.. </div> <div style='clear:both;'></div> </div> Is there a way to output the sql rows in two diffrent divs?

    Read the article

  • Python configuration file generator

    - by Stan
    I want to use Python to make a configuration file generator. My roughly idea is feeding input with template files and some XML files with the real settings. Then use the program to generate the real configuration files. I got several questions: Is there any open source configuration generator program? (what could be the keyword), I wonder if there's anything can be added/modified in the design. Does Python have good XML parser module? Is it good idea to use XML file to save the original settings? I've been thinking to use Excel since it's more intuitive to maintain, but harder for program to parse. Not sure how people deal with this. Hope the community can give me some suggestions. Thanks a lot!

    Read the article

  • SQL insert default value

    - by Stan
    Say if I have a table like CREATE TABLE [Message] ( [MessageIdx] [int] IDENTITY (1, 1) NOT NULL , [Message] [varchar] (1024) COLLATE Latin1_General_CI_AS NOT NULL , [ValidUntil] [datetime] NULL , CONSTRAINT [PK_Message] PRIMARY KEY CLUSTERED ( [MessageIdx] ) WITH FILLFACTOR = 90 ON [PRIMARY] ) ON [PRIMARY] GO I am trying to insert value without specify column names explicitly. Below statement causes error. How can I do that? Thanks. set identity_insert caconfig..fxmessage on; insert into message values (DEFAULT,'blah',DEFAULT); set identity_insert caconfig..fxmessage off;

    Read the article

  • Android while getting HTTP response to file how to know it wasn't fully loaded?

    - by Stan
    I'm using this approach to store a big-sized response from server to parse it later: final HttpClient client = new DefaultHttpClient(new BasicHttpParams()); final HttpGet mHttpGetRequest = new HttpGet(strUrl); mHttpGetRequest.setHeader("Content-Type", "application/x-www-form-urlencoded"); FileOutputStream fos = null; try { final HttpResponse response = client.execute(mHttpGetRequest); final StatusLine statusLine = response.getStatusLine(); lastHttpErrorCode = statusLine.getStatusCode(); lastHttpErrorMsg = statusLine.getReasonPhrase(); if (lastHttpErrorCode == 200) { HttpEntity entity = response.getEntity(); fos = new FileOutputStream(reponseFile); entity.writeTo(fos); entity.consumeContent(); fos.flush(); } } catch (ClientProtocolException e) { e.printStackTrace(); lastHttpErrorMsg = e.toString(); return null; } catch (final ParseException e) { e.printStackTrace(); lastHttpErrorMsg = e.toString(); return null; } catch (final UnknownHostException e) { e.printStackTrace(); lastHttpErrorMsg = e.toString(); return null; } catch (IOException e) { e.printStackTrace(); lastHttpErrorMsg = e.toString(); } finally{ if (fos!=null) try{ fos.close(); } catch (IOException e){} } now how could I ensure the response was completely received and thus saved to file? Assume client's device lost Internet connection while this code was running. So the app received only some part of real response. And I'm pretty sure it happens cuz I got parsing exceptions like "tag not closed", "unexpected end of file" etc. So I need to detect somehow this situation to prevent code from parsing partial response but can't see how. Is it possible at all and how to do it? Or has it has to raise IOException in such cases?

    Read the article

  • Return the difference between the lowest and highest key

    - by stan
    This is a past exam paper i am attempting and have no way to check if the out put is correct as i am not capable of building one of these things the question is in the title class Tree{ Tree left; Tree right; int key; public static int span(Tree tree) { if ( tree == null ){ return null; } if( tree.left != null) int min = span(tree.left); } if( tree.right != null){ int max = span(tree.right); } return max - min; } } Could anyone suggest what i need to change to get 5/5 marks :D - the only thing we have to do is write the span method, the header was given for us Thanks

    Read the article

  • What is preventing me from upgrading / installing Fixefox extensions?

    - by Josh
    I am trying to install a Firefox extension into Firefox 3.6.13 under OS X 10.5.8, and I keep getting an error message: Firefox could not install the file at because: Download error -228 I have read this and found it unhelpful. My cache is 500 MB and ~/Library/Caches/TemporaryItems is writable: [jnet@Stan ~]$ ls -la ~/Library/Caches/TemporaryItems total 16 drwx------ 5 jnet jnet 170 Jan 27 20:51 . Any idea how I can correct this?

    Read the article

  • Best Of 2010

    - by Mike Dietrich
    Hi there, in Australia, Japan, Singapore and many other countries it's already 2011 - but Germany and the US is still some time until midnight :-) To round up the year you'll find a few off-topic pictures from 2010. You might click on the pictures to get a better resolution. Enjoy ... Moscow - Red Square Tokyo Train - Cell Phone Mania Great Chinese Wall near Beijing Hong Kong by Night Yearing Station Winery, Yarra - Victoria, Australia Dublin, Ireland - during the ash cloud - no comment - Liberty It's sometime foggy in SF Singapore Opera Stockholm - Gamla Stan Unbelievable white beach at Camps Bay, Clifton, Capetown Words fail me ... Mike

    Read the article

  • How to resume CUPS printer from command line

    - by stach81
    Hello I have printer in CUPS that due driver problems (hp 1010) form time to time goes into pause. I would like to write a shell script that will be once per hour resuming printer in cups. But I have no idea after googling for couple of minutes how to resume printer from shell command line. Regards Stan

    Read the article

  • How do you pronounce Linux?

    - by Xerxes
    I'm tired of the old fart at work who keeps coming upto my desk and telling me all about his "years of experience in working with Unix and Lye-nix". I couldn't vent it out at him because that would be wrong, so I'm going to vent it out here - because obviously (that's the right thing to do...). Anyway, for all the people that practice in this disgusting behaviour - the pronunciation is.... (Hmmm - anyone know phonetics?) - "Li-nix" Note: Despite hating him for this - he is otherwise a very nice (but sometimes rather annoying) person. Now... to formally make this a "question" - Could someone write the phonetics for pronouncing "Linux", and also the notorious "Lye-nix", so I can make a note of it for future ventings? I think this is right... L?n?x, NOT L?n?x. ...or perhaps... L?n?x, NOT L?n?x* Can someone confirm the correct phonetics? (Listen to Linus on the matter).

    Read the article

  • SICP making change

    - by RyanD
    So; I'm a hobbiest who's trying to work through SICP (it's free!) and there is an example procedure in the first chapter that is meant to count the possible ways to make change with american coins; (change-maker 100) = 292. It's implemented something like: (define (change-maker amount) (define (coin-value n) (cond ((= n 1) 1) ((= n 2) 5) ((= n 3) 10) ((= n 4) 25) ((= n 5) 50))) (define (iter amount coin-type) (cond ((= amount 0) 1) ((or (= coin-type 0) (< amount 0)) 0) (else (+ (iter amount (- coin-type 1)) (iter (- amount (coin-value coin-type)) coin-type))))) (iter amount 5)) Anyway; this is a tree-recursive procedure, and the author "leaves as a challenge" finding an iterative procedure to solve the same problem (ie fixed space). I have not had luck figuring this out or finding an answer after getting frustrated. I'm wondering if it's a brain fart on my part, or if the author's screwing with me.

    Read the article

  • c# create an arbitrary length generic parameter string e.g. ?,?,?

    - by Sky Sanders
    I know I am forgetting to remember how to do this and it is late. I want to, in an elegant manner, build a placeholder list for a munged sql command. Have a command with an arbitrary number of parameters, need to build ?,?,? Did I mention that it was a wet brain fart? this is what came out: Regex.Replace(new string('?', _command.Parameters.Count), @"\?\?", @"\?,\?"); You are welcome to make me feel like more of an idiot if you just remember me what I am forgetting. ;-)

    Read the article

  • SQL Stored Procedure fired from C# Code-Behind not working on UPDATE

    - by CSSHell
    I have a stored procedure called from a C# code-behind. The code fires but the update command does not get performed. The stored procedure, if run directly, works. I think I am having a brain fart. Please help. :) CODEBEHIND protected void btnAbout_Click(object sender, EventArgs e) { SqlConnection myConnection = new SqlConnection(strConnection); SqlCommand myCommand = new SqlCommand("spUpdateCMSAbout", myConnection); myConnection.Open(); myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.Add("@AboutText", SqlDbType.NVarChar, -1).Value = txtAbout.Text.ToString(); myCommand.ExecuteNonQuery(); myConnection.Close(); } STORED PROCEDURE ALTER PROCEDURE fstage.spUpdateCMSAbout ( @AboutText nvarchar(max) ) AS BEGIN SET NOCOUNT ON; UPDATE fstage.staticCMS SET About = @AboutText; END HTML <asp:Button ID="btnAbout" runat="server" Text="Save" CausesValidation="False" onclick="btnAbout_Click" UseSubmitBehavior="False" /> C# .NET 4.0

    Read the article

  • ArchBeat Link-o-Rama for 2012-09-25

    - by Bob Rhubart
    Oracle 11gR2 RAC on Software Defined Network (SDN) | Gilbert Stan "The SDN [software defined network] idea is to separate the control plane and the data plane in networking and to virtualize networking the same way we have virtualized servers," explains Gil Standen. "This is an idea whose time has come because VMs and vmotion have created all kinds of problems with how to tell networking equipment that a VM has moved and to preserve connectivity to VPN end points, preserve IP, etc." H/T to Oracle ACE Director Tim Hall for the recommendation. ServerSent-Events on WebLogic Server | Steve Buttons "The HTML5 ServerSent-Event model provides a mechanism to allow browser clients to establish a uni-directional communication path to a server, where the server is then able to push messages to the browser at any point in time," explains Steve "Buttso" Buttons. Focus on Architects and Architecture This handy guide for sessions and other activities at Oracle OpenWorld 2012 focuses on IT architecture in all its many facets and permutations. Operating System Set-up for WebLogic Server | Rene van Wijk Oracle ACE Rene van Wijk shows you how to set-up an operating system for WebLogic Server. "We will use VMware as our virtualization platform and use CentOS as the operating system," says van Wijk. "We end the post by showing how the operating system can be tuned when running a Java process such as WebLogic Server." Free eBook: Oracle SOA Suite - In the Customer's Words If you find yourself in the position of having to sell the idea of Service-oriented Architecture to business stakeholders this free e-book may come in very handy. Check out "Oracle SOA Suite: In the Customer's Words. (Registration / Oracle.com login required.) Thought for the Day "The first rule of any technology used in a business is that automation applied to an efficient operation will magnify the efficiency. The second is that automation applied to an inefficient operation will magnify the inefficiency." — Bill Gates Source: BrainyQuote.com

    Read the article

  • More Free Apps Bound for the Marketplace

    - by Scott Kuhl
    Microsoft has announced they are raising the limit of free applications a developer can submit from 5 to 100.  But what does that really mean? First, lets look at the reason for the limitation.  The iTunes Store and the Android Market both have a lot more applications available than the Windows Phone Marketplace.  But that says nothing about the quality of those applications.  I attended a couple of pre-launch events and Microsoft representatives were clearly told to send a message. We don’t want a bunch of junky applications that do nothing but spam the marketplace.  That was the reason for the 5 free application limit. Okay, so now what has the result been?  Well, there are still fart apps, but there is no sign of a developer flooding the marking with 1500 wallpaper applications or 1000 of the same application all pointed at different RSS feeds.   On the other hand there are developers who want to release real free apps but are constrained by the 5 app limit. So why did Microsoft change it’s mind?  Is it to get the count of applications up, or is to make developers happy?  Windows Phone Marketplace is growing fast but it’s a long way behind the other guys.   I don’t think Microsoft wants to have 100,000 apps show up in the next 3 months if they are loaded with copy cat apps.  Those numbers will get picked apart quickly and the press will start complaining about  the same problems the Android Market has.  I do think the bump was at developer request.  Microsoft is usually good about listening to developer feedback, but has been pretty slow about it at times.  And from a financial perspective, there will me more apps that Microsoft has to review that they will see no profit on.  At least not until they bake in a advertising model connected to Bing. Ultimately, what does this mean for the future? Well, there are developers out there looking to release more than 5 simple free apps, so I think we will see more hobby apps.  And there are developers out there trying to make money from advertising instead of sales, so I think we will see more of those also.  But the category that I think will grow the fastest is free versions of paid applications that are the same as the trial version of the application.  While technically that makes no sense, its purely a marketing move.  Free apps get downloaded a lot more than paid apps, even with a trial mode.  It always surprises me how little consumers are willing to spend on mobile apps.  How many reviews of applications have you seen that says something like “a bit pricey at $1.99”.  Really?  Have you looked at how much you spend on your phone and plan?  I always thought the trial mode baked into Windows Marketplace was a good idea.  So I’m not sure how the more open free market will play out. In the long run though, I won’t be surprised to see a Bing ad mobile ad model show up so Microsoft can capitalize on the more open and free Windows Marketplace. Bonus: The Oatmeal on How I Feel About Buying Apps

    Read the article

< Previous Page | 3 4 5 6 7 8  | Next Page >