Search Results

Search found 119 results on 5 pages for 'tobias mann'.

Page 5/5 | < Previous Page | 1 2 3 4 5 

  • Inventory Management concepts in XNA game

    - by user1332755
    I am trying to code the inventory system in my first real game so I have very little experience in both c# and game engine development. Basically, I need some general guidance and tips with how to structure and organize these sorts of systems. Please tell me if I am on the right track or not before I get too deep into making some badly structured system. It's fine if you don't feel like looking through my code, suggestions about general structure would also be appreciated. What I am aiming to end up with is some sort of system like Minecraft or Terraria. It must include: main inventory GUI (items can be dragged and placed in whatever slot desired Itembar outside of the main inventory which can be assigned to certain items the ability to use items from either location So far, I have 4 main classes: Inventory holds the general info and methods, inventoryslot holds info for individual slots, Itembar holds all info and methods for itself, and finally, ItemManager to manage interactions between the two and hold a master list of items. So far, my itembar works perfectly and interacts well with mousedragging items into and out of it as well as activating the item effect. Here is the code I have so far: (there is a lot but I will try to keep it relevant) This is the code for the itembar on the main screen: class Itembar { public Texture2D itembarfull, iSelected; public static Rectangle itembar = new Rectangle(5, 218, 40, 391); public Rectangle box1 = new Rectangle(itembar.X, 218, 40, 40); //up to 10 Rectangles for each slot public int Selected = 0; private ItemManager manager; public Itembar(Texture2D texture, Texture2D texture3, ItemManager mann) { itembarfull = texture; iSelected = texture3; manager = mann; } public void Update(GameTime gametime) { } public void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw( itembarfull, new Vector2 (itembar.X, itembar.Y), null, Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 1.0f); if (Selected == 1) spriteBatch.Draw(iSelected, new Rectangle(box1.X-3, box1.Y-3, box1.Width+6, box1.Height+6), Color.White); //goes up to 10 slots } public int Box1Query() { foreach (Item item in manager.items) { if(box1.Contains(item.BoundingBox)) return manager.items.IndexOf(item); } return 999; } //10 different box queries It is working fine right now. I just put an Item in there and the box will query things like the item's effects, stack number, consumable or not etc...This one is basically almost complete. Here is the main inventory class: class Inventory { public bool isActive; public List<Rectangle> mainSlots = new List<Rectangle>(24); public List<InventorySlot> mainSlotscheck = new List<InventorySlot>(24); public static Rectangle inv = new Rectangle(841, 469, 156, 231); public Rectangle invfull = new Rectangle(inv.X, inv.Y, inv.Width, inv.Height); public Rectangle inv1 = new Rectangle(inv.X + 4, inv.Y +3, 32, 32); //goes up to inv24 resulting in a 6x4 grid of Rectangles public Inventory() { mainSlots.Add(inv1); mainSlots.Add(inv2); mainSlots.Add(inv3); mainSlots.Add(inv4); //goes up to 24 foreach (Rectangle slot in mainSlots) mainSlotscheck.Add(new InventorySlot(slot)); } //update and draw methods are empty because im not too sure what to put there public int LookforfreeSlot() { int slotnumber = 999; for (int x = 0; x < mainSlots.Count; x++) { if (mainSlotscheck[x].isFree) { slotnumber = x; break; } } return slotnumber; } } } LookforFreeSlot() method is meant to be called when I do AddtoInventory(). I'm kinda stumped about what other things I need to put in this class. Here is the inventorySlot class: (its main purpose is to check the bool "isFree" to see whether or not something already occupies the slot. But i guess it can also do other stuff like get item info.) class InventorySlot { public int X, Y; public int Width = 32, Height = 32; public Vector2 Position; public int slotnumber; public bool free = true; public int? content = null; public bool isFree { get { return free; } set { free = value; } } public InventorySlot(Rectangle slot) { slot = new Rectangle(X, Y, Width, Height); } } } Finally, here is the ItemManager (I am omitting the master list because it is too long) class ItemManager { public List<Item> items = new List<Item>(20); public List<Item> inventory1 = new List<Item>(24); public List<Item> inventory2 = new List<Item>(24); public List<Item> inventory3 = new List<Item>(24); public List<Item> inventory4 = new List<Item>(24); public Texture2D icon, filta; private Rectangle msRect; MouseState mouseState; public int ISelectedIndex; Inventory inventory; SpriteFont font; public void GenerateItems() { items.Add(new Item(new Rectangle(0, 0, 32, 32), icon, font)); items[0].name = "Grass Chip"; items[0].itemID = 0; items[0].consumable = true; items[0].stackable = true; items[0].maxStack = 99; items.Add(new Item(new Rectangle(32, 0, 32, 32), icon, font)); //master list continues. it will generate all items in the game; } public ItemManager(Inventory inv, Texture2D itemsheet, Rectangle mouseRectt, MouseState ms, Texture2D fil, SpriteFont f) { icon = itemsheet; msRect = mouseRectt; filta = fil; mouseState = ms; inventory = inv; font = f; } //once again, no update or draw public void mousedrag() { items[0].DestinationRect = new Rectangle (msRect.X, msRect.Y, 32, 32); items[0].dragging = true; } public void AddtoInventory(Item item) { int index = inventory.LookforfreeSlot(); if (index == 999) return; item.DestinationRect = inventory.mainSlots[index]; inventory.mainSlotscheck[index].content = item.itemID; inventory.mainSlotscheck[index].isFree = false; item.IsActive = true; } } } The mousedrag works pretty well. AddtoInventory doesn't work because LookforfreeSlot doesn't work. Relevant code from the main program: When I want to add something to the main inventory, I do something like this: foreach (Particle ether in ether1.ethers) { if (ether.isCollected) itemmanager.AddtoInventory(itemmanager.items[14]); } This turned out to be much longer than I had expected :( But I hope someone is interested enough to comment.

    Read the article

  • Boost singletons

    - by Ockonal
    Hi guys, at this page: http://torjo.com/tobias/index.html#boost_utility_singleton._usage I saw that boost has singleton class which gets second param: recreate instance if it's deleted (when we call the singleton). I can't find the implementation of this singleton in boost library. There is only singletons from serialization and pool. What's wrong?

    Read the article

  • SharePoint Q&A With the MVP Gang

    - by Bil Simser
    Interested in getting some first hand knowledge about SharePoint and all of it’s quirks, oddities, and secrets? We’re hosting not one, but *two* SharePoint Q&A sessions with the MVP crowd. Here’s the official blurb: Do you have tough technical questions regarding SharePoint for which you're seeking answers? Do you want to tap into the deep knowledge of the talented Microsoft Most Valuable Professionals? The SharePoint MVPs are the same people you see in the technical community as authors, speakers, user group leaders and answerers in the MSDN forums. By popular demand, we have brought these experts together as a collective group to answer your questions live. So please join us and bring on the questions! This chat will cover WSS, MOSS and the SharePoint 2010. Topics include setup and administration, design, development and general questions. Here’s a rundown of the expected guests for the chats: Agnes Molnar, Andrew Connell, Asif Rehmani, Becky Bertram, Me, Bryan Phillips, Chris O'Brien, Clayton Cobb, Dan Attis, Darrin Bishop, David Mann, Gary Lapointe, John Ross, Mike Oryzak, Muhanad Omar, Paul Stork, Randy Drisgill, Rob Bogue, Rob Foster, Shane Young, Spence Harbar. Apologies for not linking to everyone’s blogs, I’m just not that ambitious tonight. Please note that not everyone listed here is guaranteed to make it to either chat and there may be additions/changes at the last minute so the names may change to protect the innocent. The chat sessions will be held April 27th, 2010 at 4PM (PST) and April 28th at 9AM (PST). You can find out more details about the chats here or click here to add the April 27th event to your calendar, or click here to add the April 28th event (assuming your calendar software supports ICS files). See you there!

    Read the article

  • SharePoint MVP Chat &ndash; tomorrow and day after

    - by Sahil Malik
    Ad:: SharePoint 2007 Training in .NET 3.5 technologies (more information). Yes we’re doing it again! After two very successful chats, a number of MVPs will be online in chat style answering your SharePoint questions. Here’s the schedule Tuesday May 25th at 4PM PDT (join here) Agnes Molnar Bill English Brian Farnhill Bryan Phillips Clayton Cobb David Mann <—ask him to tell a joke, he has a great sense of humor! Also bug him about Workflows. Matt McDermott Paul Stork Rob Bogue <—Ask him about WFs too. Rob Foster <— Him and Nick Swan run a SharePoint podcast. Sahil Malik <—I know him Saifullah Shafiq Ahmed   Wednesday at 9AM PDT (join here) Andrew Connell <— youngest MVP ever! LOL. Becky Bertram Bil Simser Chadima Kulathilake Claudio Brotto Gary Lapointe <—the stsadm extensions guy, ask him about powershell Darrin Bishop John Ross Michael Mukalian Muhanad Omar Randy Drisgill <—he created SP2010 starter master pages. Ask him about branding Shane Young Todd Bleeker Zlatan Dzinic Comment on the article ....

    Read the article

  • Tab Sweep: Java EE 6 Scopes, Observer, SSL, Workshop, Virtual Server, JDBC Connection Validation

    - by arungupta
    Recent Tips and News on Java, Java EE 6, GlassFish & more : • How Java EE 6 Scopes Affect User Interactions (DevX.com) • Why is Java EE 6 better than Spring ? (Arun Gupta) • JavaEE Revisits Design Patterns: Observer (Murat Yener) • Getting started with Glassfish V3 and SSL (JavaDude) • Software stacks market share within Jelastic: March 2012 (Jelastic) • All aboard the Java EE 6 Love Boat! (Bert Ertman) • Full stack Java EE workshop (Kito Mann) • Create a virtual server from console in glassfish (Hector Guzman) • Glassfish – JDBC Connection Validation explained (Alexandru Ersenie) • Automatically setting the label of a component in JSF 2 (Arjan Tijms) • JSF2 + Primefaces3 + Spring3 & Hibernate4 Integration Project (Eren Avsarogullari) • THE EXECUTABLE FEEL OF JAX-RS 2.0 CLIENT (Adam Bien) Here are some tweets from this week ... web-app dtd(s) on http://t.co/4AN0057b R.I.P. using http://t.co/OTZrOEEr instead. Thank you Oracle! finally got GlassFish and Cassandra running embedded so I can unit test my app #jarhell #JavaEE6 + #NetBeans is really a pleasure to work with! Reading latest chapter in #Spring vs #JavaEE wars https://t.co/RqlGmBG9 (and yes, #JavaEE6 is better :P) @javarebel very easy install and very easy to use in combination with @netbeans and @glassfish. Save your time.

    Read the article

  • ArchBeat Link-o-Rama Top 20 for June 17-23, 2012

    - by Bob Rhubart
    The most popular item shared via my social networks for the week of June 17-23, 2012. Simple Made Easy | Rich Hickey InfoQ: Current Trends in Enterprise Mobility Cloud Bursting between AWS and Rackspace | High Scalability A Distributed Access Control Architecture for Cloud Computing Congrats to @MNEMONIC01 on his new book: Oracle WebLogic Server 12c: First Look BI Architecture Master Class for Partners - Oracle Architecture Unplugged Guide to integration architecture | Stephanie Mann Oracle Data Integrator 11g - Faster Files | David Allan Recap: EMEA User Group Leaders Meeting Latvia May 2012 Starting a cluster | Mark Nelson SOA, Cloud & Service Technology Symposium 2012 London - Special Oracle Discount Enterprise 2.0 Conference: Building Social Business | Oracle WebCenter Blog FY13 Oracle PartnerNetworkr Kickoff - Tues June 26, 2012 | @oraclepartners Why should you choose Oracle WebLogic 12c instead of JBoss EAP 6? | Ricardo Ferreira Call for Nominations: Oracle Fusion Middleware Innovation Awards 2012 - Win a free pass to #OOW12 Hibernate4 and Coherence | Rene van Wijk Eclipse and Oracle Fusion Development - Free Virtual Event, July 10th Why building SaaS well means giving up your servers | GigaOM Personas - what, why & how | Mascha van Oosterhout Oracle Public Cloud Architecture | Tyler Jewell Thought for the Day "There is only one thing more painful than learning from experience and that is not learning from experience." — Archibald McLeish (May 7, 1892 – April 20, 1982) Source: SoftwareQuotes.com

    Read the article

  • SQLRally Nordic gets underway

    - by Rob Farley
    PASS is becoming more international, which is great. The SQL Community has always been international – it’s not as if data is only generated in North America. And while it’s easy for organisations to have a North American focus, PASS is taking steps to become international. Regular readers will be aware that I’m one of three advisors to the PASS Board of Directors, with a focus on developing PASS as a more global organisation. With this in mind, it’s great that today is Day 1 of SQLRally Nordic, being hosted in in Sweden – not only a non-American country, but one that doesn’t have English as its major language. The event has been hosted by the amazing Johan Åhlén and Raoul Illyés, two guys who I met earlier this year, but the thing that amazes me is the incredible support that this event has from the SQL Community. It’s been sold out for a long time, and when you see the list of speakers, it’s not surprising. Some of the industry’s biggest names from Microsoft have turned up, including Mark Souza (who is also a PASS Director), Thomas Kejser and Tobias Thernström. Business Intelligence experts such as Jen Stirrup, Chris Webb, Peter Myers, Marco Russo and Alberto Ferrari are there, as are some of the most awarded SQL MVPs such as Itzik Ben-Gan, Aaron Bertrand and Kevin Kline. The sponsor list is also brilliant, with names such as HP, FusionIO, SQL Sentry, Quest and SolidQ complimented by Swedish companies like Cornerstone, Informator, B3IT and Addskills. As someone who is interested in PASS becoming global, I’m really excited to see this event happening, and I hope it’s a launch-pad into many other international events hosted by the SQL community. If you have the opportunity, thank Johan and Raoul for putting this event on, and the speakers and sponsors for helping support it. The noise from Twitter is that everything is going fantastically well, and everyone involved should be thoroughly congratulated! @rob_farley

    Read the article

  • There is No Scrum without Agile

    - by John K. Hines
    It's been interesting for me to dive a little deeper into Scrum after realizing how fragile its adoption can be.  I've been particularly impressed with James Shore's essay "Kaizen and Kaikaku" and the Net Objectives post "There are Better Alternatives to Scrum" by Alan Shalloway.  The bottom line: You can't execute Scrum well without being Agile. Personally, I'm the rare developer who has an interest in project management.  I think the methodology to deliver software is interesting, and that there are many roles whose job exists to make software development easier.  As a project lead I've seen Scrum deliver for disciplined, highly motivated teams with solid engineering practices.  It definitely made my job an order of magnitude easier.  As a developer I've experienced huge rewards from having a well-defined pipeline of tasks that were consistently delivered with high quality in short iterations.  In both of these cases Scrum was an addition to a fundamentally solid process and a huge benefit to the team. The question I'm now facing is how Scrum fits into organizations withot solid engineering practices.  The trend that concerns me is one of Scrum being mandated as the single development process across teams where it may not apply.  And we have to realize that Scurm itself isn't even a development process.  This is what worries me the most - the assumption that Scrum on its own increases developer efficiency when it is essentially an exercise in project management. Jim's essay quotes Tobias Mayer writing, "Scrum is a framework for surfacing organizational dysfunction."  I'm unsure whether a Vice President of Software Development wants to hear that, reality nonwithstanding.  Our Scrum adoption has surfaced a great deal of dysfunction, but I feel the original assumption was that we would experience increased efficiency.  It's starting to feel like a blended approach - Agile/XP techniques for developers, Scrum for project managers - may be a better fit.  Or at least, a better way of framing the conversation. The blended approach. Technorati tags: Agile Scrum

    Read the article

  • Mobile Web Applications – A guide for professional development

    - by JuergenKress
    (Tobias Bosch, Stefan Scheidt, Torsten Winterberg / Opitz Consulting Deutschland GmbH). There is a real hype around mobile solutions. Smartphones and tablets are everywhere. Frontend architecture is changing quickly to adopt cross browser technologies like HTML5 and extensive JavaScript-based development. In this book we introduce our software development process to build test-driven Single-Page JavaScript Web Applications, which will be the future next to native apps. We start with a short introduction of our RYLC showcase (know from our SOA articles), give a very short introduction to JavaScript, then talk about jQuery Mobile, Angular JS, Testing, Backend-communication and we close with deploying our RYLC-Webapp as a hybrid app using the PhoneGap (Cordova) framework. Don’t expect too much theory – it’s a practical guide explaining how RYLC Web App was built, to kickstart your own development. Currently only available in German as paperback and eBook. WebLogic Partner Community For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center. BlogTwitterLinkedInMixForumWiki Technorati Tags: adf mobil

    Read the article

  • Regular Expression for $_GET query strings

    - by sandelius
    Hi there! I'm trying to find a regular expression for $_GET query strings. I have an array like this: private $_regexp = array( ':id' => '[0-9]+', ':year' => '[12][0-9]{3}', ':month' => '0[1-9]|1[012]', ':day' => '0[1-9]|[12][0-9]|3[01]', ':slug' => '[a-zA-Z0-9-]+', ':query' => '...' ); and I loop throw them to see if I have a matching wildcard like this: if ( array_key_exists($matches[0], $this->_regexp) ) { return '^('.$this->_regexp[$matches[0]].')$'; } All other regexp go throw but I've tried a whole lot of different regexp to find: ?anything=anything can't figure it out, googled like h..l but can't find anything. I've tried, for example something like this: (\?)(.*)(=)(.*) but without result... Any regexp gurus here? / Tobias

    Read the article

  • ERB doesnt get executed in javascript scripts

    - by Stefano
    Hi guys I have a select input on my page. this select input displays/hides fields in the form. This all works fine. But the problem is that if i submit the form and lack some necessary fields, it doesnt set the select to the right value afterwards. I just cant get the embedded ruby to work! it keeps escaping the whole thing... here my code: $(document).ready(function() { $("#profile_sex").val('<%= @profile.sex %>') $("#profile_sex").change(function(){ ($(this).val() == "Frau") ? $('#form-female').show() : $('#form-female').hide(); ($(this).val() == "Mann") ? $('#form-male').show() : $('#form-male').hide(); if ($(this).val() == "Paar") { $('#form-female').show(); $('#form-male').show(); } }); }); why doesnt this work??? I dont get any error or anything it just sets the value to "<%= @profile.sex =" I was googling and searching about on stack overflow and railscasts, the rails API, everything. Im seriously confused... thanks for your help.

    Read the article

  • Book Review (Book 12) - 20 Master Plots

    - by BuckWoody
    This is a continuation of the books I challenged myself to read to help my career - one a month, for a year. You can read my first book review here, and the entire list is here. The book I chose for May 2012 was:20 Master Plots by Ronald B. Tobias. This is my final book review - at least for this year. I'll explain what I've learned in this book in particular, and in the last twelve months in general. Why I chose this book: Stories and themes are part of software, presenting, and working in teams. This book claims there are only 20 plots, ever. I wanted to find out. What I learned: Probably my most favorite read of the year. Deceptively small, amazingly insightful. The premise is that there are only a few "base" themes, and that once you learn them you can put together an interesting set of stories on most any topic. Yes, the author admits that this number has been different throughout history - some have said 50, others 14, and still others claim only one or two basic plots. This doesn't change the fact that you can build very complex stories from a simple set of circumstances and characters. Be warned - if you read this book it takes away much of the wonder from almost every movie or book you'll read from here on! I loved it. My favorite part is that the author gives you exercises to build stories, right from the start. I've actually used these as the start of a meeting to foster creativity. Amazing stuff. One of my favorite sections of the book deals with plot and story. Plot: The king died, and the queen died. Story: The king died, and the queen died of heartbreak. Add one or two words, and you have the essence of storytelling. A highly recommended read, for all folks of all ages. You'll like it, your spouse will like it, and your kids will like it. I learned to be a better storyteller, and it helped me understand that plots and stories are not just things in books - they are a direct reflection of human nature. That makes me a better manager of myself and others.   And this is the last of the reviews - at least for this year. I probably won't post many more book reviews here, but I will keep up the practice. As a reminder, the goal was to select 12 books that will help you reach your career goals. They don't have to be technical, or even apply directly to your job - but they do need to be books that you mindfully select as getting you closer to what you want to be. Each month, jot down what you learned from the work. And see if it doesn't in fact get you closer to your goals. These readings helped me - I got a promotion this year, and I attribute at least some of that to the things I learned.

    Read the article

  • Book Review (Book 12) - 20 Master Plots

    - by BuckWoody
    This is a continuation of the books I challenged myself to read to help my career - one a month, for a year. You can read my first book review here, and the entire list is here. The book I chose for May 2012 was:20 Master Plots by Ronald B. Tobias. This is my final book review - at least for this year. I'll explain what I've learned in this book in particular, and in the last twelve months in general. Why I chose this book: Stories and themes are part of software, presenting, and working in teams. This book claims there are only 20 plots, ever. I wanted to find out. What I learned: Probably my most favorite read of the year. Deceptively small, amazingly insightful. The premise is that there are only a few "base" themes, and that once you learn them you can put together an interesting set of stories on most any topic. Yes, the author admits that this number has been different throughout history - some have said 50, others 14, and still others claim only one or two basic plots. This doesn't change the fact that you can build very complex stories from a simple set of circumstances and characters. Be warned - if you read this book it takes away much of the wonder from almost every movie or book you'll read from here on! I loved it. My favorite part is that the author gives you exercises to build stories, right from the start. I've actually used these as the start of a meeting to foster creativity. Amazing stuff. One of my favorite sections of the book deals with plot and story. Plot: The king died, and the queen died. Story: The king died, and the queen died of heartbreak. Add one or two words, and you have the essence of storytelling. A highly recommended read, for all folks of all ages. You'll like it, your spouse will like it, and your kids will like it. I learned to be a better storyteller, and it helped me understand that plots and stories are not just things in books - they are a direct reflection of human nature. That makes me a better manager of myself and others.   And this is the last of the reviews - at least for this year. I probably won't post many more book reviews here, but I will keep up the practice. As a reminder, the goal was to select 12 books that will help you reach your career goals. They don't have to be technical, or even apply directly to your job - but they do need to be books that you mindfully select as getting you closer to what you want to be. Each month, jot down what you learned from the work. And see if it doesn't in fact get you closer to your goals. These readings helped me - I got a promotion this year, and I attribute at least some of that to the things I learned.

    Read the article

  • Do I really need bindParam?

    - by sandelius
    Hi there! I'm trying to do a little PDO CRUD to learn some PDO. I have a question about bindParam. Here's my update method right now: public static function update($conditions = array(), $data = array(), $table = '') { self::instance(); // Late static bindings (PHP 5.3) $table = ($table === '') ? self::table() : $table; // Check which data array we want to use $values = (empty($data)) ? self::$_fields : $data; $sql = "UPDATE $table SET "; foreach ($values as $f => $v) { $sql .= "$f = ?, "; } // let's build the conditions self::build_conditions($conditions); // fix our WHERE, AND, OR, LIKE conditions $extra = self::$condition_string; // querystring $sql = rtrim($sql, ', ') . $extra; // let's merge the arrays into on $v_val = array_values($values); $c_val = array_values($conditions); $array = array_merge($v_val, self::$condition_array); $stmt = self::$db->prepare($sql); return $stmt->execute($array); } in my "self::$condition_array" I get all the right values from the ?. SO the query looks like this: UPDATE table SET this = ?, another = ? WHERE title = ? AND time = ? as you can see I dont use bindParams instead I pass the right values in the right order ($array) directly into the execute($array) method. This works like a charm BUT is it safe not use use bindParam here? If not then how can I do it? Thanks from Sweden Tobias

    Read the article

  • Do I really ned bindParam?

    - by sandelius
    Hi there! I'm trying to do a little PDO CRUD to learn some PDO. I have a question about bindParam. Here's my update method right now: public static function update($conditions = array(), $data = array(), $table = '') { self::instance(); // Late static bindings (PHP 5.3) $table = ($table === '') ? self::table() : $table; // Check which data array we want to use $values = (empty($data)) ? self::$_fields : $data; $sql = "UPDATE $table SET "; foreach ($values as $f => $v) { $sql .= "$f = ?, "; } // let's build the conditions self::build_conditions($conditions); // fix our WHERE, AND, OR, LIKE conditions $extra = self::$condition_string; // querystring $sql = rtrim($sql, ', ') . $extra; // let's merge the arrays into on $v_val = array_values($values); $c_val = array_values($conditions); $array = array_merge($v_val, self::$condition_array); $stmt = self::$db->prepare($sql); return $stmt->execute($array); } in my "self::$condition_array" I get all the right values from the ?. SO the query looks like this: UPDATE table SET this = ?, another = ? WHERE title = ? AND time = ? as you can see I dont use bindParams instead I pass the right values in the right order ($array) directly into the execute($array) method. This works like a charm BUT is it safe not use use bindParam here? If not then how can I do it? Thanks from Sweden Tobias

    Read the article

  • Best practice accessing an array set within a class

    - by user350599
    I have created a basic class for a customer. I haven't done this before and want to know the best way to access the data. Should I have a get() method for every field in the customer array or should I simply pass the customer array back and access with the page. i.e. Just return the array class Customer { protected $id; protected $customer; public function __construct($customer_id) { $this->id = $customer_id; $this->set_customer(); } protected function set_customer() { $query = mysql_query("SELECT * FROM customer WHERE id = '$this->id'"); $this->customer = mysql_fetch_row($query); } public function get_customer() { return $this->customer; } } versus create a method for each item in the array class Customer { protected $id; protected $customer; public function __construct($customer_id) { $this->id = $customer_id; $this->set_customer(); } protected function set_customer() { $query = mysql_query("SELECT * FROM customer WHERE id = '$this->id'"); $this->customer = mysql_fetch_row($query); } public function get_customer_name() { return $this->customer->customer_name; } ... ... } versus option 3 based on Tobias' feedback: (not sure if syntax is correct) class Customer { protected $id; protected $customer; public function __construct($customer_id) { $this->id = $customer_id; return $this->set_customer(); } protected function set_customer() { $query = mysql_query("SELECT * FROM customer WHERE id = '$this->id'"); return mysql_fetch_row($query); } }

    Read the article

  • Copying Columns from Grid to Clipboard in SQL Developer

    - by thatjeffsmith
    There are several ways to get data from a query or a table|view to the clipboard. You know the tried and true, copy and paste. But what if you only want one or more columns, not every column? There are several ways to do this, let’s see if we can’t identify all of them. Write your query to only include the data you want Obvious? Yes. Needed to be said? Definitely. The best tuning tip is to only ask for the data you need, only when you absolutely need it. But let’s look at a few more practical ways to do this. Hide the unwanted columns Mouse right click on an column header. In the context menu, select ‘Columns.’ Hide the columns you don’t want. Copy and paste. WYSIWYG Grids, Hide Columns and Filter Rows Mouse select the columns Obvious, but a bit painful. For a very large dataset, you’ll be holding down the Shift and PageDown buttons – but it works. Remember to use Ctrl+Shift+C to get the column headers with the data. Use the Export Wizard This used to be called ‘Unload’ – agreed, not a great name. So, we changed it. In a grid, right mouse click on the data, and on the context menu, select ‘Export…’ Select your format – I suggest ‘delimited’ or ‘fixed’ for copying data to the clipboard. You can export to the clipboard, yes you can! Click ‘Next.’ Click in the Columns dialog, and choose the columns you want copied. Trim the columns you don't want copied Click ‘Finish.’ Alt or Ctrl tab to your window or application of choice. And Paste! "FIRST_NAME" "LAST_NAME" "Donald" "OConnell" "Douglas" "Grant" "Jennifer" "Whalen" "Pat" "Fay" "Susan" "Mavris" "William" "Gietz" "Alexander" "Hunold" "Bruce" "Ernst" "David" "Austin" "Valli" "Pataballa" "Diana" "Lorentz" "Daniel" "Faviet" "John" "Chen" "Ismael" "Sciarra" "Jose Manuel" "Urman" "Luis" "Popp" "Alexander" "Khoo" "Shelli" "Baida" "Sigal" "Tobias" "Guy" "Himuro" "Karen" "Colmenares" "Matthew" "Weiss" "Adam" "Fripp" "Payam" "Kaufling" "Shanta" "Vollman" "Kevin" "Mourgos" "Julia" "Nayer" "Irene" "Mikkilineni" ... There’s probably at least 2 or 3 more ways, but… But, try these and let me know how we can improve things. I’ve already gotten a request to be able to include the SQL text used to populate the dataset on the the copy to clipboard, and it’s now on our to-do list

    Read the article

  • Android remote service doesn't call service methods

    - by tarantel
    Hello, I'm developing a GPS tracking software on android. I need IPC to control the service from different activities. So I decide to develop a remote service with AIDL. This wasn't a big problem but now it's always running into the methods of the interface and not into those of my service class. Maybe someone could help me? Here my ADIL file: package test.de.android.tracker interface ITrackingServiceRemote { void startTracking(in long trackId); void stopTracking(); void pauseTracking(); void resumeTracking(in long trackId); long trackingState(); } And the here a short version of my service class: public class TrackingService extends Service implements LocationListener{ private LocationManager mLocationManager; private TrackDb db; private long trackId; private boolean isTracking = false; @Override public void onCreate() { super.onCreate(); mNotificationManager = (NotificationManager) this .getSystemService(NOTIFICATION_SERVICE); mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE); db = new TrackDb(this.getApplicationContext()); } @Override public void onStart(Intent intent, int startId) { super.onStart(intent, startId); } @Override public void onDestroy(){ //TODO super.onDestroy(); } @Override public IBinder onBind(Intent intent){ return this.mBinder; } private IBinder mBinder = new ITrackingServiceRemote.Stub() { public void startTracking(long trackId) throws RemoteException { TrackingService.this.startTracking(trackId); } public void pauseTracking() throws RemoteException { TrackingService.this.pauseTracking(); } public void resumeTracking(long trackId) throws RemoteException { TrackingService.this.resumeTracking(trackId); } public void stopTracking() throws RemoteException { TrackingService.this.stopTracking(); } public long trackingState() throws RemoteException { long state = TrackingService.this.trackingState(); return state; } }; public synchronized void startTracking(long trackId) { // request updates every 250 meters or 0 sec this.trackId = trackId; mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 250, this); isTracking = true; } public synchronized long trackingState() { if(isTracking){ return trackId; } else return -1; } public synchronized void stopTracking() { if(isTracking){ mLocationManager.removeUpdates(this); isTracking = false; } else Log.i(TAG, "Could not stop because service is not tracking at the moment"); } public synchronized void resumeTracking(long trackId) { if(!isTracking){ this.trackId = trackId; mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 250, this); isTracking = true; } else Log.i(TAG, "Could not resume because service is tracking already track " + this.trackId); } public synchronized void pauseTracking() { if(isTracking){ mLocationManager.removeUpdates(this); isTracking = false; } else Log.i(TAG, "Could not pause because service is not tracking at the moment"); } public void onLocationChanged(Location location) { //TODO } For easier access from the client I wrote a ServiceManager class which sets up the ServiceConnection and you can call the service methods. Here my code for this: public class TrackingServiceManager{ private static final String TAG = "TrackingServiceManager"; private ITrackingServiceRemote mService = null; private Context mContext; private Boolean isBound = false; private ServiceConnection mServiceConnection; public TrackingServiceManager(Context ctx){ this.mContext = ctx; } public void start(long trackId) { if (isBound && mService != null) { try { mService.startTracking(trackId); } catch (RemoteException e) { Log.e(TAG, "Could not start tracking!",e); } } else Log.i(TAG, "No Service bound! 1"); } public void stop(){ if (isBound && mService != null) { try { mService.stopTracking(); } catch (RemoteException e) { Log.e(TAG, "Could not stop tracking!",e); } } else Log.i(TAG, "No Service bound!"); } public void pause(){ if (isBound && mService != null) { try { mService.pauseTracking(); } catch (RemoteException e) { Log.e(TAG, "Could not pause tracking!",e); } } else Log.i(TAG, "No Service bound!"); } public void resume(long trackId){ if (isBound && mService != null) { try { mService.resumeTracking(trackId); } catch (RemoteException e) { Log.e(TAG, "Could not resume tracking!",e); } } else Log.i(TAG, "No Service bound!"); } public float state(){ if (isBound && mService != null) { try { return mService.trackingState(); } catch (RemoteException e) { Log.e(TAG, "Could not resume tracking!",e); return -1; } } else Log.i(TAG, "No Service bound!"); return -1; } /** * Method for binding the Service with client */ public boolean connectService(){ mServiceConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { TrackingServiceManager.this.mService = ITrackingServiceRemote.Stub.asInterface(service); } } @Override public void onServiceDisconnected(ComponentName name) { if (mService != null) { mService = null; } } }; Intent mIntent = new Intent("test.de.android.tracker.action.intent.TrackingService"); this.isBound = this.mContext.bindService(mIntent, mServiceConnection, Context.BIND_AUTO_CREATE); return this.isBound; } public void disconnectService(){ this.mContext.unbindService(mServiceConnection); this.isBound = false; } } If i now try to call a method from an activity for example start(trackId) nothing happens. The binding is OK. When debugging it always runs into the startTracking() in the generated ITrackingServiceRemote.java file and not into my TrackingService class. Where is the problem? I can't find anything wrong. Thanks in advance! Tobias

    Read the article

< Previous Page | 1 2 3 4 5