Sunday 1 September 2013

C# Multitouch application: How to rotate a window depending on gesture?

C# Multitouch application: How to rotate a window depending on gesture?

I am playing around with a programm I want to use on a multitouch laptop.
My programm pretty is pretty much a virtual notepad where I store
information and pictures within notes.
When I click on the notes the information is shown within an extra window
(WinForm). And with that window comes my problem:
Since I use the programm on a touch laptop (which I can use as a pad, too)
I want to be able to rotate those windows (in reaction to the rotate
gesture) so I can show others the content without rotating the laptop.
I have seen that in other programms so it should be possible, but I did
not come up with anything working using Google, as most answeres I find
talk about multitouch for Phones or normal Pads, which don't use WinForm
as such...
Can anyone help?

Fatal Error : Call to undefined method Database::query()

Fatal Error : Call to undefined method Database::query()

I am having an error ( Fatal Error : Call to undefined method
Database::query() ) somewhere in this part, I don't know where is this
coming from. Because I just changed my constructor
Class Database{
public function __construct(){
$this->getConn();
}
public function getConn(){
return new mysqli("localhost", "root", "", "os_db");
}
public function select($query){
$data = array();
if($result = $this->query($query)){
while($row = $result->fetch_assoc()){
$data[] = $row;
}
}else{
$data = array();
}
return $data;
}
}

Saturday 31 August 2013

C++ error C2228

C++ error C2228

I'll admit I'm not sure of what I'm doing here, so I am doing a lot of
copying sample code from my textbook and replacing with info for my own
program... but can tell me what is causing this error?
Car.cpp
// Implementation file for the Car class
#include "Car.h"
// This constructor accepts arguments for the car's year
// and make. The speed member variable is assigned 0.
Car::Car(int carYearModel, string carMake)
{
yearModel = carYearModel;
make = carMake;
speed = 0;
}
Car.h
// Specification file for the Car class
#ifndef CAR_H
#define CAR_H
#include <string>
using namespace std;
class Car
{
private:
int yearModel; // Car year model
string make; // Car make
int speed; // Car speed
public:
Car(int, string); // Constructor
};

How to consume web services in Sencha Touch 2.2

How to consume web services in Sencha Touch 2.2

am new to Sencha Touch. I tried to consume web service but its keeps
saying "Unable to load data using the supplied configuration.Open in
Browser". My store is
Ext.define('MyApp.store.MyJsonPStore', {
extend: 'Ext.data.Store',
requires: [
'MyApp.model.MyModel'
],
config: {
autoLoad: true,
model: 'MyApp.model.MyModel',
storeId: 'MyJsonPStore',
proxy: {
type: 'jsonp',
url: 'http://api.twitter.com/1/statuses/public_timeline.json',
reader: {
type: 'json',
rootProperty: 'errors'
}
}
}
});
and my model is
Ext.define('MyApp.model.MyModel', {
extend: 'Ext.data.Model',
config: {
fields: [
{
name: 'message'
},
{
name: 'code'
}
]
}
});
Thanks for your help in advance.

R: using Matplot to plot multiple curves same graph and scale

R: using Matplot to plot multiple curves same graph and scale

I have a table: y
1 2 3 4 5 6
0.2414412019 0.5032905670 0.1956391677 0.0422788008 0.0081100844 0.0015289503
7 8 9 15 20 24
0.0003323805 0.0001329522 0.0001994283 0.0000664761 0.0000664761 0.0000664761
26 27 28 29 30 38
0.0009971415 0.0007312371 0.0023266636 0.0010636176 0.0004653327 0.0001329522
39 40 41 42
0.0001994283 0.0005318088 0.0003323805 0.0000664761
is.table(y)
[1] TRUE
Originally, if I want to create a plot, I could simply do plot(y), which
look likes this
However, now I would like to add another curve to this plot, i.e.
dpois(1:42, lambda = 10). And I would like to preserve the scale by using
matplot. But since y is a table not a vector, I have no idea how to use
matplot to solve the problem. I do not want to use par(new = T) blablabla,
since it doesnt always preserve the scale and I am working with many
tables with different length
Note: my goal is to reproduce the plot above (the vertical lines must be
preserved, I do not want histogram or bars. In other words, I wish the
table structure of y can be preserved) with an additional curve on the
same graph. Can I use matplot or other function to achieve this in R?
Data structure below
dput(y)
structure(c(0.241441201887921, 0.503290567041149, 0.195639167719205,
0.0422788007711228, 0.00811008442464934, 0.00152895034235192,
0.00033238050920694, 0.000132952203682776, 0.000199428305524164,
6.6476101841388e-05, 6.6476101841388e-05, 6.6476101841388e-05,
0.00099714152762082, 0.000731237120255268, 0.00232666356444858,
0.00106361762946221, 0.000465332712889716, 0.000132952203682776,
0.000199428305524164, 0.000531808814731104, 0.00033238050920694,
6.6476101841388e-05), class = "table", .Dim = 22L, .Dimnames =
structure(list(
c("1", "2", "3", "4", "5", "6", "7", "8", "9", "15", "20",
"24", "26", "27", "28", "29", "30", "38", "39", "40", "41",
"42")), .Names = ""))

Azure Caching - Failure after upgrading to SDK 2.1 and caching 2.1

Azure Caching - Failure after upgrading to SDK 2.1 and caching 2.1

It looks like there are a number of questions already open on this topic,
but I believe mine might be different. My setup:
1 Azure Cache Worker Role
1 Web Role
Up until about a week ago, they existed in harmony, until I tried to
upgrade to Azure caching 2.1. Once I did that, I was afflicted with the
"No such host is known" problem that seems to have affected many
developers out there. I found many questions and sites that directed me to
upgrade my Azure SDK installation to the new 2.1 version. I have done all
of these things:
Install newest Azure SDK 2.1
Uninstall Azure SDK 2.0
Uninstall and Reinstall Azure Caching 2.1
Triple check configuration of all my caching settings
Triple check that all references are pointing to the newest versions and
not the old ones
Upgrade my Azure Project to 2.1 by right-click, going to Properties, and
clicking Upgrade
and I am still getting the following (My Error):
Exception type: SocketException
Exception message: No such host is known
at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)
This is different than the more typical error that most other questions
and sites are showing, which is (More commonly reported error, not mine):
No such host is known
Exception message: No such host is known
at Microsoft.ApplicationServer.Caching.AsyncResultNoResult.EndInvoke()
I am about 30 hours into troubleshooting this, and could really use some
help. Maybe I am just missing some step about the upgrade of the SDK?
Somehow maybe sneakily it is still using an old version of a DLL? Is there
some foolproof way to check this besides looking at the path of every
reference in the project (which I have already done, and they all match
up)?

How to convert a jquery array to a string array in javascript

How to convert a jquery array to a string array in javascript

I ran the following jquery command:
x=$(".container h3")
and got back this response:
[<h3>&#8203;A</h3>&#8203;, <h3>&#8203;B&#8203;</h3>&#8203;,
<h3>&#8203;C&#8203;</h3>&#8203;, <h3>&#8203;D&#8203;</h3>&#8203;,
<h3>&#8203;E</h3>&#8203;]
I would like to convert each of the elements in the array to a string, so
the final result would look like this:
["A", "B", "C", "D", "E"]
The problem is that I can't convert each jquery response object into a
string element.
I tried to cast each object as a String, via:
for(var i=0; i < x.length; ++i) {console.log( String(x[i]) )}
But I got back this:
[object HTMLHeadingElement]
[object HTMLHeadingElement]
[object HTMLHeadingElement]
[object HTMLHeadingElement]
[object HTMLHeadingElement]
Is there a direct way of converting each object into a string element?