JInx 123

1

votes
0

answer
232

views

Django Custom User Error: FOREIGN KEY constraint failed

I'm following the Django document Customer user and proxy model to create a custom user model. The code is exactly same, I just copy the while brunch of the code into my project. But it's showing up an error. django.db.utils.IntegrityError: FOREIGN KEY constraint failed Error enter image description...
Jinx
1

votes
0

answer
66

views

Google API with RIOT API fail JSON parsing

Some one can help me here ? Exception in thread 'main' net.rithms.riot.api.RiotApiException: Failed to parse the JSON response at net.rithms.riot.api.request.Request.getDto(Request.java:288) at net.rithms.riot.api.request.Request.getDto(Request.java:252) at net.rithms.riot.api.EndpointManager.callMe...
Hinata Jinx Chan
1

votes
0

answer
46

views

How do I install chromedriver in a specific directory (/app/assets/chromedriver) on Heroku?

Problem I have been playing around with a Python script using Selenium, which works fine locally (as I have ChromeDriver installed in the correct directory, which is assets/chromedriver), but it does not work on Heroku. A summary of the error message I get is this: 'chromedriver' executable needs to...
Jinx
1

votes
1

answer
41

views

FFmpeg - resampled audio with much noise

I'm not familiar with auido resampling. I tried to resample auido streams from two videos. The first one's output was close to the original but with noise, the other one was almost full of noise. Information for the first one 128 kb/s, 48.0kHz, 2 channels, AACLC Information for the second one 384 kb...
Jinx
1

votes
2

answer
213

views

How can I return a list of records based on contiguous time assignments in SQL Server 2000

I have a Table that looks like this: IP Hostname TransactionDate ------------- ---------- ------------------- 1.1.1.1 A 2009-01-01 01:00:00 1.1.1.1 A 2009-01-02 01:00:00 1.1.1.1 A 2009-01-03 01:45:00 1.1.1.1 B 2009-01-04 01:00:...
Tequila Jinx
1

votes
2

answer
891

views

Can I define a Perl-like binding operator (=~) in C#?

I really like being able to use =~ and !~ in Perl to evaluate a string against a regular expression. I'd like to port this functionality over to C#, but it appears that, while you can overload operators, you can't create new ones. I'm considering extending the string type to provide a Match() method...
Tequila Jinx
0

votes
0

answer
7

views

Qt - steps to using QOpenGLWidget to display images

I'm trying to use a QOpenGLWidget to show some images instead of using QLabel. But I'm a bit confused about how to do this. To make the widget get the job done, I know I need to reimplement the initializeGL() method and paintGL() method. To get the texture of an image, what I used is SOIL_load_imag...
Jinx
1

votes
3

answer
871

views

JavaScript insert element at point of execution

Is it possible to insert DOM HTML element at the point of execution of tag? Like with document.write() function which immediately inserts text into DOM when executed. [UPDATE] Yes it is! Here's what I came up with: var injectElement = function (element) { //Function that generates random id var ran...
Jinx
1

votes
2

answer
2.6k

views

