Daily Archives

Articles indexed Tuesday November 22 2011

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

  • Purely technical reasons for PHP as a first choice?

    - by JoelFan
    I know this may come off as a flame-y / troll-y, but I hope you will take my word for it that it's not my intention. I am just trying to understand the PHP phenomenon. After looking at the many technical issues with the language design of PHP, I am hard pressed to find any redeeming technical advantages where PHP surpasses all other languages. Before coming to the conclusion that there would simply be no reason to choose PHP as a development language on purely technical grounds, I would like to ask, if all non-technical factors were equal (such as what language the developers already know, what languages the hosting provider offers, language of existing code, cost, license, corporate fiat, etc.), would there be any type of new software system that would indicate making PHP a first choice for development? If so, what technical advantage does PHP have over all other languages that would cause you to choose it? EDIT: I am not interested in comparing PHP "out of the box" with other languages "out of the box". If PHP has a certain feature "out of the box" that another language has only after installing some readily available add-on, that is not considered an advantage for PHP for the purposes of this question.

    Read the article

  • Unity Launcher only runs once - requires lightdm restart before it runs again

    - by Don
    I have an intermittent problem that just started showing up several days ago. I am running 11.10 and all updates are current. I first saw the symptom with a custom version of the "Home" nautilus-home.desktop file I created in ~/.local.share/applications. I added a few static shortcuts to specific folders. What I found was, clikcing the icon once would open up my home folder, but after closing that nautilus window, clicking the icon again did nothing (did not even show icon backlight animation). However, I could right click on the same icon and access my short cuts as many times as I want. Symptom persisted until restarting lightdm. Just yesterday I saw the same sort of symptom happen with a custom launcher I created for a chromium-borwser to open a specific URL (with a few short cuts to other URLs). Click the icon - it works once. Then never again. Right click the icon and I can use the short cuts over and over - no problem. Note - at one point I assumed I might have a problem with my custom .desktop file, so I did a test by removing my custom nautilus-home.desktop. However, even after restarting lightdm, and verifying the home icon was the standard one from /opt/share/applications (all my custom shortcuts were gone) I saw the same symptom re-appear - it runs once and then not again until restarting lightdm. It seems to be intermittent and seems to move between various launchers. Not sure what to do or even what background data to gather. Attempt to improve question after the first answer: I tried the following: 1) remove all custom launchers 2) reboot 3) add custom lauchers back 4) reboot 5) attempt to use .... still have "runs once and never again" symptom with several launchers

    Read the article

  • Is it normal to not have desktop effects after installing on an Asus N53S?

    - by Fabzter
    I've just installed 11.10 and so far so great, except I just discovered (after looking at another installation) I'm missing some effects. First of all, I am using unity 3d (I chose ubuntu at the login menu), and have already the correct nvidia drivers. Yet, my launcher is the same from unity 2d, the same as the app switcher, and when dragging windows to screen corners, they don't get grabbed. This "error" was present since the begining, so I was not able to detect it. Please help, I want to have an ubuntu experience as nice as everyone else. EDIT 1: I'm using an Asus N53S. My graphic card is Nvidia geforce GT540M. It says cuda, if that matters.

    Read the article

  • Sigmatel sound card not working on an Dell XPS m2010

    - by ralph crowhurst
    I've installed Ubuntu 11.4 on my dell xps m2010 using wubi. Then booted up and could not connect to the Internet using 3three huawei e122 usb mobile broadband (I would like this to work also). I've managed to connect through a wireless network, I went to my favorite sites and was told I needed to install adobe flash player.This what I did players run and picture is good. But there is no sound! Then I've tried to play songs in Banshee, but no sound. I have checked everything in sound preferences including test speaker, there is sound. I have sigmatel sound card. Thanks

    Read the article

  • 500 Error on index.php file. All other php files are working well

    - by Stas
    I've successfully installed LAMP and created some virtual hosts. Everything is working fine except index.php files. When I try access them, browser returns 500 Error, regardless of their content. All other PHP files are working fine, index.html files can be opened without any errors. Please, help me to resolve this problem. I guess something wrong with server configuration, but I didn't find what exactly.

    Read the article

  • Sound not working on an Intel 5 Series/3400

    - by phoenix7
    lspci gives me these two devices: $ lspci | grep Audio 00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 05) 02:00.1 Audio device: ATI Technologies Inc RV710/730 There are two devices listed in System Settings|Sound|Output: RV710/730 Digital Stereo (HDMI) Internal Audio Analog Stereo And finally, the are not muted! Also, when I run an application that accesses the sound card, I can see it in the Applications tab. Any ideas?

    Read the article

  • Using External Monitor with Laptop Monitor as separate monitors

    - by user14623
    I am trying to use 32"LCD monitor with my ubuntu 10.10 installation. I am trying to use my laptop screen and external monitor at the same time but having two separate desktops. I also want to use my laptop with 1280x800 resolution and external one with 1920 x 1080 using VGA. However, ubuntu sees my external LCD as a CRT and provide 13....x... resolution at the best not above. My graphics card driver is Nvidia 270.... driver. Is ubuntu capable of using two monitors separately or should i give up? Thank you

    Read the article

  • Accessing home directory hangs

    - by Jeff
    Occasionally my laptop will hang when trying to access my home directory. The only fix so far is to reboot and then it goes away for a week. /var/log/kern.log has the following error: Nov 21 13:54:39 Laptop1 kernel: [231480.428107] INFO: task ls:10104 blocked for more than 120 seconds. Nov 21 13:54:39 Laptop1 kernel: [231480.428114] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. Nov 21 13:54:39 Laptop1 kernel: [231480.428120] ls D f5dbf6a0 0 10104 9964 0x00000004 Nov 21 13:54:39 Laptop1 kernel: [231480.428130] f3edbd40 00000086 00000001 f5dbf6a0 00000000 00000001 c175dfe0 c1868ec0 Nov 21 13:54:39 Laptop1 kernel: [231480.428145] c1868ec0 054eadaf 0000d250 f5005ec0 ee940cc0 f3e5b300 f3edbcf8 c10e8bfa Nov 21 13:54:39 Laptop1 kernel: [231480.428159] f3edbd10 f3edbd10 f3edbd10 c102b505 fffba7e8 089fa000 f3edbd38 c10fb528 Nov 21 13:54:39 Laptop1 kernel: [231480.428173] Call Trace: Nov 21 13:54:39 Laptop1 kernel: [231480.428189] [<c10e8bfa>] ? lru_cache_add_lru+0x2a/0x50 Nov 21 13:54:39 Laptop1 kernel: [231480.428199] [<c102b505>] ? __kunmap_atomic+0x75/0xa0 Nov 21 13:54:39 Laptop1 kernel: [231480.428207] [<c10fb528>] ? do_anonymous_page+0x1f8/0x280 Nov 21 13:54:39 Laptop1 kernel: [231480.428218] [<c152b656>] __mutex_lock_slowpath+0xc6/0x120 Nov 21 13:54:39 Laptop1 kernel: [231480.428225] [<c152b304>] mutex_lock+0x24/0x40 Nov 21 13:54:39 Laptop1 kernel: [231480.428246] [<f83ab87c>] cifs_reconnect_tcon+0x13c/0x2a0 [cifs] Nov 21 13:54:39 Laptop1 kernel: [231480.428255] [<c152fa00>] ? vmalloc_fault+0xee/0xee Nov 21 13:54:39 Laptop1 kernel: [231480.428262] [<c152fc2f>] ? do_page_fault+0x22f/0x4a0 Nov 21 13:54:39 Laptop1 kernel: [231480.428276] [<f83abe3c>] smb_init+0x2c/0x90 [cifs] Nov 21 13:54:39 Laptop1 kernel: [231480.428285] [<c11aa42e>] ? ext4_htree_store_dirent+0x2e/0x120 Nov 21 13:54:39 Laptop1 kernel: [231480.428301] [<f83b0941>] CIFSSMBQPathInfo+0x41/0x210 [cifs] Nov 21 13:54:39 Laptop1 kernel: [231480.428319] [<f83c39e4>] ? cifs_get_inode_info+0x224/0x390 [cifs] Nov 21 13:54:39 Laptop1 kernel: [231480.428336] [<f83c3a21>] cifs_get_inode_info+0x261/0x390 [cifs] Nov 21 13:54:39 Laptop1 kernel: [231480.428354] [<f83bb35d>] ? build_path_from_dentry+0xcd/0x250 [cifs] Nov 21 13:54:39 Laptop1 kernel: [231480.428362] [<c102b69e>] ? kmap_atomic_prot+0xde/0x100 Nov 21 13:54:39 Laptop1 kernel: [231480.428370] [<c152c4cd>] ? _raw_spin_lock+0xd/0x10 Nov 21 13:54:39 Laptop1 kernel: [231480.428388] [<f83c6378>] ? _GetXid+0x58/0x80 [cifs] Nov 21 13:54:39 Laptop1 kernel: [231480.428405] [<f83c4f81>] cifs_revalidate_dentry_attr+0x111/0x1a0 [cifs] Nov 21 13:54:39 Laptop1 kernel: [231480.428423] [<f83c50e2>] cifs_getattr+0x52/0x120 [cifs] Nov 21 13:54:39 Laptop1 kernel: [231480.428431] [<c112c5b2>] vfs_getattr+0x42/0x70 Nov 21 13:54:39 Laptop1 kernel: [231480.428448] [<f83c5090>] ? cifs_revalidate_dentry+0x40/0x40 [cifs] Nov 21 13:54:39 Laptop1 kernel: [231480.428455] [<c112c647>] vfs_fstatat+0x67/0x80 Nov 21 13:54:39 Laptop1 kernel: [231480.428461] [<c112c680>] vfs_lstat+0x20/0x30 Nov 21 13:54:39 Laptop1 kernel: [231480.428468] [<c112c946>] sys_lstat64+0x16/0x30 Nov 21 13:54:39 Laptop1 kernel: [231480.428475] [<c11341ed>] ? link_path_walk+0x79d/0x8a0 Nov 21 13:54:39 Laptop1 kernel: [231480.428483] [<c152c8e4>] syscall_call+0x7/0xb

    Read the article

  • How do I ensure all of the ports on my machine are open or reachable?

    - by Rev3rse
    I was testing port connectivity on my machine because WoW (which uses TCP ports 3724, 6112, and 6881-6999) couldn't connect to the Internet. So I downloaded PFPortChecker application and ran it using Wine (v1.3). After I tried to check every port, it seems like they're not reachable/closed. Why is that? My firewall is disabled so why is this happening? How can I open these ports and how can I see if these ports are opened or not? Also, how can I determine which application is using them?

    Read the article

  • Realtek RTL8168/8111E onboard NIC not recognized - the everlasting problem?

    - by Nikioko
    I used the newest vendor driver for my onboard NIC (board: ASUS M5A97 Pro) and those sites to get it running on kernel 3.0: http://www.twm-kd.com/linux/realtek-rtl81688111e-and-ubuntu-linux/ The problem now is, that this doesn't work with either kernel 3.1 or 3.2: https://code.google.com/p/r8168/issues/detail?id=6 My question is: does anyone have a solution to get it run on the newest kernel? Or is this a plaque I have to carry forever?

    Read the article

  • Ubuntu 11.10 with KDE installed does not prompt for elevation for privileged ops in all apps

    - by Michael Goldshteyn
    I installed the KDE window manager on top of Ubuntu 11.10 and while I am using KDE, I do not get an elevation dialog when I try to perform tasks that require root privileges. Instead, the operations silently fail, unless I launch apps from a terminal, in which case I get errors like: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py", line 649, in on_isv_source_toggled self.backend.ToggleSourceUse(str(source_entry)) File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 143, in __call__ **keywords) File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 630, in call_blocking message, timeout) dbus.exceptions.DBusException: com.ubuntu.SoftwareProperties.PermissionDeniedByPolicy: com.ubuntu.softwareproperties.applychanges Or from the muon package manager, an error dialog such as: Does anyone know what I need to do to fix this, so that I get a proper dialog asking for elevation? Otherwise, I have to start each app that may need root privs with sudo from a terminal or gksudo. Thanks

    Read the article

  • HTC Android device mounted as USB drive is read-only unless I'm root

    - by Ian Dickinson
    When I connect my HTC Incredible S to my Ubuntu 10.10 system as a USB drive, the device seems to mount OK, but is read-only unless I access it as root. For example, if I run nautilus, I can't drag and drop files to the SD-card in the phone, but if I run sudo nautilus I can. I have USB debug support set on the phone (Applications > Development > USB debugging) and I have added a rule for the device in /etc/udev/rules.d/51-android.rules on my Ubuntu system. Any suggestions as to how I can mount the drive so that I can copy content to the SD card without needing to sudo? Update Following advice from waltinator, I added the following line to my /etc/fstab: UUID=3537-3834 /media/usb1 vfat rw,user,noexec,nodev,nosuid,noauto However, the Android device is still being auto-mounted on /media/usb1 with uid and gid root. Update 2 syslog output: Nov 21 23:38:40 rowan-15 usbmount[4352]: executing command: mount -tvfat -osync,noexec,nodev,noatime,nodiratime /dev/sdd1 /media/usb1 Nov 21 23:38:40 rowan-15 usbmount[4352]: executing command: run-parts /etc/usbmount/mount.d

    Read the article

  • Black Screen after Resume from Sleep (Kubuntu)

    - by user20271
    I know there is a lot of other posts like this, but I have been looking for hours and I still haven't found any solution. I have recently installed Kubuntu Linux along side my Windows 7, the sleep on my Win7 works fine and resumes like normal. When I am loaded into Kubuntu, and I put my laptop to sleep, it goes into sleep as normal. When I go to RESUME from the sleep, the screen stays solid black, it doesn't light up, no blinking curser or anything. The Wi-Fi light is 'off' (orange) and I cannot turn it on. The Caps lock and the Num lock lights on the keyboard blink slowly. I hear something on the inside of the computer start to spin. I am not very experienced with Kubuntu/Linux, but I do know a bunch of computer terminology, I am still far from an expert though. I have about 300GB designated to my Win7 stuff, and another partition with about 100GB for my Kubuntu Linux. My computers specs are as follows: Windows 7 64-bit I have the most recent version of Kubuntu because I just downloaded it a few days ago and updated it yesterday. AMD Athlon Duel-Core processor 4GB of RAM And it is a HP G61 Laptop

    Read the article

  • Finding terms surrounding a trending hashtag?

    - by aendrew
    I'm looking for a way to find "sub-trends", or words that are trending beneath a larger trend. For instance, say "#foo" is the hashtag for a conference. Searching for "#foo" only gives you a general overview of what people are talking about -- if "#foo" moves too quickly, it becomes really difficult to track disparite conversations at #foo. If "#bar" and "#abc" are two different sessions at "#foo", one can find more specific information by searching for "#foo #bar" or "#foo #abc"; yet, how would one find out about the existence of these surrounding hashtags, i.e., sub-trends? If you look at the screenshot for Peoplebrowsr, there's a panel that looks for "words surrounding [trend]," which seems to be exactly what I'm looking for. Is there a way to accomplish this more simply, i.e., without paying $149 /mo. for Peoplebrowsr? Thanks! Update: Another service that can do this is Twazzup (click for example). The "Community" panel has some limited info on surrounding words; is there a tool that does this, but with more detail?

    Read the article

  • Error when setting Piwik analytics

    - by bertran
    I've uploaded the latest version of Piwik unto my web server, which is hosted by go daddy.com, on a linux hosting plan. I'm setting it up (accessing it from my browser as instructed) and I have the "Piwikinstallation" page open on step 3 (database set-up ) of 9. I don't know what to imput in the field "database server"... the default is the number 127.0.0.1 When I leave that input as is, and click "Next" leaving the gives the error: "Error when trying to connect to database server: SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 111" and changing that input to "localhost" gives me another error: "Error when trying to connect to database server:SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)"

    Read the article

  • Why not AJAX'ify entire websites?

    - by Anonymous -
    Is there any solid reasoning as to why sites shouldn't be developed with ajax functionality that loads major parts of each part (assuming there are elements like the header, navigation etc that remain the same)? Surely it would be less resource-intensive since the server wouldn't have to serve content that appears on every page, benefiting both the host and end-user. Answer the question taking into consideration: The sites javascript behaviour degrades gracefully in every instance For my question I'm talking about new sites where this behaviour could be implemented rather from the off, so it doesn't technically cost any money - we're not returning to a finished product to implement it.

    Read the article

  • auth_mysql and php [migrated]

    - by user1052448
    I have a directory with auth_mysql in a virtualhost file password protected using a mysql user/pass combo. The problem I have is one file inside that directory needs to be accessed without a user/pass. Is there a way I can pass the user/pass within the php file? Or excluse the one file? What would I put between the code below? <Location /password-protected> ...mysql password protection require valid-user </Location>

    Read the article

  • Smooth animation in Cocos2d for iOS

    - by MrDatabase
    I move a simple CCSprite around the screen of an iOS device using this code: [self schedule:@selector(update:) interval:0.0167]; - (void) update:(ccTime) delta { CGPoint currPos = self.position; currPos.x += xVelocity; currPos.y += yVelocity; self.position = currPos; } This works however the animation is not smooth. How can I improve the smoothness of my animation? My scene is exceedingly simple (just has one full-screen CCSprite with a background image and a relatively small CCSprite that moves slowly). I've logged the ccTime delta and it's not consistent (it's almost always greater than my specified interval of 0.0167... sometimes up to a factor of 4x). I've considered tailoring the motion in the update method to the delta time (larger delta = larger movement etc). However given the simplicity of my scene it's seems there's a better way (and something basic that I'm probably missing).

    Read the article

  • Best way to implement mouse-based movement in MMOG

    - by fiftyeight
    I want to design an MMO where players click the destination they want to walk to with their mouse and the character moves there, similar to Runescape in this manner. I think it should be easier than keyboard movement since the client can simply send the server the destination each time the player clicks on a destination. The main thing I'm trying to decide is what to do when there are obstacles in the way. It's no problem to implement a simple path-finding solution on the client, the question is if the server will do path-finding as well, since it'll probably take too much Computation power from the server. What I though is that when there is an obstacle the client will send only the first coordinate it plans to go to and then when he gets there he'll send the next coordinate automatically. For example if there is a rock in the way the character will decide on a route that is made of two destinations so it goes around the rock and when it arrives at the first destination it sends the next coordinate. That way if the player changes destination is the middle he won't send unnecessary information. Is this a good way to implement it and is there a standard way MMOGs usually do it? EDIT: I should also mention that the server will make sure all movements are legal and there aren't any walls in the way etc. In the way I wrote it should be quite easy since all movements will be sent in straight lines so the server will just check there aren't any obstacles along that line.

    Read the article

  • How to import or "using" a custom class in Unity script?

    - by Bobbake4
    I have downloaded the JSONObject plugin for parsing JSON in Unity but when I use it in a script I get an error indicating JSONObject cannot be found. My question is how do I use a custom object class defined inside another class. I know I need a using directive to solve this but I am not sure of the path to these custom objects I have imported. They are in the root project folder inside JSONObject folder and class is called JSONObject. Thanks

    Read the article

  • Movement and Collision with AABB

    - by Jeremy Giberson
    I'm having a little difficulty figuring out the following scenarios. http://i.stack.imgur.com/8lM6i.png In scenario A, the moving entity has fallen to (and slightly into the floor). The current position represents the projected position that will occur if I apply the acceleration & velocity as usual without worrying about collision. The Next position, represents the corrected projection position after collision check. The resulting end position is the falling entity now rests ON the floor--that is, in a consistent state of collision by sharing it's bottom X axis with the floor's top X axis. My current update loop looks like the following: // figure out forces & accelerations and project an objects next position // check collision occurrence from current position -> projected position // if a collision occurs, adjust projection position Which seems to be working for the scenario of my object falling to the floor. However, the situation becomes sticky when trying to figure out scenario's B & C. In scenario B, I'm attempt to move along the floor on the X axis (player is pressing right direction button) additionally, gravity is pulling the object into the floor. The problem is, when the object attempts to move the collision detection code is going to recognize that the object is already colliding with the floor to begin with, and auto correct any movement back to where it was before. In scenario C, I'm attempting to jump off the floor. Again, because the object is already in a constant collision with the floor, when the collision routine checks to make sure moving from current position to projected position doesn't result in a collision, it will fail because at the beginning of the motion, the object is already colliding. How do you allow movement along the edge of an object? How do you allow movement away from an object you are already colliding with. Extra Info My collision routine is based on AABB sweeping test from an old gamasutra article, http://www.gamasutra.com/view/feature/3383/simple_intersection_tests_for_games.php?page=3 My bounding box implementation is based on top left/bottom right instead of midpoint/extents, so my min/max functions are adjusted. Otherwise, here is my bounding box class with collision routines: public class BoundingBox { public XYZ topLeft; public XYZ bottomRight; public BoundingBox(float x, float y, float z, float w, float h, float d) { topLeft = new XYZ(); bottomRight = new XYZ(); topLeft.x = x; topLeft.y = y; topLeft.z = z; bottomRight.x = x+w; bottomRight.y = y+h; bottomRight.z = z+d; } public BoundingBox(XYZ position, XYZ dimensions, boolean centered) { topLeft = new XYZ(); bottomRight = new XYZ(); topLeft.x = position.x; topLeft.y = position.y; topLeft.z = position.z; bottomRight.x = position.x + (centered ? dimensions.x/2 : dimensions.x); bottomRight.y = position.y + (centered ? dimensions.y/2 : dimensions.y); bottomRight.z = position.z + (centered ? dimensions.z/2 : dimensions.z); } /** * Check if a point lies inside a bounding box * @param box * @param point * @return */ public static boolean isPointInside(BoundingBox box, XYZ point) { if(box.topLeft.x <= point.x && point.x <= box.bottomRight.x && box.topLeft.y <= point.y && point.y <= box.bottomRight.y && box.topLeft.z <= point.z && point.z <= box.bottomRight.z) return true; return false; } /** * Check for overlap between two bounding boxes using separating axis theorem * if two boxes are separated on any axis, they cannot be overlapping * @param a * @param b * @return */ public static boolean isOverlapping(BoundingBox a, BoundingBox b) { XYZ dxyz = new XYZ(b.topLeft.x - a.topLeft.x, b.topLeft.y - a.topLeft.y, b.topLeft.z - a.topLeft.z); // if b - a is positive, a is first on the axis and we should use its extent // if b -a is negative, b is first on the axis and we should use its extent // check for x axis separation if ((dxyz.x >= 0 && a.bottomRight.x-a.topLeft.x < dxyz.x) // negative scale, reverse extent sum, flip equality ||(dxyz.x < 0 && b.topLeft.x-b.bottomRight.x > dxyz.x)) return false; // check for y axis separation if ((dxyz.y >= 0 && a.bottomRight.y-a.topLeft.y < dxyz.y) // negative scale, reverse extent sum, flip equality ||(dxyz.y < 0 && b.topLeft.y-b.bottomRight.y > dxyz.y)) return false; // check for z axis separation if ((dxyz.z >= 0 && a.bottomRight.z-a.topLeft.z < dxyz.z) // negative scale, reverse extent sum, flip equality ||(dxyz.z < 0 && b.topLeft.z-b.bottomRight.z > dxyz.z)) return false; // not separated on any axis, overlapping return true; } public static boolean isContactEdge(int xyzAxis, BoundingBox a, BoundingBox b) { switch(xyzAxis) { case XYZ.XCOORD: if(a.topLeft.x == b.bottomRight.x || a.bottomRight.x == b.topLeft.x) return true; return false; case XYZ.YCOORD: if(a.topLeft.y == b.bottomRight.y || a.bottomRight.y == b.topLeft.y) return true; return false; case XYZ.ZCOORD: if(a.topLeft.z == b.bottomRight.z || a.bottomRight.z == b.topLeft.z) return true; return false; } return false; } /** * Sweep test min extent value * @param box * @param xyzCoord * @return */ public static float min(BoundingBox box, int xyzCoord) { switch(xyzCoord) { case XYZ.XCOORD: return box.topLeft.x; case XYZ.YCOORD: return box.topLeft.y; case XYZ.ZCOORD: return box.topLeft.z; default: return 0f; } } /** * Sweep test max extent value * @param box * @param xyzCoord * @return */ public static float max(BoundingBox box, int xyzCoord) { switch(xyzCoord) { case XYZ.XCOORD: return box.bottomRight.x; case XYZ.YCOORD: return box.bottomRight.y; case XYZ.ZCOORD: return box.bottomRight.z; default: return 0f; } } /** * Test if bounding box A will overlap bounding box B at any point * when box A moves from position 0 to position 1 and box B moves from position 0 to position 1 * Note, sweep test assumes bounding boxes A and B's dimensions do not change * * @param a0 box a starting position * @param a1 box a ending position * @param b0 box b starting position * @param b1 box b ending position * @param aCollisionOut xyz of box a's position when/if a collision occurs * @param bCollisionOut xyz of box b's position when/if a collision occurs * @return */ public static boolean sweepTest(BoundingBox a0, BoundingBox a1, BoundingBox b0, BoundingBox b1, XYZ aCollisionOut, XYZ bCollisionOut) { // solve in reference to A XYZ va = new XYZ(a1.topLeft.x-a0.topLeft.x, a1.topLeft.y-a0.topLeft.y, a1.topLeft.z-a0.topLeft.z); XYZ vb = new XYZ(b1.topLeft.x-b0.topLeft.x, b1.topLeft.y-b0.topLeft.y, b1.topLeft.z-b0.topLeft.z); XYZ v = new XYZ(vb.x-va.x, vb.y-va.y, vb.z-va.z); // check for initial overlap if(BoundingBox.isOverlapping(a0, b0)) { // java pass by ref/value gotcha, have to modify value can't reassign it aCollisionOut.x = a0.topLeft.x; aCollisionOut.y = a0.topLeft.y; aCollisionOut.z = a0.topLeft.z; bCollisionOut.x = b0.topLeft.x; bCollisionOut.y = b0.topLeft.y; bCollisionOut.z = b0.topLeft.z; return true; } // overlap min/maxs XYZ u0 = new XYZ(); XYZ u1 = new XYZ(1,1,1); float t0, t1; // iterate axis and find overlaps times (x=0, y=1, z=2) for(int i = 0; i < 3; i++) { float aMax = max(a0, i); float aMin = min(a0, i); float bMax = max(b0, i); float bMin = min(b0, i); float vi = XYZ.getCoord(v, i); if(aMax < bMax && vi < 0) XYZ.setCoord(u0, i, (aMax-bMin)/vi); else if(bMax < aMin && vi > 0) XYZ.setCoord(u0, i, (aMin-bMax)/vi); if(bMax > aMin && vi < 0) XYZ.setCoord(u1, i, (aMin-bMax)/vi); else if(aMax > bMin && vi > 0) XYZ.setCoord(u1, i, (aMax-bMin)/vi); } // get times of collision t0 = Math.max(u0.x, Math.max(u0.y, u0.z)); t1 = Math.min(u1.x, Math.min(u1.y, u1.z)); // collision only occurs if t0 < t1 if(t0 <= t1 && t0 != 0) // not t0 because we already tested it! { // t0 is the normalized time of the collision // then the position of the bounding boxes would // be their original position + velocity*time aCollisionOut.x = a0.topLeft.x + va.x*t0; aCollisionOut.y = a0.topLeft.y + va.y*t0; aCollisionOut.z = a0.topLeft.z + va.z*t0; bCollisionOut.x = b0.topLeft.x + vb.x*t0; bCollisionOut.y = b0.topLeft.y + vb.y*t0; bCollisionOut.z = b0.topLeft.z + vb.z*t0; return true; } else return false; } }

    Read the article

  • How do you stop OgreBullet Capsule from falling over?

    - by Nathan Baggs
    I've just started implementing bullet into my Ogre project. I followed the install instructions here: http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+1 And the rest if the tutorial here: http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+2 I got that to work fine however now I wanted to extend it to a handle a first person camera. I created a CapsuleShape and a Rigid Body (like the tutorial did for the boxes) however when I run the game the capsule falls over and rolls around on the floor, causing the camera swing wildly around. I need a way to fix the capsule to always stay upright, but I have no idea how Below is the code I'm using. (part of) Header File OgreBulletDynamics::DynamicsWorld *mWorld; // OgreBullet World OgreBulletCollisions::DebugDrawer *debugDrawer; std::deque<OgreBulletDynamics::RigidBody *> mBodies; std::deque<OgreBulletCollisions::CollisionShape *> mShapes; OgreBulletCollisions::CollisionShape *character; OgreBulletDynamics::RigidBody *characterBody; Ogre::SceneNode *charNode; Ogre::Camera* mCamera; Ogre::SceneManager* mSceneMgr; Ogre::RenderWindow* mWindow; main file bool MinimalOgre::go(void) { ... mCamera = mSceneMgr->createCamera("PlayerCam"); mCamera->setPosition(Vector3(0,0,0)); mCamera->lookAt(Vector3(0,0,300)); mCamera->setNearClipDistance(5); mCameraMan = new OgreBites::SdkCameraMan(mCamera); OgreBulletCollisions::CollisionShape *Shape; Shape = new OgreBulletCollisions::StaticPlaneCollisionShape(Vector3(0,1,0), 0); // (normal vector, distance) OgreBulletDynamics::RigidBody *defaultPlaneBody = new OgreBulletDynamics::RigidBody( "BasePlane", mWorld); defaultPlaneBody->setStaticShape(Shape, 0.1, 0.8); // (shape, restitution, friction) // push the created objects to the deques mShapes.push_back(Shape); mBodies.push_back(defaultPlaneBody); character = new OgreBulletCollisions::CapsuleCollisionShape(1.0f, 1.0f, Vector3(0, 1, 0)); charNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(); charNode->attachObject(mCamera); charNode->setPosition(mCamera->getPosition()); characterBody = new OgreBulletDynamics::RigidBody("character", mWorld); characterBody->setShape( charNode, character, 0.0f, // dynamic body restitution 10.0f, // dynamic body friction 10.0f, // dynamic bodymass Vector3(0,0,0), Quaternion(0, 0, 1, 0)); mShapes.push_back(character); mBodies.push_back(characterBody); ... }

    Read the article

  • In java getting different value for TimeZone.getDefault().getID() on different system

    - by Deepak Chaudhry
    I am getting different value for TimeZone.getDefault().getID() on different systems. For example, in case of Indian standard time, On one of the system we are getting "GMT+5:30": while on another we are getting "Asia/Calcutta". We are expected to get "Asia/calcutta" strings on all machines. Why is there an inconsistency for such behavior? Is there any way to get consistent behavior across different systems windows/MAC? What is the best way to get client time zone programmatically using Java?

    Read the article

  • How can I edit a css rule in jQuery?

    - by chacham15
    The purpose is that rows are dynamically added to a table and it is not as nice (and slower) to apply the rule manually later. The specific example is that I am creating a tree table to represent a folder directory. Each folder is a div. In each div, there is a ul with an li for each columns' information. These li have a class name equivalent to the column name. This provides column width. I want to make the columns resizable however. I could do $('.className').css('width', newWidth) but then this wont apply to newly inserted items. Therefore, I want to modify the css rule. How do I do this?

    Read the article

  • add a div.class in a child, only when the parent does not have other div.class

    - by armandfp
    i have a html code like this: <div class="someclass"> <div class="childclass"></div> <div class="checkclass"></div> </div> <div class="someclass"> <div class="childclass"></div> </div> <div class="someclass"> <div class="childclass"></div> <div class="checkclass"></div> </div> <div class="someclass"> <div class="childclass"></div> <div class="checkclass"></div> </div> <div class="someclass"> <div class="childclass"></div> </div> and i need to add a div only on those divs that dont have that "checkclass", so it will like this: <div class="someclass"> <div class="childclass"></div> <div class="checkclass"></div> </div> <div class="someclass"> <div class="childclass"></div> <div class="newclass"></div> </div> <div class="someclass"> <div class="childclass"></div> <div class="checkclass"></div> </div> <div class="someclass"> <div class="childclass"></div> <div class="checkclass"></div> </div> <div class="someclass"> <div class="childclass"></div> <div class="newclass"></div> </div> i tried with jquery something like: $('.someclase:not(children(hasClass(checkclass))').append('<div class="newclass"></div>'); $('.someclass:not(:children(.checkclass))').append('<div class="newclass"></div>'); $('.someclass > :not(.checkclass)').append('<div class="newclass"></div>'); but still nothing, any ideas?

    Read the article

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