Posts

java - Isometric Tile Picking Giving Negative Values -

java - Isometric Tile Picking Giving Negative Values - i need find coordinates isometric tiles when it's clicked. i've got figured out. y values returning correctly, apparently x formula wrong , i'm receiving negative values. exhibit a: the grayness tile supposed 0, 0 reason i'm getting -5... here's code. here create map (probably not relevant question here show how i'm doing things). objectid enum storing tile types. objectid tile_map[][] = new objectid[][] { {objectid.ground_concrete, objectid.ground_grass, objectid.ground_grass, objectid.ground_grass}, {objectid.ground_grass, objectid.ground_grass, objectid.ground_grass, objectid.ground_grass}, {objectid.ground_grass, objectid.ground_grass, objectid.ground_grass, objectid.ground_grass}, {objectid.ground_grass, objectid.ground_grass, objectid.ground_grass, objectid.ground_grass}, {objectid.ground_grass, objectid....

apache - How to avoid duplicate content mapping urls with htaccess -

apache - How to avoid duplicate content mapping urls with htaccess - i'm kind of new writing htaccess rules. want create urls in website simple possible. let's want "map" /home/ directory root domain. so, http://www.domain.com display content /home/ directory without changing url. moreover, don't want users / google access to: http://www.domain.com/home/, so, if goes url, want redirect them root domain: http://www.domain.com. i'm seeing google indexing both directories same duplicate content. http://www.domain.com http://www.domain.com/home/ is there can stop this? don't want utilize robots.txt because i've heard it's bad practice. rewriteengine on rewritebase / # redirect /home/ dir 'www.domain.com' #rewritecond %{request_uri} ^/home/$ [nc] #rewriterule ^(.*)$ / [r=301,l] # show /home/ dir 'www.domain.com' rewritecond %{http_host} ^www\.domain\.com [nc] rewritecond %{request_uri} ^/$ rewriterule ^(.*)$ /home/$1 ...

c++ - gmtime is giving me some times localtime? -

c++ - gmtime is giving me some times localtime? - i'm printing events in multi-thread environment console static mutex shared threads. the problem randomly every hundred or one thousand events time local time , not utc. i have seen error in linux machines (build g++) not in windows (build vc++). have no clue start, idea? void publish(std::string source, std::string topic, std::string msg) noexcept { console.lock(); std::time_t = std::chrono::high_resolution_clock::to_time_t(*localtime); char buf[50]; strftime(buf, sizeof (buf), "%y-%m-%dt%h:%m:%s+00:00", gmtime(&now)); cout << buf << " " << source << " " << topic << " " << msg << endl; cout.flush(); console.unlock(); } struct tm * gmtime (const time_t * timer); converts time_t tm utc time. phone call uses value pointed timer fill tm construction values represent corresponding time, ex...

webstorm - Intellij: Move tab left and right -

webstorm - Intellij: Move tab left and right - is there way move/reposition tab using keyboard? know can switch tab using alt + left/right, , able move them maybe using alt + shift + left/right. is possible? my research suggests there's no way (currently). there "move right" , "move down" splits tab groups vertically , horizontally, respectively. there's no key binding seems related this, either. perhaps suggest feature: https:// youtrack.jetbrains.net /issues/idea/ (they have bad cert don't want link directly) there's plugin can install: http://www.smardec.com/products/idea.html unfortunately, doesn't work in intellij 13 (gives runtime errors) intellij-idea webstorm intellij-13

algorithm - Union grouping in bipartite graphs? -

algorithm - Union grouping in bipartite graphs? - i'm trying figure out (and fast) solution next problem: i have 2 models i'm working with, let's phone call them players , teams. player can on multiple teams , team can have multiple players). i'm working on creating ui element on form allows user select multiple teams (checkboxes). user selecting (or deselecting) teams, i'd display teams grouped players. so examples: if selected teams have no players intersect, each team have own section. if user selects 2 teams , have same players, there 1 section containing names of 2 teams , players. if team_a has players [1, 2, 4, 5] , team_b has players [1, 3, 5, 6]. there next sections: section_x = [team_a, team_b, 1, 5], section_y = [team_a, 2, 3], section _z = [team_b, 3, 5] i hope that's clear. essentially, want find teams players have in mutual , grouping that. thinking maybe there way navigating bipartite graph? not sure how though , might overth...

php - Function returns lots of notices -

php - Function returns lots of notices - first off, skill level @ best, hobbit - new compared if not of you. i attempting craft function homecoming single <br /> if no parameter/value given, else homecoming many <br /> tags value $num equal to. i'm trying create function to: a) larn how create functions b) hate typing <br /> c) it's thought function came interested me. so, ideally, in code, if type getbrt() , homecoming 1 single <br /> tag, if type getbrt(1) , homecoming 1 single <br /> tag, if type getbrt(5) , homecoming 5 <br /> tags. its not working hoped when type getbrt() . have slug value in? trying not possible within constraints of php? here function i've built it: function getbrt2($num){ //if num equals 'nothing', 1 break - easier call/type in code repeatedly if ($num = ''){ echo '<br /'; }else{ //if num equals 'something', breaks ...

python - How can I match values from first row of array with values from first column to create a json? -

python - How can I match values from first row of array with values from first column to create a json? - i have list of lists in python has info this: metric, person1, person2, person3, person4, ... sex|male, 0.50, 0.75, 0.35, 0.80, ... sex|female, 0,50, 0.25, 0.65, 0.20, .... age| 18-24, 0.25, 0.20, 0.15, 0.17, ... i create json next structure: info = [{person1:[{sex|male:0.50}, {sex|female:0.50}, {age|18-24:0.25}]}, {person2:[{sex|male:0.75},{sex|female:0.25}, {age|18-24:0.20}]}, ...] how can match these values using python? if, say, have list of lists, i.e. data = [ ['metric', 'person1', 'person2', 'person3', 'person4'], ['sex|male', 0.5, 0.75, 0.35, 0.8], ['sex|female', 0, 50, 0.25, 0.65, 0.2], ['age| 18-24', 0.25, 0.2, 0.15, 0.17], ] the next produce required output: >>> l = zip(*data) # swap rows , columns - it's easier wor...