Search Results

Search found 1903 results on 77 pages for 'james'.

Page 33/77 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • ScatterViewItems Containing Surface Interactive Elements

    - by James Hay
    This is an age old problem of interactive elements inside interactive elements, but I want a ScatterViewItem to contain other surface interactive elements such as a SurfaceButton or SurfaceCheckBox. I've got all my elements in there and they react to taps etc. The problem is that I only get the normal ScatterView behavior once I click on an area that does not contain a control. Is there an elegant solution to allow dragging even when the contact is on a SurfaceButton or SurfaceCheckbox? e.g. <s:ScatterView > <Grid Width="200" Height="200"> <s:SurfaceButton /> </Grid> </s:ScatterView>

    Read the article

  • Getting Data from WinForms ListView Control

    - by James
    I need to retrieve my data from a ListView control set up in Details mode with 5 columns. I tried using this code: MessageBox.Show(ManageList.SelectedItems(0).Text) And it works, but only for the first selected item (item 0). If I try this: MessageBox.Show(ManageList.SelectedItems(2).Text) I get this error: InvalidArgument=Value of '2' is not valid for 'index'. Parameter name: index I have no clue how I can fix this, any help? Edit: Sorry, should have said, I'm using Windows.Forms :)

    Read the article

  • Sphinx PHP search

    - by James
    I'm doing a Sphinx search but turning up some really weird results. Any help is appreciated. So for example if I type "50", I get: 50 Cent 50 Lions 50 Foot Wave, etc. This is great, but when I search "50 Ce", I get: Ryczace Dwudziestki Spisek Bernhard Gal Cowabunga Go-Go And other crazy results. Also when I search for "50 Cent", the correct result is at the top, but then random results below. Any ideas why? PHP code: $query = $_GET['query']; if (!empty($query)) { $sphinx->SetMatchMode(SPH_MATCH_ALL); $sphinx->AddQuery($query, 'artists'); $sphinx->AddQuery($query, 'variations'); $sphinx->SetFilter('name', array(3)); $sphinx->SetLimits(0, 10); $result = $sphinx->RunQueries(); echo '<pre>'; switch ($result) { case false: echo 'Query failed: ' . $sphinx->GetLastError() . "\n"; break; default: if ($sphinx->GetLastWarning()) { echo 'WARNING: ' . $sphinx->GetLastWarning() . "\n"; } if (is_array($result[0]['matches']) && count($result[0]['matches'])) { foreach ($result[0]['matches'] as $value => $info) { $artist = artistDetails($value); echo $artist['name'] . "\n"; } } } } Sphinx Index and Source: source artists { type = mysql sql_host = localhost sql_user = user sql_pass = pass sql_db = db sql_port = 3300 sql_query = \ SELECT \ id, name \ FROM artists; #UNIX_TIMESTAMP(time) #sql_attr_uint = group_id #sql_attr_timestamp = time sql_query_info = SELECT id,name FROM artists WHERE id=$id } index artists { source = artists path = /var/sphinx/artists docinfo = extern charset_type = utf-8 }

    Read the article

  • How can I encrypt CoreData contents on an iPhone

    - by James A. Rosen
    I have some information I'd like to store statically encrypted on an iPhone application. I'm new to iPhone development, some I'm not terribly familiar with CoreData and how it integrates with the views. I have the data as JSON, though I can easily put it into a SQLITE3 database or any other backing data format. I'll take whatever is easiest (a) to encrypt and (b) to integrate with the iPhone view layer. The user will need to enter the password to decrypt the data each time the app is launched. The purpose of the encryption is to keep the data from being accessible if the user loses the phone. For speed reasons, I would prefer to encrypt and decrypt the entire file at once rather than encrypting each individual field in each row of the database. Note: this isn't the same idea as Question 929744, in which the purpose is to keep the user from messing with or seeing the data. The data should be perfectly transparent when in use. Also note: I'm willing to use SQLCipher to store the data, but would prefer to use things that already exist on the iPhone/CoreData framework rather than go through the lengthy build/integration process involved.

    Read the article

  • Finding edge and corner values of an image in matlab

    - by James
    Hi, this problem links to two other questions i've asked on here. I am tracing the outline of an image and plotting this to a dxf file. I would like to use the bwboundaries function to find the coordinates of the edges of the image, find the corner coordinates using the cornermetric function and then remove any edge coordinates that are not a corner. The important thing I need to be able to do is keep the order of the corner elements obtained from bwboundaries, so that the section traces properly. The dxf function I have that draws from the coordinates draws lines between coordinates that are next to each other, so the line has to be drawn "around" the section rather than straight between the corner points. The reason I am doing this is because there are less coordinates obtained this way, so it is easier to amend the dxf file (as there are less points to manipulate). The code I have so far is: %# Shape to be traced bw = zeros(200); bw(20:40,20:180) = 1; bw(20:180,90:110) = 1; bw(140:180,20:185) = 1; %# Boundary Finding Section [Boundary] = bwboundaries(bw); %Traces the boundary of each section figure, imshow(bw); hold on; colors=['b' 'g' 'r' 'c' 'm' 'y']; for k=1:length(Boundary) perim = Boundary{k}; %Obtains perimeter coordinates (as a 2D matrix) from the cell array cidx = mod(k,length(colors))+1;% Obtains colours for the plot plot(perim(:,2), perim(:,1),... colors(cidx),'LineWidth',2); end Coordmat = cell2mat(Boundary) %Converts the traced regions to a matrix X = Coordmat(:,1) Y = Coordmat(:,2) % This gives the edge coordinates in matrix form %% Corner Finding Section (from Jonas' answer to a previous question %# get corners cornerProbability = cornermetric(bw); cornerIdx = find(cornerProbability==max(cornerProbability(:))); %# Label the image. bwlabel puts 1 for the first feature, 2 for the second, etc. %# Since concave corners are placed just outside the feature, grow the features %# a little before labeling bw2 = imdilate(bw,ones(3)); labeledImage = bwlabel(bw2); %# read the feature number associated with the corner cornerLabels = labeledImage(cornerIdx); %# find all corners that are associated with feature 1 corners_1 = cornerIdx(cornerLabels==1) [Xcorners, Ycorners] = ind2sub(200,corners_1) % Convert subscripts The code I have is, to give a matrix Xfin for the final x coordinates (which are on the edge AND at a corner. Xfin = zeros(length(X),1) for i = Xcorners XFin(i) = Xcorners if i~= Xcorners XFin(i) = [] end end However, this does not work correctly, because the values in the solution are sorted into order, and only one of each value remains. As I said, I would like the corner elements to be in the same order as obtained from bwboundaries, to allow the image to trace properly. Thanks

    Read the article

  • What is wrong with my PHP/MySQL code?

    - by James
    I am building a navigation menu which lists all my categories and subcategories. The problem is it returns only one of these and not all. I have the categories echoed inside the while loop so I'm not sure why it's only showing one result and not all: <?php $query = mysql_query("SELECT * FROM categories_parent"); while ($row = mysql_fetch_assoc($query)) { $id = $row['id']; $name = $row['name']; $slug = $row['slug']; $childStatus = $row['child_status']; // if has child categories if ($childStatus == "1") { echo "<li class='dir'><a href='category.php?slug=$slug'>$name</a>"; echo "<ul id='dropdown'>"; $query = mysql_query("SELECT * FROM categories_child WHERE parent=$id"); while ($row = mysql_fetch_assoc($query)) { $id = $row['id']; $name = $row['name']; $slug = $row['slug']; echo "<li><a href='category.php?slug=$slug'>$name</a></li>"; } echo "</ul>"; echo "</li>"; } // if singular parent else { echo "<li><a href='category.php?slug=$slug'>$name</a></li>"; } } ?> My database tables: -- -- Table structure for table `categories_child` -- CREATE TABLE IF NOT EXISTS `categories_child` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(1000) NOT NULL, `slug` varchar(1000) NOT NULL, `parent` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=139 ; -- -- Dumping data for table `categories_child` -- INSERT INTO `categories_child` (`id`, `name`, `slug`, `parent`) VALUES (138, 'Britney Spears', 'category/celiberties/britney-spears/', 137), (136, 'Tigers', 'category/animals/tigers/', 136), (137, 'Horses', 'category/animals/horses/', 136), (135, 'Lions', 'category/animals/lions/', 136); -- -- Table structure for table `categories_parent` -- CREATE TABLE IF NOT EXISTS `categories_parent` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(1000) NOT NULL, `slug` varchar(1000) NOT NULL, `child_status` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=139 ; -- -- Dumping data for table `categories_parent` -- INSERT INTO `categories_parent` (`id`, `name`, `slug`, `child_status`) VALUES (137, 'Celiberties', 'category/celiberties/', 1), (138, 'TV Shows', 'category/tv-shows/', 0), (136, 'Animals', 'category/animals/', 1);

    Read the article

  • -[CFString length]: message sent to deallocated instance 0x3881940 when i scroll to near the bottom

    - by James
    Hey guys, i've got a problem debugging an iphone app that i'm attempting to write and it's got me stumped, bear with me, i'm a n00b to programming and might get some of the terminology wrong but i'll try to explain it as best as i can. The app gets an XML doc from the a web site, parses it into an array, and then displays it in a table view, i have the parser in a separate file. The ViewDidLoad in RootViewController sends it a url, the parser goes to work and then returns an NSMutableArray. When i run the app it works fine with small XML files (5 entries or so, and 1-3 sections), but when i use a larger one(20+ rows, over 12 sections) i get the error "-[CFString length]: message sent to deallocated instance 0x3881940" when i scroll near the bottom of the tableview, just as the last section title is about to come onto the viewable area on the screen to be precise. if i return a static string instead of the object in my array in this method it doesn't crash, but i can use NSLog to call the array and it returns the title no problems. - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)indexPath { return [[returnedEvents objectAtIndex:indexPath ] objectAtIndex:0]; } The returnedEvents array isn't released until -(void) dealloc {} I have read a few other posts on here, and a few guides on debugging and as of yet am unable to find anything that was able to help me, i'd be more than happy to post some code up here and any more information, i'm just not sure where to start... Thanks in advance for anyone willing to have a go at helping me out.

    Read the article

  • How do I use waf to build a shared library?

    - by James Morris
    I want to build a shared library using waf as it looks much easier and less cluttered than GNU autotools. I actually have several questions so far related to the wscript I've started to write: VERSION='0.0.1' APPNAME='libmylib' srcdir = '.' blddir = 'build' def set_options(opt): opt.tool_options('compiler_cc') pass def configure(conf): conf.check_tool('compiler_cc') conf.env.append_value('CCFLAGS', '-std=gnu99 -Wall -pedantic -ggdb') def build(bld): bld.new_task_gen( features = 'cc cshlib', source = '*.c', target='libmylib') The line containing source = '*.c' does not work. Must I specify each and every .c file instead of using a wildcard? How can I enable a debug build for example (currently the wscript is using the debug builds CFLAGS, but I want to make this optional for the end user). It is planned for the library sources to be within a sub directory, and programs that use the lib each in their own sub directories.

    Read the article

  • Daily Backups for a single table in Microsoft SQL Server

    - by James Horton
    Hello, I have a table in a database that I would like to backup daily, and keep the backups of the last two weeks. It's important that only this single table will be backed up. I couldn't find a way of creating a maintenance plan or a job that will backup a single table, so I thought of creating a stored procedure job that will run the logic I mentioned above by copying rows from my table to a database on a different server, and deleting old rows from that destination database. Unfortunately, I'm not sure if that's even possible. Any ideas how can I accomplish what I'm trying to do would be greatly appreciated. Thank you.

    Read the article

  • JSLint -Tolerate inefficient subscripting?

    - by James Wiseman
    I'm reading the JSlint Options Documentation to understand each of the available options, and have come across one that I don't quite understand, and can't find any useful information regarding it elsewhere. sub - Tolerate inefficient subscripting true if subscript notation may be used for expressions better expressed in dot notation. Can anyone shed more light as to what this means? Thanks

    Read the article

  • Help with converting foreach loop to while loop in c#

    - by James Dawson
    I had learnt by reading your great answers here, that it is not good practice deleting items from within a foreach loop, as it is (and I quote) "Sawing off the branch you're sitting on". My code currently removes the text from the dropdownlist, but the actual item remains (just without text displayed). In other words, it isn't deleting, and probably can't because you can't delete from within a foreach loop. After hours of trying I am unable to get my head around a way of doing it. //For each checked box, run the delete code for (int i = 0; i < this.organizeFav.CheckedItems.Count; i++) { //this is the foreach loop foreach (ToolStripItem mItem in favoritesToolStripMenuItem.DropDownItems) { //This rules out seperators if (mItem is ToolStripMenuItem) { ToolStripMenuItem menuItem = mItem as ToolStripMenuItem; //This matches the dropdownitems text to the CheckedItems String if (((ToolStripMenuItem)mItem).Text.ToString() == organizeFav.CheckedItems[i].ToString()) { //And deletes the item menuItem.DropDownItems.Remove(mItem); } } } } But it isn't deleting because it is within a foreach loop! I would greatly appreciate your help, and be truly amazed if anyone can get their head around this code :) Kind Regards

    Read the article

  • Symfony "cannot fetch TableMap" error when using propel:build-all

    - by James Skidmore
    Cannot fetch TableMap for undefined table: order_product. Make sure you have the static MapBuilder registration code after your peer stub class definition. Even if I erase the entire schema, clear the cache, and delete everything but "vendor" in the lib folder, I still get the error. I also get the error when doing propel:build-filters or propel:build-forms. Thanks for your help in advance!

    Read the article

  • VB.NET 2008 - Anonymous Function

    - by James Brauman
    Hi, On Form Load I populate a menu with all possible colors so they user can pick a color. However when they pick a color the forecolor of my label is not changed. Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' When the form loads, we want to populate the color menu item with all the possible colors that we could change the label to. For Each currentColor As KnownColor In [Enum].GetValues(GetType(KnownColor)) ' Declare the knowColor again - we must do this to be able to do anonymous delegates in VB.NET Dim actualCurrentColor As KnownColor = currentColor ' Get the name for this color Dim colorName As String = [Enum].GetName(GetType(KnownColor), actualCurrentColor) ' Create a new menu item for this color Dim newMenuItem As ToolStripMenuItem = New ToolStripMenuItem(colorName) ' Add a handler to this menu item so when it is clicked, we change the heading color AddHandler newMenuItem.Click, Function(s As System.Object, events As System.EventArgs) (HeadingLabel.ForeColor = Color.FromKnownColor(actualCurrentColor)) ' Add the menu item to the colors menu ColorToolStripMenuItem.DropDownItems.Add(newMenuItem) Next End Sub What am I doing wrong? Thanks

    Read the article

  • Android ndk-build command does nothing

    - by James
    I have a similar question to that posted here: Android NDK: why ndk-build doesn't generate .so file and a new libs folder in Eclipse? ...though I am running Windows 7, not Mac os. Essentially the ndk-build command is run, gives no error but doesn't create an .so file (also, since I'm on windows this should create a .dll and not an .so?). I tried running the command from the root, jni, src folders etc. but got the same result; cmd just returns to the prompter after a few seconds. I ran it again from the jni folder with NDK_LOG=1 parameter to see what was happening. Here is a portion of the transcript of the log results after running ndk-build in the jni folder (after it successfully identified the platform, etc.)... Android NDK: Looking for jni/Android.mk in /workspace/NdkFooActivity/jni Android NDK: Looking for jni/Android.mk in /workspace/NdkFooActivity Android NDK: Found it ! Android NDK: Found project path: /workspace/NdkFooActivity Android NDK: Ouput path: /workspace/NdkFooActivity/obj Android NDK: Parsing /cygdrive/c/android-ndk-r8/build/core/default-application.mk Android NDK: Found APP_PLATFORM=android-15 in /workspace/NdkFooActivity/project.properties Android NDK: Application local targets unknown platform 'android-15' Android NDK: Switching to android-14 Android NDK: Using build script /workspace/NdkFooActivity/jni/Android.mk Android NDK: Application 'local' is not debuggable Android NDK: Selecting release optimization mode (app is not debuggable) Android NDK: Adding import directory: /cygdrive/c/android-ndk-r8/sources Android NDK: Building application 'local' for ABI 'armeabi' Android NDK: Using target toolchain 'arm-linux-androideabi-4.4.3' for 'armeabi' ABI Android NDK: Looking for imported module with tag 'cxx-stl/system' Android NDK: Probing /cygdrive/c/android-ndk-r8/sources/cxx-stl/system/Android.mk Android NDK: Found in /cygdrive/c/android-ndk-r8/sources/cxx-stl/system Android NDK: Cygwin dependency file conversion script: ...after which point it just runs the script mentioned in the last line, then terminates. Any ideas? Thanks!

    Read the article

  • Explicit Type Conversion and Multiple Simple Type Specifiers

    - by James McNellis
    To value initialize an object of type T, one would do something along the lines of one of the following: T x = T(); T x((T())); My question concerns types specified by a combination of simple type specifiers, e.g., unsigned int: unsigned int x = unsigned int(); unsigned int x((unsigned int())); Visual C++ 2008 and Intel C++ Compiler 11.1 accept both of these without warnings; Comeau 4.3.10.1b2 and g++ 3.4.5 (which is, admittedly, not particularly recent) do not. According to the C++ standard (C++03 5.2.3/2, expr.type.conv): The expression T(), where T is a simple-type-specifier (7.1.5.2) for a non-array complete object type or the (possibly cv-qualified) void type, creates an rvalue of the specified type, which is value-initialized 7.1.5.2 says, "the simple type specifiers are," and follows with a list that includes unsigned and int. Therefore, given that in 5.2.3/2, "simple-type-specifier" is singular, and unsigned and int are two type specifiers, are the examples above that use unsigned int invalid? (and, if so, the followup is, is it incorrect for Microsoft and Intel to support said expressions?) This question is more out of curiosity than anything else; for all of the types specified by a combination of multiple simple type specifiers, value initialization is equivalent to zero initialization. (This question was prompted by comments in response to this answer to a question about initialization).

    Read the article

  • Best way to unit-test WCF REST/SOAP service while dynamically generating stubs

    - by James Black
    I have a webservice written with WCF 4.0 that exposes REST and SOAP functions, and I want to set up my unit tests so that as I work on my web services I can quickly test by having the test framework start up the service, outside of IIS, and then do the tests. I want it to be dynamically generated as I am not certain what the interface will look like, and it is easier to not worry about having to generate the stubs before I start the tests. But, I couldn't get Groovy to work with my web service, so I am curious if Iron Python or Iron Ruby would work well for this, or is there another .NET language that may work well for this.

    Read the article

  • Updating textfield in doctrine produces an exception

    - by james-murphy
    I have a textfield that contains say for example the following text:- "A traditional English dish comprising sausages in Yorkshire pudding batter, usually served with vegetables and gravy." This textfield is in a form that simply updates an item record using it's ID. If I edit part of the textfield and replace "and gravy." with "humous." So that the textfield now contains "A traditional English dish comprising sausages in Yorkshire pudding batter, usually served with vegetables and humous." I get the following exception:- Fatal error: Uncaught exception 'Doctrine_Query_Exception' with message 'Unknown component alias humous' in C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Abstract.php:780 Stack trace: C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Abstract.php(767): Doctrine_Query_Abstract-getQueryComponent('humous') C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Set.php(58): Doctrine_Query_Abstract-getAliasDeclaration('humous') C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Abstract.php(2092): Doctrine_Query_Set-parse('i.details = 'A ...') C:\Projects\nitrous\lightweight\system\database\Doctrine\Query.php(1058): Doctrine_Query_Abstract-_processDqlQueryPart('set', Array) C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Abstract.php(971): Doctrine_Query-getSqlQuery(Array) C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Abstract.php(1030): Doctrine_Query_Abstract-_execute(Array) C:\Projects\nitrous\lightweight\system\appl in C:\Projects\nitrous\lightweight\system\database\Doctrine\Query\Abstract.php on line 780 I'm using Doctrine 1.0.6 hooked into CodeIgniter 1.7.0 if anyone is interested. My doctrine query that actually performs the update looks as follows:- public function updateItems($id, $arrayItem) { $query = new Doctrine_Query(); $query->update('Item i'); foreach($arrayItem as $key => $value) { $query->set('i.'.$key, "'".$value."'"); } $query->where('i.id = ?', $id); return $query->execute(); } This seems bizarre because if i replace the entire string "A traditional English dish comprising sausages in Yorkshire pudding batter, usually served with vegetables and humous." with something completely different like just "test" it doesn't throw an exception and works just fine. This baffles me... is it a bug in Doctrine or have I missed something?

    Read the article

  • Returning to last viewed List page after insert/edit with ASP.NET Dynamic Data

    - by Pat James
    With a pretty standard Dynamic Data site, when the user edits or inserts a new item and saves, the page does a Response.Redirect(table.ListActionPath), which takes the user back to page 1 of the table. If they were editing an item on page 10 (or whatever) and want to edit the next item on that page, they have to remember the page number and navigate back to it. What's the best way to return the user to the list page they last viewed? I can conceive of some solutions using cookies, session state, or query string values to retain this state and making my own Page Template to incorporate it, but I can't help thinking this must be something that was considered when Dynamic Data was created, and there must be something simpler or built-in to the framework that I'm missing here.

    Read the article

  • SQL DATEDIFF Not working!?

    - by James
    Hi all, I am running a simple DATEDIFF query but it doesn't seem to calculate the days properly or i'm doing something wrong. If I run PRINT DATEDIFF(Day, 2010-01-20, 2010-01-01) RETURN 19 Which is correct. If i change the month in the first date to Feb (02) I get something strange. PRINT DATEDIFF(Day, 2010-02-20, 2010-01-01) RETURN 20 Now shouldn't it be 48 or something? Can anyone see what i'm doing wrong or is this not the correct function to be using if I want the No of days between these dates? I've tried taking one date from the other: PRINT (2010-02-20) - (2010-01-01) RETURN -20 Any help much appreciated. Thanks J.

    Read the article

  • Building Web Application project using MSBuild from command line on 64-bit: missing targets file

    - by James Allen
    Building a solution containing a web application project using MSBuild from powershell like this: msbuild "/p:OutDir=$build_dir\" $solution_file Works fine for me on 32-bit, but on a 64-bit machine I am running into this error: error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. I am using Visual Studio 2008 and powershell v2. The problem has already been documented here and here. Basically on 64-bit install of VS, the Microsoft.WebApplication.targets needed by MSBuild is in the Program Files(x86) dir, not the Program Files dir, but MSBuild doesn't recognise this and so looks in the wrong place. The two solutions are not ideal: Manually copy the file on 64-bit from Program Files(x86) to Program Files. This is a poor solution - every dev will have to do this manually. Manually edit the csproj file so MSBuild looks in the right place. Again not ideal: I would rather not have to get everyone on 64bit to manually edit csproj files on every new project. e.g. <Import Project="$(MSBuildExtensionsPathx86)\$(WebAppTargetsSuffix)" Condition="Exists('$(MSBuildExtensionsPathx86)\$(WebAppTargetsSuffix)')" /> Ideally I want a way to tell MSBuild to import the target file form the right place from the command line but I can't work out how to do that. Any solutions?

    Read the article

  • Reuse an MVC area in multiple MVC applications?

    - by James Newton-King
    I have some common web pages that will be in multiple MVC applications. For those pages I'd like to reuse the same source code (controllers + views) between the different MVC web sites. What is the best way to go about doing this? ASP.NET MVC areas seem like one possibility but they just a sub directory of the website project. Is it possible to reuse an MVC area in multiple MVC applications?

    Read the article

  • R strsplit and vectorization

    - by James
    When creating functions that use strsplit, vector inputs do not behave as desired, and sapply needs to be used. This is due to the list output that strsplit produces. Is there a way to vectorize the process - that is, the function produces the correct element in the list for each of the elements of the input? For example, to count the lengths of words in a character vector: words <- c("a","quick","brown","fox") > length(strsplit(words,"")) [1] 4 # The number of words (length of the list) > length(strsplit(words,"")[[1]]) [1] 1 # The length of the first word only > sapply(words,function (x) length(strsplit(x,"")[[1]])) a quick brown fox 1 5 5 3 # Success, but potentially very slow Ideally, something like length(strsplit(words,"")[[.]]) where . is interpreted as the being the relevant part of the input vector.

    Read the article

  • Getting the MODELVIEW matrix...

    - by james.ingham
    Hi, I've been pulling my hair out trying to get some matrix calculations working properly and started to wonder. If I have the following: glPushMatrix(); float m[16]; glGetFloatv(GL_MODELVIEW_MATRIX, m); glPopMatrix(); What should I expect the values of m to equal? Currently I'm getting these values and I'm confused as to where they're coming from: -1, 0, 0, 0, 0, -0.6139, 0.7893522, 0, 0, 0.789352238, 0.61394, 0, 0, 0.0955992, -1.344529, 1, I'm assuming there is something which affects this, but I'm not sure what. Could anyone help? I've tried changing pretty much anything but everytime I push the matrix stack I always get this matrix straight away! I don't think this makes a difference but I'm using OpenGLES. Thanks

    Read the article

  • Initiate User Scope Class at Session Start

    - by James Santiago
    I want to initiate a class for each user at the start of the user's session so that a single class can be used throughout the user's session. I checked out this post but I'm not sure where I should be placing this Sessionhandler class. Inside global.asax? How do I go about accomplishing this?

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >