Search Results

Search found 290 results on 12 pages for 'kris anderson'.

Page 8/12 | < Previous Page | 4 5 6 7 8 9 10 11 12  | Next Page >

  • Add functions in gdb at runtime

    - by Michael Anderson
    I'm trying to debug some STL based C++ code in gdb. The code has something like int myfunc() { std::map<int,int> m; ... } Now in gdb, inside myfunc using "print m" gives something very ugly. What I've seen recommended is compiling something like void printmap( std::map<int,int> m ) { for( std::map<int,int>::iterator it = ... ) { printf("%d : %d", it->first, it->second ); } } Then in gdb doing (gdb) call printmap( m ) This seems like a good way to handle the issue... but can I put printmap into a seperate object file (or even dynamic library) that I then load into gdb at runtime rather than compiling it into my binary - as recompiling the binary every time I want to look at another STL variable is not fun .. while compiling and loading a single .o file for the print routine may be acceptable.

    Read the article

  • How do I set scons system include path

    - by Michael Anderson
    Using scons I can easily set my include paths: env.Append( CPPPATH=['foo'] ) This passes the flag -Ifoo to gcc However I'm trying to compile with a lot of warnings enabled. In particular with env.Append( CPPFLAGS=['-Werror', '-Wall', '-Wextra'] ) which dies horribly on certain boost includes ... I can fix this by adding the boost includes to the system include path rather than the include path as gcc treats system includes differently. So what I need to get passed to gcc instead of -Ifoo is -isystem foo I guess I could do this with the CPPFLAGS variable, but was wondering if there was a better solution built into scons.

    Read the article

  • How do I set TargetNullValue to a date?

    - by Bryan Anderson
    I'm using the WPF toolkit's Calendar control to allow users to select a date. If the date is not yet selected then the property the SelectedDate is bound to is Null. This makes the Calendar default you January 1, 0 AD. I'd like to do something like SelectedDate="{Binding UserPickedDate, TargetNullValue=Today, Mode=TwoWay}" But both "Today" and "Now" throw binding errors. Can I use TargetNullValue to set the default date to Today or Now?

    Read the article

  • Linq query - multiple where, with extension method

    - by Cj Anderson
    My code works for ORs as I've listed it below but I want to use AND instead of OR and it fails. I'm not quite sure what I'm doing wrong. Basically I have a Linq query that searches on multiple fields in an XML file. The search fields might not all have information. Each element runs the extension method, and tests the equality. Any advice would be appreciated. refinedresult = From x In theresult _ Where x.<thelastname>.Value.TestPhoneElement(LastName) Or _ x.<thefirstname>.Value.TestPhoneElement(FirstName) Or _ x.<id>.Value.TestPhoneElement(Id) Or _ x.<number>.Value.TestPhoneElement(Telephone) Or _ x.<location>.Value.TestPhoneElement(Location) Or _ x.<building>.Value.TestPhoneElement(building) Or _ x.<department>.Value.TestPhoneElement(Department) _ Select x Public Function TestPhoneElement(ByVal parent As String, ByVal value2compare As String) As Boolean 'find out if a value is null, if not then compare the passed value to see if it starts with Dim ret As Boolean = False If String.IsNullOrEmpty(parent) Then Return False End If If String.IsNullOrEmpty(value2compare) Then Return ret Else ret = parent.ToLower.StartsWith(value2compare.ToLower.Trim) End If Return ret End Function

    Read the article

  • Validating Application Settings Key Values in Isolated Storage for Windows Phone Applications

    - by Martin Anderson
    Hello everyone. I am very new at all this c# Windows Phone programming, so this is most probably a dumb question, but I need to know anywho... IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings; if (!appSettings.Contains("isFirstRun")) { firstrunCheckBox.Opacity = 0.5; MessageBox.Show("isFirstRun not found - creating as true"); appSettings.Add("isFirstRun", "true"); appSettings.Save(); firstrunCheckBox.Opacity = 1; firstrunCheckBox.IsChecked = true; } else { if (appSettings["isFirstRun"] == "true") { firstrunCheckBox.Opacity = 1; firstrunCheckBox.IsChecked = true; } else if (appSettings["isFirstRun"] == "false") { firstrunCheckBox.Opacity = 1; firstrunCheckBox.IsChecked = false; } else { firstrunCheckBox.Opacity = 0.5; } } I am trying to firstly check if there is a specific key in my Application Settings Isolated Storage, and then wish to make a CheckBox appear checked or unchecked depending on if the value for that key is "true" or "false". Also I am defaulting the opacity of the checkbox to 0.5 opacity when no action is taken upon it. With the code I have, I get the warnings Possible unintended reference comparison; to get a value comparison, cast the left hand side to type 'string' Can someone tell me what I am doing wrong. I have explored storing data in an Isolated Storage txt file, and that worked, I am now trying Application Settings, and will finally try to download and store an xml file, as well as create and store user settings into an xml file. I want to try understand all the options open to me, and use which ever runs better and quicker

    Read the article

  • warnings emitted during 'easy_install'

    - by Matt Anderson
    When I easy_install some python modules, warnings such as: <some module>: module references __file__ <some module>: module references __path__ <some module>: module MAY be using inspect.trace <some module>: module MAY be using inspect.getsourcefile sometimes get emitted. Where (what package / source file) do these messages come from? Why is referencing __file__ or __path__ considered a bad thing?

    Read the article

  • In CAB is a service it's own module?

    - by David Anderson
    I'm learning Composite Application Block and I've hit a rock about services. I have my shell application in its own solution, and of course a test module in its own solution (developed and testing completely independent and external of the shell solution). If I created a service named "Sql Service", would I need to put this in it's own library, so that both the shell, and the module know the types? If that's the case, then for good practice, should I put the service project in the shell solution, or external just like a module (in it's own solution), even though it's not loaded as a module? Then, what about references? Should the shell reference this directly, add then add the service? Or load it as a module and add the service? I have a lot of confusion on where I should create my services, and if I should reference or load as modules..

    Read the article

  • Windows Phone - OnNavigatingFrom - problem

    - by Martin Anderson
    I believe this is just a problem for me, due to my lack of programming ability. I am currently exploring transitions between page navigation with Windows Phone apps. I was originally using storyboards, and completed event handlers to have my pages animate on and off screen. These leads to the a problem when you want to navigate to many pages from one page, using the same transition. So I have started looking at OnNavigatedTo, and OnNavigatingFrom events and while it is working nicely for OnNavigatedTo, the later just wont work. It seems the Microsoft.Phone.Navigation assembly does not contain OnNavigatingFrom, and referencing System.Windows.Navigation, compiles ok, but I cant get pages to animate off upon navigation. I have a button on my Page2, which I want to go back to my MainPage (after I over-rided the back key with a message box for testing). I have transitions made on the page, and I have this as the event handler code... private void btnP2_BackToP1Clicked(object sender, System.Windows.RoutedEventArgs e) { NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); } With this code for the OnNavigatedTo and OnNavigatingFrom events... protected override void OnNavigatedTo(PhoneNavigationEventArgs e) { PageTransition_In.Begin(); } // // protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { PageTransition_Out.Begin(); base.OnNavigatingFrom(e); } I have the feeling that OnNavigatingFrom may not(yet) be supported for Windows Phone Apps. OnNavigatedFrom is part of Microsoft.Phone.Navigation, but it only performs actions once the page is no longer active, which is too late to perform any animation effects.

    Read the article

  • Searching a set of data with multiple terms using Linq

    - by Cj Anderson
    I'm in the process of moving from ADO.NET to Linq. The application is a directory search program to look people up. The users are allowed to type the search criteria into a single textbox. They can separate each term with a space, or wrap a phrase in quotes such as "park place" to indicate that it is one term. Behind the scenes the data comes from a XML file that has about 90,000 records in it and is about 65 megs. I load the data into a DataTable and then use the .Select method with a SQL query to perform the searches. The query I pass is built from the search terms the user passed. I split the string from the textbox into an array using a regular expression that will split everything into a separate element that has a space in it. However if there are quotes around a phrase, that becomes it's own element in the array. I then end up with a single dimension array with x number of elements, which I iterate over to build a long query. I then build the search expression below: query = query & _ "((userid LIKE '" & tempstr & "%') OR " & _ "(nickname LIKE '" & tempstr & "%') OR " & _ "(lastname LIKE '" & tempstr & "%') OR " & _ "(firstname LIKE '" & tempstr & "%') OR " & _ "(department LIKE '" & tempstr & "%') OR " & _ "(telephoneNumber LIKE '" & tempstr & "%') OR " & _ "(email LIKE '" & tempstr & "%') OR " & _ "(Office LIKE '" & tempstr & "%'))" Each term will have a set of the above query. If there is more than one term, I put an AND in between, and build another query like above with the next term. I'm not sure how to do this in Linq. So far, I've got the XML file loading correctly. I'm able to search it with specific criteria, but I'm not sure how to best implement the search over multiple terms. 'this works but far too simple to get the job done Dim results = From c In m_DataSet...<Users> _ Where c.<userid>.Value = "XXXX" _ Select c The above code also doesn't use the LIKE operator either. So partial matches don't work. It looks like what I'd want to use is the .Startswith but that appears to be only in Linq2SQL. Any guidance would be appreciated. I'm new to Linq, so I might be missing a simple way to do this. The XML file looks like so: <?xml version="1.0" standalone="yes"?> <theusers> <Users> <userid>person1</userid> <nickname></nickname> <lastname></lastname> <firstname></firstname> <department></department> <telephoneNumber></telephoneNumber> <email></email> </Users> <Users> <userid>person2</userid> <nickname></nickname> <lastname></lastname> <firstname></firstname> <department></department> <telephoneNumber></telephoneNumber> <email></email> </Users>

    Read the article

  • metaclass multiple inheritance inconsistency

    - by Matt Anderson
    Why is this: class MyType(type): def __init__(cls, name, bases, attrs): print 'created', cls class MyMixin: __metaclass__ = MyType class MyList(list, MyMixin): pass okay, and works as expected: created <class '__main__.MyMixin'> created <class '__main__.MyList'> But this: class MyType(type): def __init__(cls, name, bases, attrs): print 'created', cls class MyMixin: __metaclass__ = MyType class MyObject(object, MyMixin): pass Is not okay, and blows up thusly?: created <class '__main__.MyMixin'> Traceback (most recent call last): File "/tmp/junk.py", line 11, in <module> class MyObject(object, MyMixin): pass TypeError: Error when calling the metaclass bases Cannot create a consistent method resolution order (MRO) for bases object, MyMixin

    Read the article

  • PHP detmine numbers in between two numbers then query

    - by Joshua Anderson
    This should be simple but I can't figure it out <?php $testid = 240; $curid = 251; $cal = $curid - $testid; echo $cal; ?> I want to determine the numbers in between two other numbers so for this example it detects there are 11 numbers in between the $testid and $curid, but i dont need it to do that. I need it to literally figure the numbers in between $curid - $testid which in this example would be 241, 242, 243... all the way to 251 then i need to create a loop with those numbers and do a query below with each one $cal = $curid - $testid; mysql_query("SELECT * FROM wall WHERE id='".$cal."'") // and for each number mysql should out put each data field with those numbers. Thanks again, love you guys.

    Read the article

  • Is there a way to declare a variable that implements multiple interfaces in .Net?

    - by Bryan Anderson
    Similar to this Java question. I would like to specify that a variable implements multiple interfaces. For instance private {IFirstInterface, ISecondInterface} _foo; public void SetFoo({IFirstInterface, ISecondInterface} value) { _foo = value; } Requirements: I don't have the ability to add an interface to most type that would be passed in to Foo. So I can't create a third interface that inherits from IFirstInterface and ISecondInterface. I would like to avoid making the containing class generic if possible because the type of Foo doesn't have much to do with the class and the user isn't likely to know it at compile time. I need to use foo to access methods in both interfaces at a later time. I would like to do this in a compiler safe way, i.e. no trying to cast to the interface just before trying to use it. If foo does not implement both interfaces quite a bit of functionality won't work properly. Is this possible?

    Read the article

  • SQL 2005 Express Edition - Install new instance

    - by Douglas Anderson
    Looking for a way to programatically, or otherwise, add a new instance of SQL 2005 Express Edition to a system that already has an instance installed. Traditionally, you run Micrsoft's installer like I am in the command line below and it does the trick. Executing the command in my installer is not the issue, it's more a matter of dragging around the 40 MBs of MS-SQL installer that I don't need if they have SQL Express already installed. This is what my installer currently executes: SQLEXPR32.EXE /qb ADDLOCAL=ALL INSTANCENAME=<instancename> SECURITYMODE=SQL SAPWD=<password> SQLAUTOSTART=1 DISABLENETWORKPROTOCOLS=0 I don't need assistance with launching this command, rather the appropriate way to add a new instance of SQL 2005 Express without actually running the full installer again. I'd go into great detail about why I want to do this but I'd simply bore everyone. Suffice to say, having this ability to create a new instance without the time it takes to reinstall SQL Express etc. would greatly assist me for the deployment of my application and it's installer. If makes any difference to anyone, I'm using a combination of NSIS and Advanced Installer for this installation project.

    Read the article

  • Passing youtube video id from video feed to flash

    - by Grant Anderson
    I'm working on a flash web application (Actionscript 2.0) for my honours project but am having trouble embedding youtube videos. Basically the user selects symbols which queries the youtube api with certain tags depending on the symbols chosenand a random video is then picked from the first 30 videos. I have this working using the following code: on (release) { url="http://gdata.youtube.com/feeds/api/videos?q=danger+passion&orderby=published&start-index="+random(30)+"&max-results=1&v=2" getURL(url); } but this just displays a webpage with a link to the youtube video. This is the code I'll be using as the foundations for the player: // create a MovieClip to load the player into var ytplayer:MovieClip = _root.createEmptyMovieClip("ytplayer", 1); // create a listener object for the MovieClipLoader to use var ytPlayerLoaderListener:Object = { onLoadInit: function() { // When the player clip first loads, we start an interval to // check for when the player is ready loadInterval = setInterval(checkPlayerLoaded, 250); } }; var loadInterval:Number; function checkPlayerLoaded():Void { // once the player is ready, we can subscribe to events, or in the case of // the chromeless player, we could load videos if (ytplayer.isPlayerLoaded()) { ytplayer.addEventListener("onStateChange", onPlayerStateChange); ytplayer.addEventListener("onError", onPlayerError); clearInterval(loadInterval); } } function onPlayerStateChange(newState:Number) { trace("New player state: "+ newState); } function onPlayerError(errorCode:Number) { trace("An error occurred: "+ errorCode); } // create a MovieClipLoader to handle the loading of the player var ytPlayerLoader:MovieClipLoader = new MovieClipLoader(); ytPlayerLoader.addListener(ytPlayerLoaderListener); // load the player ytPlayerLoader.loadClip("http://www.youtube.com/v/pv5zWaTEVkI", ytplayer); can anyone help me on how to get the id of the video (for example: pv5zWaTEVkI) from the feed? Or how to send a query from flash which will return the video url/id as opposed to the url of a feed. Any help would be much appreciated as my hand in rather soon. Thanks

    Read the article

  • How can I avoid properties being reset at design-time in tightly bound user controls?

    - by David Anderson
    I have UserControl 'A' with a label, and this property: /// <summary> /// Gets or Sets the text of the control /// </summary> [ Browsable(true), EditorBrowsable(EditorBrowsableState.Always), Category("Appearance") ] public override string Text { get { return uxLabel.Text; } set { uxLabel.Text = value; } } I then have UserControl 'B' which has UserControl 'A' on it, and I set the Text Property to "My Example Label" in the designer. Then, I have my MainForm, which has UserControl 'B' on it. Each time I do a build or run, the Text property of UserControl 'A' is reset to its default value. I suppose this is because since I am doing a rebuild, it rebuilds both UserControl 'A' and 'B', thus causing the problem. How can I go about a better approach to design pattern to avoid this type of behavior when working with tightly bound controls and forms in a application?

    Read the article

  • Escape characters during paste in vim

    - by Michael Anderson
    I copy stuff from output buffers into C++ code I'm working on in vim. Often this output gets stuck into strings. And it'd be nice to be able to escape all the control characters automatically rather than going back and hand editing the pasted fragment. As an example I might copy something like this: error in file "foo.dat" And need to put it into something like this std::string expected_error = "error in file \"foo.dat\"" I'm thinking it might be possible to apply a replace function to the body of the last paste using the start and end marks of the last paste, but I'm not sure how to make it fly.

    Read the article

  • Doing will_paginate pages calculation around a record

    - by Anderson De Andrade
    I'm displaying a list of events. I wanted displayed the page with the events for today by default. That was easy accomplished by: page = number_of_records_before_RECORD / number_of_pages + 1 Now I want to display the first item of today's events as the first item in that page. Maybe there is a way to generate page numbers around a record with negative values to get back.

    Read the article

  • How can I authenticate when using the Bugzilla Perl API in a script?

    - by Allan Anderson
    Working from the Bugzilla API, I've written a quick Perl script to clone a Bugzilla Product (recreating all the Components under their new Product). The Bugzilla Perl API is quite easy to use from the command line. I could have just worked on the database directly, but I wanted a longer-term solution. Another option was the webservice, but I thought I'd try using the API directly this time. The one problem I'm running into is authenticating as my Bz admin user so I can create the new components. Looking at Bugzilla's Bugzilla.pm file, I see that they just run login() from a Bugzilla::Auth object. I'm not sure how to get the username and password in there. I suppose I could just add the script to the Bugzilla admin interface... Can any of you point me in the right direction?

    Read the article

  • php nl2br limit x amount

    - by Joshua Anderson
    Hi this is fairly simple I want to know how to use nl2br(); in php, but limit the amount of <br/>'s that are allowed at one time. //For Example: A user enters hi Im a jerk and made 16 more lines. or I could make as many as i want Is there anyway to have php limit the <br/>'s to no more than x amount of numbers at at time so if we only allowed 4 <br>'s at a time the output would be hi Im a jerk I tried to make 9 lines and it made it 4

    Read the article

  • Excel 2010 Access to path is denied temp

    - by Chris Anderson
    I am using excel data reader to read data from an excel file. FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read); //1. Reading from a binary Excel file ('97-2003 format; *.xls) IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream); //2. Reading from a OpenXml Excel file (2007 format; *.xlsx) IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream); http://exceldatareader.codeplex.com/ This reads excel 1997-2003 format and excel 2007 format on my local machine and when we move it to our test server. However, when moved to production, it works for excel 97-2003 files, but when I try to read 2007 files I receive the following error: Access to the path 'C:\Documents and Settings\PORTALS03\ASPNET\LOCALS~1\Temp\TMP_Z129388041687919815' is denied. How is it possible that the 97-2003 excel file can be read but the 2007 files throw access is denied?

    Read the article

  • How do you encrypt parts of a file separately using pgp?

    - by Collin Anderson
    I would like to encrypt credit card numbers on a web server as they come in using PGP. I would then like to be able to export all of the credit card numbers and other information in one file that can be easily decrypted using standard PGP software. Is it possible to take the encrypted credit card numbers and join them with other encrypted data and be able to decrypt the entire file? Basically is this true? D(E(x) + E(y)) = x + y Where '+' means string concatenation.

    Read the article

  • VB.NET switching from ADO.NET to LINQ

    - by Cj Anderson
    I'm VERY new to Linq. I have an application I wrote that is in VB.NET 2.0. Works great, but I'd like to switch this application to Linq. I use ADO.NET to load XML into a datatable. The XML file has about 90,000 records in it. I then use the Datatable.Select to perform searches against that Datatable. The search control is a free form textbox. So if the user types in terms it searches instantly. Any further terms that are typed in continue to restrict the results. So you can type in Bob, or type in Bob Barker. Or type in Bob Barker Price is Right. The more criteria typed in the more narrowed your result. I bind the results to a gridview. Moving forward what all do I need to do? From a high level, I assume I need to: 1) Go to Project Properties -- Advanced Compiler Settings and change the Target framework to 3.5 from 2.0. 2) Add the reference to System.XML.Linq, Add the Imports statement to the classes. So I'm not sure what the best approach is going forward after that. I assume I use XDocument.Load, then my search subroutine runs against the XDocument. Do I just do the standard Linq query for this sort of repeated search? Like so: var people = from phonebook in doc.Root.Elements("phonebook") where phonebook.Element("userid") = "whatever" select phonebook; Any tips on how to best implement?

    Read the article

  • heterogeneous comparisons in python3

    - by Matt Anderson
    I'm 99+% still using python 2.x, but I'm trying to think ahead to the day when I switch. So, I know that using comparison operators (less/greater than, or equal to) on heterogeneous types that don't have a natural ordering is no longer supported in python3.x -- instead of some consistent (but arbitrary) result we raise TypeError instead. I see the logic in that, and even mostly think its a good thing. Consistency and refusing to guess is a virtue. But what if you essentially want the python2.x behavior? What's the best way to go about getting it? For fun (more or less) I was recently implementing a Skip List, a data structure that keeps its elements sorted. I wanted to use heterogeneous types as keys in the data structure, and I've got to compare keys to one another as I walk the data structure. The python2.x way of comparing makes this really convenient -- you get an understandable ordering amongst elements that have a natural ordering, and some ordering amongst those that don't. Consistently using a sort/comparison key like (type(obj).__name__, obj) has the disadvantage of not interleaving the objects that do have a natural ordering; you get all your floats clustered together before your ints, and your str-derived class separates from your strs. I came up with the following: import operator def hetero_sort_key(obj): cls = type(obj) return (cls.__name__+'_'+cls.__module__, obj) def make_hetero_comparitor(fn): def comparator(a, b): try: return fn(a, b) except TypeError: return fn(hetero_sort_key(a), hetero_sort_key(b)) return comparator hetero_lt = make_hetero_comparitor(operator.lt) hetero_gt = make_hetero_comparitor(operator.gt) hetero_le = make_hetero_comparitor(operator.le) hetero_ge = make_hetero_comparitor(operator.gt) Is there a better way? I suspect one could construct a corner case that this would screw up -- a situation where you can compare type A to B and type A to C, but where B and C raise TypeError when compared, and you can end up with something illogical like a > b, a < c, and yet b > c (because of how their class names sorted). I don't know how likely it is that you'd run into this in practice.

    Read the article

  • .NET Regular Expression to split multiple words or phrases

    - by Cj Anderson
    I'm using the code below to take a string and split it up into an array. It will take: Disney Land and make it two separate elements. If the string contains "Disney Land" then it is one element in the array. Works great, however it adds some empty elements to the array each time. So I just iterate over the elements and remove them if they are empty. Is there a tweak to the code below that will prevent those empty elements from occurring? Private m_Reg As Regex m_Reg = New Regex("([^""^\s]+)\s*|""([^""]+)""\s*") Dim rezsplit = m_Reg.Split(criteria)

    Read the article

  • Browsers disagree about the text of a body element

    - by Charles Anderson
    My HTML looks like this: <html> <head> <title>Test</title> <script type="text/javascript" src="jQuery.js"></script> <script type="text/javascript"> function init() { var text = jQuery('body').text(); alert('length = ' + text.length); } </script> </head> <body onload="init()">0123456789</body> </html> When I load this in Firefox, the length is reported as 10. However, in Chrome it's 11 because it thinks there's a linefeed after the '9'. In IE it's also 11, but the last character is an escape. Meanwhile, Opera thinks there are 12 characters, with the last two being CR LF. If I change the body element to include a span: <body onload="init()"><span>0123456789</span></body> and the jQuery call to: var text = jQuery('body span').text(); then all the browsers agree that the length is 10. Clearly it's the body element that's causing the issue, but can anyone explain exactly why this is happening? I'm particularly surprised because the excellent jQuery is normally browser-independent.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12  | Next Page >