xtoolkit - volume.range is undefined - xtk

volume.range is undefined
here is a part from the code :
var sliceXController = volumegui.add(volume, 'indexX', 0,
volume.range[0] - 1);
var sliceYController = volumegui.add(volume, 'indexY', 0,
volume.range[1] - 1);
var sliceZController = volumegui.add(volume, 'indexZ', 0,
volume.range[2] - 1);
volumegui.open();
and here is the full code from lesson13 :
http://jsfiddle.net/gh/get/toolkit/edge/xtk/lessons/tree/master/13/#run
what should i do now and thanks a lot

Did you get this to work? I'm new to XTK and had problems with this when loading my own NRRD/NII files. I changed volume.range[0] to volume.dimensions[0] (etc.) and that worked fine for me, but not sure if that's a legit way of fixing things.
Edit: Actually, check which build you are using. I switched to xtk_edge.js and volume.range works fine with that build.
https://github.com/xtk/ge

Related

GetCurrentViewProjectionMatrix, get projection matrix from vr hardware using openvr.h

I'm creating a game in (modern) opengl, c++, glm, glfw and openvr.h and currently learning from provided example source code (hellovr_opengl_main.cpp). There are apis found in openvr to provide both the view and projection matrices and used in combination would replicate what your eyes would see in real life through virtual reality goggles.
So I implemented framebuffers into my opengl application and everything worked perfectly so all ok there then followed the examples and tried to access the apis from openvr.h myself, and after that failed i downright copied and pasted from their example code the entire hierarchy of everything that was relevant to this problem and called everything in the same order as they appeared from the example and that didnt work either so ive tried everything i can think of and i cant figure it out
Also i use there matrix definitions as they are until it reaches my code where i convert it to glm::mat4, but i did get the viewmatrix working w/o any modification (like column major)
glm::mat4 CMainApplication::GetCurrentViewProjectionMatrix(vr::Hmd_Eye nEye)
{
Matrix4 i;
if (nEye == vr::Eye_Left)
{
i = m_mat4ProjectionLeft * m_mat4eyePosLeft * m_mat4HMDPose;
}
else if (nEye == vr::Eye_Right)
{
i = m_mat4ProjectionRight * m_mat4eyePosRight * m_mat4HMDPose;
}
Matrix4 i2 = m_mat4eyePosRight * m_mat4HMDPose;//works!
view = glm::mat4(i2[0], i2[1], i2[2], i2[3], i2[4], i2[5], i2[6], i2[7], i2[8], i2[9],
i2[10], i2[11], i2[12], i2[13], i2[14], i2[15]);
Matrix4 i3 = m_mat4ProjectionRight;
project = glm::mat4(i3[0], i3[1], i3[2], i3[3], i3[4], i3[5], i3[6], i3[7], i3[8], i3[9],
i3[10], i3[11], i3[12], i3[13], i3[14], i3[15]);//doesnt work
project = glm::mat4(i3[0], i3[4], i3[8], i3[12], i3[1], i3[5], i3[9], i3[13], i3[2], i3[6],
i3[10], i3[14], i3[3], i3[7], i3[11], i3[15]);//row>>column //doesnt work
return glm::mat4(i[0], i[4], i[8], i[12], i[1], i[5], i[9], i[13], i[2], i[6],
i[10], i[14], i[3], i[7], i[11], i[15]);//doesnt work
return glm::mat4(i[0], i[4], i[8], i[12], i[1], i[5], i[9], i[13], i[2], i[6],
i[10], i[14], i[3], i[7], i[11], i[15]);//row>>column //doesnt work
return glm::mat4(i[12], i[13], i[14], i[15], i[4], i[5], i[6], i[7], i[8], i[9],
i[10], i[11], i[0], i[1], i[2], i[3]);//replace top w/ bottom //doesnt work
}

Google Script .getvalue() Not Working With Cells With a Formula In It

