Search Results

Search found 31 results on 2 pages for 'trey'.

Page 1/2 | 1 2  | Next Page >

  • Jquery Autocomplete plugin with Django (Trey Piepmeier solution)

    - by Sally
    So, I'm basing my code on Trey's solution on: http://solutions.treypiepmeier.com/2009/12/10/using-jquery-autocomplete-with-django/ The script is: <script> $(function() { $('#id_members').autocomplete('{{ object.get_absolute_url }}members/lookup', { dataType: 'json', width: 200, parse: function(data) { return $.map(data, function(row) { return { data:row, value:row[1], result:row[0] }; }); } }).result( function(e, data, value) { $("#id_members_pk").val(value); } ); } ); </script> The views.py: def members_lookup(request, pid): results = [] if request.method == "GET": if request.GET.has_key(u'q'): value = request.GET[u'q'] # Ignore queries shorter than length 1 if len(value) > 2: model_results = Member.objects.filter( Q(user__first_name__icontains=value) | Q(user__last_name__icontains=value) ) results = [ (x.user.get_full_name(), x.id) for x in model_results ] json = simplejson.dumps(results) print json return HttpResponse(json, mimetype='application/json') The problem is: It stops refining the search results after the initial lookup. For example: If I set len(value) 2, after I type the 3rd character it will give me a list of suggestions. But if I keep on typing the 4th or 5th character, the list of suggestions doesn't change. Any suggestions on why this is?

    Read the article

  • Mocking User.Identity in ASP.NET MVC

    - by Trey Carroll
    I need to create Unit Tests for an ASP.NET MVC 2.0 web site. The site uses Windows Authentication. I've been reading up on the necessity to mock the HTTP context for code that deals with the HttpContext. I feel like I'm starting to get a handle on the DI pattern as well. (Give the class an attribute of type IRepository and then pass in a Repository object when you instantiate the controller.) What I don't understand, however, is the proper way to Mock the Windows Principal object available through User.Identity. Is this part of the HttpContext? Does any body have a link to an article that demonstrates this (or a recommendation for a book)? Thanks, Trey Carroll

    Read the article

  • Need Users to Re-authenticate with NTLM

    - by Trey Carroll
    I'm NTLM (authenication="windows" in the web.config) with an asp.net mvc 2.0 site. Right now once a user logs in it keeps them logged in for weeks at a time. The use of the application is being opened up to users who share computers that use logged in service accounts. I need the site to reprompt each user for their AD credentials each time in order to handle these users. (Activity on the site must be linked to a uniquely identified user.) Thanks for any help that you can provide. Trey Carroll

    Read the article

  • Why does localization with resx files fail with ZH (chinese) only?

    - by Trey Carroll
    Howdy All, I've been tasked with localizing an English language ASP.NET MVC 2.0 website into 7 additional languages. I've added resource files to the Views Home App_LocalResources folder: Example: Index.resx, Index.es.resx, Index.fr.resx, Index.zh.resx, etc. I have set the CustomTool to PublicResXFileCodeGenerator (Access modifier is Public), Set file as an Embedded Resource, Set a Custom Tool Namespace. The keys ("Name") in all of the files are the same. For 7 languages this works perfectly. If I go into IE 8 settings and change the language to de,fr,it, etc., the page shows the appropriate translated strings. However, when I set the language in the Browser to any of the zh (Simplified Chinese) variants localization completely fails and the English strings are displayed. Is there something special about Simplified Chinese? Japanese and Korean work without problems. TIA, Trey Carroll

    Read the article

  • How to stop MVC caching the results of invoking and action method?

    - by Trey Carroll
    I am experiencing a problem with IE caching the results of an action method. Other articles I found were related to security and the [Authorize] attribute. This problem has nothing to do with security. This is a very simple "record a vote, grab the average, return the avg and the number of votes" method. The only slightly interesting thing about it is that it is invoked via Ajax and returns a Json object. I believe that it is the Json object that is getting catched. When I run it from FireFox and watch the XHR traffic with Firebug, everything works perfectly. However, under IE 8 the "throbber" graphic doesn't ever have time to show up and the page elements that display the "new" avg and count that are being injected into the page with jQuery are never different. I need a way to tell MVC to never cache this action method. This article seems to address the problem, but I cannot understand it: http://stackoverflow.com/questions/1441467/prevent-caching-of-attributes-in-asp-net-mvc-force-attribute-execution-every-tim I need a bit more context for the solution to understand how to extend AuthorizationAttribute. Please address your answer as if you were speaking to someone who lacks a deep understanding of MVC even if that means replying with an article on some basics/prerequisites that are required. Thanks, Trey Carroll

    Read the article

  • Can't get SSH public key authentication to work

    - by Trey Parkman
    My server is running CentOS 5.3. I'm on a Mac running Leopard. I don't know which is responsible for this: I can log on to my server just fine via password authentication. I've gone through all of the steps for setting up PKA (as described at http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-ssh-beyondshell.html), but when I use SSH, it refuses to even attempt publickey verification. Using the command ssh -vvv user@host (where -vvv cranks up verbosity to the maximum level) I get the following relevant output: debug2: key: /Users/me/.ssh/id_dsa (0x123456) debug1: Authentications that can continue: publickey,gssapi-with-mic,password debug3: start over, passed a different list publickey,gssapi-with-mic,password debug3: preferred keyboard-interactive,password debug3: authmethod_lookup password debug3: remaining preferred: ,password debug3: authmethod_is_enabled password debug1: Next authentication method: password followed by a prompt for my password. If I try to force the issue with ssh -vvv -o PreferredAuthentications=publickey user@host I get debug2: key: /Users/me/.ssh/id_dsa (0x123456) debug1: Authentications that can continue: publickey,gssapi-with-mic,password debug3: start over, passed a different list publickey,gssapi-with-mic,password debug3: preferred publickey debug3: authmethod_lookup publickey debug3: No more authentication methods to try. So, even though the server says it accepts the publickey authentication method, and my SSH client insists on it, I'm rebutted. (Note the conspicuous absence of an "Offering public key:" line above.) Any suggestions?

    Read the article

  • FreeBSD slow transfers - RFC 1323 scaling issue?

    - by Trey
    I think I may be having an issue with window scaling (RFC 1323) and am hoping that someone can enlighten me on what's going on. Server: FreeBSD 9, apache22, serving a static 100MB zip file. 192.168.18.30 Client: Mac OS X 10.6, Firefox 192.168.17.47 Network: Only a switch between them - the subnet is 192.168.16/22 (In this test, I also have dummynet filtering simulating an 80ms ping time on all IP traffic. I've seen nearly identical traces with a "real" setup, with real internet traffic/latency also) Questions: Does this look normal? Is packet #2 specifying a window size of 65535 and a scale of 512? Is packet #5 then shrinking the window size so it can use the 512 scale and still keep the overall calculated window size near 64K? Why is the window scale so high? Here are the first 6 packets from wireshark. For packets 5 and 6 I've included the details showing the window size and scaling factor being used for the data transfer. Code: No. Time Source Destination Protocol Length Info 108 6.699922 192.168.17.47 192.168.18.30 TCP 78 49190 http [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=8 TSval=945617489 TSecr=0 SACK_PERM=1 115 6.781971 192.168.18.30 192.168.17.47 TCP 74 http 49190 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 MSS=1460 WS=512 SACK_PERM=1 TSval=2617517338 TSecr=945617489 116 6.782218 192.168.17.47 192.168.18.30 TCP 66 49190 http [ACK] Seq=1 Ack=1 Win=524280 Len=0 TSval=945617490 TSecr=2617517338 117 6.782220 192.168.17.47 192.168.18.30 HTTP 490 GET /utils/speedtest/large.file.zip HTTP/1.1 118 6.867070 192.168.18.30 192.168.17.47 TCP 375 [TCP segment of a reassembled PDU] Details: Transmission Control Protocol, Src Port: http (80), Dst Port: 49190 (49190), Seq: 1, Ack: 425, Len: 309 Source port: http (80) Destination port: 49190 (49190) [Stream index: 4] Sequence number: 1 (relative sequence number) [Next sequence number: 310 (relative sequence number)] Acknowledgement number: 425 (relative ack number) Header length: 32 bytes Flags: 0x018 (PSH, ACK) Window size value: 130 [Calculated window size: 66560] [Window size scaling factor: 512] Checksum: 0xd182 [validation disabled] Options: (12 bytes) No-Operation (NOP) No-Operation (NOP) Timestamps: TSval 2617517423, TSecr 945617490 [SEQ/ACK analysis] TCP segment data (309 bytes) Note: originally posted http://forums.freebsd.org/showthread.php?t=32552

    Read the article

  • fail2ban and denyhosts constantly ban me on Ubuntu

    - by Trey Parkman
    I just got an Ubuntu instance on Linode. To secure the SSH on it, I installed fail2ban (using apt-get), but then had a problem: fail2ban kept banning my IP (for limited durations, thankfully) even though I was entering the correct password. So I removed fail2ban and installed denyhosts instead. Same problem, but more severe: It seems like every time I SSH in, my IP gets banned. I remove it from /etc/hosts.deny, restart denyhosts and log in again, and my IP gets banned again. The only explanation I can think of is that I've been SSH-ing in as root (yes, yes, I know); maybe something is set somewhere that blocks anyone who SSH-es in as root, even if they log in successfully? This seems bizarre to me. Any ideas? (Whitelisting my IP is a temporary fix. I don't want to only be able to log on from one IP.)

    Read the article

  • ASP.Net Application Trust Medium File IO Outside Virtual Directory

    - by Trey Gramann
    I am trying to determine how suicidal this is... I have a hosting environment where a custom ASP.Net CMS application needs to access the files in the root folder of a website even though it is in a virtual folder so it can be shared accross many sites. I can modify the Medium trust on the server and came up with this... <IPermission class="FileIOPermission" version="1" Read="$AppDir$;$AppDir$\.." Write="$AppDir$;$AppDir$\.." Append="$AppDir$;$AppDir$\.." PathDiscovery="$AppDir$;$AppDir$\.."/> Oddly enough, it works. Yes, I understand it is doing this for all the Apps. I am a bit at a loss as to easy ways to test what else is being exposed. Feels dangerous. Opinions?

    Read the article

  • Crystal Reports Server - Database Login Needs to go Away

    - by Trey Sargent
    The environment I'm working in is a Crystal Reports Server 2008 talking to a MySQL Server 5.1 database using JDBC. The problem is that I get a database logon screen every time I try to access a report from Crystal Reports Server. I've setup a JDBC connection using the MySQL Connector/J driver. When I create a .rpt file I provide the login credentails all is fine. I then publish to InfoView and go to access the report and it prompts me for username and password to the database. I then went to CMC and right-clicked on the report and opened the Database Configuration. I've selected 'Use original database logon information from the report' and 'Use same database logon as when report is run'. However, I still get the logon screen when I try to access the report.

    Read the article

  • First Test Crashes using MSTEST with ASP.NET MVC 1

    - by Trey Carroll
    I'm trying to start using Unit Testing and I want to test the following Controller: public class AjaxController : Controller { ... public JsonResult RateVideo( int userRating, long videoId ) { string userName = User.Identity.Name; ... } } I have a created a TestClass with the following method: [ TestMethod public void TestRateVideo() { //Arrange AjaxController c = new AjaxController(); //Act JsonResult jr = c.RateVideo(1, 1); //Assert //Not implemented yet } I select debug and run the test. When the code reaches the 1st statement: string username = User.Identity.Name; Debugging stops and I am presented with a message that says that the test failed. Any guidance you can offer would be appreciated.

    Read the article

  • How do I stub a view in rspec-2

    - by Trey Bean
    I'm in the process of upgrading an app to Rails 3/Rspec 2. I see that stubbing a view helper method has changed in Rspec 2. It looks like instead of doing template.stub!, we're now supposed to do view.stub!, but I can't seem to get this to work on beta 10. I get an "undefined local variable or method `view' for # < RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x106785fd0" error. I see that in this commit David removed the view method, but I can't figure out what it was replaced with. Something in ActionView::TestCase::Behavior? I'm on rails 3.0.0.beta3. Any idea what I'm missing?

    Read the article

  • Dictionary API or Library

    - by Trey
    Does anyone know of a good dictionary API or ruby library to lookup the definitions of words? I'm thinking it should work something like: I call get_definition(word) It returns the definition for that word (ideally in some way to easily format the definition for display. Thanks

    Read the article

  • Creating a Stack Overflow notifier

    - by Trey
    I could not find a Stack Overflow notifier Android app so I am planning on making one. I hope that my app will serve a similar purpose as the Stack Overflow Notifier Chrome extension. This will be my first Android app so I am still unfamiliar with the platform. My main concern when creating this app is, what is the proper way to access the user's Recent Activity page? I thought of two different approaches but I'm not sure how to implement either one: Make the user login to Stack Overflow through the Browser application or an embedded browser and scrape their recent activity page occasionally for updates. Ask the user for their username and password and forward this information to Stack Overflow for authentication, storing cookies somehow to keep the session active. I think Astrid uses something similar to the first approach, but I haven't been able to figure it out yet from skimming their code. What is the correct way to handle a notification application like this that requires session management?

    Read the article

  • acts_as_solr isn't updating associated models in Rails

    - by Trey Bean
    I'm using acts_as_solr for searching in a project. Unfortunately, the index doesn't seem to be updated for the associated models when a model is saved. Example: I have three models: class Merchant < ActiveRecord::Base acts_as_solr :fields => [:name, :domain, :description], :include => [:coupons, :tags] ... end class Coupon < ActiveRecord::Base acts_as_solr :fields => [:store_name, :url, :code, :description] ... end class Tag < ActiveRecord::Base acts_as_solr :fields => [:name] ... end I use the following line to perform a search: Merchant.paginate_by_solr(params[:q], :per_page => PER_PAGE, :page => [(params[:page] || 1).to_i, 1].max) For some reason though, after I add a coupon that contains the word 'shoes' in the description, a query for 'shoes' doesn't return the merchant associated with the coupon. The association all work and if I run rake solr:reindex, the search then returns the new coupon. Do I need to update the index for Merchant each time a new coupon is created? Do I have to update the index for the whole class or can I just update the associated merchant? Shouldn't this be done automatically? Thanks for any input.

    Read the article

  • Ldap query returns null result when deployed.

    - by Trey Carroll
    I'm using a very simple Ldap query in my asp.net mvc 2.0 site: String ldapPath = ConfigReader.LdapPath; String emailAddress = null; try { DirectorySearcher search = new DirectorySearcher(ConfigReader.LdapPath); search.Filter = String.Format("(&(objectClass=user)(objectCategory=person)(objectSid={0})) ", securityIdentifierValue); // add the mail property to the list of props to retrieve search.PropertiesToLoad.Add("mail"); var result = search.FindOne(); if (result == null) { throw new Exception("Ldap Query with filter:" + search.Filter.ToString() + " returned a null value (no match found)"); } else { emailAddress = result.Properties["mail"][0].ToString(); } } catch (ArgumentOutOfRangeException aoorEx) { throw new Exception( "The query could not find an email for this user."); } catch (Exception ex) { //_log.Error(string.Format("======!!!!!! ERROR ERROR ERROR !!!!! in LdapLookupUtil.cs getEmailFromLdap Exception: {0}", ex)); throw ex; } return emailAddress; It works fine on my localhost machine. It works fine when I run it in VS2010 on the server. It always returns a null result when deployed. Here is my web.config: Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in \Windows\Microsoft.Net\Framework\v2.x\Config -- section enables configuration of the security authentication mode used by ASP.NET to identify an incoming user. -- <!-- -- section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. -- I'm running it under the default app pool. Does anybody see the problem? This is driving me crazy!

    Read the article

  • Programatically Create Controller in Rails

    - by Trey Bean
    What's the best way to dynamically create a controller in Rails. I've got a class that needs to generate a bunch of controller that inherit from it. I could just create a bunch of files in /app/controllers, but they'd all be basically empty files. There's got to be a way to generate these classes dynamically and have them treated like other controllers in Rails, e.g. reloaded correctly in dev mode. I tried putting this in a config/initializer: FL.contact_types.each do |contact_type| controller_name = "#{contact_type.pluralize}Controller" Object.const_set(controller_name.to_sym, Class.new(ContactsController)) unless Object.const_defined?(controller_name.to_sym) end This worked, but I run into the dependency/reload problem and get “A copy of AuthenticatedSystem has been removed from the module tree but is still active” since the ContactsController inherits from ApplicationController which includes AuthenticatedSystem. Is creating a bunch of empty files really the best solution?

    Read the article

  • How can I run a local Windows Application and have the output be piped into the Browser.

    - by Trey Sherrill
    I have Windows Application (.EXE file is written in C and built with MS-Visual Studio), that outputs ASCII text to stdout. I’m looking to enhance the ASCII text to include limited HTML with a few links. I’d like to invoke this application (.EXE File) and take the output of that application and pipe it into a Browser. This is not a one time thing, each new web page would be another run of the Local Application! The HTML/java-script application below has worked for me to execute the application, but the output has gone into a DOS Box windows and not to pipe it into the Browser. I’d like to update this HTML Application to enable the Browser to capture that text (that is enhanced with HTML) and display it with the browser. <body> <script> function go() { w = new ActiveXObject("WScript.Shell"); w.run('C:/DL/Browser/mk_html.exe'); return true; } </script> <form> Run My Application (Window with explorer only) <input type="button" value="Go" onClick="return go()"> </FORM> </body>

    Read the article

  • Asp.net mvc - trying to display images pulled from db \

    - by Trey Carroll
    //Inherits="System.Web.Mvc.ViewPage<FilmFestWeb.Models.ListVideosViewModel>" <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>ListVideos</h2> <% foreach(BusinessObjects.Video vid in Model.VideoList){%> <div class="videoBox"> <%= Html.Encode(vid.Name) %> <img src="<%= vid.ThumbnailImage %>" /> </div> <%} %> </asp:Content> //ListVideosViewModel public class ListVideosViewModel { public IList<Video> VideoList { get; set; } } //Video public class Video { public long VideoId { get; set; } public long TeamId { get; set; } public string Name { get; set; } public string Tags { get; set; } public string TeamMembers { get; set; } public string TranscriptFileName { get; set; } public string VideoFileName { get; set; } public int TotalNumRatings { get; set; } public int CumulativeTotalScore { get; set; } public string VideoUri { get; set; } public Image ThumbnailImage { get; set; } } I am getting the "red x" that I usually associate with image file not found. I have verified that my database table shows after the stored proc that uploads the image executes. Any insight or advice would be greatly appreciated.

    Read the article

  • Returned JSON from Twitter and displaying tweets using FlexSlider

    - by Trey Copeland
    After sending a request to the Twitter API using geocode, I'm getting back a json response with a list of tweets. I then that into a php array using json_decode() and use a foreach loop to output what I need. I'm using flex slider to show the tweets in a vertical fashion after wrapping them in a list. So what I want is for it to only show 10 tweets at a time and scroll through them infinitely like an escalator. Here's my loop to output the tweets: foreach ($tweets["results"] as $result) { $str = preg_replace('/[^\00-\255]+/u', '', $result["text"]); echo '<ul class="slides">'; echo '<li><a href="http://twitter.com/' . $result["from_user"] . '"><img src=' . $result["profile_image_url"] . '></a>' . $str . '</li><br /><br />'; echo '</ul>'; } My jQuery looks like this as of right now as I'm trying to play around with things: $(window).load(function() { $('.flexslider').flexslider({ slideDirection: "vertical", start: function(slider) { //$('.flexslider .slides > li gt(10)').hide(); }, after: function(slider) { // current.sl } }); }); Non-Working demo here - http://macklabmedia.com/tweet/

    Read the article

  • When is ¦ not equal to ¦?

    - by Trey Jackson
    Background. I'm working with netlists, and in general, people specify different hierarchies by using /. However, it's not illegal to actually use a / as a part of an instance name. For example, X1/X2/X3/X4 might refer to instance X4 inside another instance named X1/X2/X3. Or it might refer an instance named X3/X4 inside an instance named X2 inside an instance named X1. Got it? There's really no "regular" character that cannot be used as a part of an instance name, so you resort to a non-printable one, or ... perhaps one outside of the standard 0..127 ASCII chars. I thought I'd try (decimal) 166, because for me it shows up as the pipe: ¦. So... I've got some C++ code which constructs the path name using ¦ as the hierarchical separator, so the path above looks like X1¦X2/X3¦X4. Now the GUI is written in Tcl/Tk, and to properly translate this into human readable terms I need to do something like the following: set path [getPathFromC++] ;# returns X1¦X2/X3¦X4 set humanreadable [join [split $path ¦] /] Basically, replace the ¦ with / (I could also accomplish this with [string map]). Now, the problem is, the ¦ in the string I get from C++ doesn't match the ¦ I can create in Tcl. i.e. This fails: set path [getPathFromC++] ;# returns X1¦X2/X3¦X4 string match $path [format X1%cX2/X3%cX4 166 166] Visually, the two strings look identical, but string match fails. I even tried using scan to see if I'd mixed up the bit values. But set path [getPathFromC++] ;# returns X1¦X2/X3¦X4 set path2 [format X1%cX2/X3%cX4 166 166] for {set i 0} {$i < [string length $path]} {incr i} { set p [string range $path $i $i] set p2 [string range $path2 $i $i] scan %c $p c scan %c $p2 c2 puts [list $p $c :::: $p2 $c2 equal? [string equal $c $c2]] } Produces output which looks like everything should match, except the [string equal] fails for the ¦ characters with a print line: ¦ 166 :::: ¦ 166 equal? 0 For what it's worth, the character in C++ is defined as: const char SEPARATOR = 166; Any ideas why a character outside the regular ASCII range would fail like this? When I changed the separator to (decimal) 28 (^\), things worked fine. I just don't want to get bit by a similar problem on a different platform. (I'm currently using Redhat Linux).

    Read the article

  • Lua Programming for PSP: Sending a string, then spliting that string

    - by Trey Andrews
    How do I send a string between 2 PSPs? Here is a test script: Script A Adhoc.init() Adhoc.connect() data1 = "Trey777" data2 = "This is a test!!..." Outdata = "Name"..data1.."text"..data2 function senddata() Adhoc.send(Outdata) end While true do screen.waitVblankStart() screen:flip() end Script B red = Color.new(255,0,0) Adhoc.init() Adhoc.connect() function recevmsg() data = Adhoc.recv() ----What do I here to split the text? ----print name to line '0,10' ----print text to line'0,20' end While true do screen.waitVblankStart() screen:flip() end Each script will be loaded onto a different PSP. One will send and one will receive. I need to know how does it split a string? string.find and sub return numbers, not text

    Read the article

  • Asp.net mvc retriev images from db and display on Page

    - by Trey Carroll
    //Inherits="System.Web.Mvc.ViewPage<FilmFestWeb.Models.ListVideosViewModel>" <h2>ListVideos</h2> <% foreach(BusinessObjects.Video vid in Model.VideoList){%> <div class="videoBox"> <%= Html.Encode(vid.Name) %> <img src="<% vid.ThumbnailImage; %>" /> </div> <%} %> //ListVideosViewModel public class ListVideosViewModel { public IList<Video> VideoList { get; set; } } //Video public class Video { public long VideoId { get; set; } public long TeamId { get; set; } public string Name { get; set; } public string Tags { get; set; } public string TeamMembers { get; set; } public string TranscriptFileName { get; set; } public string VideoFileName { get; set; } public int TotalNumRatings { get; set; } public int CumulativeTotalScore { get; set; } public string VideoUri { get; set; } public Image ThumbnailImage { get; set; } } I am getting the "red x" that I usually associate with image file not found. I have verified that my database table shows <binary data> after the stored proc that uploads the image executes. Any insight or advice would be greatly appreciated.

    Read the article

1 2  | Next Page >