Search Results

Search found 15 results on 1 pages for 'astropanic'.

Page 1/1 | 1 

  • PyGame QIX clone, filling areas

    - by astropanic
    I'm playing around with PyGame. Now I'm trying to implement a QIX clone. I have my game loop, and I can move the player (cursor) on the screen. In QIX, the movment of the player leaves a trace (tail) on the screen, creating a polyline. If the polyline with the screen boundaries creates a polygon, the area is filled. How I can accomplish this behaviour ? How store the tail in memory ? How to detect when it build a closed shape that should be filled ? I don't need an exact working solution, some pointers, algo names would be cool.

    Read the article

  • Emacs check syntax of file before saving

    - by astropanic
    How I can prevent Emacs from saving my buffer when it contains syntax errors ? It would by especially useful for editing source code. I'm writing some source code into the buffer, hit C-x C-s and Emacs should position the cursor on the line containing the error. I'm correcting the error, hit the save command again, and Emacs should save the file.

    Read the article

  • Emacs check syntax of file before saving

    - by astropanic
    How I can prevent Emacs from saving my buffer when it contains syntax errors ? It would by especially useful for editing source code. I'm writing some source code into the buffer, hit C-x C-s and Emacs should position the cursor on the line containing the error. I'm correcting the error, hit the save command again, and Emacs should save the file.

    Read the article

  • Apache 2 Symbolic link not allowed or link target not accessible

    - by astropanic
    My apache server runs as user foo. I have some Rails applications in /home/foo/app1 /home/foo/app2. Each of them has an vhost <VirtualHost *:80> ServerName app1.foobar.com ServerAlias www.app1.foobar.com DocumentRoot /var/www/html/app1/current/public RailsEnv production <Directory /var/www/html/app1/current/public> AllowOverride all Options -MultiViews </Directory> </VirtualHost> I have a symlink in /var/www/html/app1 : current -> /home/foo/app1/tmp_20102611 All file permissons are set correctly (user foo group foo), I can go through the filesystem from shell. SELINUX is disabled Distro is CentOs 5.5 Which the above symlink I get an 403 and an error entry in error_log Symbolic link not allowed or link target not accessible:/var/www/html/app1/current When I symlink my app in the subdir of /var/www/html instead of /home/foo it works. How I can avoid this error still placing my app in my /home/foo directory ?

    Read the article

  • statemachine, conditional transitions

    - by astropanic
    I'm currently using Workflow. class Link < ActiveRecord::Base include Workflow workflow do state :new do event :process, :transitions_to => :checking #checking http_response_code & content_type end state :checking do event :process, :transitions_to => :fetching_links # fetching all links end state :fetching_links do event :process, :transitions_to => :checking #ready for next check end end end Now, I can do: l = Link.new l.process! l.process! l.process! l.process! # n times l.process! (in a loop, or cron job for example) But it can happens, some link will not respond or give me an invalid response durning the checking process. How I can conditionally switch to another state ? I mean something like this: class Link < ActiveRecord::Base include Workflow workflow do state :new do event :process, :transitions_to => :checking #checking http_response_code & content_type end state :checking do event :process, :transitions_to => :fetching_links # if all is fine event :process, :transitions_to => :failded # if something goes wrong end state :fetching_links do event :process, :transitions_to => :checking #ready for next check end end end

    Read the article

  • Strange routing

    - by astropanic
    How I can setup my rails app to respond to such urls: http://mydomain.com/white-halogene-lamp http://mydomain.com/children-lamps http://mydomain.com/contact-form The first one should link to my products controller, and show my product with this name The second one should link to my categories controller, and show the category with this name The third one should link to my sites controller, and show the site with this title. All three models (product, category, site) have a method to_seo, giving the mentioned above urls (after the slash) I know it's not the restful way, but please don't disuss here, it is wrong approach or not, that's not the question. The question is how to accomplish this weird routing ? I know we have catch all routes, but how I can tell rails to use different controllers on different urls in the catch all route ? Or have You an better idea ? I would avoid redirects to other urls.

    Read the article

  • Nokogiri find only inbound links

    - by astropanic
    I have an html document located on http://somedomain.com/somedir/example.html The document contains of four links: http://otherdomain.com/other.html http://somedomain.com/other.html /only.html test.html How I can get the full urls for the links in the current domain ? I mean I should get: http://somedomain.com/other.html http://somedomain.com/only.html http://somedomain.com/somedir/test.html The first link should be ignored because it does'nt match my domain

    Read the article

  • Formtastic + nested categories

    - by astropanic
    I have an article model and an category model. Category act as tree. What is the best approch to build a select list to allow the administrator to select an category from a select list to associate it later with an article ? semantic_form_for(@article) do |f| f.input :title, :as => :string f.input :content, :as => :text f.input :category, :collection => #what should go here ? end

    Read the article

  • Nokogiri find text in paragraphs

    - by astropanic
    I want to replace the inner_text in all paragraphs in my XHTML document. I know I can get all text with Nokogiri like this doc.xpath("//text()") But I want only operate on text in paragraphs, how I can select all text in paragraphs without affecting eventually existent anchor texts in links ? #For example : <p>some text <a href="/">This should not be changed</a> another one</a>

    Read the article

  • ruby parametrized regular expression

    - by astropanic
    I have a string like "{some|words|are|here}" or "{another|set|of|words}" So in general the string consists of an opening curly bracket,words delimited by a pipe and a closing curly bracket. What is the most efficient way to get the selected word of that string ? I would like do something like this: @my_string = "{this|is|a|test|case}" @my_string.get_column(0) # => "this" @my_string.get_column(2) # => "is" @my_string.get_column(4) # => "case" What should the method get_column contain ?

    Read the article

  • Valid content-type for XML, HTML and XHTML documents

    - by astropanic
    What are correctly content-types for this documents ? I need to write a simple crawler, that only fetches this kind of files. Nowadays http://somedomain.com/index.html can serve for example an JPEG file due to mod_rewrite, so I need to check the content-type from the response header and compare it with a list of allowed content-types. From where I can get such list ?

    Read the article

  • ruby enclose selected whole words in brackets

    - by astropanic
    @string = "Sometimes some stupid people say some stupid words" @string.enclose_in_brackets("some") # => "Sometimes {some} stupid people say {some} stupid words" How should the method enclose_in_brackets look ? Please keep in mind, I want only enclose whole words, (I don't want "{Some}times {some} stupid....", the "sometimes" word should be left unchanged

    Read the article

1