w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Custom PyCharm docstring stubs (i.e. for google docstring or numpydoc formats)
As CrazyCoder mentions, its a ticket. Right now, you can only use EpyType and reStructuredText.

Categories : Python

Documenting `tuple` return type in a function docstring for PyCharm type hinting
I contacted PyCharm support, and this is what they said: For tuple please use (<type_1>, <type_2>, <type_3>, e t.c.) syntax. E.g.: """ :rtype: (string, int, int) """ This is confirmed in PyCharm's documentation: Type Syntax Type syntax in Python docstrings is not defined by any standard. Thus, PyCharm suggests the following notation: ... (Foo, Bar) # Tuple of Foo and Bar

Categories : Python

DateTime is not in proper format
There's several ways to do this. Either: Change the regional settings for the user running your web application Use the correct CultureInfo object when formatting Set the default CultureInfo object on the current thread Escape the slashes To provide a CultureInfo object when formatting: @Html.DisplayFor(modelItem => item.EndDate.ToString("dd/MM/yyyy", CultureInfo.GetCulture("en-US"))) To set the default CultureInfo object: Thread.CurrentThread.CurrentCulture = CultureInfo.GetCulture("en-US"); To escape the slashes, use single quotes: [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd'/'MM'/'yyyy}")] Note that all the code ends up in DateTime.ToString(string) or one of its overloads, so that's the place to look for clues to this.

Categories : C#

Convert into proper XML format
Add a reference to System.Web and use the HttpServerUtility.UrlDecode Method (String): var decodedXml = System.Web.HttpUtility.UrlDecode(xml);

Categories : C#

XSLT format a xml data file to multiple table display using HTML format
When this stylesheet is executed, it starts by applying templates to the root node, /. This fires your xsl:template match="/". While that template is being applied, the context node is /. So when it processes <xsl:apply-templates select="testsuites"/> <xsl:apply-templates select="testsuite"/> <xsl:apply-templates select="testcase"/> <xsl:apply-templates select="failure"/> each of those XPath expressions is evaluated relative to /. So for the first one, you're asking it to apply templates to /testsuites (immediate child[ren] of the root node named testsuites). That's fine, because there is such a node. But for the second one, you're asking it to apply templates to /testsuite (immediate children of the root node, named testsuite). No such node exists. Th

Categories : HTML

jsp not passing UTF-8 data in proper format
The character encoding specified in the page (or in the web.xml) is applied to the following phases of an HTTP communication: Preparing / sending the Request from the Client to the Server Receiving / reading the Request in the Server Preparing / sending the Response from the Server to the Client Receiving / reading the Response in the Client The Application Server is the only responsible for the phase 2. You need to look for your specific application server settings, to alter the default character encoding (that could easily be ISO-8859-1), and alter it to work in UTF-8. For example, in Tomcat you would need to edit the conf/server.xml file, by adding the URIEncoding="UTF-8" parameter to the <Connector>, for example from <Connector port="8090" /> to <Connector p

Categories : Java

how to get proper dropdown format for dates
The POSTed information is the value of the option, not its text. If you want the text, you can: echo "<option value=".$month_array[$i]." name='Resolved_date2'>".$month_array[$i]."</option>"; To limit the number of days according to the chosen month, you'll have to do it on the client side, using javascript or preferably one of its frameworks like jQuery.

Categories : PHP

Proper number format not coming for spanish
You have to set NSNumberFormatterCurrencyStyle instead of NSNumberFormatterDecimalStyle and CurrencySymbol to Empty to remove the symbol of Currency. Working Code : NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init]; [currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle]; [currencyFormatter setCurrencySymbol:@""]; [currencyFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"es_ES"]]; NSLog(@"Final Value :: %@", [currencyFormatter stringFromNumber:[NSNumber numberWithFloat:1000000]]); Output (As you want without Currency Symbol) : Final Value :: 1.000.000,00

Categories : Iphone

