Search Results

Search found 7484 results on 300 pages for 'tzury bar yochay'.

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

  • Name for this antipattern? Fields as local variables

    - by JSB????
    In some code I'm reviewing, I'm seeing stuff that's the moral equivalent of the following: public class Foo { private Bar bar; public MethodA() { bar = new Bar(); bar.A(); bar = null; } public MethodB() { bar = new Bar(); bar.B(); bar = null; } } The field bar here is logically a local variable, as its value is never intended to persist across method calls. However, since many of the methods in Foo need an object of type Bar, the original code author has just made a field of type Bar. This is obviously bad, right? Is there a name for this antipattern?

    Read the article

  • How to add my program to the OS X system menu bar?

    - by Joe
    I have created a volume controller for iTunes but I would like this app to place an icon on the OS X system menu bar and have my slider controller drop down. I created this because I have to switch to iTunes to change the volume of the music because I am using the digital-out audio and the keyboard keys do not work in digital-out mode. Any guidance would be greatly appreciated.

    Read the article

  • How should I display a notification bar in WinForms?

    - by mafutrct
    You all know the "You've got new answers!" notification bar on SO. I'd like the same thing in a Form, preferably just as smooth. Is there a simple way? Or do I have to completely create this myself? My searches did not yield any good results, only lots of progress bars and popups in the system notification area, but that's not what I'm looking for.

    Read the article

  • Customize Firefox Status Bar?

    - by Steven Penny
    For web browsing I use Pale Moon. Pale Moon has a Status Bar, similar to what is now known as the Add-on Bar in Firefox. With Pale Moon when I hover over a link URL is shown in the status bar URL is shown instantly Entire width of status bar is allowed for URL, if necessary With Firefox when I hover over a link URL is shown in a tooltip in lower left corner URL is shown after intentional delay Only half the browser window width is allowed for URL Is there a way to make Firefox behave more like Pale Moon? No Status-4-Evar answers I realize Status-4-Evar might be the best solution here but I wish to see what, if any other options are out there. I will also accept well thought out and referenced answers as to why the Firefox way is "better".

    Read the article

  • progress bar for Hibernation in Windows Seven

    - by Toc
    On XP, during hibernation a progress bar showd me how long I have to wait for completing the operation. On Seven, I see no progress bar and the monitor turn off at once while the OS saves the ram on the disk. Same thing during the wake up process after the hibernation. Is it possible to have the progress bar for hibernation and following wake up on Seven?

    Read the article

  • Excel - add target line to stacked bar chart

    - by Chris W
    I've got a stacked bar chart. I'm displaying a set of floating bars to represent hi/low ranges for some metrics, by using a transparent fill on the bottom section of the bar I achieve the desired look. What I now need to do is add a horizontal line across the chart to indicate how a particular users score relates to all of these hi/low ranges therefore the placement of this line needs to be dynamic based on a value in a cell. Is there anyway to do this as I can't find an easy option. If this was a simple bar chart I could add the target scores as new series and use the line chart type but I don't seem able to overlay a second series on the stacked bar chart. I'm using 2003 at the moment but run this in 2007 if that helps.

    Read the article

  • Firefox add-on to move the tab bar.

    - by D Connors
    Hi, I'm using Firefox on my netbook, and I want to save as many vertical pixels as possible without turning to full-screen mode. Right now, the only thing in my way is the fact that the tab bar can't be moved like the navigation bar or the bookmarks toolbar. I'm looking for a Firefox add-on that will let me place the tab bar side-by-side with the other bars. Is there anything like that? (the lighter the better)

    Read the article

  • SQL SERVER – Color Coding SQL Server Management Studio Status Bar – SQL in Sixty Seconds #023 – Video

    - by pinaldave
    I often see developers executing the unplanned code on production server when they actually want to execute on the development server. Developers and DBAs get confused because when they use SQL Server Management Studio (SSMS) they forget to pay attention to the server they are connecting. It is very easy to fix this problem. You can select different color for a different server. Once you have different color for different server in the status bar, it will be easier for developer easily notice the server against which they are about to execute the script. Personally when I work on SQL Server development, here is the color code, which I follow. I keep Green for my development server, blue for my staging server and red for my production server. Honestly color coding does not signify much but different color for different server is the key here. More Tips on SSMS in SQL in Sixty Seconds: Generate Script for Schema and Data in SQL Server – SQL in Sixty Seconds #021  Remove Debug Button in SQL Server Management Studio – SQL in Sixty Seconds #020  Three Tricks to Comment T-SQL in SQL Server Management Studio – SQL in Sixty Seconds #019  Importing CSV into SQL Server – SQL in Sixty Seconds #018   Tricks to Replace SELECT * with Column Names – SQL in Sixty Seconds #017 I encourage you to submit your ideas for SQL in Sixty Seconds. We will try to accommodate as many as we can. If we like your idea we promise to share with you educational material. Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: Database, Pinal Dave, PostADay, SQL, SQL Authority, SQL in Sixty Seconds, SQL Query, SQL Scripts, SQL Server, SQL Server Management Studio, SQL Tips and Tricks, T SQL, Technology, Video

    Read the article

  • Experience the Oracle Support Stars Bar

    - by Oracle OpenWorld Blog Team
    By Gina WolfDon't miss the opportunity to meet with the stars of Oracle Support, live and in person at the Moscone West Level 2 lobby. Ask our experts your toughest questions about the Oracle hardware, software, and engineered systems you use to run your business. Explore new Oracle Support innovations including Oracle Platinum Services, My Oracle Support Mobile, and the Oracle Enterprise Manager Ops Center Everywhere program. Learn the latest best practices for problem prevention, rapid resolution, and product upgrades. In addition, discover how Oracle Advanced Customer Support Services can help you maximize the performance of all mission-critical Oracle systems. Come meet the stars behind your support: our trusted experts are ready to assist! The Oracle Support Stars Bar at the Moscone West Level 2 lobby is open all conference week at the following times: Sunday, September 30, 12:00 p.m. – 4:00 p.m. Monday, October 1, 10:00 a.m. – 6:00 p.m. Tuesday, October 2, 10:00 a.m. – 6:00 p.m. Wednesday, October 3, 9:00 a.m. – 5:00 p.m. Thursday, October 4, 9:00 a.m. – 1:00 p.m. Attend one or more of the 27 Oracle Customer Support Services sessions during Oracle OpenWorld to learn how Oracle Support enables you to gain maximum value from your Oracle hardware and software investments.

    Read the article

  • Double entries in the gnome 3 task bar

    - by Mark
    I am running Ubuntu 12.04 with Gnome 3. All was working well except that graphics were slow and even moving a window on the screen seemed slow. I installed the fglrx ati driver. Which seems to have improved matters. But on first login I had all gnome items duplicated. That is my task bar has the ubuntu sign, then says Applications, then places then the ubuntu sign then Aplications and then places. Any application I run produces two icons at the bottom of the screen. This was after a reboot. I rebooted again. Now I have 3!! On the right each set of icons such as printer is also trippled!! See screenshot at http://jetmark.co.uk/Screenshot.png See Dmesg at http://jetmark.co.uk/dmesg.txt Any suggestions welcome. Reboot - now I have 4!! So one set gets added on each reboot. Help!! I am going to be task barred out before long!!

    Read the article

  • Ubuntu 12.04 menu bar, nautilus, terminal, and gtk themes not working after installation of Gimp 2.8

    - by Chris
    I installed gimp2.8 from this ppa: ppa:otto-kesselgulasch/gimp after that, my system began having problems. This is my thought process in trying to fix what's happened and the order in which it happened: I noticed the menu bar at the top changed from an opaque black to perfectly clear and the titles of applications and the hidden buttons reacted slowly. No big deal, restarted to see if it fixed it. It didn't, in fact, when the logon screen came up, the password field was grey and boxy like a default windows 98 theme (that's the best I can describe it) as were all the option buttons for gtk programs. I open terminal to try and reinstall gtk, but the terminal is just a black screen with no ability to input commands. I go to a tty and I reinstalled gtk3 and gtk2 (I have both on my system. I don't think they're in conflict, they hadn't been before hand). I restarted. Nothing doing. Log in, nautilus isn't placing icons on my desktop. I click the launcher. It flashes, but no window opens. Try to open by Alt+f2, nothing. I purge ubuntu-desktop, restart, reinstall ubuntu-desktop. Nothing. I have no clue what to do at this point so I'm asking for any help diagnosing the problem and fixing it.

    Read the article

  • [Windows 8] Application bar buttons symbols

    - by Benjamin Roux
    During the development of my current Windows 8 application, I wanted to add custom application bar buttons with symbols that were not available in the StandardStyle.xaml file created with the template project. First I tried to Bing some new symbols and I found this blog post by Tim Heuer with the list of all symbols available (supposedly) but the one I wanted was not there (a heart). In this blog post I’m going the show you how to retrieve all the symbols available without creating a custom path. First you have to start the “Character map” tool and select “Segoe UI Symbol” then go at the end of the grid to see all the symbols available. When you want one just select it and copy it’s code inside the content of your Button. In my case I wanted a heart and its code is “E0A5”, so my button (or style in this case) became <Style x:Key="LoveAppBarButtonStyle" TargetType="Button" BasedOn="{StaticResource AppBarButtonStyle}"> <Setter Property="AutomationProperties.AutomationId" Value="LoveAppBarButtonStyle"/> <Setter Property="AutomationProperties.Name" Value="Love"/> <Setter Property="Content" Value="&#xE0A5;"/> </Style> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } Et voila. Hope this will help you (there is A LOT of symbols")!

    Read the article

  • Why is UIApplicationWillChangeStatusBarFrameNotification not sent when the in-call status bar is sho

    - by Sbrocket
    I've been trying to listen for changes in the status bar height – such as when the in-call status bar is shown or hidden – by listening for the UIApplicationWillChangeStatusBarFrameNotification notification to be sent. Fairly straightforward code here... [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarWillChangeFrame:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil]; But the notification never seems to be sent in that case, either on the Simulator by using the "Toggle In-Call Status Bar" option or on the device when a call ends with the application open. In addition, the similar UIApplicationDelegate method is not called. According to the documentation, UIApplicationWillChangeStatusBarFrameNotification Posted when the application is about to change the frame of the status bar. The userInfo dictionary contains an NSValue object that encapsulates a CGRect structure expressing the location and size of the new status bar frame. Use UIApplicationStatusBarFrameUserInfoKey to access this value. Can anyone explain why this notification is not being sent in response to the in-call status bar being shown or hidden? According to the documentation, it should be.

    Read the article

  • Navigation bar's buttons tint color sometimes not set

    - by Felipe
    Refer to the following, short video: http://screencast.com/t/cmnsqVTh The problem is with the color of a navigation bar's back button. The first time I load the app, the navigation bar + its buttons have the default color. I then push a view controller on the stack, and when the new view loads (in the viewDidLoad method), it sets the navigation bar's tint color to pink. The nav bar's buttons are also pink as expected. I then press the back button, and the view is popped from the stack. On the root view controller's viewWillAppear method I set the tint color back to nil so that it's the default color again. The navigation bar looks as expected. However if I push the view controller on the stack yet again, the navigation bar's tint color is pink, but the back button's color is the default light blue. Hope that was understandable. So what's the cause of the problem?

    Read the article

  • XNA Health Bar continually decreasing

    - by Craig
    As per the Health bar tutorial on ... http://www.xnadevelopment.com/tutorials/notsohealthy/NotSoHealthy.shtml I have set up the above, how do I make it decrease by 1 health per second? I want to create a mini survival game, and this is an important factor. Where am i going wrong? I want it to visibly decrease every second. using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Media; namespace Health { /// <summary> /// This is the main type for your game /// </summary> public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; Texture2D healthBar; int currentHealth = 100; float seconds; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } /// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); } /// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); healthBar = Content.Load<Texture2D>("HealthBar"); // TODO: use this.Content to load your game content here } /// <summary> /// UnloadContent will be called once per game and is the place to unload /// all content. /// </summary> protected override void UnloadContent() { // TODO: Unload any non ContentManager content here } /// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); // TODO: Add your update logic here currentHealth = (int)MathHelper.Clamp(currentHealth, 0, 100); seconds += (float)gameTime.ElapsedGameTime.TotalSeconds; if (seconds >= 1) { currentHealth -= 1; } seconds = 0; base.Update(gameTime); } /// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); spriteBatch.Draw(healthBar, new Rectangle(this.Window.ClientBounds.Width / 2 - healthBar.Width / 2, 30, healthBar.Width, 44), new Rectangle(0, 45, healthBar.Width, 44), Color.Gray); spriteBatch.Draw(healthBar, new Rectangle(this.Window.ClientBounds.Width / 2 - healthBar.Width / 2, 30, (int)(healthBar.Width * ((double)currentHealth / 100)), 44), new Rectangle(0, 45, healthBar.Width, 44), Color.Red); spriteBatch.Draw(healthBar, new Rectangle(this.Window.ClientBounds.Width / 2 - healthBar.Width / 2, 30, healthBar.Width, 44), new Rectangle(0, 0, healthBar.Width, 44), Color.White); spriteBatch.End(); base.Draw(gameTime); } } } Cheers!

    Read the article

  • Integrating a Progress Bar into a Wizard

    - by Geertjan
    Normally, when you create a wizard, as described here, and you have your own iterator, you'll have a class signature like this: public final class MyWizardWizardIterator implements WizardDescriptor.InstantiatingIterator<WizardDescriptor> { Let's now imagine that you've got some kind of long running process your wizard needs to perform. Maybe the wizard needs to connect to something, which could take some time. Start by adding a new dependency on the Progress API, which gives you the classes that access the NetBeans Platform's progress functionality. Now all we need to do is change the class signature very slightly: public final class MyWizardWizardIterator implements WizardDescriptor.ProgressInstantiatingIterator<WizardDescriptor> { Take a look at the part of the signature above that is highlighted. I.e., use WizardDescriptor.ProgressInstantiatingIterator instead of WizardDescriptor.InstantiatingIterator. Now you will need to implement a new instantiate method, one that receives a ProgressHandle. The other instantiate method, i.e., the one that already existed, should never be accessed anymore, and so you can add an assert to that effect: @Override public Set<?> instantiate() throws IOException {     throw new AssertionError("instantiate(ProgressHandle) " //NOI18N             + "should have been called"); //NOI18N } @Override public Set instantiate(ProgressHandle ph) throws IOException {     return Collections.emptySet(); } OK. Let's now add some code to make our progress bar work: @Override public Set instantiate(ProgressHandle ph) throws IOException {     ph.start();     ph.progress("Processing...");     try {         //Simulate some long process:         Thread.sleep(2500);     } catch (InterruptedException ex) {         Exceptions.printStackTrace(ex);     }     ph.finish();     return Collections.emptySet(); } And, maybe even more impressive, you can also do this: @Override public Set instantiate(ProgressHandle ph) throws IOException {     ph.start(1000);     ph.progress("Processing...");     try {         //Simulate some long process:         ph.progress("1/4 complete...", 250);         Thread.sleep(2500);         ph.progress("1/2 complete...", 500);         Thread.sleep(5000);         ph.progress("3/4 complete...", 750);         Thread.sleep(7500);         ph.progress("Complete...", 1000);         Thread.sleep(1000);     } catch (InterruptedException ex) {         Exceptions.printStackTrace(ex);     }     ph.finish();     return Collections.emptySet(); } The screenshots above show you what you should see when the Finish button is clicked in each case.

    Read the article

  • In a Tab Bar based app a controller release data of the other ! !

    - by Flodev03
    Hi all ! I've made a ViewBased app, in the app delegate i've set a UITabBarCotntroller, in the app i have different view Controller two of them displays text in a UITextView and labels, the other one is my "ShakeController" a UIViewController in which i've set a UIAcelerometerDelegate, in it i create a instance of UIAccelerometer, in the method which manages the shake everything works fine, in this controller i have also set a UIImageView to make a simple animation, in the view Did Load method i set my imageView.animation to an array of UIImage. My problem is : when the app is launched i use the ViewControllers and everything work fine, but when i tap the ShakeController item in the tab bar and then when i come back to the other controllers the label looks like : label and textView like : Lorem ipsum..... the text of UItextView in IB. I have noticed thaht if i comment the initialisation of my imageView to the array of image i can navigate the items (from a view controller to another) without the label change and stay what i want them to be. Notice that the two controllers are in a UINavigationController. (i use @proprety (nonnatomic, retain) then @synthesize ... then releqse in the dealloc for the labels textview and my uiimageView) Do not know what to do thanks to all

    Read the article

  • Charms and the App Bar

    - by Dennis Vroegop
    Ok. I admit. I made a mistake in the last post about our planespotter app. I have dedicated a full part of the hub to Social. I also had a section called Friends but that made sense since I said that “Friends” is a special group of people that connect to each other through our app and only our app. Social however is sharing our spots with Twitter, Facebook and so on. Now, we could write that functionality in our app in a different section but there is one small problem with that: users don’t expect that. Ok, I admit. The mistake was quite deliberate to give me an excuse to write this part. But still: the mistake is one I see a lot. People are trying to do stuff in their application that they shouldn’t be doing. This always strike me as slightly odd: why do some work when others have already done it for you and you can just use it? After all: good developers are lazy (lazy people will always try to find the easiest way to do something and in development land this usually means the cleanest and best to support way…) So. What is that part that Microsoft has done for us and we don’t have to do ourselves? The answer lies on the right hand of your Win8 screen: This is a screenshot of my tablet (as you can see I am writing this right now….) When I swipe my finger from out of the screen on the right inside the screen (or move the mouse to the upper right corner) this menu will appear. Next to settings and the start menu button we’ll find the Search and the Share charms. These are two ways that your app can share the information it contains with the rest of the world, or at least: the rest of your system. So don’t write a Search feature in your app. Don’t write a Share feature in your app. It’s here already. Users, once they are used to Windows 8, will use that feature and expect it to work. If it doesn’t, they won’t like your app and you can kiss you dreams of everlasting fame goodbye. So use these two. What are they? Well, simply they are parts of a contract. In your app you say somewhere in code that you are supporting Search and Share. So when the user selects Share the system will interrogate the current app in the foreground if it supports this feature. Your app will say “But why, yes, I do!” Then the system will ask the app “Ok then, wisecrack, then share!” and you will have to provide the system with some information about the format. Other applications have subscribed to be at the receiving end of the Share contract. They have told the system that they support Sharing (receiving) and which formats they understand. If one or more of them support the formats you specify, the user will see them. The user clicks / taps on the app of their choice and data is moved from your app to the new one. So if you say you support Facebook and Twitter users can post data from your app to these networks by selecting Share. The same applies to Search. Don’t make a “search” button in your app but use the contract to tell the system that you support search and use that instead. Users will be grateful (remember that bar with men/women/creatures that are waiting for you?) The more and more people get to know Windows 8, the more they will use this. And if you are one of the people who wrote an app that helped them learn the system, well, that’s even better. So. We don’t have a Share or a Search button. We do have other buttons. Most important: we probably need a “New Spot” button. And a “Filter” might be useful. Or someway to open the camera so you can add a picture to the spot. Where will be put those? The answer is the “Appbar” . This is a application / context aware menu that slides up from the bottom of the screen when you move your finger / mouse from below the screen into it. From above downwards works just as well. Here you see an example of the appbar from the People app. (click on it for a larger version). This appears whenever you slide your finger up from below of down from above. This is where you put your commands. Remember, this is context aware so this menu will change when you are in different parts of your app or when you have selected different items. There are a few conventions when you create this appbar. First, the items on the right are “General” items, meaning they have little to do with what is on the screen right now. I think this would be a great place to add our “New Spot” icon. On the far left are items associated with the current selected item or screen. So if you have a spot selected, the button for Add Photo should be visible here and on the left hand side. Not everything is as clear as this, but this is what you should strive for. Group items together. And please note: this is the only place in Metro design where we are allowed to use lines as separators. So when you want to separate a group of icons from another group, add a line. Also note the simplicity of the buttons. No colors, no lights or shadows, no 3D. After a couple of years of fancy almost realistic looking icons people have finally decided that hey, this is a virtual world: it’s ok to look virtual as well. So make things as readable and clear as possible and don’t try to duplicate nature. It’s all about the information, remember? (If you don’t remember I’d like to point you to a older blog post of mine about the what and why of Metro). So.. think about the buttons a bit and think about Share and Search. What will you put there? Remember: this is the way the users interact with your apps and while you shouldn’t judge a book by its covers when it comes to people, this isn’t entirely so when it comes to apps. People DO judge an app by its looks and the way it feels. Take advantage of that. History has learned that a crappy app with a GREAT user interface gets better reviews than a GREAT app with a lousy UI… I know: developers will find this extremely unfair but that’s the world we live in (No, I am not saying you should deliver rubbish apps). Next time: we’ll start by building the darn thing!

    Read the article

  • Character jump animation is not working when i hit the space bar

    - by muzzy
    i am having an issue with my game in XNA. My jump sprite sheet for my character does not trigger when i hit the space bar. I cant seem to find the problem. Please help me. I am also put the code below to make things easier. namespace WindowsGame4 { public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; // start of new code Texture2D playerWalk; // sprite sheet of walk cycle (14 frames) Texture2D idle; // idle animation Texture2D jump; // jump animation Vector2 playerPos; // to hold x and y position info for the player Point frameDimensions; // to hold width and height values for the frames int presentFrame; // to record which frame we are on at any given time int noOfFrames; // to hold the total number of frames in the spritesheet int elapsedTime; // to know how long each frame has been shown int frameDuration; // to hold info about how long each frame should be shown SpriteEffects flipDirection; // SpriteEffects object int speed; //rate of movement int upMovement; int downMovement; int rightMovement; int leftMovement; int jumpApex; string state; //this is going to be "idle","walking" or "jumping". KeyboardState previousKeyboardState; Vector2 originalPlayerPos; Vector2 movementDirection; Vector2 movementSpeed; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } protected override void Initialize() { // textures will be defined in the LoadContent() method playerPos = new Vector2(0, 200); // starting position for the player is at the left of the screen, and a Y position of 200 frameDimensions = new Point(55, 65); // each frame in the idle sprite sheet is 55 wide by 65 high presentFrame = 0; // start at frame 0 noOfFrames = 5; // there are 5 frames in the idle cycle elapsedTime = 0; // set elapsed time to start at 0 frameDuration = 80; // 80 milliseconds is how long each frame will show for (the higher the number, the slower the animation) flipDirection = SpriteEffects.None; // set the value of flipDirection to none speed = 200; upMovement = -2; downMovement = 2; rightMovement = 1; leftMovement = -1; jumpApex = 100; state = "idle"; previousKeyboardState = Keyboard.GetState(); originalPlayerPos = Vector2.Zero; movementDirection = Vector2.Zero; movementSpeed = Vector2.Zero; base.Initialize(); } protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); playerWalk = Content.Load<Texture2D>("sprites/walkSmall"); // load the walk cycle spritesheet idle = Content.Load<Texture2D>("sprites/idleCycle"); // load the idle cycle sprite sheet jump = Content.Load<Texture2D>("sprites/jump"); // load the jump cycle sprite sheet } protected override void UnloadContent() // we're not using this method at the moment { } protected override void Update(GameTime gameTime) // Update method - used it to call a number of other methods { if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { this.Exit(); // Exit the game if the Escape key is pressed } KeyboardState presentKeyboardState = Keyboard.GetState(); UpdateMovement(presentKeyboardState, gameTime); UpdateIdle(presentKeyboardState, gameTime); UpdateJump(presentKeyboardState); UpdateAnimation(gameTime); playerPos += movementDirection * movementSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds; previousKeyboardState = presentKeyboardState; base.Update(gameTime); } private void UpdateAnimation(GameTime gameTime) { elapsedTime += gameTime.ElapsedGameTime.Milliseconds; if (elapsedTime > frameDuration) { elapsedTime -= frameDuration; elapsedTime = elapsedTime - frameDuration; presentFrame++; if (presentFrame > noOfFrames) if (state != "jumping") { presentFrame = 0; } else { presentFrame = 8; } } } protected void UpdateMovement(KeyboardState presentKeyboardState, GameTime gameTime) { if (state == "idle") { movementSpeed = Vector2.Zero; movementDirection = Vector2.Zero; if (presentKeyboardState.IsKeyDown(Keys.Left)) { state = "walking"; movementSpeed.X = speed; movementDirection.X = leftMovement; flipDirection = SpriteEffects.FlipHorizontally; } if (presentKeyboardState.IsKeyDown(Keys.Right)) { state = "walking"; movementSpeed.X = speed; movementDirection.X = rightMovement; flipDirection = SpriteEffects.None; } } } private void UpdateIdle(KeyboardState presentKeyboardState, GameTime gameTime) { if ((presentKeyboardState.IsKeyUp(Keys.Left) && previousKeyboardState.IsKeyDown(Keys.Left) || presentKeyboardState.IsKeyUp(Keys.Right) && previousKeyboardState.IsKeyDown(Keys.Right) && state != "jumping")) { state = "idle"; } } private void UpdateJump(KeyboardState presentKeyboardState) { if (state == "walking" || state == "idle") { if (presentKeyboardState.IsKeyDown(Keys.Space) && !presentKeyboardState.IsKeyDown(Keys.Space)) { presentFrame = 1; DoJump(); } } if (state == "jumping") { if (originalPlayerPos.Y - playerPos.Y > jumpApex) { movementDirection.Y = downMovement; } if (playerPos.Y > originalPlayerPos.Y) { playerPos.Y = originalPlayerPos.Y; state = "idle"; movementDirection = Vector2.Zero; } } } private void DoJump() { if (state != "jumping") { state = "jumping"; originalPlayerPos = playerPos; movementDirection.Y = upMovement; movementSpeed = new Vector2(speed, speed); } } protected override void Draw(GameTime gameTime) // Draw method { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); // begin the spritebatch if (state == "walking") { noOfFrames = 14; frameDimensions = new Point(55, 65); Vector2 playerWalkPos = new Vector2(playerPos.X, playerPos.Y - 28); spriteBatch.Draw(playerWalk, playerWalkPos, new Rectangle((presentFrame * frameDimensions.X), 0, frameDimensions.X, frameDimensions.Y), Color.White, 0, Vector2.Zero, 1, flipDirection, 0); } if (state == "idle") { noOfFrames = 5; frameDimensions = new Point(55, 65); Vector2 idlePos = new Vector2(playerPos.X, playerPos.Y - 28); spriteBatch.Draw(idle, idlePos, new Rectangle((presentFrame * frameDimensions.X), 0, frameDimensions.X, frameDimensions.Y), Color.White, 0, Vector2.Zero, 1, flipDirection, 0); } if (state == "jumping") { noOfFrames = 9; frameDimensions = new Point(55, 92); Vector2 jumpPos = new Vector2(playerPos.X, playerPos.Y - 28); spriteBatch.Draw(jump, jumpPos, new Rectangle((presentFrame * frameDimensions.X), 0, frameDimensions.X, frameDimensions.Y), Color.White, 0, Vector2.Zero, 1, flipDirection, 0); } spriteBatch.End(); // end the spritebatch commands base.Draw(gameTime); } } }

    Read the article

  • Matching first set of elements with xpath...

    - by Ugo Enyioha
    I have an xml document that looks like this. <foo> <bar type="artist"/> Bob Marley </bar> <bar type="artist"/> Peter Tosh </bar> <bar type="artist"/> Marlon Wayans </bar> </foo> <foo> <bar type="artist"/> Bob Marley </bar> <bar type="artist"/> Peter Tosh </bar> <bar type="artist"/> Marlon Wayans </bar> </foo> <foo> <bar type="artist"/> Bob Marley </bar> <bar type="artist"/> Peter Tosh </bar> <bar type="artist"/> Marlon Wayans </bar> </foo> I would like to construct an xpath that returns only the first set: <bar type="artist"/> Bob Marley </a> <bar type="artist"/> Peter Tosh </a> <bar type="artist"/> Marlon Wayans </a> How would one go about this? I have tried //bar[@type='artist'] but it's obvious there's more to this. Thanks in advance.

    Read the article

  • OpenGL ES, UIView and Status Bar mess

    - by sfider
    I have iPhone (iPhoneOS 3.x) OpenGL ES app that: can be in landscape/portrait orientation can be with/without status bar shown I do this by changing status bar orientation and hidden state, then updating OpenGL view frame so it won't overlap status bar and setting projection matrix appropriately. OpenGL view is in portrait orientation at all time. View controller's shouldAutorotateToInterfaceOrientation: method returns false always, so the status bar won't start autorotating when app is in landscape mode. The problem I have is that I want to use some other UIViews, like: UIWebView, MFMailComposeView, MPMediaPicker. I could show them as modals, but this this have some drawbacks: views will always show in portrait orientation, even if they support landscape orientation views will not autorotate, even if they support it What I do is I take OpenGL view of the window with removeFromSuperview, set transform to the other view so it will be in portrait/landscape orientation when it shows up and place the other view on the window with addSubview:. This works fine without the status bar, but with it there are some problems I cannot work out: MPMediaPicker is sized to fit under status bar, but it slides under it anyway MFMailComposeView does not show navigation bar until it autorotates on device orientation change Does anyone has an idea how can I get it to work?

    Read the article

  • set width of bars in matlab bar plot on logarithmic scale

    - by KatyB
    I am a bit confused on how to draw a bar graph for the following example: x_lims = [1000,10000;10000,100000;100000,1000000;1000000,10000000;10000000,... 100000000;100000000,1000000000;1000000000,10000000000;... 10000000000,100000000000;100000000000,1e12]; ex1 = [277422033.049038;24118536.4203188;2096819.03295482;... 182293.402068030;15905;1330;105;16;1]; Here, x_lims is the x axis limits for each individual bar and ex1 is the count. How can I plot these on a bar graph so that the width of each individual bar along the x axis is defined by the distance between x_lims(:,1) and x_lims(:,2) and the y value is defined by ex1? So far I have: bar(log10(x_lims(:,1)),log10(ex1)); set(gca,'Xtick',3:11,'YTick',0:9); set(gca,'Xticklabel',10.^get(gca,'Xtick'),... 'Yticklabel',10.^get(gca,'Ytick')); But I would like to (1) have the labels to be the same as if they were created using semilogx or semilogy e.g. 10^9, and (2) I would like to remove the space between the bars, for the first bar, for example, I would like to have it extend horizontally from 1000 to 10000 and then the second bar from 10000 to 100000, and so on. How can this be done?

    Read the article

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