I have this google script for google sheets that moves rows of data from "Sheet1" to "Sheet2" when column 15 says "tracking", and it works perfectly fine when I type in "tracking" but I would like that column to be an IF equation something like IF(G:G="tracking not available at this time","","tracking"). But the code does not seem to recognize the formula change from "" to "tracking". Do I need to change the getvalue()? Or is there a different workaround to this issue? I've used =query(importrange) withing the spreadsheet to copy over data with a trigger word, but I really want this to be more of an archive system and add a row to the bottom of "Sheet2" whenever row15 on "sheet1"Thanks! Here is the code:
function onEdit(event) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = event.source.getActiveSheet();
var r = event.source.getActiveRange();
if(s.getName() == "Sheet1" && r.getColumn() == 14 && r.getValue() == "tracking") {
var row = r.getRow();
var numColumns = s.getLastColumn();
var targetSheet = ss.getSheetByName("Sheet2");
if(targetSheet.getLastRow() == targetSheet.getMaxRows()) {
targetSheet.insertRowsAfter(targetSheet.getLastRow(), 20);
}
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
s.getRange(row, 1, 1, numColumns).moveTo(target);
s.deleteRow(row);
}
}
I had an issue with this recently
I spent about 3 hours debugging something yesterday and this was the culprit.
try using r.getDisplayValue() instead of r.getValue
I am still new to this myself, and feel free to correct me if I am wrong, because if there is a different reason I would really love to know!!!
It seems that if a value in a cell is not typed in but placed there through a formula such as =query() or a similar method, I don't think it actually sees that there is a value in the cell. (I got null values or the formula itself)
If you use getDisplayValue, it "should" get the value that you actually see in the cell.
The correct way to get formulas, instead of displayed values, is with getFormulas rather than getValues

QString functions giving incorrect results on CentOS

I am using C++ Qt Library and following code is working perfectly on Windows but not working on CentOS :
if(line.startsWith("[", Qt::CaseInsensitive))
{
int index = line.indexOf(']', 0, Qt::CaseInsensitive);
QString subLine = line.mid(index+1);
subLine = subLine.trimmed();
tokenList = subLine.split("\t");
}
else
{
tokenList = line.split("\t");
}
I have a line [ x.x.x.x ] something ../dir/file.extension and I want to ignore the [x.x.x.x] part while breaking line into tokens. I am using VC9 on windows to debug and its working fine.
Edit: i have removed mid() and used right() still same problem persists, working on windows but not on CentOS.
Edit: after debugging on linux using QMessageBox i have concluded that control is never going inside if block, i tried using if(line.data()[0] == '[') but same results.
Your code can be simplified.
line.remove(QRegExp("\\[\\s+\\d+\\.\\d+\\.\\d+\\.\\d+\\s+\\]"));
tokenList = line.split("\t");

Gtksourceviewmm syntax highlighting not working

I'm trying to use the C++ wrapper gtksourceview, I made this a long time ago and I remember that it was working, but now everything works except the higlight syntax. And I'm not pretty sure what it is. I hope you can help me, I read a lot about this library on internet but I can find a solution. Here is a simple code. Thanks in advance.
#include "twindow.h"
#include <iostream>
TWindow::TWindow() {
add(m_SourceView);
m_SourceView.set_size_request(640, 480);
m_SourceView.set_show_line_numbers();
m_SourceView.set_tab_width(4);
m_SourceView.set_auto_indent();
m_SourceView.set_show_right_margin();
m_SourceView.set_right_margin_position(80);
m_SourceView.set_highlight_current_line();
m_SourceView.set_smart_home_end(gtksourceview::SOURCE_SMART_HOME_END_ALWAYS);
gtksourceview::init ();
Glib::RefPtr<gtksourceview::SourceBuffer> buffer = m_SourceView.get_source_buffer () ;
if (!buffer) {
std::cerr << "gtksourceview::SourceView::get_source_buffer () failed" << std::endl ;
}
buffer->begin_not_undoable_action();
buffer->set_text(Glib::file_get_contents("main.c"));
buffer->end_not_undoable_action();
buffer->set_highlight_syntax(true);
Glib::RefPtr<gtksourceview::SourceLanguageManager> language_manager = gtksourceview::SourceLanguageManager::create();
Glib::RefPtr<gtksourceview::SourceLanguage> language = gtksourceview::SourceLanguage::create();
language = language_manager->get_language("c");
buffer->set_language(language);
show_all_children();
}
So you want to use the c++ wrapper of gtksourceview, so I guess you want to use gtksourceviewmm.
Why you create the LanguageManager, you can use the default one.
If you using 3.2 of gtksourceviewmm, then look at the docs.
You should also check out this function.
So an example would look like;
Glib::ustring file_path = "/home/user/whatever/main.c";
Glib::RefPtr<Gsv::LanguageManager> language_manager = Gsv::LanguageManager::get_default();
Glib::RefPtr<Gsv::Language> language = language_manager->guess_language(file_path, Glib::ustring());
Another thing I want to mention is that you should create a buffer to show the content of the file, as in my projects I got a seg fault when I wanted to use get_source_buffer(), so it seems to be null by default.
Glib::RefPtr<Gsv::Buffer> buffer = Gsv::Buffer::create(language);
buffer->set_text(Glib::get_file_contents(file_path));
this->m_SourceView.set_source_buffer(buffer);

