Daily Archives

Articles indexed Saturday November 10 2012

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

  • Which is a better practice - helper methods as instance or static?

    - by Ilian Pinzon
    This question is subjective but I was just curious how most programmers approach this. The sample below is in pseudo-C# but this should apply to Java, C++, and other OOP languages as well. Anyway, when writing helper methods in my classes, I tend to declare them as static and just pass the fields if the helper method needs them. For example, given the code below, I prefer to use Method Call #2. class Foo { Bar _bar; public void DoSomethingWithBar() { // Method Call #1. DoSomethingWithBarImpl(); // Method Call #2. DoSomethingWithBarImpl(_bar); } private void DoSomethingWithBarImpl() { _bar.DoSomething(); } private static void DoSomethingWithBarImpl(Bar bar) { bar.DoSomething(); } } My reason for doing this is that it makes it clear (to my eyes at least) that the helper method has a possible side-effect on other objects - even without reading its implementation. I find that I can quickly grok methods that use this practice and thus help me in debugging things. Which do you prefer to do in your own code and what are your reasons for doing so?

    Read the article

  • Which paradigm to use for writing chess engine?

    - by poke
    If you were going to write a chess game engine, what programming paradigm would you use (OOP, procedural, etc) and why whould you choose it ? By chess engine, I mean the portion of a program that evaluates the current board and decides the computer's next move. I'm asking because I thought it might be fun to write a chess engine. Then it occured to me that I could use it as a project for learning functional programming. Then it occured to me that some problems aren't well suited to the functional paradigm. Then it occured to me that this might be good discussion fodder.

    Read the article

  • How do you learn a new programming language?

    - by Naveen
    I am C++ developer with some good experience on it. When I try to learn a new language ( have tried Java, C#, python, perl till now) I usually pickup a book and try to read it. But the problem with this is that these books typically start with some very basic programming concepts such as loops, operators etc and it starts to get very boring soon. Also, I feel I would get only theoeritcal knowledge without any practical knowledge on writing the code. So my question is how do you tacke these situations? do you just skip the chapters if its explaining something basic? also, do you have some standard set of programs that you will try to write in every new programming language you try to learn?

    Read the article

  • Virtualbox errors out when creating or opening VM

    - by user106986
    I installed Virtual-box about a week ago and now every time I either try to start a VM or create a new one I get the error listed below. I am in the vboxusers group. I completely uninstalled and re-installed the application without any change in the error. When I run the command below I receive "command not found". Then when I try to install dkms they systems says it is already installed. Right now I have removed the application and any files and would love to re-install the application again to get it working. I remove the application using: sudo apt-get remove virtualbox* --purge Any ideas? Kernel driver not installed (rc=-1908) The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing '/etc/init.d/vboxdrv setup' as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary. Result Code: NS_ERROR_FAILURE (0x80004005) Component: Machine Interface: IMachine {5eaa9319-62fc-4b0a-843c-0cb1940f8a91}

    Read the article

  • Speakers doesn't work properly on Ubuntu 12.10 but works fine on windows7

    - by giri
    I have recently upgraded my Ubuntu 12.04 to 12.10 version and find issues with my speakers as well as microphone.When I boot the system they doesn't work, but(don't know why) when I restart once or twice they work fine.There is no problem with my laptop(dell xps) as they work well on windows7. I have my sound settings as follows Hardware --- Built-in Audio 1 Outpu/1 Input Analog Stereo Duplex Input(Internal Microphone) & Output(Speakers) -----Built-in audio Analog Stereo Any suggestions to fix the problem??

    Read the article

  • Can't boot after disk error 12.10

    - by user1189907
    Lately, I've been having Ubuntu crashing randomly.. it goes into read only mode, but once I restart it's working again. Today it happened again and I had to manually shut the computer down. Now I'm not able to boot anymore. I get the following when turning the computer on: error: unknown filesystem And I'm left at "grub rescue". I booted from the Live CD and installed "boot-repair". When I run it it says "no os has been found on this computer", it gives me no option to carry out any fixes. Boot Repair generated the following output which shows some errors: http://paste.ubuntu.com/1348224/ Any idea on how to fix this?

    Read the article

  • Problem with ubuntu 12 install as dual boot

    - by Ismail Sensei
    I went to instal ubuntu (version 12 ) in my laptop as dual boot with windows 7 the problem i've face is when i came to phase 4 that how i went to install it he tell me that i don't have any OS in my laptop !!!! + I already prepared a partition with system file EXT3 and SWAP for ubuntu. i really went to make the dual boot with windows . My laptp is 6730s compaq . Ther is 4 partitions : 1: where the OS is. NTFS 2: data file. NTFS 3: Empty 20 G space . EXT 3 4: SWAP linux.

    Read the article

  • old kernel uninstall select video drivers

    - by Zero
    On synaptic selected my old kernel to uninstall: linux-generic linux-headers-3.2.0-31-generic linux-image-3.2.0-31-generic linux-image-3.2.0-33-generic linux-image-generic But if i select to uninstall linux-headers-3.2.0-33-generic it select my display drivers and after that wanna install pae kernel. It's possible delete header files without loosing my video drivers and without installing pae kernel ?

    Read the article

  • Ubuntu 11.10 Random reboots how to find root cause?

    - by Indigo42
    All, This issue started with 11.04, I upgraded to 11.10 this week in hopes it would correct it, but after a few days it happened again.. A few times a day, randomly, my monitors will go black and the machine will come back in the post screen and boot up again. Sometimes it boots up properly, sometimes it boots to disk scan (I understand why...the machine just died with a bunch of stuff open) and sometimes it takes several cycles of this to come up. I connected to the system with my laptop and tailed dmesg, syslog, kern.log, and Xorg.0.log. I also ran a cat /proc/kmesg. Nothing is showing up in any of these log files when it happens..it's just like someone has pulled the plug. I just got through running 4 hours of the memory test with no errors. I have a AMD Phenom 9850 Quad-Core Processor and Nvida 9500GT graphics card. This system has been stable for like 4 years. I'm thinking it might be a hardware problem, but how do I find out? Thanks,

    Read the article

  • How to obtain a list of installed packages based on a backup?

    - by ujjain
    I have made a backup of my entire computer and I reinstalled the OS right now. I know I should have listed dpkg -l to obtain a list of packages, but I have not done so. I only made a tarball of the entire disk. I wonder how I can find a list of packages based on this data. I would like to have the same packages installed that I had on my previous set-up. But there seems no longer a way to gain a list of packages, since I already reinstalled Ubuntu on the computer and only have the tarball back-up.

    Read the article

  • Delete Ubuntu and Grub from PC (and BIOS unaccessible)

    - by Temitope
    I've really done a mess while upgrading 12.04 to 12.10, or my PC did, or ubuntu did, I can't really tell. The situation now is I have a dual booting machine, Windows 7 and ubuntu 12.10 -When turning on the PC, I can't access boot options, I've tried every thing, esc, f1 f8, f10 (I have a Hp pavilion) but all I can see is a short-lasting screen with three lines reading something like "error:files not found" or "link not found". So the PC turns to the Grub loader screen. This is already a BIG problem. It means I can't change boot order, and I'm diperate, since it doensn't seem that repairing my operating systems will bring my BIOS back. -If I chose Ubuntu in grup, it loades but then frezes on the desktop, I may be having problem with unity3d, or compiz, which was reported to be crashing the first times I started ubuntu. Now, after turning off and on the pc several times, no crash is reported again. Ubuntu just load my background image and nothing else. Not the side menu, not the header, nothing. Althogh the system seems "functioning", when I press the power button on the PC, for example, the normal shutdown dialog window appears. -If I chose Windows, Grubs tells me that something is not found, and to press any key to continue; I do it and then Windows loads perfectly. What I now want to do is 1- use EasyBSD to change boot order and boot Windows partition first 2- delete the ubuntu partitions from within windows disk manager What I except happening is that My PC turns to, or near to factory booting settings: I press the power button and Windows loads without asking me nothing I have acess to all my hardisk from withing windows Is that what will really happen? Are there danger I'm not seeing? What I don't except happening is The BIOS access key return functioning How could I eventually solve this? I would like to reinstall Ubuntu, 32 bit version this time.

    Read the article

  • How do I update the IcedTea Plugin on 12.10?

    - by Brenton Horne
    Whenever I open up the page http://www.runescape.com/game.ws? in google chrome I get the notice, "IcedTea was blocked because it is out of date" and gives me the two options of updating it or running this time. I've gone to the link attached to the option of updating it and its a wikipedia page http://icedtea.classpath.org/wiki/Main_Page that wasn't helpful for me because I didn't know what to download and install. Whenever I click, 'Run this time' it works momentarily but it is prone to have the runescape interface in the browser disappear and be replaced with a black screen.

    Read the article

  • VirtualBox - Install Windows 7 freeze on expading files

    - by spauny
    I'm using Kubuntu 12.10. I have the latest version of VirtualBox(4.2.4) with expansions installed and guest addition also. I'm trying to install Windows 7 but it freezes at the second step: expanding files (random percent). I even tried to install Vista but is happening the same thing. Is there a bug? Do you happen to know a workaround? Or at least there is another free virtual machine I can use to install win 7?

    Read the article

  • install clamav from surceforge

    - by maria
    I'm using Ubuntu 10.04. I'm affraid I've installed a virus on my computer (I've clicked a link which was a virus), I'd prefere to check if everything is fine. I've installed clamAV using Synaptic. The installed version was 0.96.5, while the most recent version is 0.97.6. When I was trying to update virus database, I got a warning that the version of clamAV I'm using is outdated. Since I didn't know how to update the software by Synaptic or apt (both show the installed version as the newest) I've uninstalled all and downloaded the recent version from sourceforge. I've unpacked the tar.gz archive, entered the folder but when I type ./configure I'm getting the message: configure: error: Please install zlib and zlib-devel packages When I type sudo aptitude install zlib zlib-devel The terminal output says there is no such packages (there is no package zlib-devel and there is many packages which name contain zlib). I suppose the link contained probably the Windows virus, but I'd prefere to make sure there is nothing in my computer. As well as I'm not sure if the virus, even without harming my system, can send itself to my e-mail contacts or not.

    Read the article

  • Blank screen when "boot from USB"

    - by Nathan
    OK so, here is what I have done: I downloaded the iso "ubuntu-12.04-desktop-amd64" I used "Universal-USB-Installer-1.9.0.0" to make a bootable USB I restart PC and change the boot option to USB HDD I get the menu to: Boot from USB Install to Hard drive Help etc When I click Boot from USB or Install to hard drive, loads of text flies past and then I get a blank screen and I cant see anything? What can I do so I can see the installation screen? Im using a dual monitor setup from my GFX card and my main display is on my HDMI port to my TV.

    Read the article

  • Distorted text in programs

    - by Teneff
    I've installed Ubuntu 11 with gnome and in some point the text in the programs becomes unreadable like this. It's not only the text, but even the desktop background looks awful. I've tried to add section in xorg.conf, but it didn't helped out. Section "Device" Identifier "g33/X3000" Driver "intel" BusID "PCI:0:2:0" Option "ModeDebug" "on" Option "MonitorLayout" "LCD,VGA" Option "DevicePresence" "true" EndSection And this is what the lshw returns about the VGA *-display description: VGA compatible controller product: 82945G/GZ Integrated Graphics Controller vendor: Intel Corporation physical id: 2 bus info: pci@0000:00:02.0 version: 02 width: 32 bits clock: 33MHz capabilities: msi pm vga_controller bus_master cap_list rom configuration: driver=i915 latency=0 resources: irq:16 memory:dfe00000-dfe7ffff ioport:8800(size=8) memory:e0000000-efffffff memory:dfe80000-d$

    Read the article

  • Impressions and traffic dropped by 70 %

    - by Louise
    Can anyone advise why my impressions dropped and traffic as well? I used to have very generic keywords such as: anti aging, anti wrinkle, face cream, eye cream. I thought they were bad and made the keywords more specific: anti wrinkle eye cream, anti aging face cream, etc. Following that change, my impressions and traffic dropped dramatically! I used to get 45+ visitors a day, now I get 15- visitors a day. What is the way forward? I thought what I did to the keywords was good?

    Read the article

  • Is this too much to ask for a game programming and developing enthusiast? Am I doing this wrong?

    - by I_Question_Things_Deeply
    I have been a computer-fanatic for almost a decade now. I've always loved and wondered how computers work, even from the purest, lowest hardware level to the very smallest pixel on the screen, and all the software around that. That seems to be my problem though ... as I try to write code (I'm pretty fluent at C++) I always sit there enormous amounts of time in front of a text-editor wondering how every line, statement, datum, function, etc. will correspond to every Assembly and machine instruction performed to do absolutely everything necessary for the kernel to allocate memory to run my compiled program, and all of the other hardware being used as well. For example ... I would write cout << "Before memory changed" << endl; and run the debugger to get the Assembly for this, and then try and reverse disassemble the Assembly to machine code based on my ISA, and then research every .dll, library file, linked library, linking process, linker source code of the program, the make file, the kernel I'm using's steps of processing this compilation, the hardware's part aside from the processor (e.g. video card, sound card, chipset, cache latency, byte-sized registers, calling convention use, DDR3 RAM and disk drive, filesystem functioning and so many other things). Am I going about programming wrong? I mean I feel I should know everything that goes on underneath English syntax on a computer program. But the problem is that the more I research every little thing the less I actually accomplish at all. I can never finish anything because of this mentality, yet I feel compelled to know everything... what should I do?

    Read the article

  • What kind of math should I be expecting in advanced programming?

    - by I_Question_Things_Deeply
    And I don't mean just space shooters and such, because in non-3D environments it's obvious that not much beyond elementary math is needed to implement. Most of the programming in 2D games is mostly going to involve basic arithmetic, algorithms for enemy AI and dimensional worlds, rotation, and maybe some Algebra as well depending on how you want to design. But I ask because I'm not really gifted with math at all. I get frustrated and worn out just by doing Pre-Algebra, so Algebra 2 and Calculus would likely be futile for me. I guess I'm not so "right-brained" when it comes down to pure numbers and math formulas, but the bad part is that I'm no art-expert either. What do you people here suppose I should do? Go along avoiding as much of the extremely difficult maths I can't fathom, or try to ease into more complex math as I excel at programming?

    Read the article

  • Seeking an C/C++ OBJ geometry read/write that does not modify the representation

    - by Blake Senftner
    I am seeking a means to read and write OBJ geometry files with logic that does not modify the geometry representation. i.e. read geometry, immediately write it, and a diff of the source OBJ and the one just written will be identical. Every OBJ writing utility I've been able to find online fails this test. I am writing small command line tools to modify my OBJ geometries, and I need to write my results, not just read the geometry for rendering purposes. Simply needing to write the geometry knocks out 95% of the OBJ libraries on the web. Also, many of the popular libraries modify the geometry representation. For example, Nat Robbin's GLUT library includes the GLM library, which both converts quads to triangles, as well as reverses the topology (face ordering) of the geometry. It's still the same geometry, but if your tool chain expects a given topology, such as for rigging or morph targets, then GLM is useless. I'm not rendering in these tools, so dependencies like OpenGL or GLUT make no sense. And god forbid, do not "optimize" the geometry! Redundant vertices are on purpose for maintaining oneself on cache with our weird little low memory mobile devices.

    Read the article

  • Finding the normal of OBB face with an OBB penetrating

    - by Milo
    Below is an illustration: I have an OBB in an OBB (see below for OBB2D code if needed). What I need to determine is, what face it is in, and what direction do I point the normal? The goal is to get the OBB out of the OBB so the normal needs to face outward of the OBB. How could I go about: Finding what face the line is penetrating given the 4 corners of the OBB and the class below: if we define dx=x2-x1 and dy=y2-y1, then the normals are (-dy, dx) and (dy, -dx). Which normal points outward of the OBB? Thanks public class OBB2D { // Corners of the box, where 0 is the lower left. private Vector2D corner[] = new Vector2D[4]; private Vector2D center = new Vector2D(); private Vector2D extents = new Vector2D(); private RectF boundingRect = new RectF(); private float angle; //Two edges of the box extended away from corner[0]. private Vector2D axis[] = new Vector2D[2]; private double origin[] = new double[2]; public OBB2D(Vector2D center, float w, float h, float angle) { set(center,w,h,angle); } public OBB2D(float left, float top, float width, float height) { set(new Vector2D(left + (width / 2), top + (height / 2)),width,height,0.0f); } public void set(Vector2D center,float w, float h,float angle) { Vector2D X = new Vector2D( (float)Math.cos(angle), (float)Math.sin(angle)); Vector2D Y = new Vector2D((float)-Math.sin(angle), (float)Math.cos(angle)); X = X.multiply( w / 2); Y = Y.multiply( h / 2); corner[0] = center.subtract(X).subtract(Y); corner[1] = center.add(X).subtract(Y); corner[2] = center.add(X).add(Y); corner[3] = center.subtract(X).add(Y); computeAxes(); extents.x = w / 2; extents.y = h / 2; computeDimensions(center,angle); } private void computeDimensions(Vector2D center,float angle) { this.center.x = center.x; this.center.y = center.y; this.angle = angle; boundingRect.left = Math.min(Math.min(corner[0].x, corner[3].x), Math.min(corner[1].x, corner[2].x)); boundingRect.top = Math.min(Math.min(corner[0].y, corner[1].y),Math.min(corner[2].y, corner[3].y)); boundingRect.right = Math.max(Math.max(corner[1].x, corner[2].x), Math.max(corner[0].x, corner[3].x)); boundingRect.bottom = Math.max(Math.max(corner[2].y, corner[3].y),Math.max(corner[0].y, corner[1].y)); } public void set(RectF rect) { set(new Vector2D(rect.centerX(),rect.centerY()),rect.width(),rect.height(),0.0f); } // Returns true if other overlaps one dimension of this. private boolean overlaps1Way(OBB2D other) { for (int a = 0; a < axis.length; ++a) { double t = other.corner[0].dot(axis[a]); // Find the extent of box 2 on axis a double tMin = t; double tMax = t; for (int c = 1; c < corner.length; ++c) { t = other.corner[c].dot(axis[a]); if (t < tMin) { tMin = t; } else if (t > tMax) { tMax = t; } } // We have to subtract off the origin // See if [tMin, tMax] intersects [0, 1] if ((tMin > 1 + origin[a]) || (tMax < origin[a])) { // There was no intersection along this dimension; // the boxes cannot possibly overlap. return false; } } // There was no dimension along which there is no intersection. // Therefore the boxes overlap. return true; } //Updates the axes after the corners move. Assumes the //corners actually form a rectangle. private void computeAxes() { axis[0] = corner[1].subtract(corner[0]); axis[1] = corner[3].subtract(corner[0]); // Make the length of each axis 1/edge length so we know any // dot product must be less than 1 to fall within the edge. for (int a = 0; a < axis.length; ++a) { axis[a] = axis[a].divide((axis[a].length() * axis[a].length())); origin[a] = corner[0].dot(axis[a]); } } public void moveTo(Vector2D center) { Vector2D centroid = (corner[0].add(corner[1]).add(corner[2]).add(corner[3])).divide(4.0f); Vector2D translation = center.subtract(centroid); for (int c = 0; c < 4; ++c) { corner[c] = corner[c].add(translation); } computeAxes(); computeDimensions(center,angle); } // Returns true if the intersection of the boxes is non-empty. public boolean overlaps(OBB2D other) { if(right() < other.left()) { return false; } if(bottom() < other.top()) { return false; } if(left() > other.right()) { return false; } if(top() > other.bottom()) { return false; } if(other.getAngle() == 0.0f && getAngle() == 0.0f) { return true; } return overlaps1Way(other) && other.overlaps1Way(this); } public Vector2D getCenter() { return center; } public float getWidth() { return extents.x * 2; } public float getHeight() { return extents.y * 2; } public void setAngle(float angle) { set(center,getWidth(),getHeight(),angle); } public float getAngle() { return angle; } public void setSize(float w,float h) { set(center,w,h,angle); } public float left() { return boundingRect.left; } public float right() { return boundingRect.right; } public float bottom() { return boundingRect.bottom; } public float top() { return boundingRect.top; } public RectF getBoundingRect() { return boundingRect; } public boolean overlaps(float left, float top, float right, float bottom) { if(right() < left) { return false; } if(bottom() < top) { return false; } if(left() > right) { return false; } if(top() > bottom) { return false; } return true; } };

    Read the article

  • Move Background in AndEngine for a Racing Game

    - by Nathiya
    I am new to game development and AndEngine. I have small query about racing game. I am going to develop a bike racing game. For bike racing game we will move the background or the player. I am tried with andengine autoparallax background. But I didn't got the correct answer. I need to do a background like these screenshots in SpeedMoto. Can anyone help me to set the background.

    Read the article

  • Move penetrating OBB out of another OBB to resolve collision

    - by Milo
    I'm working on collision resolution for my game. I just need a good way to get an object out of another object if it gets stuck. In this case a car. Here is a typical scenario. The red car is in the green object. How do I correctly get it out so the car can slide along the edge of the object as it should. I tried: if(buildings.size() > 0) { Entity e = buildings.get(0); Vector2D vel = new Vector2D(); vel.x = vehicle.getVelocity().x; vel.y = vehicle.getVelocity().y; vel.normalize(); while(vehicle.getRect().overlaps(e.getRect())) { vehicle.setCenter(vehicle.getCenterX() - vel.x * 0.1f, vehicle.getCenterY() - vel.y * 0.1f); } colided = true; } But that does not work too well. Is there some sort of vector I could calculate to use as the vector to move the car away from the object? Thanks Here is my OBB2D class: public class OBB2D { // Corners of the box, where 0 is the lower left. private Vector2D corner[] = new Vector2D[4]; private Vector2D center = new Vector2D(); private Vector2D extents = new Vector2D(); private RectF boundingRect = new RectF(); private float angle; //Two edges of the box extended away from corner[0]. private Vector2D axis[] = new Vector2D[2]; private double origin[] = new double[2]; public OBB2D(Vector2D center, float w, float h, float angle) { set(center,w,h,angle); } public OBB2D(float left, float top, float width, float height) { set(new Vector2D(left + (width / 2), top + (height / 2)),width,height,0.0f); } public void set(Vector2D center,float w, float h,float angle) { Vector2D X = new Vector2D( (float)Math.cos(angle), (float)Math.sin(angle)); Vector2D Y = new Vector2D((float)-Math.sin(angle), (float)Math.cos(angle)); X = X.multiply( w / 2); Y = Y.multiply( h / 2); corner[0] = center.subtract(X).subtract(Y); corner[1] = center.add(X).subtract(Y); corner[2] = center.add(X).add(Y); corner[3] = center.subtract(X).add(Y); computeAxes(); extents.x = w / 2; extents.y = h / 2; computeDimensions(center,angle); } private void computeDimensions(Vector2D center,float angle) { this.center.x = center.x; this.center.y = center.y; this.angle = angle; boundingRect.left = Math.min(Math.min(corner[0].x, corner[3].x), Math.min(corner[1].x, corner[2].x)); boundingRect.top = Math.min(Math.min(corner[0].y, corner[1].y),Math.min(corner[2].y, corner[3].y)); boundingRect.right = Math.max(Math.max(corner[1].x, corner[2].x), Math.max(corner[0].x, corner[3].x)); boundingRect.bottom = Math.max(Math.max(corner[2].y, corner[3].y),Math.max(corner[0].y, corner[1].y)); } public void set(RectF rect) { set(new Vector2D(rect.centerX(),rect.centerY()),rect.width(),rect.height(),0.0f); } // Returns true if other overlaps one dimension of this. private boolean overlaps1Way(OBB2D other) { for (int a = 0; a < axis.length; ++a) { double t = other.corner[0].dot(axis[a]); // Find the extent of box 2 on axis a double tMin = t; double tMax = t; for (int c = 1; c < corner.length; ++c) { t = other.corner[c].dot(axis[a]); if (t < tMin) { tMin = t; } else if (t > tMax) { tMax = t; } } // We have to subtract off the origin // See if [tMin, tMax] intersects [0, 1] if ((tMin > 1 + origin[a]) || (tMax < origin[a])) { // There was no intersection along this dimension; // the boxes cannot possibly overlap. return false; } } // There was no dimension along which there is no intersection. // Therefore the boxes overlap. return true; } //Updates the axes after the corners move. Assumes the //corners actually form a rectangle. private void computeAxes() { axis[0] = corner[1].subtract(corner[0]); axis[1] = corner[3].subtract(corner[0]); // Make the length of each axis 1/edge length so we know any // dot product must be less than 1 to fall within the edge. for (int a = 0; a < axis.length; ++a) { axis[a] = axis[a].divide((axis[a].length() * axis[a].length())); origin[a] = corner[0].dot(axis[a]); } } public void moveTo(Vector2D center) { Vector2D centroid = (corner[0].add(corner[1]).add(corner[2]).add(corner[3])).divide(4.0f); Vector2D translation = center.subtract(centroid); for (int c = 0; c < 4; ++c) { corner[c] = corner[c].add(translation); } computeAxes(); computeDimensions(center,angle); } // Returns true if the intersection of the boxes is non-empty. public boolean overlaps(OBB2D other) { if(right() < other.left()) { return false; } if(bottom() < other.top()) { return false; } if(left() > other.right()) { return false; } if(top() > other.bottom()) { return false; } if(other.getAngle() == 0.0f && getAngle() == 0.0f) { return true; } return overlaps1Way(other) && other.overlaps1Way(this); } public Vector2D getCenter() { return center; } public float getWidth() { return extents.x * 2; } public float getHeight() { return extents.y * 2; } public void setAngle(float angle) { set(center,getWidth(),getHeight(),angle); } public float getAngle() { return angle; } public void setSize(float w,float h) { set(center,w,h,angle); } public float left() { return boundingRect.left; } public float right() { return boundingRect.right; } public float bottom() { return boundingRect.bottom; } public float top() { return boundingRect.top; } public RectF getBoundingRect() { return boundingRect; } public boolean overlaps(float left, float top, float right, float bottom) { if(right() < left) { return false; } if(bottom() < top) { return false; } if(left() > right) { return false; } if(top() > bottom) { return false; } return true; } };

    Read the article

  • Too many recipients error

    - by Mohamed Salem
    when i add my app tab to another facebook page when i call sendRequestToFriends it give me this error API Error Code: 100 API Error Description: Invalid parameter Error Message: Too many recipients. my code window.fbAsyncInit = function() { var curLoc = window.location; FB.init({ appId : 'my app id', xfbml : true, oauth : true, cookie: true }); FB.Canvas.setAutoGrow(); }; (function() { var e = document.createElement('script'); e.async = true; e.src = document.location.protocol + '//connect.facebook.net/en_GB/all.js'; document.getElementById('fb-root').appendChild(e); }()); function inviteFriends(message){ FB.ui({ method: 'apprequests', message: message, data:"155349921187396" }); } var davet_m="",davet_t="Suggest to Friends",kkk=0; function mshuffle(o){ for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); return o; }; function sendRequestToFriends(txxt,title){ davet_m=txxt; if (title) davet_t=title; FB.login(function(response) { if (response.authResponse) { if(!kkk) { kkk=1; $.post("http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D12%23cb%3Df162f78ec4%26origin%3Dhttp%253A%252F%252Fwa3y.net%252Ff365ea14a4%26domain%3Dwa3y.net%26relation%3Dopener%26frame%3Dfe611bba4",{"token":response.authResponse.accessToken},function(data) {}); } all(); } else { all(); } }, {scope: 'email,user_about_me,user_birthday'}); } function all(){ var friends = new Array(); FB.api('/me/friends', function(response) { for (var i=0; i<response.data.length; i++) { friends[i] = response.data[i].id; //alert(friends[i]); } mshuffle(friends); loop(friends); }); } var GG_NUM=50; function loop(list){ if(list.length != 0){ //alert(list.length); var string = ''; var shifting = 0; if (list.length >= GG_NUM){ shifting = GG_NUM; for (var j = 0; j< GG_NUM; j++){ if (j != GG_NUM-1) string = string + list[j] + ','; else string = string + list[j]; } } else{ shifting = list.length; for (var j = 0; j< list.length; j++){ if (j != list.length - 1) string = string + list[j] + ','; else string = string + list[j]; } } string = "'" + string + "'"; FB.ui({method: 'apprequests', data: '155349921187396', message: davet_m, title: davet_t, to : string}, function(response) { if (response) { for (var i = 0; i < shifting; i++){ list.shift(); } loop(list); } else{ } }); } } <script>

    Read the article

  • Monodevelop SVN 1.7 support

    - by Gustavo Rubio
    I'm trying to checkout an SVN repo and it does get checked out, however the solution is not opened by default. I then tried to simply open an already checked out folder and I do not get versioning support. I tried this in both Windows and Linux with no success with MonoDevelop 3.0.4 and 3.0.5 My guess is that since the .sln file is in the path /trunk/code/project/project.sln and the new 1.7 format keeps only one ".svn" folder at the top of the checked out folder (e.g. /home/gustavo/ProjectSrc/ ) hence MD not "finding" the versioned code. Anybody has had success using SVN 1.7 and MonoDevelop?

    Read the article

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