2018-10-22         Pearl

Complete HTML with stange characters

I use this function to complete my HTML.function correct_html($string) { $dom = new \DOMDocument; $dom->loadHTML($string); $mock = new \DOMDocument; $body = $dom->getElementsByTagName('body')->item(0); foreach ($body->childNodes as $child) { $mock->appendChild($mock->importNode($child, true)); } return trim($mock->saveHTML());}But when i use this function with an é or any other special characters it's giving me é. How can i fix this Try adding utf8_decode()before parsing the string to the loadHTML(), like this,function ...

 php                     2 answers                     84 view
 2018-10-22         Pearl

implicitly and explicitly defined columns in CSS

I was doing an online quiz about CSS grid and I'm confused by one of the problems.Here's the problem: Imagine we have a grid with the following CSS properties, with 4 boxes inside of it. If we added a fifth box to the HTML, what width would it have?and here's the code: .grid { grid-template-rows: repeat(2, 50px); grid-template-columns: repeat(2, 100px); grid-auto-rows: 60px; grid-auto-columns: 70px; }My thought was: so there are already 4 boxes, if we were to add a new one, it would trigger the 'grid-auto-rows' and 'grid-auto-columns'. So its width would be 70px.But t...

 css                     1 answers                     66 view
 2018-10-22         Pearl

Backing up and Restoring SQL Server Tables from C#

In a webapp I am building, I have a requirement in which I need to backup and restore around 10-15 tables from a SQL Server database.My solution..-Backup: For each table, Fill a dataset , serialize that to a file-Restore: Deserialize the file into a dataset and use SQLBulkCopyIs this the best was to achieve my goal? You need to make sure you consider the following. What happens when the schema changes? How do you upgrade the data? If any of the tables have identity columns you need to make sure you wack on identity insert before loading up the data. Watch out for trigge...

 c#                     3 answers                     94 view
 2018-10-22         Pearl

through command line automation, create/edit client specification view

I have two directories like://A/B/C/Folder-One///A/B/C/D/Folder-Two/Now, in automation I want to map above these paths to one client and sync it.like//A/B/C/Folder-One/ //MYClient/Folder-One/...//A/B/C/Folder-Two/ //MYClient/Folder-Two/...Can any one help me how can I achieve that through automation?Assumption note: In the current directory, I have .perforce file where respective variables are configured and p4 client -o is also working correctly. The --field undoc option makes this pretty easy:p4 --field "View+=//A/B/C/Folder-One/... //MYClient/Folder-One/..." client -o...

 perforce                     1 answers                     8 view
 2018-10-22         Pearl

Two's complement function outputs wrong result for -1

I am generating the input for an FPGA program to use the trapezoidal integration method. Basically, the functions of interest here are the invert() and twos_comp() functions; the rest is just testing (creating a square wave signal, and then iterating through and converting it into two's complement). signals = []bit_signals = []def invert(bit_val): new_val = [] for i in bit_val: new_val.append(str(int(not(int(i))))) return ''.join(new_val)def twos_comp(val): if val < 0: bin_val = format(val, '08b')[1:] return format(int(invert(bin_val),2) ...

 python                     1 answers                     23 view
 2018-10-22         Pearl

Shibboleth->Saml2 metadata

So our site needs to authenticate with an external Shibboleth system. They say they support SAML2, so I added the Saml2 nuget to IdentityServer3, pointed it at their site. Seems to work, but on their end it says we aren't allowed to access it.They need some metadata route to add so we can be recognized as valid, any idea what that would even be? They are saying https://your.sp-host.com/Shibboleth.sso/Metadata but we're not using Shibboleth internally so clearly that route on our end makes no sense.This is the package I'm plugging inhttps://www.nuget.org/packages/Sustains...

 saml                     2 answers                     102 view
 2018-10-22         Pearl

Reshape this (4,4) numpy ndarray to (2,2,4) ndarray

I have this numpy ndarray nd with shape (4,4).[ [1.07 1.16 1.00 1.11] [1.13 1.19 1.11 1.17] [1.17 1.17 1.13 1.16] [1.14 1.16 1.03 1.04]]I would like to reshape it to a ndarray to (2,2,4) and it should look like this.[ [ [1.07 1.16 1.00 1.11] [1.13 1.19 1.11 1.17] ] [ [1.17 1.17 1.13 1.16] [1.14 1.16 1.03 1.04] ]]I am using python v3.6 You could use reshape:import numpy as npnd = np.array([ [1.07, 1.16, 1.00, 1.11], [1.13, 1.19, 1.11, 1.17], [1.17, 1.17, 1.13, 1.16], [1.14, 1.16, 1.03, 1.04]])nd_new = np.resh...

 python-3.x                     1 answers                     32 view
 2018-10-22         Pearl

Odoo - Cannot loop through model records

I want to call a method every time my module gets installed or updated. Inside that method I want to loop through model records, but I'm only getting different errors.This documentation looks pretty straightforward: https://www.odoo.com/documentation/9.0/reference/orm.htmlBut it doesn't work for me. I'm getting this error: ParseError: "'account.tax' object has no attribute '_ids'" while parsingThis is how I call the method:<openerp> <data> <function model="account.tax" name="_my_method" /> </data></openerp>I took this from the fir...

 loops                     1 answers                     17 view
 2018-10-22         Pearl

Oracle/SQL : count number of values and assign a number

Here is what I am trying to do. I have 2 tables:T1: ID create datetime(mm/dd/yyyy hh:mm:ss)1 17-Apr-20162 18-Apr-20163 13-Apr-20164 15-Apr-20165 20-Apr-20166 19-Apr-2016T2ID(FK) seq create datetime(mm/dd/yyyy hh:mm:ss)1 6546 20-Apr-2016 1 5457 19-Apr-2016 1 4245 18-Apr-20161 02 5567 19-Apr-2016 2 03 2034 15-Apr-2016 3 1987 14-Apr-2016 3 1902 14-Apr-2016 3 1249 13-Apr-2016 3 04 2209 15-Apr-2016 4 2456 16-Apr-2016 ...

 sql                     3 answers                     99 view
 2018-10-22         Pearl

sql server datainsert error

I try this code this is problem to pass value in mssqlserver I pass value one page to another page in hear nrno is value come to other page but hear error is java.sql.SQLException: Invalid column name 'nrno'.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>Untitled</title></head><body><%@ page import="java.sql.*" %><%@ page import="java.io.*" %><%String AppURL = request.getContextPath() ;String thisFile = AppURL+request.getServletPath() ;int nrno = 0;try{ nrno = Integer.parseInt(reques...

 java                     2 answers                     75 view
 2018-10-22         Pearl

Kafka Stream - aggregate on fixed size sliding window

How do I implement sliding window aggregation (or transformation) with a fixed size (count) window? For e.g: If I have stream data like the followinginput stream = 1,2,3,4,5,6,7,8...Assume that time is not relevant here. And say my aggregate function is AVERAGE and window size is fixed at 3 records (not 3 millis, 3 secs, 3 hours etc), I would like my output stream to beoutput stream = avg(1,2,3), avg(2,3,4), avg(3,4,5), avg(4,5,6), avg(5,6,7)... = 2,3,4,5,6...The Windows documented in Kafka streams work are "time-based". Even the constructor of base class Window has followi...

 apache-kafka                     2 answers                     53 view
 2018-10-22         Pearl

Refer to the current directory with <base> set

Setting <base href="/a/"> causes <a href="/b"> to resolve to /a/b. This is fine.However, if I have an HTML file /a/b/x.html and I want to refer to /a/b/y.html, it would seem the only way to do this is <a href="/b/y.html">. Normally (without setting <base>), I can refer to a file in the current directory with ./y.html or even just y.html. But with <base> set, the ./ does not resolve to the current directory, it resolves to the directory specified in <base>.A more complex example:a└─b └─c └─d |──x.html └──y.htmlIf I am in...

 html                     1 answers                     43 view
 2018-10-22         Pearl

Can you set metadata on an Azure CloudBlockBlob at the same time as uploading it?

I have a situation in which I currently upload a CloudBlockBlob using CloudBlockBlob.UploadFromStreamAsync, and then immediately afterward I set a bunch of user metadata on it.The issue is: I have an Event Grid event which is triggered when the blob is uploaded, but the event handler requires the metadata. Long story short, it's a race condition wherein I have to "hope" that the metadata has been set before my event handler responds to the block blob upload.Is there some way to both upload the block blob (file) and set its metadata in a single operation? As juunas said,...

 c#                     1 answers                     86 view
 2018-10-22         Pearl

How can I "override" deepcopy in Python?

I'd like to override __deepcopy__ for a given SQLAlchemy-mapped class such that it ignores any SQLA attributes but deepcopies everything else that's part of the class.I'm not particularly familiar with overriding any of Python's built-in objects in particular but I've got some idea as to what I want.Let's just make a very simple class User that's mapped using SQLA.class User(object): def __init__(self, user_id=None, name=None): self.user_id = user_id self.name = nameI've used dir() to see, before and after mapping, what SQLAlchemy-specific attributes there ...

 python                     4 answers                     56 view
 2018-10-22         Pearl

@keyframes not working in expected way CSS

I'm recoding this website for practice purposes. I've changed the background image to black in my codepen because images don't work in codepen. Here's a link to my code. I've also placed the code here in case you can't view the codepen:INDEX.HTML<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" type="text/css" href="styles.css"> <link rel="stylesheet" type="text/css" h...

 html                     1 answers                     15 view
 2018-10-22         Pearl

Questions about mysqldump and Microsoft Azure

I need to dump database which hosts on Microsoft Azure.I tried following: 1. Connect to db with MySQL Workbench. 2. Select Data Export and use it. The warning message says that 'unequal version of mysqldump(8.0.12) and MySQL Server to be dumped(5.7.21) may cause issues' were shown. 3. No upgrades avaliable at MySQL Community Installer. So where's the question:1. How to get mysqldump of required version?2. mysqldump version seems higher than needed but it still doent work. Why?All attemps had following log:18:59:01 Dumping schedule-system (all tables)Running: "C:\Program Fi...

 mysql                     1 answers                     123 view

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