Daily Archives

Articles indexed Thursday December 6 2012

Page 14/16 | < Previous Page | 10 11 12 13 14 15 16  | Next Page >

  • Is it justified to use project-wide unique function and variable names to help future refactoring?

    - by kahoon
    Refactoring tools (like ReSharper) often can't be sure whether to rename a given identifier when, for example refactoring a JavaScript function. I guess this is a consequence of JavaScript's dynamic nature. ReSharper solves this problem by offering to rename reasonable lexical matches too. The developer can opt out of renaming certain functions, if he finds that the lexical match is purely accidental. This means that the developer has to approve every instance that will be affected by the renaming. For example let's consider we have two Backbone classes which are used completely independently from each other in our application: var Header = Backbone.View.extend({ close: function() {...} }) var Dialog = Backbone.View.extend({ close: function() {...} }) If you try to rename Dialog's close method to for example closeAndNotify, then ReSharper will offer to rename all occurences of Header's close method just because they are the same lexically prior to the renaming. To avoid this problem, please consider this: var Header = Backbone.View.extend({ closeHeader: function() {...} }) var Dialog = Backbone.View.extend({ closeDialog: function() {...} }) Now you can rename closeDialog unambiguously - given that you have no other classes having a method with the same name. Is it worth it to name my functions this way to help future refactoring?

    Read the article

  • How do I get localized names of application in python?

    - by Mystic-Mirage
    This code gives me only English application name if .desktop file does not have "Name[*]" options (like in totem.desktop) but only "X-Ubuntu-Gettext-Domain: totem": from gi.repository import Gio app = Gio.app_info_get_default_for_type('video/x-flv', True) print app.get_name() This like code gives me proper result for vlc.desktop. Ubuntu Dash shows proper localized names for all applications. How do I get localized names of application in python? Sorry for my English.

    Read the article

  • FTP Changes file permisions

    - by AkBKukU
    I am trying to make changes to my website over ftp but when I save any files it changes the permissions and owner to my username. I can edit files in the same folder trough samba without changing the permissions. I really don't understand how the permissions for the /var/www folder work and I'm pulling my hair out trying to get it to work. I have recently made changes to the permissions of the /var/www directory (following this guide) so I could modify files in the www root. Right now I have the entire contents of /var/www set as -rwxrwxr-x 1 www-data www-data but when I change a file over ftp it becomes -rw------- 1 akbkuku akbkuku, akbkuku being my username. I am using vsftpd as the server, and I login with my normal user. How do I make it leave to permissions alone? At this point I'll even take a way yo reset all the permission back to stock and I'll just never modify files in the web root.

    Read the article

  • LIRC-ZILOG on ubuntu 12.04

    - by aoman
    I followed these guides to configure a Hauppauge PVR, and after compiling the hpvr modules, I have this problem: (that also includes the zilog one) # locate zilog /lib/modules/3.2.0-29-generic/kernel/drivers/staging/media/lirc/lirc_zilog.ko /lib/modules/3.2.0-34-generic/kernel/drivers/staging/media/lirc/lirc_zilog.ko /usr/src/linux-headers-3.2.0-29-generic/include/config/lirc/zilog.h sudo modprobe lirc_zilog FATAL: Error inserting lirc_zilog (/lib/modules/3.2.0-34-generic/kernel/drivers/staging/media/lirc/lirc_zilog.ko): Invalid argument The PVR works and I can get a test video with sound. The remote does not. I want the transmitter to work so it can automatically change the channel on the cable box and find the video I wanted to record. The LIRC sources are not on Ubuntu sources and so I can only guess at what commands I might have to use. How do I resolve the error and get the remote working?

    Read the article

  • Problems after installing Ubuntu LiveUSB on my 2nd HD

    - by user113106
    I decided to create a Ubuntu USB installer using the Universal USB Installer, selecting a Ubuntu 12.10 ISO. I selected my D: drive, my NON-windows7 carrying drive as install. After this I Re-booted my system and my PC began to Run the Ubuntu Boot-startscreen every time I power up the machine, giving errors like this: Root=Unknown I used my girlfriend's laptop to create, on the exact same way, a real! USB Ubuntu installer. Booting from that USB, picking the option Run Ubuntu from this USB I get the following error: http://postimage.org/image/63qkv98c1/ Let's try installing it from that USB to a Hard-Disk: http://postimage.org/image/usqbwymfx/ As I said: I do not have the Option to pick my Boot-section, at this very moment I can only access to the Ubuntu installation and nothing else. I've read about 90% of other Questions that could've been related, but I could not find a solution. BTW I'm running a Acer Aspire 2Quadcore 4gb DDR 2 Ati Radeon HD, 64bit and I've set my Bios OS-usage from Windows to "Others"

    Read the article

  • No WIFI or LAN on Ubuntu 12.04 or 12.10 Live CD/USB using Toshiba qosmio x870

    - by Mighty
    I recently had issues with secure boot and couldn't boot the Live CD/USB but after disabling secure boot, I was able to 'TRY UBUNTU'. My currently problem is that I can't access WIFI or LAN from either Ubuntu 12.04 or 12.10 Live CD/USB which I do from Windows 8. Also, the wireless button is able to turn on and off the wireless LED but doesn't find available WIFI. Please, what should I do to get both WIFI and LAN working on Ubuntu using Toshiba qosmio x870? UPDATED: Here's the output of lspci: ubuntu@ubuntu:~$ lspci 00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09) 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09) 00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09) 00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04) 00:16.0 Communication controller: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 (rev 04) 00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04) 00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04) 00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4) 00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4) 00:1c.4 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 5 (rev c4) 00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04) 00:1f.0 ISA bridge: Intel Corporation HM76 Express Chipset LPC Controller (rev 04) 00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04) 00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04) 01:00.0 VGA compatible controller: NVIDIA Corporation Device 1213 (rev a1) 07:00.0 Ethernet controller: Atheros Communications Inc. AR8161 Gigabit Ethernet (rev 10) 08:00.0 Network controller: Realtek Semiconductor Co., Ltd. Device 8723 09:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5229 PCI Express Card Reader (rev 01)

    Read the article

  • How do I include a password with SSH command? (want to make shell script)

    - by Evan
    I'm trying to SSH to a server on startup with a .sh script, but that will require me to enter the password for the account on the server that I'm SSHing to. I did some RTFMing, and I see in "-o" that it has "PasswordAuthentication" but I'm not sure how or if I could use that option. As this will be in a shell script, obviously I'd like to have the password in that file, or in any case not have to enter in the password manually every time the script runs.

    Read the article

  • Ghosting Program for Ubuntu 12.10

    - by Sean Webber
    I am looking to figure out how to set up a mass backup system for a computer network (of about 25) and am looking for a ghosting program that makes an image of the entire system for backup/recovery purposes. While clonezilla would work.. you have to manually boot us the CD for it. I am looking for a program that runs INSIDE Ubuntu that sends a system image backup off to the network server at set times, then when needed could also be used to burn the clone back to the machine. Another words- automatically and the only time I have to do anything to it is when I need to burn a backup BACK to a 'crapped' machine. Any ideas?

    Read the article

  • Ubuntu Wifi Not Connecting (And keeps asking for authentication every minute or so)

    - by kelvinsong
    This is a problem in 12.10 that has been driving me nuts, and it's a problem with the wifi. Ubuntu will never connect to the network. All of my other devices work fine. What will happen is I will type in the password, the authentication window will go away, and the Wifi icon will pulsate for a while. Then about a minute later, a window will pop up asking for authentication to join the same wifi network. If you type in the password again it will do the same thing, and even if you hit [Cancel], the window will still pop back up in another minute. This is a very irritating thing.

    Read the article

  • Ubuntu software center not opening [closed]

    - by I'll sudeepdino008
    Ubuntu software center is not opening, when I type: software-center in the command line, the following errors are generated: (software-center:8570): Gtk-WARNING **: Theme parsing error: gtk.css:227:31: Failed to import: Error opening file: No such file or directory 2012-09-30 17:00:58,068 - softwarecenter.ui.gtk3.app - INFO - setting up proxy 'http://10.3.100.212:8080/' 2012-09-30 17:00:58,071 - softwarecenter.db.database - INFO - open() database: path=None use_axi=True use_agent=True 2012-09-30 17:00:58,327 - softwarecenter.backend.reviews - WARNING - Could not get usefulness from server, no username in config file 2012-09-30 17:00:58,428 - softwarecenter.ui.gtk3.app - INFO - show_available_packages: search_text is '', app is None. 2012-09-30 17:00:58,433 - softwarecenter.db.pkginfo_impl.aptcache - INFO - aptcache.open() Traceback (most recent call last): File "/usr/share/software-center/softwarecenter/db/pkginfo_impl/aptcache.py", line 243, in open self._cache = apt.Cache(GtkMainIterationProgress()) File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 102, in __init__ self.open(progress) File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 145, in open self._cache = apt_pkg.Cache(progress) SystemError: E:Encountered a section with no Package: header, E:Problem with MergeList /var/lib/apt/lists/ppa.launchpad.net_webupd8team_themes_ubuntu_dists_precise_main_binary-i386_Packages, E:The package lists or status file could not be parsed or opened. 2012-09-30 17:01:00,130 - softwarecenter.db.enquire - ERROR - _get_estimate_nr_apps_and_nr_pkgs failed Traceback (most recent call last): File "/usr/share/software-center/softwarecenter/db/enquire.py", line 115, in _get_estimate_nr_apps_and_nr_pkgs tmp_matches = enquire.get_mset(0, len(self.db), None, xfilter) File "/usr/share/software-center/softwarecenter/db/appfilter.py", line 89, in __call__ if (not pkgname in self.cache and File "/usr/share/software-center/softwarecenter/db/pkginfo_impl/aptcache.py", line 263, in __contains__ return self._cache.__contains__(k) AttributeError: 'NoneType' object has no attribute '__contains__' Traceback (most recent call last): File "/usr/bin/software-center", line 176, in <module> app.run(args) File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 1422, in run self.show_available_packages(args) File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 1352, in show_available_packages self.view_manager.set_active_view(ViewPages.AVAILABLE) File "/usr/share/software-center/softwarecenter/ui/gtk3/session/viewmanager.py", line 154, in set_active_view view_widget.init_view() File "/usr/share/software-center/softwarecenter/ui/gtk3/panes/availablepane.py", line 171, in init_view self.apps_filter) File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 238, in __init__ self.build(desktopdir) File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 511, in build self._build_homepage_view() File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 271, in _build_homepage_view self._append_whats_new() File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 450, in _append_whats_new whats_new_cat = self._update_whats_new_content() File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 439, in _update_whats_new_content docs = whats_new_cat.get_documents(self.db) File "/usr/share/software-center/softwarecenter/db/categories.py", line 124, in get_documents nonblocking_load=False) File "/usr/share/software-center/softwarecenter/db/enquire.py", line 317, in set_query self._blocking_perform_search() File "/usr/share/software-center/softwarecenter/db/enquire.py", line 212, in _blocking_perform_search matches = enquire.get_mset(0, self.limit, None, xfilter) File "/usr/share/software-center/softwarecenter/db/appfilter.py", line 89, in __call__ if (not pkgname in self.cache and File "/usr/share/software-center/softwarecenter/db/pkginfo_impl/aptcache.py", line 263, in __contains__ return self._cache.__contains__(k) AttributeError: 'NoneType' object has no attribute '__contains__'

    Read the article

  • Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E

    - by Sebastian Bugiu
    I had Ubuntu 11.10 and in the last few weeks I experienced an obscure problem: after I had the computer running for a few days I could no longer connect to google.com or anything related to google. All sites worked with all browsers (Firefox, chrome, opera) except google. It remained in the connecting phase for a few minutes and either timed out or finally connected with this huge delay. Even if I entered other sites such as this one, if it had anything to do with google such adsense or gstatic or whatever with g in it, that site took a long time to load waiting in connecting to gstatic.com . Anything google related took minutes to work, but everything else worked instantly! I tried rebooting or using other machine(with windows on it) and this worked, so it's not network related. But after a few days it started not working again... So I upgraded to the Precise Pangolin hoping this behavior would go away. It didn't! After a few days I get the same behavior as in 11.10. What am I supposed to do? Reboot every other day? I didn't have this problem with neither 10.10 or 11.04. I found the Realtek RTL8168/8111E issue with the r8169 driver but this is not exactly the same card so probably trying r8168 won't help. Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8101E/RTL8102E PCI Express Fast Ethernet controller (rev 02) Subsystem: Toshiba America Info Systems Device ff1c Flags: bus master, fast devsel, latency 0, IRQ 44 I/O ports at 4000 [size=256] Memory at d0010000 (64-bit, prefetchable) [size=4K] Memory at d0000000 (64-bit, prefetchable) [size=64K] Capabilities: [40] Power Management version 7 Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+ Capabilities: [70] Express Endpoint, MSI 01 Capabilities: [ac] MSI-X: Enable- Count=2 Masked- Capabilities: [cc] Vital Product Data Capabilities: [100] Advanced Error Reporting Capabilities: [140] Virtual Channel Capabilities: [160] Device Serial Number 09-00-00-00-ff-ff-00-00 Kernel driver in use: r8169 Kernel modules: r8169

    Read the article

  • Ubuntu 12.04 - default Radeon driver does not work at all

    - by mumble
    I've recently upgraded to 12.04 LTS and I have an ATI Radeon HD5670. I've heard that the open source 'Radeon' driver is used by default. However, it wasn't showing anything for me. What I did was I added the 'nomodeset' option to boot up and install fglrx. But it didn't work well for me as it introduced a lot of problems (freezes/glitches). So I removed/purged fglrx and am planning to use the open source drivers instead. So my question is this: Why is my default Radeon driver not working? Is anyone having a similar issue? I've also tried using the ubuntu-x-swat driver by running the ff commands: sudo add-apt-repository ppa:ubuntu-x-swat/x-updates sudo apt-get update But the result was the same as the Radeon driver. Nothing shows up on system boot. Any ideas? Thanks in advance! Update Running lspci -nn | grep VGA gives me the following: 02:00.0 VGA compatible controller [0300]: Advanced Micro Devices [AMD] nee ATI Redwood [Radeon HD 5670] [1002:68d8]

    Read the article

  • installing my Graphic Card on ubuntu12.04

    - by lamouchi amine
    I have a HP Pavillion G6 series 1225, i5 laptop with Radeon HD 6470M switchable VGA. i installed Ubuntu 12.04 LTS but the VGA drivers don't work properly. I want to install drivers into the Ubuntu. But when I do it arrived error message like this: sorry, installation of this driver failed. Please have a look at the log file for details: /var/log/jockey.log I found a solution in a link: http://ubuntuforums.org/showthread.php?t=1930450 It works for a few steps and then in the installation of the package of the AMD driver, a message pops up 'fatal error' and it redirects me to Ask Ubuntu to find a solution, please help me, I need to make it work.

    Read the article

  • Netdisco for Ubuntu server

    - by BrNathan
    Has anyone had luck installing netdisco through apt-get? I couldn't get it to work. I tried netdisco-frontend, netdisco-backend, netdisco-common, netdisco-installer. I used the command: sudo apt-get install netdisco-common netdisco-frontend netdisco-backend Everything installed fine, but I can't get it running. It doesn't seem to have install to /usr/local/netdisco/. I have looked all over the internet and there doesn't seem to be an easy way to do this. I use server 12.04. Thanks!

    Read the article

  • What in /home would benefit from being on an SSD?

    - by N.N.
    In Is a 40GB SSD practical to use for ' / ' Jorge describes how he symlinks directories in his /home that would benefit from being on an SSD. The directories he names are ~/.cache ~/.config ~/.gconf I know how to make the symlinks. What I am asking for is if this is a good list of directories in /home that benefits from being on an SSD? I figure that good items on such a list are files that are read often. The reason for asking this is that I cannot fit all of /home on the SSD but I still want to get as much performance out of the SSD as possible.

    Read the article

  • Crossbrowser issue - navigation-menu [closed]

    - by aztekk
    I'm having issues with crossbrowser compatibility on my navigationmenu for my site. The issue is that it's not working as expected in MSIE. It bugs out on mouseover. The site is run with wordpress and the theme is called GreenChilli. It's a free theme from MyThemeShop and they don't seam to be very active in resolving free theme issues on their forum. Can someone have a look and see if this is an easy fix, or if I maybe have to abaondon this theme for something else? Site is: http://lamslagen.com

    Read the article

  • htaccess code for maintenance page redirect

    - by Force Flow
    I set up a maintenance page that I could enable through an htaccess file. The html file is located in a folder called "maintenance". The html file has some images in it. However, visitors to the page see no images, even though I added a line to allow them. If I try to visit an image in the browser directly, it redirects to the maintenance.htm page. Am I missing something? # Redirects visitors to maintenance page except for specific IP addresses # uncomment lines when redirecting visitors to maintenance page; comment when done. # Also see the section on "redirects visitors from maintenance page to homepage" # #RewriteCond %{REMOTE_ADDR} !^127.0.0.1$ #RewriteCond %{REMOTE_ADDR} !^111.111.111.111$ RewriteCond %{REQUEST_URI} !/maintenance/maintenance\.htm$ [NC] RewriteCond %{REQUEST_URI} !\.(jpg|jpeg|png|gif|css|ico)$ [NC] RewriteRule ^(.*)$ /maintenance/maintenance.htm [R=302,L] # # end redirects visitors to maintenance page # Redirects visitors from maintenance page to homepage # comment lines when redirecting visitors to maintenance page; uncomment when done # #Redirect 301 /maintenance/maintenance.htm / # # end redirects visitors from maintenance page to homepage

    Read the article

  • Is ignoring clients data during an automatic upgrading acceptable?

    - by A competent translator
    I recently faced a deletion of my calendar and notes data inside a third party application ( Horde ) on my online space. When I told the web hosting provider they replied that they were doing an upgrade to system software (!!) and client third party applications are not within their reach or backup policy. They don't even have a backup of my data. Is this practice acceptable from a web hosting provider, even for an individual clients ? I know that backing up my data is my responsibility but I anticipated that backup copies done by the host would be available when needed.

    Read the article

  • Page for Page Redirect in Google App Engine

    - by clifgray
    I have recently changed domain name for a webapp I run on Google App Engine and I am wondering if there is a simple way to do a page for page redirect from my old website to the new domain. Everything code wise is staying exactly the same but I just want it to go to the new domain. I am using python and the webapp2 framework for the webapp. I know I could go through and for every single handler do: webapp2.redirect('the specific url', permanent=True) But I am hoping for a simpler solution.

    Read the article

  • Windows Phone 7 Networked Game

    - by Craig
    Im creating a multiplayer asteroids type game for the Windows Phone 7, 2 players can challenge each other over who will get the highest score. On each players phone the opponent is displayed and both go about shooting asteroids and enemies. In an assignment I have due I would like to talk about the packet design, what would be the least amount of info that I can send over the connection? Instead of constantly having to send each players position, asteroid position, bullet position and enemy position etc. Or would all that data constantly need to be sent?

    Read the article

  • Drawing a texture at the end of a trace (crosshair?) UDK

    - by Dave Voyles
    I'm trying to draw a crosshair at the end of my trace. If my crosshair does not hit a pawn or static mesh (ex, just a skybox) then the crosshair stays locked on a certain point at that actor - I want to say its origin. Ex: Run across a pawn, then it turns yellow and stays on that pawn. If it runs across the skybox, then it stays at one point on the box. Weird? How can I get my crosshair to stay consistent? I've included two images for reference, to help illustrate. Note: The wrench is actually my crosshair. The "X" is just a debug crosshair. Ignore that. /// Image 1 /// /// Image 2 /// /*************************************************************************** * Draws the crosshair ***************************************************************************/ function bool CheckCrosshairOnFriendly() { local float CrosshairSize; local vector HitLocation, HitNormal, StartTrace, EndTrace, ScreenPos; local actor HitActor; local MyWeapon W; local Pawn MyPawnOwner; /** Sets the PawnOwner */ MyPawnOwner = Pawn(PlayerOwner.ViewTarget); /** Sets the Weapon */ W = MyWeapon(MyPawnOwner.Weapon); /** If we don't have an owner, then get out of the function */ if ( MyPawnOwner == None ) { return false; } /** If we have a weapon... */ if ( W != None) { /** Values for the trace */ StartTrace = W.InstantFireStartTrace(); EndTrace = StartTrace + W.MaxRange() * vector(PlayerOwner.Rotation); HitActor = MyPawnOwner.Trace(HitLocation, HitNormal, EndTrace, StartTrace, true, vect(0,0,0),, TRACEFLAG_Bullet); DrawDebugLine(StartTrace, EndTrace, 100,100,100,); /** Projection for the crosshair to convert 3d coords into 2d */ ScreenPos = Canvas.Project(HitLocation); /** If we haven't hit any actors... */ if ( Pawn(HitActor) == None ) { HitActor = (HitActor == None) ? None : Pawn(HitActor.Base); } } /** If our trace hits a pawn... */ if ((Pawn(HitActor) == None)) { /** Draws the crosshair for no one - Grey*/ CrosshairSize = 28 * (Canvas.ClipY / 768) * (Canvas.ClipX /1024); Canvas.SetDrawColor(100,100,128,255); Canvas.SetPos(ScreenPos.X - (CrosshairSize * 0.5f), ScreenPos.Y -(CrosshairSize * 0.5f)); Canvas.DrawTile(class'UTHUD'.default.AltHudTexture, CrosshairSize, CrosshairSize, 600, 262, 28, 27); return false; } /** Draws the crosshair for friendlies - Yellow */ CrosshairSize = 28 * (Canvas.ClipY / 768) * (Canvas.ClipX /1024); Canvas.SetDrawColor(255,255,128,255); Canvas.SetPos(ScreenPos.X - (CrosshairSize * 0.5f), ScreenPos.Y -(CrosshairSize * 0.5f)); Canvas.DrawTile(class'UTHUD'.default.AltHudTexture, CrosshairSize, CrosshairSize, 600, 262, 28, 27); return true; }

    Read the article

  • Why are only some of my objects being rendered?

    - by BleedObsidian
    Every time I create a new asteroid the previous one is no longer rendered? I did some debugging and printed out the size of Array-List 'Small' and when a new asteroid is created it doesn't go down, so the thread is still there it's just not being rendered, Why? StatePlay: package me.bleedobsidian.astroidjump; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.SlickException; import org.newdawn.slick.state.BasicGameState; import org.newdawn.slick.state.StateBasedGame; public class StatePlay extends BasicGameState { int stateID = 10; Player player; Asteroids asteroids; StatePlay(int stateID) { this.stateID = stateID; } @Override public int getID() { return stateID; } @Override public void init(GameContainer gc, StateBasedGame sbg) throws SlickException { ResManager.loadImages(); player = new Player(); asteroids = new Asteroids(); } @Override public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { g.setAntiAlias(true); player.render(g); asteroids.render(g); g.drawString("Asteroids: " + Asteroids.small.size(), 10, 25); } @Override public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException { player.update(gc, delta); asteroids.update(delta); } } Asteroids: package me.bleedobsidian.astroidjump; import java.util.ArrayList; import java.util.Timer; import org.newdawn.slick.Graphics; import org.newdawn.slick.Image; import org.newdawn.slick.SpriteSheet; public class Asteroids { public static ArrayList<Asteroid_Small> small = new ArrayList<Asteroid_Small>(); static SpriteSheet small_sprites = new SpriteSheet(ResManager.asteroids_small_ss, 32, 32); static Image small_1 = small_sprites.getSubImage(0, 0); static Image small_2 = small_sprites.getSubImage(1, 0); static Image small_3 = small_sprites.getSubImage(2, 0); static Image small_4 = small_sprites.getSubImage(3, 0); static boolean asteroids = true; static int diff = 0; Asteroids() { Task_Asteroids TaskA = new Task_Asteroids(); Timer timer = new Timer("Asteroids"); if(diff == 0) { timer.schedule(TaskA, 0, 4000); } else if(diff == 1) { timer.schedule(TaskA, 0, 3000); } } public static Image chooseSmallImage(int i) { if(i == 0) { return small_1; } else if(i == 1) { return small_2; } else if(i == 2) { return small_3; } else if(i == 3) { return small_4; } else { return small_1; } } public static void level_manager(float x) { if(x < 1000) { diff = 0; } else if(x < 2000) { diff = 1; } else if(x < 3000) { diff = 2; } else if(x < 5000) { diff = 3; } else if(x < 10000) { diff = 4; } else { diff = 5; } } public void update(int delta) { for(int s = 0; s < small.size(); s++) { Asteroid_Small as = small.get(s); as.update(delta); } } public void render(Graphics g) { for(int s = 0; s < small.size(); s++) { Asteroid_Small as = small.get(s); as.render(g); } } public static void setAsteroids(boolean tf) { asteroids = tf; } } Asteroid_Small: package me.bleedobsidian.astroidjump; import org.newdawn.slick.Graphics; import org.newdawn.slick.Image; public class Asteroid_Small { private static Image me; private static float x = 0; private static float y = 0; private static float speed = 0; private static float rotation = 0; private static float rotation_speed = 0; Asteroid_Small(Image i, float x, float y, float rs, float sp) { me = i; Asteroid_Small.x = x; Asteroid_Small.y = y; Asteroid_Small.rotation_speed = rs; Asteroid_Small.speed = sp; } public void update(int delta) { x -= speed * delta; rotation += rotation_speed * delta; me.setRotation(rotation); } public void render(Graphics g) { g.drawImage(me, x, y); } } Task_Asteroid: package me.bleedobsidian.astroidjump; import java.util.TimerTask; public class Task_Asteroids extends TimerTask { public void run() { if(Asteroids.diff == 0) { int randImage = (int) (Math.random() * 4); int randHeight = (int) (Math.random() * 480); Asteroids.small.add(new Asteroid_Small(Asteroids.chooseSmallImage(randImage), Player.x + 960, randHeight, 0.05f, 0.04f)); } } }

    Read the article

  • HTML5 - Does it have the power to handle a large 2D game with a huge world?

    - by user15858
    I have been using XNA game studio, but due to private reasons (as well as the ability to publish anywhere & my heavy interest in isogenic engine), I would like to switch to HTML5. However, I have very high 2D graphic demands for my game. The game itself will have a HDD size of anywhere between 6GB (min) to 12GB (max) which would be a full game deployed offline. The size of the images aren't significantly large, so streaming would be entirely possible if only those assets required were streamed as needed. The game has a massive file size because of the sheer amount of content. For some images or spritesheets, they would be quite massive. (ex. a very large Dragon, which if animated in a spritesheet would be split into two 4096x4096 sheets or one 8192x8192 sheet). Most assets would be very small, and about 7MB for a full character with 15 animations in every direction (all animations not required immediately) so in the size of a few hundred KB to download before the game loads. My question, however, is if the graphical power of HTML5 is enough to animate several characters on screen at once, when it flips through frames quite rapidly. All my sprites have about 25 frames per animation, 5 directions (a spritesheet for each direction & animation), and run at 30fps. Upon changing direction, animation, or a new character entering, spritesheets would change and be constantly loading/unloading. If I pack all directions in a single sheet, it would be about 2048x2048 per sheet. Most frameworks have no problem with this, but I am afraid from what I read that HTML5's graphical capabilities will limit me. Since it takes significant time simply to animate characters in any language, I'd like a quick answer.

    Read the article

  • Twitter integration

    - by qaisjp
    My computer game is powered using Love2d in Lua, there is dead space in the menu of my game and I'd like to fill it up with something. So I'll like to put a twitter feed there, how can I receive all the twitter posts created by AND mentioned from @stickydestroyer; how can I make it look good and code the actual thing. I know I have to use some sort of cURL module, but how can I get the feed AND make it looking nicely?

    Read the article

  • Performance issues with visibility detection and object transparency

    - by maul
    I'm working on a 3d game that has a view similar to classic isometric games (diablo, etc.). One of the things I'm trying to implement is the effect of turning walls transparent when the player walks behind them. By itself this is not a huge issue, but I'm having trouble determining which walls should be transparent exactly. I can't use a circle or square mask. There are a lot of cases where the wall piece at the same (relative) position has different visibility depending on the surrounding area. With the help of a friend I came up with this algorithm: Create a grid around the player that contains a lot of "visibility points" (my game is semi tile-based so I create one point for every tile on the grid) - the size of the square's side is close to the radius where I make objects transparent. I found 6x6 to be a good value, so that's 36 visibility points total. For every visibility point on the grid, check if that point is in the player's line of sight. For every visibility point that is in the LOS, cast a ray from the camera to that point and mark all objects the ray hits as transparent. This algorithm works - not perfectly, but only requires some tuning - however this is very slow. As you can see, it requries 36 ray casts minimum, but most of the time 60-70 depending on the position. That's simply too much for the CPU. Is there a better way to do this? I'm using Unity 3D but I'm not looking for an engine-specific solution.

    Read the article

< Previous Page | 10 11 12 13 14 15 16  | Next Page >