Search Results

Search found 187 results on 8 pages for 'nate shoffner'.

Page 5/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • Invoke an action that is using ASP.NET MVC [Authorize] from outside the application

    - by Nate Bross
    Is this possible? I'd like to expose a URL (action) such as http://mysever/myapp/UpdateHeartbeat/. In my MVC application it looks like [Authorize] [AcceptsVerbs(HttpVerbs.Post)] public ActionResult UpdateHeartbeat() { // update date in DB to DateTime.Now } Now, in my MVC application the user has logged in via FORMS authentication and they can execute that action to their hearts content. What I want to do, is hit that URL progromatically (as part of an API that I wouldl like to build) -- is there a way I can do that without removing the [Authorize] attribute and adding username/password as parameters to the POST?

    Read the article

  • Returning large collections from WCF Serivce

    - by Nate Bross
    I'm trying to determine the best approach for building a WCF Service, and the area I'm struggling with most is returning lists of objects. The built-in maxMessageSize of 64k seems pretty high, and I really don't want to bump it up (quick googling finds 100s of places bumping the maxMessageSize up to multi-gigabyte range which seems foolish). But, when I'm returning a collection of objects (~150 items) I am exceeding the default 64k. I'm almost to the point of returning my own class which inherits IEnumerable and has properties for hasNext, hasPrevious and PageSize so that I can implement paging on the client side -- this seems like alot of code. The other option is to jackup the maxMessageSize and hope for the best, but that feels wrong. All other aspects of my service are working great, its just returning large collectiosn where I'm having issues. For background, there are two types of consumers of this service, UI applications which will be primarly web and/or wpf applications, and data processing applications, .NET console apps, and maybe some other non-UI apps. For the UI applications, I would like to keep them responsive and keep the messageSize low, on the console apps it doesn't matter as much as they are just pulling data down to do processing and push it back up to the service.

    Read the article

  • R plot- SGAM plot counts vs. time - how do I get dates on the x-axis?

    - by Nate
    I'd like to plot this vs. time, with the actual dates (years actually, 1997,1998...2010). The dates are in a raw format, ala SAS, days since 1960 (hence as.date conversion). If I convert the dates using as.date to variable x, and do the GAM plot, I get an error. It works fine with the raw day numbers. But I want the plot to display the years (data are not equally spaced). structure(list(site = c(928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L, 928L), date = c(13493L, 13534L, 13566L, 13611L, 13723L, 13752L, 13804L, 13837L, 13927L, 14028L, 14082L, 14122L, 14150L, 14182L, 14199L, 16198L, 16279L, 16607L, 16945L, 17545L, 17650L, 17743L, 17868L, 17941L, 18017L, 18092L), y = c(7L, 7L, 17L, 18L, 17L, 17L, 10L, 3L, 17L, 24L, 11L, 5L, 5L, 3L, 5L, 14L, 2L, 9L, 9L, 4L, 7L, 6L, 1L, 0L, 5L, 0L)), .Names = c("site", "date", "y"), class = "data.frame", row.names = c(NA, -26L)) sgam1 <- gam(sites$y ~ s(sites$date)) sgam <- predict(sgam1, se=TRUE) plot(sites$date,sites$y,xaxt="n", xlab='Time', ylab='Counts') x<-as.Date(sites$date, origin="1960-01-01") axis(1, at=1:26,labels=x) lines(sites$date,sgam$fit, lty = 1) lines(sites$date,sgam$fit + 1.96* sgam$se, lty = 2) lines(sites$date,sgam$fit - 1.96* sgam$se, lty = 2) ggplot2 has a solution (it doesn't mind the as.date thing) but it gives me other problems...

    Read the article

  • SQL to return dates that fall in period and range

    - by Nate
    Hey stackers, I’ve been grinding my head on this for a while… My goal is to return all dates that fall between a start and end date and have a certain period as a factor, from the start date. (hard to explain) For example… Start Date: Nov 20, 1987; End Date: Jan 01, 1988; Period: 10 days; I want these dates: Nov 20, 1987; Nov 30, 1987; Dec 10, 1987; Dec 20, 1987; Dec 30, 1987; I already have a date table with all dates from 1900 to 2099. The period could be by days, months or years. Any ideas? Let me know if you need more info.

    Read the article

  • Bizarre Javascript JSON undefined error

    - by Nate C-K
    I'm experiencing an error that I haven't been able to find any mention of anywhere. I'm developing an AJAX-enabled WCF web service with ASP.NET. In my ASP.NET master page's , I included the json.js file, copied fresh from json.org. When I run the page, it fails (VS 2008 catches a Javascript exception) on the first line of code in json.js (following lots of comments), which is: JSON = JSON || {}; The error says that JSON is undefined: Microsoft JScript runtime error: 'JSON' is undefined Well, duh! That's why the line is testing if it's defined and if so setting it to an empty object! It is supposed to be undefined, right? Last I heard it was not an error in Javascript to perform such an operation on an undefined variable. Can anyone give me a clue as to what's going on here? I suspect it's something gone wrong elsewhere that's somehow causing this problem. I don't have deep experience with either Javascript or ASP.NET so it might be that I'm missing some common gotcha in the setup.

    Read the article

  • Error when trying to use PDO object

    - by Nate
    EDIT: I'm going to put my code in here due to comments below. So sit tight for a few minutes ;-) Thanks! I'm an inexperienced php programmer and only found out about PDO a few days ago. I'm now trying to port my website code over to using PDO, but I am getting an error when I try to use the PDO object that I create. I'm using a CMS on my website, and it makes building page output kind of complicated, but I've tried to draw the structure of what is being called below: index.php -class myClass defined --method myFunction defined (it gets called on pageload & returns the page output) ---include file1.php ----require_once('mysql_connect.php') (creates pdo object) ----*I can use the pdo object here successfully* ----require_once('file2.php') -----require_once('mysql_connect.php') -----function myFunction2 defined ------*trying to use the pdo object here results in the error* The error I'm getting is: Fatal error: Call to a member function prepare() on a non-object in /home/rgcpanel/public_html/account/account_functions.php on line 147 Any idea what's going on?

    Read the article

  • Will creating a background thread in a WCF service during a call, take up a thread in the ASP .NET t

    - by Nate Pinchot
    The following code is part of a WCF service. Will eventWatcher take up a thread in the ASP .NET thread pool, even if it is set IsBackground = true? /// <summary> /// Provides methods to work with the PhoneSystem web services SDK. /// This is a singleton since we need to keep track of what lines (extensions) are open. /// </summary> public sealed class PhoneSystemWebServiceFactory : IDisposable { // singleton instance reference private static readonly PhoneSystemWebServiceFactory instance = new PhoneSystemWebServiceFactory(); private static readonly object l = new object(); private static volatile Hashtable monitoredExtensions = new Hashtable(); private static readonly PhoneSystemWebServiceClient webServiceClient = CreateWebServiceClient(); private static volatile bool isClientRegistered; private static volatile string clientHandle; private static readonly Thread eventWatcherThread = new Thread(EventPoller) {IsBackground = true}; #region Constructor // these constructors are hacks to make the C# compiler not mark beforefieldinit // more info: http://www.yoda.arachsys.com/csharp/singleton.html static PhoneSystemWebServiceFactory() { } PhoneSystemWebServiceFactory() { } #endregion #region Properties /// <summary> /// Gets a thread safe instance of PhoneSystemWebServiceFactory /// </summary> public static PhoneSystemWebServiceFactory Instance { get { return instance; } } #endregion #region Private methods /// <summary> /// Create and configure a PhoneSystemWebServiceClient with basic http binding and endpoint from app settings. /// </summary> /// <returns>PhoneSystemWebServiceClient</returns> private static PhoneSystemWebServiceClient CreateWebServiceClient() { string url = ConfigurationManager.AppSettings["PhoneSystemWebService_Url"]; if (string.IsNullOrEmpty(url)) { throw new ConfigurationErrorsException( "The AppSetting \"PhoneSystemWebService_Url\" could not be found. Check the application configuration and ensure that the element exists. Example: <appSettings><add key=\"PhoneSystemWebService_Url\" value=\"http://xyz\" /></appSettings>"); } return new PhoneSystemWebServiceClient(new BasicHttpBinding(), new EndpointAddress(url)); } #endregion #region Event poller public static void EventPoller() { while (true) { if (Thread.CurrentThread.ThreadState == ThreadState.Aborted || Thread.CurrentThread.ThreadState == ThreadState.AbortRequested || Thread.CurrentThread.ThreadState == ThreadState.Stopped || Thread.CurrentThread.ThreadState == ThreadState.StopRequested) break; // get events //webServiceClient.GetEvents(clientHandle, 30, 100); } Thread.Sleep(5000); } #endregion #region Client registration methods private static void RegisterClientIfNeeded() { if (isClientRegistered) { return; } lock (l) { // double lock check if (isClientRegistered) { return; } //clientHandle = webServiceClient.RegisterClient("PhoneSystemWebServiceFactoryInternal", null); isClientRegistered = true; } } private static void UnregisterClient() { if (!isClientRegistered) { return; } lock (l) { // double lock check if (!isClientRegistered) { return; } //webServiceClient.UnegisterClient(clientHandle); } } #endregion #region Phone extension methods public bool SubscribeToEventsForExtension(string extension) { if (monitoredExtensions.Contains(extension)) { return false; } lock (monitoredExtensions.SyncRoot) { // double lock check if (monitoredExtensions.Contains(extension)) { return false; } RegisterClientIfNeeded(); // open line so we receive events for extension LineInfo lineInfo; try { //lineInfo = webServiceClient.OpenLine(clientHandle, extension); } catch (FaultException<PhoneSystemWebSDKErrorDetail>) { // TODO: log error return false; } // add extension to list of monitored extensions //monitoredExtensions.Add(extension, lineInfo.lineID); monitoredExtensions.Add(extension, 1); // start event poller thread if not already started if (eventWatcherThread.ThreadState == ThreadState.Stopped || eventWatcherThread.ThreadState == ThreadState.Unstarted) { eventWatcherThread.Start(); } return true; } } public bool UnsubscribeFromEventsForExtension(string extension) { if (!monitoredExtensions.Contains(extension)) { return false; } lock (monitoredExtensions.SyncRoot) { if (!monitoredExtensions.Contains(extension)) { return false; } // close line try { //webServiceClient.CloseLine(clientHandle, (int) monitoredExtensions[extension]); } catch (FaultException<PhoneSystemWebSDKErrorDetail>) { // TODO: log error return false; } // remove extension from list of monitored extensions monitoredExtensions.Remove(extension); // if we are not monitoring anything else, stop the poller and unregister the client if (monitoredExtensions.Count == 0) { eventWatcherThread.Abort(); UnregisterClient(); } return true; } } public bool IsExtensionMonitored(string extension) { lock (monitoredExtensions.SyncRoot) { return monitoredExtensions.Contains(extension); } } #endregion #region Dispose public void Dispose() { lock (l) { // close any open lines var extensions = monitoredExtensions.Keys.Cast<string>().ToList(); while (extensions.Count > 0) { UnsubscribeFromEventsForExtension(extensions[0]); extensions.RemoveAt(0); } if (!isClientRegistered) { return; } // unregister web service client UnregisterClient(); } } #endregion }

    Read the article

  • Using the using statement with WinForms... Good Practice?

    - by Nate Heinrich
    I understand the concept and reasons behind using the using statement, and I use it with things like file resources and remote connections, I was wondering if it is good practice to use the using statement with WinForm forms and dialogs? using (MyDialog dlg = new MyDialog()) { if (dlg.ShowDialog() == EDialogResult.OK) { // Do Something } } Thanks!

    Read the article

  • Where does C# and the .NET Framework fail?

    - by Nate Bross
    In my non-programming life, I always attempt to use the approprite tool for the job, and I feel that I do the same in my programming life, but I find that I am choosing C# and .NET for almost everything. I'm finding it hard to come up with (realistic business) needs that cannot be met by .NET and C#. Obviously embedded systems might require something less bloated than the .NET Micro Framework, but I'm really looking for line of business type situations where .NET is not the best tool. I'm primarly a C# and .NET guy since its what I'm the most comfertable in, but I know a fair amount of C++, php, VB, powershell, batch files, and Java, as well as being versed in the web technologes (javascript, html/css). But I'm open minded about it my skill set and I'm looking for cases where C# and .NET are not the right tool for the job. The bottom line here, is that I feel that I'm choosing C# and .NET simply because I am very comfertable with it, so I'm looking for cases where you have chosen something other than .NET, even though you are primarly a .NET developer.

    Read the article

  • mysql to get depth of record, count parent and ancestor records

    - by Nate
    Hey All, Say I have a post table containing the fields post_id and parent_post_id. I want to return every record in the post table with a count of the "depth" of the post. By depth, I mean, how many parent and ancestor records exist. Take this data for example... post_id parent_post_id ------- -------------- 1 null 2 1 3 1 4 2 5 4 The data represents this hierarchy... 1 |_ 2 | |_ 4 | |_ 5 |_ 3 The result of the query should be... post_id depth ------- ----- 1 0 2 1 3 1 4 2 5 3 Thanks in advance!

    Read the article

  • Should I define a single "DataContext" and pass references to it around or define muliple "DataConte

    - by Nate Bross
    I have a Silverlight application that consists of a MainWindow and several classes which update and draw images on the MainWindow. I'm now expanding this to keep track of everything in a database. Without going into specifics, lets say I have a structure like this: MainWindow Drawing-Surface Class1 -- Supports Drawing DataContext + DataServiceCollection<T> w/events Class2 -- Manages "transactions" (add/delete objects from drawing) Class3 Each "Class" is passed a reference to the Drawing Surface so they can interact with it independently. I'm starting to use WCF Data Services in Class1 and its working well; however, the other classes are also going to need access to the WCF Data Services. (Should I define my "DataContext" in MainWindow and pass a reference to each child class?) Class1 will need READ access to the "transactions" data, and Class2 will need READ access to some of the drawing data. So my question is, where does it make the most sense to define my DataContext? Does it make sense to: Define a "global" WCF Data Service "Context" object and pass references to that in all of my subsequent classes? Define an instance of the "Context" for each Class1, Class2, etc Have each method that requires access to data define its own instance of the "Context" and use closures handle the async load/complete events? Would a structure like this make more sense? Is there any danger in keeping an active "DataContext" open for an extended period of time? Typical usecase of this application could range from 1 minute to 40+ minutes. MainWindow Drawing-Surface DataContext Class1 -- Supports Drawing DataServiceCollection<DrawingType> w/events Class2 -- Manages "transactions" (add/delete objects from drawing) DataServiceCollection<TransactionType> w/events Class3 DataServiceCollection<T> w/events

    Read the article

  • Designing a service for consumption on multiple mobile platforms

    - by Nate Bross
    I am building and designing a (mostly) read-only interface to some data. I'll be uing ASP.NET MVC to build a psudo-restful API. I'm wondering if anyone can provide some resources for building full-client applications for various mobile platforms, iPhone, Android, Blackberry, Windows Mobile, etc. I'm thinking that serving up XML data is going to be the most simple and universal, but parsing XML in objective-C for example doesn't sound like fun to me, but maybe there are some good libaries out there to help ease this task? In other words, what formt will be the quickest to implement on the client side? Are there any JSON parsrs for iPhone or Android? I know there are .NET JSON parsers, but not sure about other platforms -- is ther another format that might better? Or should I stick with pure XML and deal with it on each platform differently?

    Read the article

  • Why isn't an exception thrown when the right .NET framework version is not present?

    - by Nate Heinrich
    We have a .NET application which targets .NET 3.5. Our clients run it from a shared drive (very infrequently) in order to have a central config file location. We have noticed that if a workstation accesses the shared drive and runs the program, but does not have .NET 3.5 installed, nothing happens, no error, no exception, no log entry, it just doesn't launch. Why is there no error message shown in windows by the CLR? Is there something I can put at the beginning of the code that would ensure that a proper error message is displayed? It is not an option to run an installer that would check for prereqs, as we are only installing it in one central location. Thanks.

    Read the article

  • Change MS Access to Exclusive on the fly

    - by Nate
    I have a process in an MS Acess database that the users will usually run once daily, but could be more or less. It takes several minutes and requires temporary exclusive access because it deletes and recreates the main table. I have code to check to see if there are other users in the db before the process starts, but is there a way to change the access to "exclusive" at the beginning, and then change it back to open access at the end? Thanks for any help.

    Read the article

  • Detecting if SQL Server Compact Edition 3.5 SP2 x64 is installed?

    - by Nate Zaugg
    I am building an installer and I want to bootstrap SQL Server Compact Edition 3.5 SP2. The problem is that I am looking for the registry key HKLM\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5\ENU\DesktopRuntimeVersion. The reason that is a problem is that for 64-bit machines SQL CE requires that both the 32-bit and 64-bit installers are run. You can't install the 64-bit version until the 32-bit version is installed. As soon as the 32-bit version is installed the registry key is populated and my bootstrapper, dotNetInstaller detects that the registry key is there and the x64 version is never installed. Any ideas on how to tell if the x64 version is installed even if the x32 is installed?

    Read the article

  • XNA Class Design with Structs as Properties and issues because they are value types and not referenc

    - by Nate Bross
    I'm wondering how you'd recommend designin a class, given the fact that XNA Framework uses Struct all over the place? For example, a spite class, which may require a Vector2 and a Rectangle (both defined as Struct) to be accessed outside of the class. The issue come in when you try to write code like this: class Item { public Vetor2 Position {get; set;} public Item() { Position = new Vector2(5,5); } } Item i = new Item(); i.Positon.X = 20; // fails with error 'Cannot modify the return value of Item because it is not a variable.' // you must write code like this var pos = i.Position; pos.X++; i.Position = pos; The second option compiles and works, but it is just butt ugly. Is there a better way?

    Read the article

  • What programming/techy name should I give my new pup? [closed]

    - by Nate
    I am getting a Border Collie puppy tomorrow. If I can get my wife to agree to do so I want to give it a techy/programming type of name. The vast majority of my development is in Microsoft .NET / C# on mobile devices (WinMo and tablets) as well as Silverlight and ASP.NET. I would like the name to be something in that area although I am open other technologies, etc. I have not seen him yet. I assume he is typical Border Collie colored - black/white. One name that crossed my mind is Xaml (pronounced Zammel). What other name ideas do you have?

    Read the article

  • ASP.NET MVC Actions that return different views, or just make a ton of Actions?

    - by Nate Bross
    So, I am in a situation, where I need to display a different view based on the "Role" that the authenticated user has. I'm wondering which approach is best here: [Authorize(Roles="Admin")] public ActionResult AdminList(int? divID, int? subDivID) { var data = GetListItems(divID.Value, subDivID.Value); return View(data); } [Authorize(Roles = "Consultant")] public ActionResult ConsultantList(int? divID, int? subDivID) { var data = GetListItems(divID.Value, subDivID.Value); return View(data); } or should I do something like this [Authorize] public ActionResult List(int? divID, int? subDivID) { var data = GetListItems(divID.Value, subDivID.Value); if(HttpContenxt.User.IsInRole("Admin") { return View("AdminList", data ); } if(HttpContenxt.User.IsInRole("Consultant") { return View("ConsultantList", data ); } return View("NotFound"); }

    Read the article

  • Troubles with DateTime and PHP 5.2

    - by Nate Wagar
    I'm attempting to use the PHP DateTime class on a server with PHP 5.2.6, with a test server running PHP 5.3. Here is the code: <?php try { $dt = new DateTime('2009-10-08'); $dt->setDate(2009,10,8); print_r($dt); }catch (Exception $e) { echo $e->getMessage(); } On the test server, things work flawlessly, this is what prints: DateTime Object ( [date] => 2009-10-08 00:00:00 [timezone_type] => 3 [timezone] => America/New_York ) On the server I need to use it on, however, this is what prints: DateTime Object ( ) Removing the setDate makes no difference whatsoever. Any ideas why this might be happening? Thanks!

    Read the article

  • Where/When do C# and the .NET Framework fail to be the right tool?

    - by Nate Bross
    In my non-programming life, I always attempt to use the appropriate tool for the job, and I feel that I do the same in my programming life, but I find that I am choosing C# and .NET for almost everything. I'm finding it hard to come up with (realistic business) needs that cannot be met by .NET and C#. Obviously embedded systems might require something less bloated than the .NET Micro Framework, but I'm really looking for line of business type situations where .NET is not the best tool. I'm primarly a C# and .NET guy since its what I'm the most comfertable in, but I know a fair amount of C++, php, VB, PowerShell, batch files, and Java, as well as being versed in the web technologes (JavaScript, HTML, and CSS). But I'm open minded about it my skill set and I'm looking for cases where C# and .NET are not the right tool for the job. I choose .NET and C# because I'm comfortable with it, but I'm looking for cases where it isn't appropriate.

    Read the article

  • WCF Best Practice for "Overloaded" methods

    - by Nate Bross
    What is the best practice for emulating overloaded methods over WCF? Typically I might write an interface like this interface IInterface { MyType ReadMyType(int id); IEnumerable<MyType> ReadMyType(String name); IEnumerable<MyType> ReadMyType(String name, int maxResults); } What would this interface look like after you converted it to WCF?

    Read the article

  • "painting" one array onto another using python / numpy

    - by Nate
    I'm writing a library to process gaze tracking in Python, and I'm rather new to the whole numpy / scipy world. Essentially, I'm looking to take an array of (x,y) values in time and "paint" some shape onto a canvas at those coordinates. For example, the shape might be a blurred circle. The operation I have in mind is more or less identical to using the paintbrush tool in Photoshop. I've got an interative algorithm that trims my "paintbrush" to be within the bounds of my image and adds each point to an accumulator image, but it's slow(!), and it seems like there's probably a fundamentally easier way to do this. Any pointers as to where to start looking?

    Read the article

  • C++ addition overload ambiguity

    - by Nate
    I am coming up against a vexing conundrum in my code base. I can't quite tell why my code generates this error, but (for example) std::string does not. class String { public: String(const char*str); friend String operator+ ( const String& lval, const char *rval ); friend String operator+ ( const char *lval, const String& rval ); String operator+ ( const String& rval ); }; The implementation of these is easy enough to imagine on your own. My driver program contains the following: String result, lval("left side "), rval("of string"); char lv[] = "right side ", rv[] = "of string"; result = lv + rval; printf(result); result = (lval + rv); printf(result); Which generates the following error in gcc 4.1.2: driver.cpp:25: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: String.h:22: note: candidate 1: String operator+(const String&, const char*) String.h:24: note: candidate 2: String String::operator+(const String&) So far so good, right? Sadly, my String(const char *str) constructor is so handy to have as an implicit constructor, that using the explicit keyword to solve this would just cause a different pile of problems. Moreover... std::string doesn't have to resort to this, and I can't figure out why. For example, in basic_string.h, they are declared as follows: template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT, _Traits, _Alloc> operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs) template<typename _CharT, typename _Traits, typename _Alloc> basic_string<_CharT,_Traits,_Alloc> operator+(const _CharT* __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs); and so on. The basic_string constructor is not declared explicit. How does this not cause the same error I'm getting, and how can I achieve the same behavior??

    Read the article

  • Clojure load files

    - by Nate
    I'm trying to set up a simple clojure project, and I'm not sure how to load files between the project. I'm sure that the answer is in the documentation, but I can't find a simple answer any where and I'm not sure where to look. Essentially, my directory looks like this: Clojure/ clojure/ clojure.jar other clojure files clojure-contrib/ clojure-contrib.jar other contrib files project/ main.clj utils.clj And I want main.clj to be something like this: (ns project.main (:require project.utils)) (greet) and utils.clj to be something like this: (ns project.utils) (defn greet [] (println "Hello, World!")) But that fails with: Exception in thread "main" java.io.FileNotFoundException: Could not locate project/utils__init.class or project/utils.clj on classpath: (main.clj:1) When I attempt to run it. How do you set up a simple clojure project?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >