w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
wp_list_pages children of current page with sequential numbering
It is a bit messy but it works and there is always room for refactoring the code below in the future. The code below first checks to see if a page is the parent of child page. If it is the child page it will only show the child. It adds an incremental counter to every list item(even the children) and the counter is initiated by calling echo=0. Hope this helps <?php if(wp_list_pages('child_of='.$post->ID.'&echo=0&exclude=2')) { $list_of_pages = wp_list_pages('echo=0&title_li=&child_of='.$post->ID.'&exclude=2'); $list_pages = explode('<li class="',$list_of_pages); $len = count($list_pages); for ($i = 0; $i <= $len-2; $i++) : echo $list_pages[$i] . '<li class="link-'.($i+1). ' '; endfor; echo $list_pages[$i];

Categories : PHP

Numbering duplicates record in mysql (2)
You can emulate ROW_NUMBER() using correlated subquery in mysql. The resulting table with sequential number will be join with the table itself and update the value of sequence_No using the generated numbers. UPDATE tableName a INNER JOIN ( SELECT A.ID, ( SELECT COUNT(*) FROM tableName c WHERE c.Name = a.Name AND c.ID <= a.ID) AS sequence_No FROM TableName a ) b ON a.ID = b.ID SET a.sequence_No = b.sequence_No SQLFiddle Demo

Categories : Mysql

Numbering data based on occurrence
You can use a cursor. 1) Create a temp table 2) Output the result to a cursor 3) Loop throught the cursor and update the temp table 4) Select from the temp table. EDIT: I dont know how useful this will be but this statement will get u what u want without using cursor. SELECT [Col1] ,[Col2] , (select count(*) from Table_1 where Col2 = 'a' and Col1 <= t1.Col1) FROM [Table_1] t1

Categories : Sql Server

Excel VBA - Move data based on numbering
This is not tested but fundamentally shoudl work. I use the Match function to do this sort of thing all the time. You will have to tweak it for your specific purposes, i.e., assuming your tables are more than just 3 rows, etc. Sub TransferValuesUsingMatch() Dim wbSource as Workbook Dim wbDest as Workbook Dim rngSource as Range Dim rngDest as Range Dim colNum as Integer Dim colDest as Integer Dim cl as Range Set wbSource = Workbooks("test1.xlsx") 'Assumes the workbook is already open Set wbDest = Workbooks("test.xlsx") 'Assumes the workbook is already open Set rngSource = wbSource.Sheets("Sheet1").Range("A1:G3") 'Modify as needed Set rngDest = wbDest.Sheets("Sheet1").Range("A1:F3") 'Modify as needed For each cl in rngSource.Rows(2) colNum = cl.Offset(1,0).Value colDest = Appli

Categories : Excel

How to add numbering to LogFile?
You may try like this:- public sealed class LineCounter : PatternLayoutConverter { private static int i= 0; protected override void Convert(TextWriter writer, LoggingEvent loggingEvent) { LineCounter.i++; writer.Write(LineCounter.i.ToString()); } }

Categories : C#

Numbering the occurrences themseleves using sed
Use the right tool for the right job. This is tailor made job for awk: awk '$1 ~ /****/{print ++a $0; next} {print}' file line1 line2 line3 1******** line4 line5 2******** line6 line7 line8 line9 3******* line10 Or else pure BASH solution: while read l; do [[ $l == *'****'* ]] && l=$((++x))"$l" echo "$l" done < file

Categories : Regex

c++ dwarf tag numbering format
DWARF DIEs are organized as a tree - the top level DW_TAG_compile_unit for a single file will contain all of the type definitions (DW_TAG_class_type for instance), all of the functions (DW_TAG_subprogram), and global/static variables (DW_TAG_variable). A class definition (DW_TAG_class_type) will be a parent DIE and contain children like DW_TAG_member for member variables or DW_TAG_subprogram for methods. The output you've appended is the way your particular DWARF dumper operates - it looks like it is using that number to show parent/child relationships. Is this readelf? Other dwarf dumper programs may choose to show this in a different way. On Mac OS X, dwarfdump shows this relationship with indentation - children DIEs are indented a little more than parent DIEs. If you're looking at

Categories : C++

give numbering to each div with same class name
You can do this : $('.div1').html(function(i){ return i+1 }); See documentation of the html function and demonstration.

Categories : Jquery

Search and Replace > Numbering in VBS
The problem is caused by opening/creating both Ein and Aus for ASCII encoding (the FSO's default). The "Microsoft VBScript runtime error '800a0005'. Invalid procedure call or argument" is often caused by asking .Write(Line) to output something illegal for the selected encoding. (cf. this answer) If Ein is UTF-16 you can open/create the file in that mode (encoding parameter of those methods); if it is UTF-8 you can use an ADODB.Stream for I/O

Categories : Windows

Evo Pdf - Page numbering from within HTML
It looks like you can do this. See http://www.evopdf.com/demo/PDF_Creator/Headers_and_Footers/Page_Numbers_in_HTML.aspx In the sample code Evo Provides they use HtmlToPdfVariableElement.

Categories : Misc

Sequence numbering with xpages
Sequence numbering is a little challenge once you want to run your application on more than one server or offline (just wait for it, it will happen to your application too). Having said that, there are a number of approaches taken over the years: Use @Subset(@DbColumn(@DbName,"SomeViewSortedDecendingByNumber",1),1) +1; Problem: if 2 users open a document and haven't saved it Use a applicationScope variable, that you increment just before saving (don't forget the synchronized keyword for that function). Problem: value only shows on save - or you get "holes" if users don't save a document. Use an agent that only runs on one server. This sorts out multi-server and offline use. Problem: number shows up much later than document creation Use a web service (written in Notes) that gives out the

Categories : Javascript

How to add row numbering in crystal report C#
Use datatable and take DS.tables[0].rows.count and take a count inside and which increments with every loop iteration. DataTable tab_lvl = new DataTable(); tab_lvl.Columns.Add(new DataColumn("NO", typeof(string))); tab_lvl.Columns.Add(new DataColumn("Name", typeof(string))); tab_lvl.Columns.Add(new DataColumn("AGE", typeof(string))); tab_lvl.Columns.Add(newDataColumn("Allot_Asset_Code",typeof(string))); int count; for(int i=0;i<ds.Tables[0].Rows.Count;i++) { count++; DataRow dr = tab_lvl.NewRow(); dr["NO"] = count; dr["NAME"] = ds.Tables[0].Rows[i]["COLname/number"]; dr["AGE"] = ds.Tables[0].Rows[i]["COLname/number"]; } //bind the datatable to the report objRpt.SetDataSource(tab_lvl);

Categories : C#

Automatic numbering of report
QuickReports offers no support for automatic numbering like you're asking. (It supports automatic page numbering, but not tracking things like the last number of something printed for use the next time like a receipt or invoice number.) You'll need to keep track of the last number used somewhere yourself, in a database, INI file, or whatever best suits your needs. When you print a receipt, you read the last value used from that storage, update it, write it back to the storage, and then assign that new number to a label on your receipt (you can use the QRLabel.OnPrint event for that - just use Value := IntToStr(NewReceiptNumber);, where NewReceiptNumber is the variable holding the receipt number).

Categories : Delphi

numbering an output in order
You can use a user variable to get a sequence number within MySQL.:- SELECT Sub1.*,@aCount:=@aCount+1 AS aSequence FROM (SELECT * FROM `story` ORDER BY `submit_date` DESC) Sub1 CROSS JOIN (SELECT @aCount := 0) Sub2 LIMIT 1, 5

Categories : PHP

Jquery - text box numbering preference
Maybe a better way to deal with this kind of UI is to allow the user to sort them without typing. Sorting by dragging feels much more natural and doesn't require interruptions like moving your hand from the mouse to the keyboard several times. Here's an example fiddle using jQuery UI's sortable feature. I've put a class on the top 5 items to highlight those items that have made it into the top 5. Bear in mind :nth-child doesn't work < IE9 so you'd need an alternative way of setting the style in older browsers. http://jsfiddle.net/bxprs/1/ HTML <ul id="sortable"> <li class="item"> <p>Item 1</p> </li> <li class="item"> <p>Item 2</p> </li> <li class="item"> <p>Item 3</p>

Categories : Jquery

Line-Numbering of a textEdit in pyqt
You'll need a separate widget on the side to display line numbers. You can find details here: http://harmattan-dev.nokia.com/docs/library/html/qt4/widgets-codeeditor.html

Categories : Python

Fix numbering on CSV files that have deleted lines
If you need to update the count, then you have to read twice and count the number of rows you are keeping first. You can keep a separate counter to rewrite the first column once you are writing the matched lines: import re numbered = re.compile(r'Nd+').match for fn in fns: # open for counting reader = csv.reader(open(fn,"rb")) count = sum(1 for row in reader if row and not any(r.strip() == 'DIF' for r in row) and numbered(row[0])) # reopen for filtering reader = csv.reader(open(fn,"rb")) with open (os.path.join('out', fn), 'wb') as f: counter = 0 w = csv.writer(f) for row in reader: if row and 'Count' in row[0].strip(): row = ['Count', count] if row and not any(r.strip() == 'DIF' for r in row

Categories : Python

How to restart numbering on PHPWord with addListItem()?
I was trying to solve this myself today and I found a fork of PHPWord called PHPWord2. At the moment the code for numbering restart is only in a work branch. Read more at https://github.com/PHPOffice/PHPWord/issues/10. Examples are included in the work branch.

Categories : Misc

MVC Razor recursive list numbering
You may try something like this : @ShowTree(pages) @helper ShowTree(List<pages> pages, int level=1, string prefix ="") { <ul> @for (int i = 0; i < pages.Count(); i++) { <li> @Html.Raw(String.Format("<h{0}>", level)) @String.Format("{0}{1}", prefix, i + 1) @pages[i].PageName @Html.Raw(String.Format("</h{0}>", level)) @if (pages[i].children.Any()) { @ShowTree(pages[i].children, level + 1, String.Format("{0}{1}.", prefix, i + 1)) } </li> } </ul> }

Categories : CSS

Adding numbering when loading from XML files
set the variable so that if they don't pick one it doesn't error out. Int intLecturerNum = 1; then pull in their answer from the console. intLecturerNum = Convert.ToInt(Console.Readline()); been a while since I had to do this, and I was doing it with a Yes or No and there was a little bit more that I had to do with it so that I would get the right answer to my variable, but this is the general way that you pull in the variable. XElement lecturelist = XElement.Load("lecturer.xml"); Console.WriteLine("Select a lecturer:"); String strProf; Int i = 1; foreach (var mainelement in lecturelist.Elements()) { Console.Write(i.ToString() + " - "); foreach (var subelement in mainelement.Elements()) { if (subelement.Name == "Name")

Categories : C#

Bullet numbering not aligned properly
HTML <div id="navcontainer"> <ul id="navlist"> <li id="active"><a href="#" id="current">Item one</a></li> <li><a href="#">Item two</a></li> <li><a href="#">Item three</a></li> <li><a href="#">Item four</a></li> <li><a href="#">Item five</a></li> </ul> </div> CSS #navlist { margin-left: 0; padding-left: 0; list-style: none; } #navlist li { padding-left: 10px; list-style-type:lower-alpha; }

Categories : HTML

Linux input event interface numbering
If you mean by "mapping" specifying the name of the /dev/input/eventX 'file', you should use Udev. The kernel assigns the number of the event device, it is a bad idea and probably impossible to try and force this number since you never know which other device may have gotten this number first. My recommendation would be to let Udev create a symlink that points to your device; you can choose your own name and use that in your program (i.e. /dev/my_first_keypad). For example, my Wacom tablet is assigned /dev/wacom with the following udev rule: KERNEL=="event*", SUBSYSTEM=="input", SUBSYSTEMS=="input", ATTRS{name}=="Wacom Volito", SYMLINK+="wacom" The trick is to find the proper set of variables to exactly specify your keypad. If it is USB based, the vender/product ID are a good start. Ot

Categories : Linux

North American Numbering Plan regexp
Your link contains info for the match: NPA (Numbering Plan Area Code) - Allowed ranges: [2–9] for the first digit, and [0-9] for the second and third digits. When the second and third digits of an area code are the same, that code is called an easily recognizable code (ERC). ERCs designate special services; e.g., 888 for toll-free service. The NANP is not assigning area codes with 9 as the second digit. NXX (Central Office) - Allowed ranges: [2–9] for the first digit, and [0–9] for both the second and third digits (however, the third digit cannot be "1" if the second digit is also "1"). xxxx (Subscriber Number) -[0–9] for each of the four digits. If you want to omit the +1 at the beginning, then you can use the following to match the 10 digit number. The o

Categories : PHP

Left outer join? Row numbering issue
Perhaps you are looking for something like this: (Removed as not meeting the OP's requirements, as reminded by a comment.) Alternatively, you could also try parametrisation of LIMIT. As of MySQL 5.0.7, LIMIT is parametrisable when used in a statement that is part of a stored procedure or a prepared statement: PREPARE stmt FROM 'SELECT ... LIMIT ?, ?'; EXECUTE stmt USING @offset, @limit; It's worth noting that for this method it would make most sense to have as unambiguous sorting order as possible.

Categories : Mysql

How to set page numbering to start at chosen value in Word
The best way I know of figuring out a way to do stuff in Word is by recording a Macro and then viewing the generated code. It's VB, but it's pretty easy to translate it into C#. In Word 2007, if I record a macro that changes the Start at you're talking about I'm getting the following macro - Sub Macro1() ' ' Macro1 Macro ' ' With Selection.Sections(1).Headers(1).PageNumbers .NumberStyle = wdPageNumberStyleArabic .HeadingLevelForChapter = 0 .IncludeChapterNumber = False .ChapterPageSeparator = wdSeparatorHyphen .RestartNumberingAtSection = True .StartingNumber = 3 End With End Sub You're only interested in changing the StartingNumber property and the translation into C# is straig

Categories : C#

Matlab: Inconsistency in numbering pattern of legend entries
Yes - the way Matlab interprets your statement, it will first "consume" the entire first array, then the second. So if you say sprintf('%d %d ', 1:5, 2:6) the output will be 1 2 3 4 5 2 3 4 5 6 It just so happens that you are getting it "almost right" for a little bit because of the way you were trying to do things and that became confusing. The correct way to achieve what you want is make sure that the order in which variables are consumed by matlab is the order you need. An example of doing this would be sprintf('%d %d ', [1:3; 2:4]) When matlab accesses the array you created 1 2 3 2 3 4 It does so by going down the colums - so it sees 1 2 2 3 3 4 To generate the legend you want, use reshape(sprintf('Zone # %01d and %01d Intersection', [1:ii; 2:ii + 1]), 27, ii)' Wh

Categories : Matlab

numbering column in access causing query to stop responding
Embedded functions like nz() slow your query. They also make your SQL illegible. Improve your tables so nz() is not needed. For example, open your table in design view and give each numeric field a default value of zero. Test each query without the DISTINCTROW keyword. The queries should run faster. I expect it's doing nothing, because I notice each query has an ID record in the SELECT clause. (Just see if the same number of records is returned -- yep, it's doing nothing.) You seem to be grouping by OrderID on a query result that also groups by OrderID. The higher-level GROUP BY is doing nothing. Which means some of your SUM() functions are doing nothing...except being slow. Subquery 2 is a mess (sorry to be blunt). Do you need all those fields? If so, at least have mercy on

Categories : SQL

Indesign (Javascript) footnote as crossref destination destroys numbering
fixed it: i just flipped the order of making the crossrefs. i flipped the following lines backlink_destination = doc.paragraphDestinations.add (footn[i].storyOffset); endnote_destination = doc.paragraphDestinations.add (endnote.insertionPoints[0]); to endnote_destination = doc.paragraphDestinations.add (endnote.insertionPoints[0]); backlink_destination = doc.paragraphDestinations.add (footn[i].storyOffset); and backlink_source = doc.crossReferenceSources.add (endnote, crb); endnote_source = doc.crossReferenceSources.add (footn[i].storyOffset, note_styles.cr_format); to endnote_source = doc.crossReferenceSources.add (footn[i].storyOffset, note_styles.cr_format); backlink_source = doc.crossReferenceSources.add (endnote, crb); and doc.hyperlinks.add(backlink_source, backlink_de

Categories : Javascript

CSV writer will not write first line in file (code contains: dictwriter,numbering lines, values equal to other csv, length of element, etc.)
I don't quite know what you're doing there, but it's much easier: from csv import DictReader, DictWriter with open('file1') as fil1, open('file2') as fil2, open('file3', 'wb') as fcompout: read1 = DictReader(fil1) read2 = DictReader(fil2) writenum = DictWriter(fcompout, fieldnames=read2.fieldnames) writenum.writeheader() for num, line in enumerate(read1): line['Length'] = len(line['Name']) # Length of Name line['Line Num'] = num+1 # Line Numbers writenum.writerow(line) # Write line to new csv You don't need to reassign all those values - just add the ones you need additionally. Result: Line Num,Command,Name,Length,file,Geo Location,NA,Default,IPStart,IPStop 1,,DRE EXT Ascent Media,20,,,,,, 2,,DRE United Kingdom UKLONEX

Categories : Python

Trigger to auto-increment ID based on certain criteria in TSQL
Here's what I would do, rather than having the trigger: create table T (TID int IDENTITY(1,1) not null,FirstName varchar(10) not null,LastName varchar(10) not null,Amt decimal(18,4) not null) go create view V as select FirstName, LastName, ROW_NUMBER() OVER (PARTITION BY FirstName,LastName ORDER BY TID desc) - 1 as InvoiceID, Amt from T go And then set up your initial data: insert into T(FirstName,LastName,Amt) values ('John','Doe',5), ('Bill','Jane',6) go insert into T(FirstName,LastName,Amt) values ('John','Doe',3) And the new John Doe row: insert into T(FirstName,LastName,Amt) values ('John','Doe',3.5) And finally the Jane Smith row: insert into T(FirstName,LastName,Amt) values ('Jane','Smith',2) And then select from the view:

Categories : Sql Server

SQL-like window functions in PANDAS: Row Numbering in Python Pandas Dataframe
You can do this by using groupby twice along with the rank method: In [11]: g = df.groupby('key1') Use the min method argument to give values which share the same data1 the same RN: In [12]: g['data1'].rank(method='min') Out[12]: 0 1 1 2 2 2 3 1 4 4 dtype: float64 In [13]: df['RN'] = g['data1'].rank(method='min') And then groupby these results and add the rank with respect to data2: In [14]: g1 = df.groupby(['key1', 'RN']) In [15]: g1['data2'].rank(ascending=False) - 1 Out[15]: 0 0 1 0 2 1 3 0 4 0 dtype: float64 In [16]: df['RN'] += g1['data2'].rank(ascending=False) - 1 In [17]: df Out[17]: data1 data2 key1 RN 0 1 1 a 1 1 2 10 a 2 2 2 2 a 3 3 3 3 b 1 4 3 30 a 4 It feels

Categories : Python

how to check which image has opacity of 1 in image slider for numbering?
The easiest way would be to have a CSS class that has a opacity: 1.0 property, and then determining which slide currently has this class. Let's say the class is .displayed, then you can find the active slide using $slides.find('.displayed'). And when moving to a new slide, just remove the class property after doing any necessary animations: $slides.find('.displayed').animate({opacity: 0}).removeClass('.displayed');

Categories : Javascript

Numbering Grid Rows in Ext JS Ext.grid.panel
Use the RowNumberer column type. Edit: You must add an extra column of this type. Example: Ext.widget('grid', { columns: { defaults: { // you column defaults }, items: [{ xtype: 'rownumberer' // this is a column type },{ dataIndex: 'foo' ,text: 'Column Foo' },{ dataIndex: 'bar' ,text: 'Column Bar' }] } // ... })

Categories : Extjs

numbering in column and the other column get data from database
You're creating a new ordered list with each record. You're also mixing your ordered list in tables, which doesn't make sense - do one or the other. Maybe something like: <ol> <?php do { ?> <li><?php echo $row["object"]; ?></li> <?php } while ($row = mysql_fetch_assoc($recordset)); ?> </ol>

Categories : HTML

looping through column to find search criteria and paste cell values from another sheet beneath the criteria
Sub StyleProject() Dim wsStyle As Worksheet Dim wsData As Worksheet Dim wsTemplate As Worksheet Dim StyleCell As Range Dim rngFound As Range Dim arrResults() As Variant Dim strFirst As String Dim ResultIndex As Long Dim StyleIndex As Long Set wsStyle = Sheets("Style") Set wsData = Sheets("Item Data") Set wsTemplate = Sheets("Style Template") With wsStyle.Range("A2", wsStyle.Cells(Rows.Count, "A").End(xlUp)) If .Row < 2 Then Exit Sub 'No data ReDim arrResults(1 To 1 + Evaluate("MAX(COUNTIF(" & wsData.Columns("B").Address(External:=True) & "," & .Address(External:=True) & "))"), 1 To .Cells.Count) For Each StyleCell In .Cells StyleIndex = StyleIndex + 1 ResultIndex = 1

Categories : Excel

How can I globally ignore invalid byte sequences in UTF-8 strings?
If you just want to operate on the raw bytes, you can try encoding it as ASCII-8BIT/BINARY. str.force_encoding("BINARY").split("n") This isn't going to get your ü back, though, since your source string in this case is ISO-8859-1 (or something like it): "- MenxFC -".force_encoding("ISO-8859-1").encode("UTF-8") => "- Menü -" If you want to get multibyte characters, you have to know what the source charset is. Once you force_encoding to BINARY, you're going to literally just have the raw bytes, so multibyte characters won't be interpreted accordingly. If the data is from your database, you can change your connection mechanism to use an ASCII-8BIT or BINARY encoding; Ruby should flag them accordingly then. Alternately, you can monkeypatch the database driver to force encoding on a

Categories : Ruby On Rails

arbitrary sequences in "zipped" sequences (mapped sequences actually)
Use map(list, map(None, a, c, d)) Since map(None, ...) is equivalent to itertools.izip_longest(...).. This is better (in 2.x at least) : map(list, itertools.izip_longest(a, c, d)) Here are some examples.. In [100]: zip(a,c,d) Out[100]: [(1, 4, 'a'), (2, 5, 'b')] In [101]: map(None, a,c,d) Out[101]:[(1, 4, 'a'), (2, 5, 'b'), (3, 6, None), (None, 7, None)] In [102]: map(list, map(None, a,c,d)) Out[102]:[[1, 4, 'a'], [2, 5, 'b'], [3, 6, None], [None, 7, None]] In [103]: import itertools In [104]: map(list, itertools.izip_longest(a,c,d)) Out[104]:[[1, 4, 'a'], [2, 5, 'b'], [3, 6, None], [None, 7, None]] Also, it seems you don't understand how to use tuple & list: These 2 function-like objects take an iterable and convert them to a tuple & list respectively. >>>

Categories : Python

Ignore empty cell array and execute the following cell
You can use isempty to check if an element is empty or not: C = cell(5,1); C{2} = 2; for ind = 1:length(C) if ~isempty(C{ind}) disp(['Processing C{' num2str(ind) '}']); end end and never let index of C exceed length(C).

Categories : Arrays

SQL update ignore duplicates
Replace: FROM table_a a with: FROM ( SELECT DISTINCT created_at , user_name , running_count FROM table_a ) a

Categories : Mysql

django bulk create ignore duplicates
Is this not possible? I'm not sure if I used the sliced list correctly but it was my understanding that it allows you to reference a list that is being manipulated in a loop. def insert_many(model, my_objects): # list of ids where pk is unique in_db_ids = model.__class__.objects.values_list(model.__class__._meta.pk.name) if not in_db_ids: # nothing exists, save time and bulk_create model.__class__.objects.bulk_create(my_objects) else: in_db_ids_list = [elem[0] for elem in in_db_ids] to_insert=[] for elem in my_objects: if not elem.pk in in_db_ids_list and not elem.pk in to_insert[:]: to_insert[:].append(elem) if to_insert: model.__class__.objects.bulk_create(to_insert)

Categories : Python



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