XPath Query to check if td has certain children (C# + Selenium)

I hope someone can help me out, I am stuck with an XPath expression. I have the following HTML extracted from a a tennismatch with C# and Selenium: 21:00 Set 3   Barrientos N. (Col) 1 7 2 4     15 Lapentti G. (Ecu) 1 5 6 5     30 Out of this I want to extract which player is currently serving,...
jinx
1

votes
1

answer
30

views

Make 2 urls equivalent with .htaccess and serve it as RSS

I have link that looks like this: mydomain.com/index.php?option=com_obrss&task=feed&id=2:rss1klik&format=feed&Itemid=160 That link serves what's supposed to be RSS 2.0 but it serves it as plain text instead of RSS. I'd like to turn that first link into this: mydomain.com/index.php/rss/rss1klik And a...
Jinx
1

votes
1

answer
161

views

Bigcommerce-Transitioning from Blueprint to Stencil

I am going to translate my bigcommerce store from buleprint to stencil. Because My site is live now, I am afraid if there will be something wrong when I translate it to stencil theme. So I want to know if I need to backup something firstly or if there are something I need to notice.Can someone help...
jinx
1

votes
1

answer
113

views

C++ - Unexpected output from std::string

I'm writing a function which returns a string. But something weird happened. The output of the result string was printed as an unexpected thing from the console. It becomes Chinese or something else or EMPTY STRING depending on the machine (TESTED). But this only happens when the input string is su...
Jinx
1

votes
1

answer
395

views

Django - override save method

I'm overriding the save() method for a model in Django, but it's not working properly. I want the book_quantity to update automatically each time when, I edit the number of books in a cart and click save button. For instance: I've already changed the number of the book from 0 to 11 and clicked the...
Jinx
1

votes
4

answer
2.4k

views

Nonlinear regression with python - what's a simple method to fit this data better?

I have some data that I want to fit so I can make some estimations for the value of a physical parameter given a certain temperature. I used numpy.polyfit for a quadratic model, but the fit isn't quite as nice as I'd like it to be and I don't have much experience with regression. I have included th...
Jinx
1

votes
1

answer
102

views

Django - a migration was detected, but saying no migrations to apply

I added a new field slug = models.SlugField(unique=True, null=True) to a model. A new migration was successfully detected. (venv) 192-168-1-201:shop jinx$ python manage.py makemigrations book Migrations for 'book': book/migrations/0014_book_slug.py - Add field slug to book But when I tried to apply...
Jinx
1

votes
1

answer
211

views

Django - POST method error “POST /…/ HTTP/1.1” 405 0 with Ajax

I use the POST method since I need to change the database. But each time I used the POST method, this error occurred. Every time I click the button, the page will not be loading and saying 'POST /book/go-action/ HTTP/1.1' 405 0. There is no difference when I use q = request.POST['quantity'] or q = r...
Jinx
1

votes
1

answer
0

views

FFmpeg - confused with the concept of audio frame size and its calculation

I'm learning video and audio codecs with FFmpeg. I'm strgulling to understand frame size and some other concepts. Frame size This is the size in bytes of each frame. This can vary a lot: if each sample is 8 bits, and we’re handling mono sound, the frame size is one byte. Similarly in 6 channel au...
Jinx
1

votes
1

answer
0

views

FFmpeg - avcodec_receive_frame returns AVERROR(EAGAIN)

I'm using an QOpenGL widget to draw frames. However, I'm struggling to get frames by using avcodec_receive_frame. It ended within the block else if (ret == AVERROR(EAGAIN)) and returned -11. I have no idea what made this happen. Also I checked that codecs were fine, so I guess the problem wasn't cau...
Jinx
1

votes
5

answer
0

views

web.config in js

How to get the web.config elements value in Javascript file? I need the value of appSettings key's value in javascript file(not in aspx). What approach should I use to get this value? web.config
jinx
1

votes
1

answer
0

views

how can i authenticate an html control in a .aspx page

how can i authenticate an html control in a .aspx page. For eg. I have two labels :: lblusername and lblpassowrd, two textboxes to fetch the values from the user and a submit button. I want all these controls to be of html controls not the asp.net server side controls, authenticate whether the passw...
jinx
1

votes
1

answer
928

views

replacing text in multiple elements in an XML file

I have multiple endpoints in an XML doc where I am trying to replace some of the address strings. I don't want to replace the same text in the entire doc just in the endpoints. So I have tried to narrow it down and tried different ways but I cannot get it to work. This is my most recent attempt. Am...
Jinx
1

votes
1

answer
1.3k

views

Calling a sql server stored procedure with output parameter when using Simple.Data

Using Simple.Data, I would like to get the result from an output parameter in a stored procedure. Let's say I have the following SP (disregard the uselessness of it): CREATE PROCEDURE [dbo].[TestProc] @InParam int, @OutParam int OUTPUT AS BEGIN SELECT @OutParam = @InParam * 10 END When I call it wit...
Captain JiNX
1

votes
1

answer
399

views

LESS generate comma separated class names

I know how I can generate separate class names like: .class1 { } .class2{ } .class2{ } ... But if I want all of them to have 10 px margin, that generates lot's of repeated code. Can I generate something like: .class1, .class2, .class3, ... { //Common properties } in LESS?
Jinx
1

votes
2

answer
200

views

POST or GET method?

We have a service provider that allows us to connect to his payment page for payments, however the code he uses is php but we would like to do it in asp.net. Problem is I don't really understand what the method should be, POST or GET, basically we need to redirect to the client with underlying param...
jinx
2

votes
2

answer
42

views

Django - URL and namespace

I'm building a Django template in the Book app and using URL tag to redirect to the Account app's URLs. But it says account' is not a registered namespace. book.urls: app_name = 'book' urlpatterns = [ path('', views.HomePageView.as_view(), name='home'), path('account/', include('account.urls', names...
Jinx
19

votes
4

answer
23.4k

views

How To Reduce Python Script Memory Usage

I have a very large python script, 200K, that I would like to use as little memory as possible. It looks something like: # a lot of data structures r = [34, 78, 43, 12, 99] # a lot of functions that I use all the time def func1(word): return len(word) + 2 # a lot of functions that I rarely use def...
Coo Jinx
5

votes
2

answer
1.3k

views

Python : compare two files with different line endings

I have two files. File test.a and test.b. test.a was pre-generated on unix machine. test.b is generated by user and can be generated both on windows and unix machines. I can't use filecmp.cmp('test01/test.a', 'test01/test.b') because it'll always return false, all thanks to different line endings. I...
Jinx
1

votes
1

answer
141

views

Python nondeterministic epsilon authomaton : object is not iterable

I have to make non-deterministic finite automaton with epsilon transitions. I'm more of a c, c#, JavaScript guy, but my university thinks python is the only way to go for some reason, so today I learned python, but obviously not enough. Anyway. Problem is in 'automaton' function. I call it with init...
Jinx
2

votes
2

answer
1.6k

views

Extending @NotEmpty to accept other classes

I've been trying to make a custom validator so i can just use the @NotEmpty annotation for specific classes (java.util.Calendar or CommandItem in this case). But i get an exception: javax.validation.UnexpectedTypeException: No validator could be found for type: com.bla.DocumentCommandItem Now, the...
Jinx
1

votes
3

answer
451

views

Powershell - the if statement in a function only uses the first if even though the criteria is not met

I have the following function but no matter what $Server I specify, the first if statement is always used even though the criteria is not met. This causes the wrong credentials to be used. I've tried numerous re-writes '' in different places, with and without wildcards but I always have the same iss...
Jinx
2

votes
1

answer
267

views

Restrict php file in .htaccess based on mode/query string

I want to restrict access to a specific file (ucp.php), but ONLY in registration mode. Ie, someone will have to authenticate in order to register, but once registered will be able to access other ucp.php functions (profile editing, for example), without being required to authenticate again. Since u...
Jinx
2

votes
1

answer
45

views

Removing square brackets from hash array for value

I am having a following hash array A = [{'name' => ['xx'], 'status' => ['true']}, {'name' => ['yy'], 'status' => ['true']} I tried following code to remove the square brackets A.to_s.gsub('\\[|\\]', '') also tried with code p A.map { |hash| hash.each_with_object({}) { |(k, v), hash| hash[k] = v.firs...
Jinx
3

votes
3

answer
516

views

PHP adding empty text node before including html file

I'm using php as templating engine, and I've noticed that when I include view file, empty text node is added before content of that view. For example, I have html file I want to include that has following content: Some text than I include that file like this: (notice that I've removed any spaces bet...
Jinx
3

votes
2

answer
2.5k

views

Displaying multiple images in one datalist template cell

I know there's a lot of questions about the subject, but my situation is sort of different. I'm trying to display 3 images in one datalist cell, for example I have a product table in SQL server that can have multiple images. Image Mapping table ID URL_Mapping_ID ProductID 1 image 1.png...
jinx
2

votes
2

answer
3.1k

views

Windows user home folder in C (MinGW)

I'm trying to port an application written in C from linux to windows. At the moment I'm done fixing the 'hard' parts like missing posix features and the like. The application compiles, links and works on Windows now (except for the fork() stuff which will be replaced with windows service code later)...
the JinX
2

votes
3

answer
9.4k

views

Best way to implement unsupported paypal currency into woocommerce

I'm making a webshop and I'm using woocommerce. The problem is following: My customer wants to sell only in Croatia, for now which means I have to display price in Kunas (HRK)... I have PayPal gateway for woocommerce, and I have implemented Croatian Kuna into woocommerce system by using following co...
Jinx
2

votes
2

answer
5.2k

views

Override joomla category list view

I'm trying to change category title in joomla category list (list of all articles in a certain category) but I simply can't find the right file to override. Files are supposed to be in components\com_content\views\category\tmpl and there's default.php that renders wrapper with a class of .category-l...
Jinx
7

votes
3

answer
10k

views

XML Return from an Oracle Stored Procedure

Unfortunately most of my DB experience has been with MSSQL which tends to hold your hand a lot more than Oracle. What I'm trying to do is fairly trivial in tSQL, however, pl/sql is giving me a headache. I have the following procedure: CREATE OR REPLACE PROCEDURE USPX_GetUserbyID (USERID USERS.USERID...
Tequila Jinx
2

votes
2

answer
618

views

Case Insensitive search in containment filter

I need to perform Case Insensitive search in containment filter instead of using the exact case sensitve matching. def filter(request, fname, fvalue): list = HmsPatient.objects.filter(**{fname:fvalue}) c = {'list' : list} return render_to_response('patient/list.html', c, context_instance=RequestCont...
JInx 123
2

votes
1

answer
355

views

Bigcommerce why is cart url different from other url

I am developing my site with a bigcommerce stencil theme. My site's domain is 'www.mydomain.com', but my cart url is 'https://store-xxxxxxx.mybigcommerce.com/cart.php'. Why are they different?
jinx

View additional