Search Results

Search found 313 results on 13 pages for 'bryan shen'.

Page 9/13 | < Previous Page | 5 6 7 8 9 10 11 12 13  | Next Page >

  • Add dynamic URL (or button) to each node in Drupal

    - by Bryan Folds
    I've used CCK to create a 'Travel Offer' content-type which basically just lists the details for a travel package. My question is how to have a button or link on each node (when the user views it) that will link to a url that includes the title of the current node (eg: example.com/requestQuote/Title_Of_This_Node). I haven't implemented my system yet so I am free to change the content-type to include a button field or something like that...

    Read the article

  • How do I create lines while dragging a menu item on a WinForm? C#

    - by Bryan
    I want to mimic the functionality of Google Chrome/FireFox for example, when rearranging your bookmarks, when you are dragging the menu item, it creates a line at the proposed drop point. I've already implemented the Drag/Drop functionality to rearrange the menu, but I would like to add these separator lines as an additional feature. Is there a way to do this within the .NET Framework (3.5) or shall I have to resort to Win32 api calls? Just wanted to ask before I went down that path.

    Read the article

  • Astar implementation in AS3

    - by Bryan Hare
    Hey, I am putting together a project for a class that requires me to put AI in a top down Tactical Strategy game in Flash AS3. I decided that I would use a node based path finding approach because the game is based on a circular movement scheme. When a player moves a unit he essentially draws a series of line segments that connect that a player unit will follow along. I am trying to put together a similar operation for the AI units in our game by creating a list of nodes to traverse to a target node. Hence my use of Astar (the resulting path can be used to create this line). Here is my Algorithm function findShortestPath (startN:node, goalN:node) { var openSet:Array = new Array(); var closedSet:Array = new Array(); var pathFound:Boolean = false; startN.g_score = 0; startN.h_score = distFunction(startN,goalN); startN.f_score = startN.h_score; startN.fromNode = null; openSet.push (startN); var i:int = 0 for(i= 0; i< nodeArray.length; i++) { for(var j:int =0; j<nodeArray[0].length; j++) { if(!nodeArray[i][j].isPathable) { closedSet.push(nodeArray[i][j]); } } } while (openSet.length != 0) { var cNode:node = openSet.shift(); if (cNode == goalN) { resolvePath (cNode); return true; } closedSet.push (cNode); for (i= 0; i < cNode.dirArray.length; i++) { var neighborNode:node = cNode.nodeArray[cNode.dirArray[i]]; if (!(closedSet.indexOf(neighborNode) == -1)) { continue; } neighborNode.fromNode = cNode; var tenativeg_score:Number = cNode.gscore + distFunction(neighborNode.fromNode,neighborNode); if (openSet.indexOf(neighborNode) == -1) { neighborNode.g_score = neighborNode.fromNode.g_score + distFunction(neighborNode,cNode); if (cNode.dirArray[i] >= 4) { neighborNode.g_score -= 4; } neighborNode.h_score=distFunction(neighborNode,goalN); neighborNode.f_score=neighborNode.g_score+neighborNode.h_score; insertIntoPQ (neighborNode, openSet); //trace(" F Score of neighbor: " + neighborNode.f_score + " H score of Neighbor: " + neighborNode.h_score + " G_score or neighbor: " +neighborNode.g_score); } else if (tenativeg_score <= neighborNode.g_score) { neighborNode.fromNode=cNode; neighborNode.g_score=cNode.g_score+distFunction(neighborNode,cNode); if (cNode.dirArray[i]>=4) { neighborNode.g_score-=4; } neighborNode.f_score=neighborNode.g_score+neighborNode.h_score; openSet.splice (openSet.indexOf(neighborNode),1); //trace(" F Score of neighbor: " + neighborNode.f_score + " H score of Neighbor: " + neighborNode.h_score + " G_score or neighbor: " +neighborNode.g_score); insertIntoPQ (neighborNode, openSet); } } } trace ("fail"); return false; } Right now this function creates paths that are often not optimal or wholly inaccurate given the target and this generally happens when I have nodes that are not path able, and I am not quite sure what I am doing wrong right now. If someone could help me correct this I would appreciate it greatly. Some Notes My OpenSet is essentially a Priority Queue, so thats how I sort my nodes by cost. Here is that function function insertIntoPQ (iNode:node, pq:Array) { var inserted:Boolean=true; var iterater:int=0; while (inserted) { if (iterater==pq.length) { pq.push (iNode); inserted=false; } else if (pq[iterater].f_score >= iNode.f_score) { pq.splice (iterater,0,iNode); inserted=false; } ++iterater; } } Thanks!

    Read the article

  • Drupal: Two-way communication between unregistered customer and admin

    - by Bryan Folds
    I need to setup a system where customers can choose to Request a Quote for a specific holiday package, where they will enter their personal details as well as their holiday requirements (number of rooms, etc.) and will then allow them to view a page which will have a threaded conversation between them and the admin (so the admin can reply to their quote request on the website). The problem is that most customers won't be registered when they want to request a quote, so I was thinking that the Request a Quote page could silently register the customer as a user (using their personal details) on the same page where it asks for their holiday requirements. The other option I can think of would be to not register them and just email them a unique URL where they can view their quote request and reply to the admin. Could you point me in the right direction on how to do either of those?

    Read the article

  • Interface in a dynamic language?

    - by Bryan
    Interface (or an abstract class with all the methods abstract) is a powerful weapon in a static language. It allows different derived types to be used in a uniformed way. However, in a dynamic language, all objects can be used in a uniformed way as long as they define certain methods. Does interface exist in dynamic languages? It seems unnecessary to me.

    Read the article

  • How can I use the paid version of my app as a "key" to the free version?

    - by Bryan Denny
    Let's say for example that I have some Android app that does X. The free version has ads or basic features. I want to have a paid version that removes the ads and adds extra features. How can I use the paid app as a "license key" to unlock the features in the free app? So the user would install the free app, then install the paid app to get the extra features, but they would still run the free app (which would now be unlocked). What's the best approach to doing this?

    Read the article

  • How to detect which Windows account is running a .net application?

    - by Bryan
    Hi, I'm writing a sharepoint web part. It writes logs into a file (by using StreamWriter). However, logs are written only for users whose accounts are administrators on the server hosting the web part. I want to detect which account (probably not by using SPUser) is executing web part's code, so that I can have logs generated for less privileged users. Is that possible? Thanks

    Read the article

  • SQL query through an intermediate table

    - by Bryan
    Given the following tables: Recipes | id | name | 1 | 'chocolate cream pie' | 2 | 'banana cream pie' | 3 | 'chocolate banana surprise' Ingredients | id | name | 1 | 'banana' | 2 | 'cream' | 3 | 'chocolate' RecipeIngredients | recipe_id | ingredient_id | 1 | 2 | 1 | 3 | 2 | 1 | 2 | 2 | 3 | 1 | 3 | 3 How do I construct a SQL query to find recipes where ingredients.name = 'chocolate' and ingredients.name = 'cream'?

    Read the article

  • How to capture SQL with parameters substituted in? (.NET, SqlCommand)

    - by Bryan
    Hello, If there an easy way to get a completed SQL statement back after parameter substitution? I.e., I want to keep a logfile of all the SQL this program runs. Or if I want to do this, will I just want to get rid of Parameters, and do the whole query the old school way, in one big string? Simple Example: I want to capture the output: SELECT subcatId FROM EnrollmentSubCategory WHERE catid = 1 .. from this code: Dim subCatSQL As String = "SELECT subcatId FROM EnrollmentSubCategory WHERE catid = @catId" Dim connectionString As String = "X" Dim conn As New SqlConnection(connectionString) If conn.State = ConnectionState.Closed Then conn.Open() End If Dim cmd As New SqlCommand(subCatSQL, conn) With cmd .Parameters.Add(New SqlParameter("@catId", SqlDbType.Int, 1)) End With Console.WriteLine("Before: " + cmd.CommandText) cmd.Prepare() Console.WriteLine("After: " + cmd.CommandText) I had assumed Prepare() would do the substitutions, but apparently not. Thoughts? Advice? Thanks in advance.

    Read the article

  • Problem comparing French character Î

    - by Bryan
    When comparing "Île" and "Ile", C# does not consider these to be to be the same. string.Equals("Île", "Ile", StringComparison.InvariantCultureIgnoreCase) For all other accented characters I have come across the comparison works fine. Is there another comparison function I should use?

    Read the article

  • How can I Export a Table in Access using VBA into a specific sheet in an Excel spreadsheet?

    - by Bryan
    I have a some tables, we will call them Table1,Table2.... and I need them to be Exported into specific spreadsheets in a macro enabled Excel File (.xlsm) that already exists. So I would need to put Table1 into Sheet2, Table2 into Sheet3... and so on. I had been doing this manually by going to the export menu in Access but it is getting monotonous so I would like to automate the process. The Excel file will already have code in each spreadsheet which would need to still be intact.

    Read the article

  • Passing parameters to eventListener function

    - by bryan sammon
    I have this function check(e) that I'd like to be able to pass parameters from test() when I add it to the eventListener. Is this possible? Like say to get the mainlink variable to pass through the parameters. Is this even good to do? I put the javascript below, I also have it on jsbin: http://jsbin.com/ujahe3/9/edit function test() { if (!document.getElementById('myid')) { var mainlink = document.getElementById('mainlink'); var newElem = document.createElement('span'); mainlink.appendChild(newElem); var linkElemAttrib = document.createAttribute('id'); linkElemAttrib.value = "myid"; newElem.setAttributeNode(linkElemAttrib); var linkElem = document.createElement('a'); newElem.appendChild(linkElem); var linkElemAttrib = document.createAttribute('href'); linkElemAttrib.value = "jsbin.com"; linkElem.setAttributeNode(linkElemAttrib); var linkElemText = document.createTextNode('new click me'); linkElem.appendChild(linkElemText); if (document.addEventListener) { document.addEventListener('click', check/*(WOULD LIKE TO PASS PARAMETERS HERE)*/, false); }; }; }; function check(e) { if (document.getElementById('myid')) { if (document.getElementById('myid').parentNode === document.getElementById('mainlink')) { var target = (e && e.target) || (event && event.srcElement); var obj = document.getElementById('mainlink'); if (target!= obj) { obj.removeChild(obj.lastChild); }; }; }; };

    Read the article

  • Do Ruby/Rails state machines exist that execute event transitions when a state change occurs?

    - by Bryan
    Hello All, Hopefully this isn't a silly question and I'm just not overlooking something in Ruby/Rails state machines (AASM, Transitions, AlterEgo, etc). From what I can tell, these state machine implementations operate on the preface that an event will get fired and the appropriate transition for that event will be triggered based on the old and new state. However, they don't seem to work the other way; say a user wants to change state from 'created' to 'assigned' and have the correct transition occur (rather than firing the event that causes the current state to be transitioned to the new state). Essentially, I want the user to be able to select a new state from a select box of available states and have the appropriate transition, guards, success callbacks, etc executed. Does anyone know if the existing state machine implementations support this?

    Read the article

  • Timespan in C# converting to int? Somehow?

    - by Bryan
    I'm trying to use the Timespan class to create a start time and a stop time, get the difference and ultimately dividing and multiplying the result against another number. The problem is getting into something I can work with. Any suggestions?

    Read the article

  • On saving an new active record, in what order are the associated objects saved?

    - by Bryan
    In rails, when saving an active_record object, its associated objects will be saved as well. But has_one and has_many association have different order in saving objects. I have three simplified models: class Team < ActiveRecord::Base has_many :players has_one :coach end class Player < ActiveRecord::Base belongs_to :team validates_presence_of :team_id end class Coach < ActiveRecord::Base belongs_to :team validates_presence_of :team_id end I expected that when team.save is called, team should be saved before its associated coach and players. I use the following code to test these models: t = Team.new team.coach = Coach.new team.save! team.save! returns true. But in another test: t = Team.new team.players << Player.new team.save! team.save! gives the following error: > ActiveRecord::RecordInvalid: > Validation failed: Players is invalid I figured out that team.save! saves objects in the following order: 1) players, 2) team, and 3) coach. This is why I got the error: When a player is saved, team doesn't yet have a id, so validates_presence_of :team_id fails in player. Can someone explain to me why objects are saved in this order? This seems not logical to me.

    Read the article

  • Problem with SQL syntax (probably simple)

    - by Bryan Folds
    I'm doing some custom database work for a module for Drupal and I get the following SQL error when trying to create my table: user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT NULL, rooms INT DEFAULT NULL, adults INT DEFAULT NULL, children' at line 14 query: CREATE TABLE dr_enquiry ( eId INT unsigned NOT NULL auto_increment, eKey VARCHAR(16) NOT NULL, dateSent INT NOT NULL DEFAULT 0, status VARCHAR(30) NOT NULL DEFAULT 'Unanswered', custName VARCHAR(50) NOT NULL, custEmail VARCHAR(200) NOT NULL, custPhone VARCHAR(25) NOT NULL, custCountry VARCHAR(40) NOT NULL, custIP VARCHAR(11) DEFAULT NULL, offerName VARCHAR(100) NOT NULL, offerURL VARCHAR(200) NOT NULL, arrival DATETIME DEFAULT NULL, departure DEFAULT NULL, rooms INT DEFAULT NULL, adults INT DEFAULT NULL, children INT DEFAULT NULL, childAges VARCHAR(32) DEFAULT NULL, toddlers INT DEFAULT NULL, toddlerAges VARCHAR(32) DEFAULT NULL, catering VARCHAR(255) DEFAULT NULL, comments VARCHAR(255) DEFAULT NULL, agent VARCHAR(100) DEFAULT NULL, voucher VARCHAR(100) DEFAULT NULL, PRIMARY KEY (eId) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in /home/travelco/public_html/includes/database.inc on line 550.

    Read the article

  • Joomla External HTML and Access Levels

    - by Bryan
    I am trying to use Joomla to create a website that allows users to do the following: submit links to external html search through the external websites based on category, rankings, etc. display the websites in multiple iframes simultaneously ( like google gadgets) limit access to certain external websites by user customize users homepage (like igoogle) I am trying to pull the right joomla plugin and component pieces together. For i-frame display I am looking at: http://www.joomlaclub.gr/joomla-free-downloads.html?func=fileinfo&id=46 http://www.cmsmarket.com/extensions-directory/external+content/frames+%26+external+html/praiseframe+module http://extensions.joomla.org/extensions/style-&-design/popups-&-iframes/3116/details Can you think of any extensions, plugins, or components that would help me build the aforementioned functionality. Thanks

    Read the article

  • C# creating a Class, having objects as member variables? I think the objects are garbage collecte

    - by Bryan
    So I have a class that has the following member variables. I have get and set functions for every piece of data in this class. public class NavigationMesh { public Vector3 node; int weight; bool isWall; bool hasTreasure; public NavigationMesh(int x, int y, int z, bool setWall, bool setTreasure) { //default constructor //Console.WriteLine(x + " " + y + " " + z); node = new Vector3(x, y, z); //Console.WriteLine(node.X + " " + node.Y + " " + node.Z); isWall = setWall; hasTreasure = setTreasure; weight = 1; }// end constructor public float getX() { Console.WriteLine(node.X); return node.X; } public float getY() { Console.WriteLine(node.Y); return node.Y; } public float getZ() { Console.WriteLine(node.Z); return node.Z; } public bool getWall() { return isWall; } public void setWall(bool item) { isWall = item; } public bool getTreasure() { return hasTreasure; } public void setTreasure(bool item) { hasTreasure = item; } public int getWeight() { return weight; } }// end class In another class, I have a 2-Dim array that looks like this NavigationMesh[,] mesh; mesh = new NavigationMesh[502,502]; I use a double for loop to assign this, my problem is I cannot get the data I need out of the Vector3 node object after I create this object in my array with my "getters". I've tried making the Vector3 a static variable, however I think it refers to the last instance of the object. How do I keep all of these object in memory? I think there being garbage collected. Any thoughts?

    Read the article

  • How to initiate a remote SVN update on server

    - by Bryan
    I'm using SVN for a project, and for easy deployments to the server we're just using another SVN enlistment there. So I've been using Remote Desktop to log onto the server and then trigger an update (we use Tortoise SVN). Is there an existing tool (or SVN feature) that would allow me to trigger this update without logging on to the server and doing it manually?

    Read the article

  • Recovering From An SQL Injection

    - by Bryan
    Let's not go so far as to say that I'm paranoid, but I've been spending hour after hour learning how to prevent SQL injections (and XSS for what it's worth). What I'm wondering is that a SQL injection doesn't seem like it would do permanent harm to my database if I've made daily backups. Doesn't importing yesterday's copy of my tables just restore them and then I can be on my merry way?

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13  | Next Page >