Custom TileSource is not working properly to load initial level image - deepzoom

I am trying to make custom tile source, I have simple copy paste the code from here : https://openseadragon.github.io/examples/tilesource-custom/
But i can see the Output as per here : http://screencast.com/t/j7Qvh4URsX
and for the Images related output here.. http://screencast.com/t/nPSGdRRbkn
Here questions are :
1) what is the correct way to load images properly..i cant see there are much documentation for it. if any specific info please provide me..
2) why there is (level-8)... ?
3) How can i make it dynamic.. for example if i want to make load images from my PC related folders dynamically with ajax call using asp.net mvc.. is there any examples...
4) I have much read about but not exact info for custom tile source to load the images to show the output as on Demo page...
I am using below code currently, it will go later based on ajax call to load local folders - level0,1,2,3,4,5,6 etc
var viewer = OpenSeadragon({
id: "example-custom-tilesource", showNavigator: true,
wrapHorizontal: true,
tileSources: {
height: 512*256,
width: 512*256,
tileSize: 256,
minLevel: 8,
getTileUrl: function (level, x, y)
{
console.log("URL::->"+ "http://s3.amazonaws.com/com.modestmaps.bluemarble/" +(level-8) + "-r" + x + "-c" + y + ".jpg")
return "http://s3.amazonaws.com/com.modestmaps.bluemarble/" +
(level-8) + "-r" + x + "-c" + y + ".jpg";
}
}
});

This is being discussed here: https://github.com/openseadragon/openseadragon/issues/547

Related

SOQL Query for getting the Application name of a Particular Tab

I would like to get the Application name of a specific sObject. For example: I have a custom object called Candidate__c. How to get the Application name of Candidate__c programmatically?
I am open to any approach like using Schema Namespace as well.
I am answering my question. I used Schema.describeTabs() and It works perfectly, but the Doc says the DescribeTabs method returns the minimum required metadata that can be used to render apps ...
Basically, The All Tabs are not included in the list of described tabs. The results are dependent upon the apps that are available to the running user.
// Get tab set describes for each app
List<Schema.DescribeTabSetResult> allApps = Schema.describeTabs();
// Iterate through each tab set describe for each app
for (Schema.DescribeTabSetResult oneApp : allApps) {
System.debug('The tabs/objects associated with the' + oneApp.getLabel() + ' app are:');
List<Schema.DescribeTabResult> appTabs = oneApp.getTabs();
for (Integer i = 0; i < appTabs.size(); i++) {
System.debug((i + 1) + '. Tab Name: ' + appTabs[i].getLabel());
}
}

Dhtmlxgantt how can i change the height of the Task Bars?

Hello i work with the Framework Dhtmlxgantt. And i would like to change the height of the Task Bars. They are to big for me and i would like to have id smaller. Is this possible? Because i search alot and i dont find anything about that. And i have another Problem. I have in my Database some Projects and a part of them has in the Titel html tags and the other not. The result is in the Gantt chart is the Titel field in diffrent font size what looks stupid. So is there a way to change that before id rendert on the Gantt chart or have i to change all Titel's in the Database? I hope some of you can help me. Greece
try this to set height
gantt.config.row_height = 36;
gantt.config.task_height = 20;
gantt.config.scale_height = 50;
To set task text use templates
gantt.templates.task_text=function(start, end, task) {
return "anything you want";
};
You can return task.text or task.id or "(" + task.text + " id = " + task.id + ")"
It seems to be easy )

How to disable Aria accessibility warnings in ExtJS 6

I am migrating a big ExtJS code base from ExtJS4 to ExtJS6, and the browser console if full mit warnings like
[W] Panel panel-1017 is a region section of the application, but it does not have a title. Per WAI-ARIA, all regions should have a heading element that contains region's title.
How can I disable those warnings ? (I know accessbility is good, but I'd like to tackle after fixing the migration bugs )
I tried
Ext.enableAria = false;
Ext.enableAriaButtons = false;
Ext.enablePanels = false;
to no avail
It's Ext.enableAriaPanels, not Ext.enablePanels.
And it should work, because, if you look into the Ext code:
if (Ext.enableAriaPanels && me.ariaRole === 'region' && !title) {
Ext.log.warn("Panel " + me.id + " is a region section of the application, " +
"but it does not have a title. Per WAI-ARIA, all regions " +
"should have a heading element that contains region's title.");
}
If it doesn't work, you're setting the value too late.

Google Forms as Multiple Choice Quiz - How to Provide Results

I've built a google form for a multiple choice quiz, with a linked spreadsheet for results, which works very well. I have a specific problem, which is that I'd like to present the user's results to them (i.e. how many answers they got right/wrong). The approach I've taken so far is:
create an extra sheet on the spreadsheet with a formula to calculate the number of correct answers for each response. This gives me two columns "Full Name" and "Scores"
embed the form into a google site
create a google apps script to read the results sheet and display output
embed the above into the same site below the form as an Apps Script Gadget
Currently I am able to display all of the results recorded so far. See here:
https://sites.google.com/site/mcqtest123/home
The script looks like:
// Script-as-app template.
function doGet() {
var app = UiApp.createApplication();
var title = app.createLabel("Survey Results").setStyleAttribute("fontSize","16px");
app.add(title);
//readRows(app);
calculateScores(app);
return app;
};
function calculateScores(app) {
var sheet = SpreadsheetApp.openById("0AlNR-ou0QtandFFzX1JCU1VRdTl0NVBRNTFjOUFhd1E");
var responseSheet = sheet.getSheetByName("Form Responses");
var allData = responseSheet.getDataRange().getValues();
var correct = allData[1];
var responses = allData.slice(2);
//Logger.log("Timestamp, name, score");
Logger.log("Name, Score");
for (var i = 0; i < responses.length; i++) {
var timestamp = responses[i][0];
var name = responses[i][1];
var score = 0;
for (var j = 2; j < correct.length; j++) {
if(responses[i][j] == correct[j]) {
score += 1;
}
}
//var output = timestamp + ", " + name + ", " + score + "/" + correct.length
var output = name + ", " + score + "/" + correct.length
print(app, output);
}
};
function print(app, line) {
Logger.log(line);
app.add(app.createLabel(line));
};
So this leaves two problems:
When the page loads, it loads the scores for all the respondents. I'd like to be able to present only the score for the person who filled out the form.
The scores don't get updated when the form is completed - only when the page is refreshed.
For problem 1), I wondered if there was some way to access the data in the form iframe (e.g. using document.getElementById('targetFrame'), except that google scripts don't seem to have access to the document model) to only display results of the person whose full name matches the name in the form (of course you could then view someone else's results if you know what they'd put as their full name, but without using the timestamp I don't see away round this).
For problem 2), I wondered if there was some way to trigger the script when the responses sheet was updated. However when I go to the spreadsheet and Tools->Script Manager I get the message "No scripts found", so I don't know how to add this trigger.
If you make your own form using HtmlService or UiApp and then that POSTing to your script to populate the spreadsheet, then you can generate a UID in a hidden field and use this to determine the results someone needs to see.
This will be the results as instant feedback to their answers to the quiz. To see these at a later date, you could then also add a bookmarkable link that also included that UID as a parameter. So your doGet() would look for a e.parameters.uid for example.
From Google Forms as they stand I am not so sure. you could potentially, with the new form styles, offer a pre-filled field with such a UID, but the route from form submission to your webapp is again unclear.

node.js websocket chat to handle parallel colors

I'm working on some project where I need some chat application. I decided to test some node.js/websocket version here: http://martinsikora.com/nodejs-and-websocket-simple-chat-tutorial
everything works perfect, but as he mentions in the end of the tutorial:
Node.js unlike Apache doesn't use processes for each connection.
It means that after 7 users logged in, every hard coded color will be used and then it uses white color for username style.
// Array with some colors
var colors = [ 'red', 'green', 'blue', 'magenta', 'purple', 'plum', 'orange' ];
// ... in random order
colors.sort(function(a,b) { return Math.random() > 0.5; } );
userName = htmlEntities(message.utf8Data);
// get random color and send it back to the user
userColor = colors.shift();
connection.sendUTF(JSON.stringify({ type:'color', data: userColor }));
console.log((new Date()) + ' User is known as: ' + userName
+ ' with ' + userColor + ' color.');
Is it somehow possible to allow two users to use the same color?
Thanks
You're better off just randomly picking a color on each request (which means you don't have to pre-shuffle the colors array). Yes, that means that sometimes two consecutive users will get the same color; that's an inherent property of real randomness, rather than what people mistakenly imagine randomness to be.
you shouldn't use Array.shift(), since it removes an element from your colors array, so basicaly after 7 users your array is empty.
just generate a random id
var idx = Math.floor(Math.random()*colors.length)
.....
({ type:'color', data: colors[idx] })
After doing:
usercolor = colors.shift();
Add this line:
colors.push(usercolor);
This puts the returned color back into the array at the other end. The net result is it'll cycle through your seven colors over and over.

Resources