I'm trying to create a dynamic datagrid using jsgrid based in a plain text.
I know I could use the option "editable" and use the own jsgrid tools to implement a dynamic datagrid, but this project is focused in a specific area where most of users are used to use plain text to copy and to archive the data in question, so it's mandatory to me to use plain text to keep easy to input and to output data whenever necessary.
Until now, I'm simply writing the data grid over again every time the input is changed, but obviously as the input becomes larger, more slow is this writing.
Here the link for tests: http://balaiomtg.ligaos.net/
Try this as input:
1 Zedruu the Greathearted
1 Steel Golem
1 Illusions of Grandeur
1 Pyromancer's Swath
1 Celestial Dawn
1 Gilded Drake
1 Vedalken Plotter
1 Political Trickery
1 Shifting Borders
1 Phyrexian Metamorph
1 Psychosis Crawler
1 Mirror-Sigil Sergeant
1 Yosei, the Morning Star
1 Keiga, the Tide Star
1 Consecrated Sphinx
1 Sun Titan
1 Niv-Mizzet, the Firemind
1 Numot, the Devastator
1 Eternal Dragon
1 Quicksilver Gargantuan
1 Chancellor of the Spires
1 Bogardan Hellkite
1 Iona, Shield of Emeria
1 Hinder
1 Spell Crumple
1 Forbid
1 Decree of Silence
1 Journey to Nowhere
1 Oblivion Ring
1 Detention Sphere (RTR)
1 Nevermore
1 Orim's Thunder
1 Dismantling Blow
1 Hallowed Burial
1 Terminus
1 Austere Command
1 Wild Research
1 Idyllic Tutor
1 Tezzeret the Seeker
1 Mystic Remora
1 Rhystic Study
1 Fact or Fiction
1 Future Sight
1 Aeon Chronicler
1 Sphinx's Revelation
1 Lightning Greaves
1 Whispersilk Cloak
1 Crystal Shard
1 Spreading Seas
1 Paradox Haze
1 Copy Enchantment
1 Venser the Sojourner
1 Sphere of the Suns
1 Vessel of Endless Rest
1 Darksteel Ingot
1 Coalition Relic
1 Expedition Map
1 Journeyer's Kite
1 Pilgrim's Eye
1 Solemn Simulacrum
1 Command Tower
1 Homeward Path
1 Reliquary Tower
1 Kher Keep
1 Terramorphic Expanse
1 Evolving Wilds
1 Celestial Colonnade
1 Glacial Fortress
1 Mystic Gate
1 Flooded Strand
1 Azorius Chancery
1 Hallowed Fountain
1 Battlefield Forge
1 Arid Mesa
1 Rugged Prairie
1 Boros Garrison
1 Sacred Foundry
1 Cascade Bluffs
1 Steam Vents
1 Izzet Boilerworks
1 Shivan Reef
1 Vivid Meadow
1 Vivid Crag
1 Vivid Creek
1 Tolaria West
1 Mistveil Plains
6 Island
5 Plains
3 Mountain
1 Bruna, the Fading Light*
1 Gisela, the Broken Blade
1 Knight of the White Orchid
1 Thalia's Lancers
1 Sol Ring*
1 Thran Dynamo*
1 Caged Sun
1 Hedron Archive*
1 Worn Powerstone*
1 Pearl Medallion
1 Grand Abolisher
1 Serra Avenger*
EDIT: set a larger sample to input.
Related
I have a simple byte flag with two bits that represents if a person was invited to, and is attending, an online interview. Attendance is represented by two Radio selectors in a form, and could be either Yes, No, or NULL. Invited can be NULL.
bit index 0 = INVITED?
bit index 1 = ATTENDING?
7 6 5 4 3 2 1 0 bit index
=========================================================
128 64 32 16 8 4 2 1 binary notation
=========================================================
1 1 invited, attending
1 0 invited, not attending
0 1 not invited, attending
0 0 not invited, not attending
The user can change the Attending bit via radio controls in the
form. It can be Yes, No, or NULL.
The user cannot switch the Invited bit. It is set to 1 on initial
import, otherwise, it is NULL.
The Invited bit is set to 1 upon initial import into the
application. However, the Attending bit should be NULL, since there
we don't know yet if they're attending.
That's my problem!! The Attending bit is naturally 0, because the user hasn't confirmed if you are attending.
I don't know how to represent the state of "on initial import, Attendance is unconfirmed"
Can I represent a "NULL" state at bit index 1? Should I just add an additional bit to represent an unconfirmed state? Should I change my byte flag to better represent what's going on?
Something like this. I would have to remember to clear bit index 2.
bit index 0 = INVITED?
bit index 1 = ATTENDING?
bit index 2 = UNCONFIMRED ATTENDANCE?
7 6 5 4 3 2 1 0 bit index
=========================================================
128 64 32 16 8 4 2 1 binary notation
=========================================================
1 0 1 invited, not attending, attendance not established yet
0 1 1 invited, attending, attendance established
I have big dataset with 200 items. For each math correlation value with others. Matrix 200x200.
Something like that:
item item correl
1 1 1
2 1 0.58
3 1 0.95
4 1 -0.05
1 2 0.58
2 2 1
3 2 0.42
4 2 -0.20
1 3 0.95
2 3 0.42
3 3 1
4 3 0.09
1 4 -0.05
2 4 -0.20
3 4 0.09
4 4 1
Or without duplicates:
item item correl
1 2 0.58
2 3 0.42
3 4 0.09
4 1 -0.05
1 3 0.95
2 4 -0.20
(Similar mechanism uses full text search: docs->doc->words, where we count doc weigth per word and further sort docs by words in query)
I need to draw network scatter where each point will be related by tie strength with each other. Something like gravity where points groups by correlation value
pic1
pic2
Prefer for interactions: select, zoom, sort, filter, search etc
You know tool something like this?
Thanks
Sounds like a job for D3.js
D3
Is this what you are looking for?: http://bl.ocks.org/mbostock/3887118
- https://d3js.org/
What I want is to know how star ratings works. I don't get the logic of it.
Example:
5 star - 300 people
4 star - 45 people
3 star - 100 people
2 star - 99 people
1 star - 10 people
Total of 554 people
I want to convert these number of votes to percentage and compute all of it to get its average
5 star - 40% (300 people)
4 star - 10% (45 people)
3 star - 21% (100 people)
2 star - 20 % (99 people)
1 star - 9% (10 people)
a total of 100%
It's just a random percentage. It's not the correct answer.
How can I achieve that ? I don't think if that's the correct process of ratings.
I am confused s to what the question is?
But first some math:
5 star - 300 people
4 star - 45 people
3 star - 100 people
2 star - 99 people
1 star - 10 people
Total of 554 people
We can easily calculate the vote distribution in percent for stars, lets check units:
[count of people]/[total of people] => ratio of people
ratio of x * 100 => % of x
i.e:
(300/554) * 100 = 54.1516245487 % of people
and compute for all
5 star - 300 people - 54.15 % of votes
4 star - 45 people - 8.12 % of votes
3 star - 100 people - 18.05 % of votes
2 star - 99 people - 17.87 % of votes
1 star - 10 people - 1.80 % of votes
error due to round off: 100 - (sum(%) = 99.99) = 0.01 so its ok to round of
however this is not what the figures you came with looks like.
This is probably because the code you are using, is not showing the percent of people who voted for something, but instead it shows an estimate of how the votes should be distributed, and not how they are.
Many rating systems actually count votes with different weights, depending on either the existing distribution, or to equate votes across cultures.
I am Danish, so I'll use that culture of reference, for the example.
Take for instance Rural Denmark.
In this culture, no one actually uses rates 5 or 1, unless the thing thats being rated is very extremely extraordinary bad or good.
In fact it is also more likely to get a 1 than a 5.
- but if you get a 2 or 4, it is not "close to 3" it is in fact really bad or really good..
In the Urban Denmark you get more exited, and easily vote 5 for something that is basivly a mediocre performance. Also 1 for something just because you had a bad day.
So for an ordinary but good show, (should rate mean 4) this would be the two distributions:
Rural:
5 stars - 1 people
4 stars - 3 people
3 stars - 10 people
2 stars - 5 people
1 stars - 1 people.
Urban:
5 stars - 4 people
4 stars - 5 people
3 stars - 5 people
2 stars - 3 people
1 stars - 3 people.
notice the cultural difference clearly shown in these made up results..
I am not making this up its called response styles, you may want to read this:
http://www.harzing.com/download/respstyles.pdf
So the developer needs to consider which response style the ratings should compensate for.
I could easily weigh the Rural votes, and let the 1 person who dared to press 5 stars, get extra weight in the votes, and also give the people that voted 3 stars, get less wieght. This would make the two results look more alike, and make it easier for an urban dweller to compare the results.
But is that actually correct. ? (to choose urban votes as the norm, and modify the others to fit) would the opposite argument be just as good?
weigh 5 and 1 less in the urban votes, and 3 more, to make it look more comparable for the rural population?
--
in your case it seems that the results carry weights
we cannot see how the weights have been found, but we can deduct something from them.
weights:
5 star - 40% / 54.15% ~= 0.74
4 star - 10% / 8.12% ~= 1.21
3 star - 21% / 18.05% ~= 1.16
2 star - 20% / 17.87% ~= 1.18
1 star - 9% / 1.8% ~= 5
so in this case a negative vote is valued with a high weight, and a positive vote, is given less wight.
I would have expected that the sum of the weights would equal 1, but they are not, so this could be the result of manually fine tuning the results of ratings, to some desired distribution (commercial interests), or perhaps a miscalculation on your part.
Just some basic math.
Sum: 300 + 45 + 100 + 99 + 10 = 554 Votes
Percentage by rating:
5 Star: (300/554) * 100 = 54,15162455%
4 Star: (45/554) * 100 = 8,122743682%
3 Star: (100/554) * 100 = 18,05054152%
2 Star: (99/554) * 100 = 17,8700361%
1 Star: (10/554) * 100 = 1,805054152%
Average:
(5*300) + (4*45) + (3*100) + (2*99) + (1*10) = 2188
2118 / 554 = 3,949458484 stars
First of all get total no of people vote.
and use this function to show percentage.
star percentage = star total people vote * 100 / total no of people vote.
for example if you want to get 5 star rate percentage then
5 star percentage = 300 * 100 / 554
I am trying to build a simple OCR system (if there is such a thing!)
I have a successful working model (90% recognition - which I call success :-P) for single characters - I am now trying to make it recognise multiple characters.
What I want to do is find all connected pixels (this system is designed for none joined up writing only)
so if I read across a 1 pixel high line i find a 'black' pixel - how would I then find every connected pixel - efficiently :-P
I could brute force it by literally looking at the pixel above, below, right and left and then looking at each of those pixels in the same manner but I am assuming there is a better methodology.
Or is it better to add every pixel to a matrix and then do comparisons on it then?
I basically want to output a multi dimensional array along the lines of:
1 1 1 1
1 1 1 1
0 1 1 0
0 1 1 0
0 1 1 0
0 1 1 0
1 1 1 1
1 1 1 1
Which would be a capital I
Javascript is what it is written in, but if someone has the method in PHP I should be able to convert (unless it has multiple libraries needed!)
Hope that is clear - any further info please ask in comments.
I'm trying to build a Google Line Chart with MySQL data and while I understand Javascript and how to get data with PHP I'm having a hard time wrapping my head around getting and/or formatting the data in the correct manner.
Right now my table looks like this
PERSON WEEK PRODUCTION
Bob 2 1
Bob 3 0
Bob 4 0
Bob 5 2
Bob 6 0
Paul 1 0
Paul 2 0
Paul 3 0
Paul 4 2
Paul 5 3
Paul 6 1
Mike 1 0
Mike 2 1
Mike 3 1
Mike 4 4
Mike 5 0
Mike 6 1
Ron 1 1
Ron 3 0
Ron 4 0
Ron 6 0
And the graph I essentially want create looks like this
I was able to make that in the Google Code Playground by manually tweaking the data to look like this
WEEK BOB PAUL MIKE RON
1 0 0 0 1
2 1 0 1 0
3 0 0 1 0
4 0 2 4 0
5 5 3 0 0
6 0 1 1 0
So my big question though is how do I do this in an automated fashion? Obviously I need to either modify my sql query to do the heavy lifting there or massage the data with PHP afterwards, but I'm as lost as a babe in the woods on how to do that. Further complicating the issue, at least in my eyes, is that in the original data set not every has all the weeks, but needs them to be created and zero'ed out in the final result set. Also while I'm showing 4 persons it could be 1 to N.
If anyone could point me in the right direction I would be eternally grateful!
UPDATE
#asgallant pointed me to this example he had written up - http://jsfiddle.net/asgallant/HkjDe/
I tried implementing the solution he presented, which can be seen here - http://thejspot.ws/qa/table.php
While the first table populates, the second table never displays. I've tracked it down to this line of code, but I'm not sure what the issue is.
var pivotedData = google.visualization.data.group(view, [0], groupColumns);
Any suggestions?