Latest Event Updates

Adobe Digital Editions E_ADEPT_CORE_EXPIRED fixed!

Posted on

Was getting this error on Adobe Digital Editions

Error getting License. License Server Communication Problem: E_ADEPT_CORE_EXPIRED

This was the solution to the ADE problem

  • Fix the clock – it was off by 1 day. Helped customer fix their clock
  • Reboot
  • Open Adobe Digital Editions
  • De-authorize Adobe Digital Editions
    • Press ‘Command + Shift + D’.
    • Select ‘Erase Authorization’.
  • Click OK and close Adobe Digital Editions .
  • Re-open Adobe Digital Editions.
  • Authorize Adobe Digital Editions
    • Press ‘Command + Shift + U’.
    • Enter your Adobe ID and password.

Can now load books onto ADE

React inline styles – merge two style objects

Posted on Updated on

I had two style objects that I needed to merge for a component. One was the style objects that makes the component look good, the other was to set the display visible or not.

I could get around it by wrapping the component in another div that would get the display style, but here is how to minimize your divs

const style1 = {color: ‘blue’}
const style2 = {display: ‘none’} //used with state that toggles visibility

<div style={Object.assign(style2, style1)} > </div>

The reason the display style should be first is because the key pairs from the second object are copied to the first. so style2 would now be

{display: ‘none’, color: ‘blue’}

 

Node Error : Promise.all is not a function

Posted on

Are you getting the message?

Promise.all is not a function

At first I was thinking is my node version out of date?

But the answer is actually that your Promise.all function inst receiving an array. 

 

 

axios – on POST errors JSON response from api server not being printed

Posted on

When you POST from curl, you are getting the JSON response from the server that you setup.

On your frontend when trying to print the error to the console it’s not coming up. Instead you get the following:

xhr.js:166 POST MYURLHERE 400 (Bad Request)

Even if you print the whole error or JSON stringify the error you aren’t seeing the response

ANSWER

make sure you are printing error.response.data 

 

mongoose-unique-validator not working?

Posted on Updated on

Are you using the mongoose-unique-validator package and not getting any errors when you post duplicate objects?

CURRENT

const personSchema = new mongoose.Schema({name:String,number: String})
personSchema.plugin(uniqueValidator)

SOLUTION

You need to set a unique attribute on the key you want uniqueness with. By default mongo only adds uniqueness to the __id key

const personSchema = new mongoose.Schema({name: {type:String, unique: true}, number: String})

SyntaxError: Unexpected token c in JSON at position 1 when you POST JSON data with curl

Posted on Updated on

When trying to use curl to POST data to your api and getting an error?

The error:

SyntaxError: Unexpected token c in JSON at position 1

Answer

You need to wrap your json block in quotes

curl -X POST -H "Content-Type: application/json" -d '{"content":"a"}' your_url_here

“Invalid Host Header” Errors when running your React project off your cloud ide

Posted on

This one was a pain. So your react app is hosted on localhost:3000 and your node backend is on localhost:3001. This isn’t a problem if you a developing locally. You open up your browser and everything connects perfectly. But if you are developing on a cloud ide or vps, you are probably connecting to something like someweirdname.cloudidename.com.

By itself, running npm start will give you your project nicely. But once you have a backend that your browser isnt accessing locally, you might get the dreaded  “Invalid Host Header”

Here is how I fixed my problem:

File: package.json  add the following:  where the value is your ide host name

"proxy": "http://mybackend.mycloudidehost.c9.io"

.env.development.local <- thats DOT ENV DOT DEVELOPMENT DOT LOCAL , I spent a good while troubleshooting because of the missing DOT,  add the following:

DANGEROUSLY_DISABLE_HOST_CHECK=true

The above is not recommended if you are developing locally, but its a cloud ide.