Daily Archives

Articles indexed Saturday December 1 2012

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

  • Attempting to change Keyboard Backlight levels changes theme

    - by Daniel Lounsbery
    I'm using an Asus G74SX on Ubuntu 12.04. When I try to change my Keyboard Backlight levels my theme seems to change or crash to a backup. P.S. My Screen Brightness won't change if I use the keys or even going into display settings manually. P.S.S I'll be able to post a screen shot when my reputation gets up to 10 It changes to this: From This ( note: the normal theme is the window surrounding the picture ):

    Read the article

  • url changed to www...how much time google take to reindex

    - by user20321
    its been about a week i have changed my url from non www to www version it was done by my host provider .....now i want to ask how much time does google take to remove my sitename.com from indexing and replace it with www.sitename.com (site redirection has been already done by host provider )as it is still showing old ones my new urls are indexed but my main url www.sitename.com is not indexed...or so do i have to remove those old urls personally...its been already about 5-6 days?????

    Read the article

  • How to allow Google Images search to by pass hotlink protection?

    - by Marco Demaio
    I saw Google Images seems to index my images only if hotlink protection is off. * I use anyway hotlink protection because I don't like the idea of people sucking my bandwidth, i simply this code to protcet my sites from being hotlinked: RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain\.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain\.com$ [NC] RewriteRule .*\.(jpg|jpeg|png|gif)$ - [F,NC,L] But in order to allow Google Image search to bypass my hotlink protection (I want Google Images search to show my images) would it suffice to add a line like this one: RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google\.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google\.com$ [NC] Because I'm wondring: is the crawler crawling just from google.com? and what about google.it / google.co.uk, etc.? FYI: on Google official guidelines I did not find info about this. I suppose hotlink protection prevents Google Images to show images in its results because I did some tests and it seems hotlink protection does prevent my images to be shown in Google Images search.

    Read the article

  • Redirect subdomain to local pc

    - by user1188570
    I have a home webserver which is constatly running. Is it possible to create a subdomain which would redirect traffic to another local pc? For example I have 1 Server and one notebook(with webserver installed for developing) Now I can access to notebook only from local network with IP. Server is also hosting domain example.com. Now I would like to visit laptop.example.com, which would be my laptop.

    Read the article

  • shared hosting: ssl domain receives all server's ssl requests, google gets it wrong

    - by pixeline
    This website is hosted on a shared server. I've recently had my hosting provider secure our website using SSL (https://domain.com instead of http://domain.com). Ever since then, all https requests sent to the server are redirected to my website. https://otherdomain.com leads to a warning, then, if you continue, to my website. Ok, my fault, i should have known SSL means 1 IP, otherwise, this thing can happen. But... Google Search results for my website's target keywords is now displaying these websites above my own, even though they have nothing even remotely related to the target keywords! already done: provide canonical url in the html page. told the problem to the server manager, who tells me it's normal but he'll look for a solution. This was one week ago, no answer since. I have no idea why Google is providing these https urls: i thought someone would have to submit them, or have them inside an html page in order for Google to actually index dummy https domains, but i see no reason why someone would do that. Any suggestion on how to solve this situation? Golive is in one week and SEO looks really bad because of that.

    Read the article

  • Changed url from non www to www...Google Indexing

    - by user20321
    I have recently changed (about 1 week ago) my url from non www version to www version. I told my hosting company to do this and they did it successfully all my urls are directed to www version. But google is indexing my non www version on the search results. I have updated new content on my website and google indexes that content with the changed url i.e with prefix www but the mainpage i.e the site name is still shown without www and its not updated. I have checked that my www.sitename.com is listed on google but not shown when I type www.sitename.com. So how much time does it take to remove the old urls from indexing and updating into new urls ??????

    Read the article

  • Delete Perl install files?

    - by Bjorn
    I have a VPS that is managed and am mysteriously running out of space, I think I found a few files I can delete. So just double checking it's ok to delete the Perl install files: /root/perl588installer.tar.gz (pretty sure this can go) /root/perl588installer/ (wasn't sure if this can go, I'm thinking it's just used when perl is installed) I rarely install this kind of thing myself but when I do I'm sure you can delete these files. Thanks

    Read the article

  • How would I handle input with a Game Component?

    - by Aufziehvogel
    I am currently having problems from finding my way into the component-oriented XNA design. I read an overview over the general design pattern and googled a lot of XNA examples. However, they seem to be right on the opposite site. In the general design pattern, an object (my current player) is passed to InputComponent::update(Player). This means the class will know what to do and how this will affect the game (e.g. move person vs. scroll text in a menu). Yet, in XNA GameComponent::update(GameTime) is called automatically without a reference to the current player. The only XNA examples I found built some sort of higher-level Keyboard engine into the game component like this: class InputComponent: GameComponent { public void keyReleased(Keys); public void keyPressed(Keys); public bool keyDown(Keys); public void override update(GameTime gameTime) { // compare previous state with current state and // determine if released, pressed, down or nothing } } Some others went a bit further making it possible to use a Service Locator by a design like this: interface IInputComponent { public void downwardsMovement(Keys); public void upwardsMovement(Keys); public bool pausedGame(Keys); // determine which keys pressed and what that means // can be done for different inputs in different implementations public void override update(GameTime); } Yet, then I am wondering if it is possible to design an input class to resolve all possible situations. Like in a menu a mouse click can mean "click that button", but in game play it can mean "shoot that weapon". So if I am using such a modular design with game components for input, how much logic is to be put into the InputComponent / KeyboardComponent / GamepadComponent and where is the rest handled? What I had in mind, when I heard about Game Components and Service Locator in XNA was something like this: use Game Components to run the InputHandler automatically in the loop use Service Locator to be able to switch input at runtime (i.e. let player choose if he wants to use a gamepad or a keyboard; or which shall be player 1 and which player 2). However, now I cannot see how this can be done. First code example does not seem flexible enough, as on a game pad you could require some combination of buttons for something that is possible on keyboard with only one button or with the mouse) The second code example seems really hard to implement, because the InputComponent has to know in which context we are currently. Moreover, you could imagine your application to be multi-layered and let the key-stroke go through all layers to the bottom-layer which requires a different behaviour than the InputComponent would have guessed from the top-layer. The general design pattern with passing the Player to update() does not have a representation in XNA and I also cannot see how and where to decide which class should be passed to update(). At most time of course the player, but sometimes there could be menu items you have to or can click I see that the question in general is already dealt with here, but probably from a more elobate point-of-view. At least, I am not smart enough in game development to understand it. I am searching for a rather code-based example directly for XNA. And the answer there leaves (a noob like) me still alone in how the object that should receive the detected event is chosen. Like if I have a key-up event, should it go to the text box or to the player?

    Read the article

  • Sound not playing on Windows XP - SoundEffect or Song: Monogame

    - by ashes999
    I'm trying to integrate sound into my Monogame game. I don't have the content pipeline hack -- just straight Monogame (Beta 3) at this point. (I tried adding the content pipeline, but ran into some issues.) I added a .wav file to my /Content directory, and I can create and instantiate both SoundEffect and Song classes. However, both show durations of 00:00:00 (on a ten-second long file), and neither plays. I can call LoadContent without any issue. But when I call Play, nothing plays. I've tried a couple of different sounds, and different formats (MP3 and WAV) to rule that out. Only WAV seems to even load without crashing out, but it doesn't play. There seems to be a GitHub issue that fixes this problem in 2.5.1. Downgrading to 2.5.1 doesn't fix this problem; it seems like it's fixed in 3.0 (_data is set in the SoundEffect instance). This issue only occurs on Windows XP. I tested it on a Windows 7 laptop, and the sound plays fine.

    Read the article

  • Basic modelling of radar

    - by Hawk66
    I'm currently researching how to model/simulate radar for my naval simulation. Since the emphasis is on modelling ASW or submarines in general, I need only a basic radar model - at least for the beginning. So, does anybody know a resource for such a simple model? The model should take signal strength of the sensor, the size of the target and the terrain (height/ground clutter) into account. Thanks.

    Read the article

  • OpenGL : sluggish performance in extracting texture from GPU

    - by Cyan
    I'm currently working on an algorithm which creates a texture within a render buffer. The operations are pretty complex, but for the GPU this is a simple task, done very quickly. The problem is that, after creating the texture, i would like to save it. This requires to extract it from GPU memory. For this operation, i'm using glGetTexImage(). It works, but the performance is sluggish. No, i mean even slower than that. For example, an 8MB texture (uncompressed) requires 3 seconds (yes, seconds) to be extracted. That's mind puzzling. I'm almost wondering if my graphic card is connected by a serial link... Well, anyway, i've looked around, and found some people complaining about the same, but no working solution so far. The most promising advise was to "extract data in the native format of the GPU". Which i've tried and tried, but failed so far. Edit : by moving the call to glGetTexImage() in a different place, the speed has been a bit improved for the most dramatic samples : looking again at the 8MB texture, it knows requires 500ms, instead of 3sec. It's better, but still much too slow. Smaller texture sizes were not affected by the change (typical timing remained into the 60-80ms range). Using glFinish() didn't help either. Note that, if i call glFinish() (without glGetTexImage), i'm getting a fixed 16ms result, whatever the texture size or complexity. It really looks like the timing for a frame at 60fps. The timing is measured for the full rendering + saving sequence. The call to glGetTexImage() alone does not really matter. That being said, it is this call which changes the performance. And yes, of course, as stated at the beginning, the texture is "created into the GPU", hence the need to save it.

    Read the article

  • Getting isometric grid coordinates from standard X,Y coordinates

    - by RoryHarvey
    I'm currently trying to add sprites to an isometric Tiled TMX map using Objects in cocos2d. The problem is the X and Y metadata from TMX object are in standard 2d format (pixels x, pixels y), instead of isometric grid X and Y format. Usually you would just divide them by the tile size, but isometric needs some sort of transform. For example on a 64x32 isometric tilemap of size 40 tiles by 40 tiles an object at (20,21)'s coordinates come out as (640,584) So the question really is what formula gets (20,21) from (640,584)?

    Read the article

  • How to fix windows 7 loader?

    - by Adio
    I have an HD 250 Gb It is portioned to C,D,E C has 50 GB D has 50 GB and the rest is given to E, On C I have Windows 7, I decided to install Opensuse On E. I have installed Opensuse Successfully. Now Opensuse loader shows Windows7 option when I it loads but, when I chose to load windows 7 I get " A Disk read error occured, press ctrl+alt+e to restart". Does any one has an Idea How to fix windows 7 and keep Opensuse ? My Opensuse is 12.2. Thanks

    Read the article

  • Combine Arbitrary number of polygons together

    - by Jakobud
    I have an arbitrary number of polygons (hexes in this case) that are arranged randomly, but they are all touching another hex. Each individual hex has 6 x,y vertices. The vertex's are known for all the hexes. Can anyone point me in the direction of an algorithm that will combine all the hexes into a single polygon? Essentially I'm just looking for a function that spits out an array of vertex locations that are ordered in a way that when drawing lines from one to the next, it forms the polygon. This is my method so far: Create array of all the vertices for all the hexes. Determine the number of times a vertex occurs in the array If vertex is in the array 3+ times, delete the vertices from the array. If vertex is in the array 2 times, delete one of them. The next step is tricky though. I'm using canvas to draw out these polygons, which essentially involves drawing a line from one vertex to the next. So the order of the vertices in the final array is important. It can't be sorted arbitrarily. Also, I'm not looking for a "convex hull" algorithm, as that would not draw the polygon correctly. Are there any functions out there that do something like this? Am I on the right track or is there a better more efficient way?

    Read the article

  • Encog 3.0 backpropagation

    - by Mohamed Shouman
    I have a question...I am using Encog framework to train a network using BP. I am training the network using images that has some object say a cat, telling the network which images are cats and which are not. Bellow are my Neural Network results actual=0.1545868370551181 ideal=0.0,actual=0.797896306829758 ideal=1.0,actual=0.1545868370551181 ideal=0.0,actual=0.797896306829758 ideal=1.0 It is my understanding that since different pictures are presented to network some look like cat for example then they should have higher percentage...but i keep getting same percentage for any pic that has a cat which is 0.79 and for other pics i get 0.15...how can i solve this issue!, what is the intuition behind whats going on! Many thanks

    Read the article

  • How important is it that models be consistent across project components?

    - by RonLugge
    I have a project with two components, a server-side component and a client-side component. For various reasons, the client-side device doesn't carry a fully copy of the database around. How important is it that my models have a 1:1 correlation between the two sides? And, to extend the question to my bigger concern, are there any time-bombs I'm going to run into down the line if they don't? I'm not talking about having different information on each side, but rather the way the information is encapsulated will vary. (Obviously, storage mechanisms will also vary) The server side will store each user, each review, each 'item' with seperate tables, and create links between them to gather data as necessary. The client side shouldn't have a complete user database, however, so rather than link against the user for gathering things like 'name', I'd store that on the review. In other words... --- Server Side --- Item: +id //Store stuff about the item User: +id +Name -Password Review: +id +itemId +rating +text +userId --- Device Side --- Item: +id +AverageRating Review: +id +rating +text +userId +name User: +id +Name //Stuff The basic idea is that certain 'critical' information gets moved one level 'up'. A user gets the list of 'items' relevant to their query, with certain review-orientation moved up (i. e. average rating). If they want more info, they query the detail view for the item, and the actual reviews get queried and added to the dataset (and displayed). If they query the actual review, the review gets queried and they pick up some additional user info along the way (maybe; I'm not sure if the user would have any use for any of the additional user information). My basic concern is that I don't wan't to glut the user's bandwidth or local storage with a huge variety of information that they just don't need, even if proper database normalizations suggests that information REALLY should be stored at a 'lower' level. I've phrased this as a fairly low-level conceptual issue because that's the level I'm trying to think / worry over, but if it matters I'm creating a PHP / MySQL server that provides data for a iOS / CoreData client.

    Read the article

  • Non-public application uses GPL code — are we obliged to publish our source?

    - by Cimbit
    Real Example. I have a closed source server-side program for "internal purposes only" (no distribution or selling). I want to use "MYSQL C++ Connector" in my server application in my VPS (MYSQL C++ Connector is GPL). Do I have to make my application "GPL" and distribute my source code? Can I use the GPL Source Code in my closed source application. (There is no distribution or selling of my application — it is for internal purposes only.)

    Read the article

  • Partition loop understanding

    - by user1795732
    Why the loop body of the partition method never throws an ArrayIndexOutOfBounds Exception? public static int partition( int[] a, low, high ) { int k = low, m = low; /* loop invariant: * low <= k <= m <= high and * all elements in a[low..k-1] are RED (i.e., < pivot) and * all elements in a[k..m-1] are BLUE (i.e., >= pivot) */ while (m != high) { if (a[m] >= pivot) // a[m] is BLUE { } else { // a[m] is RED swap(a,k,m); k = k+1; } m = m+1; } return k; }

    Read the article

  • object of type 'closure' is not subsettable - contradiction?

    - by Alex
    I'm writing a function to produce time series plots of stock prices. However, I'm getting the following error "Error in df[, 7] : object of type 'closure' is not subsettable" Here's an example of the function: plot.prices <- function(df) { require(ggplot2) g <- ggplot(df, aes(x= as.Date(Date, format= "%Y-%m-%d"), y= df[, 7])) + geom_point(size=1) # ... code not shown... g } And example data: spy <- read.csv(file= 'http://ichart.finance.yahoo.com/table.csv?s=SPY&d=11&e=1&f=2012&g=d&a=0&b=29&c=1993&ignore=.csv', header= T) plot.prices(spy) # produces error ggplot(spy, aes(x= as.Date(Date, format= "%Y-%m-%d"), y= spy[, 7])) + geom_point(size=1) ## does not produce error As you can see, the code is identical. I get an error if the call to ggplot() is INSIDE the function but not if the call to ggplot() is OUTSIDE the function. Anyone have any idea why the seeming contradiction?

    Read the article

  • Heroku- Could not find paperclip-3.1.3 in any of the sources

    - by otchkcom
    This morning when I tried to update my website, heroku didn't let me push the app. Here's the message I got. Fetching gem metadata from http://rubygems.org/....... Fetching gem metadata from http://rubygems.org/.. Fetching git://github.com/drhenner/nifty-generators.git Could not find paperclip-3.1.3 in any of the sources ! ! Failed to install gems via Bundler. ! ! Heroku push rejected, failed to compile Ruby/rails app ! [remote rejected] master -> master (pre-receive hook declined) I don't have paperclip- 3.1.3 in my gem file. I'm not sure why it's looking for paperclip 3.1.3 Here's my gem file source 'http://rubygems.org' gem 'rails', '~> 3.2.6' gem 'asset_sync' group :assets do gem 'uglifier', '>= 1.0.3' end gem 'sass-rails', " ~> 3.2.3" gem "activemerchant", '~> 1.17.0' #, :lib => 'active_merchant' gem 'authlogic', "3.0.3" gem 'bluecloth', '~> 2.1.0' gem 'cancan', '~> 1.6.7' gem 'compass', '~> 0.12.rc.0' gem 'compass-rails' gem 'dalli', '~> 1.1.5' gem "friendly_id", "~> 3.3" gem 'haml', ">= 3.0.13"#, ">= 3.0.4"#, "2.2.21"#, gem "jquery-rails" gem 'aws-sdk' group :production do gem 'pg' gem 'thin' end gem 'nested_set', '~> 1.6.3' gem 'nokogiri', '~> 1.5.0' gem 'paperclip', '~> 3.0' gem 'prawn', '~> 0.12.0' gem 'rails3-generators', '~> 0.17.0' gem 'rmagick', :require => 'RMagick' gem 'rake', '~> 0.9.2' gem 'state_machine', '~> 1.1.2' gem 'sunspot_solr' gem 'sunspot_rails', '~> 1.3.0rc' gem 'will_paginate', '~> 3.0.0' gem 'dynamic_form' group :development do gem 'sqlite3' gem "autotest-rails-pure" gem "rails-erd" gem "ruby-debug19" end group :test, :development do gem "rspec-rails", "~> 2.8.0" gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git' gem 'launchy' gem 'database_cleaner' end group :test do gem 'factory_girl', "~> 3.3.0" gem 'factory_girl_rails', "~> 3.3.0" gem 'mocha', '~> 0.10.0', :require => false gem 'rspec-rails-mocha' gem "rspec", "~> 2.8.0" gem "rspec-core", "~> 2.8.0" gem "rspec-expectations", "~> 2.8.0" gem "rspec-mocks", "~> 2.8.0" gem 'email_spec' gem "faker" gem "autotest", '~> 4.4.6' gem "autotest-rails-pure" gem "autotest-growl" gem "ZenTest", '4.6.2' end

    Read the article

  • How to filter using a dropdown in Knockout

    - by user517406
    I have just started using Knockout and I want to filter my data that I am displaying in my UI by selecting an item from a dropdown. I have got so far, but I cannot get the selected value from my dropdown yet, and then after that I need to actually filter the data displayed based upon that value. Here is my code so far : @model Models.Fixture @{ ViewBag.Title = "Fixtures"; Layout = "~/Areas/Development/Views/Shared/_Layout.cshtml"; } @Scripts.Render("~/bundles/jqueryval") <script type="text/javascript" src="@Url.Content("~/Scripts/knockout-2.1.0.js")"></script> <script type="text/javascript"> function FixturesViewModel() { var self = this; var baseUri = '@ViewBag.ApiUrl'; self.fixtures = ko.observableArray(); self.teams = ko.observableArray(); self.update = function (fixture) { $.ajax({ type: "PUT", url: baseUri + '/' + fixture.Id, data: fixture }); }; self.sortByAwayTeamScore = function () { this.fixtures.sort(function(a, b) { return a.AwayTeamScore < b.AwayTeamScore ? -1 : 1; }); }; self.select = function (team) { }; $.getJSON("/api/fixture", self.fixtures); $.getJSON("/api/team", self.teams); } $(document).ready(function () { ko.applyBindings(new FixturesViewModel()); }); </script> <div class="content"> <div> <table><tr><td><select data-bind="options: teams, optionsText: 'TeamName', optionsCaption: 'Select...', optionsValue: 'TeamId', click: $root.select"> </select></td></tr></table> <table class="details ui-widget-content"> <thead> <tr><td>FixtureId</td><td>Season</td><td>Week</td><td>AwayTeam</td><td><a id="header" data-bind='click: sortByAwayTeamScore'>AwayTeamScore</a></td><td>HomeTeam</td><td>HomeTeamScore</td></tr> </thead> <tbody data-bind="foreach: fixtures"> <tr> <td><span data-bind="text: $data.Id"></span></td> <td><span data-bind="text: $data.Season"></span></td> <td><span data-bind="text: $data.Week"></span></td> <td><span data-bind="text: $data.AwayTeamName"></span></td> <td><input type="text" data-bind="value: $data.AwayTeamScore"/></td> <td><span data-bind="text: $data.HomeTeamName"></span></td> <td><input type="text" data-bind="value: $data.HomeTeamScore"/></td> <td><input type="button" value="Update" data-bind="click: $root.update"/></td> </tr> </tbody> </table> </div> </div> Can anybody please advise on this?

    Read the article

  • int[] to string c#

    - by Robin Webdev
    Hi I'm developing an client application in C# and the server is written in c++ the server uses: inline void StrToInts(int *pInts, int Num, const char *pStr) { int Index = 0; while(Num) { char aBuf[4] = {0,0,0,0}; for(int c = 0; c < 4 && pStr[Index]; c++, Index++) aBuf[c] = pStr[Index]; *pInts = ((aBuf[0]+128)<<24)|((aBuf[1]+128)<<16)|((aBuf[2]+128)<<8)|(aBuf[3]+128); pInts++; Num--; } // null terminate pInts[-1] &= 0xffffff00; } to convert an string to int[] in my c# client i recieve: int[4] { -14240, -12938, -16988, -8832 } How do I convert the array back to an string? I don't want to use unsafe code (e.g. pointers) Any of my tries resulted in unreadable strings.

    Read the article

  • Statistics help on 3 choices

    - by DaveSav
    I'm working on an Android app where, at one point, the user is asked to input whether something helped. Their options are 'Yes', 'No' and 'Don't Know'; or they could choose to ignore it. This is for multiple 'somethings' over a date range. A summary view for a date range shows the percentage of 'Yes', 'No' and 'Don't Know' entered for each 'something'. I'm also showing the 'Overall Effectiveness' as the percentage of 'Yes' inputs, which I realise is incorrect. I am thinking of changing that to 'Yes' minus 'No', but that doesn't address the 'Don't Know' inputs. How would I handle the data so that 'Overall Effectiveness' represents all 3 data inputs? So, for a 'something' which has a 'Yes' of 25%, a 'No' of 25% and a 'Don't Know' of 50%, would that be an 'Overall Effectiveness' of 0% ? Or would the 'Don't Know' affect that figure at all? As an additional to that, what graph type, other that Pie, would best display all 3 data?

    Read the article

  • Can someone explain this color wheel code to me?

    - by user1869438
    I just started doing java and i need some help with understanding this code. I got it from a this website. This is supposed to be code for a color wheel but i don't really understand how it works, especially the final ints STEPS and SLICES. import java.awt.Color; import objectdraw.*; public class ColorWheel extends WindowController { private double brightness; private Text text; private FilledRect swatch; private Location center; private int size; private FilledRect brightnessOverlay; private static final int SLICES = 96; private static final int STEPS = 16; public void begin() { canvas.setBackground(Color.BLACK); brightness = 1.; size = Math.min(canvas.getWidth(), canvas.getHeight() - 20); center = new Location(canvas.getWidth() / 2, size / 2); for(int j = STEPS; j >= 1; j--) { int arcSize = size * j / STEPS; int x = center.getX() - arcSize / 2; int y = center.getY() - arcSize / 2; for(int i = 0; i < SLICES; i++) { Color c = Color.getHSBColor((float)i / SLICES, (float)j / STEPS, (float)brightness); new FilledArc(x, y, arcSize, arcSize, i * 360. / SLICES, 360. / SLICES + .5, c, canvas); } } swatch = new FilledRect(0, canvas.getHeight() - 20, canvas.getWidth(), 20, Color.BLACK, canvas); brightnessOverlay = new FilledRect(0, 0, canvas.getWidth(), canvas.getHeight() - 20, new Color(0, 0, 0, 0), canvas); text = new Text("", canvas.getWidth() / 2, canvas.getHeight() - 18, canvas); text.setAlignment(Text.CENTER, Text.TOP); text.setBold(true); } public void onMouseDrag(Location point) { brightness = (canvas.getHeight() - point.getY()) / (double)(canvas.getHeight()); if(brightness < 0) { brightness = 0; } else if(brightness > 1) { brightness = 1; } if(brightness < .5) { text.setColor(Color.WHITE); } else { text.setColor(Color.BLACK); } brightnessOverlay.setColor(new Color(0f, 0f, 0f, (float)(1 - brightness))); } public void onMouseMove(Location point) { double saturation = 2 * center.distanceTo(point) / size; if(saturation > 1) { text.setText(""); swatch.setColor(Color.BLACK); return; } double hue = -Math.atan2(point.getY() - center.getY(), point.getX() - center.getX()) / (2 * Math.PI); if(hue < 0) { hue += 1; } swatch.setColor(Color.getHSBColor((float)hue, (float)saturation, (float)brightness)); text.setText("Color.getHSBColor(" + Text.formatDecimal(hue, 2) + "f, " + Text.formatDecimal(saturation, 2) + "f, " + Text.formatDecimal(brightness, 2) + "f)"); } }

    Read the article

  • factorygirl rails, says "top required" in my spec - don't know how to fix

    - by user924088
    I get the following error message when I run my tests. It says that the problem is in my lecture_spec, and that the top is required. I don't know if this has something to do with requiring my spec_helper.rb file. 1) Lecture has a valid factory Failure/Error: FactoryGirl.create(:lecture).should be_valid NoMethodError: undefined method `after_build=' for #<Lecture:0x007fe7747bce70> # ./spec/models/lecture_spec.rb:21:in `block (2 levels) in <top (required)>' My factory looks like the following: require 'faker' FactoryGirl.define do factory :question do association :lecture name { Faker::Lorem.words(1) } description {Faker::Lorem.words(7)} factory :question_one do answer 1 end factory :question_two do answer 2 end factory :question_three do answer 3 end end end And this is my lecture_spec file require 'spec_helper' describe Lecture do it "has a valid factory" do FactoryGirl.create(:lecture).should be_valid end end and this is my lecture factory, where I defined the lecture factory. FactoryGirl.define do factory :lecture do #association :question name {Faker::Lorem.words(1)} description {Faker::Lorem.words(7)} soundfile_file_name {Faker::Lorem.words(1)} soundfile_content_type {Faker::Lorem.words(3)} soundfile_file_size {Faker::Lorem.words(8)} after_build do |question| [:question_one, :question_two, :question_three].each do |question| association :questions, factory: :question, strategy: :build end end end end

    Read the article

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