Search Results

Search found 1815 results on 73 pages for 'andrew kelly'.

Page 14/73 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Regular Expressions in PHP

    - by kelly
    Sorry for unclear description, my English is not good. My problem is that I want to decode a string, and this string has nested content delimited by {}. For example: The string: {any string0{any string 00{any string 000....}}}{any string1}any string. The result I want to get: array[0] = {any string0{any string 00{any string 000....}}} array[1] = {any string1} I hope it's clear enough.

    Read the article

  • Jquery: syntax for inserting a function

    - by kelly
    I'm trying to integrate an animation by using the bezier path plug-in and I can't seem to implement it right. Stripped down, here's what I have: $('#next2btn').live('click', function(){ $(this).attr('id','next3btn'); $('#content2').show(300, function() { $('#account').fadeTo(500,1.0) var arc_params = { center: [278,120], radius: 186, start: -90, end: 90, dir: -1 }; }); $("#account").animate({path : new $.path.arc(arc_params)},1000); }); So, I'm trying to add this piece of code into what I have: var arc_params = { center: [278,120], radius: 186, start: -90, end: 90, dir: -1 }; }); $("#account").animate({path : new $.path.arc(arc_params)},1000) which works on its own as does the other. I'm thinking it's something about declaring that variable and where I do that. I'm essentially chaining a few different animations/actions upon a button click. Thanks for any insight- kj

    Read the article

  • When to use CreateChildControls() vs. embedding in the ASPX

    - by Kelly French
    I'm developing a webpart for SharePoint 2007 and have seen several posts that advise to do all the creation of controls in the code-behind. I'm transitioning from Java J2EE development so I don't have the platform history of .Net/ASP/etc. In other places it shows how you can do the same thing by embedding the control definition into the asp page with tags My question is this: What is the rule governing where to implement controls? Has this rule changed recently, ASP vs ASP.Net or ASP.Net MVC maybe? Is this advice limited to SharePoint development?

    Read the article

  • What's the recommended implementation for hashing OLE Variants?

    - by Barry Kelly
    OLE Variants, as used by older versions of Visual Basic and pervasively in COM Automation, can store lots of different types: basic types like integers and floats, more complicated types like strings and arrays, and all the way up to IDispatch implementations and pointers in the form of ByRef variants. Variants are also weakly typed: they convert the value to another type without warning depending on which operator you apply and what the current types are of the values passed to the operator. For example, comparing two variants, one containing the integer 1 and another containing the string "1", for equality will return True. So assuming that I'm working with variants at the underlying data level (e.g. VARIANT in C++ or TVarData in Delphi - i.e. the big union of different possible values), how should I hash variants consistently so that they obey the right rules? Rules: Variants that hash unequally should compare as unequal, both in sorting and direct equality Variants that compare as equal for both sorting and direct equality should hash as equal It's OK if I have to use different sorting and direct comparison rules in order to make the hashing fit. The way I'm currently working is I'm normalizing the variants to strings (if they fit), and treating them as strings, otherwise I'm working with the variant data as if it was an opaque blob, and hashing and comparing its raw bytes. That has some limitations, of course: numbers 1..10 sort as [1, 10, 2, ... 9] etc. This is mildly annoying, but it is consistent and it is very little work. However, I do wonder if there is an accepted practice for this problem.

    Read the article

  • Using linq select to provide a grid datasource, properties are read-only

    - by Kelly
    I am using the return from the following call as the datasource for a grid. public object GetPropertyDataSourceWithCheckBox( ) { return ( from p in LocalProperties join c in GetCities( ) on p.CityID equals c.CityID orderby p.StreetNumber select new { Selected = false, p.PropertyID, p.StreetNumber, p.StreetName, c.CityName } ).ToList( ); } I get a checkbox in the grid, but it is READ-ONLY. [For the record, the grid is DevExpress.] Is there a way around this, short of creating a non-anonymous class?

    Read the article

  • Problem with absolute positioning div over SWF and IE 8.

    - by Michael S. Kelly
    I'm attempting to use the old IFrame-over-SWF trick to get HTML to display "inside" a SWF. I'm following the example provided by Brian Deitte at: http://www.deitte.com/IFrameDemo3/IFrameDemo.html. (The source code can be viewed and downloaded by right-clicking on the SWF and selecting "View Source".) In the latest versions of Firefox, Google, Opera, and Safari on the Mac, it all looks good. But in IE 8 the absolutely positioned div containing the IFrame is positioned too far up and left, and the height and width are considerably smaller. Thoughts?

    Read the article

  • Converting C source to C++

    - by Barry Kelly
    How would you go about converting a reasonably large (300K), fairly mature C codebase to C++? The kind of C I have in mind is split into files roughly corresponding to modules (i.e. less granular than a typical OO class-based decomposition), using internal linkage in lieu private functions and data, and external linkage for public functions and data. Global variables are used extensively for communication between the modules. There is a very extensive integration test suite available, but no unit (i.e. module) level tests. I have in mind a general strategy: Compile everything in C++'s C subset and get that working. Convert modules into huge classes, so that all the cross-references are scoped by a class name, but leaving all functions and data as static members, and get that working. Convert huge classes into instances with appropriate constructors and initialized cross-references; replace static member accesses with indirect accesses as appropriate; and get that working. Now, approach the project as an ill-factored OO application, and write unit tests where dependencies are tractable, and decompose into separate classes where they are not; the goal here would be to move from one working program to another at each transformation. Obviously, this would be quite a bit of work. Are there any case studies / war stories out there on this kind of translation? Alternative strategies? Other useful advice? Note 1: the program is a compiler, and probably millions of other programs rely on its behaviour not changing, so wholesale rewriting is pretty much not an option. Note 2: the source is nearly 20 years old, and has perhaps 30% code churn (lines modified + added / previous total lines) per year. It is heavily maintained and extended, in other words. Thus, one of the goals would be to increase mantainability. [For the sake of the question, assume that translation into C++ is mandatory, and that leaving it in C is not an option. The point of adding this condition is to weed out the "leave it in C" answers.]

    Read the article

  • How do I use a string as a keyword argument?

    - by Issac Kelly
    Specifically, I'm trying to use a string to arbitrairly filter the ORM. I've tried exec and eval solutions, but I'm running into walls. The code below doesn't work, but it's the best way I know how to explain where I'm trying to go from gblocks.models import Image f = 'image__endswith="jpg"' # Would be scripted in another area, but passed as text <user input> d = Image.objects.filter(f) #for the non-django pythonistas: d = Image.objects.filter(image__endswith="jpg") # would be the non-dynamic equivalent.

    Read the article

  • progress bar in separate window

    - by Kelly
    (WPF) We have been asked to build a little window that pops up when the app is busy (instead of or in addition to a wait cursor). We put a textblock in the window, and a ProgressBar with IsIndeterminate = true. We call show on the little window, and then start up our long-running process, calling Close on the little window when we are through. However, during the long-running process, the ProgressBar does not show any activity, and the little window shows (Not Responding) in its title. Is this even possible? A better idea?

    Read the article

  • Activator.CreateInstance with type name as string and including parameters

    - by Kelly
    I am working in .Net 3.5, looking at all the various constructors for Activator.CreateInstance. I want to create an instance of a class, calling a particular constructor. I do not have the class type, only its name. I have the following, which works, but actually winds up calling the parameterless constructor first, then the one I want. This is not a terribly big deal, but the parameterless constructor calls a rather busy base constructor, and the constructor I want to call does, too. In other words, given a type, calling CreateInstance with parameters is easy (only the last two lines below), but given only a type name, is there a better way than this? ObjectHandle oh = Activator.CreateInstance( "MyDllName", "MyNS." + "MyClassName" ); object o = oh.Unwrap( ); object newObj = Activator.CreateInstance( o.GetType( ), new object[] { param1 } ); return ( IMyDesiredObject )newObject; Thanks!

    Read the article

  • Mass update of data in sql from int to varchar

    - by Christopher Kelly
    we have a large table (5608782 rows and growing) that has 3 columns Zip1,Zip2, distance all columns are currently int, we would like to convert this table to use varchars for international usage but need to do a mass import into the new table convert zip < 5 digits to 0 padded varchars 123 becomes 00123 etc. is there a way to do this short of looping over each row and doing the translation programmaticly?

    Read the article

  • Find files on a remote server

    - by Peter Kelly
    I have a web-service that resides on serverA. The webservice will be responsible for finding files of a certain type in a virtual directory on serverB and then returning the full URL to the files. I have the service working if the files are located on the same machine - this is straight-forward enough. My question is what is the best way to find all files of a certain type (say *.xml) in all directories below a known virtual directory on a remote server? So for example, the webservice is on http://ServerA/service.asmx and the virtual directory is located at http://serverB/virtualdirectory So in this code, obviously the DirectoryInfo will not take a path to the remote server - how do I access this so I can find the files it contains? How do I then get the full URL to a file found on that remote server? DirectoryInfo updateDirectory = new DirectoryInfo(path); FileInfo[] files = updateDirectory.GetFiles("*.xml", SearchOption.AllDirectories); foreach (FileInfo fileInfo in files) { // Get URL to the file } I cannot have the files and the service on the same server - IT decision that is out of my hands. Thanks!

    Read the article

  • dynamically changing the selector text

    - by kelly
    I have a 'next' button which fades out a div, shows another, changes out a graphic and then... I want it to change the actual ID of the 'next' button but neither .html nor replaceWith seem to be working. I have this: $(document).ready(function(){ $('#portfolio').fadeTo(500,0.25); $('#account') .animate({width:"10.1875em",height:"11.1875em",duration:'medium'}); $('#next2_btn').click(function(){ $('#content').fadeTo(300, 0.0, function() { $('#content2').show(300, function() { $('#next2_btn').$('#next2_btn'.value).html('<area shape="rect" coords="826,935,906,971" id="next3_btn" href="#">') $('#account').fadeTo(500,1.0) .animate({marginLeft:"220px", width:"2em",'height' :"2em",duration:'medium'}) .animate({     marginLeft:"400px",     marginTop:"35px",     width:"7em",     height:"7em", duration:"medium"     }, 'medium', 'linear', function() {     $('#statusGraphic').replaceWith('<img src="state2_138x28.gif">');     }) .fadeTo(500,0.5); $('#portfolio') .fadeTo(500,1.5) .animate({marginLeft:"-175px", width:"2em",height:"2.5em",duration:'medium'}) .animate({marginLeft:"-330px", width:"8.5em",height:"9.9375em",duration:'medium'}); }); }) })

    Read the article

  • Can't get KnownType to work with WCF

    - by Kelly Cline
    I have an interface and a class defined in separate assemblies, like this: namespace DataInterfaces { public interface IPerson { string Name { get; set; } } } namespace DataObjects { [DataContract] [KnownType( typeof( IPerson ) ) ] public class Person : IPerson { [DataMember] public string Name { get; set; } } } This is my Service Interface: public interface ICalculator { [OperationContract] IPerson GetPerson ( ); } When I update my Service Reference for my Client, I get this in the Reference.cs: public object GetPerson() { return base.Channel.GetPerson(); I was hoping that KnownType would give me IPerson instead of "object" here. I have also tried [KnownType( typeof( Person ) ) ] with the same result. I have control of both client and server, so I have my DataObjects (where Person is defined) and DataInterfaces (where IPerson is defined) assemblies in both places. Is there something obvious I am missing? I thought KnownType was the answer to being able to use interfaces with WCF. ----- FURTHER INFORMATION ----- I removed the KnownType from the Person class and added [ServiceKnownType( typeof( Person ) ) ] to my service interface, as suggested by Richard. The client-side proxy still looks the same, public object GetPerson() { return base.Channel.GetPerson(); , but now it doesn't blow up. The client just has an "object", though, so it has to cast it to IPerson before it is useful. var person = client.GetPerson ( ); Console.WriteLine ( ( ( IPerson ) person ).Name );

    Read the article

  • MVC.net 2 - change the HTML outputed by ValidationMessageFor - can this be down via templates?

    - by Nathan Kelly
    MVC.net 2 by default outputs validation messages like this: <span id="UserName_validationMessage" class="field-validation-valid">A Validation message</span> I would like it to do it like this: <label id="UserName_validationMessage" class="field-validation-valid">A Validation message</label> Is there a way to do it like the display and editor templates? Or is there another way to do it globally?

    Read the article

  • jQuery: Circulate plugin: stopping midway in animation

    - by kelly
    Has anyone had any luck in altering the plug-in code so that one might animate an object in "3d" space for only a 1/4 or 1/2 turn? As it stands, an object must complete a full circle before stopping or looping. And for those who haven't seen it yet: http://css-tricks.com/examples/Circulate/

    Read the article

  • Drupal: Can Book layout menu be added and expanded in the primary menu?

    - by kelly
    I'd like to take a book menu and just add it right to the primary links. Any way to do that? It can appear alreayd in the Navigation links but I'd like it to expand to deeper child levels. Also, I'm using a theme (Newswire) that creates a suckerfish menu from the primary links, so if I can automatically add my book pages to the primary links that would be ideal... Sample Book Layout

    Read the article

  • Mongodb - how to deserialze when a property has an Interface return type

    - by Mark Kelly
    I'm attempting to avoid introducing any dependencies between my Data layer and client code that makes use of this layer, but am running into some problems when attempting to do this with Mongo (using the MongoRepository) MongoRepository shows examples where you create Types that reflect your data structure, and inherit Entity where required. Eg. [CollectionName("track")] public class Track : Entity { public string name { get; set; } public string hash { get; set; } public Artist artist { get; set; } public List<Publish> published {get; set;} public List<Occurence> occurence {get; set;} } In order to make use of these in my client code, I'd like to replace the Mongo-specific types with Interfaces, e.g: [CollectionName("track")] public class Track : Entity, ITrackEntity { public string name { get; set; } public string hash { get; set; } public IArtistEntity artist { get; set; } public List<IPublishEntity> published {get; set;} public List<IOccurenceEntity> occurence {get; set;} } However, the Mongo driver doesn't know how to treat these interfaces, and I understandably get the following error: An error occurred while deserializing the artist property of class sf.data.mongodb.entities.Track: No serializer found for type sf.data.IArtistEntity. --- MongoDB.Bson.BsonSerializationException: No serializer found for type sf.data.IArtistEntity. Does anyone have any suggestions about how I should approach this?

    Read the article

  • Import Data from Excel Spreadsheet or CVS into MySQL

    - by Kelly Roper
    I have a spreadsheet which really has only one complicated table. I basically convert the spreadsheet to a cvs and use a groovy script to generate the INSERT scripts. However, I cannot do this with a table that has 28 fields with data within some of the fields on the spreadsheet that make importing into the CVS even more complicated. So the fields in the new CVS are not differentiated properly or my script has not accounted for it. Does anyone have any suggestions on a better approach to do this? Thanks.

    Read the article

  • Calling back a functions value

    - by Jason Kelly
    I need your help, I cannot, for the life of me, figure this out. I've had my head wrapped around it only to no avail. Ideally, i'd like to setup two functions. 1 function: select_date() to interact with the user to select a date from the jQuery Date picker. If the dialog is closed then return as null. Then a second function: test() to check wether or not a date was picked/selected.' Here's my delema, when the function test() is executed, an alert box pops up and says "undefined" which means, I never get to select a date and it always being "undefined" I dont see what I am doing wrong here and everything seems logical to me. <!DOCTYPE html> <html> <head> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/jquery-ui.js"></script> <script type="text/javascript"> function select_date() { var sdate $('#dd').dialog({ autoOpen: true, modal: true, overlay: { opacity: 0.5, background: 'black' }, title: "title", height: 265, width: 235, draggable: false, resizable: false }); $('#d1').datepicker({ onSelect: function () { $("#dd").dialog("close"); } }); return sdate } function test() { var x = select_date() alert(x) } </script> <style type="text/css"> #d1 {font-size:64%;} </style> </head> <body> <div id="dd"> <div id="d1"> </div> </div> <a href="javascript:test()">test</a> </body> </html>

    Read the article

  • Returning the Name of a column header

    - by Jason Kelly
    I need your help, Given the html table below, how can I create a javascript function that will, at the click of a mouse, alert me the name of the column header? Ie. if I click on the COLORS header, a javascript box will popup and alert("COLORS")? <html> <head> </head> <body> <table border="1" cellspacing="1" width="500"> <tr> <td>FRUITS</td> <td>COLORS</td> <td>VEGGIES</td> <td>NUMBERS</td> </tr> <tr> <td>apples</td> <td>red</td> <td>carrots</td> <td>123</td> </tr> <tr> <td>oranges</td> <td>blue</td> <td>celery</td> <td>456</td> </tr> <tr> <td>pears</td> <td>green</td> <td>brocoli</td> <td>789</td> </tr> <tr> <td>mangos</td> <td>yellow</td> <td>lettuce</td> <td>098</td> </tr> </table> </body> </html>

    Read the article

  • header location won't work in php

    - by Jayden Kelly
    I am making a login page for my website but the header location won't work. here is the code of login.php: <?php include ( './includes/header.php' ); if (isset($_POST['submit'])) { $username = $_POST['username']; $password = $_POST['password']; $check_username = mysql_query("SELECT username FROM users WHERE username='$username'"); $numrows = mysql_num_rows($check_username); if ($numrows != 1) { echo 'That User doesn\'t exist.'; } else { $check_password = mysql_query("SELECT password FROM users WHERE password='$password' && username='$username'"); while ($row = mysql_fetch_assoc($check_password)) { $password_db = $row['password']; if ($password_db == $password) { $_SESSION['username'] = $username; header("Location: members.php"); } } } } ?> <h2>Login to Your Account</h2> <form action='login.php' method='POST'> <input type='text' name='username' value='Username ...' onclick='value=""'/><p /> <input type='password' name='password' value='Password ...' onclick='value=""'/><p /> <input type='submit' name='submit' value='Login to my Account' /> </form> I would really appreciate it if someone could help me, thanks. P.S. If you need the php part of the header file it is here: <?php session_start(); include ( './includes/functions.php' ); include ( './includes/connect_to_mysql.php' ); ?>

    Read the article

  • TwoWay Binding With ItemsControl

    - by Andrew
    I'm trying to write a user control that has an ItemsControl, the ItemsTemplate of which contains a TextBox that will allow for TwoWay binding. However, I must be making a mistake somewhere in my code, because the binding only appears to work as if Mode=OneWay. This is a pretty simplified excerpt from my project, but it still contains the problem: <UserControl x:Class="ItemsControlTest.UserControl1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="300" Width="300"> <Grid> <StackPanel> <ItemsControl ItemsSource="{Binding Path=.}" x:Name="myItemsControl"> <ItemsControl.ItemTemplate> <DataTemplate> <TextBox Text="{Binding Mode=TwoWay, UpdateSourceTrigger=LostFocus, Path=.}" /> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> <Button Click="Button_Click" Content="Click Here To Change Focus From ItemsControl" /> </StackPanel> </Grid> </UserControl> Here's the code behind for the above control: using System; using System.Windows; using System.Windows.Controls; using System.Collections.ObjectModel; namespace ItemsControlTest { /// <summary> /// Interaction logic for UserControl1.xaml /// </summary> public partial class UserControl1 : UserControl { public ObservableCollection<string> MyCollection { get { return (ObservableCollection<string>)GetValue(MyCollectionProperty); } set { SetValue(MyCollectionProperty, value); } } // Using a DependencyProperty as the backing store for MyCollection. This enables animation, styling, binding, etc... public static readonly DependencyProperty MyCollectionProperty = DependencyProperty.Register("MyCollection", typeof(ObservableCollection<string>), typeof(UserControl1), new UIPropertyMetadata(new ObservableCollection<string>())); public UserControl1() { for (int i = 0; i < 6; i++) MyCollection.Add("String " + i.ToString()); InitializeComponent(); myItemsControl.DataContext = this.MyCollection; } private void Button_Click(object sender, RoutedEventArgs e) { // Insert a string after the third element of MyCollection MyCollection.Insert(3, "Inserted Item"); // Display contents of MyCollection in a MessageBox string str = ""; foreach (string s in MyCollection) str += s + Environment.NewLine; MessageBox.Show(str); } } } And finally, here's the xaml for the main window: <Window x:Class="ItemsControlTest.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:src="clr-namespace:ItemsControlTest" Title="Window1" Height="300" Width="300"> <Grid> <src:UserControl1 /> </Grid> </Window> Well, that's everything. I'm not sure why editing the TextBox.Text properties in the window does not seem to update the source property for the binding in the code behind, namely MyCollection. Clicking on the button pretty much causes the problem to stare me in the face;) Please help me understand where I'm going wrong. Thanx! Andrew

    Read the article

  • I can't get SetSystemTime to work in Windows Vista using C# with Interop (P/Invoke).

    - by Andrew
    Hi, I'm having a hard time getting SetSystemTime working in my C# code. SetSystemtime is a kernel32.dll function. I'm using P/invoke (interop) to call it. SetSystemtime returns false and the error is "Invalid Parameter". I've posted the code below. I stress that GetSystemTime works just fine. I've tested this on Vista and Windows 7. Based on some newsgroup postings I've seen I have turned off UAC. No difference. I have done some searching for this problem. I found this link: http://groups.google.com.tw/group/microsoft.public.dotnet.framework.interop/browse_thread/thread/805fa8603b00c267 where the problem is reported but no resolution seems to be found. Notice that UAC is also mentioned but I'm not sure this is the problem. Also notice that this gentleman gets no actual Win32Error. Can someone try my code on XP? Can someone tell me what I'm doing wrong and how to fix it. If the answer is to somehow change permission settings programatically, I'd need an example. I would have thought turning off UAC should cover that though. I'm not required to use this particular way (SetSystemTime). I'm just trying to introduce some "clock drift" to stress test something. If there's another way to do it, please tell me. Frankly, I'm surprised I need to use Interop to change the system time. I would have thought there is a .NET method. Thank you very much for any help or ideas. Andrew Code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.InteropServices; namespace SystemTimeInteropTest { class Program { #region ClockDriftSetup [StructLayout(LayoutKind.Sequential)] public struct SystemTime { [MarshalAs(UnmanagedType.U2)] public short Year; [MarshalAs(UnmanagedType.U2)] public short Month; [MarshalAs(UnmanagedType.U2)] public short DayOfWeek; [MarshalAs(UnmanagedType.U2)] public short Day; [MarshalAs(UnmanagedType.U2)] public short Hour; [MarshalAs(UnmanagedType.U2)] public short Minute; [MarshalAs(UnmanagedType.U2)] public short Second; [MarshalAs(UnmanagedType.U2)] public short Milliseconds; } [DllImport("kernel32.dll")] public static extern void GetLocalTime( out SystemTime systemTime); [DllImport("kernel32.dll")] public static extern void GetSystemTime( out SystemTime systemTime); [DllImport("kernel32.dll", SetLastError = true)] public static extern bool SetSystemTime( ref SystemTime systemTime); //[DllImport("kernel32.dll", SetLastError = true)] //public static extern bool SetLocalTime( //ref SystemTime systemTime); [System.Runtime.InteropServices.DllImportAttribute("kernel32.dll", EntryPoint = "SetLocalTime")] [return: System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.Bool)] public static extern bool SetLocalTime([InAttribute()] ref SystemTime lpSystemTime); #endregion ClockDriftSetup static void Main(string[] args) { try { SystemTime sysTime; GetSystemTime(out sysTime); sysTime.Milliseconds += (short)80; sysTime.Second += (short)3000; bool bResult = SetSystemTime(ref sysTime); if (bResult == false) throw new System.ComponentModel.Win32Exception(); } catch (Exception ex) { Console.WriteLine("Drift Error: " + ex.Message); } } } }

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >