w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Unable to use paging despite enabling paging
You are not using PageIndexChanging event and you have to bind PageIndexChanging event and rebind your grid using current page. Html <asp:GridView ID="GVVerify" runat="server" OnPageIndexChanging="GridViewPageEventHandler" AllowPaging="True" AutoGenerateSelectButton="True" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" CssClass="gridviewadminverify" ForeColor="Black" OnSelectedIndexChanged="GVVerify_SelectedIndexChanged" Width="100%"> Code behind protected void grdView_PageIndexChanging(object sender, GridViewPageEventArgs e) { GVVerify.PageIndex = e.NewPageIndex; GVVerify.DataSource = GetGridData(); GVVerify.DataBind(); }

Categories : C#

Problematic function pickling
The main problem with your code is the closuse in "sample_function". Without the closure, it can be done with marshal and types modules, here's some example: import pickle import marshal import types class Foo(): def __init__(self, fun): self.fun = fun def call_fun(self, arg): self.fun(arg) def save(self, f): saved = self.fun self.fun = marshal.dumps(self.fun.func_code) pickle.dump(self, f) self.fun = saved @staticmethod def load(f): foo = pickle.load(f) foo.fun = types.FunctionType(marshal.loads(foo.fun), globals()) return foo def sample_function(arg): arg.effect(4) class Arg(): def effect(self, value): print "ok: " + str(value) With this classes and function, you can save:

Categories : Python

How to I parse problematic strings
In [52]: text = '"motor 1" "12.345 " "motor2" 80 "sonar 8" "Pin 11 On"' In [53]: import shlex In [54]: shlex.split(text) Out[54]: ['motor 1', '12.345 ', 'motor2', '80', 'sonar 8', 'Pin 11 On'] In [55]: [item.replace(' ','') for item in shlex.split(text)] Out[55]: ['motor1', '12.345', 'motor2', '80', 'sonar8', 'Pin11On'] In [56]: ' '.join([item.replace(' ','') for item in shlex.split(text)]) Out[56]: 'motor1 12.345 motor2 80 sonar8 Pin11On'

Categories : Python

Problematic conversion from unsigned_int to size_t
The length member of std::string is a function, so you must call it: for (size_t i = 0; i < str.length(); i++) // Note function call ^^

Categories : C++

ListView very choppy - possible problematic layout
the listView scroll is choppy on certain devices I would strongly recommend that you read Romain Guy's epic blog post about identifying ListView scrolling jank. In particular, watch out for overdraw. Also, I have no idea what imageLoader is, but use StrictMode and/or Traceview to make sure that it isn't doing something stupid like loading images on the main application thread. You might also temporarily remove your pull-to-refresh stuff, to ensure that it somehow isn't the source of your jank.

Categories : Android

Are two instances of return in Python problematic?
If a function does not return anything, it defaults to returning None. Your cube function, instead of printing the result, returns the result so it can be used elsewhere. If it were just print cubed instead of return, then return cube(n) would be equivalent to return None, and this isn't what you want. Because return returns (or in this case, assigns) the value to a variable. In your by_three function, it is useful to have the else: return False, because, as mentioned above, it will otherwise return None. This might not be helpful, because you may need the value False to determine something else later in your code. The reason you were asked to put the returns in the if/else was because that was what Codecademy wanted you to do :p. It's probably not going to be useful for you later during

Categories : Python

Problematic nameless table in Postgresql
If this is NOT about a table which name is not displayable due to encoding / font issues you can do this: Determine the table OID from the system catalogues. Set a new table name in the system catalogues to a temporary name. Use the OID as an identifer Re-rename the table to something useful (or just drop it). This of course assumes, that you have superuser access to the database. The first step - determine the OID from the catalogue: SELECT oid, relname FROM pg_class WHERE length(relname) <= 1; If you don't get any result the table has a name - it is just not displayable. In this case just skip the WHERE part and look with your eyes. The second step - change the system catalogue: UPDATE pg_class SET relname = 'foo' WHERE oid = /*OID from step 1*/; In any case - don't stop h

Categories : Database

Optimizing an InnoDB table and a problematic query
You shouldn't be JOINing on a VARCHAR column (Nickname); you should use the user ID to join those tables. That is definitely slowing the query down and is probably the biggest issue. It would also be easier to follow if you wrote all of the JOINs explicitly instead of at the end in the WHERE clause like this: SELECT Messages.ID AS MessageID, Messages.Message, Messages.TIMESTAMP, Messages.Nickname, Topics.ID AS TopicID, Topics.Title AS TopicTitle, Forums.Title AS ForumTitle FROM Messages JOIN FollowedNicknames ON Messages.Nickname = FollowedNicknames.Nickname AND FollowedNicknames.UserID = 'MYUSERID' JOIN Forums ON Forums.ID = FollowedNicknames.ForumID JOIN Subforums ON Subforums.ForumID = Forums.ID JOIN Topics ON Messages.TopicID =

Categories : Mysql

Why is this commit that sets the RSA public exponent to 1 problematic?
You've essentially asked three questions: What is this code doing? Why is 1 bad? Why was it replaced with 65537? It sounds like you don't have a lot of cryptography background, so I'll try to fill in some of the gaps there as well. What is this code doing? To understand why the original value of 1 was a broken choice, you have to understand a little bit about how RSA works. RSA is a cryptosystem -- a way of performing key generation, encryption, and decryption -- so that you can send messages securely to other people. RSA is a member of a class called public-key cryptosystems, because the key that you use to encrypt messages is public and can be freely known by everyone. The key you use to decrypt messages enciphered with your public key is secret and known only by you, so we call i

Categories : Security

Compile a problematic CSS file with Twitter Recess
The reason recess fails, is because that is invalid css. (You probably know that). And the reason it works anyway on the browser you use, is because browsers assume some web developers just wont use correct syntax and also they want to be compatible with legacy websites, not because the semicolons are optional on css, or because css parsers are supposed to have a quirks mode!. I would use a sed line to clean the css file, and from now on, use correct css code. Here is an example sed line: (backup your css file first!) sed -i '/{/,/}/ { /[}{]/ !{ //*.*[^(*/ )][ ]*$/,/*// !{ s/([^(*/); ])[ ]*$/1;/ }}}' yourcssfile.css This sed line will: Add ;, only to the lines that end without semicolons; that is, if you do have some lines that end with semicolons, you wont end with two semicolon

Categories : CSS

Banning problematic users in a social iOS app without an identifying unique ID?
I think banning like this is not a good idea. Because if the banned user sells his iPhone to someone, the new owner can't use your app. So are you using any user Id for logging in ? If yes. Block them according to the UserId. Blocking them using the device Id is not a good solution (It's my suggestion)

Categories : IOS

DataGrid edition 'EditItem' is not allowed for this view` when bound to a WPF DataGrid
I tried this and the problem is that you have initialized your Level2 collection as Hashset<>. IEditableCollectionView.EditItem() throws this error while trying to update item in Hashset<>. I initialized the collection as List<> and it was working fine. I am not sure why it is not able to update item in hashset, need to look deeper into it. But changing the Hashset<> to List<> will fix this error. Hope it helps Thanks

Categories : C#

Silverlight Datagrid scrolling, DataGrid fires RowLoading event
The RowLoading event is fired because rows are virtualized. With virtualization, rows are created (and loaded) only when they are visible on screen. So every time you scroll down or up a new row is created, loaded and the RowLoading event fired. To disable the virtualization you can try to set this property: VirtualizingStackPanel.VirtualizationMode="Standard" Be aware that this can slow down the performance of your grid if you have a lot of rows.

Categories : Database

Find "problematic" rows in a mysql table that will fail to export
I don't know why this "block" ... but the script will only work for very basic databases. For example, how does it handle foreign keys constraints? This is only a suggestion, and probably you have discarded it on purpose, but why not using mysql_dump? From your shell: mysql_dump -h host -u user -p my_database > db-backup.sql EDIT: As suggested by Riggs Folly, phpMyAdmin has backup facilities and is usually available on hosting. In fact, even if not available on your hosting, you could still install it on your http server and configure it to access the remote DB server: http://www.mittalpatel.co.in/access_mysql_database_hosted_remote_server_using_phpmyadmin

Categories : PHP

Binding ComboBoxColumn to collection from DataGrid's ItemsSource in WPF DataGrid
MSDN: DataGridComboboxColumns says: To populate the drop-down list, first set the ItemsSource property for the ComboBox by using one of the following options: A static resource. For more information, see StaticResource Markup Extension. An x:Static code entity. For more information, see x:Static Markup Extension. An inline collection of ComboBoxItem types. So basically to just bind to data object`s collection property it`s better to use DataGridTemplateColumn: <DataGridTemplateColumn Header="Log"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <ComboBox ItemsSource="{Binding log}" /> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> This type of c

Categories : Wpf

Copy selected row from datagrid at the end of datagrid
For Datagridview Databound you have to commit additional record to datasource (table) So, you have to do "INSERT INTO mytable ( fields here ... ) VALUES ( values here ..)" then to refresh your datagridview .. dt2.datasource = mytable ADDED : For your code ... try change like this insert_cmd.Parameters.AddWithValue("@Name", .item("Name")) insert_cmd.Parameters.AddWithValue("@Age", .item("Age"))

Categories : Sql Server

Validating A WPF Datagrid Against Data From Another Datagrid
From Microsoft official WPF course materials: ValidationRules are only to be used as simple validations (For instance Required fields, numeric formats, etc). If you need advanced / complex Business Rules validation, you should either implement IDataErrorInfo or create your own validation mechanism (that's what I did and it works like a charm)

Categories : C#

Master-Detail: On row click in master (DataGrid), display details (DataGrid)
If you searched online, you would have found a number of answers. For example, please take a look at the following articles: WPF Master Details MVVM Application Implementing a simple Master-Detail scenario for WPF in MVVM MVVM - Master Detail

Categories : Wpf

Copying data from a datagrid view to a new form with a new datagrid view VB
"Error 1 Reference to a non-shared member requires an object reference." As this message says: You need a instance of form2 - object of type form2created with New sub, which you created inside of BTN_Next_Click. But local variable frm_PI_01 can be used only inside of that function. With name of class form2 you can used only Shared member or functions/subs MSDN Shared members in VB My opinion if you need transfer some information/variables from form to another then in your case(when you transfer data only once when creating form) use a parameters in form constructors. Add another parameter to you form3 constructor. For example reference of your datagridview(this is may be not good practice referenced controls to another form, better create some variable with needed data and reference th

Categories : Vb.Net

How to add a new row in sql from datagrid and update sql row from same datagrid?
This article on codeproject does a nice (thorough) job of demonstrating what you are asking. It also comes with some demo code. http://www.codeproject.com/Articles/37430/Datagrid-Editing-Updating-Cancel-Selecting-Rows

Categories : SQL

Binding datagrid in datagrid
You have problem with DataContext here. In RowDetailsTemplate you trying to binding to a property in main view model, but DataContext of RowDetailsTemplate is the row item. If you want to binding to property in your main view model you should use RelativeSource binding. Try this: <DataGrid ItemsSource="{Binding Path=Files}" SelectedItem="{Binding Path=DataContext.CurentFile, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" AutoGenerateColumns="False" > ...

Categories : Wpf

How can embed datagrid in datagrid
I don't think it's possible. You can indeed manually replace a cell with the HTML of another grid (your "child" grid), but Dojo maintains its data in a store. Your store won't be "aware" of any changes you make in the DOM nodes of your grid, and inserting a DataGrid in a store isn't possible either since the DataGrid maps its columns to properties of the data objects.

Categories : Database

Ajax Paging Mvc 4
I solved my problem. I changed a partial view: @model PagingListViewModel<PostViewModel> @{ Layout = Request.IsAjaxRequest() ? null : "~/Views/Shared/_Layout.cshtml"; } @foreach (var post in Model.Items) { @Html.DisplayFor(_ => post,"Post") } @Html.DisplayFor(x => x.PageInfo) And added attribute to a link data-ajax-update="...".

Categories : Asp Net Mvc

How to sum rows after paging?
SELECT calendar.datefield AS DATE, SUM(contract.time_slots) AS Slots_taken FROM contract RIGHT JOIN calendar ON calendar.datefield BETWEEN contract.start_time AND contract.end_time GROUP BY DATE LIMIT 600 , 30

Categories : Mysql

Paging in PHP Laravel
To use pagination call paginate() instead of get(). In your case that would be: return View::make("stories.index") // ... ->with("stories", DB::table('stories') ->order_by('id', 'desc')->paginate(3)); Then in the view just remember to iterate over $stories->results.

Categories : PHP

Best way to do paging using redbeanphp?
First off, that won't do anything for pagination. You need to be passing a page and possibly amount to the server to paginate. Other than that, you are doing it right. $page=1; $limit=10; $all=R::findAll('needle','ORDER BY title LIMIT '.(($page-1)*$limit).', '.$limit); Your other option is to select them all and then return only the portion the user is to view, but this is a bad idea if you have thousands of records: $needles=R::findAll('needle', 'ORDER BY title'); $page=1; $limit=10; $all=array_slice($needles,(($page-1)*$limit),$limit,true); To find total pages: $needles=R::count('needle'); $totalPages=ceil($needles/$limit);

Categories : PHP

Paging my Datatable
Paging is based off sorting. Consider a SELECT statement like this: SELECT TOP 10 * FROM Customers WHERE CustomerId > 0; That would return you the first 10 customers in the table. Now, when you want the next page you would need to build a statement like this: SELECT TOP 10 * FROM Customers WHERE CustomerId > @CustomerId and provide a value to @CustomerId. That value would be the CustomerId of the last displayed row.

Categories : C#

UICollectionView with Paging
You can override the method - (UICollectionViewCell*)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath so that, for example, for indexPath.item corresponding to the item number 3 (looking at your example because normally counting starts at 0), you will return the cell object adequate to the data object number 5 from your collection of fetched elements or other array of objects.

Categories : IOS

PHP paging from MySQL
Have you included the clear() function? Look at line: $current_page = !isset($_GET['page']) ? 1 : (int)clear($_GET['page']); If you have not included the function then you will get a fatal error in the execution of the script. Try to remove the clear() all together and see what happens, the changed line should be $current_page = !isset($_GET['page']) ? 1 : $_GET['page'];

Categories : PHP

Paging With Repeater
Have a look at : void lbl_click(object sender, EventArgs e) { LinkButton lnk = sender as LinkButton; int currentPage = int.Parse(lnk.Text); int take = currentPage * 10; int skip = currentPage == 1 ? 0 : take - 10; FetchData(take, skip); } What you are saying is that you will display 10 times the number of the currentpage in rows. For instance if you are in page 4 you are going to display 40 rows, whereas in page 5 you will display 50 rows. Then you dictate how many rows to skip, so in first page you will skip none, but in page 4 you will skip 40 - 10 = 30 rows. What you should do is take always a predefined set of rows, ie 10 and then the skip to be a variable. For instance you should have your code as: void lbl_click(object sender, EventArgs e) { LinkButto

Categories : Asp Net

Paging in jsp page
Instead of implementing this yourself, I would suggest you to use some opensource library. Display Tag (http://www.displaytag.org/1.2/) is one of such librrary that can help you add pagination capability to your data. This custom JSTL library also ease the implementation of tabular data in your web application in several areas. Do explore it beyond it's paging capability.

Categories : Java

Paging not working in Ext JS
Make sure you got the total property: ... total: 'value.total', pageSize: 5, ... The total property is necessary to be given in your data response for the store. Try not to autoload the store but after creating store and toolbar, call store.load()

Categories : Extjs

Get current URL for paging
Maybe pass in a current_page variable? forum/?action=thread&threadid=10&current_page=5&page=2&page=3&page=4&page=5&page=6&page=7&page=8&page=9 Then you could do: $_GET['current_page']

Categories : PHP

gridview search and paging in C#
There's a simple answer by Rick Mohr on how to do this using BindingNavigator and BindingSource. You may also want to look at some other articles/implementations on CodeProject. DataGridView With Paging Step by Step Paging in DataGridView A simple way for Paging in DataGridView DataGrid Paging

Categories : C#

iOS UITableViewController with paging dynamically
UITableView i think inherits from UIScollView, so you can try saying [tableView setPageEnabled:YES]; if that doesn't work, you could try getting the subviews of a table view [tableView subviews]; and one of the elements will be a scroll view, but read the documentation to be sure that you are allowed to manipulate the hirearchy of a UITableView If all else fails, add a gesture control to the tableView and put in vertical gestures and then call the method scrollToRowAtIndexPath:atScrollPosition:animated: as well as a left gesture for going back, but then you don't have fluid animation that a scroll view gives. Props to anyone who has a good valid solution to this.

Categories : IOS

ios app engine endpoints paging
Check out the paging sample from the documentation. In order for the paging parameters to be included in your API, you'll need to explicitly include them in your method: @Brand.query_method(query_fields=('limit', 'pageToken'), path='brand', http_method='GET', name='brand.list') def brand_list(self, query): """Exposes an API endpoint to query for brands for the current user""" return query.order(Brand.name) The default value of the query limit is 10. You can change it but you should set a reasonable limit. It is the limit_default field in query_method.

Categories : IOS

paging with knockout and breeze
There are a few problems that I see up front - You are passing two parameters into the executeQuery method, the second of which is your success callback - but you are passing it your observable instead. This shouldn't break your query, but I am curious as to what the purpose is. You are probably trying to just execute the query and then execute the querySucceeded method when your promise is returned - return manager.executeQuery(query) .then(querySucceeded) .fail(queryFailed); The Q error you are getting is something I get 90% of the time when a promise is not returned back properly. I don't see anything that should work the first call and not the second. I am curious what happens when you hit your URI outside of your Breeze query. One other thing that I would hi

Categories : Knockout Js

WPF C# Paging in Wrap Panel
Put your wrapPanel1 inside a ScrollViewer. <ScrollViewer VerticalAlignment="Center" HorizontalAlignment="Center" Height="400" Width="1038"> <WrapPanel Name="wrapPanel1" /> </ScrollViewer> Try arranging your UI in XAML with RowDefinitions <Grid> <Grid.RowDefinitions> <RowDefinition Height="80"></RowDefinition> <RowDefinition Height="Auto"></RowDefinition> <RowDefinition Height="40"></RowDefinition> </Grid.RowDefinitions> <WrapPanel Grid.Row="0" HorizontalAlignment="Center" Name="wrapPanel2" Background="Aquamarine" Width="1000"></WrapPanel> <ScrollViewer Grid.Row="1" Height="400" Width="1038" CanContentScroll="True" HorizontalScrollBarVisibility="Auto" Ver

Categories : C#

Server-side paging possible?
You can do the below to handle this server side. Provide your own query method in the repository The cypher query should use order, skip and limit and parameterize them so that you can pass in the skip and limit values on a per page basis. E.g. start john=node:users("name:pangea") match john-[:HAS_SEEN]-(movie) return movie order by movie.name? skip 20 limit 10

Categories : Java

Paging not working Asynchronously
I found the error in my Javascript code. There is typo in the following code $.ajax(options).done(function (data) { var target = $a.parents("div.pagedList").attr("data-otf-target"); $(target).replaceWith(data); }); return false; "data-otf-target" should be "data-AL-target". Replace the above code with following $.ajax(options).done(function (data) { var target = $a.parents("div.pagedList").attr("data-AL-target"); $(target).replaceWith(data); }); return false; and add a condition in the If clause in controller and everthing works great :) if (!String.IsNullOrEmpty(model.SearchButton) || Request.IsAjaxRequest())

Categories : Asp Net Mvc



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