Search Results

Search found 4656 results on 187 pages for 'sleepy john'.

Page 92/187 | < Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >

  • Load a controller into an other controller in cakephp

    - by john
    im developing a web application, using multiple pages, each with their own controller. The problem now is that there are some variables in a controller, created for one page, that are required for an other page ( with a different controller). Therefor i need to load one controller into the other one. I did this by adding App::import('Controller', 'sections'); $sections= new sectionsController; $sections-constructClasses(); to the controller, but this doens't seem to work.. Maybe u guys have some ideas? Thnx in advance!

    Read the article

  • Calculating a Sample Covariance Matrix for Groups with plyr

    - by John A. Ramey
    I'm going to use the sample code from http://gettinggeneticsdone.blogspot.com/2009/11/split-apply-and-combine-in-r-using-plyr.html for this example. So, first, let's copy their example data: mydata=data.frame(X1=rnorm(30), X2=rnorm(30,5,2), SNP1=c(rep("AA",10), rep("Aa",10), rep("aa",10)), SNP2=c(rep("BB",10), rep("Bb",10), rep("bb",10))) I am going to ignore SNP2 in this example and just pretend the values in SNP1 denote group membership. So then, I may want some summary statistics about each group in SNP1: "AA", "Aa", "aa". Then if I want to calculate the means for each variable, it makes sense (modifying their code slightly) to use: > ddply(mydata, c("SNP1"), function(df) data.frame(meanX1=mean(df$X1), meanX2=mean(df$X2))) SNP1 meanX1 meanX2 1 aa 0.05178028 4.812302 2 Aa 0.30586206 4.820739 3 AA -0.26862500 4.856006 But what if I want the sample covariance matrix for each group? Ideally, I would like a 3D array, where the I have the covariance matrix for each group, and the third dimension denotes the corresponding group. I tried a modified version of the previous code and got the following results that have convinced me that I'm doing something wrong. > daply(mydata, c("SNP1"), function(df) cov(cbind(df$X1, df$X2))) , , = 1 SNP1 1 2 aa 1.4961210 -0.9496134 Aa 0.8833190 -0.1640711 AA 0.9942357 -0.9955837 , , = 2 SNP1 1 2 aa -0.9496134 2.881515 Aa -0.1640711 2.466105 AA -0.9955837 4.938320 I was thinking that the dim() of the 3rd dimension would be 3, but instead, it is 2. Really this is a sliced up version of the covariance matrix for each group. If we manually compute the sample covariance matrix for aa, we get: [,1] [,2] [1,] 1.4961210 -0.9496134 [2,] -0.9496134 2.8815146 Using plyr, the following gives me what I want in list() form: > dlply(mydata, c("SNP1"), function(df) cov(cbind(df$X1, df$X2))) $aa [,1] [,2] [1,] 1.4961210 -0.9496134 [2,] -0.9496134 2.8815146 $Aa [,1] [,2] [1,] 0.8833190 -0.1640711 [2,] -0.1640711 2.4661046 $AA [,1] [,2] [1,] 0.9942357 -0.9955837 [2,] -0.9955837 4.9383196 attr(,"split_type") [1] "data.frame" attr(,"split_labels") SNP1 1 aa 2 Aa 3 AA But like I said earlier, I would really like this in a 3D array. Any thoughts on where I went wrong with daply() or suggestions? Of course, I could typecast the list from dlply() to a 3D array, but I'd rather not do this because I will be repeating this process many times in a simulation. As a side note, I found one method (http://www.mail-archive.com/[email protected]/msg86328.html) that provides the sample covariance matrix for each group, but the outputted object is bloated. Thanks in advance.

    Read the article

  • Store a byte[] stored in a SQL XML parameter to a varbinary(MAX) field in SQL Server 2005. Can it be

    - by Mikey John
    Store a byte[] stored in a SQL XML parameter to a varbinary(MAX) field in SQL Server 2005. Can it be done ? Here's my stored procedure: set ANSI_NULLS ON set QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[AddPerson] @Data AS XML AS INSERT INTO Persons (name,image_binary) SELECT rowWals.value('./@Name', 'varchar(64)') AS [Name], rowWals.value('./@ImageBinary', 'varbinary(MAX)') AS [ImageBinary] FROM @Data.nodes ('/Data/Names') as b(rowVals) SELECT SCOPE_IDENTITY() AS Id In my schema Name is of type String and ImageBinary is o type byte[].

    Read the article

  • Writing a simple RSpec test to check that Rake tasks are correct

    - by John Feminella
    I'm trying to be diligent about checking my rake tasks with RSpec tests, but in the process of feeling my way around I seem to have hit a wall. I've got a really simple RSpec test that looks like this: # ./test/meta_spec.rb describe "Rake tasks" do require 'rake' before(:each) do @rake = Rake::Application.new @rake.load_rakefile # => Error here! Rake.application = @rake end after(:each) do Rake.application = nil end it "should have at least one RSpec test to execute" do Rake.application["specs"].spec_files.size.should > 0 end end I have a simple task called "specs" defined in ./Rakefile.rb which has an RSpec task that includes all the *_spec.rb files. If I put the @rake.load_rakefile method in, I want that Rakefile to load. But instead it just bombs out. If I comment it out, however, the test fails because the "specs" task is (understandably) not defined. Where am I going wrong?

    Read the article

  • Benefits of migrating my work to a new web development framework?

    - by John
    When I first started programming with PHP, I was ignorant of other php frameworks (like code igniter, cake php, etc...). So I fell into the trap of re-inventing wheels, which had the benefit of being "fun" and "educational". Overtime, I discovered other open source products that I found useful, like smarty templating engine, jquery library, tcpdf library, fdf etc...so I started bundling these technologies along with things I've built over the years into a LAMP development framework to make life easier for myself. This pass year, I've been having fun developing on the code igniter framework. It does many of the things I do in my framework. Coding in CI feels natural because the MVC and ORM feels similar to the MVC and ORM of my framework. So now I'm contemplating migrating a lot of the plugins in my framework over to CI. The pros and cons I can think of for such a project are: Pros: benefit from the vast community of CI developers lots of other developers will be familiar with it better documentation Cons: I've built a lot of useful plugins against my own framework, and it will take a lot of time to move even just the essential ones at the moment, I still, work faster against my own framework than CI, just because I'm more familiar with it even if I did migrate to CI, there will always be newer and better frameworks in the near future, and i'll be contemplating this scenario again So my question is the following: perhaps I should leave my old framework as is, and for each new project I receive, I make a decision on whether the requirements are best served by developing with CI or my own framework. Is this the right approach?

    Read the article

  • Alternative to BerkeleyDB?

    - by John
    I'm looking for a dbm-like library that I can use in place of Berkeley DB, which I'm currently using. My main reason for switching is the licensing fees for BDB are pretty high (free for open source apps, but my employer does not want to open source this particular app for various reasons). I've looked briefly at qdbm but it doesn't look like it will fill my needs -- lots of keys (several million) and large data items ( 1-5 megabytes). Before I continue my search I figured I'd ask because it seems there are tons of dbm-like libraries out there.

    Read the article

  • I want to combine my www and non www and keep the link jucie from both.

    - by John Ray
    My website shows up for some keywords in the www and some in the non www. Seaquake shows more links to the non www version. It is a PR2 either way. I would like to combine the link juice of the two versions into the non www version. Does anyone know the best way to combine the two and keep the link juice of both. It is as simple as a 301 redirect and if so does the 301 need to be handled in any specific way.

    Read the article

  • Set title of SplitViewController

    - by John
    I am using the SplitViewController template. How do I set the title on the topbar in the detailview? Been trying to work this out for hours. Tried simple: detailViewController.title = @"String"; but no luck. Any help appreciated. Thanks.

    Read the article

  • How Do You Profile & Optimize CUDA Kernels?

    - by John Dibling
    I am somewhat familiar with the CUDA visual profiler and the occupancy spreadsheet, although I am probably not leveraging them as well as I could. Profiling & optimizing CUDA code is not like profiling & optimizing code that runs on a CPU. So I am hoping to learn from your experiences about how to get the most out of my code. There was a post recently looking for the fastest possible code to identify self numbers, and I provided a CUDA implementation. I'm not satisfied that this code is as fast as it can be, but I'm at a loss as to figure out both what the right questions are and what tool I can get the answers from. How do you identify ways to make your CUDA kernels perform faster?

    Read the article

  • .hgignore whole directory tree excepting one specific file

    - by John Mee
    Can anyone tell me the .hgignore pattern to track one specific file in a directory and to ignore everything else? I have a "media" directory which contains a "default.png", for obvious purposes, and the rest of the directory will hold user media. We want hg to ignore everything in the media directory excepting the default file.

    Read the article

  • DB2 ZOS String Comparison Problem

    - by John
    I am comparing some CHAR data in a where clause in my sql like this, where PRI_CODE < PriCode The problem I am having is when the CHAR values are of different lengths. So if PRI_CODE = '0800' and PriCode = '20' it is returning true instead of false. It looks like it is comparing it like this '08' < '20' instead of like '0800' < '20' Does a CHAR comparison start from the Left until one or the other values end? If so how do I fix this? My values can have letters in it so convering to numeric is not an option.

    Read the article

  • unable to get into windows 7 or ubuntu after system file back on a dual boot system

    - by John Jiang
    I installed ubuntu on my dell xps 9000 which originally has a window 7 installed. So after I did system file back up as told by windows 7 and restarted my computer, I received the following message right after restarting in the black screen: roughly like this: ubuntu grub error, " " symbol cannot be found. I was wondering how I can get access into windows 7 and uninstall ubuntu all together. I actually had the same booting problem after system backup before and the solution was to install two extra ubuntus but I'd prefer not to do that. I'd highly appreciate any help!

    Read the article

  • How to update a custom dependency property when the datasource list changes

    - by John
    Hi We have a user control with a custom dependency property (DP). The DP is bound to an ObservableCollection. When a new item is added to the collection programatically, the databinding does not update the target DP. Why? We think it's because, unfortunately, in our case the target is not a ListBox or ListView, but a Canvas. The DP, when changed or initialized, is supposed to draw a Shape (!) onto the Canvas, and the shape's position and size is bound to the collection item's two properties: WIDTH, LEFT. Ideally we don't want to clear the Canvas and redraw all items just becasue one has been added (or deleted). But how? So: How can the custom DP take care of drawing the shape for the new collection item? What callback do we need, at what point in time does this have to happen, and what specific MetaDataOptions might there? Also, are there any good resources out there concerning all these dependency property options. They are quite confusing. MSDN does not really help with what we're trying to do. Thanks!

    Read the article

  • PHP - Looking for an HTML Generator/Manager

    - by John Himmelman
    I'm trying to find a tool that I can use to generate markup programatically (non-irl word). Here is an example of what I'm trying to accomplish in pseudo-code... $htmlDoc = new HTML_Document(); $htmlDoc->setTitle('Cool Title'); $htmlDoc->addJs('some_js_file.js'); $htmlDoc->addStylesheet('some_css_file.css'); $divElement = new HTML_Element_Div(); $htmlDoc->append('body', $divElement); $output = $htmlDoc->generate(); What is the best tool for this?

    Read the article

  • UNIX-style RegExp Replace running extremely slowly under windows. Help? EDIT: Negative lookahead ass

    - by John Sullivan
    I'm trying to run a unix regEXP on every log file in a 1.12 GB directory, then replace the matched pattern with ''. Test run on a 4 meg file is took about 10 minutes, but worked. Obviously something is murdering performance by several orders of magnitude. Find: ^(?!.*155[0-2][0-9]{4}\s.*).*$ -- NOTE: match any line NOT starting 155[0-2]NNNN where in is a number 0-9. Replace with: ''. Is there some justifiable reason for my regExp to take this long to replace matching text, or is the program I am using (this is windows / a program called "grepWin") most likely poorly optimized? Thanks. UPDATE: I am noticing that searching for ^(155[0-2]).$ takes ~7 seconds in a 5.6 MB file with 77 matches. Adding the Negative Lookahead Assertion, ?=, so that the regExp becomes ^(?!155[0-2]).$ is causing it to take at least 5-10 minutes; granted, there will be thousands and thousands of matches. Should the negative lookahead assertion be extremely detrimental to performance, and/or a large quantity of matches?

    Read the article

  • Conventions for the behavior of double or triple "click to select text" features?

    - by John Sullivan
    Almost any mature program that involves text implements "double click to select the word" and, in some cases, "triple click to select additional stuff like an entire line" as a feature. I find these features useful but they are often inconsistent between programs. Example - some programs' double clicks do not select the ending space after a word, but most do. Some recognize the - character as the end of a word, others do not. SO likes to select the entire paragraph as I write this post when I triple click it, VS web developer 2005 has no triple click support, and ultra-edit 32 will select one line upon triple clicking. We could come up with innumerable inconsistencies about how double and triple click pattern matching is implemented across programs. I am concerned about how to implement this behavior in my program if nobody else has achieved a convention about how the pattern matching should work. My question is, does a convention (conventions? maybe an MS or Linux convention?) exist that dictates how these features are supposed to behave to the end user? What, if any, are they?

    Read the article

  • Searching for known Team Development helper tools

    - by John
    Hello, My team is small, only two programmers.We both share one source ,but we live in different places.The problem is that Meanwhile I make changes on our project,the other team worker makes changes as well.It's very hard to write down every change,at least for us. When we decide we've made an important change,we contact each other sending the whole project's source. This is not good,because: The files sent from one do not contain the changes that the other worker has been working on meanwhile. We host the source on free servers,thus makes it possible for other to see the files.It will be VERY much better if only few(those that are changed) files are being uploaded rather than the whole project. My question: Are there any tools that could make our lives easier? Thanks in advance! EDIT: We use Delphi 2009.

    Read the article

  • Temporary users table or legitimate users table?

    - by John
    I have a freelance web application that lets users register for events. In my database, I have a t_events_applicants table with the column t_events_applications.user_id with a foreign key constraint linked to the t_users.user_id column. So this means only users who have registered with my web application can register for my web application's events. My client would now like to allow non-registered users, users who do not have an entry in my t_user table, to register for events. These non-registered users only need to provide their name and email address to register for events. Should I create a t_temporary_user table with columns name and email and then remove the t_events_applicants.user_id fk constraint? Or should I add un-registered users to the t_user table and then add a column called t_user.type where type can be 'registered' or 'non-registered'? How do I decide which approach to go with? A lot of times, I hesitate with either approach. I ask myself, "What if at a later time, a temporary user is allowed to become a fully registered user? Then maybe I should have only a t_user table. But then I also don't feel good about storing a lot of temporary users in t_user."

    Read the article

  • C# vs C - Big performance difference

    - by John
    I'm finding massive performance differences between similar code in C anc C#. The C code is: #include <stdio.h> #include <time.h> #include <math.h> main() { int i; double root; clock_t start = clock(); for (i = 0 ; i <= 100000000; i++){ root = sqrt(i); } printf("Time elapsed: %f\n", ((double)clock() - start) / CLOCKS_PER_SEC); } And the C# (console app) is: using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { DateTime startTime = DateTime.Now; double root; for (int i = 0; i <= 100000000; i++) { root = Math.Sqrt(i); } TimeSpan runTime = DateTime.Now - startTime; Console.WriteLine("Time elapsed: " + Convert.ToString(runTime.TotalMilliseconds/1000)); } } } With the above code, the C# completes in 0.328125 seconds (release version) and the C takes 11.14 seconds to run. The c is being compiled to a windows executable using mingw. I've always been under the assumption that C/C++ were faster or at least comparable to C#.net. What exactly is causing the C to run over 30 times slower? EDIT: It does appear that the C# optimizer was removing the root as it wasn't being used. I changed the root assignment to root += and printed out the total at the end. I've also compiled the C using cl.exe with the /O2 flag set for max speed. The results are now: 3.75 seconds for the C 2.61 seconds for the C# The C is still taking longer, but this is acceptable

    Read the article

  • jquery change load get url

    - by john morris
    Ok so I have a php page with data dynamically outputs depending on a $_GET variable ['file']. I have another page (index.php) which has a jQuery script that uses the load() function to load the php page. I have a list of links and when you click on one, it needs to change the $_GET variable to load, then refresh the load() jQuery variable. Heres a snippet: $("#remote-files").load("data.php?file=wat.txt"); $(".link1").mousedown(function() { $("#remote-files").load("data.php?file=link1.txt"); }); As you can see it loads the data into a div with the ID of remote-files. Is there a better way to do this, like update the page with the new get variable instead of redefining a new load function?

    Read the article

  • How would you go about parsing markdown?

    - by John Leidegren
    You can find the syntax here. The thing is, the source that follows with the download is written in perl. Which I have no intentions of honoring. It is riddled with regex and it relies on MD5 hashes to escape certain characters. Something is just wrong about that! I'm about to hard code a parser for markdown and I'm wonder if someone had some experience with this? Edit: If you don't have anything meaningful to say about the actual parsing of markdown, spare me the time. (This might sound harsh, but yes, I'm looking for insight, not a solution i.e. third-party library). To help a bit with the answers, regex are meant to identify patterns! NOT to parse an entire grammar. That people consider doing so is foobar. If you think about markdown, it's fundamentally based around the concept of paragraphs. As such, a reasonable approach might be to split the input into paragraphs. There are many kinds of paragraphs e.g. heading, text, list, blockquote, code. The challenge is thus to identify these paragraphs and in what context they occur. I'll be back with a solution, once I find it's worthy to be shared.

    Read the article

  • How can I send an automated reply to the sender and all recipients with Procmail?

    - by jchong
    I'd like to create a procmail recipe or Perl or shell script that will send an auto response to the original sender as well as anybody that was copied (either To: or cc:) on the original email. Example: [email protected] writes an email to [email protected] and [email protected] (in the To: field). Copies are sent via cc: to [email protected] and [email protected]. I'd like the script to send an auto response to the original sender ([email protected]) and everybody else that was sent a copy of the email ([email protected], [email protected], [email protected] and [email protected]). Thanks

    Read the article

< Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >