Thursday, 3 October 2013

fabric.js color of lines of SVG

fabric.js color of lines of SVG

I use fabric.js to draw a path on a map, and I wanna to change color of
the path when cursor is not hovering over it. But it seems to ignore
"stroke" parameter of the GroupPath element that's created using SVG file.
I can change fill color, though it's just filling space in between lines
and looks horrible. How can i change color of lines themselves?
fabric.loadSVGFromURL('somesvg.svg', function(objects, options) {
options.fill = 'red'; // this works
options.stroke = 'green'; // this does not
var group = new fabric.PathGroup(objects, options);
canvas.add(group);
canvas.renderAll();
});

Wednesday, 2 October 2013

AHK utilman script gives file not found error

AHK utilman script gives file not found error

I'm trying to create a simple backdoor for myself through utilman on my
computer using autohotkey. Basically I want to have the ease of access
button function normally in all cases on login screen Except when I hold
down the M key, where in this case it opens cmd instead. No batch or cmd
window should pop up, and one doesn't. The issue I'm having is that I get
a file not found error from the script, I compiled the script into
Utilman.exe and tested with a copy of the real utilman (renamed to lol.exe
which is specified in the script to run normally) and this works fine in
its own directory. However when I do this in the system32 folder it gives
an error that lol.exe is not found, also executing lol.exe on it's own
gives the exact same error, as if it reroutes to the script named Utilman
yet again. Here is the script, should be short and simple:
SetWorkingDir %A_ScriptDir%
Sleep 400
GetKeyState, state, m
if state = D
Run cmd.exe
else
Run lol.exe
Sleep 200
ExitApp
Thanks for any pointers, alternative suggestions or ideas. This would be
great to get working.
EDIT: Changing Run lol.exe to Run, "C:\Windows\System32\lol.exe" now gives
instead an exe corrupted error. This also happens if I run lol.exe on it's
own, I'm really not sure what's happening.

Webservice(asmx) returns array, not list

Webservice(asmx) returns array, not list

I have a deserialization webmethod which returns a list of data in
webservice(asmx), and I am calling the method from client-side. However,
the method is giving me an array, not a list. I understand that it is
because of SOAP response which returns xml format (or something like
that..)
Is it possible to return a list? If then, please tell me an idea.
If not, please teach me an alternative way. (I should not use array...)
service.asmx.cs
[WebMethod]
public IList<Person> DeserializeJson(string value)
{
JavaScriptSerializer js = new JavaScriptSerializer();
IList<Person> tableData = js.Deserialize<IList<Person>>(value);
return tableData;
}
Client.aspx.cs (WebService is my service reference)
WebService.Service1SoapClient client = new WebService.Service1SoapClient();
string stream = client.CreateJsonFromDatabase();
List<WebService.Person> tableData = client.DeserializeJson(stream);

Disable home_url rewrite with WPML plugin

Disable home_url rewrite with WPML plugin

I'm using the WPML Wordpress plugin to translate my website. My default
language is French. When I'm in a translated page, the home_url() is
rewrite with the current language. How can I disable this rewrite so my
home_url() always redirect to the french homepage?
Translate page url : http://www.mydomain.com/en/test/
Actual home_url() : http://www.mydomain.com/en/
Desired home_url() : http://www.mydomain.com/
I've already tried these solutions :
http://wpml.org/forums/topic/wpml-overwrites-home_url-to-append-language-suffix/
http://wpml.org/documentation/support/creating-multilingual-wordpress-themes/home-page-link/
http://wpml.org/forums/topic/wpml-changed-my-default-home-url/
Sorry for my poor english and thanks for the help! Let me know if I need
to provide any other information.

How to make a concept and idea for a website without coding, with animations

How to make a concept and idea for a website without coding, with animations

I have one client he want to make his company's website for which he has
approached us, but the problem is he only want the concept and the
skeleton(innovative idea) from us depending upon which he will then pass
that idea to his developers. Me and my team has tried our best and
presented our innovative idea via power point presentation. But the client
is not at all impressed. He want something which seems live, (like
Shapellhomes.com). My question is how to make a skeleton and idea for a
website(without coding) which include little animation and various
effects. Is there any ready-made tool available to create a skeleton of a
website. please guys help me, because i dnt want to loose this client.

Tuesday, 1 October 2013

basic integer swap with pointers

basic integer swap with pointers

Im trying to swap a few integers using pointers and for some reason im not
fully understanding whats happening.
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
temp = *p2;
*p2 = *p1;
*p1 = temp;
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
The output im getting is: x: 0 y: 99 x: 0 y: 0
Thanks
Edit: Thats what i believe is the problematic area. The code in its
entirety is a series of pointer tasks.
#include <iostream>
using namespace std;
void swap(int *x, int *y);
void noNegatives(int *x);
int main ()
{
int x,y,temp;
int *p1, *p2;
p1 = &x;
*p1 = 99;
cout << "x: " << x << endl;
cout << "p1: " << *p1 << endl;
p1 = &y;
*p1 = -300;
p2 = &x;
temp = *p1;
*p1 = *p2;
*p2 = temp;
noNegatives(&x);
noNegatives(&y);
p2=&x;
cout<< "x: "<<*p2<<endl;
p2=&y;
cout<< "y: "<<*p2<<endl;
int a[1];
p2 = &a[0];
*p2 = x;
cout << "First Element: " << p2<< endl;
p2 = &a[1];
*p2 = y;
cout << "Second Element: " << p2<< endl;
p1 = &a[0];
p2 = &a[1];
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
temp = *p2;
*p2 = *p1;
*p1 = temp;
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
cout << "First Element: " << a[0]<< endl;
cout << "Second Element: " << a[1]<< endl;
swap(&x,&y);
cout<< "x: " << x <<endl;
cout<< "y: " << y <<endl;
swap(&a[0], &a[1]);
cout<< "a[0]: " << a[0] <<endl;
cout<< "a[1]: " << a[1] <<endl;
}
void noNegatives(int *x)
{
if(*x<0)
*x=0;
}
void swap(int *p1, int *p2)
{
int temp;
temp = *p1;
*p1 = *p2;
*p2 = temp;
}
my goal is for the last x and y to be x: 99 and y: 0. Everything else
works as it should.
oh my god nevermind it was the array. Thank you so much for catching that
bonehead error.

How to return the value of a key: function() in javascript

How to return the value of a key: function() in javascript

Here is what I have inside a backbone model:
defaults: {
prayer_string: function (){
var label_val = $("#prayer_type_label").val();
console.log("Prayer_string returning: ", label_val);
return label_val;
}
}
But when I access the model like so:
var prayerString = model.prayer_string;
prayerString is the function and not the return label_val.
What do I need to do to get the return value of the function instead of
the function itself?
Thanks,
Andrew