Search Results

Search found 5313 results on 213 pages for 'steve care'.

Page 45/213 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • What's a reasonable way to mutate a primitive variable from an anonymous Java class?

    - by Steve
    I would like to write the following code: boolean found = false; search(new SearchCallback() { @Override void onFound(Object o) { found = true; } }); Obviously this is not allowed, since found needs to be final. I can't make found a member field for thread-safety reasons. What is the best alternative? One workaround is to define final class MutableReference<T> { private T value; MutableReference(T value) { this.value = value; } T get() { return value; } void set(T value) { this.value = value; } } but this ends up taking a lot of space when formatted properly, and I'd rather not reinvent the wheel if at all possible. I could use a List<Boolean> with a single element (either mutating that element, or else emptying the list) or even a Boolean[1]. But everything seems to smell funny, since none of the options are being used as they were intended. What is a reasonable way to do this?

    Read the article

  • UNIX script to parse Zone file (is this the best code?)

    - by Steve
    Hi, FOund the following on: http://mike.murraynet.net/2009/08/23/parsing-the-verisign-zone-file-with-os-x/ Can unix-masters have a look at it and see if its the best possible way to gather the unique domainsnames in a zone file? For .NET domains: grep “^[a-zA-Z0-9-]+ NS .” net.zone|sed “s/NS .//”|uniq netdomains.txt For .COM domains: grep “^[a-zA-Z0-9-]+ NS .” com.zone|sed “s/NS .//”|uniq comdomains.txt For .EDU domains: grep “^[a-zA-Z0-9-]+ NS .” edu.zone|sed “s/NS .//”|uniq edudomains.txt

    Read the article

  • Graceful Degradation with JSON.Parse

    - by Steve
    If a browser doesn't support JSON.parse, would it make sense to include json.js and call parseJSON in lieu? So the code would looks something like: var z; if (JSON.parse) z = JSON.parse(yada); else z = JSON.parseJSON(yada);

    Read the article

  • How to add debug assemblies to my Silverlight 2 application?

    - by Steve Wortham
    So I know now that the debug assemblies have been intentionally left out of the Silverlight runtime to save space. For that reason I get good detailed error messages on my local machine that has the Silverlight SDK on it, but I don't on a computer with the runtime only. I get the ubiquitous, "Debugging resource strings are unavailable." Unfortunately my requirements are a bit unique. I need to include the debug assembly (not sure which one yet) that will give me details of a regular expression error. And so essentially I want to include the dll in the xap if I can. The problem is that I can't seem to do this. I've tried adding the debug dll's as references and setting them to "copy local." And I've tried adding them into the project as content. But in fact, with either method the xap hardly grows in size and the error message doesn't change. Any ideas?

    Read the article

  • wsgi-served page does not refresh

    - by Steve
    I recently got my first app to work in uWSGI with Cherokee. I used the following code taken from the uWSGI docs: def application(environ, start_response): start_response('200 OK', [('Content-Type', 'text/plain')]) yield 'Hello World\n' The page correctly reads Hello World. When I change that text to New Thing and refresh, nothing changes. What am I forgetting? What I've tried: clearing browser history and cache stopping and starting Cherokee

    Read the article

  • Unit testing an MVC action method with a Cache dependency?

    - by Steve
    I’m relatively new to testing and MVC and came across a sticking point today. I’m attempting to test an action method that has a dependency on HttpContext.Current.Cache and wanted to know the best practice for achieving the “low coupling” to allow for easy testing. Here's what I've got so far... public class CacheHandler : ICacheHandler { public IList<Section3ListItem> StateList { get { return (List<Section3ListItem>)HttpContext.Current.Cache["StateList"]; } set { HttpContext.Current.Cache["StateList"] = value; } } ... I then access it like such... I'm using Castle for my IoC. public class ProfileController : ControllerBase { private readonly ISection3Repository _repository; private readonly ICacheHandler _cache; public ProfileController(ISection3Repository repository, ICacheHandler cacheHandler) { _repository = repository; _cache = cacheHandler; } [UserIdFilter] public ActionResult PersonalInfo(Guid userId) { if (_cache.StateList == null) _cache.StateList = _repository.GetLookupValues((int)ELookupKey.States).ToList(); ... Then in my unit tests I am able to mock up ICacheHandler. Would this be considered a 'best practice' and does anyone have any suggestions for other approaches? Thanks in advance. Cheers

    Read the article

  • Need .Net method to compute a Google Pagerank request checksum.

    - by Steve K
    The company I work for is currently developing a SEO tool which needs to include a domain or url Pagerank. It is possible to retrieve such data directly from Google by sending a request to the url called by the Google ToolBar. On of the parameters send to that url is a checksum of the domain whose pagerank is being requested. I have found multiple .Net methods for calculating that check sum; however, every one randomly returns corrupt values every so often. I can only handle errors to a certain point before my final data set becomes useless. I know that there are countless tools out there, from browser plugins to desktop applications, that can process page rank, so it can't be impossible. My question, then, is two fold: 1) Any anyone heard of the problem I am having? (specifically in .Net) If so, how can it (or has it) be resolved? 2) Is there a better source for retrieving Pagerank data? Below is the Url and checksum code I have been using. "http://toolbarqueries.google.com/search?client=navclient-auto&ie=UTF-8&oe=UTF-8&features=Rank:&q=info:" & strUrl & "ch=" & strCheckSum where: strUrl = the url being queried strCheckSum = CheckHash(GetHash(url)) (see code below) Any help would be greatly appreciated. ''' <summary> ''' Returns a hash-string from the site's URL ''' </summary> ''' <param name="_SiteURL">full URL as indexed by Google</param> ''' <returns>HASH for site as a string</returns> Private Shared Function GetHash(ByVal _SiteURL As String) As String Try Dim _Check1 As Long = StrToNum(_SiteURL, 5381, 33) Dim _Check2 As Long = StrToNum(_SiteURL, 0, 65599) _Check1 >>= 2 _Check1 = ((_Check1 >> 4) And 67108800) Or (_Check1 And 63) _Check1 = ((_Check1 >> 4) And 4193280) Or (_Check1 And 1023) _Check1 = ((_Check1 >> 4) And 245760) Or (_Check1 And 16383) Dim T1 As Long = ((((_Check1 And 960) << 4) Or (_Check1 And 60)) << 2) Or (_Check2 And 3855) Dim T2 As Long = ((((_Check1 And 4294950912) << 4) Or (_Check1 And 15360)) << 10) Or (_Check2 And 252641280) Return Convert.ToString(T1 Or T2) Catch Return "0" End Try End Function ''' <summary> ''' Checks the HASH-string returned and adds check numbers as necessary ''' </summary> ''' <param name="_HashNum">generated HASH-string</param> ''' <returns>modified HASH-string</returns> Private Shared Function CheckHash(ByVal _HashNum As String) As String Try Dim _CheckByte As Long = 0 Dim _Flag As Long = 0 Dim _tempI As Long = Convert.ToInt64(_HashNum) If _tempI < 0 Then _tempI = _tempI * (-1) End If Dim _Hash As String = _tempI.ToString() Dim _Length As Integer = _Hash.Length For x As Integer = _Length - 1 To 0 Step -1 Dim _quick As Char = _Hash(x) Dim _Re As Long = Convert.ToInt64(_quick.ToString()) If 1 = (_Flag Mod 2) Then _Re += _Re _Re = CLng(((_Re \ 10) + (_Re Mod 10))) End If _CheckByte += _Re _Flag += 1 Next _CheckByte = _CheckByte Mod 10 If 0 <> _CheckByte Then _CheckByte = 10 - _CheckByte If 1 = (_Flag Mod 2) Then If 1 = (_CheckByte Mod 2) Then _CheckByte >>= 1 End If End If End If If _Hash.Length = 9 Then _CheckByte += 5 End If Return "7" + _CheckByte.ToString() + _Hash Catch Return "0" End Try End Function ''' <summary> ''' Converts the string (site URL) into numbers for the HASH ''' </summary> ''' <param name="_str">Site URL as passed by GetHash()</param> ''' <param name="_Chk">Necessary passed value</param> ''' <param name="_Magic">Necessary passed value</param> ''' <returns>Long Integer manipulation of string passed</returns> Private Shared Function StrToNum(ByVal _str As String, ByVal _Chk As Long, ByVal _Magic As Long) As Long Try Dim _Int64Unit As Long = Convert.ToInt64(Math.Pow(2, 32)) Dim _StrLen As Integer = _str.Length For x As Integer = 0 To _StrLen - 1 _Chk *= _Magic If _Chk >= _Int64Unit Then _Chk = (_Chk - (_Int64Unit * Convert.ToInt64(_Chk \ _Int64Unit))) _Chk = IIf((_Chk < -2147483648), (_Chk + _Int64Unit), _Chk) End If _Chk += CLng(Asc(_str(x))) Next Catch End Try Return _Chk End Function

    Read the article

  • Where clause on joined table used for user defined key/value pairs

    - by Steve Wright
    Our application allows administrators to add “User Properties” in order for them to be able to tailor the system to match their own HR systems. For example, if your company has departments, you can define “Departments” in the Properties table and then add values that correspond to “Departments” such as “Jewelry”, “Electronics” etc… You are then able to assign a department to users. Here is the schema: In this schema, a User can have only one UserPropertyValue per Property, but doesn’t have to have a value for the property. I am trying to build a query that will be used in SSRS 2005 and also have it use the PropertyValues as the filter for users. My query looks like this: SELECT UserLogin, FirstName, LastName FROM Users U LEFT OUTER JOIN UserPropertyValues UPV ON U.ID = UPV.UserID WHERE UPV.PropertyValueID IN (1, 5) When I run this, if the user has ANY of the property values, they are returned. What I would like to have is where this query will return users that have values BY PROPERTY. So if PropertyValueID = 1 is of Department (Jewelry), and PropertyValueID = 5 is of EmploymentType (Full Time), I want to return all users that are in Department Jewelry that are EmployeeType of Full Time, can this be done? Here's a full data example: User A has Department(Jewelry value = 1) and EmploymentType(FullTime value = 5)User B has Department(Electronics value = 2) and EmploymentType(FullTime value = 5)User C has Department(Jewelry value = 1) and EmployementType(PartTime value = 6) My query should only return User A using the above query UPDATE: I should state that this query is used as a dataset in SSRS, so the parameter passed to the query will be @PropertyIDs and it is defined as a multi-value parameter in SSRS. WHERE UPV.PropertyValueID IN (@PropertyIDs)

    Read the article

  • VS 2010 Entity Repository Error Class member EntityBase.id is unmapped.

    - by Steve
    In my project I have it set up so that all the tables in the DB has the property "id" and then I have the entity objects inherit from the EntityBase class using a repository pattern. I then set the inheritance modifier for "id" property in the dbml file o/r designer to "overrides" Public MustInherit Class EntityBase MustOverride Property id() As Integer End Class Public MustInherit Class RepositoryBase(Of T As EntityBase) Protected _Db As New DataClasses1DataContext Public Function GetById(ByVal Id As Integer) As T Return (From a In _Db.GetTable(Of T)() Where a.id = Id).SingleOrDefault End Function End Class Partial Public Class Entity1 Inherits EntityBase End Class Public Class TestRepository Inherits RepositoryBase(Of Entity1) End Class the line Return (From a In _Db.GetTable(Of T)() Where a.id = Id).SingleOrDefault however produces the error "Class member EntityBase.id is unmapped" when i use VS 2010 using the 4.0 framework but I never received that error with the old one. Any help would be greatly appreciated. Thanks in advance.

    Read the article

  • Best way to globally set every control's ValidationGroup property in an asp.net?

    - by Steve Flook
    I have a User Control with form items that is re-used considerably throughout a large web application, and up until this point the validation summary upon an invalid form submission is being handled by the .aspx that consumes the User Control. Now I need to set the ValidationGroup property at runtime for each of my form items controls (textboxes, lists, validators, etc). Rather than do it manually by setting each control I'm interested in iterating through all the controls in the User Control, detecting if that control has a ValidationGroup property, and setting it's value that way. Something like this: For Each ctrl As System.Web.UI.Control In Me.Controls ' so now what is the proper way to detect if this control has the ValidationGroup property Next Code sample in vb.net or c# works for me. Many thanks!

    Read the article

  • jquery scrollpane and scrollTo at same time

    - by steve
    Current demo here: http://www.studioimbrue.com/sites/eliotdudik I have the tabs system working wonderfully. I'm trying to get it so that if you're down a ways on the gallery and then click "foreword" or any menu item, it scrolls you back to 0,0. The current sliding code is as follows: $('#wrapper ul li').click(function() { $(window).scrollTo($(this).next('li'), 500, {offset: {top:0, left:-50}}, {easing:'easeOutExpo'} ); }); And I'm trying to add something like this under it: $('#menu li').click(function() { $(window).scrollTo(0,0, 500, {offset: {top:0, left:-50}}, {easing:'easeOutExpo'} ); }); It continues switching tabs, but it won't scroll back to the beginning!

    Read the article

  • Can't find my installed application

    - by steve
    Greets, Made some app on android. I for the life of me can't get it to install on the phone as a stand alone application. It runs fine when I deploy from eclipse but never remains on the device. any idea whats happening? I put the apk file on a web server, went to the address downloaded and installed but still it wasn't to be found. I'm lost!

    Read the article

  • Listening to another window resize events in C#

    - by Steve
    Hi all I am implementing a small application (observer) that needs to "attach" itself to the bottom of another window (observed). The latter is not a window inside the application. At this moment I solved by getting the hWnd of the window and querying periodically in a thread the location of the observed window, moving the observer window accordingly. However this is a very inelegant solution. What I would like to do is to listen to the resize event of the observed window so that the observer will react only when necessary. I assume I should use a hook, and I found plenty of ways of doing it, but my lack of knowledge of the C WinAPI is blocking me in understanding which hook I need to create and how (pinvoke/parameters/etc). I'm pretty sure this is quite trivial, and some of you familiar with C/C++ and WinAPI will have the answer ready at hand ;) Thanks

    Read the article

  • Why is my substitution control suddenly not working in ASP.NET 4.0?

    - by Steve Wortham
    I just upgraded my site from ASP.NET 3.5 to 4.0. I've been working through some breaking changes (there were more than I expected). One I can't figure out, however, is why my <asp:Substitution /> control suddenly stopped working like it should. It's supposed to ignore the output cache settings of the parent page and update upon every request. For some reason that isn't happening. It's caching for the full 10 minutes (the OutputCache setting for my home page). Any ideas?

    Read the article

  • Is C# WebAPI worth it? Can I use standart MVC4 to create my API?

    - by Steve
    I need to build a massive API and I'm trying out WebAPI instead of default MVC4 projects and it seems that it just makes things more difficult. Can have only 4 methods in controller Get, Post, Put, Delete, if I want more I need to modify route for that particular method FluentValidation won't work with WebAPI so I need to use DataAnnotations which I really don't want to. Can't use dynamic return data-types My question is: Would it really be that bad if I would use MVC4 project and use default ActionResults that return Json? What are real advantages of using WebAPI, why did they even made them in the first place if you can easily convert your project to API?

    Read the article

  • Query a List of List of Items in LINQ c#

    - by call me Steve
    I am a bit new to LINQ, here is my problem. I have a List of List of Items I like to get the Items which are present in only one List (and if I could get the List in which they are without re-iterating through the "list of list" that would be great). I am trying without success to use the Aggregate / Except / Group keywords in the Linq query but nothing close to a solution so far.

    Read the article

  • PDF Viewer Showing Last Page...

    - by steve
    I have a asp.net app that writes a pdf to file. Then, later that file is opened into a window (standard acrobat reader) for viewing. No problems there. The weird part... The entire document loads as it should, but the Reader initially shows the last page in the document on the screen. The user must then scroll up to the first page. It doesn't happen all the time (about 50%) and occurs across several test computers. Is there a switch in the code I'm suppose to use in creating the file or displaying the file to tell the reader to "start displaying the document on the first page?" Environment particulars: asp.net 3.5 vb, websupergoo's abcpdf.net pro 7 (assembly that creates the pdf file), Windows 2008 Server, IIS7 Thanks

    Read the article

  • GWT application not displaying data on Windows 7 Starter Edition

    - by Steve Buikhuizen
    I have a GWT application that works great on all platforms/browsers etc. Then we tried Windows 7 Starter Edition. For all browsers (Chrome, IE, Firefox) none of the dynamically displayed data appears in the application. We know that the machine is ok because Google Wave works fine and its also a GWT application. I'm at a loss. What could cause this to happen? I'd be grateful if you have a suggestion as to how to debug this. If so find the solution I'll post it.

    Read the article

  • Sanitising user input using Python

    - by Steve
    What's the best way to sanitise user input for a Python-based web application? Is there a single function to remove HTML characters and any other necessary characters combinations to ensure that an XSS or SQL injection attack isn't possible?

    Read the article

  • Silverlight Watermarked AutoComplete Box

    - by Steve Brouillard
    Can someone direct me to an example or explanation that will help me either: Extend the SilverLight AutoComplete Box to allow watermarks. Extend the Watermark TextBox to allow AutoComplete functionality. It strikes me that option 1 would be easiest, but I'm open. Thanks in advance.

    Read the article

  • Is there a way to undo Mocha stubbing of any_instance?

    - by Steve Weet
    Within my controller specs I am stubbing out valid? for some routing tests, (based on Ryan Bates nifty_scaffold) as follows :- it "create action should render new template when model is invalid" do Company.any_instance.stubs(:valid?).returns(false) post :create response.should render_template(:new) end This is fine when I test the controllers in isolation. I also have the following in my model spec it "is valid with valid attributes" do @company.should be_valid end Again this works fine when tested in isolation. The problem comes if I run spec for both models and controllers. The model test always fails as the valid? method has been stubbed out. Is there a way for me to remove the stubbing of any_instance when the controller test is torn down. I have got around the problem by running the tests in reverse alphabetic sequence to ensure the model tests run before the controllers but I really don't like my tests being sequence dependant.

    Read the article

  • Cant insert a object into a silverlight databound combo box

    - by Steve
    Hi Until recently I had a combo box that was bound to a Linq queried IEnumerable of a DataService.Obj type in the bind method, and all worked fine private IEnumerable<DataService.Obj> _GeneralList; private IEnumerable<DataService.Obj> _QueriedList; private void Bind() { _GeneralList = SharedLists.GeneralList; _QueriedList = _GeneralList.Where(q =>q.ID >1000); cmbobox.ItemsSource = _QueriedList; } Then I had to change the method to insert a new obj and set that object as the default obj and now I get a "System.NullReferenceException: Object reference not set to an instance of an object" exception. I know this has to do with inserting into a linq queried ienumerable but I cant fix it. Any help will be gratefully received. private IEnumerable<DataService.Obj> _GeneralList; private IEnumerable<DataService.Obj> _QueriedList; private void Bind() { _GeneralList = SharedLists.GeneralList; _QueriedList = _GeneralList.Where(q =>q.ID >1000); cmbobox.ItemsSource = _QueriedList; DataService.Obj info = new DataService.Obj(); info.ID = "0"; (cmbobox.ItemsSource as ObservableCollection<DataService.Obj>).Insert(0,info); cmbobox.SelectedIndex = 0; } Thanks in advance

    Read the article

  • Entity Framework 4.0 Unit Testing

    - by Steve Ward
    Hi, I've implemented unit testing along the lines of this article with a fake object context and IObjectSet with POCO in EF4. http://blogs.msdn.com/adonet/archive/2009/12/17/test-driven-development-walkthrough-with-the-entity-framework-4-0.aspx But I'm unsure how to implement a couple of methods on my fake object context for testing. I have CreateQuery and ExecuteFunction methods on my object context interface so that I can execute ESQL and Stored Procedures but I cant (easily) implement them in my fake object context. An alternative would be to use a test double of my repository instead of a double of my object context as suggested here: http://social.msdn.microsoft.com/Forums/en-US/adonetefx/thread/c4921443-e8a3-4414-92dd-eba1480a07ad/ But this would mean my real repository isnt being tested and would seem to just bypass the issue. Can anyone offer any recommendations?

    Read the article

  • CSS: Horizontal UL: Getting it centered

    - by Steve
    I'm trying to make a horizontal menu/list. It has a mix of independent buttons and buttons that are wrapped in their own individual forms. With much hacking I got all of the buttons, in forms and not in forms to align horizontally. I haven't been able to get the whole thing to center on the page though. Could someone point out to me what I am not seeing? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <link rel="shortcut icon" href="http://localhost:7001/nsd/images/favicon.ico"> <link rel="StyleSheet" href="veci_files/nsd.css" type="text/css"> <style type = "text/css"> #horizontal_li_menu_container ul { margin-left: auto; margin-right:auto; text-align:center; border: 1px solid green; width:1000px; } #horizontal_li_menu_container_ul { list-style-type: none; text-decoration: none; border: 1px solid red; } #horizontal_li_menu_container li { display: inline;float:left; } </style> </head> <body> <div id = "horizontal_li_menu_container"> <ul id = "horizontal_li_menu_container_ul"> <li> <input value="Update" onclick="location.href='#'" name="button" type="button"/> </li> <li> <form name="formExportVECI" method="post" action="exportveci"> <input name="person_id" value="661774" type="hidden"> <input name="submitExport" value="Export To Microsoft Excel" type="submit"> </form> </li> <li> <form id="ufdh" name="formImportVECI" action="importveci" method="post" enctype="multipart/form-data"> <input name="person_id" value="661774" type="hidden"> <input value="Import From Microsoft Excel" path="Upload" type="submit"> <input id="fileData" name="fileData" value="" type="file"> </form> </li> <li> <input value="Search/Home" onclick="location.href='search'" name="buttonHome" type="button"/> </li> </ul> </div> </body></html>

    Read the article

< Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >