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?