w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Centering x-tick labels between tick marks in matplotlib
One way to do it is to use the minor ticks. The idea is that you set the minor ticks so that they are located halfway between the major ticks, and you manually specify the labels. For example: import matplotlib.ticker as ticker # a is an axes object, from figure.get_axes() # Hide major tick labels a.xaxis.set_major_formatter(ticker.NullFormatter()) # Customize minor tick labels a.xaxis.set_minor_locator(ticker.FixedLocator([1.5,2.5,3.5,4.5,5.5])) a.xaxis.set_minor_formatter(ticker.FixedFormatter(['1','2','3','4','5'])) The three lines: "Hide" the 1,2,3,4,... that you have on the major ticks Set minor ticks halfway between the major ticks (assuming your major ticks are at 1,2,3...) Manually specifies the labels for the minor ticks. Here, '1' would be between 1.0 and 2.0 on the gr

Categories : Python

Remove outer print marks on PDF iTextSharp
Do you have to actually remove them or can you just crop them out? If you can just crop them out then the code below will work. If you have to actually remove them from the file then to the best of my knowledge there isn't a simple way to do that. Those objects aren't explicitly marked as meta-objects to the best of my knowledge. The only way I can think of to remove them would be to inspect everything and see if it fits into the document's active area. Below is sample code that reads each page in the input file and finds the various boxes that might exist, trim, art and bleed. (See this page.) As long as it finds at least one it sets the page's crop box to the first item in the list. In your case you might actually have to perform some logic to find the "smallest" of all of those items

Categories : C#

Matlab: How to remove brushing marks on a plot
%first get the dataObjects h = gcf axesObjs = get(h, 'Children'); dataObjs = get(axesObjs, 'Children'); for i=1:length(dataObjs) objects=dataObjs{i}; %for each line object for j=1:length(objects) t = get(objects(j)); if strcmp(t.Type,'line') set(objects(j),'BrushData',zeros(1,length(t.BrushData))); end end end

Categories : Matlab

