Search Results

Search found 147 results on 6 pages for 'xerxes cameron'.

Page 4/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • Saving tags into a database table in CakePHP

    - by Cameron
    I have the following setup for my CakePHP app: Posts id title content Topics id title Topic_Posts id topic_id post_id So basically I have a table of Topics (tags) that are all unique and have an id. And then they can be attached to post using the Topic_Posts join table. When a user creates a new post they will fill in the topics by typing them in to a textarea separated by a comma which will then save these into the Topics table if they do not already exist and then save the references into the Topic_posts table. I have the models set up like so: Post model: class Post extends AppModel { public $name = 'Post'; public $hasAndBelongsToMany = array( 'Topic' => array('with' => 'TopicPost') ); } Topic model: class Topic extends AppModel { public $hasMany = array( 'TopicPost' ); } TopicPost model: class TopicPost extends AppModel { public $belongsTo = array( 'Topic', 'Post' ); } And for the New post method I have this so far: public function add() { if ($this->request->is('post')) { //$this->Post->create(); if ($this->Post->saveAll($this->request->data)) { // Redirect the user to the newly created post (pass the slug for performance) $this->redirect(array('controller'=>'posts','action'=>'view','id'=>$this->Post->id)); } else { $this->Session->setFlash('Server broke!'); } } } As you can see I have used saveAll but how do I go about dealing with the Topic data?

    Read the article

  • jquery drag and drop animation

    - by Cameron
    I have some UI functionality for drag and drop, but when an element is dropped, the animation makes it flit about all over the place for a split second before it appears in the newly dropped location. Can anyone advise how to tackle this, so that the draggable element moves more cleanly into place on success? ... success : function() { $(ui.draggable) .parent().droppable("option", "disabled", false) .end() .appendTo(droppable) .droppable("option", "disabled", true); }, ...

    Read the article

  • Strategy for wiring up events?

    - by Jeffrey Cameron
    I'm using Ninject (1.5 ... soon to be 2) and I'm curious how other people use Ninject or other IoC containers to help wire up events to objects? It seems to me in my code that I'm doing it herky-jerky all over the place and would love some advice on how to clean it up a bit. What are people doing out there to manage this?

    Read the article

  • hasAndBelongsToMany only working one way

    - by Cameron
    In my application I have users that are able to be friends with other users. This is controlled with a users table and a friends_users table. The friends_users table has the following columns: id, user_id, friend_id, status And the model User looks like: public $hasAndBelongsToMany = array( 'Friend'=>array( 'className' => 'User', 'joinTable' => 'friends_users', 'foreignKey' => 'user_id', 'associationForeignKey' => 'friend_id' ) ); This seems to work fine when viewing the Users for a user who is in the user_id column, but doesn't work the other way around, i.e. in reverse... Any ideas why? Here is the method I use to list the friends for a user: $user = $this->User->find('first', array( 'conditions' => array('User.id' => $this->Auth->user('id')), 'contain'=>'Profile' )); $friends = $this->User->find('first', array( 'conditions'=>array( 'User.id'=>$user['User']['id'] ), 'contain'=>array( 'Profile', 'Friend'=>array( 'Profile', 'conditions'=>array( 'FriendsUser.status'=>1 ) ) ) ) ); $this->set('friends', $friends);

    Read the article

  • HTACCESS Rewrite on directories

    - by Cameron
    I have the following code in my Root htaccess file RewriteCond %{HTTP_HOST} ^paperviewmagazine.com RewriteRule (.*) http://www.paperviewmagazine.com/$1 [R=301,L] It works fine for the main site, but for my forums at /forums/ if someone misses off the www it will show the page and not redirect to the www.paperviewmagazine.com/forums/ instead. I need to force the WWW to prevent anyone from logging in by accident on the non-www as it wont have the correct cookie credentials for accessing the site at www./forums/ Can anyone help? Thanks.

    Read the article

  • WordPress Custom Taxonomies

    - by Cameron
    I have the following code to build a custom taxonomy for my portfolio: add_action( 'init', 'create_pc_db_taxonomies', 0 ); function create_pc_db_taxonomies() { register_taxonomy( 'type', 'post', array( 'hierarchical' => true, 'label' => 'Type', 'query_var' => true, 'rewrite' => array( 'slug' => 'type' ) ) ); } I have created a portfolio category on my site (I removed the /category/ base) and have created some items and set the custom taxonomies against them. So I get the following setup: http://domain.com/portfolio/item1/ but what I want is for the taxonomy links to look like this: http://domain.com/portfolio/type/web and then this will show a list of portfolio items related to the that type. At the moment they are root like http://domain.com/type/web I have tried add portfolio/type as the taxonomy slug but it just creates a 404 but i'm pretty sure this is the wrong way of doing it anyways. Any help? Thanks

    Read the article

  • Should I denormalize a has_many has_many?

    - by Cameron
    I have this: class User < ActiveRecord::Base has_many :serials has_many :sites, :through => :series end class Serial < ActiveRecord::Base belongs_to :user belongs_to :site has_many :episodes end class Site < ActiveRecord::Base has_many :serials has_many :users, :through => :serials end class Episode < ActiveRecord::Base belongs_to :serial end I would like to do some operations on User.serials.episodes but I know this would mean all sorts of clever tricks. I could in theory just put all the episode data into serial (denormalize) and then group_by Site when needed. If I have a lot of episodes that I need to query on would this be a bad idea? thanks

    Read the article

  • How to append to an array that contains blank spaces - Java

    - by Cameron Townley
    I'm trying to append to a char[] array that contains blank spaces on the end. The char array for example contains the characters 'aaa'. When I append the first time the method functions properly and outputs 'aaabbb'. The initial capacity of the array is set to 80 or multiples of 80. The second time I try and append my output looks like"aaabbb bbb". Any psuedocode would be great.

    Read the article

  • How can I get model names from inside my app?

    - by Cameron
    I have a bunch of models in a sub-directory that inherit from a model in the models root directory. I want to be able to set a class variable in another model that lists each inherited model class. i.e @@groups = sub_models.map do { |model| model.class.to_s } Not sure how to get at this info though...

    Read the article

  • Replace Spring.Net IoC with another Container (e.g. Ninject)

    - by Jeffrey Cameron
    Hey all, I'm curious to know if it's possible to replace Spring.Net's built-in IoC container with Ninject. We use Ninject on my team for IoC in our other projects so I would like to continue using that container if possible. Is this possible? Has anyone written a Ninject-Spring.Net Adapter?? Edit I like many parts of the Spring.Net package (the data access, transactions, etc.) but I don't really like the dependency injection container. I would like to replace that with Ninject Thanks

    Read the article

  • ASP.NET MVC Query Help

    - by Cameron
    I have the following Index method on my app that shows a bunch of articles: public ActionResult Index(String query) { var ArticleQuery = from m in _db.ArticleSet select m; if (!string.IsNullOrEmpty(query)) { ArticleQuery = ArticleQuery.Where(m => m.headline.Contains(query)); } //ArticleQuery = ArticleQuery.OrderBy(m.posted descending); return View(ArticleQuery.ToList()); } It also doubles as a search mechanism by grabbing a query string if it exists. Problem 1.) The OrderBy does not work, what do I need to change it to get it to show the results by posted date in descending order. Problem 2.) I am going to adding a VERY SIMPLE pagination, and therefore only want to show 4 results per page. How would I be best going about this? Thanks EDIT: In addition to problem 2, I'm looking for a simple Helper class solution to implement said pagination into my current code. This ones looks very good (http://weblogs.asp.net/andrewrea/archive/2008/07/01/asp-net-mvc-quot-pager-quot-html-helper.aspx), but how would I implement it into my application. Thanks.

    Read the article

  • jQuery Toggle Help

    - by Cameron
    I have the following code: $(document).ready(function() { // Manage sidebar category display jQuery("#categories > ul > li.cat-item").each(function(){ var item; if ( jQuery(this).has("ul").length ) { item = jQuery("<span class='plus'>+</span>").click(function(e){ jQuery(this) .text( jQuery(this).text() === "+" ? "-" : "+" ) .parent().next().toggle(); return false; }); jQuery(this).find(".children").hide(); } else { item = jQuery("<span class='plus'>&nbsp;</span>"); } jQuery(this).children("a").prepend( item ); }); }); This creates a sort of toggle system for my categories. But it will only work with 2 levels deep, what I need it to do is work with unlimited levels.

    Read the article

  • Php Syntax Error

    - by Jeff Cameron
    I'm trying to update a table in php and I keep getting syntax errors. Here's what I've got: if (isset($_POST['inspect'])) { // get gis_id from pole table to update fm_poles $sql = "select gis_id from poles where pole_number = '".$_GET['polenumber']."'"; $rs = pg_query($sql) or die('Query failed: ' . pg_last_error()); $gisid = $row['gis_id']; pg_free_result($rs); // update fm_poles $sql = "update fm_poles set inspect ='".$_POST['inspect']."',co_date = '".$_POST['co_date']."',size = '".$_POST['size']."',date = ".$_POST['date'].",brand ='".$_POST['brand']."',backspan = ".$_POST['backspan']." WHERE gis_id = ".$gisid.""; print $sql."<BR>\n"; $rs = pg_query($sql) or die('Query failed: ' . pg_last_error()); pg_free_result($rs); } This is the error it gives me: update fm_poles set inspect ='20120208',co_date = '20030710',size = '30-5',date = 0,brand ='test',backspan = 300 WHERE gis_id = The error message: Query failed: ERROR: syntax error at end of input at character 129

    Read the article

  • ASP.NET MVC Search

    - by Cameron
    Hi I'm building a very simple search system using ASP.NET MVC. I had it originally work by doing all the logic inside the controller but I am now moving the code piece by piece into a repository. Can anyone help me do this. Thanks. Here is the original Action Result that was in the controller. public ActionResult Index(String query) { var ArticleQuery = from m in _db.ArticleSet select m; if (!string.IsNullOrEmpty(query)) { ArticleQuery = ArticleQuery.Where(m => m.headline.Contains(query) orderby m.posted descending); } return View(ArticleQuery.ToList()); } As you can see, the Index method is used for both the initial list of articles and also for the search results (they use the same view). In the new system the code in the controller is as follows: public ActionResult Index() { return View(_repository.ListAll()); } The Repository has the following code: public IList<Article> ListAll() { var ArticleQuery = (from m in _db.ArticleSet orderby m.posted descending select m); return ArticleQuery.ToList(); } and the Interface has the following code: public interface INewsRepository { IList<Article> ListAll(); } So what I need to do is now add in the search query stuff into the repository/controller methods using this new way. Can anyone help? Thanks.

    Read the article

  • sprintf and % signs in text

    - by Cameron Conner
    A problem I recently ran into was that when trying to update a field in my database using this code would not work. I traced it back to having a % sign in the text being updated ($note, then $note_escaped)... Inserting it with sprintf worked fine though. Should I not be using sprintf for updates, or should it be formed differently? I did some searching but couldn't come up with anything. $id = mysql_real_escape_string($id); $note_escaped = mysql_real_escape_string($note); $editedby = mysql_real_escape_string($author); $editdate = mysql_real_escape_string($date); //insert info from form into database $query= sprintf("UPDATE notes_$suffix SET note='$note_escaped', editedby='$editedby', editdate='$editdate' WHERE id='$id' LIMIT 1"); Thanks much!

    Read the article

  • Fast, lightweight HTML parser for C++

    - by Jen
    I'm looking for a fast, lightweight open-source HTML parser -- something along the lines of a non-validating SAX parser (except, of course, for HTML). The answers to this question cover a parser that generates a DOM (don't want that), and these answers suggest conforming the HTML to XML before sending it to Xerxes (can't do that in my case). Any suggestions?

    Read the article

  • How can I generate sql inserts from pipe delimited data?

    - by user568866
    Given a set of delimited data in the following format: 1|Star Wars: Episode IV - A New Hope|1977|Action,Sci-Fi|George Lucas 2|Titanic|1997|Drama,History,Romance|James Cameron How can I generate sql insert statements in this format? insert into table values(1,"Star Wars: Episode IV - A New Hope",1977","Action,Sci-Fi","George Lucas",0); insert into table values(2,"Titanic",1997,"Drama,History,Romance","James Cameron",0); To simplify the problem, let's allow for a parameter to tell which columns are text or numeric. (e.g. 0,1,0,1,1)

    Read the article

  • Use XQuery to Access XML in Emacs

    - by Gregory Burd
    There you are working on a multi-MB/GB/TB XML document or set of documents, you want to be able to quickly query the content but you don't want to load the XML into a full-blown XML database, the time spent setting things up is simply too expensive. Why not combine a great open source editor, Emacs, and a great XML XQuery engine, Berkeley DB XML? That is exactly what Donnie Cameron did. Give it a try.

    Read the article

  • links for 2010-03-24

    - by Bob Rhubart
    @dhinchcliffe: When online communities go to work "As we see a growing set of examples of successful online communities in the enterprise space (both internally and externally), the broad outlines are emerging of what is turning into a vital new channel for innovation, business agility, customer relationships, and productive output for most organizations: Online communities as one of the most potent new ways to achieve business objectives, both in terms of cost and quality." -- Dion Hinchcliffe (tags: enterprisearchitecture entarch enterprise2.0 socialmedia) Steven Chan: WebCenter 11g (11.1.1.2) Certified with E-Business Suite Release 12 Steven Chan shares information on WebCenter 11g's (11.1.1.2) certification with Oracle E-Business Suite Release 12, along with a list of certified EBS 12 Platforms (tags: oracle otn enterprise2.0 webcenter ebs) @oraclenerd: 1Z0-052 - Exploring the Oracle Database Architecture Oracle ACE Chet "Oraclenerd" Justice shares a list of resources/documentation covering Oracle Database Architecture. (tags: oracle otn oracleace dba certification architecture) @oraclenerd: 1Z0-052 - Books "I don't believe I have ever purchased a book on or about Oracle. The documentation provided, especially for the database, is top notch. There is so much information available out there if you just know how to find it. Reading AskTom for years didn't hurt either." -- Chet "@oraclenerd" Justice. (tags: otn oracle oracleace certification dba) Lucas Jellema: Castle in the clouds – Building the Connexys SaaS application with Fusion Middleware Oracle ACE Director Lucas Jellema shares the slides from the presentation he and colleague Arne van der Ing submitted for OBUG 2010. (tags: otn oracle oracleace cloud saas obug fusionmiddleware connexys) John Burke: Why Your ERP System Isn't Ready for the Next Evolution of the Enterprise "[ERP] has to become a stealthy modern app to help you quickly adapt to business changes while managing vital information. And through modern middleware it will connect to everything. So yes ERP as we've know it is dead, but long live ERP as a connected application member of the modern enterprise." -- John Burke, Group VP, Applications Business Unit, Oracle (tags: oracle otn entarch erp) Darwin-IT: Postfix for handling mail in your integration solution "It took me some time to understand Postfix. I was quite overwhelmed by the options. And it took me some time to figure out how to configure it for this particular usecase...But as with most other things..it turns out to be simple." -- Martien van den Akker (tags: oracle linux soa postfix) TheServerSide.com: Cameron Purdy at TSSJS 2010: If Java beats C++, what's next? ''It turns out that Java performance is much better on modern architecture. That is because of multicore processors and in-lining.'' -- Cameron Purdy, as quoted in an article by Jack Vaughn (tags: oracle java otn c++)

    Read the article

  • Engineered Systems Production Tour

    - by Javier Puerta
    Oracle's Engineered Systems are shipped fully assembled and tested, and ready to be simply wheeled into the datacenter, plugged in and turned on. If you are curious to know how Oracle manufactures the Engineered Systems, watch this short video from our manufacturing plant.The video covers the assembly, test, packing and shipping of these systems and shows the extensive quality assurance steps that are taken:     Engineered Systems Production Tour from Cameron O'Rourke on Vimeo.

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >