Daily Archives

Articles indexed Friday March 12 2010

Page 23/130 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Add Keyboard Binding To Existing Emacs Mode

    - by Sean M
    I'm attempting my first modification of emacs. I recorded a little keyboard macro and had emacs spit it out as elisp, resulting in: (setq add-docstring "\C-rdef\C-n\C-a\C-m\C-p\C-i\C-u6\"\C-u3\C-b") (global-set-key "\C-c\C-d" 'add-docstring) Searching the emacs reference, though, revealed that C-c C-d is already bound in diff mode. I don't plan on using diff mode, but the future is unknowable and I'd like to not lay a trap for myself. So I'd like this keybinding to only operate in python mode, where it tries to help me add docstrings. In my /usr/share/emacs/23.whatever/list/progmodes, I found python.elc and python.el.gz. I unzipped python.el.gz and got a readable version of the elisp file. Now, though, the documentation becomes opaque to me. How can I add my key binding to the python mode, instead of globally? Is it possible, for bonus points, to apply the changes to python mode without restarting emacs or closing open files? It's the self-modifying editor, I figure there's a good chance that it's possible.

    Read the article

  • PHP getimagesize with ampersand in string creates errors

    - by RobHardgood
    I'm using the getimagesize function in PHP, and the path string contains an ampersand, which otherwise is fine. The page gives me errors where getimagesize() is called. Looking at the source code, though, I see the ampersand is being passed through as & rather than just & I presume this is causing errors because PHP doesn't need to convert it to the html tag in order to find the path, right? Here is the error: Warning: getimagesize(image.php?name=username&pic=picture) [function.getimagesize]: failed to open stream: No such file or directory

    Read the article

  • Is it possible to dynamically set a static string during compile?

    - by LonnieBest
    I'm trying to dynamically create a connection string during compile time: public static string ConnectionString { get { string connectionString = @"Data Source=" + myLibrary.common.GetExeDir() + @"\Database\db.sdf;"; return connectionString; } } I keep running into type initialisation errors. I was trying to avoid having to set the connection string for all applications that user my code library. The location of the database is different for each project that uses the library. I have code that can determine the correction string, but was wanting run it during compile time. Is this even possible?

    Read the article

  • Django - transactions in the model?

    - by orokusaki
    Models (disregard typos / minor syntax issues. It's just pseudo-code): class SecretModel(models.Model): some_unique_field = models.CharField(max_length=25, unique=True) # Notice this is unique. class MyModel(models.Model): secret_model = models.OneToOneField(SecretModel, editable=False) # Not in the form spam = models.CharField(max_length=15) foo = models.IntegerField() def clean(self): SecretModel.objects.create(some_unique_field=self.spam) Now if I go do this: MyModel.objects.create(spam='john', foo='OOPS') # Obviously foo won't take "OOPS" as it's an IntegerField. #.... ERROR HERE MyModel.objects.create(spam='john', foo=5) # So I try again here. #... IntegrityError because SecretModel with some_unique_field = 'john' already exists. I understand that I could put this into a view with a request transaction around it, but I want this to work in the Admin, and via an API, etc. Not just with forms, or views. How is it possible?

    Read the article

  • Problem installing wordpress child themes.

    - by Jay
    Hi, I've tried to install either the Fusion or Thematic child themes for my blog. My Wordpress directory is located at myblog/wordpress while my domain is just myblog (example). Everything works fine with both basic themes or the parent Fusion or Thematic themes. When I install a child theme for either framework, I can view the preview and select 'activate.' However, after that my entire site crashes. I can't even view the wordpress admin panel. I've had to restore my database from my hosting provider just to get my blog working. All that I'm able to see is my favicon icon and a blank page. I've tried to deactivate all plugins and this doesn't help either. I really want to use the Hybrid News child template. Any thoughts on what might be happening? thanks so much!

    Read the article

  • Is it possible to dynamically set a static string during *class* Initialisation?

    - by LonnieBest
    I'm trying to dynamically create a connection string during compile time: public static string ConnectionString { get { string connectionString = @"Data Source=" + myLibrary.common.GetExeDir() + @"\Database\db.sdf;"; return connectionString; } } I keep running into type initialisation errors. I was trying to avoid having to set the connection string for all applications that user my code library. The location of the database is different for each project that uses the library. I have code that can determine the correction string, but was wanting run it during compile time. Is this even possible?

    Read the article

  • SVN: Recurisvely add files?

    - by Mark
    I'm trying svn add *.py --force As the documentation suggests, but I know for a fact it's missing files nested in deeper folders. Why? Is there a standard way to do this with other unix commands too? */*.py will nab a few more files, but it's kind of a pain in the butt to do this for every possible depth.

    Read the article

  • Unexpected answer

    - by Sandeep
    #include<stdio.h> int main() { printf("He %c llo",65); } Output: A #include<stdio.h> int main() { printf("He %c llo",13); } Output: llo I can understand that 65 is ascii value for A and hence A is printed in first case but why llo in second case. Thanks

    Read the article

  • Problem with makefile

    - by sterh
    Hello. I created a python project in IDE Anjuta, added some python files and the problem follows. I need that would make the program after a few .py files lying in src copied to dir /usr/bin. Anjuta generates enormous configure- and makefiles. 'll Show you need to register and where that would make described above. Thank you.

    Read the article

  • How do I ensure that a regex does not match an empty string?

    - by Dancrumb
    I'm using the Jison parser generator for Javascript and am having problems with my language specification. The program I'm writing will be a calculator that can handle feet, inches and sixteenths. In order to do this, I have the following specification: %% ([0-9]+\s*"'")?\s*([0-9]+\s*"\"")?\s*([0-9]+\s*"s")? {return 'FIS';} [0-9]+("."[0-9]+)?\b {return 'NUMBER';} \s+ {/* skip whitespace */} "*" {return '*';} "/" {return '/';} "-" {return '-';} "+" {return '+';} "(" {return '(';} ")" {return ')';} <<EOF>> {return 'EOF';} Most of these lines come from a basic calculator specification. I simply added the first line. The regex correctly matches feet, inch, sixteenths, such as 6'4" (six feet, 4 inches) or 4"5s (4 inches, 5 sixteenths) with any kind of whitespace between the numbers and indicators. The problem is that the regex also matches a null string. As a result, the lexical analysis always records a FIS at the start of the line and then the parsing fails. Here is my question: is there a way to modify this regex to guarantee that it will only match a non-zero length string?

    Read the article

  • Subversion version 'difference' a big deal?

    - by CmdrTallen
    Greetings, using VS2008 and VisualSVN and seems the VisualSVN folks are religious about updating the client (and their VisualSVN server) to the latest Subversion release. My question is my subversion server is a hosted server and seems to always lag several versions behind the client I use. Should I be concerned about this version "mis-match"? Is there a general rule of thumb about when it is a point to be concerned (like an entire major release behind)? Any sort of mechanism build into either the client, the server or the protocol that prevents something horrible from happening between badly 'paired' clients and servers?

    Read the article

  • Is this a good way to manage initializations of COM?

    - by BillyONeal
    Hello everyone :) I'm very new to anything involving Component Object Model, and I'm wondering if this method of managing calls to CoInitalize/CoUninitalize makes sense: COM.hpp: #pragma once namespace WindowsAPI { namespace ComponentObjectModel { class COM { COM(); ~COM(); public: static void Setup(); }; }} COM.cpp: #include <Windows.h> #include "COM.hpp" namespace WindowsAPI { namespace ComponentObjectModel { COM::COM() { if (CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) != S_OK) throw std::runtime_error("Couldn't start COM!"); } COM::~COM() { CoUninitialize(); } void COM::Setup() { static COM instance; } }} Then any component that needs COM just calls COM::Setup() and forgets about it. Does this make sense or am I breaking any "rules" of COM?

    Read the article

  • How can Perl interact with an ajax form

    - by Jeff
    I'm writing a perl program that was doing a simple get command to retrieve results and process them. But the site has been updated and now has a java component that handles the results (so the actual data is not in the source code anymore). This is the site: http://wro.westchesterclerk.com/legalsearch.aspx Try putting in: Index Number: 11103 Year: 2009 I want to be able to pro grammatically enter the "index number" and "year" at the bottom of the form where it says "search by number" and then retrieve the results listed next to it. I've written many programs in Perl that simply pass variables via the URL and the results are listed in the source code, so it's easy to parse. (Using LWP:Simple) Like: $html = get("http://www.url.com?id=$somenum&year=$someyear") But this is totally new to me and I don't know where to begin. I'm somewhat familiar with LWP:UserAgent and Mechanize. I'd really appreciate any help. Thanks!

    Read the article

  • php custom forum error

    - by phillip morris
    i have a form, and i want to have it be limited at 10 characters minimum. that is no problem, but what i want to do is echo the error at the top of the page, which is being included, so i cant just do: echo '<div class="error">Error</div>'; i want to have a designated div that is empty (will be on the included header page), but when there is an error it gets filled with the error text to output. anyone know how to do this not using sessions or cookies?

    Read the article

  • xPath Groupings how?

    - by David
    OK So, I'm learning/using xpath for a basic application thats effectively ripping data off another website. I need to gain the knowledge of each persons Countryy/Suburb/area. In some instances you can get Australia/Victoria/melborne for instance. Others may just be Australia/Melbourne. Or even just Melbourne OR just AUSTRALIA. who knows. So I'm current able to view the below code and rip all of the information with the string xpath search:@" //table/tr/td/tabke/tr/td/font/a, this returns every entry, but what I really want is to group each lot separately. I hope someone out there on planet earth knows what I just tried to explain... and can help... Good day! <font face="arial" size="2"> <strong>Location:</strong> <a href="http://maps.google.com/maps?q=Australia" target="mapblast" style="text-decoration:none">Australia</a>, <a href='http://maps.google.com/maps?q=Australia%20Victoria'target="mapblast" style='text-decoration:none'>Victoria</a>, <a href='http://maps.google.com/maps?q=Australia%20Melbourne%20Victoria'target="mapblast" style='text-decoration:none'>Melbourne</a> </font> </td> </tr>

    Read the article

  • Are multiple asserts bad in a unit test? Even if chaining?

    - by Michael Haren
    Is there anything wrong with checking so many things in this unit test?: ActualModel = ActualResult.AssertViewRendered() // check 1 .ForView("Index") // check 2 .WithViewData<List<Page>>(); // check 3 CollectionAssert.AreEqual(Expected, ActualModel); // check 4 The primary goals of this test are to verify the right view is returned (check 2) and it contains the right data (check 4). Would I gain anything by splitting this into multiple tests? I'm all about doing things right, but I'm not going to split things up if it doesn't have practical value. I'm pretty new to unit testing, so be gentle.

    Read the article

  • Why enabling transparency can lead to clipping problems ?

    - by Amokrane
    Hi, I'm working on a 3D graphical application in Java using the Java 3D API. I noticed that every time I was dealing with transparency, all I got in return were some clipping problems. Some parts of the scene weren't displayed properly. It might seem obvious that this would happen in a certain way but I'm looking for a logical explanation, why is this happening? Thank you

    Read the article

  • Json HTTP Module stream issue

    - by Justin
    Hey, I have an HTTP Module that I use to clean up the JSON returned by my web service (see http://www.codeproject.com/KB/webservices/ASPNET_JSONP.aspx?msg=3400287#xx3400287xx for an example of this.) Basically it relates to calling cross-domain JSON web services from javascript. There is this JsonHttpModule which uses a JsonResponseFilter Stream class to write out the JSON and the overloaded Write method is supposed to wrap the name of the callback function around the JSON, otherwise the JSON errors out as needing a label. However, if the JSON is really long, the Write method in the Stream class is called multiple times, causing the callback function to incorrectly get inserted midway through the JSON. Is there a way in the Stream class to wrap the callback function around the stream at the end or to specify that it write all of the JSON in 1 Write method instead of in chunks?? Here's where it calls the JsonResponseFilter in the JsonHttpModule: public void OnReleaseRequestState(object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; if (!_Apply(app.Context.Request)) return; // apply response filter to conform to JSONP app.Context.Response.Filter = new JsonResponseFilter(app.Context.Response.Filter, app.Context); } Here's the Write method in the JsonResponseFilter Stream class that gets called multiple times: public override void Write(byte[] buffer, int offset, int count) { var b1 = Encoding.UTF8.GetBytes(_context.Request.Params["callback"] + "("); _responseStream.Write(b1, 0, b1.Length); _responseStream.Write(buffer, offset, count); var b2 = Encoding.UTF8.GetBytes(");"); _responseStream.Write(b2, 0, b2.Length); } Thanks for any help! Justin

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >