Search Results

Search found 4648 results on 186 pages for 'voting buttons'.

Page 31/186 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • POST attack on my website

    - by benhowdle89
    Hi, I have a site (humanisms.co.uk) which incorporates a voting system, ie. user clicks "Up" and it sends a parameter to a PHP script via AJAX, the PHP inserts vote into MYSQL db and the new "Up" vote is sent back to the page to update the vote count. This is working great but i've noticed that the number of votes for one of my questions shot up last night. I viewed my webhosts access logs and saw this line: 108.27.195.232 - - [03/Mar/2011:15:20:18 +0000] "POST /vote.php HTTP/1.1" 200 2 "http://www.humanisms.co.uk/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.114 Safari/534.16" This is repeated well over 100 times and sometimes more than once a second. Now i know they probably arent sitting there clicking Vote but running some sort of PHP loop? I'm not worried about SQL injection but what can i do to prevent this same IP address from doing this or what can i do in general to avoid this scenario. I should also say that there's no login so anyone can click using the voting system. Thanks

    Read the article

  • Only 5 days left...your vote is needed!

    - by mvaughan
         By Misha Vaughan, Oracle Applications User Experience It is a bit early for the voting season here in the U.S., but there is a very important (to me) voting window now upon us. Until Aug. 31, the public gets to vote on submissions to South by Southwest (SXSW) Interactive in Austin, Texas, in March 2013. This is a thought-leading software conference discussing the up-and-coming trends in industry. I have attended the interactive and the music portions of SXSW before, but I have never attempted a submission. This is my first year trying.  I am building on the themes from this conversation on simplicity with Jeremy Ashley for Oracle OpenWorld 2012. The SXSW session will be a chance to share best practices for moving designs that focus on simplicity successfully through an organization. Please take a moment and cast your vote.  Help me get Oracle on the roster at SXSW! There are only five days left to vote! My colleague Ultan O’Broin has also submitted, and I encourage you to vote for his sessions as well. 

    Read the article

  • Which forum software has the most advanced community/GetSatisfaction type features?

    - by Gaia
    I need to assemble a GetSatisfaction/Lithium/Jive type support forum/community. The first is not available in the desired language and the last two are priced for the enterprise market. I did research some other options (open source or SaaS) but they all seem to be either: kind of dead (open source options) too focused in gathering ideas/feedback (uservoice) strictly support without the community/voting features (zendesk) I need an open forum (people powered support/UGC with community/voting features). Therefore I will have to do some of the work on my own. I want to piece things (plugins/mods/etc) on top of a standard forum platform to give it the features I need. For this purpose, I want to use a mature product with widespread userbase, active community and lots of plugin options. I believe most will agree that my options therefore are: vBulletin phpBB SMF Here are the questions: Which one of the three above offers the easier path towards the desired goal? Which one of the three above has the most advanced features related to the desired goal? Of course I dont expect anyone to know these answers cut and dry. I am hoping to hear some experiences and see some examples. Also, it would be great if both those questions had the same answer, but I am not going to get my hopes up... PS: I wish I could add the tags "phpbb" and "smf" ;)

    Read the article

  • Need help with the naming convention for an incremental variable [closed]

    - by iStryker
    I am using a voting module, that allows you vote either up or down [or reset]. If you vote up, the value is +1. If you vote down, the value is -1. If you vote up then down, the value is -1. I want to extend this module to allow you to vote multiple times, and the votes to be incremental. Examples Up, Up = +1, +1 = +2 Up, Up, Down = +1, +1, -1 = +1 I want to create a new boolean variable. If FALSE/NULL then use the old system +1/-1. If TRUE, voting will be incremental. What should be the name of this variable be? I feel 'incremental' is not the correct name. This module is part of an open-source project and is used on 3,177+ websites, so I want to get the naming convention right. Naturally, I'll be setting an upper and lower limit the variable be. [ie 5 & 0] Side-question: Is there a mathematics term to describe something being either +1/-1?

    Read the article

  • My powerpoint seems working in right-to-left

    - by Pavel Radzivilovsky
    I don't seem to find a way to switch it off. See picture. There seems to be no way to say the paragraph is not RTL. There are addable RTL buttons in the customize ribbon dialog, but they are grayed in ribbon cfg view, even though buttons that are actually there are also grayed in the same way. Looks like there's no way to get some other buttons shown on the office ribbon. I already found how to do it with VBA, but I find no way of doing it from UI and I spent much time searching and trying. Am I senile?

    Read the article

  • UIButtons in UIScrollView stop it scrolling, how to fix?

    - by Mark McFarlane
    Hi all, I have a problem with adding a set of UIButtons to a UIScrollView. With the buttons added it seems that the scroll command is not being passed to the scroll view as the buttons cover the whole surface. I've read various posts on this but still can't figure it out. I'm pretty new to iPhone programming so there's probably something obvious I've missed. I've tried things like canCancelContentTouches and delaysContentTouches to TRUE and FALSE. Here is the code I use to add the buttons to the scrollview. The scrollview was created in IB and is passed in to the function: -(void)drawCharacters:(NSMutableArray *)chars:(UIScrollView *)target_view { //NSLog(@"CLEARING PREVIOUS BUTTONS"); //clear previous buttons for parts/kanji if(target_view == viewParts){ for (UIButton *btn in parts_buttons) { [btn removeFromSuperview]; } [parts_buttons removeAllObjects]; } else if(target_view == viewKanji){ for (UIButton *btn in kanji_buttons) { [btn removeFromSuperview]; } [kanji_buttons removeAllObjects]; } //display options int chars_per_line = 9; //change this to change the number of chars displayed on each line if(target_view == viewKanji){ chars_per_line = 8; } int char_gap = 0; //change this to change the margin between chars int char_dimensions = (320/chars_per_line)-(char_gap*2); //set starting x, y coords int x = 0, y = 0; //increment y coord y += char_gap; //NSLog(@"ABOUT TO DRAW FIRST BUTTON"); for(NSMutableArray *char_arr in chars){ //increment x coord x += char_gap; //draw at x and y UIButton *myButton = [UIButton buttonWithType:UIButtonTypeCustom]; myButton.frame = CGRectMake(x, y, char_dimensions, char_dimensions); // position in the parent view and set the size of the button [myButton setTitle:[char_arr objectAtIndex:0] forState:UIControlStateNormal]; [myButton setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal]; [myButton setTitleColor:[UIColor colorWithRed:0.8 green:0.8 blue:0.8 alpha:1.0] forState:UIControlStateDisabled]; myButton.titleLabel.font = [UIFont boldSystemFontOfSize:22]; if(target_view == viewKanji){ myButton.titleLabel.font = [UIFont boldSystemFontOfSize:30]; } // add targets and actions if(target_view == viewParts){ [myButton addTarget:self action:@selector(partSelected:) forControlEvents:UIControlEventTouchUpInside]; } else if(target_view == viewKanji){ [myButton addTarget:self action:@selector(kanjiSelected:) forControlEvents:UIControlEventTouchUpInside]; [myButton setTag:(int)[char_arr objectAtIndex:1]]; } //if the part isnt in the current list of kanji, disable and dim it if(target_view == viewParts){ if([kanji count] > 0){ [myButton setEnabled:NO]; } bool do_break = NO; for(NSMutableArray *arr in kanji){ //NSLog([NSString stringWithFormat:@"CHECKING PARTS AGAINST %d KANJI", [kanji count]]); for(NSString *str in [[arr objectAtIndex:2] componentsSeparatedByString:@" "]){ if(([myButton.titleLabel.text isEqualToString:str])){ //NSLog(@"--------------MATCH!!!-----------------"); [myButton setEnabled:YES]; for(NSString *str1 in parts_selected){ if(([myButton.titleLabel.text isEqualToString:str1])){ [myButton setEnabled:NO]; break; } } do_break = YES; break; } if(do_break) break; } if(do_break) break; } } // add to a view [target_view addSubview:myButton]; //update coords of next button x += char_dimensions+ char_gap; if (x > (320-char_dimensions)) { x = 0; y += char_dimensions + (char_gap*2); } //add button to global array to be removed from view next update if(target_view == viewParts){ [parts_buttons addObject:myButton]; } else if(target_view == viewKanji){ [kanji_buttons addObject:myButton]; } } //NSLog(@"FINISHED DRAWING ALL BUTTONS"); } Any help on this would be greatly appreciated. I just need to fix this to finish my app.

    Read the article

  • How to set BackGround color to a divider in JSplitPane

    - by Sunil Kumar Sahoo
    I have created a divider in JSplitPane. I am unable to set the color of divider. I want to set the color of divider. please help me how to set color of that divider import javax.swing.; import java.awt.; import java.awt.event.*; public class SplitPaneDemo { JFrame frame; JPanel left, right; JSplitPane pane; int lastDividerLocation = -1; public static void main(String[] args) { SplitPaneDemo demo = new SplitPaneDemo(); demo.makeFrame(); demo.frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); demo.frame.show(); } public JFrame makeFrame() { frame = new JFrame(); // Create a horizontal split pane. pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); left = new JPanel(); left.setBackground(Color.red); pane.setLeftComponent(left); right = new JPanel(); right.setBackground(Color.green); pane.setRightComponent(right); JButton showleft = new JButton("Left"); showleft.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Container c = frame.getContentPane(); if (pane.isShowing()) { lastDividerLocation = pane.getDividerLocation(); } c.remove(pane); c.remove(left); c.remove(right); c.add(left, BorderLayout.CENTER); c.validate(); c.repaint(); } }); JButton showright = new JButton("Right"); showright.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Container c = frame.getContentPane(); if (pane.isShowing()) { lastDividerLocation = pane.getDividerLocation(); } c.remove(pane); c.remove(left); c.remove(right); c.add(right, BorderLayout.CENTER); c.validate(); c.repaint(); } }); JButton showboth = new JButton("Both"); showboth.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Container c = frame.getContentPane(); c.remove(pane); c.remove(left); c.remove(right); pane.setLeftComponent(left); pane.setRightComponent(right); c.add(pane, BorderLayout.CENTER); if (lastDividerLocation >= 0) { pane.setDividerLocation(lastDividerLocation); } c.validate(); c.repaint(); } }); JPanel buttons = new JPanel(); buttons.setLayout(new GridBagLayout()); buttons.add(showleft); buttons.add(showright); buttons.add(showboth); frame.getContentPane().add(buttons, BorderLayout.NORTH); pane.setPreferredSize(new Dimension(400, 300)); frame.getContentPane().add(pane, BorderLayout.CENTER); frame.pack(); pane.setDividerLocation(0.5); return frame; } } Thanks Sunil kumar Sahoo

    Read the article

  • Disable mouse hotkeys in Chrome

    - by John Ruiz
    Does anyone know how I can get Chrome to stop using my mouse buttons as hotkeys for a Logitech MX518 gaming mouse? I have the mouse driver and software suite (SetPoint) installed. Unfortunately, SetPoint does not provide per-application settings, so that route is not an option. No matter what I do in SetPoint, Chrome captures my side mouse buttons and uses them as a forward/back hotkey. I want to turn this off because I use those buttons for my push-to-talk in Mumble/Ventrilo. Any idea how I can do this? edit: my set-point does not have a way to create per-application settings.

    Read the article

  • Brightness Controls not working on HP Dm3t

    - by Karim
    i have an HP dm3t notebook which normally comes with windows 7. after some time i figured out how to install Windows XP on it. but now i am facing a problem that the brightess controls dont work so i am unable to change the brightess. the strange thing is that all the other buttons (sound volume, mute, sleep , etc... ) works but not the 2 brightess controls. i already downloaded the "HP Quick Launch Buttons" so i am asking about suggesitions how can i enable these two buttons in windows XP or even if i can change the brightess using some kind of software. thanks

    Read the article

  • Brightness Controls not working on HP Dm3t

    - by Karim
    i have an HP dm3t notebook which normally comes with windows 7. after some time i figured out how to install Windows XP on it. but now i am facing a problem that the brightess controls dont work so i am unable to change the brightess. the strange thing is that all the other buttons (sound volume, mute, sleep , etc... ) works but not the 2 brightess controls. i already downloaded the "HP Quick Launch Buttons" so i am asking about suggesitions how can i enable these two buttons in windows XP or even if i can change the brightess using some kind of software. thanks

    Read the article

  • 'Content' is NOT 'Text' in XAML

    - by psheriff
    One of the key concepts in XAML is that the Content property of a XAML control like a Button or ComboBoxItem does not have to contain just textual data. In fact, Content can be almost any other XAML that you want. To illustrate here is a simple example of how to spruce up your Button controls in Silverlight. Here is some very simple XAML that consists of two Button controls within a StackPanel on a Silverlight User Control. <StackPanel>  <Button Name="btnHome"          HorizontalAlignment="Left"          Content="Home" />  <Button Name="btnLog"          HorizontalAlignment="Left"          Content="Logs" /></StackPanel> The XAML listed above will produce a Silverlight control within a Browser that looks like Figure 1.   Figure 1: Normal button controls are quite boring. With just a little bit of refactoring to move the button attributes into Styles, we can make the buttons look a little better. I am a big believer in Styles, so I typically create a Resources section within my user control where I can factor out the common attribute settings for a particular set of controls. Here is a Resources section that I added to my Silverlight user control. <UserControl.Resources>  <Style TargetType="Button"         x:Key="NormalButton">    <Setter Property="HorizontalAlignment"            Value="Left" />    <Setter Property="MinWidth"            Value="50" />    <Setter Property="Margin"            Value="10" />  </Style></UserControl.Resources> Now back in the XAML within the Grid control I update the Button controls to use the Style attribute and have each button use the Static Resource called NormalButton. <StackPanel>  <Button Name="btnHome"          Style="{StaticResource NormalButton}"          Content="Home" />  <Button Name="btnLog"          Style="{StaticResource NormalButton}"          Content="Logs" /></StackPanel> With the additional attributes set in the Resources section on the Button, the above XAML will now display the two buttons as shown in Figure 2. Figure 2: Use Resources to Make Buttons More Consistent Now let’s re-design these buttons even more. Instead of using words for each button, let’s replace the Content property to use a picture. As they say… a picture is worth a thousand words, so let’s take advantage of that. Modify each of the Button controls and eliminate the Content attribute and instead, insert an <Image> control with the <Button> and the </Button> tags. Add a ToolTip to still display the words you had before in the Content and you will now have better looking buttons, as shown in Figure 3.   Figure 3: Using pictures instead of words can be an effective method of communication The XAML to produce Figure 3 is shown in the following listing: <StackPanel>  <Button Name="btnHome"          ToolTipService.ToolTip="Home"          Style="{StaticResource NormalButton}">    <Image Style="{StaticResource NormalImage}"            Source="Images/Home.jpg" />  </Button>  <Button Name="btnLog"          ToolTipService.ToolTip="Logs"          Style="{StaticResource NormalButton}">    <Image Style="{StaticResource NormalImage}"            Source="Images/Log.jpg" />  </Button></StackPanel> You will also need to add the following XAML to the User Control’s Resources section. <Style TargetType="Image"        x:Key="NormalImage">  <Setter Property="Width"          Value="50" /></Style> Add Multiple Controls to Content Now, since the Content can be whatever we want, you could also modify the Content of each button to be a StackPanel control. Then you can have an image and text within the button. <StackPanel>  <Button Name="btnHome"          ToolTipService.ToolTip="Home"          Style="{StaticResource NormalButton}">    <StackPanel>      <Image Style="{StaticResource NormalImage}"              Source="Images/Home.jpg" />      <TextBlock Text="Home"                  Style="{StaticResource NormalTextBlock}" />    </StackPanel>  </Button>  <Button Name="btnLog"          ToolTipService.ToolTip="Logs"          Style="{StaticResource NormalButton}">    <StackPanel>      <Image Style="{StaticResource NormalImage}"              Source="Images/Log.jpg" />      <TextBlock Text="Logs"                  Style="{StaticResource NormalTextBlock}" />    </StackPanel>  </Button></StackPanel> You will need to add one more resource for the TextBlock control too. <Style TargetType="TextBlock"        x:Key="NormalTextBlock">  <Setter Property="HorizontalAlignment"          Value="Center" /></Style> All of the above will now produce the following:   Figure 4: Add multiple controls to the content to make your buttons even more interesting. Summary While this is a simple example, you can see how XAML Content has great flexibility. You could add a MediaElement control as the content of a Button and play a video within the Button. Not that you would necessarily do this, but it does work. What is nice about adding different content within the Button control is you still get the Click event and other attributes of a button, but it does necessarily look like a normal button. Good Luck with your Coding,Paul Sheriff ** SPECIAL OFFER FOR MY BLOG READERS **Visit http://www.pdsa.com/Event/Blog for a free video on Silverlight entitled "Silverlight XAML for the Complete Novice - Part 1."

    Read the article

  • How to "translate" interdependent object states in code?

    - by Earl Grey
    I have the following problem. My UI interace contains several buttons, labels, and other visual information. I am able to describe every possible workflow scenario that should be be allowed on that UI. That means I can describe it like this - when button A is pressed, the following should follow - In the case of that A button, there are three independent factors that influence the possible result when pushing the A button. The state of the session (blank, single, multi, multi special), the actual work that is being done by the system at the moment of pressing the A button (nothing was happening, work was being done, work was paused) and a separate UI element that has two states (on , off)..This gives me a 3 dimensional cube with 24 possible outcomes. I could write code for this using if cycles, switch cycles etc....but the problem is, I have another 7 buttons on that ui, I can enter this UI from different states..some buttons change the state, some change parameters... To sum up, the combinations are mindbogling and I am not able come up with a methodology that scales and is systematically reliable. I am able to describe EVERY workflow with words, I am sure my description is complete and without logical errors. But I am not able to translate that into code. I was trying to draw flowcharts but it soon became visually too complicated due to too many if "emafors". Can you advice how to proceeed?

    Read the article

  • Brightness going up to 100% on loading certain websites in Chrome

    - by picheto
    I'm using Google Chrome version 21.0.1180.89 on Ubuntu 12.04 and my laptop is a Sony VAIO VPCCW15FL (spec sheet). My video driver is the propietary "NVIDIA accelerated graphics driver (post-release updates)(version-current updates)". After installing Ubuntu, I discovered that neither the brightness control buttons (hardware) or the brightness slider (software) worked, and found out I could get the hardware buttons to work by installing the nvidiabl.deb package and oBacklight script. I'm using nvidiabl-dkms 0.77 and oBacklight 0.3.8. Still, the slider on the Ubuntu "Settings" does not work, but I don't care. There is an annoying thing happening when loading certain pages in Google Chrome: the brightness goes up to 100% when loading the webpage or when leaving it (closing the tab or typing a different URL on the omnibox). However, the "brightness tooltip" (that default brightness notification) remembers the position it was set to, so if I adjust the brightness with the HW buttons, the level gets adjusted relative to the value it was set to before "going 100%". I disabled the flash PPAPI plugin, but left the NPAPI plugin enabled, and the problem went away for pages with flash content. Still, the same thing happens when viewing HTML5 video, or when loading, for example, the Chrome Web Store or using the Scratchpad extension. I suppose it has to do with the rendering of certain elements using the GPU, but this is just a guess. This brightness thing does not happen when using Firefox 15.0 or any other application I have used yet. Does anybody know why this may be happening and what could I do to fix this without changing browser? Thanks a lot.

    Read the article

  • Unity3D : Pause Menu - Android

    - by user3666251
    Im making a 2D game for android.I almost completed the game but now I need a pause game option.I added a pause icon on the top right side of the screen.The icon is a gui texture.Here is what I did so far : I made a script which will bring up some buttons (which is not working) and attached it to the GUITexture.This is the script : #pragma strict function OnMouseDown() { Debug.Log("*Pause Menu Opens*"); Time.timeScale = 0; if (GUI.Button(Rect(10,10,100,50),"Restart")); Application.LoadLevel(Application.loadedLevel); if (GUI.Button(Rect(10,60,100,50),"MainMenu")); Application.LoadLevel("MainMenu"); } Now,the problem stands at the part where the buttons won't show up,the game freezes at the first frame but the buttons won't show up.Please,if you can help I would be realy thankful. Thank you. Edit #1 : I just noticed that when I click "Pause" the game freezes and it takes me to the MainMenu.That's because I added the GUIButton which takes you to the main menu.I think the whole script structure is wrong.I also forgot to mention that Im new in scripting/unity. Thank you.

    Read the article

  • Flash AS3 button eventlistener array bug

    - by Tyler Pepper
    Hi there, this is my first time posting a question here. I have an array of 12 buttons on a timeline that when first visiting that part of the timeline, get a CLICK eventlistener added to them using a for loop. All of them work perfectly at that point. When you click one it plays a frame label inside the specific movieClip and reveals a bio on the corresponding person with a close button and removes the CLICK eventlisteners for each button, again using a for loop. The close button plays a closing animation, and then the timeline goes back to the first frame (the one with the 12 buttons on it) and the CLICK eventlisteners are re-added, but now only the first 9 buttons of the array work. There are no output errors and the code to re-add the eventlisteners is exactly the same as the first time that works. I am completely at a loss and am wondering if anyone else has run into this problem. All of my buttons are named correctly, there are absolutely no output errors (I've used the debug module) and I made sure the array with the buttons in it is outputting all 12 at the moment the close button is clicked to add the eventlisteners back. for (var q = 0; q < ackBoDBtnArray.length; q++){ contentArea_mc.acknowledgements_mc.BoD_mc[ackBoDBtnArray[q]].addEventListener(MouseEvent.CLICK, showBio); } private function showBio(eo:MouseEvent):void { trace("show the bio"); bodVar = ackBoDBtnArray.getIndex(eo.target.name); contentArea_mc.acknowledgements_mc.BoD_mc.gotoAndPlay(ackBoDPgArray[bodVar]); contentArea_mc.acknowledgements_mc.BoD_mc.closeBio_btn.addEventListener(MouseEvent.CLICK, hideBio); for (var r = 0; r < ackBoDBtnArray.length; r++){ contentArea_mc.acknowledgements_mc.BoD_mc[ackBoDBtnArray[r]].mouseEnabled = false; contentArea_mc.acknowledgements_mc.BoD_mc[ackBoDBtnArray[r]].removeEventListener(MouseEvent.CLICK, showBio); } } private function hideBio(eo:MouseEvent):void { trace("hide it!"); contentArea_mc.acknowledgements_mc.BoD_mc.closeBio_btn.removeEventListener(MouseEvent.CLICK, hideBio); contentArea_mc.acknowledgements_mc.BoD_mc.gotoAndPlay(ackBoDClosePgArray[bodVar]); for (var s = 0; s < ackBoDBtnArray.length; s++){ trace(ackBoDBtnArray[s]); contentArea_mc.acknowledgements_mc.BoD_mc[ackBoDBtnArray[s]].mouseEnabled = true; contentArea_mc.acknowledgements_mc.BoD_mc[ackBoDBtnArray[s]].addEventListener(MouseEvent.CLICK, showBio); } Thanks in advance for any help and insight you can provide...I have a slight feeling that its something that may be obvious to another set of eyes...haha.

    Read the article

  • PyGTK: Radiobuttons are still displayed after removal

    - by canavanin
    Hi everyone! I am using PyGTK and the gtk.assistant. On one page I would like to display two radiobuttons in case the user selected a certain option on a previous page. The labels of the buttons - and whether the buttons are to be present at all - are to depend entirely on that earlier selection. Furthermore, if the user goes back and changes that selection, the page containing the radiobuttons is to be updated accordingly. I have got as far as having the radiobuttons displayed when necessary, and with the correct labels. The trouble is that if I go back and change the determining selection, or if I move one page further than the 'radiobutton page' and then move back, the buttons are not only not removed (in case that would have been required), their number has also doubled. To show you what I'm doing, here's part of my code (I've left out bits that do unrelated things, that's why the function name doesn't fit). The function is called when the "prepare" signal is emitted prior to construction of the 'radiobutten page'. def make_class_skills_treestore(self): print self.trained_by_default_hbox.get_children() # PRINT 1 for child in self.trained_by_default_hbox.get_children(): if type(child) == gtk.RadioButton: self.trained_by_default_hbox.remove(child) #child.destroy() # <-- removed the labels, but not the buttons print self.trained_by_default_hbox.get_children() # PRINT 2 class_skills = self.data.data['classes'][selected_class].class_skills.values() default_trained_count = (class_skills.count([True, True]) , class_skills.count([True, False])) num_default_trained_skills = default_trained_count[1] / 2 # you have to pick one of a pair --> don't # count each as trained by default for i in range(default_trained_count[0]): # those are trained by default --> no choice num_default_trained_skills +=1 selected_class = self.get_classes_key_from_class_selection() if default_trained_count[1]: for skill in self.data.data['classes'][selected_class].class_skills.keys(): if self.data.data['classes'][selected_class].class_skills[skill] == [ True, False ] and not self.default_radio: self.default_radio.append(gtk.RadioButton(group=None, label=skill)) elif self.data.data['classes'][selected_class].class_skills[skill] == [ True, False ] and self.default_radio: self.default_radio.append(gtk.RadioButton(group=self.default_radio[0], label=skill)) if self.default_radio: for radio in self.default_radio: self.trained_by_default_hbox.add(radio) self.trained_by_default_hbox.show_all() self.trained_by_default_hbox and self.trained_by_default_label, as well as self.default_radio stem from the above function's class. I have two print statements (PRINT 1 and PRINT 2) in there for debugging. Here's what they give me: PRINT 1: [<gtk.Label object at 0x8fc4c84 (GtkLabel at 0x90a2f20)>, <gtk.RadioButton object at 0x8fc4d4c (GtkRadioButton at 0x90e4018)>, <gtk.RadioButton object at 0x8fc4cac (GtkRadioButton at 0x90ceec0)>] PRINT 2: [<gtk.Label object at 0x8fc4c84 (GtkLabel at 0x90a2f20)>] So the buttons have indeed been removed, yet they still show up on the page. I know the code requires some refactoring, but first I'd like to get it to work at all... If someone could help me out that would be great! Thanks a lot in advance for your replies - any kind of help is highly appreciated.

    Read the article

  • java nested for() loop throws ArrayIndexOutOfBoundsException

    - by Mike
    I'm working through a JPanel exercise in a Java book. I'm tasked with creating a 5x4 grid using GridLayout. When I loop through the container to add panels and buttons, the first add() throws the OOB exception. What am I doing wrong? package mineField; import java.awt.*; import javax.swing.*; @SuppressWarnings("serial") public class MineField extends JFrame { private final int WIDTH = 250; private final int HEIGHT = 120; private final int MAX_ROWS = 5; private final int MAX_COLUMNS = 4; public MineField() { super("Minefield"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Container mineFieldGrid = getContentPane(); mineFieldGrid.setLayout(new GridLayout(MAX_ROWS, MAX_COLUMNS)); // loop through arrays, add panels, then add buttons to panels. for (int i = 0; i < MAX_ROWS; i++) { JPanel[] rows = new JPanel[i]; mineFieldGrid.add(rows[i], rows[i].getName()); rows[i].setBackground(Color.blue); for (int j = 0; j < MAX_COLUMNS; j++) { JButton[] buttons = new JButton[i]; rows[i].add(buttons[j], buttons[j].getName()); } } mineFieldGrid.setSize(WIDTH, HEIGHT); mineFieldGrid.setVisible(true); } public int setRandomBomb(Container con) { int bombID; bombID = (int) (Math.random() * con.getComponentCount()); return bombID; } /** * @param args */ public static void main(String[] args) { //int randomBomb; //JButton bombLocation; MineField minePanel = new MineField(); //minePanel[randomBomb] = minePanel.setRandomBomb(minePanel); } } I'm sure I'm over-engineering a simple nested for loop. Since I'm new to Java, please be kind. I'm sure I'll return the favor some day.

    Read the article

  • GameStateManagement and inputs not being recognized

    - by Dave Voyles
    EDIT: I've removed a bit of code from the input class to make this more readable, and updated my StartScreen class, which is now at the bottom. I have the same issues though, but they are explained in my comments on the bottom of this page. It won't let me paste my additional code here (the format comes out crazy), so I've linked to pastebin with the code pastebin I've been trying to implement the MS provided GameStateManagement sample with my game, but it has proven a bit difficult. Really, I'm using Oneksoft's Starter Kit, which uses the MS provided sample, so they are identical, except for my splash screen. I'm able to get the splash screen to launch, where it informs the player to press A to advance the screen, but this doesn't seem to accept any of my inputs. I’ve also added Console.Writeline(“Pressing A”) under the IsMenuPressed method in Input.cs to verify that it is getting called, but for some reason it is constantly spamming my log, rather than just appearing each time I press it. Not sure why this is happening. I have a bit too much code to post it all here, so I’ve attached a link to my .rar with my classes, but I’ll also leave a bit here which I thinkmay be applicable. https://www.dropbox.com/sh/6ek4uru2jc2ch0k/JTeBWN_3PQ What do you guys think the issue is? namespace Pong { public class Input { public const int MaxInputs = 4; public readonly KeyboardState[] CurrentKeyboardState; public readonly GamePadState[] CurrentGamePadState; public KeyboardState[] LastKeyboardState; public GamePadState[] LastGamePadState; public readonly bool[] GamePadWasConnected; public Input() { // Get input state CurrentKeyboardState = new KeyboardState[MaxInputs]; CurrentGamePadState = new GamePadState[MaxInputs]; // Preserving last states to check for isKeyUp events LastKeyboardState = CurrentKeyboardState; LastGamePadState = CurrentGamePadState; } /// <summary> /// Checks for a "menu select" input action. /// The controllingPlayer parameter specifies which player to read input for. /// If this is null, it will accept input from any player. When the action /// is detected, the output playerIndex reports which player pressed it. /// </summary> public bool IsMenuSelect(PlayerIndex? controllingPlayer, out PlayerIndex playerIndex) { Console.WriteLine("Pressing A"); return IsNewKeyPress(Keys.Space, controllingPlayer, out playerIndex) || IsNewKeyPress(Keys.Enter, controllingPlayer, out playerIndex) || IsNewButtonPress(Buttons.A, controllingPlayer, out playerIndex) || IsNewButtonPress(Buttons.Start, controllingPlayer, out playerIndex); } /// <summary> /// Checks for a "menu cancel" input action. /// The controllingPlayer parameter specifies which player to read input for. /// If this is null, it will accept input from any player. When the action /// is detected, the output playerIndex reports which player pressed it. /// </summary> public bool IsMenuCancel(PlayerIndex? controllingPlayer, out PlayerIndex playerIndex) { return IsNewKeyPress(Keys.Escape, controllingPlayer, out playerIndex) || IsNewButtonPress(Buttons.B, controllingPlayer, out playerIndex) || IsNewButtonPress(Buttons.Back, controllingPlayer, out playerIndex); }

    Read the article

  • iPhone UIScrollview with UIButtons - how to recreate springboard?

    - by Patrick
    I'm trying to create a springboard-like interface within my app. I'm trying to use UIButtons added to a UIScrollView. The problem I'm running in to is with the buttons not passing any touches to the UIScrollView - if I try to flick/slide and happen to press on the button it doesn't register for the UIScrollView, but if I flick the space between buttons it will work. The buttons do click/work if I touch them. Is there a property or setting that forces the button to send the touch events up to its parent (superview)? Do the buttons need to be added to something else before being added the UIScrollView? Here is my code: //init scrolling area UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 480, 480)]; scrollView.contentSize = CGSizeMake(480, 1000); scrollView.bounces = NO; scrollView.delaysContentTouches = NO; //create background image UIImageView *rowsBackground = [[UIImageView alloc] initWithImage:[self scaleAndRotateImage:[UIImage imageNamed:@"mylongbackground.png"]]]; rowsBackground.userInteractionEnabled = YES; //create button UIButton *btn = [[UIButton buttonWithType:UIButtonTypeCustom] retain]; btn.frame = CGRectMake(100, 850, 150, 150); btn.bounds = CGRectMake(0, 0, 150.0, 150.0); [btn setImage:[self scaleAndRotateImage:[UIImage imageNamed:@"basicbutton.png"]] forState:UIControlStateNormal]; [btn addTarget:self action:@selector(buttonClick) forControlEvents:UIControlEventTouchUpInside]; //add "stuff" to scrolling area [scrollView addSubview:rowsBackground]; [scrollView addSubview:btn]; //add scrolling area to cocos2d //this is just a UIWindow [[[Director sharedDirector] openGLView] addSubview:scrollView]; //mem-mgmt [rowsBackground release]; [btn release]; [scrollView release];

    Read the article

  • How to create a UIScrollView Programmatically?

    - by Wayfarer
    Alright, so the key here is I'm not using IB at all, because the View I'm working with is created programmatically. The UIView covers the lower half the screen, and has a bunch of buttons on it. However, I want to add more buttons to the UIView, without making it any larger. To do so, I want to make a UIScrollView inside the view, which will allow me to add more buttons off screen so the user can scroll to them. I think that's how it works. self.manaView = [[[UIView alloc] initWithFrame:frame] autorelease]; self.manaView.backgroundColor = [UIColor purpleColor]; UIScrollView *scroll = [UIScrollView alloc]; scroll.contentSize = CGSizeMake(320, 400); scroll.showsHorizontalScrollIndicator = YES; [self.manaView addSubview:scroll]; The first part of the code iniates my UIView, which works great, but I can't figure out how to make the UIScrollView programmatically and add it to the view, and then add the buttons to it. UIButton *ret2 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; ret2.tag = 102; ret2.frame = CGRectMake(255, 5, 60, 50); [ret2 setTitle:@"Return" forState:UIControlStateNormal]; [ret2 addTarget:self action:@selector(flipAction:) forControlEvents:UIControlEventTouchUpInside]; [scroll addSubview:ret2]; When I did that, the button simply disappeared off my screen. So How do I do this correctly? Thank you for your help!

    Read the article

  • [WPF] How to register to/listen to richtextbox command's?

    - by Liewe
    I'm creating a simple editor within our application using the WPF RichTextBox. Above it I've added the reguslar buttons like Bold, Italic, etc. These buttons use the RichTextBox's commands to set these properties, but next to these buttons, the commands also get send with CTRL+B, CTRL+I, etc. I want these buttons to represent the current state of the RichTextBox at the cursor. I already found out how to get this state and it works when I update this state on the SelectionChanged event. This event ofcourse isn't fired when Bold is toggled so there is no direct feedback. I would like to know if there is a way to listen to the commands being called, without affecting its original behaviour or some other ideas to solve my problems. I tried listening to the command the following way: CommandBinding boldBinding = new CommandBinding(EditingCommands.ToggleBold, CommandExecuted); _richTextBox.CommandBindings.Add(boldBinding); and private void CommandExecuted(object sender, ExecutedRoutedEventArgs e) { UpdateProperties(); e.Handled = false; } This did update the properties, but the RichTextBox didn't seem to receive the command anymore. I also tried to make my own commands on the control containing the RichTextBox, but when CTRL+B is pressed when the RichTextBox has focus, the original RichTextBox commands are called instead of the new one. Many thanks in advance! Liewe

    Read the article

  • [WPF] How to register to/listen to richtextbox commando's?

    - by Liewe
    I'm creating a simple editor within our application using the WPF RichTextBox. Above it I've added the reguslar buttons like Bold, Italic, etc. These buttons use the RichTextBox's commands to set these properties, but next to these buttons, the commands also get send with CTRL+B, CTRL+I, etc. I want these buttons to represent the current state of the RichTextBox at the cursor. I already found out how to get this state and it works when I update this state on the SelectionChanged event. This event ofcourse isn't fired when Bold is toggled so there is no direct feedback. I would like to know if there is a way to listen to the commands being called, without affecting its original behaviour or some other ideas to solve my problems. I tried listening to the command the following way: CommandBinding boldBinding = new CommandBinding(EditingCommands.ToggleBold, CommandExecuted); _richTextBox.CommandBindings.Add(boldBinding); and private void CommandExecuted(object sender, ExecutedRoutedEventArgs e) { UpdateProperties(); e.Handled = false; } This did update the properties, but the RichTextBox didn't seem to receive the command anymore. I also tried to make my own commands on the control containing the RichTextBox, but when CTRL+B is pressed when the RichTextBox has focus, the original RichTextBox commands are called instead of the new one. Many thanks in advance! Liewe

    Read the article

  • Android:Multi touch doesn't work as expected?

    - by user187532
    Hi folks, Help me in resolving the below issue. I have three image buttons on screen. All these three buttons controlled under ontouchlistner as below. buttonOne.setOnTouchListener(this); buttonTwo.setOnTouchListener(this); buttonThree.setOnTouchListener(this); I override "public boolean onTouch(View v, MotionEvent event)". Under this i check for these three image buttons touch events like below. ImageButton imageBtn = (ImageButton) v; if ( imageBtn == buttonOne ) // first button touch ..Log.. else if ( imageBtn == buttonTwo ) ..Log.. else if ( imageBtn == buttonThree ) // first button touch ..Log.. My problem is, as it is under multi touch event handler like above, it does not detect when touch all three button at a time to try to produce multi touch effect, instead it detects only one imagebutton touch at a time even though i touch all three image buttons. As i am developing this project on Android 1.6 SDK, is there any problem accessing my requirement(multi touch) (or) it is a known issue? I am hoping that, when it works for single button touch, why shouldn't it work when clicking three imagebuttons at a time to produce three logs printed as per my above code? How do i resolve it for my case? Please don't question me why i am still developing on 1.6 for such a requirement. Thank you. Appreciate your suggestions !

    Read the article

  • Flash CS5- Problem with "navigateToURL" in web-browswer hosted on MySpace

    - by NervXT
    I made a quick flash document for my friend who posted it his MySpace. The document has 3 buttons, each with a URL attached to them. When I play the SWF file locally, the links work fine, however once it's published to MySpace, the links refuse to work. The hand icon comes up so it understands them at least as buttons, but it seems to do nothing when clicked in the web-browser. Also, I can open the SWF in my browser and it also works fine. I'm using Flash CS5 and working in ActionScript 3.0. The three buttons are on one layer called "Buttons". I right click the button and click "Actions". From there, I click the "Code Snippets" and under the folder "Actions" there is an item called "Click to Go To Webpage". Here is the code it gives you by default: button_2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage_6); function fl_ClickToGoToWebPage_6(event:MouseEvent):void { navigateToURL(new URLRequest("http://www.adobe.com"), "_blank"); } I heard there was a problem with MySpace not allowing action scripts, but after checking the source code of the web-page, the values in the "param" code seem to "always" allow action scripts. At any point, I'm lost and not sure what it causing this. I don't think it's a browser issue, since it's working fine when I execute the SWF by itself, and when I load it into Firefox. It's just seems MySpace is having a problem with it. Any advice is appreciated.

    Read the article

  • How to highlight the button untill the next view is changed in iphone?

    - by Pugal Devan
    Hi, I am new to iphone development. I have created five buttons in the view controller. If i clicked the button it goes to the corresponding view. Now i want to display the button in highlighted state when it is clicked. It should go back to the normal state only when i click the other button.(See the image below). I have set the another image for highigthting buttons when i clicked it, but it shows that highlighted state only one sec. Now i want to display the buttons highlighted till another button is clicked. Same like a Tabbar operations.(I have used buttons instead of tabbar for my requirements). Now i have used the following code, void didLoad { [btn1 setImage:[UIImage imageNamed:@"ContentColor.png"] forState:UIControlStateHighlighted]; [btn2 setImage:[UIImage imageNamed:@"bColor.png"] forState:UIControlStateHighlighted]; [btn3 setImage:[UIImage imageNamed:@"ShColor.png"] forState:UIControlStateHighlighted]; [btn4 setImage:[UIImage imageNamed:@"PicturesColor.png"] forState:UIControlStateHighlighted]; [btn5 setImage:[UIImage imageNamed:@"infoColor.png"] forState:UIControlStateHighlighted]; } Please help me out. Thanks.

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >