Search Results

Search found 265 results on 11 pages for 'stacks'.

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

  • Applications of concurrent queues and stacks in .NET 4

    - by Jon Harrop
    .NET 4 includes new concurrent data structures. The Bag and Dictionary collections have obvious applications but I cannot see any use for the Queue and Stack data structures. What are people using these for? Also, I've noticed that the design based upon linked lists incurs a lot of allocation and that destroys scalability. This is surprising given that the sole purpose of these collections is multicore programming. Is this an inherent limitation or are they just badly implemented?

    Read the article

  • quick java question

    - by mark
    hi, im currently learning stacks in java and have a quick question. what will the following code display if the stack is empty? my guess would be "true"? System.out.println(st.isEmpty());

    Read the article

  • Add every value in stack

    - by rezivor
    I am trying to figure out a method that will add every value in a stack. The goal is to use that value to determine if all the values in the stack are even. I have written to code to do this template <class Object> bool Stack<Object>::objectIsEven( Object value ) const { bool answer = false; if (value % 2 == 0) answer = true; return( answer ); } However, I am stumped on how to add all of the stack's values in a separate method

    Read the article

  • Threading heap and stack

    - by DJ
    How memory is allocated in case of spawning a new thread, i.e how memory heap, memory stack, and threads are related? I know this is fundamental (.net framework concept) but somehow I am not much aware of this concept.

    Read the article

  • Is it time to drop Courier from your monospace font stacks?

    - by Jeff
    I've been fine-tuning my font stacks lately and was wondering if it's safe to drop Courier from my monospace font stack yet? Would you feel comfortable dropping it? Of course, monospace is my final fallback. Note 1: OS Testbed: WinXP, WinVista, Win7, iPhone, iPad Based on my research, these browsers now substitute Courier New for Courier by default: IE9+ Chrome 2+ Firefox 10+ Safari 3.1+ iDevices Note 2: The default "font-family: monospace;" renders as Courier New in every browser I've tested, from IE6 through the latest iPhone/iPad devices. EDIT: One exception is Opera 12, which renders Consolas on Win. Opera 10 renders Courier New. Note 3: I've noticed that Courier refuses to render with any font smoothing (anti-aliasing) in any browser I've tested, regardless of system and/or browser display settings. Probably because it's an old bitmap font. This could be because of my system setup, however.

    Read the article

  • How to prepare for a programming competition? Graphs, Stacks, Trees, oh my! [closed]

    - by Simucal
    Last semester I attended ACM's (Association for Computing Machinery) bi-annual programming competition at a local University. My University sent 2 teams of 3 people and we competed amongst other schools in the mid-west. We got our butts kicked. You are given a packet with about 11 problems (1 problem per page) and you have 4 hours to solve as many as you can. They'll run your program you submit against a set of data and your output must match theirs exactly. In fact, the judging is automated for the most part. In any case.. I went there fairly confident in my programming skills and I left there feeling drained and weak. It was a terribly humbling experience. In 4 hours my team of 3 people completed only one of the problems. The top team completed 4 of them and took 1st place. The problems they asked were like no problems I have ever had to answer before. I later learned that in order to solve them some of them effectively you have to use graphs/graph algorithms, trees, stacks. Some of them were simply "greedy" algo's. My question is, how can I better prepare for this semesters programming competition so I don't leave there feeling like a complete moron? What tips do you have for me to be able to answer these problems that involve graphs, trees, various "well known" algorithms? How can I easily identify the algorithm we should implement for a given problem? I have yet to take Algorithm Design in school so I just feel a little out of my element. Here are some examples of the questions asked at the competitions: ACM Problem Sets Update: Just wanted to update this since the latest competition is over. My team placed 1st for our small region (about 6-7 universities with between 1-5 teams each school) and ~15th for the midwest! So, it is a marked improvement over last years performance for sure. We also had no graduate students on our team and after reviewing the rules we found out that many teams had several! So, that would be a pretty big advantage in my own opinion. Problems this semester ranged from about 1-2 "easy" problems (ie bit manipulation, string manipulation) to hard (graph problems involving fairly complex math and network flow problems). We were able to solve 4 problems in our 5 hours. Just wanted to thank everyone for the resources they provided here, we used them for our weekly team practices and it definitely helped! Some quick tips that I have that aren't suggested below: When you are seated at your computer before the competition starts, quickly type out various data structures that you might need that you won't have access to in your languages libraries. I typed out a Graph data-structure complete with floyd-warshall and dijkstra's algorithm before the competition began. We ended up using it in our 2nd problem that we solved and this is the main reason why we solved this problem before anyone else in the midwest. We had it ready to go from the beginning. Similarly, type out the code to read in a file since this will be required for every problem. Save this answer "template" someplace so you can quickly copy/paste it to your IDE at the beginning of each problem. There are no rules on programming anything before the competition starts so get any boilerplate code out the way. We found it useful to have one person who is on permanent whiteboard duty. This is usually the person who is best at math and at working out solutions to get a head start on future problems you will be doing. One person is on permanent programming duty. Your fastest/most skilled "programmer" (most familiar with the language). This will save debugging time also. The last person has several roles between assessing the packet of problems for the next "easiest" problem, helping the person on the whiteboard work out solutions and helping the person programming work out bugs/issues. This person needs to be flexible and be able to switch between roles easily.

    Read the article

  • How to implement three stacks using a single array.

    - by buried-shopno
    Hi, I came across this problem in an interview website. The problem asks for efficiently implement three stacks in a single array, such that no stack overflows until there is no space left in the entire array space. For implementing 2 stacks in an array, it's pretty obvious: 1st stack grows from LEFT to RIGHT, and 2nd stack grows from RIGHT to LEFT; and when the stackTopIndex crosses, it signals an overflow. Thanks in advance for your insightful answer.

    Read the article

  • Could it be more efficient for systems in general to do away with Stacks and just use Heap for memory management?

    - by Dark Templar
    It seems to me that everything that can be done with a stack can be done with the heap, but not everything that can be done with the heap can be done with the stack. Is that correct? Then for simplicity's sake, and even if we do lose a little amount of performance with certain workloads, couldn't it be better to just go with one standard (ie, the heap)? Think of the trade-off between modularity and performance. I know that isn't the best way to describe this scenario, but in general it seems that simplicity of understanding and design could be a better option even if there is a potential for better performance.

    Read the article

  • Buyers question: Have intel AES-NI already been integrated in IPSEC stacks?

    - by deploymonkey
    Dear serverfault, I need to decide between deploying Opteron 6100 and Xeon Westmere EP, so I regard this a platform question. If not, it may be moved to stackoverflow and I hereby declare that I am very sorry. Do any (F)OSS or proprietory IPSEC stacks already use the AES-NI functions of the Westmere-EP? Thanks a bundle! ps. If anyone would like to create the tag AES-NI, You're welcome. I couldn't due to lack of rep.

    Read the article

  • Parallel Debugging

    Using Visual Studio 2010 parallel debugging is easy. Two new debugging windows provide a total view of the internals of your PPL and TPL applications with hints on where to start investigations. These are not mere extensions to VS, but tightly integrated with the rest of the debugger experience, so you don't need to learn many new techniques. Use them in your program to eclipse bugs from existence!One of the most FAQ I receive is links to VS2010 parallel debugging content and rather than keep sending many, I decided to gather them all under one permalink, hence this multi link blog post.- MSDN Magazine article on Parallel Debugging.- Screencast of sample code from the article.- MSDN Walkthrough: Debugging a Parallel Application (VB, C++, C#).- Screencast of walkthrough for Parallel Stacks.- Screencast of walkthrough for Parallel Tasks.- MSDN "How To" on Parallel Tasks.- MSDN "How To" on Parallel Stacks.- Detailed blog post on Parallel Tasks.- Detailed blog post on Parallel Stacks.- Detailed blog post on Parallel Stacks - Tasks View.- Detailed blog post on Parallel Stacks - Method View.- Download slides on Parallel Tasks and Parallel Stacks (pptx).If you have questions on these, please post to any of the parallel computing forums or the debugging forum (your question will be routed to me if nobody else can answer it). Comments about this post welcome at the original blog.

    Read the article

  • Exhaustive (or even just large) list of languages/stacks used for popular sites?

    - by jacko
    As a result of a conversation with a colleague today, I've been searching (unsuccessfully) for a large'ish list of what technology stacks are being used popular websites and standalone applications today. We're aware of the big ones like Facebook (php/ ), Twitter (scala/cassandra), Youtube (python/?), Digg (php/cassandra), stackoverflow (.net mvc/sqlserver), but we're looking for a more complete list. It would also be interesting to hear about any stats for desktop apps also? Can anyone help?

    Read the article

  • Getting null value after adding objects to customClass

    - by Brian Stacks
    Ok here's my code first viewController.h @interface ViewController : UIViewController<UICollectionViewDataSource,UICollectionViewDelegate> { NSMutableArray *twitterObjects; } @property (strong, nonatomic) IBOutlet UICollectionView *myCollectionView; Here is my viewController.m // // ViewController.m // MDF2p2 // // Created by Brian Stacks on 6/5/14. // Copyright (c) 2014 Brian Stacks. All rights reserved. // #import "ViewController.h" // add accounts framework to code #import <Accounts/Accounts.h> // add social frameworks #import <Social/Social.h> #import "TwitterCustomObject.h" #import "CustomCell.h" #import "DetailViewController.h" @interface ViewController () @end @implementation ViewController -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { //CustomCell * cell = (CustomCell*)sender; //NSIndexPath *indexPath = [_myCollectionView indexPathForCell:cell]; // setting an id for view controller DetailViewController *detailViewcontroller = segue.destinationViewController; //TwitterCustomObject *newCustomClass = [twitterObjects objectAtIndex:indexPath.row]; if (detailViewcontroller != nil) { // setting the custom customClass object //detailViewcontroller.myNewCurrentClass = newCustomClass; } } - (void)viewDidLoad { twitterObjects = [[NSMutableArray alloc]init]; [super viewDidLoad]; [self twitterAPIcall]; // Do any additional setup after loading the view, typically from a nib. } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return 100; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { //UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"myCell" forIndexPath:indexPath]; // initiate celli CustomCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"myCell" forIndexPath:indexPath]; // add objects to cell if (cell != nil) { //TwitterCustomObject *newCustomClass = [twitterObjects objectAtIndex:indexPath.row]; //[cell refreshCell:newCustomClass.userName userImage:newCustomClass.userImage]; [cell refreshCell:@"Brian" userImage:[UIImage imageNamed:@"love.jpg"]]; } return cell; } -(void)twitterAPIcall { //create an instance of the account store from account frameworks ACAccountStore *accountStore = [[ACAccountStore alloc]init]; // make sure we have a valid object if (accountStore != nil) { // get the account type ex: Twitter, FAcebook info ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; // make sure we have a valid object if (accountType != nil) { // give access to the account iformation [accountStore requestAccessToAccountsWithType:accountType options:nil completion:^(BOOL granted, NSError *error) { if (granted) { //^^^success user gave access to account information // get the info of accounts NSArray *twitterAccounts = [accountStore accountsWithAccountType:accountType]; // make sure we have a valid object if (twitterAccounts != nil) { //NSLog(@"Accounts: %@",twitterAccounts); // get the current account information ACAccount *currentAccount = [twitterAccounts objectAtIndex:0]; // make sure we have a valid object if (currentAccount != nil) { //string from twitter api NSString *requestString = @"https://api.twitter.com/1.1/friends/list.json"; // request the data from the request screen call SLRequest *myRequest = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:[NSURL URLWithString:requestString] parameters:nil]; // must authenticate request [myRequest setAccount:currentAccount]; // perform the request named myRequest [myRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { // check to make sure there are no errors and we have a good http:request of 200 if ((error == nil) && ([urlResponse statusCode] == 200)) { // make array of dictionaries from the twitter api data using NSJSONSerialization NSArray *twitterFeed = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:nil]; NSMutableArray *nameArray = [twitterFeed valueForKeyPath:@"users"]; // for loop that loops through all the post for (NSInteger i =0; i<[twitterFeed count]; i++) { NSString *nameString = [nameArray valueForKeyPath:@"name"]; NSString *imageString = [nameArray valueForKeyPath:@"profile_image_url"]; NSLog(@"Name feed: %@",nameString); NSLog(@"Image feed: %@",imageString); // get data into my mutable array TwitterCustomObject *twitterInfo = [self createPostFromArray:[nameArray objectAtIndex:i]]; //NSLog(@"Image feed: %@",twitterInfo); if (twitterInfo != nil) { [twitterObjects addObject:twitterInfo]; } } } }]; } } } else { // the user didn't give access UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"This app will only work with twitter accounts being allowed!." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; [alert performSelectorOnMainThread:@selector(show) withObject:nil waitUntilDone:FALSE]; } }]; } } } -(TwitterCustomObject*)createPostFromArray:(NSArray*)postArray { // create strings to catch the data in NSArray *userArray = [postArray valueForKeyPath:@"users"]; NSString *myUserName = [userArray valueForKeyPath:@"name"]; NSString *twitImageURL = [userArray valueForKeyPath:@"profile_image_url"]; UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:twitImageURL]]]; // initiate object to put the data in TwitterCustomObject *twitterData = [[TwitterCustomObject alloc]initWithPostInfo:myUserName myImage:image]; NSLog(@"Name: %@",myUserName); return twitterData; } -(IBAction)done:(UIStoryboardSegue*)segue { } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end Here is my customObject class TwitterCustomClass.h // // TwitterCustomObject.h // MDF2p2 // // Created by Brian Stacks on 6/5/14. // Copyright (c) 2014 Brian Stacks. All rights reserved. // #import <Foundation/Foundation.h> @interface TwitterCustomObject : NSObject { } @property (nonatomic, readonly) NSString *userName; @property (nonatomic, readonly) UIImage *userImage; -(id)initWithPostInfo:(NSString*)screenName myImage:(UIImage*)myImage; @end TwitterCustomClass.m // // TwitterCustomObject.m // MDF2p2 // // Created by Brian Stacks on 6/5/14. // Copyright (c) 2014 Brian Stacks. All rights reserved. // #import "TwitterCustomObject.h" @implementation TwitterCustomObject -(id)initWithPostInfo:(NSString*)screenName myImage:(UIImage*)myImage { // initialize as object if (self = [super init]) { // use the data to be passed back and forth to the tableview _userName = [screenName copy]; _userImage = [myImage copy]; } return self; } @end The problem is I get the values in the method twitterAPIcall, I can get the names and image values or strings from the values. But in the (TwitterCustomObject*)createPostFromArray:(NSArray*)postArray method all values are coming up as null.I thought it got added with this line of code in the twitterAPIcall method [twitterObjects addObject:twitterInfo];?

    Read the article

  • which web services stacks are supported on JBoss AS 5?

    - by Marina
    Hi, I've been trying to find this info in JBoss docs/forums/WIKIs - but could not get a concise answer to this question: Which web services stacks are supported (or you can make work on) in JBoss 5? I have a huge legacy app using Axis 1 web services which is running fine on WLS9.2. Now I have to migrate it to JBoss 5 and I have to decide whether I can leave Axis1 web services as is (at least for the time being, to get the app working on JBoss at all), or if I have to upgrade web services to Axis 2 or CXF. So, given the three options, Axis 1, Axis 2 and CXF - what does support for them look like on JBoss 5? Any gotchas, pain points, words of wisdom from experience? :)

    Read the article

  • Is there any practical usage of Doubly Linked List, Queues and Stacks?

    - by Chouette
    I've been coding for quite sometime now. And my work pertains to solving real-world business scenarios. However, I have not really come across any practical usage of some of the data structures like the Linked List, Queues and Stacks etc. Not even at the business framework level. Of course, there is the ubiquitous HashTable, ArrayList and of late the List...but is there any practical usage of some of the other basic data structures? It would be great if someone gave a real-world solution where a Doubly Linked List "performs" better than the obvious easily usable counterpart.

    Read the article

  • How are people popping their UINavigationController stacks under a UITabBarController?

    - by RexOnRoids
    I have four UINavigationControllers assigned each to a tab in a UITabBarController. Each UINavigationController manages a UIViewController, which may itself branch out into other UIViewControllers below it hierarchally. My question is, in a case in which a user, under one tab, has navigated to a UIViewController that hierarchally BELOW the main UIViewController managed by the UINavigationController, and then the user pushes a different tab, and then goes back to the original tab, HOW can I make it so that the user is presented with the main UIViewController managed by the UINavigation controller? and not the page where he left off?

    Read the article

  • iPhone / Android: what protocol stacks do apps use for connecting to centralised services?

    - by Richard
    Hi All, Aplogies for the ignorant question, I have no experience with app development on any mobile platform. Basically what I want to know is what communication protocols do apps typically use for accessing/querying centralised services? E.g if I port a webapp/service to iPhone/Andriod, typically how would I access/query this web service in my app? E.g is it over HTTP, or are there other protocols? Also, presumably the GUI of an app is constructed with Apple/Andriod GUI libraries (in java? cocoa?). Can an app GUI be defined with HTML/javascript like a webpage? Sorry again for the pure noob questions. Thanks

    Read the article

  • repaint problem

    - by user357816
    I have a problem with my repaint in the method move. I dont know what to doo, the code is below import java.awt.*; import java.io.*; import java.text.*; import java.util.*; import javax.sound.sampled.*; import javax.swing.*; import javax.swing.Timer; import java.awt.event.*; import java.lang.*; public class bbb extends JPanel { public Stack<Integer> stacks[]; public JButton auto,jugar,nojugar; public JButton ok,ok2; public JLabel info=new JLabel("Numero de Discos: "); public JLabel instruc=new JLabel("Presiona la base de las torres para mover las fichas"); public JLabel instruc2=new JLabel("No puedes poner una pieza grande sobre una pequenia!"); public JComboBox numeros=new JComboBox(); public JComboBox velocidad=new JComboBox(); public boolean seguir=false,parar=false,primera=true; public int n1,n2,n3; public int click1=0; public int opcion=1,tiempo=50; public int op=1,continuar=0,cont=0; public int piezas=0; public int posx,posy; public int no; public bbb() throws IOException { stacks = new Stack[3]; stacks[0]=new Stack<Integer>(); stacks[1]=new Stack<Integer>(); stacks[2]=new Stack<Integer>(); setPreferredSize(new Dimension(1366,768)); ok=new JButton("OK"); ok.setBounds(new Rectangle(270,50,70,25)); ok.addActionListener(new okiz()); ok2=new JButton("OK"); ok2.setBounds(new Rectangle(270,50,70,25)); ok2.addActionListener(new vel()); add(ok2);ok2.setVisible(false); auto=new JButton("Automatico"); auto.setBounds(new Rectangle(50,80,100,25)); auto.addActionListener(new a()); jugar=new JButton("PLAY"); jugar.setBounds(new Rectangle(100,100,70,25)); jugar.addActionListener(new play()); nojugar=new JButton("PAUSE"); nojugar.setBounds(new Rectangle(100,150,70,25)); nojugar.addActionListener(new stop()); setLayout(null); info.setBounds(new Rectangle(50,50,170,25)); info.setForeground(Color.white); instruc.setBounds(new Rectangle(970,50,570,25)); instruc.setForeground(Color.white); instruc2.setBounds(new Rectangle(970,70,570,25)); instruc2.setForeground(Color.white); add(instruc);add(instruc2); add(jugar);add(nojugar);jugar.setVisible(false);nojugar.setVisible(false); add(info); info.setVisible(false); add(ok); ok.setVisible(false); add(auto); numeros.setBounds(new Rectangle(210,50,50,25)); numeros.addItem(1);numeros.addItem(2);numeros.addItem(3);numeros.addItem(4);numeros.addItem(5); numeros.addItem(6);numeros.addItem(7);numeros.addItem(8);numeros.addItem(9);numeros.addItem(10); add(numeros); numeros.setVisible(false); velocidad.setBounds(new Rectangle(150,50,100,25)); velocidad.addItem("Lenta"); velocidad.addItem("Intermedia"); velocidad.addItem("Rapida"); add(velocidad); velocidad.setVisible(false); } public void Mover(int origen, int destino) { for (int i=0;i<3;i++) { System.out.print("stack "+i+": "); for(int n : stacks[i]) System.out.print(n+";"); System.out.println(""); } System.out.println("de <"+origen+"> a <"+destino+">"); stacks[destino].push(stacks[origen].pop()); System.out.println(""); this.validate(); this.repaint( ); } public void hanoi(int origen, int destino, int cuantas) { while (parar) {} if (cuantas <= 1) Mover(origen,destino); else { hanoi(origen,3 - (origen+destino),cuantas-1); Mover(origen,destino); hanoi(3 - (origen+destino),destino,cuantas-1); } } public void paintComponent(Graphics g) { ImageIcon fondo= new ImageIcon("fondo.jpg"); g.drawImage(fondo.getImage(),0, 0,1366,768,null); g.setColor(new Color((int)(Math.random() * 254), (int)(Math.random() *255), (int)(Math.random() * 255))); g.fillRect(0,0,100,100); g.setColor(Color.white); g.fillRect(150,600,250,25); g.fillRect(550,600,250,25); g.fillRect(950,600,250,25); g.setColor(Color.red); g.fillRect(270,325,10,275); g.fillRect(270+400,325,10,275); g.fillRect(270+800,325,10,275); int x, y,top=0; g.setColor(Color.yellow); x=150;y=580; for(int ii:stacks[0]) { g.fillRect(x+((ii*125)/10),y-(((ii)*250)/10),((10-ii)*250)/10,20);} x=550;y=580; for(int ii:stacks[1]) {g.fillRect(x+((ii*125)/10),y-(((ii)*250)/10),((10-ii)*250)/10,20);} x=950;y=580; for(int ii:stacks[2]) {g.fillRect(x+((ii*125)/10),y-(((ii)*250)/10),((10-ii)*250)/10,20);} System.out.println("ENTRO"); setOpaque(false); } private class play implements ActionListener //manual { public void actionPerformed(ActionEvent algo) { parar=false; if(primera=true) { hanoi(0,2,no); primera=false; } } } private class stop implements ActionListener //manual { public void actionPerformed(ActionEvent algo) { parar=true; } } private class vel implements ActionListener //manual { public void actionPerformed(ActionEvent algo) { if (velocidad.getSelectedItem()=="Lenta") {tiempo=150;} else if (velocidad.getSelectedItem()=="Intermedia") {tiempo=75;} else tiempo=50; ok2.setVisible(false); jugar.setVisible(true); nojugar.setVisible(true); } } private class a implements ActionListener //auto { public void actionPerformed(ActionEvent algo) { auto.setVisible(false); info.setVisible(true); numeros.setVisible(true); ok.setVisible(true); op=3; } } private class okiz implements ActionListener //ok { public void actionPerformed(ActionEvent algo) { no=Integer.parseInt(numeros.getSelectedItem().toString()); piezas=no; if (no>0 && no<11) { info.setVisible(false); numeros.setVisible(false); ok.setVisible(false); for (int i=no;i>0;i--) stacks[0].push(i); opcion=2; if (op==3) { info.setText("Velocidad: ");info.setVisible(true); velocidad.setVisible(true); ok2.setVisible(true); } } else { } repaint(); } } } the code of the other class that calls the one up is below: import java.awt.*; import java.io.*; import java.net.URL; import javax.imageio.*; import javax.swing.*; import javax.swing.border.*; import java.lang.*; import java.awt.event.*; public class aaa extends JPanel { private ImageIcon Background; private JLabel fondo; public static void main(String[] args) throws IOException { JFrame.setDefaultLookAndFeelDecorated(true); final JPanel cp = new JPanel(new BorderLayout()); JFrame frame = new JFrame ("Torres de Hanoi"); frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); frame.setSize(550,550); frame.setVisible(true); bbb panel = new bbb(); frame.getContentPane().add(panel); frame.pack(); frame.setVisible(true); } }

    Read the article

  • Nvidia Drivers, Ubuntu 12.10, GeForce GT 540m

    - by Stacks
    How do I install Nvidia drivers for Ubuntu 12.10? I have a GeForce GT 540m and have been trying to do this for the past 2 months with no luck. I tried the official repository, then I added the x swat ppa. I've installed Linux-headers-generic and Linux-source, and virtually every solution google has to offer. Throughout the course of this I must have done at least 25 fresh installs of Ubuntu; does anybody else(with a GT 540m) have this problem?

    Read the article

  • Keep basic game physics separate from basic game object? [on hold]

    - by metamorphosis
    If anybody has dealt with a similar situation I'd be interested in your experience/wisdom, I'm developing a 2D game library in C++, I have game objects which have very basic physics, they also have movement classes attached to differing states, for example, a different movement type based on whether the character is jumping, on ice, whatever. In terms of storing velocity and acceleration impulses, are they best held by the object? Or by the associated movement class? The reason I ask is that I can see advantages to both approaches- if you store physics data in the movement class, you have to pass physics information between class instances when a state change occurs (ie. impulses, gravity etc) but the class has total control over whether those physics are updated or not. An obvious example of how this would be useful was if an object was affected by something which caused it to ignore gravity, or something like that. on the other hand if you store the physics data in the object class, it feels more logical, you don't have to go around passing physics impulses and gravity etc, however the control that the movement class has over the object's physics becomes more convoluted. Basically the difference is between: object->physics stacks (acceleration impulses etc) ->physics functions ->movement type <-movement type makes physics function calls through object and object->movement type->physics stacks ->physics functions ->object forwards external physics calls onto movement type ->object transfers physics stacks between movement types when state change occurs Are there best practices here?

    Read the article

  • iPhone / Objective-C: NSMutableArray writeToFile won't write to file. Always returns NO

    - by Joel
    I'm trying to serialize two NSMutableArrays of NSObjects that implement the NSCoding protocol. However it works for one (stacks) and not the other (cards). I have the following block of code: -(void) saveCards { NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString* documentsDirectory = [paths objectAtIndex:0]; NSString* cardsFile = [documentsDirectory stringByAppendingPathComponent:@"cards.state"]; NSString* stacksFile = [documentsDirectory stringByAppendingPathComponent:@"stacks.state"]; BOOL c = [rootStack.cards writeToFile:cardsFile atomically:YES]; BOOL s = [rootStack.stacks writeToFile:stacksFile atomically:YES]; } I step through this method using the debugger, and after the last two lines of code run, I check the values of the two BOOLs. BOOL c is NO and BOOL s is YES. The stacks array is actually empty (which is probably why it works). The cards array has contents. Why is it that the array with contents is failing? I can't figure this out. I've looked through numerous threads on SOF, each of them say the problem is because the protection level of the files they were writing were preventing them from writing. This is not my problem, as I'm writing to the Documents folder. I've double and tripple checked that neither rootStack.cards nor rootStack.stacks is nil. And I've checked that cards does indeed have content. Here are the coder methods for my Notecard class (I added all the if statments as part of trying to solve this problem to make sure trying to encode nil values doesn't break something): -(void) encodeWithCoder:(NSCoder *)encoder { if(text) [encoder encodeObject:text forKey:@"text"]; if(backText) [encoder encodeObject:backText forKey:@"backText"]; if(x) [encoder encodeObject:x forKey:@"x"]; if(y) [encoder encodeObject:y forKey:@"y"]; if(width) [encoder encodeObject:width forKey:@"width"]; if(height) [encoder encodeObject:height forKey:@"height"]; if(timeCreated) [encoder encodeObject:timeCreated forKey:@"timeCreated"]; if(audioManagerTicket) [encoder encodeObject:audioManagerTicket forKey:@"audioManagerTicket"]; if(backgroundColor) [encoder encodeObject:backgroundColor forKey:@"backgroundColor"]; } -(id) initWithCoder:(NSCoder *)decoder { self = [super init]; if(!self) return nil; self.text = [decoder decodeObjectForKey:@"text"]; self.backText = [decoder decodeObjectForKey:@"backText"]; self.x = [decoder decodeObjectForKey:@"x"]; self.y = [decoder decodeObjectForKey:@"y"]; self.width = [decoder decodeObjectForKey:@"width"]; self.height = [decoder decodeObjectForKey:@"height"]; self.timeCreated = [decoder decodeObjectForKey:@"timeCreated"]; self.audioManagerTicket = [decoder decodeObjectForKey:@"audioManagerTicket"]; self.backgroundColor = [decoder decodeObjectForKey:@"backgroundColor"]; return self; } each field is either an NSString, NSNumber, or UIColor. Thanks for any help

    Read the article

  • dealing cards in Clojure

    - by Ralph
    I am trying to write a Spider Solitaire player as an exercise in learning Clojure. I am trying to figure out how to deal the cards. I have created (with the help of stackoverflow), a shuffled sequence of 104 cards from two standard decks. Each card is represented as a (defstruct card :rank :suit :face-up) The tableau for Spider will be represented as follows: (defstruct tableau :stacks :complete) where :stacks is a vector of card vectors, 4 of which contain 5 cards face down and 1 card face up, and 6 of which contain 4 cards face down and 1 card face up, for a total of 54 cards, and :complete is an (initially) empty vector of completed sets of ace-king (represented as, for example, king-hearts, for printing purposes). The remainder of the undealt deck should be saved in a ref (def deck (ref seq)) During the game, a tableau may contain, for example: (struct-map tableau :stacks [[AH 2C KS ...] [6D QH JS ...] ... ] :complete [KC KS]) where "AH" is a card containing {:rank :ace :suit :hearts :face-up false}, etc. How can I write a function to deal the stacks and then save the remainder in the ref?

    Read the article

  • Looking for WAMP Benchmarking (my current WAMP is very slow, so are other solutions)

    - by therobyouknow
    I'm running ZWAMP WAMP stack on my local development machine. However I have found it to be very slow at serving pages from a Drupal site I have setup. By contrast, my live production site on shared hosting is reasonably quick. For me the goal with a local WAMP stack was to develop offline and send completed work to the live production site. I liked ZWAMP because it didn't require adjustments to User Access Control or other permissions. I've looked at Drupal Acquia Development Stack but found this too restrictive: only one site instance/doc root can be installed. I've looked at other DAMP stacks and heard reports of them being slow. My local development machine that I am running the WAMP stack on is a Dual Core 2.6Ghz hyperthreaded Intel i7, 4Gb RAM, 7200rpm hard disk, running Windows 64bit professional. Surely this is fast enough. So I'm looking for: Causes of the slowness of the WAMP and how to improve the speed Benchmark data of various WAMP stacks

    Read the article

  • Event-Driven Debugging

    - by Brian Donahue
    Most application troubleshooting involves getting an error, analyzing the error message, and at worst, attaching a debugger to work out the real cause. What is not really covered is how to troubleshoot an applicaiton that is not errant, but is having a performance issue, and more than likely, in the middle of the night when you are snug in your bed, sawing logs. What you need is an ever-vigilant cyborg who never sleeps to sit in front of your server all night, but as SkyNet is not live yet, you can settle for the next-best thing. Windows provides performance counters and alerts that can tell you when an applicaiton reaches an unacceptable threshold of naughty behavior, but although it can tattle on your brainchild, it won't be the child psychiatrist that you need to tell you why he's pulling your server's pigtails and pulling faces at the teacher. What you need is to plug a debugger into performance monitor and have it tell you what's going on with your applicaiton at the time. For this purpose, I'd used Microsoft's MDbgEngine as the basis for an applicaiton that will dump a program's stacks, I call it Application Slicer Dicer Wonder Dumper Super Cyborg, or StackOMatic for short. StackOMatic can look at a program's behavior and tell you if the stacks are not moving, but it can also work on the command-line to dump all managed methods on the stack at will. Now that there is a command you can use to dump the stacks, all you need to do is politely tell Windows to run it when you're displeased with your creation as it's trashing the CPU of your server at 3 AM. The first step is to create a scheduled task to tell StackOMatic to dump your applicaiton. Start Task Scheduler and right-click Task Scheduler Library and then Create Task. For this exercise I'm creating a task that will dump the Red Gate SQL Monitor Base Monitor Service. In the Actions tab, I enter the path to StackOMatic and use the arguments to log the stack dump to a file: /PN:RedGate.Response.Engine.Alerting.Base.Service /OUT:c:\users\administrator\MonitorLog.txt Next, I go into Windows Server 2008's Reliability and Performance Monitor and add a new Data Collector Set. This set will produce an alert on the %Processor Time for the service. When the processor time breaches 50%, it will run the StackDumpBaseService task I created. Whenever the service misbehaves, it will append to the log file. Now when I go to work in the morning, I can see what the service was doing when it overloaded the processor and take action.

    Read the article

  • Question about ITextUndoHistory returned from TryGetHistory

    - by nick.ueda
    Everytime the IWpfTextView's TextBuffer changes I am trying to get the history's redostack and undostack and simply checking the count. When doing this I am encountering a "Method not supported exception" when trying to access the two stacks. Am I retrieving the history incorrectly or does VS not want me seeing/editing the contents of the stacks? I can post the code if necessary... Thanks, Nick

    Read the article

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