Search Results

Search found 4252 results on 171 pages for 'david 85'.

Page 117/171 | < Previous Page | 113 114 115 116 117 118 119 120 121 122 123 124  | Next Page >

  • How do I force jquery to center an element when it snaps to another container using the draggable method?

    - by David
    Here's my script. I want some square-shaped draggable objects (in this case just td boxes with numbers in them) to be able to snap to some empty table cells and snap to the center of those cells (empty td boxes), not the top or bottom of those cells, which is what is seems to do by default. <script type="text/javascript"> $(document).ready(function () { $(".inputs div").draggable( { snap: ".spaces" } ); }); </script>

    Read the article

  • Calling a javascript function from an aspx.cs code behind

    - by David Hodgson
    Hi, I would like to call a javascript function from an aspx control. For instance, suppose I had: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <script type="text/javascript"> function test(x, y) { } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click"/> </div> </form> </body> </html> and in the code behind: protected void Button1_Click(object sender, EventArgs e) { // do stuff (really going to a database to fill x and y) int[] x = new int[] { 1, 2, 3, 4, 5 }; int[] y = new int[] { 1, 2, 3, 4, 5 }; // call javascript function as test(x,y); } Is there a way to do it? DUPLICATE:calling-a-javascript-function-at-the-end-of-button-click-code-behind

    Read the article

  • Why do .png backgrounds appear black on iPhone device but not simulator?

    - by David Rea
    I started with a .tiff file and used GraphicConverter to change it to a .png and set a transparency color. Worked fine in the simulator but when I pushed to the device the transparency color became black. Tested with a .png I downloaded from the net and that worked fine, so it seems to only happen with some files. Thus I suspect it has something to do with the way GraphicConverter writes the .pngs, but I don't know enough about file formats to debug it. Any ideas/suggestions? Ideally I'd like to programatically treat all .pngs because my app allowed dynamic loading of arbitrary files, so I can't verify the transparency beforehand.

    Read the article

  • Flex: Bottom-left align components?

    - by David Wolever
    As the title suggests, is there any way to bottom-left align components? An <HBox .../> nested in a <Canvas .../> doesn't work because the elements in the HBox are top-aligned instead of bottom aligned. For example, I'd like my components to be aligned like this: +-------------+ <-- container | components | | | V | | V +--+ | | +-+ | | | | +-+ +--+ | +-------------+

    Read the article

  • Generate A Simple Read-Only DAL?

    - by David
    I've been looking around for a simple solution to this, trying my best to lean towards something like NHibernate, but so far everything I've found seems to be trying to solve a slightly different problem. Here's what I'm looking at in my current project: We have an IBM iSeries database as a primary repository for a third party software suite used for our core business (a financial institution). Part of what my team does is write applications that report on or key off of a lot of this data in some way. In the past, we've been manually creating ADO .NET connections (we're using .NET 3.5 and Visual Studio 2008, by the way) and manually writing queries, etc. Moving forward, I'd like to simplify the process of getting data from there for the development team. Rather than creating connections and queries and all that each time, I'd much rather a developer be able to simply do something like this: var something = (from t in TableName select t); And, ideally, they'd just get some IQueryable or IEnumerable of generated entities. This would be done inside a new domain core that I'm building where these entities would live and the applications would interface with it through a request/response service layer. A few things to note are: The entities that correspond to the database tables should be generated once and we'd prefer to manually keep them updated over time. That is, if columns/tables are added to the database then we shouldn't have to do anything. (If some are deleted, of course, it will break, but that's fine.) But if we need to use a new column, we should be able to just add it to the necessary class(es) without having to re-gen the whole thing. The whole thing should be SELECT-only. We're not doing a full DAL here because we don't want to be able to break anything in the database (even accidentally). We don't need any kind of mapping between our domain objects and the generated entity types. The domain barely covers a fraction of the data that's in there, most of it we'll never need, and we would rather just create re-usable maps manually over time. I already have a logical separation for the DAL where my "repository" classes return domain objects, I'm just looking for a better alternative to manual ADO to be used inside the repository classes. Any suggestions? It seems like what I'm doing is just enough outside the normal demand for DAL/ORM tools/tutorials online that I haven't been able to find anything. Or maybe I'm just overlooking something obvious?

    Read the article

  • Whats wrong with this method?

    - by David
    Here's the method: public static String CPUcolor () { System.out.println ("What color am I?") ; String s = getIns() ; System.out.println ("are you sure I'm "+s+"? (Y/N)") ; String a = getIns() ; while (!((a.equals ("y")) || (a.equals ("Y")) || (a.equals ("n")) || (a.equals ("N")))) { System.out.println ("try again") ; a = getIns () ; } if (a.equals ("n") || a.equals("N")) {CPUcolor() ;} System.out.println ("I am "+s) ; return s ; } here is a possible output of this method (y's and n's are user inputs): What color am I? red are you sure I'm red? (Y/N) N What color am I? blue are you sure I'm blue? (Y/N) N What color am I? Yellow are you sure I'm Yellow? (Y/N) y I am Yellow I am blue I am red Why is it that the line's "I am blue" and "I am Blue" printed? Why are they printed in reverse order with red, the first entered, printed last?

    Read the article

  • Entity Framework projections

    - by David McClelland
    We are investigating the Entity Framework to see if it will meet our particular needs. Here is the scenario I am interested in: I have a large table (let's call it VeryWideRecord) which has many columns, and it has a corresponding business object (it's also called VeryWideRecord). I would like to be able to query my database for a VeryWideRecord business object, but only have values for certain columns returned by the underlying SQL. Can I do this with the Entity Framework? I am uncertain as to whether this could be done with the Entity Framework's table splitting feature, because the application needs to be able (at runtime) to change the columns that are requested. The reason for this is that we are trying to minimize the amount of information that is going across the wire. I see how this could be done using NHibernate (example), but how can I do this with the Entity Framework?

    Read the article

  • Silverlight horizontal stretch and get position issue

    - by David
    I have a Grid (container) wich in turn has several grids(subContainers) arranged by rows. Each one of those "subContainers" has diferent columns and controls. And each of those "subContainers" has the horizontal alignment set to stretch, and it has to stay that way, since the layout this viewer depends on it. I use the "container" to set each control on it's adequate position. So far so good. Now comes my headache... I want to remove the control from the grid and put it in a canvas, at the same exact position, only, the position it returns is as if the control is set to the beggining of the grid and not it's true position. For testing purposes, I've set the "subContainters" horizontal alignment to center and (despite the layout is totally wrong) every control is in it's right position when sent to a canvas, wich it doesn't happen when HA = stretch. Here's the code I'm using to get position: GeneralTransform gt = nc.TransformToVisual(gridZoom); Point offset = gt.Transform(new Point()); So you can understand, for example, my first control should be somewhere like (80, 1090), but the point that I get is (3,3). Can anyone help me? Thanks

    Read the article

  • Why are these lines being skipped? (java)

    - by David
    Here's the relevant bit of the source code: 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") ; printValues (a1) ; } 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]) ; } } Here is the output: #of 0's: 0 #of 1's: 0 #of 2's: 0 #of 3's: 0 #of 4's: 0 #of 5's: 0 #of 6's: 0 Why didn't these two lines execute inside printDice: System.out.println (Dice.name) ; System.out.println ("value: "+Dice.x) ; if they had then i would expect to see "a1" and "Value: 0" printed at the top of the rows of #of's

    Read the article

  • How to do it more efficiently?

    - by David Maricone
    Let's imagine we should get some data... var data = []; //some code omitted that might fill in the data (though might not) Then we need to do something with the data. And my question is how to do it more effectively. Like so?: if (data.length) { for (var i = 0; i < data.length; i++) { //iterate over the data and do something to it } } Or just like so?: for (var i = 0; i < data.length; i++) { //iterate over the data and do something to it } The point is whether to check the length before iterating or not?

    Read the article

  • Flash: Correctly handling click-and-drag outside the browser?

    - by David Wolever
    What's the correct way to detect, from Flash, when someone has started a drag within the browser (eg, a MOUSE_DOWN event), dragged the mouse outside the browser window, released the button, then moved the mouse back over the browser? For example (assuming StackOverflow was a Flash application): I've tried the "obvious" thing, checking event.buttonDown in the MOUSE_MOVE handler, but even though the mouse button is up, event.buttonDown is true in step 2 (above). So, is there any other way to check the "real" status of the mouse button? Or any other way to handle this situation?

    Read the article

  • How do I map a one-to-one value type association in an joined-subclass?

    - by David Rubin
    I've got a class hierarchy mapped using table-per-subclass, and it's been working out great: class BasicReport { ... } class SpecificReport : BasicReport { ... } With mappings: <class name="BasicReport" table="reports"> <id name="Id" column="id">...</id> <!-- some common properties --> </class> <joined-subclass name="SpecificReport" table="specificReports" extends="BasicReport"> <key column="id"/> <!-- some special properties --> </joined-subclass> So far, so good. The problem I'm struggling with is how to add a property to one of my subclasses that's both a value type for which I have an IUserType implemented and also mapped via an association: class OtherReport : BasicReport { public SpecialValue V { get; set; } } class SpecialValueUserType : IUserType { ... } What I'd like to do is: <joined-subclass name="OtherReport" table="otherReports" extends="BasicReport"> <key column="id"/> <join table="rptValues" fetch="join"> <key column="rptId"/> <property name="V" column="value" type="SpecialValueUserType"/> </join> </joined-subclass> This accurately reflects the intent, and the pre-existing database schema I'm tied to: the SpecialValue instance is a property of the OtherReport, but is stored in a separate table ("rptValues"). Unfortunately, it seems as though I can't do this, because <join> elements can't be used in <joined-subclass> mappings. <one-to-one> would require creating a class mapping for SpecialValue, which doesn't make any sense given that SpecialValue is just a meaningful scalar. So what can I do? Do I have any options? Right now I'm playing a game with sets: class OtherReport : BasicReport { public SpecialValue V { get { return _values.Count() > 0 ? _values.First() : null; } set { _values.Clear(); _values.Add(value); } } private ICollection<SpecialValue> _values; } With mapping: <joined-subclass name="OtherReport" table="otherReports" extends="BasicReport"> <key column="id"/> <set name="_values" access="field" table="rptValues" cascade="all-delete-orphan"> <key column="rptId" /> <element column="value" type="SpecialValueUserType"/> </set> </joined-subclass> Thanks in advance for the help! I've been banging my head into my desk for several days now.

    Read the article

  • A simple question about type coercion in C++

    - by David
    Given a function prototype, and a type definition: int my_function(unsigned short x); typedef unsigned short blatherskite; Is the following situation defined by standard: int main(int argc, char** argv) { int result; blatherskite b; b=3; result = my_function(b); } Do I get type coercion predictably via the function prototype?

    Read the article

  • Non-SQL API for SQL Server?

    - by David Lively
    Is there any sort of non-SQL API for talking to SQL Server? I'm curious if there is a more direct way to retrieve table or view data. (I don't have a problem with SQL, just curious if any of the layer between the SQL parser and the underlying data store is exposed.)

    Read the article

  • How can I determine when an InnoDB table was last changed?

    - by David M
    I've had success in the past storing the (heavily) processed results of a database query in memcached, using the last update time of the underlying tables(s) as part of the cache key. For MyISAM tables, that last changed time is available in SHOW TABLE STATUS. Unfortunately, that's usually NULL for InnoDB tables. In MySQL 4.1, the ctime for an InnoDB in its SHOW TABLE STATUS line was usually its actual last update time, but that doesn't seem to be true for MySQL 5.1. There is a DATETIME field in the table, but it only shows when a row has been modified - it cannot show the deletion time of a row that's not there anymore! So, I really cannot use MAX(update_time). Here's the really tricky part. I have a number of replicas that I do reads from. Can I figure out the state of the table that doesn't rely on when the changes have actually been applied? My conclusion after working on this for a while is that it's not going to be possible to get this information as cheaply as I'd like. I'm probably going to cache data until the time that I expect the table to change (it's updated once a day), and let the query cache help out where it can.

    Read the article

  • GWT + Seam, cannot fetch scoped beans from gwt servlet in seam resource servlet.

    - by David Göransson
    Hello all I am trying to get session and conversation scoped beans to a gwt servlet in the seam resource servlet. I have a conversation scoped bean: @Name ("viewFormCopyAction") @Scope (ScopeType.CONVERSATION) public class ViewFormCopyAction {} and a session scoped bean: @Name ("authenticator") @Scope (ScopeType.SESSION) public class AuthenticatorAction {} There is a RemoteService interface: @RemoteServiceRelativePath ("strokesService") public interface StrokesService extends RemoteService { public Position getPosition (int conversationId); } with corresponding async interface: public interface StrokesServiceAsync extends RemoteService { public void getPosition (int conversationId, AsyncCallback callback); } and implementation: @Name ("com.web.actions.forms.gwt.client.StrokesService") @Scope (ScopeType.EVENT) public class StrokesServiceImpl implements StrokesService { @In Manager manager; @Override @WebRemote public Position getPosition (int conversationId) { manager.switchConversation( "" + conversationId ); ViewFormCopyAction vfca = (ViewFormCopyAction) Component.getInstance( "viewFormCopyAction" ); AuthenticatorAction aa = (AuthenticatorAction) Component.getInstance( "authenticator" ); return null; } } The gwt page is within an IFrame in a regular seam page and the conversationId is propagted with the src attribute of the IFrame. Both bean objects end up with only null values. Can anyone see anything wrong with the code? I know that I could use strings instead of the int, but never mind that at this point.

    Read the article

  • asp.net MVC ActionMethod causing null exception on parameter

    - by David Liddle
    I am trying to add filter functionality that sends a GET request to the same page to filter records in my table. The problem I am having is that the textbox complains about null object reference when a parameter is not passed. For example, when the person first views the page the url is '/mycontroller/myaction/'. Then when they apply a filter and submit the form it should be something like 'mycontroller/myaction?name=...' Obviously the problem stems from when the name value has not been passed (null) it is still trying to be bound to the 'name' textbox. Any suggestions on what I should do regarding this problem? UPDATE I have tried setting the DefaultValue attribute but I am assuming this is only for route values and not query string values ActionResult MyAction([DefaultValue("")] string name) //Action - /mycontroler/myaction ActionResult MyAction(string name) { ...do stuff } //View <div id="filter"> <% Html.BeginForm("myaction", "mycontroller", FormMethod.Get); %> Name: <%= Html.TextBox("name") %> .... </div> <table>...my list of filtered data

    Read the article

  • How to detect crashing tabed webbrowser and handle it?

    - by David Eaton
    I have a desktop application (forms) with a tab control, I assign a tab and a new custom webrowser control. I open up about 10 of these tabs. Each one visits about 100 - 500 different pages. The trouble is that if 1 webbrowser control has a problem it shuts down the entire program. I want to be able to close the offending webbrowser control and open a new one in it's place. Is there any event that I need to subscribe to catch a crashing or unresponsive webbrowser control ? I am using C# on windows 7 (Forms), .NET framework v4 =============================================================== UPDATE: 1 - The Tabbed WebBrowser Example Here is the code I have and How I use the webbrowser control in the most basic way. Create a new forms project and name it SimpleWeb Add a new class and name it myWeb.cs, here is the code to use. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Security.Policy; namespace SimpleWeb { //inhert all of webbrowser class myWeb : WebBrowser { public myWeb() { //no javascript errors this.ScriptErrorsSuppressed = true; //Something we want set? AssignEvents(); } //keep near the top private void AssignEvents() { //assign WebBrowser events to our custom methods Navigated += myWeb_Navigated; DocumentCompleted += myWeb_DocumentCompleted; Navigating += myWeb_Navigating; NewWindow += myWeb_NewWindow; } #region Events //List of events:http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser_events%28v=vs.100%29.aspx //Fired when a new windows opens private void myWeb_NewWindow(object sender, System.ComponentModel.CancelEventArgs e) { //cancel all popup windows e.Cancel = true; //beep to let you know canceled new window Console.Beep(9000, 200); } //Fired before page is navigated (not sure if its before or during?) private void myWeb_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs args) { } //Fired after page is navigated (but not loaded) private void myWeb_Navigated(object sender, System.Windows.Forms.WebBrowserNavigatedEventArgs args) { } //Fired after page is loaded (Catch 22 - Iframes could be considered a page, can fire more than once. Ads are good examples) private void myWeb_DocumentCompleted(System.Object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs args) { } #endregion //Answer supplied by mo. (modified)? public void OpenUrl(string url) { try { //this.OpenUrl(url); this.Navigate(url); } catch (Exception ex) { MessageBox.Show("Your App Crashed! Because = " + ex.ToString()); //MyApplication.HandleException(ex); } } //Keep near the bottom private void RemoveEvents() { //Remove Events Navigated -= myWeb_Navigated; DocumentCompleted -= myWeb_DocumentCompleted; Navigating -= myWeb_Navigating; NewWindow -= myWeb_NewWindow; } } } On Form1 drag a standard tabControl and set the dock to fill, you can go into the tab collection and delete the pre-populated tabs if you like. Right Click on Form1 and Select "View Code" and replace it with this code. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using mshtml; namespace SimpleWeb { public partial class Form1 : Form { public Form1() { InitializeComponent(); //Load Up 10 Tabs for (int i = 0; i <= 10; i++) { newTab("Test_" + i, "http://wwww.yahoo.com"); } } private void newTab(string Title, String Url) { //Create a new Tab TabPage newTab = new TabPage(); newTab.Name = Title; newTab.Text = Title; //create webbrowser Instance myWeb newWeb = new myWeb(); //Add webbrowser to new tab newTab.Controls.Add(newWeb); newWeb.Dock = DockStyle.Fill; //Add New Tab to Tab Pages tabControl1.TabPages.Add(newTab); newWeb.OpenUrl(Url); } } } Save and Run the project. Using the answer below by mo. , you can surf the first url with no problem, but what about all the urls the user clicks on? How do we check those? I prefer not to add events to every single html element on a page, there has to be a way to run the new urls thru the function OpenUrl before it navigates without having an endless loop. Thanks.

    Read the article

  • Strongly typed dynamic Linq sorting

    - by David
    I'm trying to build some code for dynamically sorting a Linq IQueryable<. The obvious way is here, which sorts a list using a string for the field name http://dvanderboom.wordpress.com/2008/12/19/dynamically-composing-linq-orderby-clauses/ However I want one change - compile time checking of field names, and the ability to use refactoring/Find All References to support later maintenance. That means I want to define the fields as f=f.Name, instead of as strings. For my specific use I want to encapsulate some code that would decide which of a list of named "OrderBy" expressions should be used based on user input, without writing different code every time. Here is the gist of what I've written: var list = from m Movies select m; // Get our list var sorter = list.GetSorter(...); // Pass in some global user settings object sorter.AddSort("NAME", m=m.Name); sorter.AddSort("YEAR", m=m.Year).ThenBy(m=m.Year); list = sorter.GetSortedList(); ... public class Sorter ... public static Sorter GetSorter(this IQueryable source, ...) The GetSortedList function determines which of the named sorts to use, which results in a List object, where each FieldData contains the MethodInfo and Type values of the fields passed in AddSort: public SorterItem AddSort(Func field) { MethodInfo ... = field.Method; Type ... = TypeOf(TKey); // Create item, add item to diction, add fields to item's List // The item has the ThenBy method, which just adds another field to the List } I'm not sure if there is a way to store the entire field object in a way that would allow it be returned later (it would be impossible to cast, since it is a generic type) Is there a way I could adapt the sample code, or come up with entirely new code, in order to sort using strongly typed field names after they have been stored in some container and retrieved (losing any generic type casting)

    Read the article

  • Ravendb 960 does not honor JsonIgnore with property of Dictionary<string, object>

    - by David Robbins
    Does JsonIgnore not work when a property has data? I have the followin class: public class SomeObject { public string Name { get; set; } public DateTime Created { get; set; } public List<string> ErrorList { get; set; } [JsonIgnore] public Dictionary<string, object> Parameters { get; set; } public SomeObject() { this.ErrorList = new List<string>(); this.Parameters = new Dictionary<string, object>(); } } My expectation was that JsonIgnore would exclude properties from De- / Serialization. My RavenDB document has data. Am I missing something?

    Read the article

< Previous Page | 113 114 115 116 117 118 119 120 121 122 123 124  | Next Page >