Search Results

Search found 1238 results on 50 pages for 'sam bivins'.

Page 30/50 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • Retrieve contents of a public Dropbox folder?

    - by Sam
    Is there a way to retrieve a list of the contents of a public Dropbox folder (preferably in PHP)? This is what a URL to a public file in Dropbox looks like: http://dl.dropbox.com/u/1234567/publikPholder/textytext.txt One would think that jumping up one level to the directory in the URL... http://dl.dropbox.com/u/1234567/publikPholder/ ...would show all the public files. Nope. Nothing but a 404.

    Read the article

  • N-tier Repository POCOs - Aggregates?

    - by Sam
    Assume the following simple POCOs, Country and State: public partial class Country { public Country() { States = new List<State>(); } public virtual int CountryId { get; set; } public virtual string Name { get; set; } public virtual string CountryCode { get; set; } public virtual ICollection<State> States { get; set; } } public partial class State { public virtual int StateId { get; set; } public virtual int CountryId { get; set; } public virtual Country Country { get; set; } public virtual string Name { get; set; } public virtual string Abbreviation { get; set; } } Now assume I have a simple respository that looks something like this: public partial class CountryRepository : IDisposable { protected internal IDatabase _db; public CountryRepository() { _db = new Database(System.Configuration.ConfigurationManager.AppSettings["DbConnName"]); } public IEnumerable<Country> GetAll() { return _db.Query<Country>("SELECT * FROM Countries ORDER BY Name", null); } public Country Get(object id) { return _db.SingleById(id); } public void Add(Country c) { _db.Insert(c); } /* ...And So On... */ } Typically in my UI I do not display all of the children (states), but I do display an aggregate count. So my country list view model might look like this: public partial class CountryListVM { [Key] public int CountryId { get; set; } public string Name { get; set; } public string CountryCode { get; set; } public int StateCount { get; set; } } When I'm using the underlying data provider (Entity Framework, NHibernate, PetaPoco, etc) directly in my UI layer, I can easily do something like this: IList<CountryListVM> list = db.Countries .OrderBy(c => c.Name) .Select(c => new CountryListVM() { CountryId = c.CountryId, Name = c.Name, CountryCode = c.CountryCode, StateCount = c.States.Count }) .ToList(); But when I'm using a repository or service pattern, I abstract away direct access to the data layer. It seems as though my options are to: Return the Country with a populated States collection, then map over in the UI layer. The downside to this approach is that I'm returning a lot more data than is actually needed. -or- Put all my view models into my Common dll library (as opposed to having them in the Models directory in my MVC app) and expand my repository to return specific view models instead of just the domain pocos. The downside to this approach is that I'm leaking UI specific stuff (MVC data validation annotations) into my previously clean POCOs. -or- Are there other options? How are you handling these types of things?

    Read the article

  • Preserving original StackTrace/LineNumbers in .NET Exceptions

    - by Sam
    Understanding the difference between throw ex and throw, why is the original StackTrace preserved in this example: static void Main(string[] args) { try { LongFaultyMethod(); } catch (System.Exception ex) { Console.WriteLine(ex.StackTrace); } } static void LongFaultyMethod() { try { int x = 20; SomethingThatThrowsException(x); } catch (Exception) { throw; } } static void SomethingThatThrowsException(int x) { int y = x / (x - x); } But not in this one: static void Main(string[] args) { try { LongFaultyMethod(); } catch (System.Exception ex) { Console.WriteLine(ex.StackTrace); } } static void LongFaultyMethod() { try { int x = 20; int y = x / (x - 20); } catch (Exception) { throw; } } The second scenario is producing the same output as throw ex would? In both cases, one expects to see the line number where y is initialized.

    Read the article

  • How to properly close a process with NppExec?

    - by Sam the Great
    I'm not sure what's going on here, but the following code continues running even after I end the process in the NppExec console with Ctrl-C (during the execution of the while loop). I restarted my computer to stop the Ctrl key sends. However, if I run the script in Window's cmd prompt, Ctrl-C ends the script just fine. import time import win32com.client shell = win32com.client.Dispatch("WScript.Shell") time.sleep(2) while True: shell.SendKeys('^') # Ctrl key time.sleep(0.5) The NppExec run command I used was: cmd /C python -u "$(FULL_CURRENT_PATH)" Let me know if there is any more information I can provide. Thanks.

    Read the article

  • Synchronizing Access to a member of the ASP.NET session

    - by Sam
    I'm building a Javascript application and eash user has an individual UserSession. The application makes a bunch of Ajax calls. Each Ajax call needs access to a single UserSession object for the user. Each Ajax call needs a UserSession object. Data in the UserSession object is unique to each user. Originally, during each Ajax call I would create a new UserSession object and it's data members were stored in the ASP.NET Session. However, I found that the UserSession object was being instantiated a lot. To minimize the construction of the UserSession object, I wrapped it in a Singleton pattern and sychronized access to it. I believe that the synchronization is happening application wide, however I only need it to happen per user. I saw a post here that says the ASP.NET cache is synchronized, however the time between creating the object and inserting it into the cache another Thread could start construction it's another object and insert it into the cache. Here is the way I'm currently synchronizing access to the object. Is there a better way than using "lock"... should be be locking on the HttpContext.Session object? private static object SessionLock = new object(); public static WebSession GetSession { get { lock (SessionLock) { try { var context = HttpContext.Current; WebSession result = null; if (context.Session["MySession"] == null) { result = new WebSession(context); context.Session["MySession"] = result; } else { result = (WebSession)context.Session["MySession"]; } return result; } catch (Exception ex) { ex.Handle(); return null; } } } }

    Read the article

  • How to read SOAP response in FLEX 3

    - by Sam Rudolph
    SOAP Request<?xml version="1.0" encoding="UTF-8"?> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Header/> <S:Body> <ns2:deleteDataView xmlns:ns2="http://ws.$$$$$.@@@@@.####.com/"> <identifier>5</identifier> </ns2:deleteDataView> &lt;/S:Body&gt; </S:Envelope> SOAP Response<?xml version="1.0" encoding="UTF-8"?> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:deleteDataViewResponse xmlns:ns2="http://ws.$$$$$.@@@@@.####.com/"> <return>ERROR: A bug has been encountered,please try later</return&gt </ns2:deleteDataViewResponse> </S:Body> </S:Envelope> I want to read SOAP response in flex,am some what new to FLEX,pls help,even good resources will work.

    Read the article

  • rails, rest, render different action with responds to

    - by Sam
    Maybe my logic is not restful or know if this is how you would do it but this is what I am trying to do. I'm getting a category inside a category controller and then once I get that category I want to return to an index page in a different controller but keep that @category and the Category.busineses. Before rest I would have just done this: render :controller = "businesses" and it would have rendered the view of the index action in that controller. now in my respond_to block I have this format.html {redirect_to(business_path)} # index.html.erb format.xml { render :xml => @businesses } but of course with a render it looses the instance variable and starts with a new action. So what I want to do is render the action instead of redirecting to that action. is this possible?

    Read the article

  • Copying Data to a Master sheet from other sheets without duplicates

    - by sam
    I have four workbooks, three of which are for data entries, and the latter which hosts all data entered in the other workbooks; as a matter of fact, it serves as a master workbook. I need code to copy data entered in each workbook in sheet 1 to be copied to the next available row on sheet 1 of the master workbook, but if the data to be copied from these individual workbooks are duplicates, then a message box should pop up displaying that its a duplicate. To be precise, I want the users to type p in column j indicating process, and click a button in the spreadsheet to copy the data to the master sheet. I would be glad for any assistance. Thanks a million for any help.

    Read the article

  • Sign in as different user when using Integrated Windows Authentication

    - by Sam
    I have restricted access to a site by using Integrated Windows Authentication and turning off anonymous access. This way I can then show them their real name (from looking up on Active Directory and using the server variable LOGON_USER) and do other related Active Directory tasks. How can I then prompt again for their user credentials, through a 'sign in as other user' link , showing the browser prompt (like you would get on a browser like Chrome or Firefox, or if the site was not in the 'Intranet' zone in IE) rather than a Web Form? Since SharePoint offers this functionality, I assume there is a way to do this through code, but I don't know what code can do this (using C#). I can send a 401 header which makes the prompt appear, but how do you then confirm if they are logged in?

    Read the article

  • PHP Thumbnail Image Resizing with proportions

    - by Sam
    Hi all. As a brief run down, I am currently making a dating type site. Users can create accounts and upload profile pictures (up to 8). In order to display these in the browse area of the website, I am looking for a way in PHP (with third party processor/scripts) to resize all images uploaded to have thumbnails that adhere to certain dimensions. As an example, I will want "profile" images (thumbnails) to be NO larger than 120*150px. The scripting needs to resize uploaded images (regardless of whether they are portrait or landscape, and regardless of proportions) to adhere to these dimensions without getting stretched. The width (eg. 120pixels) should always remain the same, but the height (eg. 150px) can vary in order to keep the image in proportion. If it's a landscape photo, I'm assuming the script would need to take a chunk out of the middle of the image? The reason that all images to be resized is so that when profiles are display in a grid that all thumbnails are roughly the same size. Any input would be greatly appreciated.

    Read the article

  • Where to put constants in Rails

    - by Sam
    I have a few constants which are arrays that I don't want to create db's for but I don't know where to store the constants without getting errors. For example CONTAINER_SIZES = [["20 foot"],["40 foot"]] Where can I store this so all models and controller have access to this?

    Read the article

  • Email from an app, but not use a a pop up controller, just text inside a text box.

    - by Sam Jarman
    Hey is there any way to send whats in a text view (im trying to make a suggestion box) to my email address? example user types in the box " I think you should add twitter support" then that is sent in the background to my email address [email protected] then a message is popped up on the screen saying "suggestion sent" just an example of what i mean Any ideas, tutorial links would be greatly appreciated guys Thanks

    Read the article

  • how to save sitecore webpage in html file on local disk or server

    - by Sam
    WebRequest mywebReq ; WebResponse mywebResp ; StreamReader sr ; string strHTML ; StreamWriter sw; mywebReq = WebRequest.Create("http://domain/sitecore/content/test/page10.aspx"); mywebResp = mywebReq.GetResponse(); sr = new StreamReader(mywebResp.GetResponseStream()); strHTML = sr.ReadToEnd(); sw = File.CreateText(Server.MapPath("hello.html")); sw.WriteLine(strHTML); sw.Close(); Hi , I want to save sitecore .aspx page into html file on local disk , but i am getting exception. But if i use any other webpage example(google.com) it works fine. The exception : System.Net.WebException was caught HResult=-2146233079 Message=The remote server returned an error: (404) Not Found. Source=System StackTrace: at System.Net.WebClient.DownloadFile(Uri address, String fileName) at System.Net.WebClient.DownloadFile(String address, String fileName) at BlueDiamond.addmodule.btnSubmit(Object sender, EventArgs e) in c:\inetpub\wwwroot\STGLocal\Website\addmodule.aspx.cs:line 97 InnerException: Any help. Thanks in advance

    Read the article

  • msysGit: Why does git log output blank lines?

    - by Sam
    It appears to insert less blank lines the closer I type the command to the bottom of the terminal window. If I type it at the top of the terminal window, it inserts nearly a full window height of blank lines; if I type it at the very bottom, no blank lines are inserted. It seems like the pager program is pushing output to the bottom of the terminal window, but I want the output to be right below my command or at the top, like in Linux git. I can get expected behavior by using git --no-pager log, but what if I want to use a pager?

    Read the article

  • c# xml string special characters

    - by sam
    Please help explain why the dataset cannot read the encoded xml? string xml = "<?xml version=\"1.0\" standalone=\"yes\" ?> <DataSet><node>it's my \"node\" & i like it</node></DataSet>"; string encodedXml = System.Security.SecurityElement.Escape(xml); DataSet ds = new DataSet(); ds.ReadXml(New XmlTextReader(new StringReader(encodedXml))); I have checked the link http://weblogs.sqlteam.com/mladenp/archive/2008/10/21/Different-ways-how-to-escape-an-XML-string-in-C.aspx What i want to do is to read a string with special characters into a dataset. But the code cannot locate the special characters in the string, c# added all the \ so the linenumber is not accurate generated by XmlException object. Anyone could provide the code to read a string with special characters into a dataset. thanks very much

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >