Thursday, 3 October 2013

jquery - Adding an additional variable to an if statement

jquery - Adding an additional variable to an if statement

I'm trying to add in an additional variable to an if statement but I'm
having trouble. #status refers to the id of a select, and 'student' is one
of the options. The code works fine without the additional && statement.
What am I doing wrong?
var status
$("#status").change(function() {
status = $(this).val();
});
$(function() {
$('#fb').flexbox(jobroles, {
onSelect: function() {
if(this.value==="Multi therapist" &&
$('#status').val()==="Student"){
$("#gdc").show();
}
else{
$("#gdc").hide();
}

Wednesday, 2 October 2013

Search multine issue

Search multine issue

Hello i'm doing a search by multi lines
Here is my table
PEOPLE
|id| |name| |lastname1|
integer varchar(255) varchar(255)
|1| |Michael New Rails| |Morote|
|2| |Charles Chris Angels| |Flowers|
|3| |Gabriel Francis James| |Owen|
Here is my controller
@people = Person.find(:all,:conditions => ["( name LIKE ? OR
lastname1 LIKE ? OR
(concat(name, \" \", lastname1) LIKE ? )
)" ,
"%#{params[:query]}%",
"%#{params[:query]}%",
"%#{params[:query]}%" ])
But is not working properly
Someone can help me to search by whatever order in the name like me example?
I will really appreciate help

3dsmax to Unity export animation

3dsmax to Unity export animation

I'm having some difficulty exporting animated meshes from 3dsmax to Unity3d.
I've succeeded in getting transform animations to export ok, for instance
if something is moving. But animated parameters on something dont seem to
export, for instance the height of box. Here are my fxb export settings
I'm guessing they are losing this information when they are turned from
boxes to meshes and i must back the animations on manually somehow but I
have no idea how.

Why I can't get complete data from using Google Map api?

Why I can't get complete data from using Google Map api?

I created a Python project to test google map api. I occured problem when
I test the first API:Nearby Search Requests.
I tried this url official doc provided:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=AddYourOwnKeyHere
if I put this url on my browser,I'll get perfect data on browser. Then I
did nothing but created a python module , here is the code :
if __name__ == '__main__':
import socket
import ssl
sock = ssl.wrap_socket(socket.socket())
sock.connect(('maps.googleapis.com', 443))
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('maps.googleapis.com', 443))
sslSocket = socket.ssl(s)
uri = 'GET
/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&sensor=false&key=MyKey
HTTP/1.1\r\nHost:maps.googleapis.com\r\nContent-Type: application/json;
charset=UTF-8\r\naccept-encoding:gzip,deflate,sdch\r\n\r\n'
sslSocket.write(uri)
data = sock.read()
print 'going to connect...'
print data
s.close()
UnfortunatelyCthe result on the console I got is like this F
going to connect...
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Date: Wed, 02 Oct 2013 08:05:59 GMT
Expires: Wed, 02 Oct 2013 08:10:59 GMT
Cache-Control: public, max-age=300
Vary: Accept-Language
Server: mafe
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Alternate-Protocol: 443:quic
Transfer-Encoding: chunked
560b
{
"debug_info" : [],
"html_attributions" : [
"Listings by \u003ca href=\"http://www.yellowpages.com.au/\"\u003eYellow
Pages\u003c/a\u003e"],
"next_page_token" :
"ClRHAAAA4lOaMlZcUjyndIqhBsHzyyU0nD5PHarmjgmnguj3morn7Em-
ipqhSR33V__d0kjrL4PzAqY7y4TAK7Uj3XzWjhoUchLBcBs-
TNFxWIvGst8SEArmj_T7_eDZWyr8UDGy5OEaFPFaK2yHDg7Kv2U3Obsy7opkQfEw",
"results" : [
{
"geometry" : {
"location" : {
"lat" : -33.8599827,
"lng" : 151.2021282
},
"viewport" : {
"northeast" : {
"lat" : -33.8552584,
"lng" : 151.2031401
},
this result is incomplete and I tried many times, the results are same.
So, how to solve this problem?

Tuesday, 1 October 2013

PostgreSQL crashes upon startup

PostgreSQL crashes upon startup

Every time I restart my Mac OS X Version 10.8.3. and open PSQL Version
9.2.4.3 (14), the PSQL terminal appears for a second and then shuts down.
Below is the info from the docs http://postgresapp.com/documentation
Uninstalling
What I do to remedy the problem is type these 3 lines of code in bash:
open ~/Library/Application\ Support/Postgres --> I delete the Var folder
sudo sysctl -w kern.sysv.shmall=65536 sudo sysctl -w
kern.sysv.shmmax=16777216
When I restart PSQL, it works. The problem I have an empty database. All
my work is gone. How can I get PSQL running permantely so that I do not
have to restart with an empty database?

Logic in an overloaded constructor in scala

Logic in an overloaded constructor in scala

I am trying to add some processing logic in an overloaded constructor, but
cannot seem to get it working.
Here is a simplified example of what I want to do:
class FooBar(val x: String, val y: String) {
this(z: String) = {
// DO SOME ARBITRARY CODE
val x = // SOME ARBITRARY PROCESSING USING z
val y = // SOME ARBITRARY PROCESSING USING z
this(x, y)
}
}
However, I am getting a compilation error:
: 'this' expected but 'val' found
This is a very simple task in Java, I would simply set the x, y instance
variables from 2 separate constructors.
Here is my Java equivalent of what I would like to accomplish:
class FooBar {
public String x;
public String y;
public FooBar(String x, String y) {
this.x = x;
this.y = y;
}
public FooBar(String z) {
// DO SOME ARBITRARY CODE
this.x = // SOME ARBITRARY PROCESSING USING z
this.y = // SOME ARBITRARY PROCESSING USING z
}
}

Square root of a natural number to square root of another natural number – math.stackexchange.com

Square root of a natural number to square root of another natural number –
math.stackexchange.com

Is there such integers $x,y$ which they're not perfect squares and they're
not equal, such that: $\sqrt{x}^\sqrt{y}$ is actually an integer? Or
rational number?

IPv6, cant ping Google from linux server

IPv6, cant ping Google from linux server

i assigned an IPv6 to my VPS (myipv6::5) from my host dedicated server
which has myipv6::/64 assigned to it by datacenter.
from VPS i did: ping6 -I myipv6::5 myipv6::1
So Im able to ping gateway, but I cannot ping past the gateway like this...
ping6 -I myvpsipv6::5 ipv6.google.com
PING ipv6.google.com(wg-in-x6a.1e100.net) from myipv6::5 : 56 data bytes
From myipv6::1 icmp_seq=2 Destination unreachable: Address unreachable
From myipv6::1 icmp_seq=3 Destination unreachable: Address unreachable
From myipv6::1 icmp_seq=4 Destination unreachable: Address unreachable
When i do same command (ping6 -I myipv6::5ipv6.google.com) at host machine
(node server) where this VPS resides, the result is SAME "Address
unreachable".
Here are commands i did on host dedicated server
ifconfig
eth0 Link encap:Ethernet HWaddr 4C:72:B9:D2:BD:D4
inet addr:myipv4addresshere Bcast:*.*.*.255 Mask:255.255.255.0
inet6 addr: myipv6here::1/64 Scope:Global
inet6 addr: fe80::4e27:c8ff:fec2:bdd4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1767143835 errors:0 dropped:0 overruns:0 frame:0
TX packets:2246662202 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:878001097058 (817.7 GiB) TX bytes:2303874402348 (2.0 TiB)
Interrupt:225 Memory:fe500000-fe520000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:8467408 errors:0 dropped:0 overruns:0 frame:0
TX packets:8467408 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1050265852 (1001.6 MiB) TX bytes:1050265852 (1001.6 MiB)
venet0 Link encap:UNSPEC HWaddr
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet6 addr: fe80::1/128 Scope:Link
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:2223530855 errors:0 dropped:0 overruns:0 frame:0
TX packets:1740960126 errors:0 dropped:1948050 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2262666403904 (2.0 TiB) TX bytes:831015511414 (773.9 GiB)
route -n -A inet6
Kernel IPv6 routing table
Destination Next Hop
Flags Metric Ref Use Iface
myipv6here::5/128 ::
U 1024 0 0 venet0
myipv6here::6/128 ::
U 1024 0 0 venet0
myipv6here::/64 ::
U 256 1 0 eth0
myipv6herefff:ff:ff:ff:ff/128 ::
U 1024 1 0 eth0
fe80::/64 ::
U 256 0 0 eth0
fe80::/64 ::
U 256 0 0 venet0
::/0 myipv6here::
UG 1 34866 0 eth0
::/0 myipv6herefff:ff:ff:ff:ff
UG 1024 0 0 eth0
::1/128 ::
U 0 18787 1 lo
myipv6here::/128 ::
U 0 0 1 lo
myipv6here::1/128 ::
U 0 131933 1 lo
fe80::/128 ::
U 0 0 1 lo
fe80::1/128 ::
U 0 0 1 lo
fe80::4e27:c8ff:fec2:bdd4/128 ::
U 0 2 1 lo
ff00::/8 ::
U 256 0 0 eth0
ff00::/8 ::
file /etc/sysconfig/network:
NETWORKING_IPV6=yes
IPV6FORWARDING=yes
IPV6_DEFAULTDEV=eth0
IPV6_DEFAULTGW=myipv6here:0000:0000:0000:0000 ([openvz][1] shows that it
should end by ::1)
IPV6_AUTOCONF=no
file etc/sysconfig/network-scripts/ifcfg-eth0
IPV6INIT=yes
IPV6_AUTOCONF=no
IPV6ADDR=myipv6here::1/64 (openvz shows that this ip should be without /64)
file /etc/sysctl.conf
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.all.proxy_ndp = 1
net.ipv6.bindv6only = 1
net.ipv4.conf.default.proxy_arp=0
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.default.send_redirects=1
net.ipv4.conf.all.send_redirects=0
Please anyone have ideas how to make this IPv6 working on the host server?
Isnt there any issue with route? I read this post, which might give an
idea about route, but i cant understand how that apply on my case, anyone
please can help?