Search Results

Search found 284 results on 12 pages for 'christopher'.

Page 9/12 | < Previous Page | 5 6 7 8 9 10 11 12  | Next Page >

  • How 'terse' is too terse? -- Practical guidelines for expressing as much intent in as few characters

    - by Christopher Altman
    First, I love writing as little code as possible. I think, and please correct me, one of the golden rules of programming is to express your code in as few of character as possible while maintaining human readability. But I can get a little carried away. I can pack three or four lines into one statement, something like $startDate = $dateTime > time() ? mktime(0,0,0,date('m',time()-86400),date('d',time()*2),2011) : time(); (Note: this is a notional example) I can comprehend the above code when reading it. I prefer 'mushing' it all together because having less lines per page is a good thing to me. So my question: When writing code and thinking about how compact or terse you can express yourself, what are some guidelines you use? Do you write multiple lines because you think it helps other people? Do you write as little as possible, but use comments? Or do you always look for the way to write as little code as possible and enjoy the rewards of compact statements? (Just one slightly off topic comment: I love the Perl one-liners, but that is not what I am talking about here)

    Read the article

  • LAMP Stack with APC installed - WordPress Site - Is WP opcode being cached with APC?

    - by Christopher Altman
    I have a LAMP stack with APC installed. I have a WordPress site on this server. Is WP taking advantage of the opcode caching? I have done no WP configurations. My understanding is that simply having APC installed means that all PHP code is being cached. If that is untrue, please point me to the direction where I can configure WP to take advantage of APC. Note: I thought about this as a ServerFault question, but since the solution to is code related I posted on Stackoverflow.

    Read the article

  • Clean way to perform commands in the Emacs minibuffer

    - by Christopher Monsanto
    Consider the following example: I want to read a file using ido from the minibuffer, but merge in all of the directories I use often. I can't just execute (ido-find-file) (ido-merge-work-directories) Because the second sexp will only execute after the user is finished selecting the file. The question then is: what is the best/cleanest way to execute commands in the minibuffer's command loop? The only way I know to do this is to bind my desired command to a key sequence, and add that sequence to unread-command-events so the key runs once we enter the minibuffer command loop: (setq unread-command-events (append (listify-key-sequence (kbd "M-s")) unread-command-events)) ; std key-binding for ido-merge-work-directories (ido-find-file) But that is very hacky, and I would like to know if there is a better solution. Thanks!

    Read the article

  • How can I run a Perl program when I don't have ssh or shell access?

    - by Christopher
    I just installed an IRC bot, B****X (Don't ask, I don't know - the real name is not censored). I did all of the configuration and chmod'ed the pl files to 755, but running it won't work. My host does not allow SSH/Shell (which is how the documentation says to runs he script), but just going to the URL usually works because of this. However, I get a 500 (Internal Server Error) error. I have logged errors and you can find them at http://services.cl58tools.co.cc/irc/errors.txt Thanks in advance

    Read the article

  • Insert string from database into an aspx and have databinding expressions within that text evaluated

    - by Christopher Edwards
    Well, as you can see I want something quick-and-dirty! How can I get a string from a db that has aspx databinding syntax in it and have the databinding expressions evaluated? So I have text such as this stored in the DB:- Hello <%=User.Name %> I haven't seen you since <%=User.LastVisit %> And I want it to be inserted here say:- ... <body> <form id="form1" runat="server"> <div> <asp:FormView ID="FormView1" DataSourceID="DataSource1" runat="server"> <ItemTemplate> <-- insert stuff here! --> ... But with the databinding expressions evaluated. I'd rather not build a full parsing, templating and evaluation engine...

    Read the article

  • bad performance from too many caught errors?

    - by Christopher Klein
    I have a large project in C# (.NET 2.0) which contains very large chunks of code generated by SubSonic. Is a try-catch like this causing a horrible performance hit? for (int x = 0; x < identifiers.Count; x++) {decimal target = 0; try { target = Convert.ToDecimal(assets[x + identifiers.Count * 2]); // target % } catch { targetEmpty = true; }} What is happening is if the given field that is being passed in is not something that can be converted to a decimal it sets a flag which is then used further along in the record to determine something else. The problem is that the application is literally throwing 10s of thousands of exceptions as I am parsing through 30k records. The process as a whole takes almost 10 minutes for everything and my overall task is to improve that time some and this seemed like easy hanging fruit if its a bad design idea. Any thoughts would be helpful (be kind, its been a miserable day) thanks, Chris

    Read the article

  • jruby hangs on connection to sqlserver

    - by Christopher Dancy
    Jruby is hanging on connection to sqlserver and I cannot figure out why. Here is my code ... puts "make connection" ActiveRecord::Base.establish_connection( :adapter => 'jdbc', :driver => 'com.microsoft.jdbc.sqlserver.SQLServerDriver', :url => 'jdbc:sqlserver://test:1433;databaseName=test;integratedSecurity=true', :username=>'test', :password=>'test' ) puts "connected" fish = ActiveRecord::Base.connection.execute("SELECT * FROM users") puts "query ok" the code spits out "make connection" and then "connected" but never reaches "query ok" any ideas?

    Read the article

  • In Javascript, is there a technique where I can execute code after a return?

    - by Christopher Altman
    Is there a technique where I can execute code after a return? I want to return a value then reset the value without introducing a temporary variable. My current code is: function(a){ var b; if(b){ var temp = b; //I want to avoid this step b = false; return temp; }else{ b = a; return false; }; }; I want to avoid the temp var. Is that possible? var b holds a value between function calls because it is a memoization styled function.

    Read the article

  • how can I validate column names and count in an List array? C#

    - by Christopher Klein
    I'm trying to get this resolved in .NET 2.0 and unfortunately that is not negotiable. I am reading in a csv file with columns of data that 'should' correspond to a List of tickers in IdentA with some modifications. The csv file columsn would read: A_MSFT,A_CSCO,_A_YHOO,B_MSFT,B_CSCO,B_YHOO,C_MSFT,C_CSCO,C_YHOO IdentA[0]="MSFT" IdentA[1]="CSCO" IdentA[2]="YHOO" The AssetsA array is populated with the csv data AssetsA[0]=0 AssetsA[1]=1.1 AssetsA[2]=0 AssetsA[3]=2 AssetsA[4]=3.2 AssetsA[5]=12 AssetsA[6]=54 AssetsA[7]=13 AssetsA[8]=0.2 The C_ columns are optional but if they exist they all need to exist. All of the suffixes must match the values in IdentA. The values in the csv files all need to be decimal. I'm using a group of 3 as an example, there could be any number of tickers in the IdentA array. Its easy enough to do the first part: for (int x = 0; x < IdentA.Count; x++) { decimal.TryParse(AssetsA[x + IdentA.Count], out currentelections); } So that will get me the first set of values for the A_ columns but how can I get through B_ and C_ ? I can't do something as simple as IdentA.Count*2...

    Read the article

  • Blurred PNGs on UIView, using Interface Builder

    - by Christopher Stamper
    Hey everyone, I've added some UIImageViews with png images to my view, using interface builder. Initially they are added off-screen. Later, I animate them onto the screen with CoreAnimation, like so: [UIView beginAnimations:@"slide" context:nil]; [UIView setAnimationDuration:0.1f]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDelegate:self]; image.frame = CGRectMake(81+1, 390, 150, 80); [UIView commitAnimations]; Once they appear onscreen, they look really blurred or fuzzy. I've heard of this happening before. Does anyone have any idea how to fix it?

    Read the article

  • Using thrift to mix development languages

    - by christopher-mccann
    I am currently developing an application which will require multiple different development languages. I want to use PHP as the final piece of the puzzle - the physical web page construction. This PHP web app will need to contact multiple web services which could be coded in anything from Java to Erlang to Python. Each of these web services will be implemented with an API. My plan is to use Thrift to allow this mix to work. Is this the correct approach or am I mixing up what the whole point of Thrift is?

    Read the article

  • Does margin-left:2px; render faster than margin:0 0 0 2px;?

    - by Christopher Altman
    Douglas Crockford describes the consequence of Javascript inquiring a node's style. How simply asking for the margin of a div causes the browser to 'reflow' the div in the browser's rendering engine four times. So that made me wonder, during the initial rendering of a page (or in Crockford's jargon a "web scroll") is it faster to write CSS that defines only the non-zero/non-default values? To provide an example: div{ margin-left:2px; } Than div{ margin:0 0 0 2px; } I know consequence of this 'savings' is insignificant, but I think it is still important to understand how the technologies are implemented. Also, this is not a question about formatting CSS--this is a question about the implementations of browsers rendering CSS. Reference: http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-4

    Read the article

  • Do I have to create a static library to test my application?

    - by Christopher Gateley
    I'm just getting started with TDD and am curious as to what approaches others take to run their tests. For reference, I am using the google testing framework, but I believe the question is applicable to most other testing frameworks and to languages other than C/C++. My general approach so far has been to do either one of three things: Write the majority of the application in a static library, then create two executables. One executable is the application itself, while the other is the test runner with all of the tests. Both link to the static library. Embed the testing code directly into the application itself, and enable or disable the testing code using compiler flags. This is probably the best approach I've used so far, but clutters up the code a bit. Embed the testing code directly into the application itself, and, given certain command-line switches either run the application itself or run the tests embedded in the application. None of these solutions are particularly elegant... How do you do it?

    Read the article

  • MySQL get row closest to NOW()

    - by Christopher McCann
    I have a table with User data such as name, address etc and another table which has a paragraph of text about the user. The reason that they are separate is because we need to record all the old about data. So if the user changes their paragraph - the old one should still be stored. Each bit of about data has a primary key aboutMeID. What I want to do is have a join that pulls their name, address etc and the latest bit of aboutMe data from the other table. I am not sure though how I can order the join to only get the latest about me data. Can someone help?

    Read the article

  • How do I add a .jar file to the compilation of .java files

    - by Christopher Schroeder
    My makefile is below Also, I would appreciate it if you told me how to move my .class files to ../bin/ JFLAGS = -cp JAR = "RSBot*.jar" JC = javac .SUFFIXES: .java .class .java.class: $(JC) $(JFLAGS) $(JAR) $*.java CLASSES = \ src/Banker.java \ src/Eater.java \ src/Fighter.java \ src/grotgui.java \ src/InventTab.java \ src/Looter.java \ src/Potter.java \ src/W8babyGrotworm.java \ src/Walker.java default: classes classes: $(CLASSES:.java=.class) clean: $(RM) *.class

    Read the article

  • DRb connecting to linux client from windows

    - by Christopher Dancy
    I have a few DRb services running on different windows machines and they can all connect and talk with each other just fine. When I put these DRb services on Linux machines and try to connect from windows nothing happens and I get a DRB:ConnError ... the service on Linux is never touched. So I did a netstat on the linux box and the service(port) were not listed anywhere even though the program is clearly running. Is there someting that I'm missing when talking to DRb services on Linux from a windows machine?

    Read the article

  • Ant task does not return properly if slept longer than 9 seconds executing from jruby.

    - by Christopher Dancy
    So here is a strange error/bug/idk ... I'm running jruby 1.4 with ant 1.8 ... from within jruby I execute an ant task with system(command_to_execute_ant_script) and everything works as expected ... however if the ant should sleep for longer than 9 seconds the script does not return EVER from within jruby. If the script sleeps for exactly 9 seconds or less the script returns properly. I've tried using jruby.1.5.0.rc1 as well as older versions of ant and still the same problem ... Any ideas?

    Read the article

  • Multiple robots.txt for subdomains in rails

    - by Christopher
    I have a site with multiple subdomains and I want the named subdomains robots.txt to be different from the www one. I tried to use .htaccess, but the FastCGI doesn't look at it. So, I was trying to set up routes, but it doesn't seem that you can't do a direct rewrite since every routes needs a controller: map.connect '/robots.txt', :controller => ?, :path => '/robots.www.txt', :conditions => { :subdomain => 'www' } map.connect '/robots.txt', :controller => ?, :path => '/robots.club.txt' What would be the best way to approach this problem? (I am using the request_routing plugin for subdomains)

    Read the article

  • What is recursion? -- In plain english.

    - by Christopher Altman
    I hear this word everyday, but cannot give a meaningful, concise, or plain-english answer to what it is. Recursion is defined by the bastian of knowledge as: Recursion in computer science is a method where the solution to a problem depends on solutions to smaller instances of the same problem.1 The approach can be applied to many types of problems, and is one of the central ideas of computer science.[2] Source Is recursion simply something that repeats itself to get a solution? I am looking for a "Recursion for Dummies" definition, and maybe simple examples. My goal is to be able to understand and explain recursion in my own words. I do not like simply thinking I know the meaning of something because I hear it referenced daily, but have not paused to form my own understanding.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12  | Next Page >