Windows Phone 7 Consuming Webservice WSDL

Ok I have written some basic generic webservices before but I have never tried to consume a 3rd party one.
The one I am trying to consume is
http://opendap.co-ops.nos.noaa.gov/axis/webservices/predictions/wsdl/Predictions.wsdl
I am not getting any results back from this what so ever and cannot figure out why.
More odd is it is not even reaching PredictionsClient_getPredictionsAndMetadataCompleted when I put a break point in the code it doesn't even reach it.
Any suggestions would be greatly appreciated
public void Bouy(double meters)
{
PredictionService.Parameters PredictionParams = new PredictionService.Parameters();
PredictionService.PredictionsPortTypeClient PredictionsClient = new PredictionService.PredictionsPortTypeClient();
GeoCoordinateWatcher gc = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
//gc.Position.Location.Latitude, gc.Position.Location.Longitude
GeoCoordinate myLocation = new GeoCoordinate(27.931631,-82.802582);
foreach (var bl in BouyLocation.GetAll())
{
GeoCoordinate otherLocation = new GeoCoordinate(bl.Lat, bl.Lon);
PredictionParams.beginDate = DateTime.Now.ToString("yyyyMMdd");
PredictionParams.endDate = DateTime.Now.AddDays(1.0).ToString("yyyyMMdd");
PredictionParams.stationId = bl.LocationID;
PredictionParams.timeZone = 0;
PredictionParams.unit = 1;
PredictionParams.dataInterval = 6;
PredictionsClient.getPredictionsAndMetadataCompleted += new EventHandler<PredictionService.getPredictionsAndMetadataCompletedEventArgs>(PredictionsClient_getPredictionsAndMetadataCompleted);
PredictionsClient.getPredictionsAndMetadataAsync(PredictionParams);
double mymeters = myLocation.GetDistanceTo(otherLocation);
if (mymeters < meters)
{
TextBlock DynTextBlock = new TextBlock
{
Name = "Appearance" + bl.LocationID,
Text = bl.LocationName + PredictionResult,
TextWrapping = System.Windows.TextWrapping.Wrap,
Margin = new Thickness(12, -6, 12, 0),
Style = (Style)Resources["PhoneTextSubtleStyle"]
};
DynamicAppearance.Children.Add(DynTextBlock);
this.nearByLocations.Add(new BouyLocationModel() { LocationName = bl.LocationName, LocationID = bl.LocationID, Lat = bl.Lat, Lon = bl.Lon });
}
}
var test = nearByLocations;
}
void PredictionsClient_getPredictionsAndMetadataCompleted(object sender, PredictionService.getPredictionsAndMetadataCompletedEventArgs e)
{
string err = e.Error.ToString();
PredictionResult = e.Result.ToString();
}
Loooking at the code you have here I think that you have used the importing of a ServiceReference to auto build the classes for you?
Unfortunately I have found that this is rather temperamental on WP7 and the only way I actually got it to work was when I connected it to a Microsoft WCF service. Connecting to anything else just doesn't work.
If you do google searches there are various pages talking about the fact it doesn't work and ways around it (which I couldn't get to work).
However, there are ways around it but it isn't as simple as the auto-generated stuff. Basically you do things manually.
Although there are other ways to manually create the web service what I did was follow the information in the following which worked well: http://zetitle.wordpress.com/2010/10/14/using-reactive-extensions-with-webrequest/
You will need to parse the response yourself but XML to LINQ works really well for this.
Hope that helps, or maybe someone will have the solution as it is something I am interested in knowing how to get working too