Daily Archives

Articles indexed Thursday August 30 2012

Page 17/19 | < Previous Page | 13 14 15 16 17 18 19  | Next Page >

  • Must all new features go through betatest?

    - by LTR
    Obviously, small usability fixes and bugfixes go directly into the stable product. What about small new features? Can you afford to just release them after internal testing, or do they have to be betatested by customers first? Situation: This is a young commercial project, produced by a one-person company. It has an existing userbase and is at it's second major version. Previous betatests have produced some results, however most feedback came from the stable product and not from beta versions.

    Read the article

  • Which license can I use for my open source AWS project [closed]

    - by mafue
    I'm creating a project on codeplex that uses Amazon Web Services and the AWS SDK for .NET Which licenses can I use? The SDK is released under Apache 2.0 license, so I assume my project can or should use the same. If I add another open source library released under a different license, do I need to find a license that is 'compatible' with both ie. one that has the same requirements for derivative works? My requirement is for a license that allows me to publish a derivative work from the AWS .NET SDK. I can use any of the licenses that codeplex supports, which includes: Apache 2.0 GNU GPLv2 MIT Mozilla Public License 2.0 Microsoft Public License

    Read the article

  • Javascript: Avoid this and new - further reading? [closed]

    - by Thomas Deutsch
    I do not want this to end in a sort of religious discussion, i want to collect some sources for further reading on this topic. As shown here: Node.js Style and Structure Point 1: Avoid this and new you can find a good example when it could be better to use closures instead of a prototype, and to make every argument explicit. Ok, i agree - could be nice, but i need to know more. Can anyone recommend a good link? Would this make my code 100% object-pattern-free ? (no factory-, repository-, module- pattern?)

    Read the article

  • Magento Subscription Form with Image upload

    - by Pankaj Upadhyay
    We have a peculiar requirement and our site is in magento. Requirement We want the user to fill in a personal information form with their image. After that, the user should be redirected to a product subscription page where he can select either 3 month, 6 month or on yearly basis. Now, when the selection is made, the user should make the payment via our payment method. How can I develop this? I am not able to figure it out. Should I go about editing the registration page or what? Let me know how you will deal with such a requirement?

    Read the article

  • What should developers know about Windows executable binary file compression?

    - by Peter Turner
    I'd never heard of this before, so shame on me, but programs like UPX can compress my files by 80% which is totally sweet, but I have no idea what the the disadvantages are in doing this. Or even what the compressor does. Website linked above doesn't say anything about dynamically linking DLLs but it mentions about compressing DESCENT 2 and about compressing Netscape 4.06. Also, it doesn't say what the tradeoffs are, only the benefits. If there weren't tradeoffs why wouldn't my linker compress the file? If I have an environment where I have one executable and 20-30 DLL's, some of which are dynamically loaded an unloaded fairly arbitrarily, but not in loops (hopefully), do I take a big hit in processing time decompressing these DLL's when they're used?

    Read the article

  • Can I install new version of Ubuntu in spair RAIDed partition with unetbootin

    - by artfulrobot
    I have Ubuntu 11.04 running on my home desktop which has 2 hard drives mirrored by RAID. The drives are partitioned with a big data partition, a swap partition and a couple of 20Gb partitions for OSes, one is 11.04 which is in use, and the other is kept spare for installing a later version. Which is what I'd like to do now. The idea of a 2nd partition for new OS is that I can try it, and if it's problematic, I can boot back into the original one - the machine is shared with others, so I need it to stay available! I have had horrible problems with software RAID after using a Live USB stick - basically it messes up the internal numbering of the RAID drives or something, anyway, the result is you can't boot after using it :-( and have to spend ages re-assembling the arrays, trying to remember grub commands etc etc. Quite a shocker when you consider booting from a Live USB is supposed not to affect the existing system. As I'm installing in a RAIDed disc, I would typically use the Alternative install (sad to hear that this is going to be dropped in future). However, I think I might be able to use unetbootin to trick the system into working on top of the existing system that understands RAID, with the normal ISO? If unetbootin loads from drives that are already understood to be RAIDED, then presumably it will only see md0... instead of sda, sdb... and as long as I don't need to repartition (I don't) it should be fine, right? Or is that just plain foolishness? Please tell me before I end up with a dead system (again!)

    Read the article

  • Second monitor not detected

    - by configurator
    Note: I've seen this question quite a lot, but in all the cases I could find with answers, the answer was either "I don't know" or "use nvidia-settings (which is irrelevant to me)." I'm using Intel Sandybridge Desktop graphics, with a P8H61-M LE motherboard. How do I get Ubuntu to detect my second monitor? Clicking "Detect Displays" here doesn't do anything. Here's some system info: $ lspci | grep VGA 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) $ uname -a Linux clyde 3.5.0-13-generic #13-Ubuntu SMP Tue Aug 28 08:31:47 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux $ hardinfo [copied from the UI] -Display- Resolution : 1920x1080 pixels Vendor : The X.Org Foundation Version : 1.12.3 -Monitors- Monitor 0 : 1920x1080 pixels -Extensions- BIG-REQUESTS Composite DAMAGE DOUBLE-BUFFER DPMS DRI2 GLX Generic Event Extension MIT-SCREEN-SAVER MIT-SHM RANDR RECORD RENDER SECURITY SGI-GLX SHAPE SYNC X-Resource XC-MISC XFIXES XFree86-DGA XFree86-VidModeExtension XINERAMA XInputExtension XKEYBOARD XTEST XVideo -OpenGL- Vendor : Intel Open Source Technology Center Renderer : Mesa DRI Intel(R) Sandybridge Desktop Version : 3.0 Mesa 8.1-devel Direct Rendering : Yes I've tried upgrading everything from ppa:xorg-edgers/ppa and ppa:glasen/intel-driver. I've also installed various tools I've found in other threads (e.g. hardinfo) but they weren't really helpful to me as I don't know what to make of the data. How do I get Ubuntu to detect my second monitor?

    Read the article

  • 12.04.1 Error After Upgrade

    - by rambo15
    Just update my dell Inspiron to 12.04.1. Upon reboot I get the following error: The disk drive for / is not ready yet or not present. I press "S" to skip mount and then I get the folllowing error: the disk drive for /tmp is not ready yet or not present. I have already tried the following from the maintanance shell prompt: dpkg --configure -a No luck same error. Any help would be greatly appreciated.

    Read the article

  • IRQ Conflicts Causing Video Card and Boot Problems?

    - by sanpatricio
    tl;dr - I have 4 devices sharing 1 IRQ. Is this bad and how do I tell the BIOS to stop it? Background: I have an old Dell GX280 dual Pentium 4 that I (semi) resurrected last weekend with an installation of Ubuntu 12.04. Everything was going fine the first several hours until a problem that plagued me when WinXP was on that machine happened -- it froze. Completely froze. None of the myriad of ways I have found here on askubuntu helped me to regain control except a long-press of the power button to shut it off. Clearly, this wasn't a software/WinXP issue. After much googling, I found that hardware conflicts can often cause this sort of total lock-up and with all the odd blocks of yellow and flecks of color showing on my screen (both WinXP and Ubuntu) I figured my old GeForce 7600 was failing and causing me these odd issues. (A good canned-air dusting of the entire interior fixed the color fleck problem) Again, through much googling and numerous answers found on askubuntu, I somehow stumbled my way onto the lshw command. After going through it, line by line, I found that I have four devices sharing IRQ 16: eth0, wlan0, ide0 (DVD-RW), and my video card. In hindsight, I can recall weird instances of my Ethernet connection to another computer not working when I thought it should. I never full troubleshot those issues so it could be a coincidence. The other thing that has been plaguing me since installing Ubuntu (wasn't there during WinXP) has been periodic moments of my monitor getting no signal from Ubuntu during boot. The first couple days, it would disappear after the Dell boot screen and reappear at Ubuntu login. Now, it disappears after the Dell boot screen and doesn't return at all -- I have to hit F12 where I can load a safe mode version of Ubuntu and get more details like dmesg and lsdev. I also ran memtest86 overnight and woke up to zero errors, so failing RAM is out. Where do I go from here?

    Read the article

  • Ubuntu 12.04 Not Recognising Arduino Uno

    - by John Fish
    I recently purchased an arduino uno from sparkfun, and attempted it with a fresh ubuntu 12.04 build. I installed the ide, and it seemed to work fine; I could write the sketches. However, when I plugged the arduino in, it appeared not to recognise it. I should also note that the arduino does draw power from the USB port, as the green "On" light is illuminated. The serial port arduino uno should be "assigned to" is /dev/ttyACM0. However, this did not exist, as upon running ls dev/tty*, I got the following results: /dev/tty /dev/tty23 /dev/tty39 /dev/tty54 /dev/ttyS10 /dev/ttyS26 /dev/tty0 /dev/tty24 /dev/tty4 /dev/tty55 /dev/ttyS11 /dev/ttyS27 /dev/tty1 /dev/tty25 /dev/tty40 /dev/tty56 /dev/ttyS12 /dev/ttyS28 /dev/tty10 /dev/tty26 /dev/tty41 /dev/tty57 /dev/ttyS13 /dev/ttyS29 /dev/tty11 /dev/tty27 /dev/tty42 /dev/tty58 /dev/ttyS14 /dev/ttyS3 /dev/tty12 /dev/tty28 /dev/tty43 /dev/tty59 /dev/ttyS15 /dev/ttyS30 /dev/tty13 /dev/tty29 /dev/tty44 /dev/tty6 /dev/ttyS16 /dev/ttyS31 /dev/tty14 /dev/tty3 /dev/tty45 /dev/tty60 /dev/ttyS17 /dev/ttyS4 /dev/tty15 /dev/tty30 /dev/tty46 /dev/tty61 /dev/ttyS18 /dev/ttyS5 /dev/tty16 /dev/tty31 /dev/tty47 /dev/tty62 /dev/ttyS19 /dev/ttyS6 /dev/tty17 /dev/tty32 /dev/tty48 /dev/tty63 /dev/ttyS2 /dev/ttyS7 /dev/tty18 /dev/tty33 /dev/tty49 /dev/tty7 /dev/ttyS20 /dev/ttyS8 /dev/tty19 /dev/tty34 /dev/tty5 /dev/tty8 /dev/ttyS21 /dev/ttyS9 /dev/tty2 /dev/tty35 /dev/tty50 /dev/tty9 /dev/ttyS22 /dev/tty20 /dev/tty36 /dev/tty51 /dev/ttyprintk /dev/ttyS23 /dev/tty21 /dev/tty37 /dev/tty52 /dev/ttyS0 /dev/ttyS24 /dev/tty22 /dev/tty38 /dev/tty53 /dev/ttyS1 /dev/ttyS25 Any help would be greatly appreciated.

    Read the article

  • Can't open Minecraft with java

    - by Shingaling
    I know this has been asked here before, but none of the solutions have worked for me. I have a fresh install of Ubuntu 12.04 on my system and I installed Open Java 7 and I downloaded Minecraft. I right clicked Minecraft went to properties and set it as an executable and then went to open with and Java is no where to be found in the list. I made a new Java desktop file in /usr/share/applications and now when I go to the list Java is there and I set Minecraft to open with it by default but when I open it nothing at all happens. Now how am I supposed to get Minecraft to work?

    Read the article

  • Can't install Skype on Ubuntu 12.04 64 bit

    - by Gabriel Alvim
    I've tried many different ways: I downloaded the file on the Skype website, which returned me this error "Cannot install ia-32-libs" I followed this instructions https://help.ubuntu.com/community/Skype and here is what I got: **W: Failed to fetch http://archive.canonical.com/ubuntu/dists/precise/partner/Packages/binary-amd64/Packages 404 Not Found [IP: 91.189.92.191 80] W: Failed to fetch http://archive.canonical.com/ubuntu/dists/precise/partner/Packages/binary-i386/Packages 404 Not Found [IP: 91.189.92.191 80] E: Some index files failed to download. They have been ignored, or old ones used instead.** I even tried this command line: sudo apt-get install lib32stdc++6 lib32asound2 ia32-libs libc6-i386 lib32gcc1 skype And this is what I got: **Error: need a repository as argument pandora@ubuntu:~$ sudo apt-get install lib32stdc++6 lib32asound2 ia32-libs libc6-i386 lib32gcc1 skype Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: ia32-libs : Depends: ia32-libs-multiarch skype : Depends: skype-bin E: Unable to correct problems, you have held broken packages.** I just don't know what to do anymore, if I can't use skype, I might as well not use ubuntu at all. Please, someone help

    Read the article

  • Ubuntu 12.04.1 desktop monitor Out of Range

    - by Zach
    I know this question has been asked many-a-times, but I cant seem to get a definate answer to it. I am running Ubuntu 12.04.1 LTS on my HP Pavillion a6 109n PC. Processor is a AMD Athlon 64 x2 Dual core Processor. Everytime I boot up my desktop, it runs BIOS, then it boots up Linux. After about 10 seconds, a little blue screen comes up saying: Out of Range: H. Frequency: 92.7KHz V. Frequency: 58.3Hz Can anyone help with this? Thanks! Zach

    Read the article

  • Error after installing Ubuntu 12.04 using Wubi

    - by KJ50
    After using Windows Ubuntu Installer from within Windows, I am prompted to restart, so I follow the directions. When I try to start Ubuntu after restarting, the desktop background appears, but then a loading bar with this title appears. Verifying the installation configuration... While this is loading, an error window pops up that says No root file system is defined Please correct this from the partitioning menu There is only an 'Ok' button available to click, and if I click that the same error window appears. I do not know how to get to the "partitioning menu" from this state, so the only option I have is to shut down my computer. What can I do so that Ubuntu finds a "root file system"? Can I diagnose this problem via Windows? Does anyone have any insight? FYI - I am using a new ultrabook with 6GB RAM, Intel i7 3rd gen processor, and no CD/DVD drive.

    Read the article

  • trying live-usb 12.04.1 image on an old desktop

    - by 213441265152351
    I am trying to load Ubuntu 12.04.1 32-bit desktop image on an old desktop computer. The system shows the initial menu, but after a while, I get an error like the one in the following two screenshots (it takes a few seconds to go from one to the other in the screen): I tried to load it using the different USB ports at the back of the computer, just in case, and I get basically the same error. Find another screenshot from another try: Any ideas what might be happening? NOTES: I checked the md5sum of the iso file to be e235b63c02644e219b7bf3668f479c9e *ubuntu-12.04.1-desktop-i386.iso. I did the 'Test' on the laptop where I created the USB drive, and it loads up correctly. The desktop computer in question is an old AMD Duron 1800MHz with 512MB RAM. I ran a memtest on the computer, and all went fine.

    Read the article

  • I am trying to install Kubuntu, but I get a metalink error

    - by Brook Bentley
    It looks like the ISO metalink is broken for the Kubuntu install from Wubi. Can you please fix this? Or, help me figure out what I'm doing wrong. I receive the following error: 'An error occurred: Cannot download the metalink and therefore the ISO For more information, please see the log file: c:\users\bbentley\appdata\local\temp\wubi-12.04-rev269.log' The log file contains the following errors: '08-30 14:28 DEBUG TaskList: ### Running get_metalink... 08-30 14:28 DEBUG downloader: downloading http://releases.ubuntu.com/kubuntu/12.04/kubuntu-12.04-desktop-amd64.metalink > C:\ubuntu\install 08-30 14:28 ERROR CommonBackend: Cannot download metalink file err=[Errno 14] HTTP Error 404: Not Found 08-30 14:28 DEBUG downloader: downloading http://cdimage.ubuntu.com/kubuntu/daily-live/current/precise-desktop-amd64.metalink > C:\ubuntu\install 08-30 14:28 ERROR CommonBackend: Cannot download metalink file2 err=[Errno 14] HTTP Error 404: Not Found 08-30 14:28 DEBUG TaskList: ### Finished get_metalink 08-30 14:28 ERROR TaskList: Cannot download the metalink and therefore the ISO Traceback (most recent call last): File "\lib\wubi\backends\common\tasklist.py", line 197, in __call__ File "\lib\wubi\backends\common\backend.py", line 595, in get_iso File "\lib\wubi\backends\common\backend.py", line 406, in download_iso Exception: Cannot download the metalink and therefore the ISO 08-30 14:28 DEBUG TaskList: # Cancelling tasklist 08-30 14:28 DEBUG TaskList: # Finished tasklist 08-30 14:28 ERROR root: Cannot download the metalink and therefore the ISO Traceback (most recent call last): File "\lib\wubi\application.py", line 58, in run File "\lib\wubi\application.py", line 132, in select_task File "\lib\wubi\application.py", line 158, in run_installer File "\lib\wubi\backends\common\tasklist.py", line 197, in __call__ File "\lib\wubi\backends\common\backend.py", line 595, in get_iso File "\lib\wubi\backends\common\backend.py", line 406, in download_iso Exception: Cannot download the metalink and therefore the ISO'

    Read the article

  • How to fix sudo: setreuid(ROOT_UID, user_uid): Operation not permitted error?

    - by David R.
    I am using LDAP authentication on my Ubuntu 11.10 server. I installed libpam-ldap, and configured things accordingly. It works great, except that I get this error every once in a while when I try to sudo: sudo: setreuid(ROOT_UID, user_uid): Operation not permitted I know I have sudoers set up correctly, since it works most of the time. It's not just my log in either, others have the same problem when I have it. When this error is occurring, I can't ssh in with my regular system user at all. When I sign in directly, I can't get any gnome-terminal to start. Once I restart the server, the problem goes away. 'Course, that's not a solution, if it was a prod server, I'd be in trouble. How do I fix this? Edit 3/1/12: I just figured out that if stop and start the nscd service, the problem goes away. service nscd stop service nscd start Not much of a solution since I have to be logged into the server directly, not via ssh.

    Read the article

  • How can I disable the purple bootloader splash at boot?

    - by wim
    This question has been answered before, but neither of the methods in the accepted answer worked for me on 11.10. First I tried editing in /etc/default/grub, and then running sudo update-grub. But after that I still got a blank, plain, purple screen while the kernel is loading. The screen has no boot options, and it obscures those dmesg that I want to see going in the terminal. Next I tried removing the plymouth-theme-*, but that just broke my gnome-shell theme looks, and the purple screen still remains. I have also tried configuring it with startupmanager package, but nothing seems to get rid of that darned purple splash. here are the contents of my /etc/default/grub file: # If you change this file, run 'update-grub' afterwards to update # /boot/grub/grub.cfg. # For full documentation of the options in this file, see: # info -f grub -n 'Simple configuration' GRUB_DEFAULT="0" GRUB_HIDDEN_TIMEOUT="0" GRUB_HIDDEN_TIMEOUT_QUIET="true" GRUB_TIMEOUT="0" GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`" #GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX="" # Uncomment to enable BadRAM filtering, modify to suit your needs # This works with Linux (no patch required) and with any kernel that obtains # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...) #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef" # Uncomment to disable graphical terminal (grub-pc only) # GRUB_TERMINAL="console" # The resolution used on graphical terminal # note that you can use only modes which your graphic card supports via VBE # you can see them in real GRUB with the command `vbeinfo' #GRUB_GFXMODE="640x480" # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux #GRUB_DISABLE_LINUX_UUID="true" # Uncomment to disable generation of recovery mode menu entries #GRUB_DISABLE_RECOVERY="true" # Uncomment to get a beep at grub start #GRUB_INIT_TUNE="480 440 1" GRUB_DISABLE_OS_PROBER="true"

    Read the article

  • How do I toggle sound with amixer?

    - by joschi
    Including Natty I was always able to toggle (mute/unmute) the 'Master' sound volume with the amixer sset Master toggle command that I linked to an edge binding in CompizConfig-Manager. Now after installing Oneiric the command only mutes the sound but doesn't unmute it. I even tried it in the Terminal but it also doesn't work. It changes 'Mono: Playback 68 [78%] [-14.25dB] [off]' to '...[on]' but the sound stays muted so that I have to unmute it via the 'sound-indicator' in the panel. How can I get this working again? What did change since Natty? Does anyone know the command the 'sound-indicator' uses to toggle the sound volume?

    Read the article

  • get mysql_real_escape is giving me errors when I try and add security to my website

    - by Mike
    I tried doing this: @ $db = new myConnectDB(); $beerName = mysql_real_escape_string($beerName); $beerID = mysql_real_escape_string($beerID); $brewery = mysql_real_escape_string($brewery); $style = mysql_real_escape_string($style); $userID = mysql_real_escape_string($userID); $abv = mysql_real_escape_string($abv); $ibu = mysql_real_escape_string($ibu); $breweryID = mysql_real_escape_string($breweryID); $icon = mysql_real_escape_string($icon); I get this error: Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user

    Read the article

  • Is it fair to not support IE or older browsers? [closed]

    - by XToro
    Possible Duplicate: So now Google has said no to old browsers when can the rest of us follow suit? Normally a SO browser but this question doesn't fit there, hopefully it fits here. I just want to ask from web designers' point of view if it's wrong to not care about supporting Internet Explorer or older browsers. The site I'm designing looks great in all browsers except IE9-. There are certain things that IE doesn't support or behave like other browsers; webkit stuff, some CSS styles, drop-and-drop files from OS etc etc, but it all works great in Safari, FireFox, Chrome etc. Should I be that concerned? I know there are several people that use IE, but it's limitations have just been causing me more work by having to come up with workarounds. From what I've read, many of the issues I've been having should be solved with IE10, but not everybody keeps up to date. I know of several people who are still using IE6! Again, I'm hoping this is the right place to ask a question like this, and if not, please point me to the right stack exchange site instead of just downvoting me. Thanks!

    Read the article

  • PHP error log does not display script names nor does it display the errors' line numbers [migrated]

    - by gnxtech3
    I think the title is self-explanatory, and my Google-fu isn't bringing up anything useful. I'm working on a new host, and my php error log only displays the error itself, not which script is the offender, nor which line number the error is occurring on. Makes it a tad difficult to debug, especially since there's only 1 error in the script. More info: I'm not using a custom error handler that I'm aware of. This is a standard Wordpress install. The error was [27-Aug-2012 19:22:36 UTC] PHP NOTICE: Trying to get property of non-object. Just no script name or line number in the error I found that Wordpress' error logging contained the information to debug the problem, but that doesn't explain why the log didn't contain line number or script.

    Read the article

  • HTTP 303 redirection and robots.txt

    - by Ian Dickinson
    On a site I'm working on, we're using the HTTP 303 redirect pattern (see this article for background) to distinguish between information and non-information resources. So: some URL's under /id get redirected to dynamically-created pages under /doc. These dynamic pages are built from a database, and contain links to other /doc/ resources, so in general we don't want them to be crawled. Our robots.txt contains: Disallow: /doc However, we do want the non-redirected pages under /id to get indexed by Google et al: Allow: /id So the question I have, which I can't find an answer to so far, is: if an allowed /id page 303-redirects to a /doc page, will it still be blocked by robots.txt? If yes, we're OK, but otherwise I'm going to disallow all /id resources in the robots file, as having the crawler hammer the db would be worse than losing search indexing for the /id pages.

    Read the article

  • Efficient way to render tile-based map in Java

    - by Lucius
    Some time ago I posted here because I was having some memory issues with a game I'm working on. That has been pretty much solved thanks to some suggestions here, so I decided to come back with another problem I'm having. Basically, I feel that too much of the CPU is being used when rendering the map. I have a Core i5-2500 processor and when running the game, the CPU usage is about 35% - and I can't accept that that's just how it has to be. This is how I'm going about rendering the map: I have the X and Y coordinates of the player, so I'm not drawing the whole map, just the visible portion of it; The number of visible tiles on screen varies according to the resolution chosen by the player (the CPU usage is 35% here when playing at a resolution of 1440x900); If the tile is "empty", I just skip drawing it (this didn't visibly lower the CPU usage, but reduced the drawing time in about 20ms); The map is composed of 5 layers - for more details; The tiles are 32x32 pixels; And just to be on the safe side, I'll post the code for drawing the game here, although it's as messy and unreadable as it can be T_T (I'll try to make it a little readable) private void drawGame(Graphics2D g2d){ //Width and Height of the visible portion of the map (not of the screen) int visionWidht = visibleCols * TILE_SIZE; int visionHeight = visibleRows * TILE_SIZE; //Since the map can be smaller than the screen, I center it just to be sure int xAdjust = (getWidth() - visionWidht) / 2; int yAdjust = (getHeight() - visionHeight) / 2; //This "deducedX" thing is to move the map a few pixels horizontally, since the player moves by pixels and not full tiles int playerDrawX = listOfCharacters.get(0).getX(); int deducedX = 0; if (listOfCharacters.get(0).currentCol() - visibleCols / 2 >= 0) { playerDrawX = visibleCols / 2 * TILE_SIZE; map_draw_col = listOfCharacters.get(0).currentCol() - visibleCols / 2; deducedX = listOfCharacters.get(0).getXCol(); } //"deducedY" is the same deal as "deducedX", but vertically int playerDrawY = listOfCharacters.get(0).getY(); int deducedY = 0; if (listOfCharacters.get(0).currentRow() - visibleRows / 2 >= 0) { playerDrawY = visibleRows / 2 * TILE_SIZE; map_draw_row = listOfCharacters.get(0).currentRow() - visibleRows / 2; deducedY = listOfCharacters.get(0).getYRow(); } int max_cols = visibleCols + map_draw_col; if (max_cols >= map.getCols()) { max_cols = map.getCols() - 1; deducedX = 0; map_draw_col = max_cols - visibleCols + 1; playerDrawX = listOfCharacters.get(0).getX() - map_draw_col * TILE_SIZE; } int max_rows = visibleRows + map_draw_row; if (max_rows >= map.getRows()) { max_rows = map.getRows() - 1; deducedY = 0; map_draw_row = max_rows - visibleRows + 1; playerDrawY = listOfCharacters.get(0).getY() - map_draw_row * TILE_SIZE; } //map_draw_row and map_draw_col representes the coordinate of the upper left tile on the screen //iterate through all the tiles on screen and draw them - this is what consumes most of the CPU for (int col = map_draw_col; col <= max_cols; col++) { for (int row = map_draw_row; row <= max_rows; row++) { Tile[] tiles = map.getTiles(col, row); for(int layer = 0; layer < tiles.length; layer++){ Tile currentTile = tiles[layer]; boolean shouldDraw = true; //I only draw the tile if it exists and is not empty (id=-1) if(currentTile != null && currentTile.getId() >= 0){ //The layers above 1 can be draw behing or infront of the player according to where it's standing if(layer > 1 && currentTile.getId() >= 0){ if(playerBehind(col, row, layer, listOfCharacters.get(0))){ behinds.get(0).add(new int[]{col, row}); //the tiles that are infront of the player wont be draw right now shouldDraw = false; } } if(shouldDraw){ g2d.drawImage( tiles[layer].getImage(), (col-map_draw_col)*TILE_SIZE - deducedX + xAdjust, (row-map_draw_row)*TILE_SIZE - deducedY + yAdjust, null); } } } } } } There's some more code in this method but nothing relevant to this question. Basically, the biggest problem is that I iterate over around 5000 tiles (in this specific resolution) 60 times each second. I thought about rendering the visible portion of the map once and storing it into a BufferedImage and when the player moved move the whole image the same amount but to the opposite side and then drawn the tiles that appeared on the screen, but if I do it like that, I wont be able to have animated tiles (at least I think). That being said, any suggestions?

    Read the article

  • How to properly add texture to multi-fixture/shape b2Body

    - by Blazej Wdowikowski
    Hello to everyone this is my first poste here I hope that will be not fail start. At start I must say I make part 1 in Ray's Tutorial "How To Make A Game Like Fruit Ninja With Box2D and Cocos2D". But I wonder what when I want make more complex body with texture? Simple just add n b2FixtureDef to the same body. OK but what about texture? If I will take code from that tutorial it only fill last fixture. Probably it does not takes every b2Vec2 point. I was right, it did not. So quick refactor and from that -(id)initWithTexture:(CCTexture2D*)texture body:(b2Body*)body original:(BOOL)original { // gather all the vertices from our Box2D shape b2Fixture *originalFixture = body->GetFixtureList(); b2PolygonShape *shape = (b2PolygonShape*)originalFixture->GetShape(); int vertexCount = shape->GetVertexCount(); NSMutableArray *points = [NSMutableArray arrayWithCapacity:vertexCount]; for(int i = 0; i < vertexCount; i++) { CGPoint p = ccp(shape->GetVertex(i).x * PTM_RATIO, shape->GetVertex(i).y * PTM_RATIO); [points addObject:[NSValue valueWithCGPoint:p]]; } if ((self = [super initWithPoints:points andTexture:texture])) { _body = body; _body->SetUserData(self); _original = original; // gets the center of the polygon _centroid = self.body->GetLocalCenter(); // assign an anchor point based on the center self.anchorPoint = ccp(_centroid.x * PTM_RATIO / texture.contentSize.width, _centroid.y * PTM_RATIO / texture.contentSize.height); } return self; } I came up with that -(id)initWithTexture:(CCTexture2D*)texture body:(b2Body*)body original:(BOOL)original { int vertexCount = 0; //gather total number of b2Vect2 points b2Fixture *currentFixture = body->GetFixtureList(); while (currentFixture) { //new b2PolygonShape *shape = (b2PolygonShape*)currentFixture->GetShape(); vertexCount += shape->GetVertexCount(); currentFixture = currentFixture->GetNext(); } NSMutableArray *points = [NSMutableArray arrayWithCapacity:vertexCount]; // gather all the vertices from our Box2D shape b2Fixture *originalFixture = body->GetFixtureList(); while (originalFixture) { //new NSLog((NSString*)@"-"); b2PolygonShape *shape = (b2PolygonShape*)originalFixture->GetShape(); int currentVertexCount = shape->GetVertexCount(); for(int i = 0; i < currentVertexCount; i++) { CGPoint p = ccp(shape->GetVertex(i).x * PTM_RATIO, shape->GetVertex(i).y * PTM_RATIO); [points addObject:[NSValue valueWithCGPoint:p]]; } originalFixture = originalFixture->GetNext(); } if ((self = [super initWithPoints:points andTexture:texture])) { _body = body; _body->SetUserData(self); _original = original; // gets the center of the polygon _centroid = self.body->GetLocalCenter(); // assign an anchor point based on the center self.anchorPoint = ccp(_centroid.x * PTM_RATIO / texture.contentSize.width,_centroid.y * PTM_RATIO / texture.contentSize.height); } return self; } I was working for simple two fixtures body like b2BodyDef bodyDef; bodyDef.type = b2_dynamicBody; bodyDef.position = position; bodyDef.angle = rotation; b2Body *body = world->CreateBody(&bodyDef); b2FixtureDef fixtureDef; fixtureDef.density = 1.0; fixtureDef.friction = 0.5; fixtureDef.restitution = 0.2; fixtureDef.filter.categoryBits = 0x0001; fixtureDef.filter.maskBits = 0x0001; b2Vec2 vertices[] = { b2Vec2(0.0/PTM_RATIO,50.0/PTM_RATIO), b2Vec2(0.0/PTM_RATIO,0.0/PTM_RATIO), b2Vec2(50.0/PTM_RATIO,30.1/PTM_RATIO), b2Vec2(60.0/PTM_RATIO,60.0/PTM_RATIO) }; b2PolygonShape shape; shape.Set(vertices, 4); fixtureDef.shape = &shape; body->CreateFixture(&fixtureDef); b2Vec2 vertices2[] = { b2Vec2(20.0/PTM_RATIO,50.0/PTM_RATIO), b2Vec2(20.0/PTM_RATIO,0.0/PTM_RATIO), b2Vec2(70.0/PTM_RATIO,30.1/PTM_RATIO), b2Vec2(80.0/PTM_RATIO,60.0/PTM_RATIO) }; shape.Set(vertices2, 4); fixtureDef.shape = &shape; body->CreateFixture(&fixtureDef); But if I try put secondary shape upper than first it starting wierd, texture goes crazy. For example not mention about more complex shapes. What's more if shapes have one common point texture will not render for them at all [For that I use Physics Edytor like in tutorial part1] BTW. I use PolygonSprite and in method createWithWorld... another shapes. Uff.. Question So my question is, why texture coords are in such a mess up? It's my modify method or just wrong approach? Maybe I should remove duplicated from points array?

    Read the article

< Previous Page | 13 14 15 16 17 18 19  | Next Page >