Posts

Showing posts from September, 2019

PHP and JQuery Stuff

Declaring non Existing object: In order to comply with  E_STRICT  standards prior to PHP 5.4, or the normal  E_WARNING  error level in PHP >= 5.4, assuming you are trying to create a generic object and assign the property  success , you need to declare  $res  as an object of  stdClass  in the global namespace: $res = new \stdClass (); $res -> success = false ; Jquery Email Regex: var userinput = $ ( this ). val (); var pattern = /^\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b$/ i if (! pattern . test ( userinput )) { alert ( 'not a valid e-mail address' ); }​ Jquery Session: https://www.w3schools.com/jsref/prop_win_localstorage.asp How to bind click event to dynamically created HTML elements in jQuery If you try to do something with the elements that are dynamically added to DOM using the jQuery  click()  method it will not work, because it bind the click event only to the elements that exist at the time of binding. To bind the click event to al

Django Rest Framwork Important Stuff

Serializing Django objects: https://docs.djangoproject.com/en/dev/topics/serialization/ Filtering against the URL : https://www.django-rest-framework.org/api-guide/filtering/

Hosting to Heroku and Amazon S3 Service

How to Setup Amazon S3 in a Django Project: https://simpleisbetterthancomplex.com/tutorial/2017/08/01/how-to-setup-amazon-s3-in-a-django-project.html Amazon S3 Storage: https://django-storages.readthedocs.io/en/latest/backends/amazon-S3.html S3 Static & Media Files for Django: https://www.codingforentrepreneurs.com/blog/s3-static-media-files-for-django/ Configuring Django Apps for Heroku: https://devcenter.heroku.com/articles/django-app-configuration Heroku Python Support: https://devcenter.heroku.com/articles/python-support Youtube: Hosting and Deploying app on Heroku: https://www.youtube.com/watch?v=MoX36izzEWY How To Deploy Django App on Heroku: https://www.codementor.io/jamesezechukwu/how-to-deploy-django-app-on-heroku-dtsee04d4 // Disable the static file for Heroku heroku config:set DISABLE_COLLECTSTATIC=1 // Create seed for db python manage.py dumpdata information.Slider --format json --indent 4 > information/fixtures/sliders.json // To load data

JavaScript and Jquery Related Stuff

Digital Signature Using Signature Pad JavaScript Library https://jsfiddle.net/szimek/d6a78gwq/ https://github.com/szimek/signature_pad https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL How to convert file to base64 in JavaScript? https://stackoverflow.com/questions/36280818/how-to-convert-file-to-base64-in-javascript how to upload image through jquery ? https://stackoverflow.com/questions/44283986/how-to-upload-image-through-jquery How to bind click event to dynamically created HTML elements in jQuery https://www.tutorialrepublic.com/faq/how-to-bind-click-event-to-dynamically-added-elements-in-jquery.php How to get or set value of CKEditor 5? var myEditor ; ClassicEditor . create ( document . querySelector ( '#editor' ) ) . then ( editor => { console . log ( 'Editor was initialized' , editor ); myEditor = editor ; } ) . catch ( err