Search Results

Search found 344 results on 14 pages for 'ethan hunt'.

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

  • CSS Margins Increase with H1 Length

    - by Ethan Turkeltaub
    Consider the following markup: <!DOCTYPE html> <html> <head> <title>Test Page</title> <link href="screen.css" rel="stylesheet" /> </head> <body> <h1>Test</h1> <h3>Description</h3> </body> </html> And the CSS: h3{ margin-top: -25px; } Now, I want the H3 to have a margin-left of however long H1 is, and it is consistently 20px away. So, if I have a H1 block of 200px long, then H3 would have a margin-left of 220px, and so on and so forth. How would I do this?

    Read the article

  • Create Jinja2 macros that put content in separate places

    - by Brian M. Hunt
    I want to create a table of contents and endnotes in a Jinja2 template. How can one accomplish these tasks? For example, I want to have a template as follows: {% block toc %} {# ... the ToC goes here ... #} {% endblock %} {% include "some other file with content.jnj" %} {% block endnotes %} {# ... the endnotes go here ... #} {% endblock %} Where the some other file with content.jnj has content like this: {% section "One" %} Title information for Section One (may be quite long); goes in Table of Contents ... Content of section One {% section "Two" %} Title information of Section Two (also may be quite long) <a href="#" id="en1">EndNote 1</a> <script type="text/javsacript">...(may be reasonably long) </script> {# ... Everything up to here is included in the EndNote #} Where I say "may be quite/reasonably long" I mean to say that it can't reasonably be put into quotes as an argument to a macro or global function. I'm wondering if there's a pattern for this that may accommodate this, within the framework of Jinja2. My initial thought is to create an extension, so that one can have a block for sections and end-notes, like-so: {% section "One" %} Title information goes here. {% endsection %} {% endnote "one" %} <a href="#">...</a> <script> ... </script> {% endendnote %} Then have global functions (that pass in the Jinja2 Environment): {{ table_of_contents() }} {% include ... %} {{ endnotes() }} However, while this will work for endnotes, I'd presume it requires a second pass by something for the table of contents. Thank you for reading. I'd be much obliged for your thoughts and input. Brian

    Read the article

  • How can I modify/merge Jinja2 dictionaries?

    - by Brian M. Hunt
    I have a Jinja2 dictionary and I want a single expression that modifies it - either by changing its content, or merging with another dictionary. >>> import jinja2 >>> e = jinja2.Environment() Modify a dict: Fails. >>> e.from_string("{{ x[4]=5 }}").render({'x':{1:2,2:3}}) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "jinja2/environment.py", line 743, in from_string return cls.from_code(self, self.compile(source), globals, None) File "jinja2/environment.py", line 469, in compile self.handle_exception(exc_info, source_hint=source) File "<unknown>", line 1, in template jinja2.exceptions.TemplateSyntaxError: expected token 'end of print statement', got '=' Two-stage update: Prints superfluous "None". >>> e.from_string("{{ x.update({4:5}) }} {{ x }}").render({'x':{1:2,2:3}}) u'None {1: 2, 2: 3, 4: 5}' >>> e.from_string("{{ dict(x.items()+ {3:4}.items()) }}").render({'x':{1:2,2:3}}) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "jinja2/environment.py", line 868, in render return self.environment.handle_exception(exc_info, True) File "<template>", line 1, in top-level template code TypeError: <lambda>() takes exactly 0 arguments (1 given) Use dict(x,**y): Fails. >>> e.from_string("{{ dict((3,4), **x) }}").render({'x':{1:2,2:3}}) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "jinja2/environment.py", line 868, in render return self.environment.handle_exception(exc_info, True) File "<template>", line 1, in top-level template code TypeError: call() keywords must be strings So how does one modify the dictionary x in Jinja2 by changing an attribute or merging with another dictionary? This question is similar to: How can I merge two Python dictionaries as a single expression? -- insofar as Jinja2 and Python are analogous.

    Read the article

  • Unusual request URL in ASP.NET health monitoring event

    - by Troy Hunt
    I’m seeing a rather strange occurrence in the request information section of an ASP.NET health monitoring email I hope someone can shed some light on. This is a publicly facing website which runs on infrastructure at an Indian hosting provider. Health monitoring is notifying us of server errors via automated email but every now and then the requested URL appears as a totally different website. For example: Request information: Request URL: http://www.baidu.com/Default.aspx Request path: /Default.aspx User host address: 221.13.128.175 User: Is authenticated: False Authentication Type: Thread account name: NT AUTHORITY\NETWORK SERVICE Obviously the site in question is not Baidu and obviously this attribute is not the referrer either; the “Request URL” value is the path which has generated the error. The IP address is located in Beijing (coincidental given the Baidu address?) and in this instance it looks like the SQL server backend was not accessible (I haven't included the entire error message for security's sake). What would cause the request URL attribute to be arbitrarily changed to that of another site? I’ve never seen this occur in a health monitoring event before. Thanks!

    Read the article

  • Insert unicode strings into CleverCSS

    - by Brian M. Hunt
    How can one insert a Unicode string CSS into CleverCSS? In particular, how could one produce the following CSS using CleverCSS: li:after { content: "\00BB \0020"; } I've figured out CleverCSS's parsing rules, but suffice that the permutations I've thought sensible have failed, for example: li: content: "\\00BB \\0020" // becomes content: 'BB 0' EDIT: My other examples and the rest of my post weren't saved. Suffice that I had a longer list of examples that also failed, as did my closing which was something like: I'd be grateful for any thoughts and input. Brian

    Read the article

  • jQuery.each for lists and non-lists

    - by Brian M. Hunt
    I've a jQuery.each(data, foo), where data is either a string or a list of strings. I'd like to know if there's an existing utility function to convert the string to a list, or otherwise perform foo on just the string. So instead of the easy route: if (!$.isArray(data)) { foo(0, data); // can't rely on `this` variable } else { $.each(data,foo); } I was just wondering if there was already a builtin function of jQuery or Javascript that would convert data to a list automatically, like this: function convert_to_list(data) { return $.isArray(data) ? data : [data]; } $.each(convert_to_list(data), foo); Just curious! Thanks for reading. Brian

    Read the article

  • Jinja2 returns "None" string for Google App Engine models

    - by Brian M. Hunt
    Google App Engine models, likeso: from google.appengine.ext.db import Model class M(): name = db.StringProperty() Then in a Jinja2 template called from a Django view with an in instance of M passed in as m: The name of this M is {{ m.name }}. When m is initialized without name being set, the following is printed: The name of this M is None. The preferable and expected output (and the output when using Django templates) would be/is: The name of this M is . Do you know why this is happening, and how to get the preferred & expected output?

    Read the article

  • Matching math expression with regular expression?

    - by Ethan
    For example, these are valid math expressions: a * b + c -a * (b / 1.50) (apple + (-0.5)) * (boy - 1) And these are invalid math expressions: --a *+ b @ 1.5.0 // two consecutive signs, two consecutive operators, invalid operator, invalid number -a * b + 1) // unmatched parentheses a) * (b + c) / (d // unmatched parentheses I have no problem with matching float numbers, but have difficulty with parentheses matching. Any idea? If there is better solution than regular expression, I'll accept as well. But regex is preferred.

    Read the article

  • Backbone.js not registering Model.hasChanged event

    - by Brian M. Hunt
    Hello, I'm trying to get a View in Backbone.js to save when there's a 'change' event if (and only if) the data has changed. Long story short, I've a 'change' event set on the View that calls this: function changed_event() { log.debug("Before: " + this.model.get('name')) // not 'contrived!' this.model.set({'name': 'contrived!'}); log.debug("After: " + this.model.get('name')) // 'contrived!' if (this.model.hasChanged()) { alert("This is never called."); } } I'd like to know why the model.hasChanged() is false when clearly the model has been changed. I'm not sure what other information is necessary, but if there is more information that may be helpful please comment and I'll elaborate. Thank you for reading.

    Read the article

  • pushing back an boost::ptr_vector<...>::iterator in another boost::ptr_vector?

    - by Ethan Nash
    Hi all, I have the following code (just typed it in here, might have typos or stuff): typedef boost::ptr_vector<SomeClass> tvec; tvec v; // ... fill v ... tvec vsnap; for(tvec::iterator it = v.begin(); it != v.end(); ++it) { if((*v).anyCondition) vsnap.push_back( it ); // (*it) or &(*it) doesn't work } My problem is now that i cant push_back an iterator in any way, I just don't get the pointer out of the iterator. Is there an easy way i didnt see, or are boosts ptr_vector the false choice for this case? Thanks in advance.

    Read the article

  • How to chroot Django

    - by Brian M. Hunt
    Can one run Django in a chroot? Notably, what's necessary in order to set up (for example) /var/www as a chroot'd directory and then have Django run in that chroot'd directory? Thank you - I'm grateful for any input.

    Read the article

  • How to configure encoding in maven

    - by Ethan Leroy
    When I run maven install on my multi module maven project I always get the following output: [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! So, I googled around a bit, but all I can find is that I have to add <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> to my pom.xml. But it's already there (in the parent pom.xml). Configuring <encoding> for the maven-resources-plugin or the maven-compiler-plugin also doesn't fix it. So what's the problem?

    Read the article

  • Is is possible to derive currency symbol from currency code?

    - by Dave Hunt
    My iPhone app formats an NSDecimalNumber as a currency using setCurrencyCode, however another screen displays just the currency symbol. Rather than storing both the currency code and symbol, is it possible to derive the symbol from the code? I thought the following might work, but it just returns the symbol as $: currencyCode = [dictPrices valueForKey:@"currencyCode"]; NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] autorelease]; [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4]; [numberFormatter setCurrencyCode:currencyCode]; [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle]; NSString *currencySymbol = [numberFormatter currencySymbol];

    Read the article

  • Does SharpSVN have an API to manage repository permissions

    - by Troy Hunt
    Does anyone know if there is any API exposed to manage repository permissions within SharpSVN? For example, programatically adding read and write permissions on a per repository basis. Alternatively, any other thoughts on managing permissions with other SVN APIs? Worst case wil be manually managing the contents of svnaccessfile but this is a last resort. Thanks.

    Read the article

  • Sinatra Variable Scope

    - by Ethan Turkeltaub
    Take the following code: ### Dependencies require 'rubygems' require 'sinatra' require 'datamapper' ### Configuration config = YAML::load(File.read('config.yml')) name = config['config']['name'] description = config['config']['description'] username = config['config']['username'] password = config['config']['password'] theme = config['config']['theme'] set :public, 'views/themes/#{theme}/static' ### Models DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/marvin.db") class Post include DataMapper::Resource property :id, Serial property :name, String property :body, Text property :created_at, DateTime property :slug, String end class Page include DataMapper::Resource property :id, Serial property :name, String property :body, Text property :slug, String end DataMapper.auto_migrate! ### Controllers get '/' do @posts = Post.get(:order => [ :id_desc ]) haml :"themes/#{theme}/index" end get '/:year/:month/:day/:slug' do year = params[:year] month = params[:month] day = params[:day] slug = params[:slug] haml :"themes/#{theme}/post.haml" end get '/:slug' do haml :"themes/#{theme}/page.haml" end get '/admin' do haml :"admin/index.haml" end I want to make name, and all those variables available to the entire script, as well as the views. I tried making them global variables, but no dice.

    Read the article

  • ETL mechanisms for MySQL to SQL Server over WAN

    - by Troy Hunt
    I’m looking for some feedback on mechanisms to batch data from MySQL Community Server 5.1.32 with an external host down to an internal SQL Server 05 Enterprise machine over VPN. The external box accumulates data throughout business hours (about 100Mb per day), which then needs to be transferred internationally across a WAN connection to an internal corporate environment before some BI work is performed. This should just be change-sets making their way down each night. I’m interested in thoughts on the ETL mechanisms people have successfully used in similar scenarios before. SSIS seems like a potential candidate; can anyone comment on the suitability for this scenario? Alternatively, other thoughts on how to do this in a cost-conscious way would be most appreciated. Thanks!

    Read the article

  • Entity Relationship Model: Ternary Relationships

    - by Ethan
    Hi, I am trying to understand why this statement in the book is wrong: "given a C entity, there is at most one related A entity and at most one related B entity". Is it that it doesn't apply to a specific kind of relationship?? So, if I have an example of a student who is in attendance to a course with a type of subject. The entities are student, attendance, course and subject. Student makes attendance in a room. Also, a student can make attendance for a subject. Does this example apply to the statement? Thanks for your time.

    Read the article

  • WCF REST Question, Binding, Configuration

    - by Ethan McGee
    I am working on a WCF rest interface using json. I have wrapped the service in a windows service to host the service but I am now having trouble getting the service to be callable. I am not sure exactly what is wrong. The basic idea is that I want to host the service on a remote server so I want the service mapped to port localhost:7600 so that it can be invoked by posting data to [server_ip]:7600. The problem is most likely in the configuration file, since I am new to WCF and Rest I wasn't really sure what to type for the configuration so sorry if it's a total mess. I removed several chunks of code and comments to make it a little easier to read. These functions should have no bearing on the service since they call only C# functions. WCF Service Code using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using System.ServiceModel.Activation; using System.ServiceModel.Web; using System.Text; namespace PCMiler_Connect { public class ZIP_List_Container { public string[] ZIP_List { get; set; } public string Optimized { get; set; } public string Calc_Type { get; set; } public string Cross_International_Borders { get; set; } public string Use_Kilometers { get; set; } public string Hazard_Level { get; set; } public string OK_To_Change_Destination { get; set; } } [ServiceContract] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] public class PCMiler_Webservice { [WebInvoke(Method = "POST", UriTemplate = "", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json), OperationContract] public List<string> Calculate_Distance(ZIP_List_Container container) { return new List<string>(){ distance.ToString(), time.ToString() }; } } } XML Config File <?xml version="1.0" encoding="utf-8"?> <configuration> <system.serviceModel> <services> <service name="PCMiler_Connect.PCMiler_Webservice"> <endpoint address="" behaviorConfiguration="jsonBehavior" binding="webHttpBinding" bindingConfiguration="" contract="PCMiler_Connect.PCMiler_Webservice" /> <host> <baseAddresses> <add baseAddress="http://localhost:7600/" /> </baseAddresses> </host> </service> </services> <behaviors> <endpointBehaviors> <behavior name="jsonBehavior"> <enableWebScript/> </behavior> </endpointBehaviors> </behaviors> </system.serviceModel> </configuration> Service Wrapper using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Linq; using System.ServiceProcess; using System.ServiceModel; using System.Text; using System.Threading; namespace PCMiler_WIN_Service { public partial class Service1 : ServiceBase { ServiceHost host; public Service1() { InitializeComponent(); } protected override void OnStart(string[] args) { host = new ServiceHost(typeof(PCMiler_Connect.PCMiler_Webservice)); Thread thread = new Thread(new ThreadStart(host.Open)); } protected override void OnStop() { if (host != null) { host.Close(); host = null; } } } }

    Read the article

  • jQuery - change a list of elements to an associative array

    - by Brian M. Hunt
    Given an associative array (of the sort returned by jQuery.serializeArray()) like this: [ { 'name': 'abc', 'value': 'aaa', '__proto__': [Object] }, { 'name': 'def', 'value': 'bbb', '__proto__': [Object] }, { 'name': 'abc', 'value': 'ccc', '__proto__': [Object] } ] How can one convert this, using either jQuery or just javascript, to an associative array of name: [values] like this: { 'abc': ['aaa', 'ccc'], 'def': ['bbb'] } This seems to essentially be the inverse of this question: Build associative array based on values of another associative array... but in Javascript (not PHP). I wasn't able to find this question on Stackoverflow, though I thought it would have been asked. Thank you for reading. Brian

    Read the article

  • Learning Ruby on Rails

    - by Ethan Gunderson
    As it stands now I'm a Java and C# developer, but the more and more I look at Ruby on Rails, the more I really want to learn it. What have you found to be the best route to learn RoR? Would it be easier to develop on Windows, or should I just run a virtual machine with linux? Is there an ide that can match the robustness of Visual Studio? Any programs to develop that give a good overhead of what to do? Any good books? Seriously, any tips/tricks/rants would be awesome.

    Read the article

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