Search Results

Search found 1864 results on 75 pages for 'optional'.

Page 38/75 | < Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >

  • how to write re-usable views in django?

    - by rz
    These are the techniques that I use regularly to make my views reusable: take the template_name as an argument with a default take an optional extra_context which defaults to empty {} right before the template is rendered the context is updated with the extra_context for further re-usability, call any callable in extra_context.values() whenever the view deals with a queryset, there is a queryset argument with a default whenever the view needs a particular object from the ORM, it attempts to fetch it using any "id" parameter in several ways (e.g. as a slug, as a database id) (this may be a bad practice...) First, Should I add anything to my list? Should I remove anything from my list? The items accommodates a large number of cases. However, whenever an app extends a model of another in some way (e.g. adding a field or changing the behavior in some way) I end up writing my own views and only reusing the model. Is this normal?

    Read the article

  • hibernate update JPA foregin key

    - by cometta
    my jpa look like below public class TESTClass implements Serializable { ... private String name; @EmbeddedId protected IssTESTPK issTESTPK; @JoinColumns({@JoinColumn(name = "DIVISION_CODE", referencedColumnName = "DIVISION_CODE", nullable = false , insertable = false, updatable = false), @JoinColumn(name = "SURVEY_NUM", referencedColumnName = "SURVEY_NUM", nullable = false, insertable = false, updatable = false)}) @ManyToOne(optional = false) private IssDivision issDivision; } if i make change to 'name' and call merge, it able to update into database, but when i change issDivision, and call merge, it doesnt update database. how to solve this? does it related to because i'm using embededId (composite primary keys) ?

    Read the article

  • App submitted to Amazon AppStore is both "Status: Incomplete" and "Cannot edit application while in review"

    - by Nicolas Raoul
    Yesterday I submitted my application to the Amazon AppStore. I did not upload a video, because I haven't made one and it seemed optional, because I was able to submit the app without one. Today I checked the app's status, it says "Status: Incomplete (Missing Multimedia)" with a link to the multimedia section whose video field says "Video < none uploaded ". So I made a video, but I can not add it because it says "Cannot edit application while in review." I used the "Feeback" link to send a message to Amazon, I might even get a reply, but do anyone already know a solution to this problem?

    Read the article

  • Basics for implementing SSL on PHP Website

    - by KoolKabin
    Hi guys, I am here as a developer of a website. My website got different modules among which one function is to process credit card. In order to process credit card I need to implement SSL layer and process the pages. For rest of modules the SSL is optional. Now my points are: 1.) Is the location of file for http and https same? 2.) Can the session of http and https be shared? this is required as i need user login information and cart item information.

    Read the article

  • Zend Framework Zend_Form Decorators: <span> Inside Button Element?

    - by leek
    I have a button element that I've created like so: $submit = new Zend_Form_Element_Button('submit'); $submit->setLabel('My Button'); $submit->setDecorators(array( 'ViewHelper', array('HtmlTag', array('tag' => 'li')) )); $submit->setAttrib('type', 'submit'); This generates the following HTML: <li> <label for="submit" class="optional">My Button</label> <button name="submit" id="submit" type="submit">My Button</button> </li> I would like to wrap the inside of the button with a <span, like this: <button...><span>My Button</span></button> What is the best way to do this using Zend_Form?

    Read the article

  • Using XPath to access comments a flat hierachy

    - by Sebastian
    I have a given XML document (structure can not be changed) and want to get the comments that are written above the nodes. The document looks like this: <!--Some comment here--> <attribute name="Title">Book A</attribute> <attribute name="Author"> <value>Joe Doe</value> <value>John Miller</value> </attribute> <!--Some comment here--> <attribute name="Code">1</attribute> So comments are optional, but if there is one, I want to get the comment above each attribute. Using /*/comment()[n] would give me comment n, but for n=2 I would naturally get the comment of the third attribute, so there is no connection between attributes and comments Any ideas? Thanks

    Read the article

  • Regex: Matching a space-joined list of words, excluding last whitespace

    - by Jesper
    How would I match a space separated list of words followed by whitespace and some optional numbers? I have this: >>> import re >>> m = re.match('(?P<words>(\w+\s+)+)(?P<num>\d+)?\r\n', 'Foo Bar 12345\r\n') >>> m.groupdict() {'num': '12345', 'words': 'Foo Bar '} I'd like the words group to not include the last whitespace(s) but I can't figure this one out. I could do a .strip() on the result but that's not as much fun :) Some strings to test and wanted result: 'Foo & Bar 555\r\n' => {'num': '555', 'words': 'Foo & Bar'} 'Hello World\r\n' => {'num': None, 'words': 'Hello World'} 'Spam 99\r\n' => {'num': 99, 'words': 'Spam'} 'Number 1 666\r\n' => {'num': 666, 'words': 'Number 1'}

    Read the article

  • asp.net mvc routing id parameter

    - by parminder
    Hi Experts, I am working on a website in asp.net mvc. I have a route routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); which is the default route. Now I have method public ActionResult ErrorPage(int errorno) { return View(); } now if i want to run this code with http://something/mycontroller/Errorpage/1 it doesnt work. but if i change the parameter name to id from errorno it works. Is it cumpulsory to have same parameter name for this method. Or I need to create seperate routes for such situations. Regards Parminder

    Read the article

  • JPA optimistic lock - setting @Version to entity class cause query to include VERSION as column

    - by masato-san
    I'm using JPA Toplink Essential, Netbean6.8, GlassFish v3 In my Entity class I added @Version annotation to enable optimistic locking at transaction commit however after I added the annotation, my query started including VERSION as column thus throwing SQL exception. None of this is mentioned in any tutorial I've seen so far. What could be wrong? Snippet public class MasatosanTest2 implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @Column(name = "id") private Integer id; @Column(name = "username") private String username; @Column(name = "note") private String note; //here adding Version @Version int version; query used: SELECT m FROM MasatosanTest2 m Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException Call: SELECT id, username, note, VERSION FROM MasatosanTest2

    Read the article

  • iPhone Text entry with completion and DONE button (not search)

    - by Adam Jack
    Using iPhone SDK 3.0, I wish to allow text entry with (optional) completion options that appear as typing is occurring, i.e. also allowing freeformat entry. As such I am using a UISearchBar (which has the text change events) and a UISearchDisplayController to present options. The problems is I want the DONE button to say DONE and not SEARCH, however I cannot find a way to set that. Clearly I feel I am missing something, or Interface Builder of the SDK API would have some property to set. I have seen other apps (in the store) that have achieved the result I want (free format entry, completion, DONE button) so maybe there is an alternative approach I am missing. Thanks in advance for any pointers.

    Read the article

  • Extending Django-tagging, adding extra field to each tag?

    - by victorhooi
    heya, We're coding together a Django app to handle reviews of newspaper articles. Each newspaper article model will an arbitrary number of tags associated with it. Also, each tag will have an optional ranking (0 to 10). I was thinking of using django-tagging to do this (http://code.google.com/p/django-tagging/), but I'm not sure of the best way to add the ranking to the system. Should I extend django-tagging somehow? (Not sure if this is possible, without changing django-tagging's actual code?). Or is there a better way of achieving this? Cheers, Victor

    Read the article

  • upload image during registration in asp.net

    - by Vikrant
    I am developing a student registration form in asp.net. there are two tables viz std_registration and gallery(having pic_id and pic_url). During registration, before the click of submit button i want to retrieve pic_id from gallery table and then pass it to the insert query of registration table. image upload is an optional part. if no image is uploaded i want a default image to get uploaded. pls help me on this. thanx.

    Read the article

  • Regular Expressions, Checking for a range of occurrences

    - by gmcalab
    I have a phone number I want to match against a regular expression. The format of the phone number must match this: (123) 123-4567 x12345 The extension is optional. Also the extension must contain 1-5 numbers. Below is a regular expression I wrote that works. ^\(\d{3}\) \d{3}-\d{4}( x\d\d?\d?\d?\d?)?$ I was wondering if there is a better way to check for the extension instead of x\d\d?\d?\d?\d? Can I say 1-5 occurrences of \d instead of the above some how ?

    Read the article

  • A tool to find and fix incomplete source code documentation

    - by Pekka
    I have several finished, older PHP projects with a lot of includes that I would like to document in javadoc/phpDocumentor style. While working through each file manually and being forced to do a code review alongside the documenting would be the best thing, I am, simply out of time constraints, interested in tools to help me automate the task as much as possible. The tool I am thinking about would ideally have the following features: Parse a PHP project tree and tell me where there are undocumented files, classes, and functions/methods (i.e. elements missing the appropriate docblock comment) Provide a method to half-way easily add the missing docblocks by creating the empty structures and, ideally, opening the file in an editor (internal or external I don't care) so I can put in the description. Optional: Automatic recognition of parameter types, return values and such. But that's not really required. The language in question is PHP, though I could imagine that a C/Java tool might be able to handle PHP files after some tweaking. Thanks for your great input!

    Read the article

  • boost::Spirit Grammar for unsorted schema

    - by Hassan Syed
    I have a section of a schema for a model that I need to parse. Lets say it looks like the following. { type = "Standard"; hostname="x.y.z"; port="123"; } The properties are: The elements may appear unordered. All elements that are part of the schema must appear, and no other. All of the elements' synthesised attributes go into a struct. (optional) The schema might in the future depend on the type field -- i.e., different fields based on type -- however I am not concerned about this at the moment.

    Read the article

  • ASP.Net MVC 404 errors when route contains an .svc extension

    - by Kragen
    I have an ASP.Net MVC 2 site set up under IIS7 using the integrated pipeline with the following route: routes.MapRoute( "MyRoute", "mycontroller/{name}/{*path}", new { controller = "MyController", action = "Index", path = UrlParameter.Optional } ); There are no other routes above this route, but whenever I try and access the above route with a path value that has an .svc extension, for example: http://localhost/MyVirtualDirectory/mycontroller/test/somepath.svc ASP.Net returns a 404 error without executing my controller (I have a log message call at the start of the action method). If I change the extension to something benign (like .txt) it works perfectly, so seems that somewhere along the line ASP.Net is interpreting the request as a standard ASP.Net call to a web service that doesn't exist - this is definitely an ASP.Net 404 response (not an IIS response). What could be causing this, and how do I stop it from happening?

    Read the article

  • ZIPLIB problem on opening zip files

    - by Ahmet vardar
    I am using this class to create zip <?php // vim: expandtab sw=4 ts=4 sts=4: class zipfile { var $datasec = array(); var $ctrl_dir = array(); var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; var $old_offset = 0; function unix2DosTime($unixtime = 0) { $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime); if ($timearray['year'] < 1980) { $timearray['year'] = 1980; $timearray['mon'] = 1; $timearray['mday'] = 1; $timearray['hours'] = 0; $timearray['minutes'] = 0; $timearray['seconds'] = 0; } // end if return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1); } // end of the 'unix2DosTime()' method function addFile($data, $name, $time = 0) { $name = str_replace('\\', '/', $name); $dtime = dechex($this->unix2DosTime($time)); $hexdtime = '\x' . $dtime[6] . $dtime[7] . '\x' . $dtime[4] . $dtime[5] . '\x' . $dtime[2] . $dtime[3] . '\x' . $dtime[0] . $dtime[1]; eval('$hexdtime = "' . $hexdtime . '";'); $fr = "\x50\x4b\x03\x04"; $fr .= "\x14\x00"; // ver needed to extract $fr .= "\x00\x00"; // gen purpose bit flag $fr .= "\x08\x00"; // compression method $fr .= $hexdtime; // last mod time and date // "local file header" segment $unc_len = strlen($data); $crc = crc32($data); $zdata = gzcompress($data); $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug $c_len = strlen($zdata); $fr .= pack('V', $crc); // crc32 $fr .= pack('V', $c_len); // compressed filesize $fr .= pack('V', $unc_len); // uncompressed filesize $fr .= pack('v', strlen($name)); // length of filename $fr .= pack('v', 0); // extra field length $fr .= $name; // "file data" segment $fr .= $zdata; // "data descriptor" segment (optional but necessary if archive is not // served as file) $fr .= pack('V', $crc); // crc32 $fr .= pack('V', $c_len); // compressed filesize $fr .= pack('V', $unc_len); // uncompressed filesize // add this entry to array $this -> datasec[] = $fr; // now add to central directory record $cdrec = "\x50\x4b\x01\x02"; $cdrec .= "\x00\x00"; // version made by $cdrec .= "\x14\x00"; // version needed to extract $cdrec .= "\x00\x00"; // gen purpose bit flag $cdrec .= "\x08\x00"; // compression method $cdrec .= $hexdtime; // last mod time & date $cdrec .= pack('V', $crc); // crc32 $cdrec .= pack('V', $c_len); // compressed filesize $cdrec .= pack('V', $unc_len); // uncompressed filesize $cdrec .= pack('v', strlen($name) ); // length of filename $cdrec .= pack('v', 0 ); // extra field length $cdrec .= pack('v', 0 ); // file comment length $cdrec .= pack('v', 0 ); // disk number start $cdrec .= pack('v', 0 ); // internal file attributes $cdrec .= pack('V', 32 ); // external file attributes - 'archive' bit set $cdrec .= pack('V', $this -> old_offset ); // relative offset of local header $this -> old_offset += strlen($fr); $cdrec .= $name; // optional extra field, file comment goes here // save to central directory $this -> ctrl_dir[] = $cdrec; } // end of the 'addFile()' method function file() { $data = implode('', $this -> datasec); $ctrldir = implode('', $this -> ctrl_dir); return $data . $ctrldir . $this -> eof_ctrl_dir . pack('v', sizeof($this -> ctrl_dir)) . // total # of entries "on this disk" pack('v', sizeof($this -> ctrl_dir)) . // total # of entries overall pack('V', strlen($ctrldir)) . // size of central dir pack('V', strlen($data)) . // offset to start of central dir "\x00\x00"; // .zip file comment length } // end of the 'file()' method function addFiles($files ) { foreach($files as $file) { if (is_file($file)) //directory check { $data = implode("",file($file)); $this->addFile($data,$file); } } } function output($file) { $fp=fopen($file,"w"); fwrite($fp,$this->file()); fclose($fp); } } // end of the 'zipfile' class ?> It creates zip file but when i try to open it on Mac os x snow leopard and windows 7, it doesnt open. on mac i had this error: Error 1: operation not permitted Any idea ? thanks

    Read the article

  • Mod rewrite with 3 parameters ?

    - by Axel
    Hello, I did tons of methods to figure out how to make this mod rewrite but i was completly unsuccessful. I want a .htaccess code that rewrite in the following method: http://www.mydomain.com/apple/upcoming/2 --- http://www.mydomain.com/handler.php?topic=apple&orderby=upcoming&page=2 This is easy to do, but the problem is that all parameters are not required so the link has different levels of parameters each time like this: http://www.mydomain.com/apple/popular/2 -- topic=apple&orderby=popular&page=2 http://www.mydomain.com/apple/2 -- topic=apple&orderby=&page=2 http://www.mydomain.com/all/popular/2 -- topic=all&orderby=popular&page=2 http://www.mydomain.com/apple/upcoming/ -- topic=apple&orderby=upcoming&page= So briefly, the url has 3 optional parameters in one static order: (topic) (orderby) (page) Note: the ORDERBY parameter can be "popular" or "upcoming" or nothing. Thanks

    Read the article

  • What is the maximum length in seconds to store a value in memcache

    - by Emilien
    The Google App Engine memcache documentation states that the time parameter of memcache.set() is an "Optional expiration time, either relative number of seconds from current time (up to 1 month), or an absolute Unix epoch time." So I tried to set a value for 30 days, which according to Google is 2 592 000 seconds. However, I highly suspect that this value is too high, because the value was set (memcache.set() returned the value True), but a memcache.get() just after always returned None. Reducing this value to 1 728 000 seconds just worked fine/as expected. I guess that once passed the highest value, the time parameter gets interpreted as an absolute Unix epoch time. That would mean that 2 592 000 seconds got interpreted as "Sat, 31 Jan 1970 00:00:00 GMT", which is obviously a date in the past... So what is the highest value you can enter that will get interpreted as a number of seconds in the future?

    Read the article

  • GUI-Library for microcontroller

    - by Martin Kirsche
    I want to create a GUI driven application for a micro-controller (Atmel XMEGA) that is connected to a 128x64 dots graphics LCD (EA DOGL128-6) and 4 buttons for navigation. Controlling the display itself (e.g. drawing pixels and characters) is no problem but in order to prevent me from reinventing the wheel I was googling for a GUI-Library/-Toolkit that is written in c, includes its source code, will run on a 32 MHz 8-bit micro-controller and provides at least the following controls: panel (to group elements) menu (scrollable) icon label button line-graph (optional) But I didn't find any thing useful. Does anyone know (or better uses) such a library(preferably for free)?

    Read the article

  • break dataframe into subsets by factor values, send to function that returns glm class, how to recom

    - by Alex Holcombe
    Thanks to Hadley's plyr package ddply function we can take a dataframe, break it down into subdataframes by factors, send each to a function, and then combine the function results for each subdataframe into a new dataframe. But what if the function returns an object of a class like glm or in my case, a c("glm", "lm"). Then, these can't be combined into a dataframe can they? I get this error instead Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors) : cannot coerce class 'c("glm", "lm")' into a data.frame Is there some more flexible data structure that will accommodate all the complex glm class results of my function calls, preserving the information regarding the dataframe subsets? Or should this be done in an entirely different way?

    Read the article

  • How do I get the size of a response from a Spring 2.5 HTTP remoting call?

    - by aarestad
    I've been poking around the org.springframework.remoting.httpinvoker package in Spring 2.5 trying to find a way to get visibility into the size of the response, but I keep going around in circles. Via another question I saw here, I think what I want to do is get a handle on the InputStream that represents the response from the server, and then wrap it with an Apache commons-io CountingInputStream. What's the best way to go about doing this? For the moment, I'd be happy with just printing the size of the response to stdout, but eventually I want to store it in a well-known location in my app for optional display.

    Read the article

  • Generate links for routes with non-parameter url segments on ASP.NET MVC 2

    - by spapaseit
    I have a route defined with several hardcoded (non-parameter) segments: routes.MapRoute(null, "suggestion/list/by/{tag}", new { controller = "Suggestion", action = "List", tag = UrlParameter.Optional }); Suppose I'm in the Index view of SuggestionController, which has a Suggestion object for Model, how can I create a link that matches that route? I'd rather use one of the provided helpers and keep the route name as null in order to avoid hard-coding to much on my views, but I can't figure out how to user these non-parameter segments in Html.ActionLink or RouteLink methods. I've even tried to render the link using plain ol' html <a href="/suggestion/list/by/<%=Model.Tag %>"><%=Model.Tag %></a> but this somehow didn't match the route either. There's probably a very simple solution and I might be over-complicating things in mi mind, but I'm at a loss. Any ideas? Thanks in advance.

    Read the article

  • Can't set default value of string property to "" in the Xcode CoreData model designer

    - by glenc
    I have an entity in my datamodel with a string property that is currently optional, and I'd like to convert this property to a required property with a default value of the empty string. As others have discovered, leaving the default value blank results in validation errors (since the designer interprets this as NULL), but trying '', "", or @"" as the default value results in those literal characters being interpreted as the default, rather than the empty zero-length string, as desired. I did find this thread on Google, however, apart from the solution being really ugly (model definition split between the .xcdatamodel and objc source), it also doesn't work for lightweight migrations because those migrations are done solely based on the .xcdatamodel files and the objc logic from your entity implementations isn't loaded. Is there any way to achieve this in the data model designer?

    Read the article

  • Voting UI for showing like/dislike community comments side-by-side

    - by Justin Grant
    We want to add a comments/reviews feature to our website's plugin gallery, so users can vote up/down a particular plugin and leave an optional short comment about what they liked or didn't like about it. I'm looking for inspiration, ideally a good implementation elsewhere on the web which isn't annoying to end users, isn't impossibly complex to develop, and which enables users to see both good and bad comments side-by-side, like this: Like: 57 votes Dislike: 8 votes --------------------------------- -------------------------------- "great plugin, saved me hours..." "hard to install" "works well on MacOS and Ubuntu" "Broken on Windows Vista with UAC enabled" "integrates well with version 3.2" More... More... Anyone know a site which does something like this?

    Read the article

< Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >