2018-10-22         Les

Problem adding item to sortable list

I'm not entirely sure how to post this question, but here goes...I have a web app that has a list of sortable items. I sort them ajax style using Sortable. That works like a charm. I can drag and drop the items till my heart is content.At the same time, there is a button that allows for the creation of new items on my list. This is also ajaxified and works for the most part. The new item appears on my list anyway, and firebug shows that the code being rendered is exactly the same as the other list items. Oh and it is contained in the correct list. The problem is that...

 javascript                     1 answers                     4 view
 2018-10-22         Les

In App or Paypal integration with iPhone App

I am developing an iphone app and it demands me to sell some real world products with it. I know that guidelines of Apple would not permit me to sell them through In App purchase functionality, So for now i am concentrating more on paypal integrated way. Still, i have ambiguities in mind whether it would be appropriate way or not because i have gone through several forums which says that apple reject such applications. Any input on it would be great help.Thanks in advance An iOS application I developed offers 2 payment methods instead of in-app purchasing (also for real...

 iphone                     1 answers                     96 view
 2018-10-22         Les

Implement "Remember Me" Django

I'm currently trying to implement "Remember Me" feature in Django.I'm using both SessionAuthentication from Django REST framework and JSONWebTokenAuthentication from djangorestframework-jwt.However, I don't know how to implement the concept of "Remember Me" for these two authentications. Like how do I extend the session forever and how do I extend the token forever (I'm using JWT auth for mobile & desktop - Session auth for browser).Also, what is the secure way to implement this feature for both authentications? There are a few things here that I should make clear ah...

 python                     2 answers                     3 view
 2018-10-22         Les

How can I restrict user from accessing some specific urls?

I have created a view which allow user to delete a specific Booking provided with id but I dont want other user except the user associated with the Booking object to delete it. How I can restrict user to access urls which delete booking they not own.The urls:path('manage/', views.ManageView, name='manage'),path('manage/delete_booking/(?P<pk>\d+)', views.delete_booking, name='delete_booking'),The views:@login_requireddef delete_booking(request, pk): booking = Booking.objects.get(pk=pk) booking.delete() return redirect('manage')@login_requireddef ManageView(req...

 django                     1 answers                     40 view
 2018-10-22         Les

Python remove space from string make it into int

How would I remove the space in <span id="balance">1 268</span> and make it an intCode: Balance_afterWinORLoseBet.replace(" ", "") Balance_afterWinORLoseBet = int(balance_new.text) #Makes new var, turns it into int.if "10.1" in countdown_timer.text: # Balance_afterPlaceBet.replace(" ", "") Balance_afterPlaceBet = int(balance_old.text) #Makes new var, turns it into int.Error: Balance_afterWinORLoseBet = int(balance_new.text) #Makes new var, turns it into int. ValueError: invalid literal for int() with base 10: '1 268' None of the other answer...

 python                     4 answers                     92 view
 2018-10-22         Les

Django / React Router DOM - Landing on a url not specified in django

I'm building an app with django as the backend api and react as the frontend framework. When landing on an empty pathname url such as www.fakeapp.com/ django shows a frontend app view which renders an index page built with react.Inside the react SPA I have <Link>s which update the <BrowserRouter>s <Route>s and might send you to the path /user/register (which is working fine). However, if I refresh the page with the new pathname www.fakeapp.com/user/register django doesn't recognize the url and throws an error.I'm not sure the best path to take here since t...

 django                     2 answers                     56 view
 2018-10-22         Les

How to use custom fonts in DrawerLayout and NavigationView

I want to use Android's DrawerLayout and NavigationView for menus, but I don't know how to have the menu items use a custom font. Does anyone have a successful implementation? use this method passing the base view in your drawer public static void overrideFonts(final Context context, final View v) { Typeface typeface=Typeface.createFromAsset(context.getAssets(), context.getResources().getString(R.string.fontName)); try { if (v instanceof ViewGroup) { ViewGroup vg = (ViewGroup) v; for (int i = 0; i < vg.getChildCount(); i++) { ...

 android                     2 answers                     89 view
 2018-10-22         Les

SQL joining three tables returns extra NULL row

I am joining three tables to see how long it takes a property maintenance person to do a task. I need the property name, what the task was, how long it took, and who the person was.The catch is that some tasks got entered into the system with no one's name, which is totally fine so it renders as NULL. But to track how long it took to do a task, the tasks that had no name show fine as None with no time. That is fine. The tasks with a person's name on it, show two rows - one for the dude and one for NULL.I don't want the NULL/None if a guy's name is on the task. Below you...

 sql                     1 answers                     55 view
 2018-10-22         Les

Why do we care about data types?

Specifically, in relational database management systems, why do we need to know the data type of a column (more likely, the attribute of an object) at creation time?To me, data types feel like an optimization, because one data point can be implemented in any number of ways. Wouldn't it be better to assign semantic roles and constraints to a data point and then have the engine internally examine and optimize which data type best serves the user?I suspect this is where the heavy lifting is and why it's easier to just ask the user rather than to do the work.What do you think? ...

 sql                     15 answers                     72 view
 2018-10-22         Les

Is it possible to perform an operation before routing to views in django

I have the main urls.py that includes other apps urls.py, then calling the corresponding view. However, I have an operation that needs to be performed everytime before doing anything, whatever the app. Is it possible to perform an operation before routing to the view ? Yes what you describe here is middleware [Django-doc]. You can see middleware as a set of decorators that are wrapped over every request-response cycle: you thus have the freedom to perform certain tasks before the request is passed to the view, and after the response comes back from the view.In fact you ...

 django                     1 answers                     14 view
 2018-10-22         Les

sqlsrv_fetch_array() expects parameter 1 to be resource

To sum it all up, I am working on an project which includes.MSSQL server 2008, ISS 7, PHP I want to use $_SESSION but when I use it this appears in the logging of ISS7PHP Notice: Undefined index: Username in line 14PHP Notice: Undefined index: Afdeling in line 15PHP Notice: Undefined index: Mail in line 16Here is the script for those errors:session_start();include_once("connect.php");if (isset($_POST['username'])) { $username = $_POST['username']; $password = $_POST['password']; $tsql = "SELECT id, username, afdeling, mail FROM dbo.login WHERE username='...

 php                     2 answers                     33 view
 2018-10-22         Les

Swift: casting un-constrained generic type to generic type that confirms to Decodable

SituationI have a two generic classes which will fetch data either from api and database, lets say APIDataSource<I, O> and DBDataSource<I, O> respectivelyI will inject any of two class in view-model when creating it and view-model will use that class to fetch data it needed. I want view-model to work exactly same with both class. So I don't want different generic constraints for the classes// sudo codeViewModel(APIDataSource <InputModel, ResponseModel>(...))// I want to change the datasource in future likeViewModel(DBDataSource <InputModel, ResponseMode...

 swift                     2 answers                     58 view
 2018-10-22         Les

conditional formatting excel: identifying and coloring duplicate value cells within a single row (row only) for an entire set of data

I'm trying to figure out how one can conditionally format (or create a macro if necessary) a single row to identify cells with duplicate values within the columns for that row (and highlight these yellow) and then drag using the format painter for an entire dataset (100+ rows) so that all duplicates are identified that are row specific ( does not take in to account duplicates cell values within different rows). I have manually done the below attached example. If there is a better way to do this please let me know.example of duplicates, but manually doneMany Thanks You ca...

 excel                     1 answers                     38 view
 2018-10-22         Les

In VM of Azure, concurrent processing

In VM of Microsoft Azure,I want this experiment.step 1. creating two VM. (vert easy...)step 2. i want 'concurrent processing' with one work on two created VM (want to know..this is possible or impossible.)in this experiment, i want to know that concurrent processing in VM of Microsoft Azure is possible.and... if concurrent processing is possible, i want to know a proper work which will be done properly between two VM.(sorry... i'm not skilful in english... 'a proper work' is whatever will be done in two VM)(i don't have good thinking about "one work". please advise your ...

 azure                     1 answers                     50 view
 2018-10-22         Les

Increase Caching "Javascript loaded from CDN" in GoogleAMP enabled page?

I don't have much experience with caching using .htaccess. I found some snippets and that worked for static resources (like imgs, js, css etc), but in my project I have to include a CDN that has a different expiration time.How can I increase my CDN cache time without it affecting my PageSpeed at Google insights.I have attached the image as well: what you need to do is to import all the .js files dynamically into our website. To do on PHP use the file_get_contents() function.The first thing to do is to locate the external script:<script type="text/javascript" src="http...

 .htaccess                     2 answers                     45 view
 2018-10-22         Les

Spark Processing file with different structure

My file contains multiple rows that have different structure. Each column is recognized by position depending on the type of row.For example, we could have a file like this:row_type1 first_name1 last_name1 info1 info2row_type2 last_name1 first_name1 info3 info2row_type3info4info1last_name1first_name1 We know the position of every column for every row type, we can use substring to get them.The target dataframe will be "first_name1,last_name1,info1,info2,info3,info4) with no duplicated (first_name1,last_name1)The info1 for example is duplicated in the first and 3rd row....

 scala                     1 answers                     12 view

Page 1 of 146  |  Show More Pages:  Top Prev Next Last