Search Results

Search found 2965 results on 119 pages for 'bill james'.

Page 75/119 | < Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >

  • MATLAB image corner coordinates & referncing to cell arrays

    - by James
    Hi, I am having some problems comparing the elements in different cell arrays. The context of this problem is that I am using the bwboundaries function in MATLAB to trace the outline of an image. The image is of a structural cross section and I am trying to find if there is continuity throughout the section (i.e. there is only one outline produced by the bwboundaries command). Having done this and found where the is more than one section traced (i.e. it is not continuous), I have used the cornermetric command to find the corners of each section. The code I have is: %% Define the structural section as a binary matrix (Image is an I-section with the web broken) bw(20:40,50:150) = 1; bw(160:180,50:150) = 1; bw(20:60,95:105) = 1; bw(140:180,95:105) = 1; Trace = bw; [B] = bwboundaries(Trace,'noholes'); %Traces the outer boundary of each section L = length(B); % Finds number of boundaries if L > 1 disp('Multiple boundaries') % States whether more than one boundary found end %% Obtain perimeter coordinates for k=1:length(B) %For all the boundaries perim = B{k}; %Obtains perimeter coordinates (as a 2D matrix) from the cell array end %% Find the corner positions C = cornermetric(bw); Areacorners = find(C == max(max(C))) % Finds the corner coordinates of each boundary [rowindexcorners,colindexcorners] = ind2sub(size(Newgeometry),Areacorners) % Convert corner coordinate indexes into subcripts, to give x & y coordinates (i.e. the same format as B gives) %% Put these corner coordinates into a cell array Cornerscellarray = cell(length(rowindexcorners),1); % Initialises cell array of zeros for i =1:numel(rowindexcorners) Cornerscellarray(i) = {[rowindexcorners(i) colindexcorners(i)]}; %Assigns the corner indicies into the cell array %This is done so the cell arrays can be compared end for k=1:length(B) %For all the boundaries found perim = B{k}; %Obtains coordinates for each perimeter Z = perim; % Initialise the matrix containing the perimeter corners Sectioncellmatrix = cell(length(rowindexcorners),1); for i =1:length(perim) Sectioncellmatrix(i) = {[perim(i,1) perim(i,2)]}; end for i = 1:length(perim) if Sectioncellmatrix(i) ~= Cornerscellarray Sectioncellmatrix(i) = []; %Gets rid of the elements that are not corners, but keeps them associated with the relevent section end end end This creates an error in the last for loop. Is there a way I can check whether each cell of the array (containing an x and y coordinate) is equal to any pair of coordinates in cornercellarray? I know it is possible with matrices to compare whether a certain element matches any of the elements in another matrix. I want to be able to do the same here, but for the pair of coordinates within the cell array. The reason I don't just use the cornercellarray cell array itself, is because this lists all the corner coordinates and does not associate them with a specific traced boundary.

    Read the article

  • Nested Select in Rails

    - by James
    I am working on a Rails application which uses categories for items. My category model is self-joined so that categories can be nested: class Category < ActiveRecord::Base has_many :items # Self Join (categories can have subcategories) has_many :subcategories, :class_name => "Category", :foreign_key => "parent_id" belongs_to :parent, :class_name => "Category" ... end I have a form which allows a user to create an item which currently lists all categories in a select, but they are all listed together: <%= f.label :category_id %> <%= select :item, :category_id, Category.all.collect {|c| [ c.title, c.id ]} %> So the select looks something like this: Category1 Category2 Category3BelongsTo2 Category4BelongsTo1 But what I want is: Category1 - Category4BelongsTo1 Category2 - Category3BelongsTo2 Is there a helper for this (which would be awesome!)? If not, how could I accomplish this? Thanks!

    Read the article

  • Reading value of cookie using curl in php

    - by james
    Hello, Im using Firefox 3.5.9. When i visit a url , it sets a cookie on my computer.I can see this cookie in Firefox by going to Tools-Options-Privacy,then clicking on 'Remove Individual Cookies'. There is a folder called xyz,which contains a cookie named JSessionId and which has some Content value . If i use curl in my php code to navigate to that website,is there a way i can read the Content value of that cookie programmatically ? . Some sample code would be really appreciated. Thank You

    Read the article

  • Can I package my Eclipse extension so the right version is automatically installed?

    - by James
    Is there a way to build an Eclipse Update Site so that Eclipse 3.3 will install one version of my plug-in while Eclipse 3.4 will install another version? Background: I've become responsible for an Eclipse extension that has half a dozen plug-ins which depend on a "support" plug-in, and the support plug-in needs to be one version for Eclipse 3.3 and a different version for Eclipse 3.4/3.5. I currently have two separate features, "extension for 3.3" and "extension for 3.4+" but I'd like to not bother my users with this detail.

    Read the article

  • A C# Refactoring Question...

    - by james lewis
    I came accross the following code today and I didn't like it. It's fairly obvious what it's doing but I'll add a little explanation here anyway: Basically it reads all the settings for an app from the DB and the iterates through all of them looking for the DB Version and the APP Version then sets some variables to the values in the DB (to be used later). I looked at it and thought it was a bit ugly - I don't like switch statements and I hate things that carry on iterating through a list once they're finished. So I decided to refactor it. My question to all of you is how would you refactor it? Or do you think it even needs refactoring at all? Here's the code: using (var sqlConnection = new SqlConnection(Lfepa.Itrs.Framework.Configuration.ConnectionString)) { sqlConnection.Open(); var dataTable = new DataTable("Settings"); var selectCommand = new SqlCommand(Lfepa.Itrs.Data.Database.Commands.dbo.SettingsSelAll, sqlConnection); var reader = selectCommand.ExecuteReader(); while (reader.Read()) { switch (reader[SettingKeyColumnName].ToString().ToUpper()) { case DatabaseVersionKey: DatabaseVersion = new Version(reader[SettingValueColumneName].ToString()); break; case ApplicationVersionKey: ApplicationVersion = new Version(reader[SettingValueColumneName].ToString()); break; default: break; } } if (DatabaseVersion == null) throw new ApplicationException("Colud not load Database Version Setting from the database."); if (ApplicationVersion == null) throw new ApplicationException("Colud not load Application Version Setting from the database."); }

    Read the article

  • C++ interface inheritance problem

    - by james t
    Hey, i'm trying to create a c++ stomp client, my client constructor is : Client(std::string &server, short port, std::string &login, std::string &pass, Listener &listener); it gets a listener object which when Listener is the following interface : class Listener { virtual void message(StmpMessage message) =0; }; now i attempt to instantiate a client in a test class : class test : public virtual Listener { public: void message(StmpMessage message) { message.prettyPrint(); } int main(int argc, char* argv[]) { Client client("127.0.0.1", 61613, *this); return 0; } }; i'm sending this to the client because this is a listener object, i get the following error : /Users/mzruya/Documents/STOMPCPP/main.cpp:18: error: no matching function for call to 'Client::Client(const char [10], int, test&)' /Users/mzruya/Documents/STOMPCPP/Client.h:43: note: candidates are: Client::Client(std::string&, short int, std::string&, std::string&, Listener&) /Users/mzruya/Documents/STOMPCPP/Client.h:37: note: Client::Client(const Client&)

    Read the article

  • NSNotification postNotificationName in AppDelegate but NSNotificationCenter in ViewController?

    - by James Testa
    I can't get the selector method, receiveChatText, in the NSNotificationCenter to execute and I am wondering if the problem is because the NSNotification postNotificationName is in AppDelegate.m but NSNotificationCenter is in ViewController.m? I.E. can the postNotificationName know that the NSNotificationCenter is in another viewController file or is that something I need to tell it? In a viewController.m I have -(id)init { self = [super init]; if(self){ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveChatText:) name:ChatMessageReceived object:nil]; return self; } - (void)receiveChatText:(NSNotification *)note { NSLog(@"received chat text"); } and in the top level AppDelegate.m file I have the following: -(void) didReceiveMessage { [[NSNotificationCenter defaultCenter] postNotificationName:ChatMessageReceived object:nil userInfo:nil]; } Any ideas what could stop receiveChatText from being executed when didReceiveMessage is called?

    Read the article

  • How can I perform a reverse string search in Excel without using VBA?

    - by e.James
    I have an Excel spreadsheet containing a list of strings. Each string is made up of several words, but the number of words in each string is different. Using built in Excel functions (no VBA), is there a way to isolate the last word in each string? Examples: Are you classified as human? - human? Negative, I am a meat popsicle - popsicle Aziz! Light! - Light!

    Read the article

  • How can I reference a drawable class in Android XML

    - by James Veenstra
    I've created a class that extends drawable that I'd like to reference inside a resource xml. I happen to need it in a selector, like so: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_window_focused="false" android:state_pressed="false" android:drawable="com.sample.android.contacts.TopBarCollapsed" /> <item android:state_window_focused="true" android:state_pressed="true" android:drawable="@drawable/top_switcher_collapsed_selected" /> <item android:state_focused="true" android:drawable="@drawable/top_switcher_collapsed_focused" /> com.sample.android.contacts.TopBarCollapsed is the class that extends drawable.

    Read the article

  • Returning XML natively in a .NET (C#) webservice?

    - by James McMahon
    I realize that SOAP webservices in .NET return XML representation of whatever object the web method returns, but if I want to return data formatting in XML what is the best object to store it in? I am using the answer to this question to write my XML, here is the code: XmlWriter writer = XmlWriter.Create(pathToOutput); writer.WriteStartDocument(); writer.WriteStartElement("People"); writer.WriteStartElement("Person"); writer.WriteAttributeString("Name", "Nick"); writer.WriteEndElement(); writer.WriteStartElement("Person"); writer.WriteStartAttribute("Name"); writer.WriteValue("Nick"); writer.WriteEndAttribute(); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndDocument(); writer.Flush(); Now I can return this output as a String to my calling webmethod, but it shows up as <string> XML HERE </string>, is there anyway to just return the full xml? Please in your answer, give an example of how to use said object with either XmlWriter or another internal object (if you consider XmlWriter to be a poor choice). The System.Xml package (namespace) has many objects, but I haven't been able to uncover decent documentation on how to use the objects together, or what to use for what situations.

    Read the article

  • How are attached properties useful in LINQ?

    - by James Cadd
    I got this question during an interview in the past and never really dug into in, but I've put some thought into it lately and I can't come up with a good answer. When I think of attached properties my mind goes straight to UI related concepts - what benefits could be had in using attached properties with LINQ? I'm starting to think the answer is "they're not" unless I find out otherwise!

    Read the article

  • Storing date/times as UTC in database

    - by James
    I am storing date/times in the database as UTC and computing them inside my application back to local time based on the specific timezone. Say for example I have the following date/time: 01/04/2010 00:00 Say it is for a country e.g. UK which observes DST (Daylight Savings Time) and at this particular time we are in daylight savings. When I convert this date to UTC and store it in the database it is actually stored as: 31/03/2010 23:00 As the date would be adjusted -1 hours for DST. This works fine when your observing DST at time of submission. However, what happens when the clock is adjusted back? When I pull that date from the database and convert it to local time that particular datetime would be seen as 31/03/2009 23:00 when in reality it was processed as 01/04/2010 00:00. Correct me if I am wrong but isn't this a bit of a flaw when storing times as UTC? Example of Timezone conversion Basically what I am doing is storing the date/times of when information is being submitted to my system in order to allow users to do a range report. Here is how I am storing the date/times: public DateTime LocalDateTime(string timeZoneId) { var tzi = TimeZoneInfo.FindSystemTimeZoneById(timeZoneId); return TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi).ToLocalTime(); } Storing as UTC: var localDateTime = LocalDateTime("AUS Eastern Standard Time"); WriteToDB(localDateTime.ToUniversalTime());

    Read the article

  • Live streaming using Flash

    - by James
    Hi, I was working on an application that streams live video using Flash client and Wowza media server. As of now, I use an independent desktop based encoder(Flash Media Live Encoder) to publish my live stream. I wanted to know if it is possible to do the encoding part in the browser? My application would be a used by many to publish their streams so I cannot ask everyone to use FMLE to publish. I was wondering how do the other web based video chat applications do the encoding part over the web. Please help. Thanks

    Read the article

  • VB.NET 2008, Windows 7 and saving files

    - by James Brauman
    Hello, We have to learn VB.NET for the semester, my experience lies mainly with C# - not that this should make a difference to this particular problem. I've used just about the most simple way to save a file using the .NET framework, but Windows 7 won't let me save the file anywhere (or anywhere that I have found yet). Here is the code I am using to save a text file. Dim dialog As FolderBrowserDialog = New FolderBrowserDialog() Dim saveLocation As String = dialog.SelectedPath ... Build up output string ... Try ' Try to write the file. My.Computer.FileSystem.WriteAllText(saveLocation, output, False) Catch PermissionEx As UnauthorizedAccessException ' We do not have permissions to save in this folder. MessageBox.Show("Do not have permissions to save file to the folder specified. Please try saving somewhere different.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Catch Ex As Exception ' Catch any exceptions that occured when trying to write the file. MessageBox.Show("Writing the file was not successful.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try The problem is that this using this code throws an UnauthorizedAccessException no matter where I try to save the file. I've tried running the .exe file as administrator, and the IDE as administrator. Is this just Windows 7 being overprotective? And if so, what can I do to solve this problem? The requirements state that I be able to save a file! Thanks.

    Read the article

  • Retrieving data from MySQL in one SQL statement

    - by james.ingham
    Hi all, If I'm getting my data from Mysql like so: $result = $dbConnector->Query("SELECT * FROM branches, businesses WHERE branches.BusinessId = businesses.Id ORDER BY businesses.Name"); $resultNum = $dbConnector->GetNumRows($result); if($resultNum > 0) { for($i=0; $i < $resultNum; $i++) { $row = $dbConnector->FetchArray($result); // $row['businesses.Name']; // $row['branches.Name']; echo $row['Name']; } } Does anyone know how to print the field Name in businesses and how to print the name from branches? My only other alternative is to rename the fields or to call Mysql with two seperate queries. Thanks in advance

    Read the article

  • copy the item with the metadata that user just added to a folder called "NativeFiles". this folder i

    - by James
    I need to copy the item that user just added (for example. myresume.doc or financial.xls) with the metadata (doc lib obtains the columns from content type, ct obtains the columns from site colum) and copy the item with metadata in a folder called "NativeFile". Every doc library has this folder. I know itemadded can be used but then I heard itemadded fires before user have a chance to complete the metadata for the item they just added. What are my options? (new to sp, so some sample code would greatly help. or some good link similar to this issue) Sharepoint 2007, itemadded or itemadding or itemupdating or itemupdated....

    Read the article

  • How to sort a list so that managers are always ahead of their subordinates (How do I do a topologica

    - by James Black
    I am working on a project using Groovy, and I would like to take an array of employees, so that no manager follows their subordinates in the array. The reason being that I need to add people to a database and I would prefer not to do it in two passes. So, I basically have: <employees> <employee> <employeeid>12</employeeid> <manager>3</manager> </employee> <employee> <employeeid>1</employeeid> <manager></manager> </employee> <employee> <employeeid>3</employeeid> <manager>1</manager> </employee> </employees> So, it should be sorted as such: employeeid = 1 employeeid = 3 employeeid = 12 The first person should have a null for managers. I am thinking about a binary tree representation, but I expect it will be very unbalanced, and I am not certain the best way to do this using Groovy properly. Is there a way to do this that isn't going to involve using nested loops?

    Read the article

  • What is the fastest way to validate that a field has no more than n words?

    - by James A. Rosen
    I have a Ruby-on-Rails model: class Candidate < ActiveRecord::Base validates_presence_of :application_essay validate :validate_length_of_application_essay protected def validate_length_of_application_essay return if application_essay.blank? # don't add a second error message if they didn't fill it out errors.add(:application_essay, :too_long), unless ... end end Without dropping into C, what is the fastest way to check that the application_essay contains no more than 500 words? You can assume that most essays will be at least 200 words, are unlikely to be more than 5000 words, and are in English (or the pseudo-English sometimes called "business-ese"). You can also classify anything you want as a "word" as long as your classification would be immediately obvious to a typical user. (NB: this is not the place to debate what a "typical user" is :) )

    Read the article

  • Python+Windows+GStreamer = Impossible (for me)?

    - by james
    Hi :) essentially, my problem is, ater a long time searching, finding only this other question, i decided i was just going to ask my own... i am on windows 7 with python 2.6 and ossbuild GStreamer, but i am trying to get the python binding for it, and struggling. i have got gst-python from http://gstreamer.freedesktop.org/src/gst-python/ but as my eyes and research tell me, it does not work in the setup.py way, and the other question has a link to a site that he says has a binary avaiable, which no longer does, http://www.gstreamer-winbuild.ylatuya.es/doku.php?id=download and even the sdk is gone, and ossbuild dont seem to have anything useful either. so essentially, my question is, can anyone tell me a method, however convoluted, of getting my setup so if i write a script for (py)gst, with an import gst it will work? not the best of explanations... im tired k? xxx :)

    Read the article

  • How to have multiple instances of jQuery plugin on single page?

    - by James Skidmore
    I'm writing a simple jQuery plugin, but I'm having trouble being able to use multiple instances on a page. For instance, here is a sample plugin to illustrate my point: (function($) { $.fn.samplePlugin = function(options) { if (typeof foo != 'undefined') { alert('Already defined!'); } else { var foo = 'bar'; } }; })(jQuery); And then if I do this: $(document).ready(function(){ $('#myDiv').samplePlugin({}); // does nothing $('#myDiv2').samplePlugion({}); // alerts "Already defined!" }); This is obviously an over-simplified example to get across the point. So my question is, how do I have two separate instances of the plugin? I'd like to be able to use it across multiple instances on the same page. I'm guessing that part of the problem might be with defining the variables in a global scope. How can I define them unique to that instance of the plugin then? Thank you for your guidance!

    Read the article

  • Does the order of columns in a query matter?

    - by James Simpson
    When selecting columns from a MySQL table, is performance affected by the order that you select the columns as compared to their order in the table (not considering indexes that may cover the columns)? For example, you have a table with rows uid, name, bday, and you have the following query. SELECT uid, name, bday FROM table Does MySQL see the following query any differently and thus cause any sort of performance hit? SELECT uid, bday, name FROM table

    Read the article

  • How to initialize F# list when size is unknown, using while..do loop

    - by James Black
    I have a function that will parse the results of a DataReader, and I don't know how many items are returned, so I want to use a while..do loop to iterate over the reader, and the outcome should be a list of a certain type. (fun(reader) -> [ while reader.Read() do new CityType(Id=(reader.GetInt32 0), Name=(reader.GetString 1), StateName=(reader.GetString 2)) ]) This is what I tried, but the warning I get is: This expression should have type 'unit', but has type 'CityType'. Use 'ignore' to discard the result of the expression, or 'let' to bind the result to a name. So what is the best way to iterate over a DataReader and create a list?

    Read the article

< Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >