Search Results

Search found 1870 results on 75 pages for 'matt mcclellan'.

Page 55/75 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • Safely turning a JSON string into an object

    - by Matt Sheppard
    Given a string of JSON data, how can you safely turn that string into a JavaScript object? Obviously you can do this unsafely with something like... var obj = eval("(" + json + ')'); ...but that leaves us vulnerable to the json string containing other code, which it seems very dangerous to simply eval.

    Read the article

  • How do I use a jQuery not selector to select relative URLs?

    - by Matt
    I'm working on a little jQuery script to add Google Analytics pageTracker onclick data to all relative URLs on my forum, allowing me to track clicks to external sites. I don't want to add the onclick to internal links on forum.sitename or sitename, and I don't want to add them to any hrefs marked # or that start with /. My script below works nicely, but for one minor problem! All of the forum's URLs are relative and don't start with /. I appear to have no way to change that, so need to modify the jQuery below to prevent it adding the onclick to links like as it currently does. What I want to do, is to write a .not() function like .not("[href!^=http") to prevent jQuery from adding the onclick to any hrefs which do not start with http. However, .not() appears not to support this. I'm new to jQuery and can't figure this out. Any pointers would be massively appreciated. $(document).ready(function(){ // Get URL from a href var URL = $("a").attr('href'); // Add pageTracker data for GA tracking $("a") .not("[href^=#]") .not("[href^=http://forum.sitename]") .not("[href^=http://www.sitename]") .attr("onclick","pageTracker._trackEvent('Outgoing_Links', 'Forum', " + URL + ");") ; }); Thanks!

    Read the article

  • Resize AIR app window while dragging

    - by matt lohkamp
    So I've noticed Windows 7 has a disturbing tendency to prevent you from dragging the title bar of windows off the top of the screen. If you try - in this case, using an air app with a draggable area at the bottom of the window, allowing you to push the top of the window up past the screen - it just kicks the window back down far enough that the title bar is at the top of what it considers the 'visible area.' One solution would be to resize the app window as it moves, so that the title bar is always where windows wants it. How would you resize the window while you're dragging it, though? Would you do it like this? dragHitArea.addEventListener(MouseEvent.MOUSE_DOWN, function(e:MouseEvent):void{ stage.nativeWindow.height += 50; stage.nativeWindow.startMove(); stage.nativeWindow.height -= 50; }); see what's going on there? When I click, I'm doing startMove(), which is hooking into the OS' function for dragging a window around. I'm also increasing and decreasing the height of the window by 50 pixels - which should give me no net increase, right? Wrong - the first '.height +=' gets executed, but the '.height -=' after the .startMove() never runs. Why? update - If you're curious, I'm programming an air widget with fly-out menus which expand rightwards and upwards - and since those element can only be displayed within the boundaries of the application window itself (even though the window is set to be chromeless and transparent) I have to expand the application's borders to include the area that the menu 'pops up' into. In the extreme case, with the widget positioned bottom left, and the menus expanded completely across to the right side and top edge of the screen, the application area could very well cover the entire desktop. The problem is, when it's expanded like this, if the user drags it up and to the right, it causes the 'title bar' area of the application window to move above the top edge of the desktop area, where it would normally be unreachable; and Windows automatically re-positions the window back below that edge once the .startMove() operation is completed. So what I want to do is continually resize the height of the application so that the visual effect will be the same for the user, but for the benefit of the operating system the window's title bar will never be above that top boundary of the desktop area.

    Read the article

  • Problem updating through LINQtoSQL in MVC application using StructureMap, Repository Pattern and UoW

    - by matt
    I have an ASP MVC application using LINQ to SQL for data access. I am trying to use the Repository and Unit of Work patterns, with a service layer consuming the repositories and unit of work. I am experiencing a problem when attempting to perform updates on a particular repository. My application architecture is as follows: My service class: public class MyService { private IRepositoryA _RepositoryA; private IRepositoryB _RepositoryB; private IUnitOfWork _unitOfWork; public MyService(IRepositoryA ARepositoryA, IRepositoryB ARepositoryB, IUnitOfWork AUnitOfWork) { _unitOfWork = AUnitOfWork; _RepositoryA = ARepositoryA; _RepositoryB = ARepositoryB; } public PerformActionOnObject(Guid AID) { MyObject obj = _RepositoryA.GetRecords() .WithID(AID); obj.SomeProperty = "Changed to new value"; _RepositoryA.UpdateRecord(obj); _unitOfWork.Save(); } } Repository interface: public interface IRepositoryA { IQueryable<MyObject> GetRecords(); UpdateRecord(MyObject obj); } Repository LINQtoSQL implementation: public class LINQtoSQLRepositoryA : IRepositoryA { private MyDataContext _DBContext; public LINQtoSQLRepositoryA(IUnitOfWork AUnitOfWork) { _DBConext = AUnitOfWork as MyDataContext; } public IQueryable<MyObject> GetRecords() { return from records in _DBContext.MyTable select new MyObject { ID = records.ID, SomeProperty = records.SomeProperty } } public bool UpdateRecord(MyObject AObj) { MyTableRecord record = (from u in _DB.MyTable where u.ID == AObj.ID select u).SingleOrDefault(); if (record == null) { return false; } record.SomeProperty = AObj.SomePropery; return true; } } Unit of work interface: public interface IUnitOfWork { void Save(); } Unit of work implemented in data context extension. public partial class MyDataContext : DataContext, IUnitOfWork { public void Save() { SubmitChanges(); } } StructureMap registry: public class DataServiceRegistry : Registry { public DataServiceRegistry() { // Unit of work For<IUnitOfWork>() .HttpContextScoped() .TheDefault.Is.ConstructedBy(() => new MyDataContext()); // RepositoryA For<IRepositoryA>() .Singleton() .Use<LINQtoSQLRepositoryA>(); // RepositoryB For<IRepositoryB>() .Singleton() .Use<LINQtoSQLRepositoryB>(); } } My problem is that when I call PerformActionOnObject on my service object, the update never fires any SQL. I think this is because the datacontext in the UnitofWork object is different to the one in RepositoryA where the data is changed. So when the service calls Save() on it's IUnitOfWork, the underlying datacontext does not have any updated data so no update SQL is fired. Is there something I've done wrong in the StrutureMap registry setup? Or is there a more fundamental problem with the design? Many thanks.

    Read the article

  • Force Binding Update Silverlight

    - by Matt
    How can I force my objects DataContext bindings to update? I'm using an event on a grid, and binding updates are not being processed before my event fires. Any cheap tricks to get around this? In the end I can always do things the old manual way of getting the values from my textboxes and updating my object, but it'd be nice to have binding do it for me.

    Read the article

  • Has Windows 7 Fixed the 255 Character File Path Limit?

    - by The Matt
    As I understand it, the limitation of 255 characters in a file path is a Windows limitation. What is the reasoning for this? If so, has this been resolved in Windows 7? In our continuous integration practices, we often have deeply nested project structures and it would be extremely useful to be able to go beyond 255 characters. Right now we are somewhat forced to structure our projects in such a way as to not hit this artificial ceiling.

    Read the article

  • From my code, I can't trace the out of bounds exception.

    - by Matt
    public override Models.CalculationNode Parse(string expression) { var calNode = new Models.CalculationNode(); int i = expression.Length; char[] x = expression.ToCharArray(); string temp = ""; //Backwards assembly of the tree //Right Node while (!IsOperator(x[i]) && i > 0) { if (!x[i].Equals(' ')) temp = x[i] + temp; i--; } } It has been a while since I've used trees and I'm getting an out of bounds exception in the while loop.

    Read the article

  • Why do my WPF UIElements NOT have OnPreview events?

    - by Matt.M
    I'm building a custom Silverlight UserControl which needs to listen to events using Preview/Tunneling, but for some reason the compiler is telling me they are not recognized or accessible. For example, I can add an event handler to MouseLeftButtonDown, but not PreviewMouseLeftButtonDown. This doesn't make sense because according to Microsoft (http://msdn.microsoft.com/en-us/library/system.windows.uielement_members(v=VS.100).aspx) all UIElements should have Preview events attached. Any ideas as to why this is happening? I'm using Visual Studio 2010 Trial, Blend 4 RC and .Net 4, if that makes a difference.

    Read the article

  • Add Attribute (System.Attribute variety) to .aspx page - not the code-behind

    - by Macho Matt
    I am creating a custom Attribute (extending System.Attribute). I know I can put it on another class easily enough by doing the following. [MattsAttribute] public class SomeClassWhichIsACodeBehind { However, I need to be able to test this attribute easily, and putting it in the code-behind would cause a lot of extra effort to get it deployed to an environment which would respond to the behavior of attribute. What I would like to do: declaratively apply this attribute to the .aspx page itself (which is really just another class that inherits from the code-behind). Is this possible? If so, what is the proper syntax for doing this?

    Read the article

  • Fluent nHibernate - How to map a non-key column on an association table?

    - by The Matt
    Taking an example that is provided on the Fluent nHibernate website, I need to extend it slightly: I need to add a 'Quantity' column to the StoreProduct table. How would I map this using nHibernate? An example mapping is provided for the given scenario above, but I'm not sure how I would get the Quantity column to map: public class StoreMap : ClassMap<Store> { public StoreMap() { Id(x => x.Id); Map(x => x.Name); HasMany(x => x.Employee) .Inverse() .Cascade.All(); HasManyToMany(x => x.Products) .Cascade.All() .Table("StoreProduct"); } }

    Read the article

  • jQuery slider not working in Wordpress plugin

    - by Matt Facer
    I've written a plugin for wordpress and I want to use a slider on my page. In it's most basic form (now) to test, I have the for the slider on my page <div id="wpge-slider"></div> then in the plugin, I have my init action add_action('init', 'wpge_init' ); function wpge_init() { wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('wpge_search_results', get_bloginfo('wpurl') . '/wp-content/plugins/myplugintest/js/wpge_search_results.js', array('jquery'), '1.0'); } then in my own javascript page, I have jQuery(document).ready(function($) { $("#wpge-slider").slider(); }); Everything (to me) looks ok, and the scripts ARE being called in the header. I can see them on the page... yet the slider is not showing. Can anyone see where I'm going wrong?!

    Read the article

  • Java class Class<T> and static method Class.forName() drive me crazy.

    - by matt
    Hi, this code doesn't compile. i'm wandering what i am doing wrong: private static Importable getRightInstance(String s) throws Exception { Class<Importable> c = Class.forName(s); Importable i = c.newInstance(); return i; } where Importable is an interface and the string s is the name of an implementing class. The compiler says: ./Importer.java:33: incompatible types found : java.lang.Class<capture#964 of ?> required: java.lang.Class<Importable> Class<Importable> c = Class.forName(format(s)); thanks for any help!

    Read the article

  • Is it possible to add a Silverlight 3 out-of-browser application to the add/remove programs list?

    - by Matt Lacey
    Is it possible to include a Silverlight (3) out-of-browser application to the add-or-remove programs list? The intention is to be able to remove the OOB application that way (not just by right-clicking from within the running app)? If the OOB app is installed with a shortcut to the desktop and you try to delete the shortcut you are presented with the standard 'you are just deleting a shortcut if you want to delete the application go to add or remove programs' dialog. I want to tidy up this inconsistency.

    Read the article

  • How can I write a MySQL query to check multiple rows?

    - by Matt
    I have a MySQL table containing data on product features: feature_id feature_product_id feature_finder_id feature_text feature_status_yn 1 1 1 Webcam y 2 1 1 Speakers y 3 1 1 Bluray n I want to write a MySQL query that allows me to search for all products that have a 'y' feature_status_yn value for a given feature_product_id and return the feature_product_id. The aim is to use this as a search tool to allow me to filter results to product IDs only matching the requested feature set. A query of SELECT feature_id FROM product_features WHERE feature_finder_id = '1' AND feature_status_yn = 'y' will return all of the features of a given product. But how can I select all products (feature_product_id) that have a 'y' value when they are on separate lines? Multiple queries might be one way to do it, but I'm wondering whether there's a more elegant solution based purely in SQL.

    Read the article

  • FLOT: How to make different colored points in same data series, connected by a line?

    - by Mega Matt
    Hi all, I think I may have stumbled onto a limitation of Flot, but I'm not sure. I'm trying to represent a single data series over time. The items' "State" is represented on the Y-Axis (there are 5 of them), and time is on the X-Axis (items can change states over time). I want the graph to have points and lines connecting those points for each data series. In addition to tracking an item's State over time, I'd also like to represent it's "Status" at any of the particular points. This I would like to do by changing the color of the points. What this means is a single item may have different Statuses at different times, meaning for a single data series I need a line that connects different points (dots) of different colors. The only thing I've seen so far is the ability to specify the color for all points in a given dataseries. Does anyone know if there's a way to specify colors individually? Thanks.

    Read the article

  • ajaxSubmit and Other Code. Can someone help me determine what this code is doing?

    - by Matt Dawdy
    I've inherited some code that I need to debug. It isn't working at present. My task is to get it to work. No other requirements have been given to me. No, this isn't homework, this is a maintenance nightmare job. ASP.Net (framework 3.5), C#, jQury 1.4.2. This project makes heavy use of jQuery and AJAX. There is a drop down on a page that, when an item is chosen, is supposed to add that item (it's a user) to an object in the database. To accomplish this, the previous programmer first, on page load, dynamically loads the entire page through AJAX. To do this, he's got 5 div's, and each one is loaded from a jquery call to a different full page in the website. Somehow, the HTML and BODY and all the other stuff is stripped out and the contents of the div are loaded with the content of the aspx page. Which seems incredibly wrong to me since it relies on the browser to magically strip out html, head, body, form tags and merge with the existing html head body form tags. Also, as the "content" page is returned as a string, the previous programmer has this code running on it before it is appended to the div: function CleanupResponseText(responseText, uniqueName) { responseText = responseText.replace("theForm.submit();", "SubmitSubForm(theForm, $(theForm).parent());"); responseText = responseText.replace(new RegExp("theForm", "g"), uniqueName); responseText = responseText.replace(new RegExp("doPostBack", "g"), "doPostBack" + uniqueName); return responseText; } When the dropdown itself fires it's onchange event, here is the code that gets fired: function SubmitSubForm(form, container) { //ShowLoading(container); $(form).ajaxSubmit( { url: $(form).attr("action"), success: function(responseText) { $(container).html(CleanupResponseText(responseText, form.id)); $("form", container).css("margin-top", "0").css("padding-top", "0"); //HideLoading(container); } } ); } This blows up in IE, with the message that "Microsoft JScript runtime error: Object doesn't support this property or method" -- which, I think, has to be that $(form).ajaxSubmit method doesn't exist. What is this code really trying to do? I am so turned around right now that I think my only option is to scrap everything and start over. But I'd rather not do that unless necessary. Is this code good? Is it working against .Net, and is that why we are having issues?

    Read the article

  • How can I bind to a helper property in Silverlight

    - by Matt
    For the sake of argument, here's a simple person class public class Person : DependencyObject, INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public static readonly DependencyProperty FirstNameProperty = DependencyProperty.Register( "FirstName", typeof ( string ), typeof ( Person ), null ); public static readonly DependencyProperty LastNameProperty = DependencyProperty.Register( "LastName", typeof( string ), typeof( Person ), null ); public string FirstName { get { return ( string ) GetValue( FirstNameProperty ); } set { SetValue( FirstNameProperty, value ); if(PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs( "FirstName" )); } } public string LastName { get { return ( string ) GetValue( LastNameProperty ); } set { SetValue( LastNameProperty, value ); if ( PropertyChanged != null ) PropertyChanged( this, new PropertyChangedEventArgs( "LastName" ) ); } } } I want to go about creating a readonly property like this public string FullName { get { return FirstName + " " + LastName; } } How does binding work in this scenario? I've tried adding a DependancyProperty and raised the PropertyChanged event for the fullname. Basically I just want to have a property that I can bind to that returns the fullname of a user whenever the first or last name changes. Here's the final class I'm using with the modifications. public class Person : DependencyObject, INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public static readonly DependencyProperty FirstNameProperty = DependencyProperty.Register( "FirstName", typeof ( string ), typeof ( Person ), null ); public static readonly DependencyProperty LastNameProperty = DependencyProperty.Register( "LastName", typeof( string ), typeof( Person ), null ); public static readonly DependencyProperty FullNameProperty = DependencyProperty.Register( "FullName", typeof( string ), typeof( Person ), null ); public string FirstName { get { return ( string ) GetValue( FirstNameProperty ); } set { SetValue( FirstNameProperty, value ); if ( PropertyChanged != null ) { PropertyChanged( this, new PropertyChangedEventArgs( "FirstName" ) ); PropertyChanged( this, new PropertyChangedEventArgs( "FullName" ) ); } } } public string LastName { get { return ( string ) GetValue( LastNameProperty ); } set { SetValue( LastNameProperty, value ); if ( PropertyChanged != null ) { PropertyChanged( this, new PropertyChangedEventArgs( "LastName" ) ); PropertyChanged( this, new PropertyChangedEventArgs( "FullName" ) ); } } } public string FullName { get { return GetValue( FirstNameProperty ) + " " + GetValue( LastNameProperty ); } } }

    Read the article

  • Is search and replace the only way to rename an asp control in the code behind file?

    - by Matt
    Is search and replace the only way to rename as asp control in the code behind file? I find this extremely annoying, but it is the only way I can find. Scenario: I'll find a variable that needs renaming (Usually to meet naming convention) I'll rename the variable in the aspx/ascx file. I'll have to go in the code behind files and search and replace. I get annoyed Are there any better ways - preferably that would not touch a similarly named variable in another scope in the project. I'm on VS2008 with resharper -- does VS2010 address this perhaps?

    Read the article

  • Justify Text in a HTML/XHTML TextArea

    - by Matt
    I am currently trying to justify text in a textarea, unfortunately the CSS: text-align: justify; Doesn't work on the text like center, left and right do. I've tried this in both Firefox 3 and IE 7 with no luck. Is there any way around this?

    Read the article

  • How to change ScrollView's position after touch?

    - by Matt
    I'm trying to make a ScrollView with a list of numbers in it that the user can select from. After the user touches and scrolls, after the finger is lifted I want the scroll to "snap" to the item in the middle of the ScrollView and give me the output. My ScrollView contains a vertical linear layout with TextView objects in it. The ScrollView's vertical size is about 60sp. I think this would involve the ScrollView.onTouch with a ACTION_UP, but I don't know how to use it. Also, is there a way to get an item's index or value based on a position in the list? Thanks!

    Read the article

  • Simple 2 way encryption for C#

    - by Matt Dawdy
    I'm looking for very simple encrypt and decrypt functionality for some data. It's not mission critical. I need something to keep honest people honest, but something a little stronger than ROT13 or Base64. I'd prefer something that is already included in the .Net framework 2.0 so I don't have to worry about any external dependencies. Pre-emptive EDIT: I really don't want to have to mess around with public/private keys, etc. I don't know much about encryption, but I do enough to know that anything I wrote would be less than worthless...in fact, I'd probably screw up the math and make it trivial to crack.

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >