Search Results

Search found 2210 results on 89 pages for 'magic plane'.

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

  • Why my /usr/share/file/magic is not found, in PHP at CentOS?

    - by Vincenzo
    This is what I'm doing: $ php <?php $finfo=finfo_open(FILEINFO_MIME, '/usr/share/file/magic'); This is what I'm getting: PHP Notice: finfo_open(): Warning: description `8-bit ISDN mu-law compressed (CCITT G.721 ADPCM voice data enco' truncated in - on line 2 PHP Notice: finfo_open(): Warning: description `8-bit ISDN mu-law compressed (CCITT G.721 ADPCM voice data enco' truncated in - on line 2 PHP Notice: finfo_open(): Warning: <= not supported in - on line 2 PHP Notice: finfo_open(): Warning: <= not supported in - on line 2 PHP Notice: finfo_open(): Warning: <= not supported in - on line 2 PHP Notice: finfo_open(): Warning: >= not supported in - on line 2 PHP Warning: finfo_open(): Failed to load magic database at '/usr/share/file/magic'. in - on line 2 This is a clean CentOS 5.5 installation, PHP 5.3. The file /usr/share/file/magic exists and is accessible.

    Read the article

  • Is MarshalByRefObject special?

    - by Vilx-
    .NET has a thing called remoting where you can pass objects around between separate appdomains or even physical machines. I don't fully understand how the magic is done, hence this question. In remoting there are two base ways of passing objects around - either they can be serialized (converted to a bunch of bytes and the rebuilt at the other end) or they can inherit from MarshalByRefObject, in which case .NET makes some transparent proxies and all method calls are forwarded back to the original instance. This is pretty cool and works like magic. And I don't like magic in programming. Looking at the MarshalByRefObject with the Reflector I don't see anything that would set it apart from any other typical object. Not even a weird internal attribute or anything. So how is the whole transparent proxy thing organized? Can I make such a mechanism myself? Can I make an alternate MyMarshalByRefObject which would not inherit from MarshalByRefObject but would still act the same? Or is MarshalByRefObject receiving some special treatment by the .NET engine itself and the whole remoting feat is non-duplicatable by mere mortals?

    Read the article

  • Reverse-projection 2D points into 3D

    - by ehsan baghaki
    Suppose we have a 3d Space with a plane on it with an arbitary equation : ax+by+cz+d=0 now suppose that we pick 3 random points on that plane: (x0,y0,z0) (x1,y1,z1) (x1,y1,z1) now i have a different point of view(camera) for this plane. i mean i have a different camera that will look at this plane from a different point of view. From that camera point of view these points have different locations. for example (x0,y0,z0) will be (x0',y0') and (x1,y1,z1) will be (x1',y1') and (x2,y2,z2) will be (x2',y2') from the new camera point of view. So here is my a little hard question! I want to pick a point for example (X,Y) from the new camera point of view and tell where it will be on that plane. All i know is that 3 points and their locations on 3d space and their projection locations on the new camera view. Do you know the coefficients of the plane-equation and the camera positions (along with the projection), or do you only have the six points? - Nils i know the location of first 3 points. therefore we can calculate the coefficients of the plane. so we know exactly where the plane is from (0,0,0) point of view. and then we have the camera that can only see the points! So the only thing that camera sees is 3 points and also it knows their locations in 3d space (and for sure their locations on 2d camera view plane). and after all i want to look at camera view, pick a point (for example (x1,y1)) and tell where is that point on that plane. (for sure this (X,Y,Z) point should fit on the plane equation). Also i know nothing about the camera location.

    Read the article

  • Hello, T4MVC &ndash; Goodbye, ASP.NET MVC &ldquo;magic strings&rdquo;

    - by Brian Schroer
    I’m working on my first ASP.NET MVC project, and I really, really like MVC. I hate all of the “magic strings”, though: <div id="logindisplay"> <% Html.RenderPartial("LogOnUserControl"); %> </div> <div id="menucontainer"> <ul id="menu"> <li><%=Html.ActionLink("Find Dinner", "Index", "Dinners")%></li> <li><%=Html.ActionLink("Host Dinner", "Create", "Dinners")%></li> <li><%=Html.ActionLink("About", "About", "Home")%></li> </ul> </div> They’re prone to misspelling (causing errors that won’t be caught until runtime), there’s duplication, there’s no Intellisense, and they’re not friendly to refactoring tools.   I had started down the path of creating static classes with constants for the strings, e.g.: <li><%=Html.ActionLink("Find Dinner", DinnerControllerActions.Index, Controllers.Dinner)%></li> …but that was pretty tedious.   Then I discovered T4MVC (http://mvccontrib.codeplex.com/wikipage?title=T4MVC). Just add its T4MVC.tt and T4MVC.settings.t4 files to the root of your MVC application, and it magically (and this time, it’s good magic) generates code that allows you to replace the first code sample above with this: <div id="logindisplay"> <% Html.RenderPartial(MVC.Shared.Views.LogOnUserControl); %> </div> <div id="menucontainer"> <ul id="menu"> <li><%=Html.ActionLink("Find Dinner", MVC.Dinners.Index())%></li> <li><%=Html.ActionLink("Host Dinner", MVC.Dinners.Create())%></li> <li><%=Html.ActionLink("About", MVC.Home.About())%></li> </ul> </div> It gives you a strongly-typed alternative to magic strings for all of these scenarios: Html.Action Html.ActionLink Html.RenderAction Html.RenderPartial Html.BeginForm Url.Action Ajax.ActionLink view names inside controllers But wait, there’s more! It even gives you static helpers for image and script links, e.g.: <img src="<%= Links.Content.nerd_jpg %>" />   <script src="<%= Links.Scripts.Map_js %>" type="text/javascript"></script> …instead of: <img src="/Content/nerd.jpg" />   <script src="/Scripts/Map.js" type="text/javascript"></script>   Thanks to David Ebbo for creating this great tool. You can watch an eight and a half minute video about T4MVC on Channel 9 via this link: http://channel9.msdn.com/posts/jongalloway/Jon-Takes-Five-with-David-Ebbo-on-T4MVC/. You can download T4MVC from its CodePlex page: http://mvccontrib.codeplex.com/wikipage?title=T4MVC.

    Read the article

  • Given two lines on a plane, how to find integer points closest to their interseciton?

    - by Lukasz Lew
    I can't solve it: You are given 8 integers: A, B, C representing a line on a plane with equation A*x + B*y = C a, b, c representing another line x, y representing a point on a plane The two lines are not parallel therefore divide plane into 4 pieces. Point (x, y) lies inside of one these pieces. Problem: Write a fast algorithm that will find a point with integer coordinates in the same piece as (x,y) that is closest to the cross point of the two given lines. Note: This is not a homework, this is old Euler-type task that I have absolutely no idea how to approach.

    Read the article

  • Given two lines on a plane, how to find integer points closest to their intersection?

    - by Lukasz Lew
    I can't solve it: You are given 8 integers: A, B, C representing a line on a plane with equation A*x + B*y = C a, b, c representing another line x, y representing a point on a plane The two lines are not parallel therefore divide plane into 4 pieces. Point (x, y) lies inside of one these pieces. Problem: Write a fast algorithm that will find a point with integer coordinates in the same piece as (x,y) that is closest to the cross point of the two given lines. Note: This is not a homework, this is old Euler-type task that I have absolutely no idea how to approach. Update: You can assume that the 8 numbers on input are 32-bit signed integers. But you cannot assume that the solution will be 32 bit.

    Read the article

  • Docs for auto-generated methods in Ruby on Rails

    - by macek
    Rails has all sorts of auto-generated methods that I've often times struggled to find documentation for. For example, in routes.rb, if I have: map.resources :projects do |p| p.resources :tasks end This will get a plethora of auto-generate path and url helpers. Where can I find documentation for how to work with these paths? I generally understand how to work with them, but more explicit docs might help me understand some of the magic that happens behind the scenes. # compare project_path(@project) project_task_path(@project, @task) # to project_path(:id => @project.id) project_task_path(:project_id => @project.id, :id => @task.id) Also, when I change an attribute on a model, @post.foo_changed? will be true. Where can I find documentation for this and all other magical methods that are created like this? If the magic is there, I'd love to take advantage of it. And finally: Is there a complete resource for config.___ statements for environment.rb? I was able to find docs for Configuration#gem but what attributes can I set within the stubs like config.active_record.___, config.action_mailer.___, config.action_controller.___, etc. Again, I'm looking for a complete resource here, not just a settings for the examples I provided. Even if you can only answer one of these questions, please chime in. These things seem to have been hiding from me and it's my goal to get them some more exposure, so I'll be upvoting all links to docs that point me to what I'm looking for. Thanks! ps, If they're not called auto-generated methods, I apologize. Someone can teach me a lesson here, too :) Edit I'm not looking for tutorials here, folks. I have a fair amount of experience with rails; I'm just looking for complete docs. E.g., I understand how routing works, I just want docs where I can read about all of the usage options.

    Read the article

  • Eliminating Magic Numbers: When is it time to say "No"?

    - by oosterwal
    We're all aware that magic numbers (hard-coded values) can wreak havoc in your program, especially when it's time to modify a section of code that has no comments, but where do you draw the line? For instance, if you have a function that calculates the number of seconds between two days, do you replace seconds = num_days * 24 * 60 * 60 with seconds = num_days * HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE At what point do you decide that it is completely obvious what the hard-coded value means and leave it alone?

    Read the article

  • Why has my zoom feature stopped working in OSX 10.6?

    - by Kev
    For the life of me I can't get the zoom feature to work on OSX 10.6 on my Max Mini. It's a fresh install, I have the wireless mighty mouse with the small grey scroll ball and the small wireless Apple metal keyboard. I've tried enabling "Zoom using scroll ball whilst holding ^Control" mouse System Preference. I also tried enabling Zoom in "Universal Access" in the System Preferences. This did work in OSX 10.5, but seems to have stopped since I installed 10.6.

    Read the article

  • What are these folders in the root of my drive?

    - by Max Schmeling
    The following folders keep showing up: C:\Default\ C:\NativeImages\ They both have a ton of folders in them witha bunch of html files in each folder. I'm assuming this has something to do with NGEN because of the NativeImages folder. How do I get rid of these folders and keep them from coming back? Or otherwise move them so they get put somewhere else? Thanks

    Read the article

  • Hard link not works under MacOS in GUI mode

    - by AntonAL
    Hi, i faced a little strange behavior, while using hard links. From terminal, i create a text file 1.txt and a hard link "to this file" nano 1.txt mkdir dir ln 1.txt ./dir/ I check the resulting hard link and see that its contents are the same as of the original file. less ./dir/1.txt I change the initial file ... nano 1.txt ... and see, that changes was reflected in hard-link less ./dir/1.txt I change content of hard-link (more correct, of course - file, being referenced with hard-link) ... nano ./dir/1.txt ... and see, that changes are reflected in initial file less 1.txt Until now, all going well... Now, I close terminal and start playing with created files (1.txt and ./dir/1.txt) from Finder. When i change on this two files with TextEdit, changes are not reflected in another file. Just like the hard link was teared off... What is going on here ?

    Read the article

  • Where can I find "magic numbers" for classic game play mechanics?

    - by MrDatabase
    I'd like to find some "magic numbers" for the classic helicopter game. For example the numbers that determine how fast the helicopter accelerates up and down. Also perhaps the "randomness" of the obstacles (uniformly distributed? Gaussian?). Where can I find these numbers? p.s. I don't care about the particular platform... Flash on the desktop browser is just as good as some implementation on a mobile device.

    Read the article

  • Ways to dynamically render a real world 3d environment in Unity3D

    - by Jake M
    Using Unity3D and C# I am attempting to display a 3d version of a real world location. Inside my Unity3D app, the user will specify the GPS coordinates of a location, then my app will have to generate a 3d plane(anything doesn't have to be a plane) of that location. The plane will show a 500 metre by 500 metre 3d snapshot of that location. How would you suggest I achieve this in Unity3D? What methodology would you use to achieve this? NOTE: I understand that this is a very difficult endevour(to render real world locations dynamically in Unity3d) so I expect to perform many actions to achieve this. I just don't know of all the technologies out there and which would be best for my needs For example: Suggested methodology 1: Prompt user to specify GPS coords Use Google earth API and HTTP to programmatically obtain a .khm file describing that location(Not sure if google earth provides that capability does it?) Unzip the .khm so I have the .dae file Convert that file to a .3ds file using ??? third party converter(is there a converter that exists?) Import .3ds into Unity3D at runtime as a plane(is this possible)? Suggested methodology 2: Prompt user to specify GPS coords Use Google earth API and HTTP to programmatically obtain a .khm file describing that location(Not sure if google earth provides that capability does it?) Unzip the .khm so I have the .dae file Parse .dae file using my own C# parser I will write(do you think its possible to write a .dae parser that can parse the .dae into an array of Vector3 that describe the height map of that location?) Dynamically create a plane in Unity3D and populate it with my array/list of Vector3 points(is it possible to create a plane this way?) Maybe I am meant to create a mesh instead of a plane? Can you think of any other ways I could render a real world 3d environment in Unity3D?

    Read the article

  • How can I render player movement on a 2d plane efficiently?

    - by user422318
    I'm prototyping a 2d HTML5 game with similar interaction to Diablo II. (See an older post of mine describing the interaction here: How can I imitate interaction and movement in Diablo II?) I just got the player click-to-move system working using the Bresenham algorithm but I can't figure out how to efficiently render the player's avatar as he moves across the screen. By the time redraw() is called, the player has already finished moving to the target point. If I try to call redraw() more frequently (based on my game timer), there's incredible system lag and I don't even see the avatar image glide across the screen. I have a game timer based off this awesome timer class: http://www.dailycoding.com/Posts/object_oriented_programming_with_javascript__timer_class.aspx In the future, there will be multiple enemies chasing the player. Fast pace is essential to the experience. What should I do?

    Read the article

  • Python: Getting the attribute name that the created object will be given

    - by cool-RR
    Before I ask this, do note: I want this for debugging purposes. I know that this is going to be some bad black magic, but I want to use it just during debugging so I could identify my objects more easily. It's like this. I have some object from class A that creates a few B instances as attributes: class A(object): def __init__(self) self.vanilla_b = B() self.chocolate_b = B() class B(object): def __init__(self): # ... What I want is that in B.__init__, it will figure out the "vanilla_b" or whatever attribute name it was given, and then put that as the .name attribute to this specific B. Then in debugging when I see some B object floating around, I could know which one it is. Is there any way to do this?

    Read the article

  • How do I make a defaultdict safe for unexpecting clients?

    - by ~miki4242
    Several times (even several in a row) I've been bitten by the defaultdict bug. d = defaultdict(list) ... try: v = d["key"] except KeyError: print "Sorry, no dice!" For those who have been bitten too, the problem is evident: when d has no key 'key', the v = d["key"] magically creates an empty list and assigns it to both d["key"] and v instead of raising an exception. Which can be quite a pain to track down if d comes from some module whose details one doesn't remember very well. I'm looking for a way to take the sting out of this bug. For me, the best solution would be to somehow disable a defaultdict's magic before returning it to the client.

    Read the article

  • Take input through Buttons in java

    - by stash211
    I understand that the title might not be descriptive enough, but I'm making a magic square game in Java and basically, I'm trying to replicate user input as found in the sudoku game here: http://www.websudoku.com/. What I have is a n x n grid of Buttons (not JButton) as the board and what I want the user to be able to do is when the user clicks on one of the buttons, similar to the game above, it allows the user to type in his guess in the button itself instead of popping up a dialog box with an input field of some sort. I don't know where to start, I am a beginner in Java (not very beginner, but my knowledge with the various Java APIs is very limited), so I'm trying to find out if this would be possible and if it is, how would I go about doing it? Thanks for any help.

    Read the article

  • Any method to denote object assignment?

    - by Droogans
    I've been studying magic methods in Python, and have been wondering if there's a way to outline the specific action of: a = MyClass(*params).method() versus: MyClass(*params).method() In the sense that, perhaps, I may want to return a list that has been split on the '\n' character, versus dumping the raw list into the variable a that keeps the '\n' intact. Is there a way to ask Python if its next action is about to return a value to a variable, and change action, if that's the case? I was thinking: class MyClass(object): def __init__(*params): self.end = self.method(*params) def __asgn__(self): return self.method(*params).split('\n') def __str__(self): """this is the fallback if __asgn__ is not called""" return self.method(*params)

    Read the article

  • Make Bluetooth on Android 2.1 discoverable indefinitely

    - by kanov-baekonfat
    Hello all. I'm working on a research project which involves Bluetooth and the Android OS. I need to make Bluetooth discoverable indefinitely in order for the project to continue. The Problem: Android limits discoverability to 300 seconds. I cannot ask the user every 300 seconds to turn discoverability back on as my application is designed to run in the background without disturbing the user. As far as I am aware, there is no way to increase the time though Android's GUI. Some sources have called this a safety feature, others have called this a bug. There may be a bit of truth in both... What I'm Trying / Have Tried: I'm trying to edit a stable release of cyanogenmod to turn the discoverability timer off (it's possible; there's a configuration file that needs to have a single number changed). This isn't working because I'm having verification problems with the resulting package. During the past week, I downloaded the cyanogenmod source code, changed a relevant class in the hope that it would make Bluetooth discoverable indefinitely, and tried to recompile. This did not work because (a) the repo is frequently changed, leading to an unstable code base which fails to compile (OR, it could be that I'm using it incorrectly; just because it looked like it was the code's fault in many instances doesn't mean I should blame it for all the problems I encountered!) and (b) the repo decides to periodically "ignore" me (but not always, as I have gotten the code base before!), replying to my synchronization/connection attempts with: fatal: The remote end hung up unexpectedly As you might imagine, the above two issues are problematic and very frustrating to deal with. More Info: I'm running Android 2.1 via cyanogenmod (v5 I believe). This means the phone is also rooted. I have a developer phone, which means that the bootloader is unlocked. My phone is an HTC Magic (32B). The Big Question: How can I make Bluetooth indefinitely discoverable on Android? Thanks for your time and input. I feel like I'm spinning my tires on this issue and I'd like to move past it.

    Read the article

  • How to determine which side of a 3D plane is showing?

    - by Josh Santangelo
    This is a 3d n00b question. I'm working on a WPF control which implements the basics of Silverlight's PerspectiveTransform feature, allowing a 2D plane to be rotated on any of the three axes. It works pretty well. However I'm a little stuck on the math required to determine whether or not the back of the plane is showing. My naive code for figuring that out now is: bool isBackShowing = Math.Abs(RotationX) > 90 && Math.Abs(RotationY) < 90; if (!isBackShowing) { isBackShowing = Math.Abs(RotationX) < 90 && Math.Abs(RotationY) > 90; } However, this fails when the rotation is between +-270 and +-360 on either axis. The underlying transform is using a Quaternion object to do the actual rotation, and that has nice Axis and Angle properties, so I'm guessing I could just use that if I knew how.

    Read the article

  • Mysql Real Escape String PHP Function Adding "\" to My Field Entry

    - by Jascha
    Hello, I am submitting a form to my mySql database using PHP. I am sending the form data through the mysql_real_escape_string($content); function. When the entry shows up in my database (checking in myPhpAdmin) all of my double quotes and single quotes are escaped. I'm fairly certain this is a PHP configuration issue? so: $content = 'Hi, my name is Jascha and my "favorite" thing to do is sleep'; mysql_real_escape_string($content); $query = 'INSERT INTO DB...' comes up in my database as: Hi, my name is Jascha and my \"favorite" thing to do is sleep Who do I tell what to do? (I cannot access the php.ini). -J

    Read the article

  • Hard link not works under MacOS in GUI mode

    - by AntonAL
    Hi, i faced a little strange behavior, while using hard links. From terminal, i create a text file 1.txt and a hard link "to this file" nano 1.txt mkdir dir ln 1.txt ./dir/ I check the resulting hard link and see, that it's contents is the same, as of "original" file. less ./dir/1.txt I change the initial file ... nano 1.txt ... and see, that changes was reflected in hard-link less ./dir/1.txt I change content of hard-link (more correct, of course - file, being referenced with hard-link) ... nano ./dir/1.txt ... and see, that changes are reflected in initial file less 1.txt Until now, all going well... Now, I close terminal and start playing with created files (1.txt and ./dir/1.txt) from Finder. When i change on this two files with TextEdit, changes are not reflected in another file. Just like the hard link was teared off... Whats going on here ?

    Read the article

  • Excess errors on model from somewhere

    - by gmile
    I have a User model, and use an acts_as_authentic (from authlogic) on it. My User model have 3 validations on username and looks as following: User < ActiveRecord::Base acts_as_authentic validates_presence_of :username validates_length_of :username, :within => 4..40 validates_uniqueness_of :username end I'm writing a test to see my validations in action. Somehow, I get 2 errors instead of one when validating a uniqueness of a name. To see excess error, I do the following test: describe User do before(:each) do @user = Factory.build(:user) end it "should have a username longer then 3 symbols" do @user2 = Factory(:user) @user.username = @user2.username @user.save puts @user.errors.inspect end end I got 2 errors on username: @errors={"username"=>["has already been taken", "has already been taken"]}. Somehow the validation passes two times. I think authlogic causes that, but I don't have a clue on how to avoid that. Another case of problem is when I set username to nil. Somehow I get four validation errors instead of three: @errors={"username"=>["is too short (minimum is 3 characters)", "should use only letters, numbers, spaces, and .-_@ please.", "can't be blank", "is too short (minimum is 4 characters)"]} I think authlogic is one that causes this strange behaviour. But I can't even imagine on how to solve that. Any ideas?

    Read the article

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