I'm designing a piece of a game where the AI needs to determine which combination of armor will give the best overall stat bonus to the character. Each character will have about 10 stats, of which only 3-4 are important, and of those important ones, a few will be more important than the others.
Armor will also give a boost to 1 or all stats. For example, a shirt might give +4 to the character's int and +2 stamina while at the same time, a pair of pants may have +7 strength and nothing else.
So let's say that a character has a healthy choice of armor to use (5 pairs of pants, 5 pairs of gloves, etc.) We've designated that Int and Perception are the most important stats for this character. How could I write an algorithm that would determine which combination of armor and items would result in the highest of any given stat (say in this example Int and Perception)?
I need a way for jQuery to return all elements that have the css
font-family:AvantGardeITCbyBT-Bold, sans-serif;
applied to them.
I'm thinking the only way of doing this is looping through all elements and checking if this css is applied to it. Seems a slow way of doing it?
Is there a way of doing this via a jQuery Selector?
The script below adds a custom meta box to the WordPress page editor interface. It lists two specific categories, "noindex" and "nofollow", which my custom theme automatically installs when the theme is activated.
It works fine for selecting and assigning the categories to the page. However, if the user unchecks either of them, the settings do not stick. Once selected, they cannot be removed from the page, regardless if they are unchecked when the page is saved.
<?php
function my_post_categories_meta_box() {
add_meta_box('categorydiv', __('Page Options'), 'post_categories_meta_box_modified', 'page', 'side', 'core');
}
function post_categories_meta_box_modified($post) {
$noindexCat = get_cat_ID('noindex');
$nofollowCat = get_cat_ID('nofollow');
if(in_category("noindex")){ $noindexChecked = " checked='checked'";}
if(in_category("nofollow")){ $nofollowChecked = " checked='checked'";}
?>
<div id="categories-all" class="ui-tabs-panel">
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
<li id='category-<?php echo $noindexCat ?>' class="popular-category"><label class="selectit"><input value="<?php echo $noindexCat ?>" type="checkbox" name="post_category[]" id="in-category-<?php echo $noindexCat ?>"<?php echo $noindexChecked ?> /> noindex</label></li>
<li id='category-<?php echo $nofollowCat ?>' class="popular-category"><label class="selectit"><input value="<?php echo $nofollowCat ?>" type="checkbox" name="post_category[]" id="in-category-<?php echo $nofollowCat ?>"<?php echo $nofollowChecked ?> /> nofollow</label></li>
</ul>
</div>
<?php
}
add_action('admin_menu', 'my_post_categories_meta_box');
?>
Now, I am developing with mailing system with delayed_jobs gem.
When I ran on developing environment, it operated well.
But, after deploying application on server, it is not acted.
This is my database.yml
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: sqlite3
database: /var/www/service/shared/db/production.sqlite3
pool: 5
timeout: 5000
I checked queue(in /var/www/...) and it act well. Also, I started delayed_jobs(rake jobs:work).
So, I think that problem is delayed_job crawl db/development.sqlite3
How can solve this problem?
I am using require.js to require JS modules in my application.
I need a way to bust client cache on new JS modules, by way of a different requested URL.
i.e., if the file hello/there.js has already been cached on the client, I can change the file name to force the browser to get the new file.
In other words, for the module hello/there, I'd like require.js to request the url hello/there___v1234___.js (the file name can look different, it's just an example), according to a version string which is accessible on the client.
What is the best way to achieve that?
Below is my data:
Data Here 94/452O
Data more 94/4522i
Data bla 94/111
Data bla 94/459es
Data bla 94/444
items is automatically generated by some previous code but it could come out like:
items = ["Data Here 94/452O", "Data more 94/4522i", "Data bla 94/111", "Data bla 94/459es", "Data bla 94/444"]
Now currently I'm appending the following:
"\n".join(items).replace("4ke", "9") with a few other .replaces however I want it to replace/change the characters on the end of the numbers with a capital letter instead of lowercase...
Output:
Data Here 94/452O
Data more 94/4522I
Data bla 94/111
Data bla 94/459ES
Data bla 94/444
Problem with jQuery:
After changing the border and background color of some input fields in a form that fail the validation i don't know how to get the previous, original colors back as i don't pre-style the inputs but use the browser settings instead. how to handle this?
thanks in advance,
clubnite
Hi there,
I am developing an iPhone app, which now can update Twitter account with GPS coordinates in real-time, by the Twitter API link: http://username:[email protected]/statuses/update.xml , and I am looking at how to make my own database to accept updates from iPhone, via a similar API page.
It seems a .php page can serve as the API, and MySQL can serve as the database.
What are the good ways of doing it? Any template code and tutorial please?
Hi
I have my own data structure written in C# like:
public class ElectricScheme
{
public List<Element> Elements { get; set; }
public List<Net> Nets { get; set; }
}
public class Element
{
public string IdName { get; set; }
public string Func { get; set; }
public string Name { get; set; }
public BaseElementType Type { get; set; }
public List<Pin> Pins { get; set; }
}
public class Pin
{
public string IdName { get; set; }
public string Name { get; set; }
public BasePinType PinType { get; set; }
public BasePinDirection PinDirection { get; set; }
}
public class Net
{
public string IdName { get; set; }
public string Name { get; set; }
public List<Tuple<Element,Pin>> ConnectionPoints { get; set; }
}
Where Elements count ~19000, each element contain =3 Pin,
Nets count ~20000, each net contain =3 pair (Element, Pin)
Parse txt (file size ~17mb) file takes 5 minutes.
Serilization / Deserialization by default serializer ~3 minutes.
Load from DB 20 minutes and not loaded...
I use Entity Framework like
public ElectricScheme LoadScheme(int schemeId)
{
var eScheme = (from s in container.ElectricSchemesSet
where s.IdElectricScheme.Equals(schemeId)
select s).FirstOrDefault();
if (eScheme == null) return null;
container.LoadProperty(eScheme, "Elements");
container.LoadProperty(eScheme, "Nets");
container.LoadProperty(eScheme, "Elements.Pins");
return eScheme;
}
The problem is dependencies between Element and Pin... (for ~19000 elements ~95000 pins)
Any ideas?
I have a div container with 3 div elements inside (A, B, and C). I'll know the width of the container and the width of A and B) the problem is that in some cases B won't be there in which case I need C to expand to fill the rest of the container. How would I do this with straight css or am I going to need to use javascript to calculate the width?
Thanks.
This MESSED ME UP hard. I thought i was setting the key but i was not. No exceptions, nothing happen except bad results. Why is there a setter if everything is ignored and no exceptions are thrown when i attempt to write? What is the point of the setter on the Keys property?
When i do the below Key value are not changed. After an hour when i realize what was happening i wrote the loop to verify. I also tried aes.Key[0] = val; var b = val == aes.Key[0]; (and messed with it in immediate mode).
Why does it have this behavior?
Array.Copy(myKey, aes.Key, aes.Key.Length);
int i = 0;
foreach (var v in aes.Key)
{
var b = myKey[i++] == v;
if (!b)
b = b;
}
I've got a server and I want to use Mercurial to coordinate a project. Can I just make a repo, put it on the server, and have everyone else clone it, then push/pull from it? Is there some way to password protect it?
.small_fonts{ font-size:10px; }
.fonts_blue{ color:blue; }
.fonts_red{ color:red; }
.fonts_green{ color:green; }
Any way to apply "small_fonts" to each of the "fonts_blue, _red, _green" w/o doing this:
.fonts_blue, fonts_red, fonts_green { font-size:10px; }
I am just trying to update my css to be more organized. I realised I don't need to define the font-size for each of the "small" fonts.
When adding the class btw... I know you can do this: class="small_fonts fonts_blue" ~ however I'm talking about combining within the css stylesheet
I need a formula for showing results on my classifieds website.
I am now done with the paging of records, but this formula for showing results remains.
I want it like this:
Showing 1-50 of 123 found.
Now what is the formula for this?
I have these variables which should be enough I think:
$results_per_page = 50; //results per page
$page = 1; //current page
Also a variable called $num_total contains the total nr of hits, in this case 123.
Thanks
I am trying to make a bar chart using tables, which I have almost accomplished to my liking. The last step I want is text over my image which represents the bar. Here is the code I have thus far for building my little bar charts:
$height = 50;
//build length
$width = 450;
$multi = $brewAvg / 5;
$width = $width * $multi;
print " <tr > <td > $count. <a href=\"$breweryURL\"> $brewR</a> </td> <td > <img src=\"blueBar.png\" width=\"$width\" height=\"$height\"> </td> </tr> ";
And this produces something like this:
You can see in the code how I simply calculate the length of the bar based on a breweries rating. What I want to do next is have the rating number show on top of each breweries on the left hand side. How would I go about accomplishing this?
Update:
I tried a tutorial I read here:
http://www.kavoir.com/2009/02/css-text-over-image.html
and I changed my code to this:
print "<div class=\"overlay\"> ";
print " <tr valign=\"middle\" > <td > $count. <a href=\"$breweryURL\"> $brewR</a> </td> <td > <img src=\"blueBar.png\" width=\"$width\" height=\"$height\"> </td> </tr> ";
print"
<div class=\"text\">
<p> $brewAvg </p>
</div>
</div>
";
And my css I added was this:
<style>
.overlay {
position:relative;
float:left; /* optional */
}
.overlay .text {
position:absolute;
top:10px; /* in conjunction with left property, decides the text position */
left:10px;
width:300px; /* optional, though better have one */
}
</style>
And it did put any of the value son top of my images. All the text is in a list above all the bars like this:
The project is hosted on a tfs server and I need to access the build number which I assume is automatically generated when ever you build a project.
I need to retrieve that build number and display it on the web pages so that QAs and testing people know exactly which build they are working on.
I found how to create customize build numbers in the following link:
http://msdn.microsoft.com/en-us/library/aa395241(v=vs.100).aspx
but it dose not solve my problem as I do not have access to the build definition file.
I am looking for some kind of post deployment task which can access the build number or may be generate one and probably write it down to a file, from where I can read it. I don't know if that makes any sense as this is my first time working on .Net
Hello, I would like to create a new dataset where the following for conditions are all met.
rowSums(is.na(UNCA[,11:23]))<12
rowSums(is.na(UNCA[,27:39]))<12
rowSums(is.na(UNCA[,40:52]))<12
rowSums(is.na(UNCA[,53:65]))<12
Thanks!
I have make one application Cocoa using XCode. Now I want to make setup file of project. So other user can install this project directly in his system.
1st number: 50
2. 30
3. 70
4. 40
5. 11
and other number is 33
I need to calculate which two numbers the last number is between (using php) .. any help?
I am using the same ViewController for several different views.
When instantiating the ViewController for a specific view, is there an easy way to specify the tab bar icon via code?
Hi,I have a range say,1-100 and i want the user to select a value from this range.Ofcourse showing this with a spinner will be awful.I want to use the functionality of date widget,where we can pick a date by pressing a +/- sign,the longer the press ,higher the iteration speed.
I found numberpicker.java that has the code the date widget uses to get this functionality, but do i have to paste that entire code to achieve this functionality!