I just setup milkdown for the first time and implement basic setup like see this examples:
But now i can't find data (try console.log still not found).
So how can i find data to use in my Project, can anyone help me out of this?
#TIA
Default data "# Milkdown :heartpulse: React" it should be transform into (mdx to text/code) Milkdown heart_icon React and after transform i want to find this value in console.log() but can't find it.
Related
I have been playing around with the General Transit Feed Specification - Realtime, and I am following exactly the example given on google's documentation:
https://developers.google.com/transit/gtfs-realtime/examples/nodejs-sample
for JavaScript, using my cities local transit feed, however I keep encountering the following error:
var feed = GtfsRealtimeBindings.FeedMessage.decode(body);
^
TypeError: Cannot read property 'decode' of undefined
I have a working implementation in python that follows their example for that, so I can verify with certainty that the feed is the correct format.
I am running the code using the instruction:
node index.js
My package.json includes all the relevant dependencies, and I have installed using npm the required packages.
I have searched far and wide for a solution to this error but have had no luck. Any advice?
Looking at the current example code on GitHub
(https://github.com/MobilityData/gtfs-realtime-bindings/tree/master/nodejs#example-code)
it seems you're missing transit_realtime in between:
GtfsRealtimeBindings.transit_realtime.FeedMessage.decode(body);
On the example there is a link to the github of the Javascript language binding. The github example differs from the documentation example. I figure the documentation is simply out of date.
the line in the google documentation example
var feed = GtfsRealtimeBindings.FeedMessage.decode(body);
should be var feed = GtfsRealtimeBindings.transit_realtime.FeedMessage.decode(body); note the inclusion of .transit_realtime.
Alternatively this could be expressed in the line:
var GtfsRealtimeBindings = require('gtfs-realtime-bindings');
as var GtfsRealtimeBindings = require('gtfs-realtime-bindings').transit_realtime;
and the google documentation example code beyond that line would remain as it is.
You need to import gtfs-realtime-bindings by referencing the transit_realtime property. It's a change from the old protobuf.js bindings generator, but this is done to separate namespaces.
It won't work
cont GtfsRealtimeBindings = require('gtfs-realtime-bindings');
It will:
const GtfsRealtimeBindings = require('gtfs-realtime-bindings').transit_realtime;
Now you can get feedMessage and decode it.
const { FeedMessage, FeedHeader, FeedEntity, VehiclePosition } = GtfsRealtimeBindings;
Apologies if the question isn't correctly worded, but here it goes: I currently have a website which needs to display a certain image, however, the link provided to me is a link that redirects to the image.
So think www.linktoimage.com/foo, which redirects me to my actual image's url, so for example, https://i.imgur.com/76lLZAn.png.
Unfortunately this is a requirement to the project I am working on for several reasons and I can't really think of a way to get around this.
For the record, I am using meteor with the blaze template engine, in case that helps. A way I thought of getting this done may be through using a helper, which will follow the redirect for me, and somehow grab the ultimate url. So something like this:
Template.myTemplate.helpers({
getMyImage: function (proxyUrl) {
var actualAddress
// somehow get the images actual address...
return actualAddress
}
})
Then in my html file:
<template name="myTemplate">
<div>
<img src="{{getMyImage 'proxyUrl'}}"
<div>
</template>
Of course if there is a better way to do this just through the HTML that would be fantastic too. Unfortunately right now, I am clueless on how I would get the actual URL.
Thanks!
Edit: essentially I want to do this, but using JavaScript instead of PHP.
Edit2: possibly found a way to get around this, though it is not quite working and has some problems due to it being async. Basically it would be using meteor's HTTP library:
Template.myTemplate.helpers({
getMyImage: function () {
var proxyUrl = 'http://www.tablotv.com/client-paywall-snapshots/web'
return HTTP.call('GET', proxyUrl, function (err, result){
console.warn('hereeee', result, err)
})
}
})
However I am getting the following error:
network at XMLHttpRequest.xhr.onreadystatechange
I can imagine this has something to do with it being async, perhaps? Anyway, am I on the right path now? How could I get this working?
I am trying to create a programmatic filter. I have a dijit.tree and a dojo gridx using the same source on a jsp. When user clicks the tree node, I want to use the node as a filter and show all rows matching it in the gridx
This is my code I have now for the onClick event of the dijit tree node.
var global=this;
treeWidget.onClick = function(item){
global.grid.filter.setFilter(global.grid.filter.grid.filter.moduleClass.or("test"));
Earlier I asked for a sample expression. I went and tried the code above and seems to
refresh the grid but comes back as No items to display. I do have data that match test and if I do a manual filter I see data returning. What am I missing here.
At https://github.com/oria/gridx/wiki/How-to-filter-Gridx-with-any-condition%3F ( see Filter Expressions)
I was able to accomplish the task using the following code in the diji.tree onClick event.
global.grid.filterBar.applyFilter({
conditions: [{
condition: 'contain',
value: 'test'
}]
});
This is a comment rather than an answer, but I can't post comments yet.
Can you post a working snippet of code? That's not complete, as I don't see your store that you're specifying, etc.
I usually do a myinstancename.grid.body.refresh(); to accomplish a proper refresh.
I started using Jasmine to test javascript code and its working fine. But I would like to display inputs to the test suite in specrunner.html.
I tried HtmlReporter() and TrivialReporter() but no luck.
SPEC CODE:
checkAddition("TEST_SUITE","Test INPUTS1",getResult(2,3),5);
checkAddition("TEST_SUITE","Test INPUTS2",getResult(3,8),11);
function checkAddition(suite_name,testcase,result,equalto){
describe(suite_name, function() {
it(testcase, function() {
expect(result).toEqual(equalto);
});
});
}
JavaScript CODE:
function getResult(input1,input2){
return input1+input2;
}
OUTPUT :
EXPECTED OUTPUT :
I need to display inputs that looks like expected output (I edited code in browser using firebug to share expected output).
Please help me. Help would be appreciated :)
The built reporters won't do this. You either need to need to hack the innards of those built in reporters to do this (you're on your own with this route), or create your own reports from scratch (see here for some examples).
But I find this to be a strange request. Perhaps there is a cleaner way to achieve your goal, whatever that may be. Maybe a test suite isn't what you want if you want this info.
working with backbone, I was seeing a problem where some data was being left blank, so I wrote this to try to see what was going on.
console.log('actions.models', this.model.actions.models)
console.log('actions.models.length', this.model.actions.models.length)
console.log('first actions.models', this.model.actions.models[0])
the output
actions.models [ Action ]
actions.models.length 0
first actions.models undefined
if I add a setTimeout of say 2 seconds to this code I get
actions.models [ Action ]
actions.models.length 1
first actions.models Action
I don't get how this could happen. I don't know where to start looking or even what would be helpful to post for you guys to look at.
If anyone can help point me in the right direction I would appreciate it. Thanks very much.
Are you loading the models via an Ajax function, like fetch? If so, you can't count on data being loaded until the Ajax function's callback is invoked, e.g.
actions.fetch {success: -> console.log actions.models.length}
Not sure what you are trying to do, but anyway.. When you dump objects to the console log, be aware of the fact that since objects are passed by reference, whatever you get from inspecting it in the log will be whatever the object ended up being. Assuming you want to log the state of an object you should probably try to serialize it when logging. For instance console.log "mymodel: ", JSON.stringify(mymodel.attributes).
Also be aware that to access backbone models, you would typically use name = mymodel.get('name'), or for a collection item = mycollection.get('someid').
If you post some testable code and what you are trying to accomplish, I'm sure somebody with a clue will be able to help you out.