ytyng.com

Latest Articles

Page 13
Linux
2017-02-03 00:40 (9 years ago)
What to Do When 'geckodriver' Executable Needs to Be in PATH in Ubuntu's Selenium

Trying to run Selenium on Ubuntu from Python

Django
2017-01-26 04:11 (9 years ago)
Mistakes When Searching MySQL with datetime in Django Due to Time Zone Mismatch

Since I often make mistakes, here's a note.

AWSMySQL
2017-01-03 12:34 (9 years ago)
Recovery of Stopped AWS RDS MySQL Replication

Something is wrong with AWS RDS MySQL replication

DjangoLinux
2016-09-16 03:24 (9 years ago)
Failure of Django CSRF Token Authentication: ELB -> Apache2 -> uwsgi

Originally, the configuration was AWS ELB -> Apache2 -> mod_wsgi, but after changing the Django server to use uWSGI, the configuration became AWS ELB -> Apache2 -> uWSGI. After this change, I started experiencing issues with Django's CSRF authentication, such as when submitting a login form. When I checked with DEBUG = True, I saw the following message: Access Forbidden (403) The request was aborted due to failure in CSRF verification. Help Reason given for failure: Referer checking failed - https://example.com.com/some-path/ does not match any trusted origins. In general, this can occur when there is a genuine Cross-Site Request Forgery, or when Django's CSRF mechanism has not been used correctly. For POST forms, you need to ensure: Your browser is accepting cookies. The view function passes a request to the template's render method. In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL. If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data. You're seeing the help section of this page because you have DEBUG = True in your Django settings file. Change that to False, and only the initial error message will be displayed. You can customize this page using the CSRF_FAILURE_VIEW setting. The ELB receives HTTPS, sends requests to Apache on port 80, and uWSGI is listening for HTTP protocol (not uWSGI protocol). The Apache configuration is as follows: ProxyPass / http://127.0.0.1:8081/ ProxyPassReverse / http://127.0.0.1:8081/ Alias /static/ /var/django/xxxxx/staticfiles/ ProxyPass /static/ ! Something like this. Upon searching the Django code, I found in csrf.py: REASON_BAD_REFERER = "Referer checking failed - %s does not match any trusted origins." It appears that adding the domain to CSRF_TRUSTED_ORIGINS should work. CSRF_TRUSTED_ORIGINS = [".example.com"] This should do the trick.

2016-09-14 09:50 (9 years ago)
If You Use Disqus, There Might Be Issues with External Site Links When Displaying Pages in the iOS Twitter App

If you are using Disqus for your blog's comment system

MySQL
2016-09-14 09:44 (9 years ago)
You should avoid using MySQL collation utf8_unicode_ci as it can be quite slow

This isn't a completely quantitative discussion, but...

DjangoPython
2016-06-20 08:35 (9 years ago)
Outputting Shift-JIS CSV with Django

Python 3, Django 1.9

mac
2016-01-02 14:35 (10 years ago)
Error Opening the Application "Steam.app"

If you encounter the error "Cannot open application 'Steam.app'" when trying to launch the downloaded Steam on macOS 10.11 El Capitan, follow these steps. Note that the correctness of this method is not guaranteed...

Django
2015-12-22 09:57 (10 years ago)
Using Django RedirectView Inline in URLs to Redirect While Preserving URL Path

I want to redirect people who access /url-path-before/feature/hoge/ to /url-path-after/feature/hoge/.

iOS
2015-12-21 06:37 (10 years ago)
When Duplicate Symbol _OBJC_CLASS_ Appears in Large Numbers During iOS App Build

When encountering a large number of duplicate symbol _OBJC_CLASS_ errors during an iOS app build

HTML
2015-12-02 09:32 (10 years ago)
Template for WebFontLoader

When using WebFont, you may encounter a phenomenon called FOUT (Flash of Unstyled Text) where text is not displayed if the font fails to load.

MySQL
2015-12-01 06:42 (10 years ago)
Disable Stopword Filter in MySQL InnoDB Full-Text Index to Allow Searching for Words like "in," "by," "is"

Background I'm creating a full-text index with bigrams in InnoDB on MySQL 5.6. However, when I tried to search for the term "TWIN,"

Python
2015-12-01 02:02 (10 years ago)
Retrieve SSL Certificate Expiration Date Using timedelta

Get the SSL certificate expiration period using timedelta

Django
2015-11-27 00:40 (10 years ago)
Decorator to Prevent Duplicate Execution of Django Management Commands

```python

iOS
2015-11-05 11:27 (10 years ago)
When Building with Xcode 7, ERROR ITMS-90096: "Your binary is not optimized for iPhone 5 ..." Appears

The following article was helpful.

Django
2015-10-29 08:35 (10 years ago)
Trying Out Django TemplateView with Extensive Use of @cached_property

Django's built-in django.views.generic.TemplateView is a powerful tool.

Bootstrap
2015-10-27 09:35 (10 years ago)
Randomly Selecting the Initial Active Item in a Bootstrap Carousel

This method allows you to randomly change the initial position when displaying a large carousel in the hero area using Bootstrap.

Python
2015-10-19 07:34 (10 years ago)
Write Parallel Processing Easily Using Process Pools

Up until now, I had been writing custom thread pools using threading.Thread, but I thought there must be something provided by Python already. So, I did some searching and found that multiprosessing.pool.Pool was exactly what I was looking for. Creating a process pool is super easy with it. What was I doing all this time?

Python
2015-10-16 07:35 (10 years ago)
Python Simple Thread Pool

I should have used multiprocessing.pool.Pool orz