How to remove brackets and quotation marks from JSON String
You can use a simple replace: String bob = "["Bob"]"; bob = bob.replace("[", "").replace(""", "").replace("]", ""); Log.i("Test", bob); This will now just print Bob

Categories : Android

Why doesn't TPageProducer remove quotation marks from strings?
What type of 'string' is 'Result' if the notation Result.Length is allowed? It's just the same old string, aliased to UnicodeString, that you've been using since Delphi 2009. The difference is that this code uses the new record helper (specifically SysUtils.TStringHelper). That's what lets you use . notation on a string variable. Is there a way in which I can tell the compiler to use 'XE3' compatibility for a unit? No. The code in question is a library unit and it is designed to be compiled in a particular mode. What's more, you can't readily re-compile it unless you take on compiling the RTL/VCL yourself. Even if there was such a mode, it would not help since the code is simply wrong (see below). No amount of mode switching can fix this particular piece of code. I get to th

Categories : String

Project Euler Q22: Why do I get different results depending on when I remove the quotation marks?
I am afraid you copy&pasted the input file or something like that instead of saving it. I tried your two codes and they work just fine: $ ruby p22.rb 87119XX82 87119XX82 Now, if you asked how I'd write it (which you didn't :-)), let's keep the abstraction get_score but refactor things a little bit: indexes = Hash[("A".."Z").map.with_index(1).to_a] get_score = proc { |word, idx| indexes.values_at(*word.chars).reduce(:+) * idx } sorted_names = File.read("names.txt").delete('"').split(',').sort solution = sorted_names.map.with_index(1, &get_score).reduce(0, :+)

Categories : Ruby

python xlrd: how to remove quotation marks when converting excel file to csv
Set the CSV writer's quoting argument to whichever of the csv module's quoting constants has the behavior you want. http://docs.python.org/2/library/csv.html#csv.QUOTE_ALL

Categories : Python

Haskell - adding quotation marks (speech marks)
Do you mean, convert 7777 to a string? You can use show. show 7777 --> "7777" If you then want quotes around that string do: """ ++ show 7777 ++ """

Categories : Haskell

Remove Wordpress navigation labels?
Instead of using a plugin for making images the navigation, you can load the images easily. Using this method will get the images to load and NOT the label. Step 1: Go to Dashboard>Appearance>Menus Step 2: Create a menu and set it as your navigation menu. Step 3: In the menu, add a custom link. Step 4 IMPORTANT: Here's where you add the images. In the URL part of the custom link, add the URL you would like to link to. In the navigation label section, add the HTML for the image (yes, it can handle HTML). So, you would want something like this in the navigation label section: <img src="the URL of where your image is">.

Categories : PHP

Remove small chunks of labels in an image
use regionprops >> props = regionprops( bwlabel( mask, 4 ), 'Area', 'PixelIdxList' ); >> smallRegions = [props(:).Area] < minNumPixels; % select the small regions >> mask( [props( smallRegions ).PixelIdxList ] ) = 0; % reset small regions

Categories : Matlab

How to remove labels from search page in windows phone?
you can do this by using simple listbox. just put image and textblock inside your listbox itemtemplete. here is the code example. <ListBox x:Name="lst"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Image Margin="10" Source="{Binding image}" Width="60" Height="60"/> <TextBlock Text="{Binding text}" VerticalAlignment="Center" Margin="20,0"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox>

Categories : Windows Phone 8

nvd3: remove y-axis tick labels from discrete bar chart
There's a variable in the nvd3 discrete bar-function that removes the y axis (including labels). Use this in your code to remove them: .showYAxis(false) A similar variable exists for the x-axis.

Categories : D3 Js

Validation(ASP.NET): If this attribute value is enclosed in quotation marks, the quotation marks must match
Try this: <asp:Label ID="CategoryText" CssClass='<%# Convert.ToBoolean(DataBinder.Eval(Container.DataItem, "IsSkipped")) ? "CategoryCell Skipped" : "CategoryCell" %>' runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "CategoryID").Equals(CurrentCategoryID) ? DataBinder.Eval(Container.DataItem, "Text").ToString() : GenerateQuestionURL(DataBinder.Eval(Container.DataItem, "CategoryID").ToString(), DataBinder.Eval(Container.DataItem, "Text").ToString()) %>' /> Its a bit of a mess though (hard to read), I would put this in a function and call it from there.

Categories : C#

How to make the NVD3 discreteBarChart labels on the X axis to adapt to the width or to the number of labels?
Little late to answer, but to get similar results but using multi-barchart as mentioned by Lars , you can use following command to get a similar graph (i.e hide "stacked" and "grouped", as well as legend buttons). n1$chart(showControls = FALSE, showLegend = FALSE)

Categories : Javascript

matplotlib: draw major tick labels under minor labels
You can use axis method set_tick_params() with the keyword pad. Compare following example. import datetime import random import matplotlib.pyplot as plt import matplotlib.dates as dates # make up some data x = [datetime.datetime.now() + datetime.timedelta(hours=i) for i in range(100)] y = [i+random.gauss(0,1) for i,_ in enumerate(x)] # plot plt.plot(x,y) # beautify the x-labels plt.gcf().autofmt_xdate() ax = plt.gca() # set date ticks to something sensible: xax = ax.get_xaxis() xax.set_major_locator(dates.DayLocator()) xax.set_major_formatter(dates.DateFormatter('%d/%b')) xax.set_minor_locator(dates.HourLocator(byhour=range(0,24,3))) xax.set_minor_formatter(dates.DateFormatter('%H')) xax.set_tick_params(which='major', pad=15) plt.show() PS: This example is borrowed from moooeeeep

Categories : Python

D3 Graph Drawing with labels, first few labels won't appear
Your problem is related to how selections work. You're doing a svg.selectAll("text"), which selects all the text elements in the SVG. Then you match data to the selected elements using .data(). The key thing is that by default, D3 matches data and DOM elements by their index (i.e. the first DOM element is matched with the first data item and so on) and that there are text elements in your SVG already (the labels of the axis). So your selection isn't empty and part of the data is matched to those elements (the axis labels). Therefore, the .enter() selection doesn't contain DOM elements for all the data elements, but only for those that are not matched. Hence you are missing exactly axis label number of elements. One of the ways of fixing this is to assign a class to your labels and change

Categories : Javascript

levelplot: how to adjust scale levels (at) & scale labels (labels)
Solved it: I stated the at=c() argument twice. Once directly in levelplot and then in the colorkey-list levelplot(X, col.regions = Acol.regions,at=round(c(seq(Uniques.min,0,length.out=5)[-5],0,seq(0,Uniques.max,length.out=5)[-1]),2), colorkey=list( at=round(c(seq(Uniques.min,0,length.out=5)[-5],0,seq(0,Uniques.max,length.out=5)[-1]),2), labels=as.character(round(c(seq(Uniques.min,0,length.out=5)[-5],0,seq(0,Uniques.max,length.out=5)[-1]),2)*2)), margin=F) Thanks to anyone who might have had a try. Eric

Categories : R

What is the use case of marks?
If you mean marking text lines as in vim, I use it quite a bit. For example, if you want to quickly go look at something else, you can use ma to mark the current line as a, then go check out something else in the file, then return to where you were with a simple 'a. Similarly, if you want to delete an unknown number of lines between your current position and somewhere else, use ma, go to that "somewhere else, and just use d'a. There are many more things you can do with them (such as changing text between your current position and a mark), those two are just the most common ones I use (and I use them a lot).

Categories : Vim

Rails - Adaptable field labels. Best way to use a models fields as labels for another models fields
Forgot all about this long newbie question of mine. So thought I would show what I did anyway. In the end I add added code like this to my Kit model (kit.rb) def info_lbl_1 if !self.kit_type.blank? "N/A" if !self.kit_type.info_label_1.blank? self.kit_type.info_label_1 end end end ..... and so on for each of the type labels. If there is no label then N/A (not applicable) is returned. Then in the kit show view (show.html.erb) I added logic to display the labels as per below: <% if @kit.info_lbl_1 !='N/A' %> <dt><strong><%= @kit.info_lbl_1 %>:</strong></dt> <dd><%= @kit.info_1 %></dd> <% end %> .... So the appropriate label for the customise type specific labels shows and the data is only displayed i

Categories : Ruby On Rails

quotation marks in PHP and mySQL
Escape everything. If you are using mysql_ statements, stop using them as they are deprecated. Take a look at PDO or Mysqli. Both of them escape symbols if you prepare the queries, so you also prevent sql injection.

Categories : PHP

quotations marks encoding in C#
If all you want to do is to write the file to disk, then: use the Stream API directly, or (even easier) just use: wc.DownloadFile("http://images.thenews.com.pk/21-08-2013/ethenews/t-24895.htm", @"D: estsharp.txt"); If you don't treat it as binary, then you need to worry about encodings - and it isn't enough just to look at sr.CurrentEncoding, because we can't be sure that it detected it correctly. It could be that the encoding was reported in the HTTP headers, which would be nice. It could also be that the encoding is specified in a BOM at the start of the payload. However, in the case of HTML the encoding could also be specified inside the HTML. In all three cases, treating the file as binary will improve things (for the BOM and inside-the-html cases, it will fix it entirely).

Categories : C#

Multiline Editing in VIM (Using Marks)
The vim-multiple-cursors plugin was already mentioned in the comments. If the text you're editing is identical, an alternative is my ChangeGlobally plugin; which provides a new gc command that works like built-in c, but after leaving insert mode applies the local substitution to all other occurrences.

Categories : Vim

Add Crop Marks to PDF with wkhtmltopdf
How is the page's CropBox defined? Also you may check out the section 14.11.3 Printer’s Marks, of the PDF specification and find how you can get it working with your software. from spec: The crop box defines the region to which the contents of the page shall be clipped (cropped) when displayed or printed. Unlike the other boxes, the crop box has no defined meaning in terms of physical page geometry or intended use; it merely imposes clipping on the page contents. However, in the absence of additional information (such as imposition instructions specified in a JDF or PJTF job ticket), the crop box determines how the page’s contents shall be positioned on the output medium. The default value is the page’s media box.

Categories : PHP

MySQL - question marks
Your database table column should be created with proper charset and collation. You can define theit while creating or altering a table: col_name {CHAR | VARCHAR | TEXT} (col_length) [CHARACTER SET charset_name] [COLLATE collation_name] Here is the mysql link to help you learn more about it: http://dev.mysql.com/doc/refman/5.0/en/charset-column.html

Categories : Java

Is there a way to minimize everything between two pragma marks
I don't think there is. You could always extract that code into a separate .m file, and #include it in the place where you want it. Then the compiler will insert the code at compile-time. Note that when you use this technique, you do NOT want to add the .m file that your #including to your target.

Categories : IOS

Umbraco quotation marks
Actually I don't think it is putting quotes round it, that's just how your browser is showing the rendered value in its code view. What is happening is that the XSLT is outputting the value as an encoded string instead of unencoded HTML. You need to add the attribute disable-output-escaping="yes" and the outer p tag: <div><xsl:value-of select="./broed" disable-output-escaping="yes" /></div>

Categories : HTML

How to get the name of a the student who got max marks in each subject?
You can use the ROW_NUMBER function to return only the "best" row per subject: SQL Fiddle MS SQL Server 2008 Schema Setup: CREATE TABLE Student ([Name] varchar(1), [Subject] varchar(1), [Marks] int) ; INSERT INTO Student ([Name], [Subject], [Marks]) VALUES ('a', 'M', 20), ('b', 'M', 25), ('c', 'M', 30), ('d', 'C', 44), ('e', 'C', 45), ('f', 'C', 46), ('g', 'H', 20) ; Query 1: SELECT Name, Subject, Marks FROM( SELECT *, ROW_NUMBER()OVER(PARTITION BY Subject ORDER BY Marks DESC) rn FROM dbo.Student )X WHERE rn = 1 Results: | NAME | SUBJECT | MARKS | -------------------------- | f | C | 46 | | g | H | 20 | | c | M | 30 |

Categories : SQL

Jackson field value with no quotation marks
That's not valid JSON, so you can't have it. JSON is a value transfer format, so you can't transfer functions. If you really need to return functions in JSON, you can probably post-process the result in javascript.

Categories : Java

How can I clear Vim's interface of the PyLint marks?
The plugin uses signs to show the lint errors. If you never want to see them let g:pymode_lint_signs = 0 disables them. If you want to clear them, AFAICT there's no interface in the plugin for just that. (You could file an enhancement request.) But what should work is clearing all signs of the current buffer: :sign unplace * buffer=<C-r>=bufnr('')<CR> or :execute 'sign unplace * buffer=' . bufnr('')

Categories : Vim

Accent marks in Windows console
The command line simply cannot show some characters only by printing them over System.out . Maybe it would be easier to write your output in a simple JTextField or JLabel or something like that, for JTextField/JLabel is able to show every unicode characters which are included in the current Font.

Categories : Java

Attribute must be enclosed in quotation marks
Use single quotes: CommandArgument='<%# DataBinder.Eval(Container.DataItem, "AssignmentID")%>' Note you can also use the shorthand Eval since ASP.NET 2.0 to get rid of some of the noise: CommandArgument='<%#Eval("AssignmentID")%>'

Categories : Asp Net

Regex unless inside "speech marks"
Description This regex will only find line with no quotes, or where quotes have white space between the quotes and it's payload. This expression assumes the first non space character would be the quote if it existed. If the first non space character is not the open quote then the entire line is allowed. ^s*(?:[^"].*|"s.*s"?)s*(?:$| | |) PHP Code Example: Input string slashdot " slashdot " " multiline 1 slashdot line 2 slashdot " "slashdot bad" " leading spaces and trailing spaces " Code <?php $sourcestring="your source string"; preg_match_all('/^(?:[^"].*|"s[^"]*s")/imx',$sourcestring,$matches); echo "<pre>".print_r($matches,true); ?> Matches $matches Array: ( [0] => Array ( [0] => sla

Categories : PHP

Removing punctuation marks using ispunct()
This operation will become very costly when string is very very long. No, it won't. It will be an O(n) operation which is good for this problem. You cannot get better than this for this operation because any which way, you have to look at each and every character in the string. There is no way to do this without looking at each and every character in the string.

Categories : C++

What may cause question marks instead of non-ASCII symbols?
You need to change the character set of the database to UTF-8 or a character set for Cyrillic characters. Latin-1 can't encode Cyrillic characters and that's why they're appearing as question marks in the database. edit: I just saw you're declaring the table with UTF-8 character set, so I'm stumped.

Categories : PHP

Add specific points on highest marks
UPDATED You can do it like this SELECT id, name, section, marks, CASE rank WHEN 1 THEN 5 WHEN 2 THEN 3 WHEN 3 THEN 1 ELSE 0 END points FROM ( SELECT s.*, @n := IF(@s = section, IF(@m = marks, @n, @n + 1), 1) rank, @m := marks, @s := section FROM students s, (SELECT @n := 0) i ORDER BY section, marks DESC ) q HAVING points > 0 Output: | ID | NAME | SECTION | MARKS | POINTS | ---------------------------------------- | 1 | S1 | class1 | 55 | 5 | | 7 | S7 | class1 | 32 | 3 | | 3 | S3 | class1 | 25 | 1 | | 10 | S10 | class2 | 78 | 5 | | 14 | S14 | class2 | 78 | 5 | | 6 | S6 | class2 | 66 | 3 | | 2 | S2 | class2 | 33 | 1 | | 13 | S13

Categories : Mysql

What to do with Question Marks in HTAccess Redirects
If it's a single link you want to change you don't need a htaccess rule for that you can just do a redirect. redirect 301 /wordpress/?p=250 http://www.othersite.com/blog If the URL parameter changes you can use this rule. RewriteEngine on RewriteRule ^wordpress/(.*) http://www.othersite.com/blog [R=301,QSA,NC,L] Note that when you use the QSA flag it will append the URL with the query parameter so if that's what you want the resulting URL will be. http://www.othersite.com/blog?p=250 Otherwise if you remove the QSA flag, then it will just redirect to this http://www.othersite.com/blog

Categories : String

Put correct scaled marks on graph
How big is your canvas? Let's assume it is 1200 pixels high. If you are getting values from 0-1024 from your Serial input, you want to graph those from the bottom of the screen (height in Processing) to 1024. Let's assume that you centre it, so offset it by 88 pixels: int graphHeight = 1024; int baseLine = height - ((height - graphHeight) /2); // 1112 This is now your starting point from which to draw everything. Then lets assume that you follow the same formula to make your gray markers: int quarterLine = baseLine - 256; // 856 int halfLine = baseLine - 512; // 600 int threeQuarterLine = baseLine - 768; // 344 int topLine = baseLine - graphHeight; // 88 If your canvas is less than that height, just scale accordingly... Make sense ? Then, draw them with the line() method: stroke(

Categories : Java

Marks for Google Maps Android
Try this: @Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); setContentView(R.layout.contacts2); //Add this line contact2Map= ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.contacts2map)) .getMap(); addtest(); }

Categories : Android

whether need quotation marks with strings in simpleXML in php
Consider the string that is being passed to xpath. With the quotes, it's: child::course[GEcode='GE1319'] without quotes, it's: child::course[GEcode=GE1319] this is invalid xpath syntax, since the value must be quoted.

Categories : PHP

Getting Arabic Query String in Question Marks
Your Apache server probably doesn't accept UTF-8 URL encoding. See this answer to solve your problem. Hope it will help :)

Categories : PHP



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