What's the proper format for a union initializer list?
A union holds only one member at a time, so you initialize it with only one value. You may use Box iMyBoxA = { value }; to initialize the first-listed member of the union or Box iMyBoxA = { .name = value }; to initialize a particular member by name. Some notes: Your code is missing a semicolon after the union declaration; it should be: struct Box { union { AS128 intr; AS32 a, b, c, d; }; }; Since you have a union inside a struct, you ought to use two sets of braces for the initializers: Box iMyBoxA = { { value } }; The syntax with one set of braces is permitted but may elicit warnings from your compiler. Designated initializers (member names in initializers) are a C 1999 feature. This question is tagged with C and C++. A C++ compiler might or might not accept a designated initial

Categories : C++

Get proper format of the text file in HTML form
If I get it right, you should replace your new line characters with <br> or <p>. Try str = [str stringByReplacingOccurrencesOfString:@" " withString:@"<br>"]; How to detect new lines in Objective-C Solution of your next question might look like this: NSArray *words = [str componentsSeparatedByString:@" "]; NSString *line = @""; NSUInteger maxLineLength = 100; NSString *resultStr = @""; for (NSString *word in words) { if ([line length] + [word length] > maxLineLength) { resultStr = [resultStr stringByAppendingFormat:@"%@<br>", line]; line = word; } else { line = [line stringByAppendingFormat:@" %@", word]; } } resultStr = [resultStr stringByAppendingString:line];

Categories : HTML

how can i get array in proper format from this foreach and nested if condition in php?
Update to this one. From : array_push($color1,$color); $items = array($color1); To array_push($color1, $color); if(!empty($color1)) { $items[] = $color1; } And $items = array() before loop.

Categories : PHP

C - What is the proper format to allow a function to show an error was encountered?
There is not really a standard practice for this kind of error handling in C. But a good handling in your specific case would be returning NaN, in other words 0.0/0.0. /* error else */ else { etc(); return 0.0/0.0; } Which would yield NaN. You can check if a value is not a number by comparing it with itself, as NaN is the only float/double value that will fail when comparing to itself. yvalue = getYValueAt(...) if (yvalue != yvalue) { treat_error_here(); } This is just an option, there are other ways of handling this kinds of error.

Categories : C

How to place content in proper table format in repeater?
Ignoring the fact that this piece of HTML is totally invalid (ul -> li -> div -> a -> table), try to set the cell vertical alignment to top (<td valign="top">). A good advice. Try to use CSS and rewrite this using just divs and make it valid. <ul> <li> <div class="product"> <a href="#" class="info"> <table class="holder"> <asp:Repeater ID="repContent" runat="server"> <ItemTemplate> <%# (Container.ItemIndex + 4) % 4 == 0 ? "<tr>" : string.Empty %> <td valign="top"> <img src='<%#"/productimages/main/" + Eval("PhotoName").ToString().Trim

Categories : Asp Net

Laravel4: check if the inserted email is in a proper format
Just define a custom error message: $messages = array( 'email' => 'Address in mailbox given :attribute does not comply with RFC 2822, 3.6.2.', ); $validator = Validator::make($input, $rules, $messages);

Categories : Forms

Primefaces p:calendar and format user input into proper date
it's true that's too late but may be cold help someone else . you can't use Mask but you can do it with regex expression for exemple : <p:calendar value="#{MyBean.MyDate}" id="MyCalendar" effect="explode" > <f:validateRegex pattern="^(?:(?:31(/|-|.)(?:0?[13578]|1[02]))1|(?:(?:29|30)(/|-|.)(?:0?[1,3-9]|1[0-2])2))(?:(?:1[6-9]|[2-9]d)?d{2})$|^(?:29(/|-|.)0?23(?:(?:(?:1[6-9]|[2-9]d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1d|2[0-8])(/|-|.)(?:(?:0?[1-9])|(?:1[0-2]))4(?:(?:1[6-9]|[2-9]d)?d{2})$"> <p:ajax update="msgMyCalendar" event="keyup" /> </f:validateRegex> </p:calendar> <p:message for="MyCalendar" id="msgMyCalendar" display="icon"/>

Categories : Jquery

how can i change display format in datawindow rather than display data in vertical
Maybe try the N-Up datawindow style otherwise you could flatten the data in SQL using one of the examples in this stackoverflow question on flattening data the method you would use might depend on if you know how many occurs there are. If you need the data to be update-able then you'll need to write some code to un-flatten on save.

Categories : Misc

jQuery datepicker changing format dosent show proper month
If you only need to month and year (since thats what you are storing on the input) you can use this: $(function() { //set datepicker or month/year selection $('#a').datepicker( { changeMonth: true, changeYear: true, showButtonPanel: true, dateFormat: 'MM yy' }); $("#a").focus(function () { $(".ui-datepicker-calendar").hide(); //add event to perform on done button click $(".ui-datepicker-close").click(function(){ var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val(); var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val(); $("#a").datepicker('option', 'defaultDate', new Date(year, month, 1));

Categories : Javascript

How to get current date and time and save it into char* array in proper format?
You can use strftime function: http://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html strftime is described in C99 Standard in 7.23.3.5.

Categories : C

why doesnt div display at proper coordinates?
you have a few problems. 1) you aren't using the CSS position: absolute within your 'tagged' class. 2) you are declaring multiple .planetmap's (one per loop) and appending the content each time. If it's intentional that you want many .planetmaps, restrict your jQuery to operate on the local copy only using something like $(this).next('.image_panel).find('.planetmap') Here is a JS Fiddle of the CSS position addition : http://jsfiddle.net/ksf3A/ Your left / rights are off & it's showing multiple images as per your HTML. Maybe you want: <div class="container"> <div class="image_panel"><br> <%= image_tag(i_connection.image.image.url(:large)) %> <div class='planetmap'></div> </div> <% if @new_manual.present? %>

Categories : Jquery

I am looking for a proper way to display a UUID via NatVis in VS2012
This approach is far from pretty but it gets the job done. First off, you need a dummy type somewhere in your code that handles the display of a single byte in hex without any prefixes. This feels like a really dirty hack, since we have to introduce an additional type into our code just for proper debug visualization. namespace dummy { struct hex_dummy { unsigned char c; }; } This type can be placed pretty much anywhere as long as the debugger is able to find it in the context where we want to look at a uuid. The next step is unfortunately almost as bad. In order to be able to print a byte in hex without the 0x prefix, we introduce a debug visualizer for hex_dummy with a whopping 256 different DisplayStrings: <Type Name="dummy::hex_dummy"> <DisplayString

Categories : C++

how to display the proper image for the particular result using php and javascript?
This is simple... First check your value, and assign an image to variable... if($val->result=="clean site"){$image = "green-light.png";} elseif($val->result=="unrated site"){$image = "orange-light.png";} elseif($val->result=="suspicious site"){$image = "red-light.png";} Then echo that image inside the table. echo "<td><img src='images/".$image."'></td>"; This means you have to create 3 images with the names as above. And put them in your images folder As for the other part of your question....it will involve counting the elements either with PHP, or better with SQL....but Im not gonna do that part for you. Heres fuller code... if(empty($val->detected)): echo '<td>'. $none .'</td>'; else: echo '<td>'. $val->detec

Categories : PHP

document.documentElement function does not display proper result
document.documentElement will get you the root HTML tag of the page in which your javascript is present. To fetch and display the XML content, you must get access to the XML document and then use it to load the XML file like the following: function findWriter() { var schriftstellerKnoten, SpracheKnoten; var FuellerKnoten, DichtungKnoten, Anzeige, rootElement; if (window.XMLHttpRequest){ xhttp=new XMLHttpRequest(); //For non IE browsers } else { // for IE 5/6 xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET","test.xml",false); xhttp.send(); xmlDoc=xhttp.responseXML; //Fetch the XML file contents var nameEl = xmlDoc.documentElement.getElementsByTagName("name"); //Get all <name> tags in it for (i=0; i<nameEl.length; i++){ doc

Categories : Javascript

How do I get Sphinx to ignore the GPL notice in my docstring?
I ran into the same problem just now and fixed it by moving the license notice out of the docstring and into a regular comment block at the top of the file. For example: # Copyright 2013 Example, inc. All rights reserved. # # License ... # ... # ... """ This is the module docstring. Description of the module here. Etc, etc. """ import .... ...

Categories : Python

How to print docstring outside a function using wrappers?
I'm not sure why you would not want to use functools.wraps, but you could add the doc string to wrapper yourself: def passmein(func): def wrapper(*args, **kwargs): return func(*args, **kwargs) wrapper.__doc__ = func.__doc__ return wrapper @passmein def testfunc(me): """This is a test function""" if __name__ == '__main__': print testfunc.__doc__

Categories : Python

Appengine model property docstring
The answer is that Sphinx works just fine. I was looking at the wrong copy of the doc output that hadn't been rebuilt. Both of these work: content = ndb.StringProperty() "The content" #: the content content = ndb.StringProperty()

Categories : Python

Exclude module docstring in autodoc
Add the following to conf.py: def remove_module_docstring(app, what, name, obj, options, lines): if what == "module" and name == "yourmodule": del lines[:] def setup(app): app.connect("autodoc-process-docstring", remove_module_docstring) This code removes the module docstring in the yourmodule module, by providing a handler for the autodoc-process-docstring event.

Categories : Python

docstring blocks elif statement
Docstrings are just string literals that are found at the start of the function. They still have to follow indentation rules. Your string is not correctly indented for the elif block; by being de-dented from the if block before, you ended the if-elif-else blocks altogether and no elif is permitted to follow. Use a regular, normal comment instead, a line starting with #; lines that contain only comments are exempt from the indentation rules: if char == '!' or char == '?': sentences.append(sentence) sentence = '' # The sign -> refers to 'followed by' elif char == '.': i = raw_text.index(char) # slicing previous/following characters boundary = True or indent the string (which is entirely still executed by Python as code, but otherwise not assigned and thus discarded a

Categories : Python

Using setScrollY for ListView, adapter's setView doesn't display proper item
Try to change your android:layout_height parameter with wrap_content value: <ListView android:id="@+id/image_list" android:layout_width="match_parent" android:layout_height="wrap_content" />

Categories : Android

fetching data from json and unable to display proper graph in extjs
fields: ['name', 'date'] shouldn't the second field be "data" instead of "date" I think your problem is the URL of your JsonDataStore. You should get the chart.json as a through a web server without trying read it directly. I hope this post will help you. Can't get jSon dataStore into ExtJS (Sencha Touch) chart: displays error "cannot read property 'length' of undefined"

Categories : Json

Python - using decorator.py to preserve a method docstring
Basic Descriptor/Decorator You just need to keep in mind which function you should decorate. Your function is being created in __get__, so it won't help to use the wrapper as a decorator, instead, you need to apply it in the __get__ method. As an aside, you can use either functools.update_wrapper or decorators.decorator for this. They work very similarly, except that you have to keep the result of decorators.decorator whereas functools.update_wrapper returns None. Both have signature f(wrapper, wrapped). from functools import update_wrapper class class_or_instance(object): def __init__(self, fn): self.fn = fn def __get__(self, obj, cls): if obj is not None: f = lambda *args, **kwds: self.fn(obj, *args, **kwds) else: f = lambda *a

Categories : Python

Aceess a methods docstring without instance, Python
You can use __doc__: class Test(): def test_method(self): """I'm a docstring""" print "test method" print Test.test_method.__doc__ # prints "I'm a docstring" Or, getdoc() from inspect module: inspect.getdoc(object) Get the documentation string for an object, cleaned up with cleandoc(). print inspect.getdoc(Test.test_method) # prints "I'm a docstring"

Categories : Python

Sublime 3, snippet for python function docstring with arguments and return
Just add a :<default value> after the # in each ${#} stop-point: <snippet> <content><![CDATA[ """${1:One liner description} Parameters ---------- ${2:a} : ${3:type} Returns ------- ${4:b} : ${5:type} """ ]]></content> <tabTrigger>docstring</tabTrigger> <scope>source.python</scope> <description>Adds a docstring skeleton to function</description> </snippet>

Categories : Python

Python 3 - Method docstring inheritance without breaking decorators or violating DRY
Use a class decorator instead: @inherit_docstrings class MyClass(SuperClass): def method(self): pass where inherit_docstrings() is defined as: from inspect import getmembers, isfunction def inherit_docstrings(cls): for name, func in getmembers(cls, isfunction): if func.__doc__: continue for parent in cls.__mro__[1:]: if hasattr(parent, name): func.__doc__ = getattr(parent, name).__doc__ return cls Demo: >>> class SuperClass: ... def method(self): ... '''Has a docstring''' ... pass ... >>> @inherit_docstrings ... class MyClass(SuperClass): ... def method(self): ... pass ... >>> MyClass.method.__doc__ 'Has a docstring' This sets the docstring after defining t

Categories : Python

python time conversion into proper time format
Instead of using time.strptime, which returns a time tuple, you could use datetime.strptime, which returns a datetime object: import datetime as DT thetime = '2013-07-16T16:14:34+0000' finaltime = DT.datetime.strptime(thetime, "%Y-%m-%dT%H:%M:%S+0000").strftime('%B %d, %Y %I:%M %p') print(finaltime) yields July 16, 2013 04:14 PM With Python2.7.5 or better, you can also use the %z directive to parse the UTC offset instead of using the fixed string +0000: DT.datetime.strptime(thetime, "%Y-%m-%dT%H:%M:%S%z")

Categories : Python

how to display right xml format
Your code is working fine for me (output is): <Contacts> <Contact> <Name xmlns="g:">Patrick Hines</Name> <Phone>206-555-0144</Phone> <Address> <street>this street</street> </Address> </Contact> </Contacts> if you still can not get the correct output then you can try this: new XDocument( new XElement("Contacts", new XElement("Contact", new XElement("Name", "Patrick Hines"), new XElement("Phone", "206-555-0144"), new XElement("Address", new XElement("street","this street")) ) ) ).Save("foo.xml");

Categories : C#

How to display string in the format ip1,ip2,ip3,ip4 etc
I assume this is what you want: int n = 10; IEnumerable<String> ips = Enumerable.Range(1, n).Select(i => "ip" + i); String allIPs = String.Join(",", ips); Result: ip1,ip2,ip3,ip4,ip5,ip6,ip7,ip8,ip9,ip10 Demo

Categories : C#

Format model's display date
You need to use this format string: <DisplayFormat(ApplyFormatInEditMode:=True, DataFormatString:="{d}")> The "d" for DateTime fields is the short date pattern of dd/MM/yyyy or MM/dd/yyyy depending on your locale. Source

Categories : Asp Net Mvc

Display the data using ArrayList in a particular format
Its not clear what you are saying here but I guess you are trying to get the output in a table format. Use table tags for it <table> <% while(x.next()) {%> <tr> <td><%out.print(x.getString(1); %></td> <td><%out.print(x.getString(2); %></td> <td><%out.print(x.getString(3); %></td> </tr> <% } %> hope this would solve your formatting problem. For displaying images from your database you must fetch the image name from your data base where you fetch all other data. Say you add another field in your query as image. Now to display that image you must have that image in your project images folder. Following code would help you to get image. <table> <% while(x.next()) {

Categories : Java

how to format the display of results after a sql query
ALWAYS indent your code, AlWAYS run tests on variables, do not take steps skipping simple testing before like looping <body> <section> <div id="slider"> <div class="slider-content"> <ul> <?php //include database connection include 'db_connect.php'; //query all records from the database $query = " SELECT name, surname, mobile, UPPER (LEFT(surname, 1)) AS letter FROM contacts ORDER BY letter ASC"; //execute the query $result = $mysqli->query( $query );

Categories : PHP

how to display rendered values in xml format
i haven't tried this .. but i think this will get you what you want in your browser but this is not real xml &lt;?xml version="1.0" encoding="utf-8" ?&gt;<br/> &lt;entries&gt; <br/> {% for entry in entries %} &nbsp;&nbsp;&nbsp;&nbsp;&lt;entry&gt;{{ entry.entry_id }}&lt;/entry&gt; <br/> {{ endfor }} &lt;/entries&gt;

Categories : Xml



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.