Sunday, 1 September 2013

fetch() returns : warning: block supersedes default value argument

fetch() returns : warning: block supersedes default value argument

Why do I get this warning and what it means?
a = [1,3,5]
a.fetch(0) #=> 1
a.fetch(0,0) #=> 1
a.fetch(22) { "out of range" } #=> out of range
a.fetch(0,0) { "out of range" } #=> returns 1 with warning: block
supersedes default value argument

similarity between two documents using machine learning

similarity between two documents using machine learning

I have two research papers and i want to detect the amount of similarity
between the two with a good accuracy.any sort of journal,reference would
be appreciated.
thanks in advance

Saturday, 31 August 2013

arrays does not null from beginning

arrays does not null from beginning

I'm a beginner in C .... I have a little code:
#include <stdio.h>
#include <string.h>
int main(){
char str1[100];
char str2[100];
char str3[100];
char str4[100];
puts(str1)
puts(str2);
puts(str3);
puts(str4);
return 0;
}
I got result
2
èý(
'Q]wØ„ÃîþÿÿÿÀ"bwd&bw
I don't know why my array does not empty from the begin. And I have to set
first element to "\0" to clear content of array. Can anyone explain for
me. Thank a lot.

Whyisn't my flexslider working? [on hold]

Whyisn't my flexslider working? [on hold]

Take a look and let me know. Yeah yeah they're kittens.
http://shopmoonfall.bigcartel.com/

ExtJS Panel item listener of click event only fires once

ExtJS Panel item listener of click event only fires once

the select listener is only firing once.Than returns and appended property
of firing: false on the second click. How can I prevent this from
happening?
xtype: 'combo',
store: ds,
displayField: 'title',
typeAhead: false,
hideLabel: true,
hideTrigger:true,
anchor: '100%',
minChars: 1,
listConfig: {
loadingText: 'Searching...',
emptyText: 'No matching buildings found.',
// Custom rendering template for each item
getInnerTpl: function() {
return '<div class="search-item">{name}</div>';
}
},
pageSize: 10,
// override default onSelect to do redirect
listeners: {
'select': function(combo, selection) {
console.log('you there?');
var building = selection[0];
if (building) {
retrieveBuildingInfo(Ext.String.format(env_url +
'building.php?id={0}', building.get('id')));
}
},
'expand': function() {
Ext.Msg.alert("test","do you see me");// this
alert never show, when the combo expanded
console.log(this.events.select);
}
}

Different text color for each class object?

Different text color for each class object?

I'm making some kind of "game score tracker". Here's how the app currently
works:
User adds players by typing a name into EditText and then clicking ok button.
After the user finished adding new players, he presses "start game" button
and a new activity opens.
Players are added to Parcelable extra and taken to the next activity.
In the next activity, a user has a spinner, EditText and +, - buttons.
After the user selects a certain player from the spinner, types in a
certain score and then either a + or -, a new TextView will appear
containing Player name and score.
Example: If there are 3 Players "James, John and Robert". The user then
adds 5 points to James, 10 points to John and 15 points to Robert. This is
how TextViews will look like:
James 5
John 10
Robert 15
Then if user will do the exactly same thing again, this will happen:
James 5
John 10
Robert 15
James 10
John 20
Robert 30
So as you can see, I don't keep the same TextView for each player but I
keep adding them (I do want that, I want the user to be able to see his
actions, when he clicked - and when +. But is there a way to somehow set a
color for each user? Example: James will be blue, John will be red and
Robert will be green. How do I pre-determine the color of each Player's
TextView?
Player class:
public static class Player implements Parcelable{
String name;
int score;
@Override
public int describeContents() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(score);
dest.writeString(name);
}
public Player(Parcel source){
score = source.readInt();
name = source.readString();
}
public Player(){
}
public static final Parcelable.Creator<Player> CREATOR = new
Parcelable.Creator<Novaigra.Player>() {
@Override
public Player createFromParcel(Parcel source) {
return new Player(source);
}
@Override
public Player[] newArray(int size) {
return new Player[size];
}
};
}
Can I add some kind of color palette to the activity when players are
being added so that a user can pre-determine a color or something?

Ember.js pushState router takeover Laravel route

Ember.js pushState router takeover Laravel route

I'm developing a Laravel/Ember.js app where Laravel serves a general role
of a backend framework and RESTful data supplier and Ember.js partially
for the client side.
So far it works fine. However I want Ember.js to take control for some of
the sub-urls.
Say I have /members route in Laravel which serves Ember app and I want
sub-consequent URL to take advantage of pushState w/ Ember like so:
/members/add, /members/edit/1 etc.. instead of /members#/add,
/members#/edit/1
With Ember this is easily achieved:
App.Router.reopen({
location: 'history', //instead of 'hash'
rootURL: '/members'
})
and it works fine when I click on the links.
However, when I refresh the page Laravel router kicks in with .htaccess
which tries to serve every url through laravel's index.php in public
folder. Here's Laravel original .htaccess file:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I'm no expert in Apache URL rewriting, so what I need to do is tell
.htaccess to rewrite everything that follows /members (/members/add,
/members/view etc..) back to /members route so Ember.js would take over
and redirect appropriately.
I was trying to do something like this, but it didn't work:
<IfModule mod_rewrite.c>
Options -MultiViews
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine On
RewriteCond %{REQUEST_URI} /members
RewriteRule (.*) members
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
Any help on this topic of url rewriting is appreciated. Thanks!