Search Results

Search found 1259 results on 51 pages for 'jack lloyd'.

Page 10/51 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • What's the best way to return stuff from a PHP function, and simultaneously trigger a jQuery action?

    - by Jack Webb-Heller
    So the title is a tad ambiguous, but I'll try and give an example. Basically, I have an 'awards' system (similar to that of StackOverflow's badges) in my PHP/CodeIgniter site, and I want, as soon as an award is earned, a notification to appear to the user. Now I'm happy to have this appear on the next page load, but, ideally I'd like it to appear as soon as the award is transactioned since my site is mostly Ajax-powered and there may not be page reloads very often. The way the system works currently, is: 1) If the user does something to trigger the earning of an award, CodeIgniter does this: $params['user_id'] = $this->tank_auth->get_user_id(); $params['award_id'] = 1; // (I have a database table with different awards in) $this->awards->award($params); 2) My custom library, $this->awards, runs the award function: function award($params) { $sql = $this->ci->db->query("INSERT INTO users_awards (user_id, award_id) VALUES ('".$params['user_id']."','".$params['award_id']."') ON DUPLICATE KEY UPDATE duplicate=duplicate+1"); $awardinfo = $this->ci->db->query("SELECT * FROM awards WHERE id = ".$params['award_id']); // If it's the 'first time' the user has gotten the award (e.g. they've earnt it) if ($awardinfo->row('duplicate') == 0) { $params['title'] = $awardinfo->row('title'); $params['description'] = $awardinfo->row('description'); $params['iconpath'] = $awardinfo->row('iconpath'); $params['percentage'] = $awardinfo->row('percentage'); return $params; } } So, it awards the user (and if they've earnt it twice, updates a useless duplicate field by one), then checks if it's the first time they've earnt it (so it can alert them of the award). If so, it gets the variables (title of the award, the award description, the path to an icon to display for the award, and finally the percentage of users who have also got this award) and returns them as an array. So... that's that. Now I'd like to know, what's the best way to do this? Currently my Award-giving bit is called from a controller, but I guess if I want this to trigger via Ajax, then the code should be placed in a View file...? To sum it up: I need the returned award data to appear without a page refresh. What's the best way of doing this? (I'm already using jQuery on my page). Thanks very much everybody! Jack

    Read the article

  • How to Lookup For something main VBA

    - by gorPweN
    Hi, I wanna know how to Lookup For many number in a column A corresponding to a name in Column B By coding in VBA..And Write it in column C??? Thanks in advance..Im new in this... Exemple A B C 200-333 Jack 200-345 Lea 200-346 Fresh 200-347 Tide Jack 200-323 Tide Lea Fresh 200-344 Tide

    Read the article

  • what's the right way to bind sqldatasource to asp:label in asp.net 4.0?

    - by cskilbeck
    Is it possible using Eval? If so, can someone post a short fragment to illustrate? My SqlDataSource returns 1 record with 3 fields, I'd like to Format these into a string. eg: Record Field 'Name' = 'Jack' Field 'Amount' = 100 Field 'Date' = 12.02.2010 asp:Label text should end up being: Welcome Jack, last payment was 100 on 12.02.2010 if another control than asp:Label is appropriate, that would be good to know also.

    Read the article

  • iPhone: Grouped tables and navigation controller issues

    - by Jack Griffiths
    Hi there, I've set up a grouped table on my app, and pushing to new views works fine. Except for one thing. The titles and stack layout are all weird. Here's the breakdown: I have two sections in my table. When I tap on the first row in the first section, it takes me to the correct view, but the title of the new view is the name of the first row in the second section of the table. In turn, the second row in the first section's title is the second row in the second section's title. If I tap on the second row in the second section of the root view table, the navigation button goes to the second row in the first section of the table. So here's a diagram of my table: Table Section 1 Row 1 Row 2 Row 3 Table Section 2 Row A Row B Row C So if I tap on row 3, the title of the pushed view is Row C. The navigation button tells me to go back to Row 3, then eventually ending up at the root view. Here's my implementation file pushing the views: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //CSS if ([[arryClientSide objectAtIndex:indexPath.row] isEqual:@"CSS"]) { CSSViewController *css = [[CSSViewController alloc] initWithNibName:@"CSSViewController" bundle:nil]; [css setTitle:@"CSS"]; [self.navigationController pushViewController:css animated:YES]; } //HTML if ([[arryClientSide objectAtIndex:indexPath.row] isEqual:@"HTML"]) { HTMLViewController *html = [[HTMLViewController alloc] initWithNibName:@"HTMLViewController" bundle:nil]; [html setTitle:@"HTML"]; [self.navigationController pushViewController:html animated:YES]; } //JS if ([[arryClientSide objectAtIndex:indexPath.row] isEqual:@"JavaScript"]) { JSViewController *js = [[JSViewController alloc] initWithNibName:@"JSViewController" bundle:nil]; [js setTitle:@"JavaScript"]; [self.navigationController pushViewController:js animated:YES]; } //PHP if ([[arryServerSide objectAtIndex:indexPath.row] isEqual:@"PHP"]) { PHPViewController *php = [[PHPViewController alloc] initWithNibName:@"PHPViewController" bundle:nil]; [php setTitle:@"PHP"]; [self.navigationController pushViewController:php animated:YES]; } //SQL if ([[arryServerSide objectAtIndex:indexPath.row] isEqual:@"SQL"]) { SQLViewController *sql = [[SQLViewController alloc] initWithNibName:@"SQLViewController" bundle:nil]; [sql setTitle:@"SQL"]; [self.navigationController pushViewController:sql animated:YES]; } & the array feeding the table's data: - (void)viewDidLoad { [super viewDidLoad]; arryClientSide = [[NSArray alloc] initWithObjects:@"CSS",@"HTML",@"JavaScript",nil]; arryServerSide = [[NSArray alloc] initWithObjects:@"Objective-C", @"PHP",@"SQL",nil]; // arryResources = [[NSArray alloc] initWithObjects:@"HTML Colour Codes", @"Useful Resources", @"About",nil]; self.title = @"Select a Language"; [super viewDidLoad]; // Uncomment the following line to display an Edit button in the navigation bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem; } Any help would be greatly appreciated. Jack

    Read the article

  • American Modern Insurance Group recognized at 2010 INN VIP Best Practices Awards

    - by [email protected]
    Below: Helen Pitts (right), Oracle Insurance, congratulates Bruce Weisgerber, Munich Re, as he accepts a VIP Best Practices Award on behalf of American Modern Insurance Group.     Oracle Insurance Senior Product Marketing Manager Helen Pitts is attending the 2010 ACORD LOMA Insurance Forum this week at the Mandalay Bay Resort in Las Vegas, Nevada, and will be providing updates from the show floor. This is one of my favorite seasons of the year--insurance trade show season. It is a time to reconnect with peers, visit with partners, make new industry connections, and celebrate our customers' achievements. It's especially meaningful when we can share the experience of having one of our Oracle Insurance customers recognized for being an innovator in its business and in the industry. Congratulations to American Modern Insurance Group, part of the Munich Re Group. American Modern earned an Insurance Networking News (INN) 2010 VIP Best Practice Award yesterday evening during the 2010 ACORD LOMA Insurance Forum. The award recognizes an insurer's best practice for use of a specific technology and the role, if feasible, that ACORD data standards played as a part of their business and technology. American Modern received an Honorable Mention for leveraging the Oracle Documaker enterprise document automation solution to: Improve the quality of communications with customers in high value, high-touch lines of business Convert thousands of page elements or "forms" from their previous system, with near pixel-perfect accuracy Increase efficiency and reusability by storing all document elements (fonts, logos, approved wording, etc.) in one place Issue on-demand documents, such as address changes or policy transactions to multiple recipients at once Consolidate all customer communications onto a single platform Gain the ability to send documents to multiple recipients at once, further improving efficiency Empower agents to produce documents in real time via the Web, such as quotes, applications and policy documents, improving carrier-agent relationships Munich Re's Bruce Weisgerber accepted the award on behalf of American Modern from Lloyd Chumbly, vice president of standards at ACORD. In a press release issued after the ceremony Chumbly noted, "This award embodies a philosophy of efficiency--working smarter with standards, these insurers represent the 'best of the best' as chosen by a body of seasoned insurance industry professionals." We couldn't agree with you more, Lloyd. Congratulations again to American Modern on your continued innovation and success. You're definitely a VIP in our book! To learn more about how American Modern is putting its enterprise document automation strategy into practice, click here to read a case study. Helen Pitts is senior product marketing manager for Oracle Insurance.

    Read the article

  • SQL Saturday #157 - San Diego

    Southern California isn't all beach time. SQL Saturday comes to San Diego on Sept 15, 2012. Join fellow SQL Server pros for a day of learning. Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.

    Read the article

  • SQL in the City - Austin 2012

    A free day of training in Austin, TX with Grant Fritchey, Steve Jones and a few others. Join us to learn about SQL Server and how you can more efficiently work in your job every day. Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.

    Read the article

  • Fuzzy-String Search: Find misspelled information with T-SQL

    An optimized Damerau-Levenshtein Distance (DLD) algorithm for "fuzzy" string matching in Transact-SQL 2000-2008 Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.

    Read the article

  • SQL Server Resources - A list

    A great list of SQL Server resources that you can use to help you improve your knowledge or ask questions. Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.

    Read the article

  • Report Builder 3.0: Formatting the Elements in your Report

    here is a lot that can be done to make basic tabular reports more readable, using Microsoft's free Report Builder. Rob Sheldon continues his exploration of the power of this tool by showing how to format various elements within reports. Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.

    Read the article

  • SQL Server Unit Testing with tSQLt

    When one considers the amount of time and effort that Unit Testing consumes for the Database Developer, is surprising how few good SQL Server Test frameworks are around. tSQLt , which is open source and free to use, is one of the frameworks that provide a simple way to populate a table with test data as part of the unit test, and check the results with what should be expected. Sebastian Meine and Dennis Lloyd, who created tSQLt, explain

    Read the article

  • SQLSaturday #160 - Kalamazoo

    SQL Saturday comes back to Michigan. Come see Jeff Moden and others talk SQL Server on Sept 22, 2012. Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.

    Read the article

  • SQL Saturday #156 - Providence, RI

    Come visit Rhode Island and meet fellow SQL Server professionals from all over New England as SQL Saturday comes on Sept 15, 2012. Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.

    Read the article

  • SQL in the City - New York 2012

    Come join Grant Fritchey, Steve Jones and others for a free day of training in New York City on Sept 28, 2012. Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.

    Read the article

  • SQL Saturday #162 - Cambridge, UK

    Come to Cambridge in the UK for a free day of training on SQL Server. Steve won't be there, but plenty of other Red Gate'ers will be. Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.

    Read the article

  • Working with SQL Agent Durations

    SQL Agent stores duration in HHMMSS format - not always useful. Discover how to use Powershell, some basic math, and T-SQL to tame these unruly values. Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.

    Read the article

  • SQLskills training goes online worldwide (and free in September!)

    SQLskills is recording their knowledge in conjunction with Pluralsight for you to view from the time and place of your choosing. And it's free in September. Read more to find out how you can get access. Learn Agile Database Development Best PracticesAgile database development experts Sebastian Meine and Dennis Lloyd are running day-long classes designed to complement Red Gate’s SQL in the City US tour. Classes will be held in San Francisco, Chicago, Boston and Seattle. Register Now.

    Read the article

  • Silverlight Cream for February 13, 2011 -- #1046

    - by Dave Campbell
    In this Issue: Loek van den Ouweland, Colin Eberhardt, Rudi Grobler, Joost van Schaik, Mike Taulty(-2-, -3-), Deborah Kurata, David Kelley, Peter Foot, Samuel Jack(-2-), and WindowsPhoneGeek(-2-). Above the Fold: Silverlight: "Silverlight Simple MVVM Commanding" Deborah Kurata WP7: "WP7 CustomInputPrompt control with Cancel button" WindowsPhoneGeek Expression Blend: "Silverlight Templated Image Button with two images" Loek van den Ouweland Shoutouts: Dave Campbell posted a write-up about the project he's on and the use of Sterling: Sterling Object-Oriented Database for ISO 1.0 Released!... Also see Jeremy Likness' post on the 1.0 release: Sterling Object-Oriented Database 1.0 RTM Not necessarily Silverlight, but darn cool, a great control by Sasha Barber: WPF : A Weird 3d based control snoutholder announced new content: Windows Phone 7 QuickStarts Live! From SilverlightCream.com: Silverlight Templated Image Button with two images Loek van den Ouweland has a video tutorial up for creating an ImageButton with a hover state... Expression Blend coolness, and check out the external links he has to their training site. Windows Phone 7 Performance Measurements – Emulator vs. Hardware Colin Eberhardt's latest is a popular post comparing performance metrics between the WP7 emulator and a real device. Mileage may vary, but I'm pretty sure the overall results are conculsive, and should help the way you view your app as you're building in the emulator. WP7: WebClient vs HttpWebRequest Rudi Grobler's latest is a discussion of WebClient and HttpWebRequest, gives coding examples of each plus discussion of why you may choose one over the other... and pay attention to his comment about mobile providers. A Blendable Windows Phone 7 / Silverlight clipping behavior Joost van Schaik posted this WP7/Silverlight clipping behavior he developed because all the other solutions were not blendable. Another really useful piece of code from Joost! Blend Bits 22–Being Stylish Mike Taulty has 3 more episodes in his Blend Bits series... first up is on one Styles... explicit, implicit, inheriting... you name it, he's covering it! Blend Bits 23–Templating Part 1 MIke Taulty then has the beginning of a series within his Blend Bits series on Templating. This is something you just have to either bite the bullet and go with Blend to do, or consume someone else's work. Mike shows us how to do it ourself by tweaking the visual aspects of a checkbox Blend Bits 24–Templating Part 2 In part 2 of the Templating series, Mike Taulty digs deeper into Blend and cracks open the Listbox control to take a bunch of the inner elements out for a spin... fun stuff and great tutorial, Mike! Silverlight Simple MVVM Commanding Deborah Kurata has another great MVVM post up... if you don't have your head wrapped around commanding yet, this is a good place to start that process... VB and C# as always. App Development for Windows Phone 7 101 David Kelley goes through the basics of producing a WP7 app both from the Silverlight and XNA side... good info and good external links to get you going. Copyable TextBlock for Windows Phone Peter Foot takes a look at the Copy/Paste functionality in WP7 and how to apply it to a TextBlock... which is NOT an out-of-the-box solution. How to deploy to, and debug, multiple instances of the Windows Phone 7 emulator Samuel Jack has a couple posts up this week... first is this clever one on running multiple copies of the emulator at once... too cool for debugging a multi-player game! Multi-player enabling my Windows Phone 7 game: Day 3 – The Server Side Samuel Jack's latest is a detailed look at his day 3 adventure of taking his multi-player game to WP7... lots of information and external links... what do you say, give him another day? :) WP7 CustomInputPrompt control with Cancel button WindowsPhoneGeek has a couple more posts up... first is this "CustomInputPrompt" control based off the InputPrompt from Coding4Fun. Implementing Windows Phone 7 DataTemplateSelector and CustomDataTemplateSelector In his latest post, WindowsPhoneGeek writes a DataTemplateSelector to allow different data templates for different list elements based on the type of the element. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Bose USB audio: crackling popping sound, eventually die

    - by Richard Barrett
    I've been trying to troubleshoot this issue for a while now. Any help would be much appreciated. I'm having trouble getting my Bose "Companion 5 multimedia speakers" working with my installation of Ubuntu 12.04 (link to Bose product here: http://www.bose.com/controller?url=/shop_online/digital_music_systems/computer_speakers/companion_5/index.jsp ). The issue seems to be low level (not just Ubuntu). What happens: When I boot into Ubuntu, I can get Rhythm box to play ok. However, if I try anything else (an .avi file, a webpage, or Clementine player with mp3 files) I get crackling, popping, or choppy sounds. If I move the mouse around, especially if it seems graphic intensive, the problem gets worse (more crackling noises). The more taxing it appears to be, the more likely it is that the sound will just die altogether until I reboot. For some reason the videos at www.bloomberg.com seem especially bad for it (my sound normally goes dead in under 45 seconds and won't work until reboot). Both my desktop running Ubuntu 12.04 and my laptop (running the same) have the same crackling problem. Troubleshooting so far: A friend of mine who knows linux well tried to solve it for me without any luck. He took pulseaudio out of the equation, but still had the problem just using AlSA. Among the many things he tried was adjusting the latency, but that didn't help either. I've also tried things like adjusting the USB device settings in the config file from -2 to -1 so that it will use my USB sound and I also commented out the lines that would stop that. These don't do anything. (That really seems like it's for someone who is getting no sound at all, so it's not surprising this won't work.) My friend's laptop running his Archlinux could play my Bose USB speakers without any problems. I also tried setting my daemon.conf file to use 6 channels (based on this http://lotphelp.com/lotp/configure-ubuntu-51-surround-sound ) but that didn't work either. I recently used a DVD to boot into Ubuntu Studio 12.04 (because it uses a live audio kernel) and this happened: I got perfect sound for a minute or two When I started moving windows around while sound was playing, the sound died again. Perhaps more interesting: There is a headphone out jack on the Bose system. When I use it, the audio is perfect for all applications (even the deadly bloomberg.com videos with .avi playing at the same time and moving around windows). Also, there is an audio-in jack on the Bose system. I can use a male-to-male mini jack to go from my soundcard's output to the Bose input and then all sound works perfectly. -However, it still requires the Bose to be plugged in to USB, otherwise I lose all sound. Any thoughts? Any suggestions for trouble shooting? (Or any suggestions for somewhere else to post to solve this?) Any logs or other files I can provide to help someone help me work this out? Your help is much appreciated! Rick BTW: I sometimes get people posting responses like "My Bose USB system works great with Ubuntu 12.04," without any more details. Is there anything I should ask such people to narrow down my problem? (It's kind of annoying to hear such a response because it doesn't help solve my problem.)

    Read the article

  • Silverlight Cream for February 06, 2011 -- #1042

    - by Dave Campbell
    In this Issue: Mike Taulty, Timmy Kokke, Laurent Bugnion, Arik Poznanski, Deyan Ginev, Deborah Kurata(-2-), Johnny Tordgeman, Roy Dallal, Jaime Rodriguez, Samuel Jack(-2-), James Ashley. Above the Fold: Silverlight: "Customizing Silverlight properties for Visual Designers" Timmy Kokke WP7: "Back button press when using webbrowser control in WP7" Jaime Rodriguez Expression Blend: "Blend Bits 21–Importing from Photoshop & Illustrator…" Mike Taulty From SilverlightCream.com: Blend Bits 21–Importing from Photoshop & Illustrator… Mike Taulty is up to 21 episodes on his Blend Bits sequence now, and this one is about using Blend's import capability, such as a .psd file with all the layers intact. Customizing Silverlight properties for Visual Designers Timmy Kokke has part 1 of 2 parts on making your Silverlight control properties in design surfaces such as Visual Studio designer or Expression Blend. An error when installing MVVM Light templates for VS10 Express Laurent Bugnion has released a new version of MVVMLight that resolves a problem with VS2010 Express version of the templates... no problem with anything else. Reading RSS items on Windows Phone 7 Arik Poznanski has a post up about reading RSS on a WP7, but better yet, he also has code for a helper class that you can grab, plus explanation of wiring it up. Integrating your Windows Phone unit tests with MSBuild #4: The WP7 Unit Test Application Deyan Ginev has a post up about Telerik's WP7 test app that outputs test results in XML from the emulator so they can be integrated with the MSBuild log. Accessing Data in a Silverlight Application: EF I apprently missed this post by Deborah Kurata last week on bringing data into your Silverlight app via Entity Frameworks... good detailed tutorial in VB and C#. Updating Data in a Silverlight Application: EF In Deborah Kurata's latest post, she is continuing with Entity Frameworks by demonstrating updating to the database... full source code will be produced in a later post. Fun with Silverlight and SharePoint 2010 Ribbon Control - Part 2 - An In Depth Look At The Ribbon Control Johnny Tordgeman has Part 2 of his Silverlight and Sharepoint 2010 Ribbon up... taking a deep-dive into the ribbon... great explanation of the attributes, code included. Geographic Coordinates Systems Roy Dallal has some Geo code up that's not necessarily Silverlight, but very cool if you're doing any GIS programming... ya gotta know the coordinate systems! Back button press when using webbrowser control in WP7 Jaime Rodriguez has a post up discussing the much-lamented back-button action in the certification requirements and how to deal with that in a web browser app. Multiplayer-enabling my Windows Phone 7 game: Day 1 Samuel Jack challenged himself to build a WP7 game in 3 days... now he's challenging himself to make it multiplayer in 3 days... this first hour-to-hour post is research of networking and an azure server-side solution. Multiplayer-enabling my Windows Phone 7 game: Day 2–Building a UI with XPF Day 2 for Samuel Jack getting the multiplayer portion of his game working in 3 days.. this day involves getting up-to-speed with XPF. How to Hotwire your WP7 Phone Battery Did you realize if you run your WP7 battery completely down that you can't charge it? James Ashley reports that circumstance, and how he resolved it. Stay in the 'Light! Twitter SilverlightNews | Twitter WynApse | WynApse.com | Tagged Posts | SilverlightCream Join me @ SilverlightCream | Phoenix Silverlight User Group Technorati Tags: Silverlight    Silverlight 3    Silverlight 4    Windows Phone MIX10

    Read the article

  • Something is making my page perform an Ajax call multiple times... [read: I've never been more frust

    - by Jack Webb-Heller
    NOTE: This is a long question. I've explained all the 'basics' at the top and then there's some further (optional) information for if you need it. Hi folks Basically last night this started happening at about 9PM whilst I was trying to restructure my code to make it a bit nicer for the designer to add a few bits to. I tried to fix it until 2AM at which point I gave up. Came back to it this morning, still baffled. I'll be honest with you, I'm a pretty bad Javascript developer. Since starting this project Javascript has been completely new to me and I've just learn as I went along. So please forgive me if my code structure is really bad (perhaps give a couple of pointers on how to improve it?). So, to the problem: to reproduce it, visit http://furnace.howcode.com (it's far from complete). This problem is a little confusing but I'd really appreciate the help. So in the second column you'll see three tabs The 'Newest' tab is selected by default. Scroll to the bottom, and 3 further results should be dynamically fetched via Ajax. Now click on the 'Top Rated' tab. You'll see all the results, but ordered by rating Scroll to the bottom of 'Top Rated'. You'll see SIX results returned. This is where it goes wrong. Only a further three should be returned (there are 18 entries in total). If you're observant you'll notice two 'blocks' of 3 returned. The first 'block' is the second page of results from the 'Newest' tab. The second block is what I just want returned. Did that make any sense? Never mind! So basically I checked this out in Firebug. What happens is, from a 'Clean' page (first load, nothing done) it calls ONE POST request to http://furnace.howcode.com/code/loadmore . But every time you load a new one of the tabs, it makes an ADDITIONAL POST request each time where there should normally only be ONE. So, can you help me? I'd really appreciate it! At this point you could start independent investigation or read on for a little further (optional) information. Thanks! Jack Further Info (may be irrelevant but here for reference): It's almost like there's some Javascript code or something being left behind that duplicates it each time. I thought it might be this code that I use to detect when the browser is scrolled to the bottom: var col = $('#col2'); col.scroll(function(){ if (col.outerHeight() == (col.get(0).scrollHeight - col.scrollTop())) loadMore(1); }); So what I thought was that code was left behind, and so every time you scroll #col2 (which contains different data for each tab) it detected that and added it for #newest as well. So, I made each tab click give #col2 a dynamic class - either .newestcol, .featuredcol, or .topratedcol. And then I changed the var col=$('.newestcol');dynamically so it would only detect it individually for each tab (makin' any sense?!). But hey, that didn't do anything. Another useful tidbit: here's the PHP for http://furnace.howcode.com/code/loadmore: $kind = $this->input->post('kind'); if ($kind == 1){ // kind is 1 - newest $start = $this->input->post('currentpage'); $data['query'] = "SELECT code.id AS codeid, code.title AS codetitle, code.summary AS codesummary, code.author AS codeauthor, code.rating AS rating, code.date, code_tags.*, tags.*, users.firstname AS authorname, users.id AS authorid, GROUP_CONCAT(tags.tag SEPARATOR ', ') AS taggroup FROM code, code_tags, tags, users WHERE users.id = code.author AND code_tags.code_id = code.id AND tags.id = code_tags.tag_id GROUP BY code_id ORDER BY date DESC LIMIT $start, 15 "; $this->load->view('code/ajaxlist',$data); } elseif ($kind == 2) { // kind is 2 - featured So my jQuery code sends a variable 'kind'. If it's 1, it runs the query for Newest, etc. etc. The PHP code for furnace.howcode.com/code/ajaxlist is: <?php // Our query base // SELECT * FROM code ORDER BY date DESC $query = $this->db->query($query); foreach($query->result() as $row) { ?> <script type="text/javascript"> $('#title-<?php echo $row->codeid;?>').click(function() { var form_data = { id: <?php echo $row->codeid; ?> }; $('#col3').fadeOut('slow', function() { $.ajax({ url: "<?php echo site_url('code/viewajax');?>", type: 'POST', data: form_data, success: function(msg) { $('#col3').html(msg); $('#col3').fadeIn('fast'); } }); }); }); </script> <div class="result"> <div class="resulttext"> <div id="title-<?php echo $row->codeid; ?>" class="title"> <?php echo anchor('#',$row->codetitle); ?> </div> <div class="summary"> <?php echo $row->codesummary; ?> </div> <!-- Now insert the 5-star rating system --> <?php include($_SERVER['DOCUMENT_ROOT']."/fivestars/5star.php");?> <div class="bottom"> <div class="author"> Submitted by <?php echo anchor('auth/profile/'.$row->authorid,''.$row->authorname);?> </div> <?php // Now we need to take the GROUP_CONCATted tags and split them using the magic of PHP into seperate tags $tagarray = explode(", ", $row->taggroup); foreach ($tagarray as $tag) { ?> <div class="tagbutton" href="#"> <span><?php echo $tag; ?></span> </div> <?php } ?> </div> </div> </div> <?php } echo "&nbsp;";?> <script type="text/javascript"> var newpage = <?php echo $this->input->post('currentpage') + 15;?>; </script> So that's everything in PHP. The rest you should be able to view with Firebug or by viewing the Source code. I've put all the Tab/clicking/Ajaxloading bits in the tags at the very bottom. There's a comment before it all kicks off. Thanks so much for your help!

    Read the article

  • PHP inserting Apostrophes where it shouldn't

    - by Jack W-H
    Hi folks Not too sure what's going on here as this doesn't seem like standard practise to me. But basically I have a basic database thingy going on that lets users submit code snippets. They can provide up to 5 tags for their submission. Now I'm still learning so please forgive me if this is obvious! Here's the PHP script that makes it all work (note there may be some CodeIgniter specific functions in there): function submitform() { $this->load->helper(array('form', 'url')); $this->load->library('form_validation'); $this->load->database(); $this->form_validation->set_error_delimiters('<p style="color:#FF0000;">', '</p>'); $this->form_validation->set_rules('title', 'Title', 'trim|required|min_length[5]|max_length[255]|xss_clean'); $this->form_validation->set_rules('summary', 'Summary', 'trim|required|min_length[5]|max_length[255]|xss_clean'); $this->form_validation->set_rules('bbcode', 'Code', 'required|min_length[5]'); // No XSS clean (or <script> tags etc. are gone) $this->form_validation->set_rules('tags', 'Tags', 'trim|xss_clean|required|max_length[254]'); if ($this->form_validation->run() == FALSE) { // Do some stuff if it fails } else { // User's input values $title = $this->db->escape(set_value('title')); $summary = $this->db->escape(set_value('summary')); $code = $this->db->escape(set_value('bbcode')); $tags = $this->db->escape(set_value('tags')); // Stop things like <script> tags working $codesanitised = htmlspecialchars($code); // Other values to be entered $author = $this->tank_auth->get_user_id(); $bi1 = ""; $bi2 = ""; // This long messy bit basically sees which browsers the code is compatible with. if (isset($_POST['IE6'])) {$bi1 .= "IE6, "; $bi2 .= "1, ";} else {$bi1 .= "IE6, "; $bi2 .= "NULL, ";} if (isset($_POST['IE7'])) {$bi1 .= "IE7, "; $bi2 .= "1, ";} else {$bi1 .= "IE7, "; $bi2 .= "NULL, ";} if (isset($_POST['IE8'])) {$bi1 .= "IE8, "; $bi2 .= "1, ";} else {$bi1 .= "IE8, "; $bi2 .= "NULL, ";} if (isset($_POST['FF2'])) {$bi1 .= "FF2, "; $bi2 .= "1, ";} else {$bi1 .= "FF2, "; $bi2 .= "NULL, ";} if (isset($_POST['FF3'])) {$bi1 .= "FF3, "; $bi2 .= "1, ";} else {$bi1 .= "FF3, "; $bi2 .= "NULL, ";} if (isset($_POST['SA3'])) {$bi1 .= "SA3, "; $bi2 .= "1, ";} else {$bi1 .= "SA3, "; $bi2 .= "NULL, ";} if (isset($_POST['SA4'])) {$bi1 .= "SA4, "; $bi2 .= "1, ";} else {$bi1 .= "SA4, "; $bi2 .= "NULL, ";} if (isset($_POST['CHR'])) {$bi1 .= "CHR, "; $bi2 .= "1, ";} else {$bi1 .= "CHR, "; $bi2 .= "NULL, ";} if (isset($_POST['OPE'])) {$bi1 .= "OPE, "; $bi2 .= "1, ";} else {$bi1 .= "OPE, "; $bi2 .= "NULL, ";} if (isset($_POST['OTH'])) {$bi1 .= "OTH, "; $bi2 .= "1, ";} else {$bi1 .= "OTH, "; $bi2 .= "NULL, ";} // $b1 is $bi1 without the last two characters (, ) which would cause a query error $b1 = substr($bi1, 0, -2); $b2 = substr($bi2, 0, -2); // :::::::::::THIS IS WHERE THE IMPORTANT STUFF IS, STACKOVERFLOW READERS:::::::::: // Split up all the words in $tags into individual variables - each tag is seperated with a space $pieces = explode(" ", $tags); // Usage: // echo $pieces[0]; // piece1 etc $ti1 = ""; $ti2 = ""; // Now we'll do similar to what we did with the compatible browsers to generate a bit of a query string if ($pieces[0]!=NULL) {$ti1 .= "tag1, "; $ti2 .= "$pieces[0], ";} else {$ti1 .= "tag1, "; $ti2 .= "NULL, ";} if ($pieces[1]!=NULL) {$ti1 .= "tag2, "; $ti2 .= "$pieces[1], ";} else {$ti1 .= "tag2, "; $ti2 .= "NULL, ";} if ($pieces[2]!=NULL) {$ti1 .= "tag3, "; $ti2 .= "$pieces[2], ";} else {$ti1 .= "tag3, "; $ti2 .= "NULL, ";} if ($pieces[3]!=NULL) {$ti1 .= "tag4, "; $ti2 .= "$pieces[3], ";} else {$ti1 .= "tag4, "; $ti2 .= "NULL, ";} if ($pieces[4]!=NULL) {$ti1 .= "tag5, "; $ti2 .= "$pieces[4], ";} else {$ti1 .= "tag5, "; $ti2 .= "NULL, ";} $t1 = substr($ti1, 0, -2); $t2 = substr($ti2, 0, -2); $sql = "INSERT INTO code (id, title, author, summary, code, date, $t1, $b1) VALUES ('', $title, $author, $summary, $codesanitised, NOW(), $t2, $b2)"; $this->db->query($sql); $this->load->view('subviews/template/headerview'); $this->load->view('subviews/template/menuview'); $this->load->view('subviews/template/sidebar'); $this->load->view('thanksforsubmission'); $this->load->view('subviews/template/footerview'); } } Sorry about that boring drivel of code there. I realise I probably have a few bad practises in there - please point them out if so. This is what the outputted query looks like (it results in an error and isn't queried at all): A Database Error Occurred Error Number: 1136 Column count doesn't match value count at row 1 INSERT INTO code (id, title, author, summary, code, date, tag1, tag2, tag3, tag4, tag5, IE6, IE7, IE8, FF2, FF3, SA3, SA4, CHR, OPE, OTH) VALUES ('', 'test2', 1, 'test2', 'test2 ', NOW(), 'test2, test2, test2, test2, test2', NULL, NULL, 1, 1, 1, 1, 1, 1, 1, NULL) You'll see at the bit after NOW(), 'test2, test2, test2, test2, test2' - I never asked it to put all that in apostrophes. Did I? What I could do is put each of those lines like this: if ($pieces[0]!=NULL) {$ti1 .= "tag1, "; $ti2 .= "'$pieces[0]', ";} else {$ti1 .= "tag1, "; $ti2 .= "NULL, ";} With single quotes around $pieces[0] etc. - but then my problem is that this kinda fails when the user only enters 4 tags, or 3, or whatever. Sorry if that's the worst phrased question in history, I tried, but my brain has turned to mush. Thanks for your help! Jack

    Read the article

  • -[__NSCFArray objectForKeyedSubscript:] error?

    - by jckly
    I'm trying to get the data from a JSON response object in my iOS app after I log in. I keep getting this error though. Error: 'NSInvalidArgumentException', reason: '-[__NSCFArray objectForKeyedSubscript:]: unrecognized selector sent to instance 0x8fc29b0' Here is my code for the request, I'm using AFNetworking: self.operation = [manager GET:urlString parameters:params success:^(AFHTTPRequestOperation *operation, id responseObject) { NSDictionary *JSON = (NSDictionary *)responseObject; NSDictionary *user = JSON[@"user"]; NSString *token = user[@"auth_token"]; NSString *userID = user[@"id"]; // NSString *avatarURL = user[@"avatar_url"]; // weakSelf.credentialStore.avatarURL = avatarURL; weakSelf.credentialStore.authToken = token; weakSelf.credentialStore.userId = userID; weakSelf.credentialStore.username = self.usernameField.text; weakSelf.credentialStore.password = self.passwordField.text; [SVProgressHUD dismiss]; [self dismissViewControllerAnimated:YES completion:nil]; } failure:^(AFHTTPRequestOperation *operation, NSError *error) { if (operation.isCancelled) { return; } [SVProgressHUD showErrorWithStatus:@"Login Failed"]; NSLog(@"%@", error); }]; What the JSON response object looks like logged: <__NSCFArray 0x8cac0b0>( { user = { "auth_token" = b3a18e0fb278739649a23f0ae325fee1e29fe5d6; email = "[email protected]"; id = 1; username = jack; }; } ) I'm converting the array to a Dictionary using pointers like this: NSDictionary *JSON = (NSDictionary *)responseObject; I'm new to iOS, apologies if problem is obvious. Thanks for any help.

    Read the article

  • Remove duplicates from a sorted ArrayList while keeping some elements from the duplicates

    - by js82
    Okay at first I thought this would be pretty straightforward. But I can't think of an efficient way to solve this. I figured a brute force way to solve this but that's not very elegant. I have an ArrayList. Contacts is a VO class that has multiple members - name, regions, id. There are duplicates in ArrayList because different regions appear multiple times. The list is sorted by ID. Here is an example: Entry 0 - Name: John Smith; Region: N; ID: 1 Entry 1 - Name: John Smith; Region: MW; ID: 1 Entry 2 - Name: John Smith; Region: S; ID: 1 Entry 3 - Name: Jane Doe; Region: NULL; ID: 2 Entry 4 - Name: Jack Black; Region: N; ID: 3 Entry 6 - Name: Jack Black; Region: MW; ID: 3 Entry 7 - Name: Joe Don; Region: NE; ID: 4 I want to transform the list to below by combining duplicate regions together for the same ID. Therefore, the final list should have only 4 distinct elements with the regions combined. So the output should look like this:- Entry 0 - Name: John Smith; Region: N,MW,S; ID: 1 Entry 1 - Name: Jane Doe; Region: NULL; ID: 2 Entry 2 - Name: Jack Black; Region: N,MW; ID: 3 Entry 3 - Name: Joe Don; Region: NE; ID: 4 What are your thoughts on the optimal way to solve this? I am not looking for actual code but ideas or tips to go about the best way to get it done. Thanks for your time!!!

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >