Search Results

Search found 3177 results on 128 pages for 'david murrant'.

Page 89/128 | < Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >

  • Convert Google Analytics cookies to Local/Session Storage

    - by David Murdoch
    Google Analytics sets 4 cookies that will be sent with all requests to that domain (and ofset its subdomains). From what I can tell no server actually uses them directly; they're only sent with __utm.gif as a query param. Now, obviously Google Analytics reads, writes and acts on their values and they will need to be available to the GA tracking script. So, what I am wondering is if it is possible to: rewrite the __utm* cookies to local storage after ga.js has written them delete them after ga.js has run rewrite the cookies FROM local storage back to cookie form right before ga.js reads them start over Or, monkey patch ga.js to use local storage before it begins the cookie read/write part. Obviously if we are going so far out of the way to remove the __utm* cookies we'll want to also use the Async variant of Analytics. I'm guessing the down vote was because I didn't ask a question. DOH! My questions are: Can it be done as described above? If so, why hasn't it been done? I have a default HTML/CSS/JS boilerplate template that passes YSlow, PageSpeed, and Chrome's Audit with near perfect scores. I'm really looking for a way to squeeze those remaining cookie bytes from Google Analytics in browsers that support local storage.

    Read the article

  • Navigation Within TabController

    - by David.Chu.ca
    I am trying to use UITabController as may controller in my main window and add navigation controllers to some tab bar items. For example, the first tab has a navigation controller with table view: ![alt text][1] The SettingsViewController is associated with its own NIB file, where a table view is defined. Within that xib file, I have a table view and set it to the outlet of SettingsViewController class property myTableView. The problem is that in the main xib file, for the SettingsViewController navigation, there is one outlet myTableView. I am not sure if I have to set this to somewhere? The exception I get is "[UIViewController _loadViewFromNibNamed:bundle:] loaded the "SettingsViewController" nib but the view outlet was not set." [1]:

    Read the article

  • How to perform add/update of a model object that contains EntitySet

    - by David Liddle
    I have a similar concept to the SO questions/tags scenario however am trying to decide the best way of implementation. Tables Questions, QuestionTags and Tags Questions QuestionTags Tags --------- ------------ ---- QID QID TID QName TID TName When adding/updating a question I have 2 textboxes. The important part is a single textbox that allows users to enter in multiple Tags separated by spaces. I am using Linq2Sql so the Questions model has an EntitySet of QuestionTags with then link to Tags. My question is regarding the adding/updating of Questions (part 1), and also how to best show QuestionTags for a Question (part 2). Part 1 Before performing an add/update, my service layer needs to deal with 3 scenarios before passing to their respective repositories. Insert Tags that do not already exist Insert/Update Question Insert QuestionTags - when updating need to remove existing QuestionTags Here is my code below however started to get into a bit of a muddle. I've created extension methods on my repositories to get Tags WithNames etc. public void Add(Question q, string tags) { var tagList = tags.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToList(); using (DB.TransactionScope ts = new DB.TransactionScope()) { var existingTags = TagsRepository.Get() .WithName(tagList) .ToList(); var newTags = (from t in tagList select new Tag { TName = t }).Except(existingTags, new TagsComparer()).ToList(); TagsRepository.Add(newTags); //need to insert QuestionTags QuestionsRepository.Add(q); ts.Complete(); } } Part 2 My second question is, when displaying a list of Questions how is it best to show their QuestionTags? For example, I have an Index view that shows a list of Questions in a table. One of the columns shows an image and when the user hovers over it shows the list of Tags. My current implementation is to create a custom ViewModel and show a List of QuestionIndexViewModel in the View. QuestionIndexViewModel { Question Question { get; set; } string Tags { get; set; } } However, this seems a bit clumsy and quite a few DB calls. public ViewResult Index() { var model= new List<QuestionIndexViewModel>(); //make a call to get a list of questions //foreach question make a call to get their QuestionTags, //to be able to get their Tag names and then join them //to form a single string. return View(model); } Also, just for test purposes using SQL Profiler, I decided to iterate through the QuestionTags entity set of a Question in my ViewModel however nothing was picked up in Profiler? What would be the reason for this?

    Read the article

  • Is anyone familiar with SDPT.clsSDPT?

    - by David Stratton
    Normally I wouldn't ask this kind of question here, but I'm desperate at this point. I'm attempting to support a classic ASP app written by a predecessor who is no longer available. Keeping it short, several applications use a dll to perform encryption of sensitive data. This dll is named SDPT.dll, and the line of code used to create an object is set objSDPT = server.CreateObject("SDPT.clsSDPT") At this point, I am getting errors in a critical app on one of my servers, and I've actually hit a dead end. The error is a standard "Server.CreateObject Failed" message, which I know how to troubleshoot in most cases. However, in this case, all of my normal tries, plus several hours of Google searches are coming up with nothing that works. At this point, I'm not so much looking for help in troubleshooting the issue as I am in finding any sort of reference on this third party component. Even finding that is proving to be difficult, so I'm resorting to asking any of the seasoned developers that hang out here if they are familiar with this product, who it was developed by, and if any documentation on it exists anywhere.

    Read the article

  • How can I modify input before model binding in asp.net mvc?

    - by David G
    How can I intercept submitted form input and modify it before it is bound to my model? For example, if I wanted to trim the whitespace from all text. I have tried creating a custom model binder like so: public class CustomBinder : DefaultModelBinder { protected override void SetProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, PropertyDescriptor propertyDescriptor, object value) { string newValue = ((string)value).Trim(); //example code to create new value but could be anything base.SetProperty(controllerContext, bindingContext, propertyDescriptor, newValue); } } but this doesn't seem to be invoked. Is there a better place to modify the input value? Note: I need to modify the value before it is bound and validated.

    Read the article

  • ASP.NET MVC : Good Replacement for User Control?

    - by David Lively
    I found user controls to be incredibly useful when working with ASP.NET webforms. By encapsulating the code required for displaying a control with the markup, creation of reusable components was very straightforward and very, very useful. While MVC provides convenient separation of concerns, this seems to break encapsulation (ie, you can add a control without adding or using its supporting code, leading to runtime errors). Having to modify a controller every time I add a control to a view seems to me to integrate concerns, not separate them. I'd rather break the purist MVC ideology than give up the benefits of reusable, packaged controls. I need to be able to include components similar to webforms user controls throughout a site, but not for the entire site, and not at a level that belongs in a master page. These components should have their own code not just markup (to interact with the business layer), and it would be great if the page controller didn't need to know about the control. Since MVC user controls don't have codebehind, I can't see a good way to do this. Update FINALLY, a good (and, in retrospect, obvious) way to accomplish this. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace K.ObjectModel.Controls { public class TestControl : ViewUserControl { protected override void Render(System.Web.UI.HtmlTextWriter writer) { writer.Write("Hello World"); base.Render(writer); } } } Create a new class which inherits ViewUserControl Override the .Render() method as shown above. Register the control via its associated ASCX as you would in a webForm: <%@ Register TagName="tn" TagPrefix="k" Src="~/Views/Navigation/LeftBar.ascx"%> Use the corresponding tag in whatever view or master page that you need: <k:tn runat="server"/> Make sure your .ascx inherits your new control: <%@ Control Language="C#" Inherits="K.ObjectModel.Controls.TestControl" %> Voila, you're up and running. This is tested with ASP.NET MVC 2, VS 2010 and .NET 4.0. Your custom tag references the ascx partial view, which inherits from the TestControl class. The control then overrides the Render() method, which is called to render the view, giving you complete control over the process from tag to output. Why does everyone try to make this so much harder than it has to be?

    Read the article

  • php preg replace

    - by David
    I'm trying to build a PHP preg replace string when processing poorly written xml, such that if I am given: $x='<abc x="y"><def x="g">more test</def x="g"><blah>test data</blah></abc x="y">'; That it checks if there's a space within a closing tag and deletes everything from the space to the end of the tag such that. becomes <abc x="y"><def x="g">more test</def><blah>test data</blah></abc> thanks

    Read the article

  • Possible to capture all events in a web browser?

    - by David
    I am working on a pet project and am at the research stage. Quick summary I am trying to intercept all form submits, onclick, and every single keydown. My library of choice is either jquery, or jquery + prototypejs. I figure I can batch up the events into a queue/stack and send it back to the server in time interval batches to keep performance relatively stable. Concerns Form submits and change's would be relatively simple.. Something like $("form :inputs").bind("change", function() { ... record event... }); But how to ensure I get precedence over the applications handlers as I have a habit of putting return false on a lot of my form handlers when there is a validation issue. As I understand it, that effectively stops the event in its tracks. My project For my smaller remote clients I will put their products onto a VPS or run it in my home data center. Currently I use a basic authentication system, given a username/password they see the website and then hopefully send me somewhat sane notes on what is broken or should be tweaked. As a better solution, I've written a simple proxy web server that does the above but allows me to have one DNS entry and then depending on credentials it makes an internal request relaying headers and re-writing URLS as needed. Every single html/text or application/* request is compressed and shoved into a sqlite table so I can partially replay what they've done. Now I am shifting to the frontend and would like to capture clicks, keydown's, and submits on everything on the page.

    Read the article

  • SQL query to get latest record for all distinct items in a table

    - by David Buckley
    I have a table of all sales defined like: mysql> describe saledata; +-------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------+-------+ | SaleDate | datetime | NO | | NULL | | | StoreID | bigint(20) unsigned | NO | | NULL | | | Quantity | int(10) unsigned | NO | | NULL | | | Price | decimal(19,4) | NO | | NULL | | | ItemID | bigint(20) unsigned | NO | | NULL | | +-------------------+---------------------+------+-----+---------+-------+ I need to get the last sale price for all items (as the price may change). I know I can run a query like: SELECT price FROM saledata WHERE itemID = 1234 AND storeID = 111 ORDER BY saledate DESC LIMIT 1 However, I want to be able to get the last sale price for all items (the ItemIDs are stored in a separate item table) and insert them into a separate table. How can I get this data? I've tried queries like this: SELECT storeID, itemID, price FROM saledata WHERE itemID IN (SELECT itemID from itemmap) ORDER BY saledate DESC LIMIT 1 and then wrap that into an insert, but it's not getting the proper data. Is there one query I can run to get the last price for each item and insert that into a table defined like: mysql> describe lastsale; +-------------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------+------+-----+---------+-------+ | StoreID | bigint(20) unsigned | NO | | NULL | | | Price | decimal(19,4) | NO | | NULL | | | ItemID | bigint(20) unsigned | NO | | NULL | | +-------------------+---------------------+------+-----+---------+-------+

    Read the article

  • CSS/JS: Evenly spreading elements across multiple lines

    - by David Lawson
    How would you go about evenly spreading elements across multiple lines, for example: wrapper div: <div style="text-align: center"> elements inside: <div style="display: inline-block; padding-left: 10px; padding-right: 10px;">Element</div> Instead of only having one element on the next line (wrapped): Element 1 Element 2 Element 3 Element 4 Element 5 Element 6 It does this, spreading out the elements: Element 1 Element 2 Element 3 Element 4 Element 5 Element 6

    Read the article

  • How do I create a custom network connection entry?

    - by David Brown
    I have a Sprint MiFi 3G router that exposes its current signal strength over HTTP. I've developed a very simple tray application that displays this. However, what I would really like to do is create a custom network connection entry so the router's 3G signal strength (along with the current network version) displays when clicking on the network connections tray icon (in Windows 7, at least). Is it possible to do this with a shell extension or something (preferably in C#)? If so, how?

    Read the article

  • GameKit Bluetooth Transfer Problem

    - by David Schiefer
    Hi, I am trying to send a file via Bluetooth using the GameKit framework. The problem I am having though is that I can only send one NSData object at a time, but I need to save it on the other end. this obviously isn't possible without knowing the filename, but i don't know how to transmit that. I've tried to convert it to a string NSData*data = [NSData dataWithContentsOfFile:urlAddress]; but i can only send one NSData object, not two. Has anyone come across this problem yet?

    Read the article

  • Deal with undefined values in code or in the template?

    - by David
    I'm writing a web application (in Python, not that it matters). One of the features is that people can leave comments on things. I have a class for comments, basically like so: class Comment: user = ... # other stuff where user is an instance of another class, class User: name = ... # other stuff And of course in my template, I have <div>${comment.user.name}</div> Problem: Let's say I allow people to post comments anonymously. In that case comment.user is None (undefined), and of course accessing comment.user.name is going to raise an error. What's the best way to deal with that? I see three possibilities: Use a conditional in the template to test for that case and display something different. This is the most versatile solution, since I can change the way anonymous comments are displayed to, say, "Posted anonymously" (instead of "Posted by ..."), but I've often been told that templates should be mindless display machines and not include logic like that. Also, other people might wind up writing alternate templates for the same application, and I feel like I should be making things as easy as possible for the template writer. Implement an accessor method for the user property of a Comment that returns a dummy user object when the real user is undefined. This dummy object would have user.name = 'Anonymous' or something like that and so the template could access it and print its name with no error. Put an actual record in my database corresponding to a user with user.name = Anonymous (or something like that), and just assign that user to any comment posted when nobody's logged in. I know I've seen some real-world systems that operate this way. (phpBB?) Is there a prevailing wisdom among people who write these sorts of systems about which of these (or some other solution) is the best? Any pitfalls I should watch out for if I go one way vs. another? Whoever gives the best explanation gets the checkmark.

    Read the article

  • What xsd will let an element have itself as a sub element infinitely?

    - by David Basarab
    How can I create an xsd to give me this type of xml structure that can go on infinitely? <?xml version="1.0" encoding="utf-8" ?> <SampleXml> <Items> <Item name="SomeName" type="string"> This would be the value </Item> <Item name="SecondName" type="string"> This is the next string </Item> <Item name="AnotherName" type="list"> <Items> <Item name="SubName" type="string"> A string in a sub list </Item> <Item name="SubSubName" type="list"> <Items> <Item name="HowDoI" type="string"> How do I keep this going infinately? </Item> </Items> </Item> </Items> </Item> </Items> </SampleXml> The only solution I have found has been to just repeat in the xsd as many times as I am willing to copy. Like below. <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="SampleXml"> <xs:complexType> <xs:sequence> <xs:element name="Items"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="Item"> <xs:complexType mixed="true"> <xs:sequence minOccurs="0"> <xs:element name="Items"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="Item"> <xs:complexType mixed="true"> <xs:sequence minOccurs="0"> <xs:element name="Items"> <xs:complexType> <xs:sequence> <xs:element name="Item"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="name" type="xs:string" use="required" /> <xs:attribute name="type" type="xs:string" use="required" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="name" type="xs:string" use="required" /> <xs:attribute name="type" type="xs:string" use="required" /> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="name" type="xs:string" use="required" /> <xs:attribute name="type" type="xs:string" use="required" /> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>

    Read the article

  • Efficient algorithm for Next button on a MySQL result set

    - by David Grayson
    I have a website that lets people view rows in a table (each row is a picture). There are more than 100,000 rows. You can view different subsets of the rows, and you can view them with different sort orders. While you are viewing one of the rows, you can click the "Next" or "Previous" buttons to go the next/previous row in the list. How would you implement the "Next" and "Previous" features of the website? More specifically, if you have an arbitrary query that returns a list of up to 100,000+ rows, and you know some information about the current row someone is viewing, how do you determine the NEXT row efficiently? Here is the pseudo-code of the solution I came up with when the website was young, and it worked well when there were only 1000 rows, but now that there are 100,000 rows I think it is eating up too much memory. int nextRowId(string query, int currentRowId) { array allRowIds = mysql_query(query); // Takes up a lot of memory! int currentIndex = (index of currentRowId in allRowIds); // Takes time! return allRowIds[currentIndex+1]; } While you are thinking about this problem, remember that the website can store more information about the current row than just its ID (for example, the position of the current row in the result set), and this information can be used as a hint to help determine the ID of the next row. Edit: Sorry for not mentioning this earlier, but this isn't just a static website: rows can often be added to the list, and rows can be re-ordered in the list. (Much rarer, rows can be removed from the list.) I think that I should worry about that kind of thing, but maybe you can convince me otherwise.

    Read the article

  • Definitive method for sizing font in css

    - by David
    Hi there, I would like to know some opinions from experienced developers on what they think the definitive way to size fonts (in a base sense). I know that working with ems is considered best but im referring to the best way to set the base font size. There is the technique of setting font to 10px using 62.5 method but i think ie has an issue with rounding which throws this out slightly (perhaps not) YUI framework uses body { font:13px/1.231 arial,helvetica,clean,sans-serif; /* for IE6/7 */ *font-size:small; /* for IE Quirks Mode */ *font:x-small; } which really confuses me! Tripoli uses html { font-size:125%; } body { font-size:50%; } a list apart suggest something along the lines of : body { font-size: 16px; *font-size: 100%; } So which is the best either out of these methods or any alternatives. The best being the easiest to work with and the most reliable cross browser.

    Read the article

  • Build a Visual Studio Project without access to referenced dlls

    - by David Reis
    I have a project which has a set of binary dependencies (assembly dlls for which I do no have the source code). At runtime those dependencies are required pre-installed on the machine and at compile time they are required in the source tree, e,g in a lib folder. As I'm also making source code available for this program I would like to enable a simple download and build experience for it. Unfortunately I cannot redistribute the dlls, and that complicates things, since VS wont link the project without access to the referenced dlls. Is there anyway to enable this project to be built and linked in absence of the real referenced dlls? Maybe theres a way to tell VS to link against an auto generated stub of the dll, so that it can rebuild without the original? Maybe there's a third party tool that will do this? Any clues or best practices at all in this area? I realize the person must have access to the dlls to run the code, so it makes sense that he could add them to the build process, but I'm just trying to save them the pain of collecting all the dlls and placing them in the lib folder manually.

    Read the article

  • C++ Passing `this` into method by reference

    - by David
    I have a class constructor that expects a reference to another class object to be passed in as an argument. I understand that references are preferable to pointers when no pointer arithmetic will be performed or when a null value will not exist. This is the header declaration of the constructor: class MixerLine { private: MIXERLINE _mixerLine; public: MixerLine(const MixerDevice& const parentMixer, DWORD destinationIndex); ~MixerLine(); } This is the code that calls the constructor (MixerDevice.cpp): void MixerDevice::enumerateLines() { DWORD numLines = getDestinationCount(); for(DWORD i=0;i<numLines;i++) { MixerLine mixerLine( this, i ); // other code here removed } } Compilation of MixerDevice.cpp fails with this error: Error 3 error C2664: 'MixerLine::MixerLine(const MixerDevice &,DWORD)' : cannot convert parameter 1 from 'MixerDevice *const ' to 'const MixerDevice &' But I thought pointer values could be assigned to pointers, e.g. Foo* foo = new Foo(); Foo& bar = foo;

    Read the article

  • Disable page cache on a specific page

    - by David Brunelle
    Hi, Not sure if I really am on the right forum, but if not, just tell me. I have a page that is coded in ASP (not .net) which is used to send email. We are currently having a problem in which the page seem to be sent twice sometime. Upon checking, we found out that those who have this problem are coming from big organisation, so it was suggested that their server might cache the file for some reason. I would like to know, is there a way in HTML (or ASP ) to prevent that from happening ? Or is it in IIS that we must set this up ? Thanks,

    Read the article

  • Will this ever result in a stack overflow error?

    - by David
    Will incrementing the instance variables of an object ever lead to a stack overflow error? For example: This method (java) will cause a stack overflow error: class StackOverflow { public static void StackOverflow (int x) { System.out.println (x) ; StackOverflow(x+1) ; } public static void main (String[]arg) { StackOverflow (0) ; } but will this?: (..... is a gap that i've put in to shorten the code. its long enough as it is.) import java.util.*; class Dice { String name ; int x ; int[] sum ; .... public Dice (String name) { this.name = name ; this.x = 0 ; this.sum = new int[7] ; } .... public static void main (String[] arg) { Dice a1 = new Dice ("a1") ; for (int i = 0; i<6000000; i++) { a1.roll () ; printDice(a1) ; } } .... public void roll () { this.x = randNum(1, this.sum.length) ; this.sum[x] ++ ; } public static int randNum (int a, int b) { Random random = new Random() ; int c = (b-a) ; int randomNumber = ((random.nextInt(c)) + a) ; return randomNumber ; } public static void printDice (Dice Dice) { System.out.println (Dice.name) ; System.out.println ("value: "+Dice.x) ; printValues (Dice) ; } public static void printValues (Dice Dice) { for (int i = 0; i<Dice.sum.length; i++) System.out.println ("#of "+i+"'s: "+Dice.sum[i]) ; } } The above doesn't currently cause a stack overflow error but could i get it too if i changed this line in main: for (int i = 0; i<6000000; i++) so that instead of 6 million something sufficiently high were there?

    Read the article

  • Microsoft Access to SQL Server - synchronization

    - by David Pfeffer
    I have a client that uses a point-of-sale solution involving an Access database for its back-end storage. I am trying to provide this client with a service that involves, for SLA reasons, the need to copy parts of this Access database into tables in my own database server which runs SQL Server 2008. I need to do this on a periodic basis, probably about 5 times a day. I do have VPN connectivity to the client. Is there an easy programmatic way to do this, or an available tool? I don't want to handcraft what I assume is a relatively common task.

    Read the article

  • Multiple loadmovie() ends up with multiple videos played at the same time!

    - by David
    Hi, i'm using loadmovie() to load a youtube video player inside my flash website but when i load another video the old one doesn't stop, so i tried unloadmovie to destroy it but it seems that i did a mistake in my code This is how the code looks to stop the old one an load the new: vloader.unloadMovie(); vloader.loadMovie("http://www.youtube.com/v/Alw5hs0chj0&hl=fr&fs=1hJ-mPcGtC"); How to do that? please don't suggest me to use other objects or classes, i only want to edit that code. Note: I have an empty CLIP called "vloader" where i load the video player. Thank you

    Read the article

< Previous Page | 85 86 87 88 89 90 91 92 93 94 95 96  | Next Page >