Posts

What are the benefits of Azure Static Website Hosting over Azure CDN

What are the benefits of Azure Static Website Hosting over Azure CDN Just read this article about Static website hosting in Azure Storage : For the moment, I use to deploy my static content to Azure CDN. So far here are the difference that I've found: I am wondering what could be a good candidate for Static website hosting in Azure Storage: Content for local application that does not need to scale globally ? By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Django: mulitselect options not prepopulating in html

Django: mulitselect options not prepopulating in html I'm using django-multiselect . On the html, all of the items are showing, but the ones that are already checked are not showing that they are checked. I was looking at the documentation, but it's coming prechecked. In particular this line of code isn't working: {% if value in myroles %}checked="checked"{% endif %} Can someone see what I did wrong? django-multiselect {% if value in myroles %}checked="checked"{% endif %} html {% for value, text in form.role.field.choices %} <div class="ui slider checkbox"> {{ value }}{{ text }} <input id="id_role_{{ forloop.counter0 }}" name="{{ form.role.name }}" type="checkbox" value="{{ value }}" {% if value in myroles %}checked="checked"{% endif %}> <label>{{ text }}</label> </div> {% endfor %} models.py aaa= 1 bbb= 2 ccc= 3 ddd= 4 eee= 5 ROLE_CHOICES = ( ...

Angular incompatibility with html attributes

Angular incompatibility with html attributes I have an imported css template written on bootstrap, and want to use it inside Angular app. CSS are imported from index.html Application characteristics. This is a SPA, and all of pages are loaded inside Navbar Component, with corresponding router-outlet wrapping. Problem. Any plugin will render included data only after "mechanical" refreshing page with browser "Reload this page" button. But if I change a src for image, from plugin custom attribute, for example data-background="assets/images/slider_1.jpg" to img src="assets/images/slider_1.jpg" , it will be loaded and shown from the first time. Example of map plugin. Doesnt show nothing. <div class="maps-container map-widget m-b-25"> <div class="map" data-addresses="[4.4, -4.4]" data-icon="assets/images/map-marker.png" data-zoom="16" data-street-v...

Google Calendar Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup

Google Calendar Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup So I am trying to work with some code that takes a ical file and syncs it to my google calendar. The code I am using as a base can be found here. However, I seem to be get errors in the code that would make me believe that I am having trouble authenticating my credentials. Below is the code I use for authenticating: def get_credentials(): store = Storage(CREDENTIAL_PATH) credentials = store.get() if not credentials or credentials.invalid: flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES) flow.user_agent = APPLICATION_NAME credentials = tools.run_flow(flow, store, None) return credentials credentials = get_credentials() http = credentials.authorize(httplib2.Http()) service = discovery.build('calendar', 'v3', http=http) service.events().update(calendarId=CALENDAR_ID, eventId=gcal_event['id'],body=gcal_event).execute() The error I get i...

How to wrap bulk upsert in Mongo with Task in C#

How to wrap bulk upsert in Mongo with Task in C# I have some model public partial class Option { [BsonId] public int Id { get; set; } public Quote Quote { get; set; } public Contract Contract { get; set; } } Method that does bulk write public Task SaveOptions(List<Option> contracts) { var context = new MongoContext(); var processes = new List<Task<UpdateResult>>(); var collection = context.Storage.GetCollection<Option>("options"); contracts.ForEach(contract => { var item = Builders<Option>.Update.Set(o => o, contract); var options = new UpdateOptions { IsUpsert = true }; processes.Add(collection.UpdateOneAsync(o => o.Id == contract.Id, item, options)); }); return Task.WhenAll(processes); } Call for the method above Task.WhenAll(service.SaveOptions(contracts)) // also tried without Task.WhenAll For some reason, it doesn't create any record in Mongo DB Update Tried to rewrite bulk write this way, still...

SSL23_GET_SERVER_HELLO:unknown protocol

SSL23_GET_SERVER_HELLO:unknown protocol I have read all postings on this error, and tried all the answers, but problem is still not resolved. Running Debian 8 virtual machine created by Google Cloud Platform, created a Self-Signed SSL and configured the default-ssl file as per instructions, and still getting error when connecting to port 443. Here is the command that I ran and the message that I got. Any insightful help would be welcome: openssl s_client -connect localhost:443 140700056811152:error:140770FC:SSL routines: :s23_clnt.c:782: --- no peer certificate available --- No client certificate CA names sent --- SSL handshake has read 7 bytes and written 289 bytes --- New, (NONE), Cipher is (NONE) Secure Renegotiation IS NOT supported Compression: NONE Expansion: NONE SSL-Session: Protocol : TLSv1.2 Cipher : 0000 Session-ID: Session-ID-ctx: Master-Key: Key-Arg : None PSK identity: None PSK identity hint: None SRP username: None Start T...

How to use redis to cache the list of relevant articles as values mapped with the articles' id as key in django?

How to use redis to cache the list of relevant articles as values mapped with the articles' id as key in django? models.py from django.db import models from django_pandas.managers import DataFrameManager # Create your models here. class BcContent(models.Model): asset_id = models.PositiveIntegerField() title = models.CharField(max_length=255) alias = models.CharField(max_length=255) title_alias = models.CharField(max_length=255) introtext = models.TextField() state = models.IntegerField() sponsored = models.IntegerField() sectionid = models.PositiveIntegerField() mask = models.PositiveIntegerField() catid = models.PositiveIntegerField() created = models.DateTimeField() created_by = models.PositiveIntegerField() created_by_alias = models.CharField(max_length=255) modified = models.DateTimeField() modified_by = models.PositiveIntegerField() checked_out = models.PositiveIntegerField() checked_out_time = models.DateTime...

Re-upload enhanced SAPUI5 Code to ABAP repository

Re-upload enhanced SAPUI5 Code to ABAP repository I managed to download the code of a SAPUI5 Application (standard app) in ABAP Repository using SE38's program: /UI5/UI5_REPOSITORY_LOAD to enhance (add QRCode Scanner feature to the app and make it runnable on mobile device). /UI5/UI5_REPOSITORY_LOAD Now I wonder how I re-upload this code back to ABAP Repository. My issues are: manifest.json sap.ca.scfld.md.ComponentBase.js sap.ca.scfld.md.ConfigurationBase.js Any suggestions for my issues? Are you using the WebIDE? You'll want to create an extension project, not change the existing application. – Jorg Jul 2 at 5:46 I will try. thank you sir – T.NQ Jul 2 at 6:36 ...

Bootstrap - custom alerts with progress bar

Image
Bootstrap - custom alerts with progress bar I am trying to customize the bootstrap 3.3.7 alert class in order to add a progress bar and inline items to achieve something like this ( the dotted line is just to demonstrate that items are aligned ): alert However, I have problem in fitting the progress bar at the bottom of the right part with a width of 100%. Also, I have problem to adjust the height of the left part to 100% and ajust the icon in the middle. width height I am not sure if I am using the correct css strategy, but this is what I have done so far: /* !important are just used to overide the bootstrap css in the snippet */ .alertContainer { border-radius: 0 !important; border-width: 0 !important; padding: 0 !important; height: auto !important; position: absolute !important; bottom: 15px !important; left: 0; right: 0; margin: 0 auto !important; width: 480px !important; } .leftPart { display: inline-block !important; height: 100% !important; width: 32...

Automatically compile TypeScript files on file save

Automatically compile TypeScript files on file save I'm looking to move a vanilla node.js project to TypeScript and I'm curious about how to restart my server with the latest changes without needing to run tsc from the command line each time I make a change. I see from this answer two options: ts-node and tsc --watch ts-node tsc --watch Can someone provide a little color on the difference between these two options? I understand they accomplish the same goal, but how are they different and in which situation should I use one over the other? See this comment on the answer: stackoverflow.com/questions/33535879/… – Aankhen Jul 2 at 10:21 @Aankhen that helps but it doesn't completely answer my question – johnnyodonnell Jul 2 at 13:21 ...

Error in connecting to DB: Error: Handshake inactivity timeout

Error in connecting to DB: Error: Handshake inactivity timeout I am running a node.js server which is using mysql DB. I was working fine but suddenly it has started throwing following error. Below is the stacktrace of the error: Error in connecting to DB: Error: Handshake inactivity timeout at Handshake.<anonymous> (/home/ubuntu/backend/node_modules/mysql/lib/protocol/Protocol.js:164:17) at emitNone (events.js:86:13) at Handshake.emit (events.js:185:7) at Handshake._onTimeout (/home/ubuntu/backend/node_modules/mysql/lib/protocol/sequences/Sequence.js:129:8) at ontimeout (timers.js:365:14) at tryOnTimeout (timers.js:237:5) at Timer.listOnTimeout (timers.js:207:5) -------------------- at Protocol._enqueue (/home/ubuntu/backend/node_modules/mysql/lib/protocol/Protocol.js:145:48) at Protocol.handshake (/home/ubuntu/backend/node_modules/mysql/lib/protocol/Protocol.js:52:23) at PoolConnection.connect (/home/ubuntu/backend/node_modules/mysql/lib/Connection.js:130:18) at Pool.getConnect...

Laravel Query with Multiple Tables Join and Multiple Join Fields

Laravel Query with Multiple Tables Join and Multiple Join Fields I'm trying to build a query to join multiple tables with multiple join fields. This is the code: $crew = DB::table('crew') ->join('aclist', function ($join){ $join->on(function($query){ $query->on('aclist.ac_config', '=', 'crew.config') ->on('aclist.ac_type', '=', 'crew.ac_type'); }); }) // Error happened after I add this indexform join script ->join('indexform', function ($join){ $join->on(function($query){ $query->on('indexform.config', '=', 'crew.config') ->on('indexform.ac_type', '=', 'crew.ac_type'); }); }) ->select('crew.*','ind...

C# code issue working on player movement and stamina system in unity

C# code issue working on player movement and stamina system in unity I am currently working on building a custom character movement system for my unity project but I seem to be having some problems with my code, no errors appear in the console and what I am trying to do is create a timer for a stamina system that will fatigued the player overtime and also a recharge system before the player can run again. The main issue is when I print the values of the current stamina multiple timers are being ran, also the values are not going up appropriately as they should any help would be appreciated Thankyou! using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityStandardAssets.CrossPlatformInput; public class PlayerController : MonoBehaviour { CharacterController characterControl; [SerializeField] float walkSpeed = 10f; [SerializeField] float sprintSpeed = 15f; [Header("Stamina")] [SerializeField] float maxStaminaDec...

algorithm, closest point between list elements

algorithm, closest point between list elements I have n ordered lists of unequal size (where I do not know beforehand how many lists there are going to be). I need to find the minimum average distance between one element in each list. For example given n=3 for three lists: a = [14, 22, 36, 48] b = [14, 23, 30, 72] c = [1, 18, 24] The output should be (22,23,24) because: mean(abs(22-23), abs(23-24), abs(22-24)) = 1.33333 which is the smallest among all the points in the example above. I tried to implement it in Python as following def alligner(aoa): ''' read arrays of arrays of peaks and return closest peaks ''' #one of arrays is empty if not [y for x in aoa for y in x]: return None # there is the same nr in all array no need to do anything candidate = set.intersection(*map(set, aoa)) if candidate: # returns intersect return [max(list(candidate))] * len(aoa) else: #tried cartesian product via bumpy malloc err pass My doubt is now regarding the...

removing padding from columns in wordpress

Image
removing padding from columns in wordpress Hi I want to remove padding from padding from columns in wordpress. http://codesigners.co.uk/nuala/restaurant/ looking at the code: .vc_column_container>.vc_column-inner { box-sizing: border-box; padding-left: 15px; <<<tied making this 0px padding-right: 15px; <<<tied making this 0px width: 100%; } also have tried editing the js_composer.min.css file. Any ideas? 1 Answer 1 Change settings of visual composer row : Row Settings > Row Stretch > Stretch row and content (no padding) By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Xamarin android notification for events

Xamarin android notification for events I'm working on a xamarin.forms application in .net standard 2.0. I have a list of events in my sqlite db with each event having starting and end time. Now, I want to show an alert to the user when ever any event is going to start in 5 minutes and when it's started and when its ended (3 alerts for each event). My approach : The issue is how can I show the alert on the exact time for the event stored in the db for start and end. Between 2 alarm managers if my evemt is occurring then I'm not able to show the alert on the exact time. Thanks in advance. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

How to create a matrix structure in C?

How to create a matrix structure in C? I'm a beginner in C, but I'm currently trying to create a matrix data structure that could be used in different functions without having to explicitly pass the number of columns and number of rows (example: matrixMult(matrix A, matrix B) instead of matrixMult(A, B, rowsA, columnsA, rowsB, columnsB) ). My approach so far has been to declare a struct such as matrixMult(matrix A, matrix B) matrixMult(A, B, rowsA, columnsA, rowsB, columnsB) typedef struct matrix{ int rows; int columns; int **data; }matrix; And then, to properly allocate the matrix, I'm trying to use the following function matrix startmatrix(matrix mat,int n_row, int n_col){ int i=0; mat.rows=n_row; mat.columns=n_col; mat.data=(int **) calloc(n_row,sizeof(int *)); for(i=0;i<n_row;i++){ mat.data[i]=(int *) calloc(n_col,sizeof(int)); } return mat; } Which (to my understanding) allocates the rows containing the columns, and ...

Can someone help me rewrite this code (fig with multiple histograms) with a for loop or function?

Can someone help me rewrite this code (fig with multiple histograms) with a for loop or function? I looked at a similar post but am still struggling with it. You don't have to write out the whole code if you don't want. But a syntactical guide would be helpful. Here is my lengthy manual approach: # Grid of MMR distributions by every 5 years mmr_1990 = mmr[mmr['Year']=='1990'] mmr_1995 = mmr[mmr['Year']=='1995'] mmr_2000 = mmr[mmr['Year']=='2000'] mmr_2005 = mmr[mmr['Year']=='2005'] mmr_2010 = mmr[mmr['Year']=='2010'] mmr_2015 = mmr[mmr['Year']=='2015'] year_list = [mmr_1990, mmr_1995, mmr_2000, mmr_2005, mmr_2010, mmr_2015] fig = plt.figure(figsize=(12,8)) ax1 = fig.add_subplot(2,3,1) ax2 = fig.add_subplot(2,3,2) ax3 = fig.add_subplot(2,3,3) ax4 = fig.add_subplot(2,3,4) ax5 = fig.add_subplot(2,3,5) ax6 = fig.add_subplot(2,3,6) #1990 ax1.hist(mmr_1990['MMR'], color='dar...

Sequelize relationship query returns duplicate data

Sequelize relationship query returns duplicate data I'm querying customer orders for a specified customer using Sequelize relationships. index.js var results2 = await customerService.getOrders(1); console.log(results2); service.js exports.getOrders = function (id) { return customerModel.findAll({ raw: true, include: [{ model: orderModel, where: { customer_idcustomer: id } }], }).then(r => r); }; results [ { idcustomer: 1, customername: 'hello world', 'orders.idorder': 1, 'orders.orderdesc': 'order description 1', 'orders.customer_idcustomer': 1 }, { idcustomer: 1, customername: 'hello world', 'orders.idorder': 2, 'orders.orderdesc': 'Test 456', 'orders.customer_idcustomer': 1 }, { idcustomer: 1, customername: 'hello world', 'orders.idorder': 3, 'orders.orderdesc': 'Tes...