summary
stringlengths 15
147
| text
stringlengths 1
19.3k
| answer
stringlengths 32
22.6k
| labels
float64 0.33
1
| answer_summary
stringlengths 5
164
|
---|---|---|---|---|
Loading and unloading "chunks" of tiles in a 2d tile engine with 2d camera
|
I am making a 2d tile based game in C# and XNA 4.0. I am having trouble loading and unloading "chunks" of tiles(blocks). The whole world is randomly generated and is infinate on both axis. How would I go about loading and unloading chunks of tile data in the camera's view?
A pastebin to the pastebin links(I still have the 2 link cap):
http://pastebin.com/9PYr8cvC
|
Basically you want to have a range around your camera. When chunks come into this range, you load/generate them. When chunks leave this range, you save/unload. Keep in mind you'll want to keep the loaded range larger than the visible range, so your chunk loading isn't seen.
At the moment it looks like you're storing your chunks in a dictionary. That's kind of a strange choice, and it may be a little more work for you to maintain your chunks with that data structure.
It looks like you've got a lot of the functions you need already, nice work. You'll want a list of chunk positions that should be loaded, your loaded list. Your update loop is going to maintain that list. As the camera moves, you update the list to include all the chunks in the range of the camera.
This is where the dictionary choice is a little strange. Essentially you'd have to loop through all your dictionary entries, unload the chunks that aren't in your loaded list and load the ones that aren't in your dictionary but are in your loaded list. The alternative is to have some sort of linked list structure. Where you can add/remove chunks from either end. This does get a little tricky when dealing with 2D linked lists, but I think you can make it work.
It would look something like this:
Starting with this scenario, where the red dot is the camera, moving in the X plus direction. All the grid squares (chunks) touching the green area are currently loaded.
Then the camera moves far enough to get some new chunks:
All the blue chunks will be loaded/generated. All the red chunks will be unloaded/saved.
As for maintaining the list, you can update whenever the camera moves past a chunk boundary. Like if it moves past the X plus boundary of the chunk it's currently over, like in the example above, the chunks to be added or removed from the list could be found like this:
for(int y = Camera.Position.Y + LoadRange.Y; y >= Camera.Position.Y - LoadRange.Y; y--){
AddToLoadedList(GetChunkRootPositionAt(Camera.Position.X + LoadRange.X, y));
RemoveFromLoadedList(GetChunkRootPositionAt(Camera.Position.X - LoadRange.X, y));
}
Where GetChunkRootPositionAt converts a world position into the root position of the chunk that contains that location. And the LoadedList functions take a Vector2 to add/remove from the loaded list.
Finally, you may find adding in a buffer for unloading could be nice. If someone is moving the camera around a lot right on a chunk boundary, you can save a lot of loading/unloading by just keeping it loaded. Essentially, you may find that unloading at the same time as loading isn't necessarily the best option.
| 0.777778 |
When chunks leave this range, you save/unload.
|
How to set A Records and MX records correctly
|
I just wanted to confirm something if that's okay? :) I am setting up a new site for someone and they already have email configured on an existing server and want the website on a different one. They have already set the www a record to the new server IP and this works fine and they have two MX records setup and the email is working fine. They have not updated the @ A Record, this is still pointing to the mail server IP (which means the non www version of the site goes there instead). Am i not right in thinking that if you have the MX records set then the A Records for both www and @ can be set to a different server IP and will have no impact on the email (as this will be controlled purely by the MX records)? So I can change the @ a record to the new server ip as well and this won't affect their email right? Assuming this is okay will it screw up the RDNS or any of the other email validation techniques?
Thanks so much for your help as ever,
Dave
|
You should be fine changing the root record. Whenever an email comes in it will always look at the MX records. There are two things to check though.
The MX records will point to a domain name, are they pointed at the root domain? Secondly do they use any form of webmail? You might need to create another record such as mail.example.com in order to ensure that they can still access these two things.
Most sender validation uses different DNS entries and doesn't rely on the A records in any way so you should be fine changing things.
| 1 |
How to change the root record?
|
Advice on an inexpensive but very hardy/tough point-and-shoot camera
|
I'm looking for a reasonably cheap point-and-shoot camera that can take a lot of abuse. Think rain, mud, occasional falls from head height, etc.
To make it easier, I really don't care too much about special features, zoom, or the quality of the photo. As long as it's reasonably viewable at the end, that's good enough for me.
I'm aware of the Olympus µ cameras, but they still try to pack in the features and that drives up the price.
Any suggestions?
|
All of the major brands make a rugged camera, but since I'm a Pentax shooter, I might suggest the Pentax Optio W90. A quick Google search on it will turn up a number of reviews, but spec wise it's pretty good and it's designed to take abuse.
| 1 |
Pentax Optio W90 is designed to take abuse
|
How much more polite does the word please make a request?
|
When I learnt "could you possibly" pattern, my friend said to me this is very polite form to use when I make a request.I said 'how about if I use the please also with it" and he said ' it is a bit too polite that almost in a begging manner'. I can understand that but what I would like to ask that there are other ways of making request.For example :
Would you open the window
or
Could you open the window
But in these forms it is ok if I do not use the word please?
Does its politeness degree change depending on where to use the please?
For example :
Could you please open the window
or
Could you open the window
please?
Which one is more idiomatic or more polite ?
And at last but not least which one is more polite?
"Would you please open the window"
"Could you please open the window"
"Could you possibly open the window"
"Could you possibly open the window please"
"Would you mind opening the window"
"Would you mind opening the window please"
|
I agree with your friend that if you use please in addition to another "softening" phrase in your request that it could be perceived as somewhat obsequious or even a bit sarcastic.
As Adam mentioned, inflection is very important. These examples could be spoken in a way that makes them more of a demand than a polite request.
Could you possibly roll down the car window please? The next time you decide to eat 5 bean burritos for lunch, you should drive by yourself back to the office.
Would you mind taking your feet off of my desk, please?
I tend to use "Could you..." mostly if there is some doubt as to whether the person is able to do what I ask. I think it's fairly common in AmE to make that distinction, but I'm certain some folks don't see much difference between "could you" and "would you", so it's not really a rule that you have to follow.
Could you possibly speed up the process for me? I need to get those permits before next week.
Could you please speed up the process for me? I need to get those permits before next week.
I tend to use "Would you..." mostly in situations where I'm asking the person if they would be willing to do what I'm requesting.
Would you help me carry these boxes please?
Would you mind helping me with these boxes?
| 0.888889 |
Would you mind taking your feet off my desk, please?
|
Complexity class of an idealised version of Bitcoin's proof-of-work (hashcash)?
|
To formulate this question precisely, I will define an idealized hypothetical "perfect" hash function $H(n)$ which has nice scalability properties, and will formulate a problem PERFECT HASHCASH in terms of that, understanding that practical considerations may end up yielding only an approximation of this ideal.
To keep it simple, we will say that our hash function $H(n)$ takes as input a single natural number $n$. Then we say that $H(n)$ is a perfect hash function iff:
$H:\mathbb N \to \{0,1\}^\infty$; That is, $H$ maps each natural number to an infinite binary sequence, and which the time complexity to compute any initial segment $s$ is polynomial in the size of $n$ and $s$, (making it a sponge function).
For any initial segment of length $d$, the set of all natural numbers $n$ such that $H(n)$ shares that initial segment has natural density $2^{-d}$.
The first thing formalizes the scalability of our function, and the second thing formalizes the idea that we want all hashes to appear roughly "equally often" as an output. Other than that, our perfect hash function is a black box, and we don't care much about exactly how it works, so long as it meets the above properties, as well as the usual desiderata applying to hash functions (easy to compute, hard to invert, hard to find collisions, etc).
Predicated on the assumption that a perfect hash function exists, we can now define the problem PERFECT HASHCASH as follows: PERFECT HASHCASH takes as input a perfect hash function $H$, a natural number $n$, and the zero vector $0^d$ of length $d$, which can be thought of as a unary representation of $d$. A solution to PERFECT HASHCASH consists of an $n$ and $d$ such that $H(n)$ starts with $0^d$.
Given those inputs, it is clear that PERFECT HASHCASH is in the complexity class TFNP, since this is a function problem and a solution is guaranteed to exist.
Can we also identify PERFECT HASHCASH as a member of any complexity class finer than TFNP?
Could it perhaps be in PPP? PPA? PPAD? Something else?
For background, see Complexity class on Wikipedia.
|
Bitcoin's proof-of-work problem is solved in constant time, since there is no asymptotics. Complexity classes are irrelevant here.
| 0.888889 |
Bitcoin's proof-of-work problem is solved in constant time
|
Roots of this third degree polynomial
|
I've got the following polynomial
$$
x^3-6x^2-2x+40
$$
and I want to find its roots. The only option I see at the moment is to compute all the divisors of $40$ and their inverse, and manually check if it's result is $0$. This works, because $4$ is a zero and now we can divide the polynomial by the factor $x-4$, resulting in a second degree polynomial (which is easier to solve).
I was wondering if there's any other method/idea to manually find the roots of this polynomial?
|
Hint: This can give some information about the possible location of roots, to help eliminate what you actually have to test. (Note: everything here refers to real roots and real zeroes.)
Write your polynomial as the function $$p(x) = x^3-6x^2-2x+40$$ and note that its derivative $$p'(x) = 3x^2 -12x-2$$
has exactly two distinct real zeroes $d_0<d_1$ given by $2\pm\frac16\sqrt{42}$. So, moving from left to right, the graph of $p$ rises to the left of $d_0$, falls between $d_0$ and $d_1$, and rises again to the right of $d_1$.
Then the possibilities depend on the values of $y_j \equiv p(d_j)$:
if $y_0<0$, $p$ has exactly one zero (it is to the right of $d_1$);
if $y_0=0$, $p$ has exactly two zeroes ($d_0$, and another to the right of $d_1$);
otherwise $y_0>0$, and we have that
if $y_1<0$, $p$ has three zeroes (one to the left of $d_0$, one between $d_0$ and $d_1$, and one to the right of $d_1$)
if $y_1=0$, $p$ has two zeroes (one to the left of $d_0$, and one at $d_1$;
otherwise $y_1>0$, and $p$ has one zero (it is to the left of $d_0$)
| 0.888889 |
Variable location of roots and real zeroes
|
STFT - DFT size of the bins
|
Having some trouble understanding this concept, really could do with some advice.
I want my STFT to have the following parameters: NFFT = 256 overlap/hop = 128
Now essentially, the algorithm will work as follows:
1) Split the signal into blocks of 256
This will result in around 72*265:
2) For each of these blocks, calculate against the Hanning Window
3) Create a "slider" that does an overlap of 128.. So, in theory it would
therefore be: `size = 256 + 128`
Therefore, when I'm computing the DFT for each of the overlapped blocks, will my FFT remain at size 256 or will the size be 256 + 128 If this is the case, does each block in the resulting vector still have to be of size 256?
Thanks
EDIT:
This is now my result:
But, compare this to a spectrogram in matplotlib
Where am I actually going wrong? I cannot make any sense of this.
I've looked bat through all the data, the blocks are correctly overlapping, Hanning window is being applied correctly.
Could it be to do with the fact I'm using a 1D DFT? I.e.
std::vector<complex> FFT->transform(complex_vector[0...n], 256);
|
The overlap is the way that you walk on your signal to be analyzed, lets go to an simple example, imagine that your signal X has a length = 14, NFFT = 4 and overlap/hop = 2
X = 1 2 3 4 5 6 7 8 9 10 11 12 13 14
To know the number of blocks of analysis you will:
int(n_samples/Overlap) - 1
Then for this example:
(14/2)-1 = 6
lets get 4 points from X to pass to your FFT
At the first time you get from X
X2 = 1 2 3 4
from now you need overlap by 2
X2 = 3 4 5 6
Third time
X2 = 5 6 7 8
fourth time
X2 = 7 8 9 10
fifth time
X2 = 9 10 11 12
sixth time
X2 = 11 12 13 14
| 1 |
X has a length = 14, NFFT = 4 and overlap/hop = 2 X
|
Should we allow or avoid non-standard pronouns?
|
This question brings up an important question:
Do we want to allow or avoid the use of non-standard English such as the words zie and zir as non gender specific pronouns on this site?
|
I think that the pronouns were used in good faith but were a bit confusing. However, the edit was also a bit confusing.
On the other hand (and I feel this is important):
Confusing terms should be clarified. A note or a link is sufficient here to preserve the original form while making it clear to everybody. Instead of changing the pronouns, since TRiG objects, we should simply add a footnote.
Users should feel welcome to the site, and I think that needing to open a question like this in meta is not what should happen for such a minor matter. TRiG does have some reasons to be upset at the kind of treatment he's receiving--whether he's right or wrong, having three people "shooting him down" in the comments, as well, is not the way to solve this.
I don't think that trying to moderate every... single... minor... point... in meta is actually useful or good for the site in general. It feels pedantic and a bit off-topic.
| 1 |
Conversion of pronouns in meta
|
#weight doesn't work on submit button
|
I'm trying to add two links on custom user form.
The goal is this links to be displayed bellow the submit button.
I've tried with weight property, but it's not working.
What do I miss?
This is my code:
<?php
function custom_alter_form_alter (&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'user_login':
$form['name']['#title'] = t('Username');
$form['pass']['#title'] = t('Password');
$form['actions']['submit']['#value'] = t('Login');
$form['actions']['submit']['#weight'] = 0;
$form['page'] = array(
'#markup' => '<h2>Login</h2>',
'#weight' => -10,
);
$form['register'] = array(
'#type' => 'markup',
'#markup' => '<div class="user-login-register">You don't have an account?
<a class="user-login-register" href="/user/register"> Click here</a></div>',
'#weight' => 1,
);
$form['password_reset'] = array(
'#markup' => '<a class="user-login-password-reset" href="/user/password"> You forgot your password</a>',
'#weight' => 2,
);
//krumo($form);
break;
}
}
|
This line:
$form['actions']['submit']['#weight'] = 0;
only sets a submit's weight inside actions container.
To push actions to the top of the page, you need to affect it's own weigh:
$form['actions']['#weight'] = 0;
and if you want to move only one button, you can restructure your form by moving this button outside actions container:
$form['submit'] = $form['actions']['submit'];
$form['submit']['#weight'] = 0;
unset($form['actions']['submit']);
Note that this may break some forms that expect submit button in it's exact original place in form structure.
| 0.888889 |
restructure your form by moving a button outside actions container
|
Red flags of unpaid IT internship
|
I read the following question: Tips for a first year CS student looking for a summer internship to gain experience?
But rather than how to get and/or look for internships, my questions concerns of how to filter companies looking for free labor to do their website VS companies that might not offer a paid check, but it will offer you mentorship and skills.
I have a cousin that is a college freshman and she is looking for Sofware development internships, but at this point, she is desperately looking for any internship that is IT related. Besides the big software names and elite small software shops, How do you recognize a good internships in non-it-companies(large or small) doing IT maintenance vs the bad ones? If you don't have work experience, what questions a college student should ask to prevent ripoff? Are there any red flags that you can spot before accepting an offer?
|
An unpaid internship is by itself a red flag.
| 0.777778 |
An unpaid internship is a red flag
|
What are the musical instruments that have the sounding range that has at least all notes on this range A#1-C5?
|
What are the musical instruments that have the sounding range that has at least all notes on this range A#1-C5?
The instrument can go up to C6, or down to c0, it just need to have all the notes on A#1-C5 (including C5 and A#1).
Most pdfs I can find on internet with it a pretty basic, and dont have enought instruments. On Wolfram alpha website, its possible to find the range of instruments, many different ones, but you actually need to write down the instruments you know to check their range
|
A "proper" Bayan runs in its core right hand keyboard from E2 to G7. Using registers with the bass reed would give you E1 to G6. Range in the left hand is E1 to C#6 I think.
The lefthand side of most converter accordions actually runs from E1 to C#6. For the right side to have similar range, you need to use a chromatic button accordion however: piano accordions are quite more modest in range. Most large piano accordions (41 keys) run from F3 to A6 in the keyboard (different registers extending range one octave below and up), with the largest converter accordions (45 keys) going from E3 to C7 in the right hand.
My Morino Artiste button accordion runs in its righthand keyboard from A2 to A#7. Using the bass reed, that gives me A1 to A#6. That just barely meets your low range requirements and the Morino Artiste are close to the largest ranged "Western" button accordions. So reaching that range with the right hand of a chromatic button accordion will require specifically looking for large-ranged instruments: the "usual" will not go down far enough.
| 0.888889 |
A "proper" Bayan runs in its core right hand keyboard from E2 to G7
|
Looping through posts per category gives same posts for each category
|
For a specific section on my website I loop through some categories and get the three latest posts in that categorie and list them. Like so:
<?php $categories = get_categories(array('exclude' => '1, 4, 9, 10, 2899')); ?>
<?php foreach ($categories as $category) : ?>
<div class="subject">
<h3><?php echo $category->cat_name; ?></h3>
<ul>
<?php $args = array(
'cat' => $category->cat_ID,
'posts_per_page' => 3
); ?>
<?php if (false === ( $category_posts_query = get_transient( 'category_posts' ) ) ) {
$category_posts_query = new WP_Query($args);
set_transient( 'category_posts', $category_posts_query, 36 * HOUR_IN_SECONDS );
}
?>
<?php while($category_posts_query->have_posts()) : ?>
<?php $category_posts_query->the_post(); ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
</div>
<?php wp_reset_postdata(); ?>
<?php endforeach; ?>
However, the result is not what is expected: all posts are the same across categories even though the posts don't belong to the different categories:
When I remove the transient for caching, everything works as expted.
<?php $categories = get_categories(array('exclude' => '1, 4, 9, 10, 2899')); ?>
<?php foreach ($categories as $category) : ?>
<div class="subject">
<h3><?php echo $category->cat_name; ?></h3>
<ul>
<?php $args = array(
'cat' => $category->cat_ID,
'posts_per_page' => 3
); ?>
<?php $category_posts_query = new WP_Query($args); ?>
<?php while($category_posts_query->have_posts()) : ?>
<?php $category_posts_query->the_post(); ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
</div>
<?php wp_reset_postdata(); ?>
<?php endforeach; ?>
How do I add chacing to this last snippet?
|
I don't think you need so many transients set, one for each category. You can only use one, that is enough. Transients are quite expensive to set as it requires additional db queries, so you would want to cut down on the use.
As always, I like to keep my templates simple, short and sweet, so I tend to write custom functions to move the bulk of the code outside my templates. You can put everything in one function with one transient
You can try something like this (Requires PHP 5.4+)
function get_term_post_list( $taxonomy = 'category', $args = [], $query_args = [] )
{
/*
* Check if we have a transient set
*/
if ( false === ( $output = get_transient( 'term_list_' . md5( $taxonomy . json_encode( $args ) . json_encode( $query_args ) ) ) ) ) {
/*
* Use get_terms to get an array of terms
*/
$terms = get_terms( $taxonomy, $args );
if ( is_wp_error( $terms ) || empty( $terms ) )
return null;
/*
* We will create a string with our output
*/
$output = '';
foreach ( $terms as $term ) {
$output .= '<div class="subject">';
$output .= '<h3>' . $term->name . '</h3>';
$output .= '<ul>';
/*
* Use a tax_query to make this dynamic for all taxonomies
*/
$default_args = [
'no_found_rows' => true,
'suppress_filters' => true,
'tax_query' => [
[
'taxonomy' => $taxonomy,
'terms' => $term->term_id,
'include_children' => false
]
]
];
/*
* Merge the tax_query with the user set arguments
*/
$merged_args = array_merge( $default_args, $query_args );
$q = new WP_Query( $merged_args );
while($q->have_posts()) {
$q->the_post();
$output .= '<li><a href="' . get_permalink() . '" title="' . apply_filters( 'the_title', get_the_title() ) . '">' . apply_filters( 'the_title', get_the_title() ) . '</a></li>';
}
wp_reset_postdata();
$output .= '</ul>';
$output .= '</div>';
}
/*
* Set our transient, use all arguments to create a unique key for the transient name
*/
set_transient( 'term_list_' . md5( $taxonomy . json_encode( $args ) . json_encode( $query_args ) ), $output, 36 * HOUR_IN_SECONDS );
}
/*
* $output will be atring, treat as such
*/
return $output;
}
FEW NOTES
The first parameter, $taxonomy is the taxonomy to get terms and posts from. It defaults to 'category'
The second parameter is $args which is the arguments which should be passed to get_terms(). For more info, check get_terms()
The third parameter, $query_args is the arguments that should be passed to the custom query. Remember to avoid using any taxonomy related parameters. For more info, see WP_Query
If the second parameter is not set and the third parameter is set, pass an empty array to the second parameter
Modify and abuse the code as you see fit
USAGE
You can now use the function as follow in your templates
$post_list = get_term_post_list( 'category', ['exclude' => '1, 4, 9, 10, 2899'], ['posts_per_page' => 3] );
if ( $post_list !== null ) {
echo $post_list;
}
If you do not pass anything to the second parameter but to the third, you should do the following (pass empty array)
$post_list = get_term_post_list( 'category', [], ['posts_per_page' => 3] );
if ( $post_list !== null ) {
echo $post_list;
}
EDIT
In a rush, I totally forgot to add a function to flush the transient when a new post is published, updated, deleted or undeleted. As your code stands, the list will only be updated when the transient expires.
To flush the transient on the above post conditions, simply use the transition_post_status hook. Add the following to your functions.php
add_action( 'transition_post_status', function ()
{
global $wpdb;
$wpdb->query( "DELETE FROM $wpdb->options WHERE `option_name` LIKE ('_transient%_term_list_%')" );
$wpdb->query( "DELETE FROM $wpdb->options WHERE `option_name` LIKE ('_transient_timeout%_term_list_%')" );
});
EDIT 2
From your comment to this answer
As you might have guessed I'd liked to use this in combination with my other question. How would I go about doing that? Should the exclusion of the terms happen in get_term_post_list()? Or should the two functions be merged somehow? (As I don't need them seperately.)
The best way to accomplish is to merge the two functions into one. That would make the most sense. I have merged the two functions and modified the functionality with the exclude parameters. What I have done is, you can now add an array of term id's to excludse via the get_terms() exclude parameter and you can also within the same function set an array of term slugs to exclude. The results will be merged into one single exclude parameter before being passed to get_terms()
Here is the function, again I have commented it well to make it easy to follow (This goes into functions.php)
function get_term_post_list( $taxonomy = 'category', $args = [], $query_args = [], $exclude_by_slug = [] )
{
/*
* Check if we have a transient set
*/
if ( false === ( $output = get_transient( 'term_list_' . md5( $taxonomy . json_encode( $args ) . json_encode( $query_args ) ) ) ) ) {
/*
* Check if any array of slugs is passed and if it is a valid array
*/
if ( is_array( $exclude_by_slug ) && !empty( $exclude_by_slug ) ) {
foreach ( $exclude_by_slug as $value ) {
/*
* Use get_term_by to get the term ID and add ID's to an array
*/
$term_objects = get_term_by( 'slug', $value, $taxonomy );
$term_ids[] = (int) $term_objects->term_id;
}
}
/*
* Merge $args['exclude'] and $term_ids
*/
if ( isset( $args['exclude'] ) && isset( $term_ids ) ) {
$excluded_args = (array) $args['exclude'];
unset( $args['exclude'] );
$args['exclude'] = array_merge( $excluded_args, $term_ids );
} elseif ( !isset( $args['exclude'] ) && isset( $term_ids ) ) {
$args['exclude'] = $term_ids;
}
/*
* Use get_terms to get an array of terms
*/
$terms = get_terms( $taxonomy, $args );
if ( is_wp_error( $terms ) || empty( $terms ) )
return null;
/*
* We will create a string with our output
*/
$output = '';
foreach ( $terms as $term ) {
$output .= '<div class="subject">';
$output .= '<h3>' . $term->name . '</h3>';
$output .= '<ul>';
/*
* Use a tax_query to make this dynamic for all taxonomies
*/
$default_args = [
'no_found_rows' => true,
'suppress_filters' => true,
'tax_query' => [
[
'taxonomy' => $taxonomy,
'terms' => $term->term_id,
'include_children' => false
]
]
];
/*
* Merge the tax_query with the user set arguments
*/
$merged_args = array_merge( $default_args, $query_args );
$q = new WP_Query( $merged_args );
while($q->have_posts()) {
$q->the_post();
$output .= '<li><a href="' . get_permalink() . '" title="' . apply_filters( 'the_title', get_the_title() ) . '">' . apply_filters( 'the_title', get_the_title() ) . '</a></li>';
}
wp_reset_postdata();
$output .= '</ul>';
$output .= '</div>';
}
/*
* Set our transient, use all arguments to create a unique key for the transient name
*/
set_transient( 'term_list_' . md5( $taxonomy . json_encode( $args ) . json_encode( $query_args ) ), $output, 36 * HOUR_IN_SECONDS );
}
/*
* $output will be string, treat as such
*/
return $output;
}
As far as usage, you first need to look at the parameters that you can pass
Parameter 1 - $taxonomy -> taxonomy to get terms from. Default category
Parameter 2 - $args -> The arguments that should be passed to get_terms(). Please see get_terms() for a full list of parameters that can be passed as an array. Default empty array []
Parameter 3 - $query_args -> Custom argument to be passed to WP_Query. You should not pass taxonomy related parameters here as it cause issues with the deafult build in tax_query. For a full list of valid arguments which can be passed in an array, see WP_Query. Default empty array []
Parameter 4 - $exclude_by_slug -> An array of slugs to exclude. Please note, this has to be a valid array for this to work. Strings will be ignored. Default empty array []
You can now call the function in any of your template files as
$a = get_term_post_list( 'category', ['exclude' => [1, 13, 42]], ['posts_per_page' => 3], ['term-slug-1', 'term-slug-2'] );
echo $a;
OR
$taxonomy = 'category';
$args = [
'exclude' => [1, 13, 42]
];
$query_args = [
'posts_per_page' => 3
];
$exclude_by_slug = [
'0' => ['term-slug-1', 'term-slug-2']
];
$a = get_term_post_list( $taxonomy, $args, $query_args, $exclude_by_slug );
echo $a;
Final note, if you don't need to pass a specific parameter, remember to just pass an empty array like
$a = get_term_post_list( 'category', [], [], ['term-slug-1'] );
echo $a;
All the above replaces all your code in your question
| 1 |
How do I get a transient set in a function?
|
Sort ListBox C#
|
So I have a Class "Video" and The users enter the video name and rate different aspects of it using a numericupdown control. There is a button that the users click and the score for the video is calculated and the video, with it's score, and number ratings for each aspect, is added to a ListBox which just shows the name. So what I want to do, is have a button, that when clicked, sorts the list by checking the score each video got, sorting the list from highest score to lowest score. I am using visual studio 2010 and coding in C#.
Thanks in advance.
|
videos = videos.OrderByDesc(x => x.Score).ToList();
Then set this sorted collection as datasource to ListBox.
Edit: to answer your question from comments.
You should separate presentation from data, ie have some data structures to hold data, not storing them in UI. So use for example:
List<Video> videos - this collection is filled from DB, XML, NetFlix webservice, whatever.
After filling this collection, bind it tu UI, in your case ListBox. Then, if you want to sort it, just use code i have posted.
| 0.777778 |
ListBox sorted collection as datasource to ListBox
|
How did they start sending messages to other's phone?
|
When the anime starts and until episode 8, they attached a cell-phone to the phone-microwave and sent a message to that specific phone to trigger sending D-Mails. But in episode 8
Ruka sent a D-Mail to her mother pager
and then in episode 9
Faris sent a D-Mail to (probably) herself
So I'm wondering if there is a plot whole somewhere in the story, or did they figure out a way to send D-Mails from any phone to any phone?
As a side question previously it was mentioned that how they can set D-Mail's time of Arrival:
each second on Phone-Microwave meant an hour going back, so I'm wondering how did they manage to set microwave time to 87600 (10 years)?
|
When the anime starts and until episode 8, they attached a cell-phone
to the phone-microwave and sent a message to that specific phone to
trigger sending D-Mails.
You are misunderstanding it. The microwave is required to send the d-mail, not to receive it.
Basically, the d-mail functions exactly as a normal text message that you would send to someone. The only difference (apart from the size limit) is that when you send a normal message, it will arrive in some time after being sent. The d-mail, on the contrary, will arrive in some time before being sent. It can be sent to any phone (or a pager), the only requirement is obviously that you need to know the phone number.
As for your side question, I didn't understand what exactly is confusing you, can you elaborate please?
| 0.777778 |
When the anime starts and until episode 8, they attached a cell-phone to the phone-microwave and sent a message to that specific
|
Travelling with electric violin under revised airport security rules
|
In light of suspected terrorist threat airport security has been tightened to include new restrictions on "electronic devices". For example, on Heathrow Airport's site they say:
Make sure your electronic devices are charged before you travel. If your device doesn’t switch on when requested, you won’t be allowed to bring it onto the aircraft.
I travel with an electric violin, not so that I can rock-out during business trips but so that my practise does not disturb people in neighbouring hotel rooms since the electric violin is near-silent without an amplifier.
Will my electric violin fall foul of new airport security restrictions? If so how does one prove that an electric violin (or any other active electronic instrument) is "turned on" without an amplifier to hand?
|
I asked my friends on Facebook too and got several recommendations for miniature amplifiers like the Roland Micro Cube
the irig (though I don't use an iPhone)
or the Amplug
but then one friend pointed out that headphones suffice to demonstrate the difference between the electric violin turned off and the electric violin turned on and many of us travel with headphones in our hand luggage anyway.
Next time I'll take the electric violin again and keep some simple headphones to-hand when going through airport security.
| 1 |
headphones show difference between electric violin turned off and electric violin turn on.
|
Birthday paradox: meaning of random
|
In the wikipedia page (http://en.wikipedia.org/wiki/Birthday_problem) on birthday paradox the following statement has been said : "the probability that, in a set of $n$ "randomly chosen" people, some pair of them will have the same birthday. We assume that that each day of the year is equally probable for a birthday."
My question is what is the meaning of "randomly chosen" here ? Is the assumption of equally probable for a birthday needed separately ? Does not the word "randomly chosen" imply the equal probability ?
|
The assumption is that each person's birthday is chosen randomly from the $365$ days of the year.
| 0.777778 |
The assumption is that each person's birthday is chosen randomly from the $365$ days of the year
|
In what order are taxes applied
|
Lets say we have a product that costs 100$ (net price). This product has 3 taxes that must be applied to it: 2 percentage taxes (e.g. 17% and 20%) and one fixed amount tax (e.g. +10$).
My question is - what math is done in this case?
Are the percentage taxes applied on the net price and summed or the first one is calculated and then the second one is done with the price we get after applying the first? When is the fixed amount tax applied? After the other two or the other two are done with net+fixed tax?
|
In the US and indeed around the world, there are very few "tax on taxes" situations. These situations are generally called out where they exist and politicians are pressured to change them; it is generally considered onerous for a government to include an amount of taxes in calculating another tax, because the government is then taxing the money you're already paying them. This is why most U.S. State and local taxes (sales taxes, property taxes, etc) are deductible from your income when itemizing deductions (the alternate "standard deduction" is an "average" amount that a person/household would be able to deduct if they itemized all lower-level taxes they had paid).
So, most taxes, especially sales taxes/duties/tariffs, are all levied on a "pre-tax" or "subtotal" amount. In your example, all three of those taxes would be calculated on the $100 "subtotal" amount, before any other tax is added, and then those amounts are added to the subtotal to produce the grand total (of $147 as Alex shows).
| 0.833333 |
"tax on taxes" situations are called out where they exist and politicians are pressured to change them .
|
Why mriswith stayed (mostly) in Hagen Woods?
|
I've just finished reading Blood of the Fold.
In the end Richard and the gar army defeat the mirswith force in Aydindril. That made me wonder why until then the mriswith stayed close to the Hagen Woods. They were apparently waiting for the Sliph to wake and protecting their trapped queen, but 3000 years? In such a long time why didn't they seize the Old World and for example travel by sea? To Westland maybe?
|
Its because the Queen was stuck in the ruins in the woods individuals would go out exploring to find the one to help her escape. more of their story in blood of the fold
| 0.888889 |
The Queen was stuck in the ruins in the woods individuals went out exploring to find the one to help her escape
|
Can the update manager download only a single package at a time?
|
I need the update manager to only download a single package at a time and not try to download multiple packages at once.
My slow internet cannot handle multiple connections; slows the download to a crawl and some packages will reset themselves halfway through when they time-out.
EDIT
When using apt-get update multiple repositories get checked:
When using apt-get upgrade multiple packages are downloaded:
|
Rather than using the update manager try sudo apt-get update&&sudo apt-get upgrade in the terminal
It would get the job done and also does not use parallel connections
| 1 |
sudo apt-get update in the terminal
|
Android setOnItemClickListener
|
I'm not able to initiate the "OnItemClickListener".
You can see my code snippet
ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.main, new String[] { "title"}, new int[] { R.id.item_title});
setListAdapter(adapter);
final ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
@SuppressWarnings("unchecked")
HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);
Toast.makeText(TopNewsActivity.this, "ID '" + o.get("id") + "' was clicked.", Toast.LENGTH_LONG).show();
}
});
after the setListAdapter my debugger goes to "lv.setOnItemClickListener" but then does not get into the loop and moves out.
I want to make the links Clickable kindly help.
|
The most probable cause is that your ListView items contain either focusable or clickable Views. If a view contains either focusable or clickable item the OnItemCLickListener won't be called. (Instead the clickable View's own click handlers will be called).
Click here for more information.
See my previous answer here or find more information here.
Try it with a very simple ListItem layout - it should work.
| 0.555556 |
If a View contains either focusable or clickable item the OnItemCLickListener won't be called.
|
Can't see all the font styles installed in Windows 7
|
I've installed a font that has different styles (bold, italics, thin, medium, ultra and so on...), but I can't use them all because I can't see them in Photoshop. The fonts are installed, but seem in some way "overlapped" by windows.
If I open the Windows fonts dir I can see only one style. If I delete it, then a different style appear and so on.
Anyone has a solution for this problem?
Thanks.
|
The source of this problem is malformed font files. The internal names of the fonts are in conflict and the flags that indicate connections between the different font files in a typeface family (Regular, Bold, Italic, Bold Italic, etc.) are missing.
The terminology is awkward. Technically and historically "Foo" is a typeface and "18 pt Foo Bold Condensed" is a font, but in the era of personal computers the definitions have blurred: a typeface is now often referred to as a "font" (even though you'll buy a particular style of that typeface as a "font" in any online store), particularly among non-typographers. The variations tend to be called "styles." People coming newly (last 25 years or so) into design are so used to scaling a font in software that they forget every size of every style of a typeface was once drawn and made individually.
For a regular application (non-professional) to give you the usual "Regular, Bold, Italic, Bold Italic" choices, the font files themselves must be individually named internally and the fact that they are associated is a specific internal flag. It's these internal flags that allow you to create bold or italic text with a keyboard shortcut or style dropdown -- the Foo Bold font file tells the OS "I am the Bold version of Foo," and so on.
You have a situation where all the individual font files have the same internal name, so Windows can't differentiate them. You see exactly one font (style) in a family; delete it, and you see another one, and so on. In Word, Open Office, etc., that's probably all you'll see. (Arial Narrow famously suffered from this problem because of an error in creating the files -- it just wouldn't show up at all, or would never show up as an available style for Arial.)
Most non-graphics applications natively understand only the usual four fonts in a family. Additional members (narrow, thin, black, extended, etc.) show up as separate typefaces.
More sophisticated applications such as Photoshop or InDesign know how to read the association flags in a set of font files and can display all the variations in a single dropdown. Garamond Premier Pro, as an example, has 39 font files in four optical sizes -- caption, regular, subhead and display -- that all show up in a single dropdown if and only if the files themselves contain the correct internal information. The ones you are having trouble with do not.
The most common source of the problem you are seeing is conversion utilities that don't do a proper job of taking older or other-platform files and turning them into well-formed OpenType or TrueType files. This often affects (illegal, it must be said) Mac --> Windows conversions, because on Mac OS the font information is split between a visible file and a hidden one. If the conversion utility doesn't correctly parse the hidden file, you get a malformed OpenType or TrueType font file that won't work properly on either platform.
Very old and "freebie" font files that are incorrectly set up internally can cause the same issue.
| 1 |
The internal names of font files in a typeface family are missing .
|
What is output impedance of a pin?
|
When a datasheet mentions the output impedance of a pin so and so ohms. What exactly does it mean? Can anybody explain through a diagram how does it look like?
|
Let me start by saying that an output pin (or input pin), by itself, has no impedance. If this was already clear to you, then you know that it has to be between two pins. It just so happens that the other "pin" is ground. So whenever the impedance of a pin is mentioned, it is commonly known/understood that it is with respect to ground.
What the "impedance specification" means, is simply, if you were to take an impedance measurement of the pin to ground, you would obtain the value given. However, since impedance depends on the frequency used to determine its value, a frequency must also be specified. If a frequency is not specified, then they are referring only to its resistance and this is the value you obtain if you connect an ohmmeter between the pin and ground.
The diagram provided by Vladimir is the exact model.
| 0.666667 |
Impedance of a pin to ground
|
CName for static images - will Google crawl?
|
I am planning to serve images on a CDN using a CNAME: images.mysite.com. I am doing this because CDNname.mysite.com makes ugly URL's and MAY be bad for SEO (debatable).
Will Google crawl the subdomain (only storing images and nothing on the main domain will link to it).
If so, would a simple robots.txt be suitable? Is this even possible seeing that the subdomain is ONLY serving images, JS, CSS i.e. not HTML?
Thanks
|
Since the images on the subdomains would be linked from the main domain, Google will certainly be aware of the subdomain and will certainly grab the linked images. I don't believe you will get the subdomain actively crawled as a separate entity, though. The algorithm is smart enough to detect that you are just serving resources off the subdomain instead of actively hosting real content and index accordingly.
| 0.777778 |
Google will certainly be aware of the subdomain and grab the linked images .
|
Does Clark Kent have a weight problem?
|
This question came to mind while watching an overloaded vehicle tilting down the road ahead of me. Are Kryptonians Height & Weight Proportional (H/W/P) to humans? I'm curious to know if Clark has to fly (hover just a little bit) in order to adjust his weight and level load a cars suspension system so he blends in when he travels with earthlings in automobiles.
|
No, Clark Kent doesn't have a weight problem. But he should. Superman has since the late sixties been portrayed as having the height and weight proportions of a normal human male, despite his superhuman strength.
DC Comics has not bothered to address this issue with Superman in any of the previous iterations of the Man of Steel. He has almost always been listed around 6 to 6.5 feet tall weighing approximately 225 - 250 pounds, sometimes a bit more.
Scientifically speaking Clark Kent, indeed all Kryptonians should weigh, at least a bit more, and have a greater molecular weight than normal humans. Coming from a world which was supposedly significantly larger, they would have to have been much stronger to maintain their human-like appearance.
His strength, since the Golden Age has not depended on his arrival from a heavy gravity planet, and in many iterations, Krypton is not even considered a heavy gravity world. In those cases, Superman's superhuman strength is strictly a product of his solar-powered infusion/conversion of energy into superhuman strength and his other powers.
No, this has not been portrayed consistently; particularly during periods where Kal-el might lose his powers or during the period as Superman Blue/Red when he had no superhuman strength at all.
In the Marvel Universe, for example, the Asgardians to partially compensate for their superhuman strength (even a normal Asgardian can lift ten tons) have three times the bone, muscle and overall tissue density of normal humans. Yes, in the case of some Asgardians they have even greater strength, but we assume there is a magical component for those who are lifting far in excess of that.
None of this makes strict sense and with multiple versions of Krypton, Superman, writer and editor inconsistency, it is not surprising the details have gotten lost or glossed over. Just look at the modifications for the planet Krypton over the decades:
Krypton and its history has been altered to a great extent from its previous versions. In the post-Crisis Krypton, sexual reproduction was considered obscene, and thus, all children were conceived in birthing matrices. After Infinite Crisis, this was taken out of Kryptonian culture.
Also in post-Crisis Krypton, this planet was located in a solar system within the Milky Way galaxy close enough that the radiation from the explosion (traveling only at light speed) was able to reach Earth (Action #600).
But after Superman: Birthright it was suggested that the planet Krypton was from an entirely different galaxy. In current continuity however, Krypton has been revised back to its previous position and is confirmed to be in the sector of space that borders that of Earth.
The Green Lanterns have dubbed Krypton's sector of space 2813 (Earth's being 2814) and was under the protection of Green Lantern Tomar-Re when it was destroyed. Another element to the previous version of Krypton was that all Kryptonians were unable to leave their planet or they would die instantly. This was a result of the Eradicator altering the genetic codes of Kryptonians to keep them planet-bound after a group of them left Krypton to explore and colonize other planets. The Eradicator punished these Kryptonians by altering their genetic codes to be vulnerable to lead, which resulted in the Daxamites.
Originally, Jor-El had a serum that he invented that would allow a Kryptonian to leave the planet safely; which he gave to his son Kal-El upon leaving for Earth. This was created to maintain the rule of Superman being the only Kryptonian survivor which was the theme of the post-Crisis Superman mythos.
This was reversed after 2003 when it was revealed that Superboy (Conner Kent) was half Kryptonian and then in 2004 when Supergirl (Kara Zor-El) arrived on Earth. The Eradicator did not place the planet-bound restrictions on the Krypton of the current DC universe but it still seems to be responsible for the Daxamites' lead vulnerability.
The Krypton of the current continuity was at one time an expanding empire that conquered other planets for years but was dismantled after the Kryptonian high council decided that their methods were too aggressive. The city of Kandor had a lunar city named after the planet bound city and when the lunar colony was destroyed, Brainiac kidnapped the real Kandor.
Other multi-ethnic versions of Kryptonians that resemble African-Americans and Asians also make an appearance in current continuity. Though previously, "black" Kryptonians were mainly confined within the Kryptonian continent of Vathlo Island. In the New Earth continuity, dark-skinned Kryptonians are more integrated into Kryptonian society than they were in the silver and pre-modern age DC universe. The other racially diverse people of Krypton came from a continent called Twenx. --Wikipedia > Krypton
| 1 |
Krypton's superhuman strength is strictly a product of his solar-powered infusion/conversion of energy .
|
Reading XML file and fetching its attributes value in Python
|
I have this XML file
<domain type='kmc' id='007'>
<name>virtual bug</name>
<uuid>66523dfdf555dfd</uuid>
<os>
<type arch='xintel' machine='ubuntu'>hvm</type>
<boot dev='hd'/>
<boot dev='cdrom'/>
</os>
<memory unit='KiB'>524288</memory>
<currentMemory unit='KiB'>270336</currentMemory>
<vcpu placement='static'>10</vcpu>
Now i want parse this and fetch its attribute value. For instance i want to fetch the uuid field. So what should be the proper method to fetch it in Python. Any libraries or code snippets that could help is appreciated
|
Here's an lxml snippet that extracts an attribute as well as element text (your question was a little ambiguous about which one you needed, so I'm including both):
from lxml import etree
doc = etree.parse(filename)
memoryElem = doc.find('memory')
print memoryElem.text # element text
print memoryElem.get('unit') # attribute
You asked (in a comment on Ali Afshar's answer) whether minidom is a good alternative. Here's the equivalent code using minidom; judge for yourself which is nicer:
import xml.dom.minidom as minidom
doc = minidom.parse(filename)
memoryElem = doc.getElementsByTagName('memory')[0]
print ''.join( [node.data for node in memoryElem.childNodes] )
print memoryElem.getAttribute('unit')
lxml seems like the winner to me.
| 0.666667 |
lxml snippet that extracts an attribute as well as element text
|
Rotating vector3 by a quaternion
|
I am attempting to rotate a vector3 by a given quaternion.
I know that this is true
v' = q * v * (q^-1)
I know that q^(-1) is the inverse which just -q/magnitude(q), but how do I map the multiplication of the vector to the quaternion to get back a vector?
I have found that you can treat v as a matrix, and convert q, and q' to matrices, and then convert v' from a matrix to a vector, but this seems a little over the top just to get a vector. Is there a cleaner implementation that I could use?
|
As Nathan Reed and teodron exposed, the recipe for rotating a vector v by a unit-length quaternion q is:
1) Create a pure quaternion p out of v. This simply means adding a fourth coordinate of 0:
2) Pre-multiply it with q and post-multiply it with the conjugate q*:
3) This will result in another pure quaternion which can be turned back to a vector:
This vector v' is v rotated by q.
This is working but far from optimal. Quaternion multiplications mean tons and tons of operations. I was curious about various implementations such as this one, and decided to find from where those came. Here are my findings.
We can also describe q as the combination of a 3-dimensional vector u and a scalar s:
By the rules of quaternion multiplication, and as the conjugate of a unit length quaternion is simply it's inverse, we get:
The scalar part (ellipses) results in zero, as detailed here. What's interesting is the vector part, AKA our rotated vector v'. It can be simplified using some basic vector identities:
This is now much more optimal; two dot products, a cross product and a few extras: around half the operations. Which would give something like that in source code (assuming some generic vector math library):
void rotate_vector_by_quaternion(const Vector3& v, const Quaternion& q, Vector3& vprime)
{
// Extract the vector part of the quaternion
Vector3 u(q.x, q.y, q.z);
// Extract the scalar part of the quaternion
float s = q.w;
// Do the math
vprime = 2.0f * dot(u, v) * u
+ (s*s - dot(u, u)) * v
+ 2.0f * s * cross(u, v);
}
| 0.333333 |
How to rotate a vector v by a unit-length quaternion q
|
CSS: Dropdown menu not displaying
|
I have this website: http://dev.gratefulhearttherapy.org/
with a dropdown menu, it's supposed to unfold when you hover a category like "Our Services" or "Abous Us". But it doesn't.
I know it's a CSS issue because I use 2 different stylesheets, and one works while the other doesn't. However I've spent two hours on it and I don't find what's wrong.
I tried to play with z-index but it doesn't work. I took over someone else's work and CSS file is messy, and the website calls several stylesheets. In any case, the stylesheet I'm working with is here: http://dev.gratefulhearttherapy.org/index.php/tools/css/themes/gratefulheart/typography-new2.css
The relevant part of the CSS begins line 287, the "Mega Menu" section. Here it is:
Can anyone give me a tip at what might be the issue?
/* Mega Menu */
.top-level-nav a.nav-path-selected {
color: #EA5603 !important;
ul.mega-menu {
height: 44px;
width: 96%;
text-align: left;
margin: 10px 0 0 20px;
padding: 0 60px;
text-indent: 0;
list-style-type: none;
margin-left: -1px;
}
ul li.mega-menu {
padding: 0;
margin: 0;
text-indent: 0;
display: inline;
line-height: 44px;
}
ul li a.mega-menu {
text-decoration: none;
color: #DE573C;
font-size: 138.5%;
}
.nav li a:hover {
color: #8e4c0f;
}
.custom {line-height: 1.6;}
.custom ul.mega-menu, .custom ul.mega-menu, .custom ul.mega-menu li {margin: 0; padding: 0; border: none;}
.custom ul.mega-menu {
background: #D6CEB4;
width: 100%;
height: 44px;
border-top: solid 2px #CCC2A5;
border-bottom: solid 2px #CCC2A5;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;; position: relative;
}
.custom ul.mega-menu li {float: left; margin: 0; padding: 0; }
.custom ul.mega-menu li a {float: left; display: block; padding: 12px 38px 12px 25px; ; text-decoration: none; color: #3B3B3B; font-size: 138.5%; text-decoration: none;}
.custom ul.mega-menu li a.dc-mega {position: relative;}
.custom ul.mega-menu li a .dc-mega-icon {display: block; position: absolute; top: 18px; right: 15px; width: 8px; height: 6px; background: url(images/arrow.png) no-repeat 0 0;}
.custom ul.mega-menu li.mega-hover a, .custom ul.mega-menu li a:hover {background-position: 100% -40px; color: #8e4c0f;}
.custom ul.mega-menu li.mega-hover a .dc-mega-icon {background-position: 0 100%;}
.custom ul.mega-menu li .sub-container { /* block container of dropdown submenu when it's closed (I think) */
position: absolute;
background: url(images/bg_sub_left.png) no-repeat 0 100%;
padding: 10px 10px 0 10px;
margin-left: -3px;
}
.custom ul.mega-menu li .sub { /* dropdown submenu itself */
margin: -8px 0 0 -8px;
background: #E3DDD3
url(images/bg_sub.png) no-repeat 100% 100%;
padding: 00px 20px 20px 10px;
border: 1px #D1C6B4;
border-style: none solid solid solid;
/* rounded corners */
-webkit-border-bottom-right-radius: 3px;
-webkit-border-bottom-left-radius: 3px;
-moz-border-radius-bottomright: 3px;
-moz-border-radius-bottomleft: 3px;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
/* dropshadow effect */
-webkit-box-shadow: 0px 4px 6px rgba(50, 50, 50, 0.6);
-moz-box-shadow: 0px 4px 6px rgba(50, 50, 50, 0.6);
box-shadow: 0px 4px 6px rgba(50, 50, 50, 0.6);
}
.custom ul.mega-menu li .sub-container.mega .sub {padding: 20px 20px 10px 0;}
.custom ul.mega-menu li .sub .row {width: 100%; overflow: hidden; clear: both;}
.custom ul.mega-menu li .sub li {list-style: none; float: none; width: 170px; font-size: 120%; line-height: 2;} /* li of dropdown submenu */
.custom ul.mega-menu li .sub li.mega-hdr {margin: 0 10px 10px 0; float: left;}
.custom ul.mega-menu li .sub li.mega-hdr.last {margin-right: 0;}
.custom ul.mega-menu li .sub a, .custom ul.mega-menu li .sub span {background: none; border: none; text-shadow: none; color: #111; padding: 7px 10px; display: block; float: none; text-decoration: none; font-size: 0.9em;}
.custom ul.mega-menu li .sub li.mega-hdr .mega-hdr-a {padding: 5px 5px 5px 15px; margin-bottom: 5px; background: #6B6B6B url(images/bg_mega_hdr.png) no-repeat 0 0; text-transform: uppercase; font-weight: bold; color: #fff; text-shadow: 1px 1px 1px #333;}
.custom ul.mega-menu li .sub li.mega-hdr a.mega-hdr-a:hover {color: #000; text-shadow: none;}
.custom ul.mega-menu .sub li.mega-hdr li a {padding: 4px 5px 4px 20px; background: url(images/arrow_off.png) no-repeat 5px 8px; font-weight: normal;}
.custom ul.mega-menu .sub li.mega-hdr li a:hover {color: #a32403; background: #efefef url(images/arrow_on.png) no-repeat 5px 8px;}
.custom ul.mega-menu .sub ul li {padding-right: 0;}
.custom ul.mega-menu li .sub-container.non-mega .sub {padding: 20px 20px 20px 0;}
.custom ul.mega-menu li .sub-container.non-mega li {padding: 0; width: 190px; margin: 0;}
.custom ul.mega-menu li .sub-container.non-mega li a {padding: 7px 5px 7px 22px; background: url(images/arrow_off.png) no-repeat 7px 10px;}
.custom ul.mega-menu li .sub-container.non-mega li a:hover {color: #a32403; background: #efefef url(images/arrow_on.png) no-repeat 7px 10px;}
|
It's because your #headerNav is set to overflow:hidden. Just remove this line of css:
#headerNav {
…
overflow: hidden;
…
}
| 0.888889 |
#headerNav overflow:hidden
|
Keyword not supported in SQL Server CE connection string
|
I'm trying to connect to a SQL Server CE database in a C# web application (VB 2012) using this connection string:
using (SqlCeConnection conn = new SqlCeConnection(@"Data Source|DataDirectory|\MyData.sdf; Persist Security Info=False;"))
The problem is that I am getting an exception that the data source|datadirectory is not a supported keyword. I attempted to change this string to:
Data Source=MainDb.sdf;Persist Security Info=False;
But then I get an error that the Db cannot be found. The database is located in the App_Data folder. Any ideas?
|
The syntax seems to be incorrect - it should look something like this:
using (SqlCeConnection conn = new SqlCeConnection(@"Data Source =
|DataDirectory|\MyData.sdf; Persist Security Info=False;"))
| 0.777778 |
The syntax seems to be incorrect - using
|
How does Charlie deduce Myra is Mrs Kieslowski?
|
In Seven Psychopaths Charlie (Woody Harrelson) comes to the hospital to find Mrs Kieslowski. He finds a patient- who we know is Myra Kieslowski- but wrongly assumes that because she is black it cannot be her. He then tells her how he is looking for Mrs Kieslowski because her husband has stolen his dog.
In the course of the subsequent conversation, he comes to realise that she is the woman he's looking for. But I can't understand how.
Here's the discussion between Charlie and Moyra.
Myra: I'm sure Mr. Kieslowski will take good care of your dog and get
it back to you safe. He always seems like a sweet man when he comes
in.
Charlie: He come visit her a lot?
Myra: Every day-
Charlie: What kind of times every day?
Myra: Different times, you know. And not every day. He misses a day
now and then.
Charlie: Oh. yeah? He been in today?
Myra: Yeah. He came in earlier this morning, about 10:00 or so.
Charlie: So the Polack married a n*gger, huh?
How did Charlie deduce this, from the conversation?
Was it just the fact that Myra seemed too eager to convince him that Charlie had already missed Mr Kieslowski's visit and was wasting his time waiting? In which case, why did she say he visited every day?
|
I saw that movie and I assumed he picked up on tells in her body language and facial movements.
| 0.888889 |
I saw that movie and assumed he picked up on tells in her body language and facial movements
|
Display a field of a node that is referenced on another node via a relationship
|
I have two content types, "Stores" and "Offers." In the "Offers" content type, there is a CCK node reference field type that references the "Stores" nodes. So essentially, I create a store and if the store has an offer, I create the "Offer" node and select the store with which it is associated.
I have a view (a default glossary view) that displays a list of stores. I would like to display the node titles of any offers that are associated with it but I can't figure out how to do it.
I have tried to add a relationship on the node reference field then add a field that uses the relationship but the result just appears blank.
|
In your view style template you can access the node reference value, load the related node and then do whatever you need with that. You don't need a relationship for this approach.
| 0.888889 |
In view style template you can access the node reference value, load the related node and then do whatever you need.
|
Eclipse Java EE Indigo 's XML formatting is suddenly screwed up
|
A few days ago it was just fine. I haven't made any change to the IDE or anything else in the preferences.
Looks like random instability, but I hope I'm wrong, I don't want to go through the IDE setup again.......
Here are two screenshots to tell the story:
Before Ctrl+Shift+F (format):
After (format results):
What can I do about it?
I've tried comparing settings in another Eclipse setup that I have which has XML formatting working properly. (Window -> Preferences -> XML -> XML Files -> Editor). Also (Structured Text Editors).
|
Solved.
It looks like "Android Common XML Editor" took over, and the above crappy formatting belongs to it.
All I had to do is right click on the XML file and choose Open With -> XML Editor.
| 0.777778 |
"Android Common XML Editor" took over .
|
Difference in "capable" and "able"
|
What is the difference in being physically capable and physically able?
When would one choose one over the other?
|
Capable is more of a mentality. Able is more of a physical idea. You can be mentally capable of describing the object in front of you; you can be able to lift the 100 lb weights. However, the words are nearly interchangeable anywhere. Even in the examples I gave, the other fits, but one seems more appropriate than the other commonly.
| 0.777778 |
Capable is more of a mentality.
|
Network database access - How do I connect to a remote database?
|
I am able to connect to a specific MS Access Database when it is on the same Windows computer as Mathematica via the command
<< DatabaseLink`;
conn = OpenSQLConnection[JDBC["odbc", "Databasename"]];
However, I cannot figure out how to connect to this database over a local area network -- disregarding trivial network problems (the computers can ping eachother), is this even possible?
|
This is not really an answer yet, but definitely too long for a comment.
Access databases are designed for single user access and store data, forms and code in a single file. It is possible to access such a file from a remote computer via e.g. a network drive. As there is no real database server involved, concurrent usage of the same database file with several processes/programs will only be possible within certain limits (which I don't know about).
It should be possible to access such a file from a network drive via the usual ODBC drivers, but you might need to configure those accordingly. You have mentioned that you want to access the database from a linux client: There are OBDC drivers for access databasefiles which work under linux, but I don't know if and how it is possible to use those from Mathematica, but would expect that should be possible. If the file lives on a windows server you could mount a network file with the samba client programs, but that might introduce additional restrictions on concurrent usage as there could be differences in how the file locking and other details are handled. I would be very careful when experimenting with such a setup. On the other hand I wouldn't expect insurmountable problems if only one program accesses the database file at a time.
Depending on how you are using that database converting the database is probably the best you can do, especially if you need concurrent access. As a first try you could try to use e.g. openoffice or kexi to convert the database, but of course you could also do that with Mathematica on a Windows machine. Depending on the target format there might be even better options, e.g. specialized import functions/scripts for certain database systems.
If you don't need concurrent access you could consider SQLite as a target format which like Access stores the data in plain files and also is "serverless", so using it might be simpler than setting up a database server. There is a JDBC driver for SQLite, which you should be able to use from Mathematica. There is also an undocumented more direct implementation to access a SQLite database from within Mathematica even without DatabaseLink, which you should find some notes about in the web.
| 1 |
Access databases are designed for single user access and store data in a single file
|
Differences in student load at liberal arts colleges vs. research universities
|
Do students at liberal arts universities have 'harder' courses than students at research universities?
Computer Science curricula at large research universities have 5 to 6 courses per semester. The Liberal Arts model dictates roughly 4 courses per semester. If the load on the student is considered to be equivalent, there must be something special to the teaching in the Liberal Arts model.
How is it that a 4 course Liberal Arts semester is as intensive as a 6 course research university semester?
UPDATE: Many of the comments below say the course load I mention above is inaccurate. I have obtained the figures as follows.
The Liberal Arts Computer Science Consortium (LACS) has released 3 LACS curricula in response to ACM/IEEE CS curriculum recommendations. The first in 1986 in response to the 1978 recommendation, next in 1996 in response to the 1991 recommendation and the most recent in 2007 in response to the 2001 recommendation. The 4 year course breakdown in all the LACS recommendations is roughly the same:
4 courses per semester
30-35% CS courses, 10% math, 5% science, and the rest, i.e. 50% or more courses on arts, humanities and social sciences.
A typical graduation requirement at a research university is at least 120 credits, which comes to 5 3-credit courses per semester. Many require more than 120 so 6 course semesters are not uncommon.
|
You are making several unfounded assumptions:
That courses are always 3 credits, so that "4 courses per semester" means 12 credits. I have taken courses that were worth 1, 2, 3, 4, and 5 credits. Many of the science courses I've taken, including math and computer science courses, have been worth 4 credits. Basic sciences that involve a lecture, lab, and recitation have sometimes been 5 credits.
That most liberal arts colleges follow the LACS recommendations to the letter.
That the LACS recommendations somehow suggest that less than 120 credits are required for graduation. Here is an example of a liberal arts college following the LACS recommendations for CS and requiring 120 credits.
I did half of my undergraduate degree at a liberal arts college and then transferred to a large research university for the other half. There was virtually no difference in my courseload between the two - I took exactly one credit more in my two years in the research university. I just pulled up my transcripts, and this is what I took each semester:
Part 0
I transferred in 30 credits in humanities, etc. from college courses taken while in high school.
Part 1 - Liberal Arts College
16 credits, 4 classes (4, 3, 4, 5)
13 credits, 3 classes (4, 4, 5)
(Summer) 3 credits, 1 class (3)
19 credits, 5 classes (3, 4, 5, 4, 3)
12 credits, 4 classes (3, 3, 4, 2)
Part 2 - Research University
16 credits, 4 classes (4, 4, 4, 4)
19 credits, 5 classes (4, 3, 4, 4, 4)
16 credits, 6 classes (3, 4, 1, 3, 3, 2)
13 credits, 4 classes (4, 3, 3, 3)
(My undergraduate degree was in Electrical Engineering, with a minor in Computer Science.)
| 0.666667 |
a liberal arts college requiring 120 credits for CS
|
Noise canceling headphones make strange sound when I touch my MacBook Pro
|
I've got headphones plugged into my desktop, and a laptop nearby that I use for work as well. Whenever I touch my MacBook Pro with the noise-canceling on my headphones turned on, it makes my headphones go nuts, creating a lot of buzzing, crackling, and popping.
I assume this has something to do with conduction between my hands and the computer, but is there any way to get around this?
|
It appears your wall socket is not properly grounded, which may cause electrical interference on your headphones when touching the MacBook Pro.
Have a look at this related answer on possible measures you can take to establish a proper electrical grounding.
| 1 |
How to establish a proper electrical grounding on your MacBook Pro
|
Easiest way to create a binary variable
|
Binary variable is often used in applied statistics. However, I had a hard time to figure out how to create it. Somebody might have better idea how to do it. I have two variables say x and y as follows
x = Range[100];
y = Flatten[RandomInteger[{1, 100}, {100, 1}]];
I want to create a binary variable b1 such that b1 = 1 if x>y and 0 otherwise. I have done so far
b1 = TrueQ[#1 > #2] & @@@ Transpose[{x, y}] /. {True -> 1, False -> 0}
Any better way please?
|
Boole@Thread[Greater[x, y]] == MapThread[Boole@Greater@## &, {x, y}]
| 0.888889 |
MapThread[Boole@Greater@##
|
iOS: Change Device Volume
|
Is there a way to change the volume of the device? I've seen several apps do it.
I have a desktop version of the iOS app and the device will be able to be controlled to some extent over the network. One of the things I want to allow the user to do is change the device volume and then play a sound. This can help if you loose your iPhone in a crack in your couch again, but can't find it.
Is there any way that you can do this without Apple getting angry?
|
You can use a little trick:
MPMusicPlayerController* musicPlayer = [MPMusicPlayerController iPodMusicPlayer];
musicPlayer.volume = 1; // device volume will be changed to maximum value
| 1 |
MPMusicPlayerController
|
How to extract unknown packet from collision between said packet and another, known packet?
|
I need to apply successive interference cancellation (SIC) to an RF signal which is the result of collisions between 2 or more unsynchronised packets. For this question let's just assume that the number of packets is 2.
In SIC, you store the collided packets until one of the packets are repeated and use the 'clean' packet to extract the other packet from the collided data.
My question is, what techniques can be used to extract an unknown packet from a collision between that packet and a known packet?
How do you deal with the packet sources not being synchronised?
Going through the possible tags for this question, it seems that 'deconvolution' is relevant.
In case it is relevant, the context is RFID tag inventory, the channel access mechanism is framed slotted ALOHA (FSA) random access, the carrier is 868 MHz (EU) and subcarrier is 256 kHz.
Thank you.
|
As JRE said, deconvolution is not what you need. You need to subtract the known signal from the combined signal to leave the unknown signal by itself.
If the signals are baseband signals (I'm aware that yours are modulated- I will get to that later in the answer) then you need to know when the known signal started and how strong it is. You can get an estimate of both of those things through cross-correlation. You cross-correlate the combined signal with a clean reconstruction of the known signal. You should get a strong peak at the location of the known signal. From this you can determine when the signal started. You can also estimate the signal amplitude using the peak's amplitude.
$$
y[n] = \sum\limits_m x[m]r[n+m]
$$
This is the definition of cross-correlation, where x[n] is the combined signal, r[n] is the reconstructed known signal, and y[n] is the cross-correlation.
$$
y[n] = \sum\limits_m (s_1[m] + s_2[m] + noise[n])r[n+m] \approx \sum\limits_m s_2[m]r[m]
$$
In this equation I have broken x[n] into its constituent parts: $s_1[n]$ (the unknown signal, $s_2[n]$ (the known signal), and noise. If we assume that $s_1[n]$ does not correlate strongly with $s_2[m]$ then we can simply disregard $s_1[n]$ and the noise term with the understanding that they will both likely add some error to the result.
So, the peak's amplitude is approximately equal to $\sum\limits_m s_2[m]r[n+m]$. Since you know $r[n]$ completely, you can use this value to determine the amplitude of $s_2[n]$.
Once you know the start time and amplitude of $s_2[n]$, you can subtract it out of $x[n]$, leaving only $s_1[n]$, the noise term, and whatever error was in your estimate of $s_2[n]$.
If the packets are modulated the same basic process is followed, except you will also have to find/determine any carrier offset in $s_2[n]$, and it's phase. The phase you can get from the cross-correlation peak's phase. The carrier offset you can find using the fourth power technique (for PSK signals), or by searching for the best cross-correlation result at various carrier offsets.
| 1 |
Cross-correlation with a clean reconstruction of the known signal
|
Why the sudden popularity of .io domains?
|
I've noticed a number of new webapps and sites are being hosted at .io domains (the top-level domain for the British Indian Ocean Territories). A couple examples include:
Forecast.io
GitHub.io
Firepad.io
And the list goes on and on.
Is there any particular cause for the sudden popularity of .io domains?
|
I guess it's just because most people would not relate .io TLDs to British Indian Ocan Territories, but with input/output or whatever abbreviation seems reasonable for the specific domain.
The same thing is happening with .tv TLDs, which is for the island of Tuvalu normally, but is more commonly interpreted by people as an abbreviation for "television".
| 1 |
.io TLDs to British Indian Ocan Territories, but with input/output
|
Most effective way to increase programmer salary besides just doing your job?
|
If you have the time and resources, what would be the most effective way to increase your salary as a full-time programmer, outside of just doing your job?
By "salary" here, I mean salary (adjusted for location cost-of-living) coming from a single programming job.
|
By doing your job, I assume you mean the technical aspect. Programming, meeting requirements, attending meetings, etc.
If so, than one of the most effective way would be to work on the social aspect of your job.
You can meet all of your technical objectives but still get a lower salary than someone with good technical skills but great people skills.
You need to promote yourself to your boss and to your coworkers. Make contacts in the industry. Become a leader among your team. Be the guy people are asking for help when they are stuck.
People that do these things are usually will usually be perceived favorably by management, thus be seen as more valuable.
| 1 |
Social aspect of your job
|
better way to duplicate a layer using ogr in python?
|
I'm splitting a large shapefile into many smaller ones using ogr. I'd like to just copy all of the field and layer config information from the original. Here's how I'm doing it now:
src = ogr.Open('original.shp', 0)
layer = src.GetLayerByIndex(0)
driver = ogr.GetDriverByName('ESRI Shapefile')
ds = driver.CreateDataSource('file1.shp')
dest_layer = ds.CreateLayer('layer1',
srs = layer.GetSpatialRef(),
geom_type=layer.GetLayerDefn().GetGeomType())
feature = layer.GetFeature(0)
[dest_layer.CreateField(feature.GetFieldDefnRef(i)) for i in range(feature.GetFieldCount())]
Is there a more succinct way to do this?
|
Use Fiona of Sean Gillies , a very simple wrapper of the OGR library (The Fiona User Manual)
All the elements of a shapefile (schema, records) are processed using Python dictionaries:
schema of one of my shapefiles as example:
{'geometry': 'LineString', 'properties': {u'faille': 'str:20', u'type': 'str:20', u'id': 'int'}}
one record in the shapefile:
{'geometry': {'type': 'LineString', 'coordinates': [(269884.20917418826, 151805.1917153612), (270409.89083992655, 153146.21637285672), (272298.05355768028, 154047.38494269375), (272941.74539327814, 155484.96337552898), (272169.31519056071, 156117.92701386689)]}, 'id': '1', 'properties': {'faille': u'de Salinas', 'type': u'normale'}}
so to duplicate a shapefile:
from shapely.geometry import mapping, shape
import fiona
# Read the original Shapefile
with fiona.collection('original.shp', 'r') as input:
# The output has the same schema
schema = input.schema.copy()
# write a new shapefile
with fiona.collection(''file1.shp', 'w', 'ESRI Shapefile', schema) as output:
for elem in input:
output.write({'properties': elem['properties'],'geometry': mapping(shape(elem['geometry']))})
If you want to split a large shapefile into many smaller ones, everything takes place in the for loop but all the schemas of the original shapefile are preserved in the dictionary with schema = input.schema.copy() and {'properties': elem['properties']
see How do I find vector line bearing in QGIS or GRASS? for an example of
spliting a shapefile
preserve the attributes of the original shapefile in the splitted shapefile
and add a new field in the splitted shapefile
For Mac OS X or Linux users, it is easy to install. For Windows users, use the version of Christoph Gohlke Unofficial Windows Binaries for Python Extension Packages
| 1 |
Python dictionaries: schema of a shapefile
|
How to add blogger's RSS feed to facebook profile/page
|
I have a blog and I want that whatever is posted in the blog should get directly posted on my facebook profile/page. Basically I wish to post my blog's RSS feed to my facebook profile/page. I used RSS Graffiti to accomplish the task but somehow it seems like that isn't working.
|
You should forget about the user profile for that. First of all, you are not allowed to use the user profile for commercial reasons, it´s ONLY a user profile, for you and your friends, not a platform to advertise. And then there´s the problem with the Access Token. An Extended User Token lasts for 60 days, so you would have to refresh it every 2 months if you want to autopost stuff to Facebook.
Now for your Facebook Page, you can create an Extended Page Token that lasts forever. The rest is explained in the Facebook docs: https://developers.facebook.com/docs/graph-api/reference/v2.2/page/feed#publish
In general, you need to use a Page Token with publish_actions to post to the /page-id/feed endpoint.
Information about Access Tokens and how to generate and extend them:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/
| 1 |
Access Tokens are not allowed for commercial reasons .
|
How do I attach a GPS receiver?
|
I would like to hookup a GPS receiver to my Pi so that I can:
Get my geographical position
Synchronise clock when not connected to network
What are my options? Will any hardware supported by gpsd work with the Pi?
|
If you do not want to use USB you can use TTL GPS recievers. Sparkfun does a very fast 50 channel GPS receiver but you can find other ones on eBay or other sites.
You can use this by disabling the serial console on the Pi and connect the receiver directly to the UART pins.
* Remember to check the voltages of the GPS device you are using
| 0.888889 |
TTL GPS recievers can be used by USB
|
rabbitmq set message Properties php
|
I'm trying to set a message property using the RabbitMQ Bundle in Symfony but I don't see where/how I can do this. Here is how I do it in the RabbitMQ Admin UI
The Properties expiration: 50000 is what I would like to set.
How can I do this?
|
Since Jan 8, 2014, you cat set message properties using RabbitMQ Bundle, you can review the commit here
Now, when you publish a message you cat set the array $additionalProperties
public function publish($msgBody, $routingKey = '', $additionalProperties = array())
You can find the supported message properties here
For example:
$msg = ['arg1' => 'val1'];
$queue->setContentType('application/json');
$queue->publish(
json_encode($msg),
"",
['expiration' => '50000']
);
If you want to use "headers" for custom headers, it is a bit more complicated because you have to define the datatype for each value. To send, e.g. $headers['arg1'] = "val1" like a string, you have to do something like that:
$msg = ['arg1' => 'val1'];
$queue->setContentType('application/json');
$queue->publish(
json_encode($msg),
"",
["application_headers" => ["arg1" => ["S", "val1"]]]
);
Valid datatypes are:
S - String
I - Integer
D - Decimal
T - Timestamps
F - Table
A - Array
| 0.777778 |
Cat set message properties using RabbitMQ Bundle
|
How to fix a dpkg broken by the Brother MFC-7340 deb driver
|
I'm getting an apt-get error that says
E: The package brmfc7340lpr needs to be reinstalled, but I can't find an archive for it.
The brmfc7340lpr is a printer driver -- it's a local deb file. Doing a dpkg or apt-get purge doesn't work, neither does apt-get install -f .
How do I reinstall a package from a local deb file?
Output:
box-name% sudo apt-get upgrade
[sudo] password for username:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package brmfc7340lpr needs to be reinstalled, but I can't find an archive for it.
box-name% sudo apt-get purge brmfc7340lpr
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package brmfc7340lpr needs to be reinstalled, but I can't find an archive for it.
box-name% sudo dpkg --purge brmfc7340lpr
dpkg: error processing brmfc7340lpr (--purge):
Package is in a very bad inconsistent state - you should
reinstall it before attempting a removal.
Errors were encountered while processing:
brmfc7340lpr
box-name% sudo dpkg --install brmfc7340lpr-2.0.2-1.i386.deb
Selecting previously deselected package brmfc7340lpr.
(Reading database ... 725204 files and directories currently installed.)
Preparing to replace brmfc7340lpr 2.0.2-1 (using .../brmfc7340lpr-2.0.2-1.i386.deb) ...
Unpacking replacement brmfc7340lpr ...
start: Unknown job: lpd
dpkg: warning: subprocess old post-removal script returned error exit status 1
dpkg - trying script from the new package instead ...
start: Unknown job: lpd
dpkg: error processing brmfc7340lpr-2.0.2-1.i386.deb (--install):
subprocess new post-removal script returned error exit status 1
start: Unknown job: lpd
dpkg: error while cleaning up:
subprocess new post-removal script returned error exit status 1
Errors were encountered while processing:
brmfc7340lpr-2.0.2-1.i386.deb
box-name% sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package brmfc7340lpr needs to be reinstalled, but I can't find an archive for it.
box-name%
|
Actually, I ran into the same problem. Turns out I followed some irrelevant information and created a /etc/init.d/lpd file as a softlink to /etc/init.d/cups
The .postrm script checks for lpd and if it exists, tries to start the service.
After I deleted the softlinked lpd file in the init.d directory, the package installation and removal went back to normal.
| 0.777778 |
.postrm script checks for lpd and if it exists, tries to start service
|
Why the sudden popularity of .io domains?
|
I've noticed a number of new webapps and sites are being hosted at .io domains (the top-level domain for the British Indian Ocean Territories). A couple examples include:
Forecast.io
GitHub.io
Firepad.io
And the list goes on and on.
Is there any particular cause for the sudden popularity of .io domains?
|
They're available…
…probably because they're significantly more expensive(from any registrar I've ever seen) than the usual TLDs…
…and somewhat desirable to techs because of a cheap I/O joke.
The usage itself among web/tech people isn't terribly new. There were several bloggers who started using the TLD years ago that I can't remember at the moment. Over time, it just seems to have slowly built an association with those sorts of people and their output/products. You have to remember that it's gotten really hard to find a decent short domain with .com et al, and very few alternative TLDs like .ws have ever gained much traction, so there's a bit of community convergence going on here, stemming in part from that shared joke.
| 0.888889 |
.com et al is a popular short domain with .ws .
|
2007 T5 AWD Volvo S40 key won't start the car or unlock the doors
|
I didn't drive the car for three weeks. When I went to open the car to drive to work my keyless entry fob wouldn't work so I used the actual key to open the door. When I tried to start the car of course it wouldn't turn over, no lights or display popped up either. I took the plastic insert "key" out and tried to use my key but that didn't work either and now I can't even get the key out. What could be the problem?
|
You have a flat battery - use either a charger or a jump-start from another car (there are plenty of questions on here and guides elsewhere as to how to jump start) to charge the battery.
| 0.888889 |
How to charge a flat battery
|
Best practice for avoiding module / theme / profile name clashes?
|
We currently have our code managed such that each site has its own theme and install profile.
These have naturally evolved in such a way that the names of these items (and their directories) tend to be the same.
For example, one site's theme and profile are both called 'dennis'
This causes problems with feature servers, and (I'm suspecting) with Aegir.
Now... it's relatively easy to rename either of these (although, for various reasons it's noticeably easier to rename the profile). Is there any sort of best practice here, ie is it normal to call the theme dennis_theme, or the profile dennis_profile? Should I apply this convention to both, or just to one?
|
A way to avoid name clashes for custom modules that are used for specific sites, is to use the site name to create the module name. For example, the short name used for "Drupal.org customizations," which is the project containing modules used specifically on drupal.org, is drupalorg, while a similar project containing custom modules for groups.drupal.org is groupsdrupalorg.
You could also avoid to use the top-level domain, if you think that you will not create modules for sites with a domain name that differ only for the top-level domain (e.g. bingo.com and bingo.it).
| 0.888889 |
How to avoid name clashes for custom modules?
|
Looking for a word with a more positive connotation than "infectious"
|
I recently was attempting to describe someone's smile. I wanted to describe it as being very 'infectious', or that it spreads very quickly and is contagious. However, as hard as I could try, I could only come up with words that have to do with infections or words that have a negative connotation.
How could I describe a person's smile if it has the ability to 'spread' to other people, as denoted above?
Thanks!
|
His smile was like barbecue sauce- it wound up on everyone's face.
| 1 |
His smile was like barbecue sauce- it wound up on everyone's face
|
What is the difference between the KLMN and SPDF methods of finding electronic configuration?
|
I've always been puzzled by this because my teachers happen to use only the KLMN method, but what is the difference between the KLMN and SPDF methods of finding electronic configuration?
|
The KLMN(OP) method is based on electron shells, with the labels KLMN(OP) being derived from an experiment in which the spectroscopist wanted to leave room for lower energy transitions in case their were any.
K denotes the first shell (or energy level), L the second shell, M, the third shell, and so on. In other words, the KLMN(OP) notation only indicates the number of electrons an atom has with each principle quantum number ($n$).
The SPDF notation subdivides each shell into its subshells. For further information about the other quantum numbers, especially $l$, which defines the subshell, see the accepted answer to this question: What do the quantum numbers actually signify?
The K shell can hold two electrons: $n=1,\ l=0$
When $l=0$, we have an $s$ subshell, which has one orbital $m_l=0$, with room for two electrons.
The L shell can hold 8 elections: $n=2,\ l=0,1$
When $l=1$, we have a $p$ subshell, which has three orbitals $m_l=-1,0,+1$, with room for 6 electrons. The L shell also has an $s$ subshell.
The M shell can hold 18 electrons $n=2,\ l=0,1,2$
When $l=2$, we have a $d$ subshell, which has 5 orbitals $m_l=-2,-1,0,+1,+2$, with room for 10 electrons. The M shell also has $s$ and $p$ subshells.
The N shell can hold 32 electrons! $n=3,\ l=0,1,2,3$
When $l=3$, we have an $f$ subshell, which has 7 orbitals $m_l=-3,-2,-1,0,+1,+2,+3$, with room for 14 electrons. The N shell also has $s$, $p$, and $d$ subshells.
This [table here] summarizes the relationship between the two notations for all elements. Here is an example for scandium $\ce{Sc}$:
Scandium has 23 electrons $Z=23$. Its electron configuration in KLMN notation is
K L M N
2 8 9 2
Its SPDF notation (based on the aufbau principle) is $1s^2 2s^2 2p^6 3s^2 3p^6 3d^1 4s^2$
| 1 |
KLMN(OP) method is based on electron shells
|
" not all code paths return a value" when return enum type
|
I have enum list and method and i get error: " not all code paths return a value"
Some idea whats wrong in my method ? I am sure I always return STANY type :/
Thanks for help :)
private enum STANY { PATROL, CHAT, EAT, SEARCH, DIE };
private STANY giveState(int id, List<Ludek> gracze, List<int> plansza)
{
// Sprawdz czy gracz stoi na polu z jedzeniem i nie ma 2000 jednostek jedzenia
bool onTheFood = false;
onTheFood = CzyPoleZjedzeniem(id, gracze, plansza, onTheFood);
if (onTheFood && (gracze[id].IloscJedzenia < startFood / 2))
return STANY.EAT;
// Sprawdz czy gracz nie stoi na polu z innym graczem
bool allKnowledge = true;
allKnowledge = CzyPoleZInnymGraczem(id, gracze, allKnowledge);
if (!allKnowledge)
return STANY.CHAT;
// Jesli ma ponad i rowna ilosc jedzenia patroluj
if (gracze[id].IloscJedzenia >= startFood / 2)
return STANY.PATROL;
// Jesli ma mniej niz polowe jedzenia szukaj jedzenia
if (gracze[id].IloscJedzenia > 0 && gracze[id].IloscJedzenia < startFood / 2)
return STANY.SEARCH;
// Jesli nie ma jedzenia umieraj
if (gracze[id].IloscJedzenia <= 0)
return STANY.DIE;
}
|
there's no return if none of those if conditions are met. You need to either use if...elseif...else
or have a return after all of the if statements that will return a value if nothing has been returned (none of the if conditions were met).
| 0.833333 |
There's no return if conditions are met
|
nm: how to show object file of a symbol in a shared library?
|
I have 25 object files which are combined to form one shared library. I have generated the shared library with gcc and while I was looking for exposed symbols with nm -D libmylib.so, I found two undesirable exposed symbols with the name of i and y which are in .bss section. I have tried to find them in my source files but i cant find them so if anyone can tell me whether there is some way to find that which .o file exactly has these undesired exposed symbols? Can I do it with nm or do I need another tool?
Any help would be appreciated.
|
Once the shared library is linked, you can no longer tell which parts of it came from which object file.
You can search the individual objects from which you build the library:
find . -name '*.o' -print0 | xargs -0 nm -A | egrep ' (i|y)$'
You can ask the linker to tell you when they are defined:
$(CC) -fPIC -shared -o libmy.so $(OBJS) -Wl,-y,i,-y,y
If you built the library from objects compiled with -g, you may ask GDB where i and y came from:
gdb -q libmy.so
(gdb) info var ^i$
(gdb) info var ^y$
| 0.888889 |
-name '*.o' -print0
|
Psychology behind $0.99 for paid apps, but $1.00 for donation apps?
|
I've noticed a trend (at least on the Google Play store) of application prices ending in x.99, while 'donation' apps usually end on the dollar. I see the reasoning behind the psychology that makes a user purchase a $0.99 item over one that costs $1.00, but why the trend to keep the prices on the dollar for donation items?
|
I know this question is old, and the purpose of misleading prices has been covered, but I don't see any explanations about why donations are round amounts.
Simply put, taking donations as whole numbers is more convenient for charities.
They don't charge taxes or give change, so they list preset donation amounts without fractions of whole numbers (eg, cents) to make accounting easy, unless of course they accept coin donations in real life as well.
Asking for whole numbers is also more convenient for making donations. If you're using a web app to make a custom donation, it's easier to only have to enter one or two digits for the amount of dollars for example. In the real world, it's easier to only have to hand over one or two bills and maybe a handful of coins.
| 1 |
Donations as whole numbers are more convenient for charities
|
business-class fiber to the home
|
Suppose you're some sort of crazy nerd fellow and you live in an area that's absolutely covered in fiber optics and network facilities. What kind of cost / infrastructure would be needed to hook in somewhere and get you're internet connection directly from a local datacenter?
|
Fiber to the home would require laying a fiber optic cable, direct to you, over the "last mile". This is what Verizon does with its FiOS service. This is not cheap. You need permits to dig, you need to hire a construction team, you need to have them bring out the big orange spools of plastic. This is not something you would ever, ever do on your own.
Now, a normal leased line might be worth looking into. But, if you're in an area with that much outlay already, you can probably get 50Mbps cable; try it out first and see if it's inadequate before you spring for crazy upgrades.
| 0.888889 |
Fiber to the home would require laying a fiber optic cable over the "last mile"
|
Get selected value of a number model spinner
|
How do you get the selected value from a number based spinner in java?
As i side note why does android always come up under the search term spinner
|
A JSpinner has a SpinnerModel, that stores the selected Value, Bounds of the Values and step sizes, etc.
JSpinner spinner;
Object value = spinner.getModel().getValue();
Also other Spinners work this way. It is based on the Model-View-Controller(MVC)-Pattern and seperates the Data from their presentation and manipulation.
| 1 |
SpinnerModel is based on Model-View-Controller(MVC)-Pattern
|
Are programming books in other languages useful for Python?
|
I'm a self-taught intermediate Python programmer; I frequently come across popular books on software development and programming written in other languages (often Java).
Typical examples:
Refactoring: Improving the Design of Existing Code
Design Patterns, Gang of Four
Test Driven Development: By Example
The Art of Unit Testing: With Examples in .NET
Generally speaking, how useful is it to read a book written for another language? Specifically, what about Python? Should one stick to language specific books?
For example, a lot of people praise Design Patterns by the GOF, I've never read it because the model applies to other languages (after all Python is about anti-patterns, right?) yet I feel the urge to because of it's place in the CS literature cannon.
Likewise, would The Art of Unit Testing: With Examples in .NET help a Python programmer learn unit testing even though the examples are in .Net?
|
First of all, some of the books you mentioned are written with examples in multiple programming languages. For example, GOF's DP is written with C++ and, if fewer, Smalltalk examples, and TDD is written with Java and Python examples.
If you are well trained in picking up what's useful, dropping what's not, and translating what you've picked up, you'll benefit from reading most of generally recommended books for programmers. However, if you have little experience in doing this, you could start from "near-transfer" books. Otherwise, you will learn very little, or even you will learn bad ideas and habits -- some of the practices are language-paradigm dependent. I have seen a good deal of Python programmers with all the hassles for implementing GOF's DP in C++.
Transfer is psychological and educational term for applying what you have learned in a different context. They differentiate between near and far transfer. Usually near-transfer is easier and more effective, which means you need to put more effort for far-transfer.
For near-transfer learning, I highly recommend learning from similar languages, in terms of its paradigm, to your target language -- siblings in the language typology. For Python, that would be something like Smalltalk -- or nowadays Ruby but Smalltalk's legacy is greater.
For instance, you will learn a lot more from reading DPSC than from solely reading GOF's DP. (BTW, reading both DPSC and GOF's DP at the same time with careful contrasting and comparing is a very rewarding learning experience)
From my near-transfer experiences, I remember leaps of improvement in my Python programming from reading books(articles, papers, and etc) for Smalltalk, APL, Io, and ICON, all of which are dynamic in nature.
| 1 |
GOF's DP is written with C++ and Smalltalk examples if fewer, and TDD with Java and Python
|
How should I create sitemap of a site which goes live with thousands of pages?
|
We are working on an education site and have custom website built on wordpress.
One component of site is blog posts and pages, sitemap for which gets built by sitemap plugin every night.
Another component is the college pages and we went live with this section 2 month back. To build the sitemap for these 8000+ pages , we wrote a program and created a sitemap lets say abc.xml.
Then we submitted the sitemap to google.
After 2 months, I can see that the google acknowledged the submission but never indexed these 8000+ pages.
561 indexed pages are from our blog post and pages.
I guess the mistakes we did was that we created the sitemap of 8000+ links and submitted when we should have done it in piecemeal basis.
2nd mistake I guess is that we do not update the abc.xml sitemap regularly which we thought of doing once all the pages were indexed.
What is suggested
a) to fix this problem
b) and how to get the pages indexed ?
|
To answer your question very specifically. Google prefers to index smaller sites and submitting a sitemap, while advisable for a site your size, may actually go largely ignored. Yes Google has read it. And yes Google is indexing pages, but I would surmise that Google is opting for indexing your site by following links more than the site map.
One site I submitted a sitemap for was fully indexed while the sitemap was hardly touched according to Google Webmaster Tools. This should not be a concern.
As well, any site can really take a while to get indexed especially any new site. Google is very good about discovering new sites and spidering them, however, any new site remains at the end of the fetch queue consistently up and until the site is well settled into the index and Google begins revisiting the site. Simply put, any new site will be at the end of the line for a while.
If your site is relatively new, it will likely take a while longer to get all of your pages in Google. You will see Google go in fits and spirts and it will frustrate the h311 out of you! Just be cool for a while. It will all work out for you just fine.
| 0.888889 |
Google prefers to index smaller sites and submitting a sitemap
|
Would this work? Using a computer SMPS as a DC-DC converter
|
I have this crazy idea of using a computer SMPS with active PFC boost to take high voltage DC battery banks (144V+) and drop it down to 3.3V, 5V and 12V.
Here's my thinking: the power supply internally rectifies the AC to DC, and the PFC boost should then boost the 144V to an acceptable 350V-400V for the power supply. The 144V input is okay for it because it falls in the 100VAC range, and most are rated down to 85VAC if not lower.
I'm not looking for a guaranteed solution - it's a one-off problem I'm trying to solve, but I think it could be a cheap and viable solution.
|
Someone once claimed that it was possible to supply 170V DC directly to a computer power supply (switch-mode) and it would work as normal. I can only see this succeeding if the power supply has no transformer (I don't know if this is common for SMPS computer power supplies). Otherwise if it's isolated the DC won't do anything and the power supply won't work.
But if it does work then you have nothing to worry about. Fully-rectified AC is about 170VDC with ripple. It won't hurt to remove the ripple and the power supply will work as normal. I'm fairly sure that 144VDC would be sufficient as well, but the power supply might have to work a bit harder.
You should have no problem with this as long as the supply has no transformer But put some fuses in - I'll bet your battery pack can supply some insane current.
| 0.888889 |
Power supply to a computer power supply (switch)
|
Alternatives of 'a snowball's chance in hell'
|
I am looking for a different, common English idiom that expresses the same thing as a snowball's chance in hell. My teacher says I use this expression too much, and that it is not appropriate for every essay. I need a same meaning like something very cold in a hot place to have a little chance.
|
If You're in the Northern Hemisphere, "... a blizzard in July"; if you're in the Southern Hemisphere, change "July" to "January". But I have a hunch that if you use the same idiomatic expression in every essay, adding one, two, or even three alternatives into a rotation is not going to satisfy the teacher for very long. Any of the likely alternatives to the idiom are going to be somewhat informal, so in more formal writing you might want to use a phrase like "highly unlikley" or some of the choices of Armen.
| 1 |
If You're in the Northern Hemisphere, change "July" to "January"
|
Will existing Ubuntu installation still work on this new hardware?
|
I currently have the following CPU:
model name : AMD Athlon(tm) II X2 240e Processor
stepping : 2
microcode : 0x10000b7
cpu MHz : 2800.000
cache size : 1024 KB
on the following mainboard:
Product: 785GT-E63(MS-7551)
Vendor: MICRO-STAR INTERNATIONAL CO.,LTD
I plan to get a new CPU Intel i7 and a new corresponding mainboard but keep the SSD, graphic card and wireless card?
Does anyone know if my existing Ubuntu installation will still work on this new hardware?
|
Linux works with general drivers.
I have taken out my hard disc from broken systems almost 10 times now and inserted the old hard disc into a brand new system and it just works (tm).
All you have to take into account that if your switch videocard brand (from NVidia to AMD or from AMD to Nvidia) is to remove the restricted driver if you have that installed (ie. in general you need to remove all 3rd party drivers you installed for hardware that does not come with the new system).
Try it. I believe you will be amazed at how easy it is to do this. You will not even have to re-install the OS; just pop the hard into the new system.
I would advice to not buy a motherboard that uses UEFI (if possible). It might work as I posted above here by turning UEFI off but there is no guarantee. Due to the nature of this piece of ... it might fail since the hardware changed and a re-install might be obligatory.
| 1 |
Linux works with general drivers.
|
Is the number 1 a unit?
|
In dimensionless analysis, coefficients of quantities which have the same unit for numerator and denominator are said to be dimensionless. I feel the word dimensionless is actually wrong and should be replaced by "of dimension number". For example, the Mach number is of dimension one.
Many people write, for this case:
Mach-Number | Dimension: "-" | Unit: "1"
As mentioned before, I would say 'Dimension: "1"' in this place. But what about the unit? $\text m/\text s$ divided by $\text m/\text s$ is equal to one. But is the number one a unit by definition? Or should one say that the Mach number has no unit and therefore 'Unit: "-"'?
|
The number $1$ may be linguistically described as "unity". This very number is the original source of various words in the terminology, like the "unit matrix" (a matrix behaving like the number $1$).
It is a convention to write down that dimensionless quantities like the Mach number have units $1$ because the multiplication by $1$ changes nothing about the result – this is the counterpart of the multiplication by another unit like ${\rm m/s}$.
It just looks more coherent to write the unit $1$ into the tables. But verbally, one may also say that quantities with "this unit" have no units whatsoever. They are dimensionless. As long as one understands the logic, there's no problem in following these somewhat inconsistent conventions in which we sometimes say the units to be $1$ and sometimes we say that the units aren't there.
In the tables, the "unit" column means "the ratio of the full quantity and its numerical value". With this definition, the result may be calculated as $1$ without any problems. It's similar to the task to compute budget deficits as the difference of revenue and expenses. If the latter two are equal, the difference is just $0$. One may write $0$ although he could also write it as $-$ and say that the difference "doesn't exist". The numbers $0$ and $1$ play the role of the "neutral objects" for addition and multiplication, respectively.
| 1 |
Quantities with "unity" are dimensionless
|
How do I increase sudo password remember timeout?
|
I already know that I need to tune /etc/sudoers file but I would like to see full information and also a solution that would not require me to use vi editor.
Update: never, ever try to edit the file with something else than visudo.
|
Run sudo visudo and add this line:
Defaults timestamp_timeout=-1
See man 5 sudoers. -1 causes the password to never timeout. You may change the number to whatever you like in minutes.
The man page for sudo says that sudo -v "extends the sudo timeout for another 5 minutes".
Running 'sudo visudo' instead of editing the file directly causes the system to validate the sudoers file before it commits the changes. For instance, if you leave a stray character somwhere, when you save and exit, it will say "there is an error in the sudoers file, what would you like to do?" ... hence giving you a chance to go back in and edit. This actually just happened to me 10 minutes ago.
| 1 |
Run sudo visudo and add this line: Default timestamp_timeout=-1 See man 5 sudoers
|
Helpless opponent & Coup de Grace
|
I had a question about Coup de Grace.
It says you can use it against a helpless opponent. Helpless opponent is defined as "Paralyzed, held, bound, sleeping, unconscious, or otherwise completely at an opponent's mercy."
Now, if I was invisible and behind an unwary opponent, could I use a Coup de Grace because he'd be 'completely at my mercy'?
I've read things in places that this might indicate a yes, but I wanted a definitive answer.
Thanks!
EDIT: I was just using invisibility to set the stage. The point was that the victim has no idea I'm there. Invisible, or not, I just wanted to know if this situation counted as a coup de grace.
|
No. You don't even automatically hit when invisible, it does not count as a coup de grace.
| 1 |
When invisible, it does not count as coup de grace
|
Is hacking back a valid security technique for companies?
|
Recently it has come to light through the reverse engineering of hacking tools that there are vulnerabilities in them that could be exploited to take over an attackers computer during a remote hacking session. In other words, while they are hacking you, you could get into the system from which they are launching the attack to find out what they have managed to access, what the system is, or even p4wn it yourself. The goals would be damage control, deterrence, and ultimately being able to charge the perpetrator of the crime.
Leaving aside the many legal, ethical, and moral considerations (if you are curious there's a debate recorded here), my question is whether hacking back using this technique has any value to a company. If it was ethical and legal would it be worth a company to invest in the systems and skills needed to make this work, or is it a waste of money?
EDIT:
There's been several comments regarding leaving the legal and ethical considerations out of the question, so here's the explanation behind that. So far the discussion of hacking back in this manner has been discussed by lawyers, some shouting it is legal, and others saying it isn't. What they do agree on is that there's no case law, and until there is there will be no clear answer. Also, legalities vary from nation to nation, so the answer to legality is "maybe" and "it depends where you are".
However so far none of the discussion I've seen has been among IT Security professionals who would be the ones to design, deploy, and run systems that would to the hacking back. The lawyers all seem to think that organizations would adopt the technique as a matter of course, but I am not in agreement with that and I would like to hear the views of my peers. This is why I've asked the question apart from legal and ethical aspects.
|
We had this debate at our local OWASP chapter last night about whether a honeypot should strike back. We did talk about some legal and moral issues however decided it was not a good idea because:
The majority of attacks are coming from dumb clients on botnets or through automated tools, so what are you actually achieving by taking out yet-another-dumb client?
The focus of your business should be aligned to your business objectives - fighting cybercrime (unless you work for a police authority) should not form part of that.
If the attack becomes serious and you need to go to court; evidence that you "striked back" would not look good and could work against you. if you are going to spend money in this topic then spend it on forensic tools so that it strengthens any legal action
circular attacks: consider if you accidentally strike back at another tool that has strike back capability? then you're just eating up bandwidth unnecessarily.
| 1 |
What are the goals of a honeypot attack?
|
Running a get link serverside, with php
|
When my PHP script runs, I would like to run a link like this server side:
http://77.33.xx.xx/s/addtoqueue.php?action=store&filename=myprettypicture&link=http://i69.servimg.com/u/f69/13/29/70/44/facebo10.png
Im doing this for storing the images on a own separate images server. The link is adding the image to a queue.
How can I execute this link correct?
I did this so far:
$link = 'http://77.33.xx.xx/s/addtoqueue.php?action=store&filename='.$filename.'&link=$link;
But dont know how to run this?
And would it by the way be smart to urlencode() and urldecode() the $link?
|
You can use cURL to call your link.
http://php.net/manual/ru/book.curl.php
| 1 |
Use cURL to call your link
|
Low beam headlights don't work, High beam headlights do
|
The vehicle is a 2003 Chevrolet Trailblazer. The low beams aren't working. High beams are. The fuse is perfectly fine (tested and swapped out). The bulbs are fine too.
A mechanic told me it could be the "body modulator". I've never heard of this before. Could this be the problem? If so, how hard is it to change out for a shade tree mechanic?
If not, what else could this be?
|
There is a relay in the fuse box under the hood on the driver's side. On a 2004, it's #46 and labeled 'HDM Relay'. YMMV. You can swap it with a known good relay (same type from the box for something you know is working). #45 should be the same (on a 2004 at least) and should be the engine fan clutch. If the headlights work after the swap, swap them back and get a new relay (you don't want to have a non-operational fan). This is from a writeup at Sparky's Answers.
Generally, start with the bulbs. Check the connectors with a multimeter and work your way back from there. You really need a wiring diagram. Based on some Youtube videos, it looks like there should be a 4 pin connector on the headlight module with 4 wires, Tan, Green, Black and Black. The blacks should be the grounds, tan should be low beam, green should be high beam. Each bulb also has a 2-wire connector you'll also need to check if the 4-wire connector checks out.
I suspect there is a dimmer switch somewhere, probably on the steering column. Hopefully you can get at the connector to check it without removing the lower dash or dropping the steering column. If you know what wires go where, you can jumper the appropriate connectors to simulate a working switch set to low beam.
| 1 |
If the headlights work after the swap, swap them back and get a new relay
|
Triac circuit confusion
|
X1Iz.png
I have the following questions about the above circuit:
-Why are we even using a trica/diac combo above. Why would a circuit consisting of just the fuse, switch and primary not be sufficient for charging the battery?
-If we do go ahead with the above combo, what is the use of the resistor/capacitor combo attached in parallel above the triac?
Thanks
giv
|
The circuit attached to the primary of the transformer is a phase chopper or "dimmer" which would reduce the power the transformer is getting (and thus delivering to the load) according to the selected value of the variable resistance.
The way a phase chopper works is delaying when the triac turns on each cycle, the variable resistor charges the capacitor until it reaches the breakdown voltage of the diac and then the triac turns on.
| 0.888889 |
The circuit attached to the primary of the transformer is a phase chopper (dimmer)
|
In-game rewards for game-related work?
|
The other GM in my group and I are both big fans of giving XP rewards for things done out of the game. Ex: We have an artist who will draw and design all sorts of stuff to "fluff out" our campaign.
We noticed participation spiked when we offered rewards like this. Eventually, we even offered XP to our "scribe" for recording everything that happened each session. At the most, though, this gives bonus XP for up to two of our players. We do not plan to remove these bonuses, but want to be fair to all our players.
What are some fun things your players can do out of game that you can reward as GM? The goal is to have them be engaged in our game even when we aren't playing.
|
I was first introduced to this idea in the Amber Diceless Roleplaying Game, which encouraged player involvement by awarding Good Stuff (a mix of character-building points and general karma) for out-of-character actions.
The main ones used there were more fitting for the Amber setting - drawing character cards (Trumps) of the characters, or writing in-character diaries for the character, which worked fantastically for our game, since in addition to having us think of the characters between session, created a running documentary of the campaign. Additionally, this scales up to however many players want in, though it's not necessarily as useful for a dungeon-crawling sort of game.
Other options for us involved the rather prosaic driving duties - a player who regularly picked up transportationally-challenged players and drove them to and from the sessions was rewarded, as were the players who build the campaign website (now sadly offline, I really need to put it back up).
I don't have the Amber Diceless book any more, but if you can get your hands on it (there's a PDF version being sold at DrivethruRPG) you can look up their suggestions for player rewards.
| 0.888889 |
Amber Diceless Roleplaying Game
|
What's the meaning of this sentence?
|
Below is a passage taken from this article
I don rubber gloves, bravely grab my pickup stick and swallow the remainder of my coffee. It’s not even midnight yet. I remember the advice of my former roommate who — once and again — occupied the same stool I stood up from.
Does the last sentence I italicized means his former roommate used to work at the shop before, and has again came back to work there for the second time?
|
Once and again is pretty old-fashioned to me. I would use "now and then", "from time to time", and "time and time again" for various shades of meaning. "Now and then" means occasionally; there's a sense of irregularity about it. "From time to time" is still not often, but there's a sense of more regular occurrence than now and then has. "Time and time again" means quite often, sometimes too often, as in being told time and time again not to slam the door. For the OP's sentence, I would most likely use from time to time.
| 0.888889 |
"now and then", "from time to time" and "time and time again"
|
How does one build a mizbeah?
|
Are there specifications to build a mizbeah? I understand that stones were used , are there other requirements?
Can one build a mizbeah in our days?
|
Are there specifications to build a Mizbeah?
Yes, there are specification for building a Mizbeach - and the Rambam has codified them in the first 2 chapters of הלכות בית הבחירה
Can one build a Mizbeah in our days?
The Rambam (ibid 1:3) says that after the temple was built (i.e. nowadays), individuals may no longer have their private temples nor make private sacrifices.
כֵּיוָן שֶׁנִּבְנָה הַמִּקְדָּשׁ בִּירוּשָׁלַיִם נֶאֶסְרוּ כָּל הַמְּקוֹמוֹת כֻּלָּן לִבְנוֹת בָּהֶן בַּיִת לַה' וּלְהַקְרִיב בָּהֶן קָרְבָּן
That leaves the option of building the Mizbeach on the Temple Mount. Two issues arise.
The Rambam says (ibid 1:4) we don't have enough details to build the 3rd Temple.
וְכֵן בִּנְיָן הֶעָתִיד לְהִבָּנוֹת אַף עַל פִּי שֶׁהוּא כָּתוּב בִּיחֶזְקֵאל אֵינוֹ מְפֹרָשׁ וּמְבֹאָר
The Rambam says (ibid 2:1) that the Mizbeach must be built on its precise location; no deviation allowed.
הַמִּזְבֵחַ מְקוֹמוֹ מְכֻוָּן בְּיוֹתֵר. וְאֵין מְשַׁנִּין אוֹתוֹ מִמְּקוֹמוֹ לְעוֹלָם
Building it nowadays would require deciding between various opinions as to its location. A job best left to Eliyahu HaNavi, may he arrive speedily in our lifetime.
| 1 |
Are there specifications for building a Mizbeah?
|
Issue while deploying Spring MVC application | no matching editors or conversion strategy found
|
I am facing a deployment issue while trying to deploy my application in oracle weblogic 12c server. While deploying, I get below error:
java.lang.Exception: Exception received from deployment driver. See Error Log view for more detail.
at oracle.eclipse.tools.weblogic.server.internal.DeploymentProgressListener.watch(DeploymentProgressListener.java:190)
at oracle.eclipse.tools.weblogic.server.internal.WlsJ2EEDeploymentHelper.deploy(WlsJ2EEDeploymentHelper.java:510)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishWeblogicModules(WeblogicServerBehaviour.java:1501)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishToServer(WeblogicServerBehaviour.java:920)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishOnce(WeblogicServerBehaviour.java:708)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publish(WeblogicServerBehaviour.java:555)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3108)
at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: weblogic.application.ModuleException: java.lang.IllegalStateException: Cannot convert value of type [$Proxy214 implementing org.springframework.web.accept.ContentNegotiationStrategy,org.springframework.web.accept.MediaTypeFileExtensionResolver,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.springframework.web.accept.ContentNegotiationManager] for property 'contentNegotiationManager': no matching editors or conversion strategy found
at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:140)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:213)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:208)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:70)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:24)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:48)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:586)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:148)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:114)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:339)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:846)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1275)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:442)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:176)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)
Caused by: java.lang.IllegalStateException: Cannot convert value of type [$Proxy214 implementing org.springframework.web.accept.ContentNegotiationStrategy,org.springframework.web.accept.MediaTypeFileExtensionResolver,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [org.springframework.web.accept.ContentNegotiationManager] for property 'contentNegotiationManager': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:264)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:450)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:496)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:490)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1437)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:598)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:517)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:458)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:138)
at javax.servlet.GenericServlet.init(GenericServlet.java:240)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:337)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:288)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
The main part of the exception stack trace is:
weblogic.application.ModuleException: java.lang.IllegalStateException: Cannot convert value of type [$Proxy214 implementing
org.springframework.web.accept.ContentNegotiationStrategy,org.springframework.web.accept.MediaTypeFileExtensionResolver,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type
[org.springframework.web.accept.ContentNegotiationManager] for property 'contentNegotiationManager': no matching editors or conversion strategy found
I have not defined any 'contentNegotiationManager' in my mvc config xml. Please help!
|
This was because I did put my AOP configuration in MVC configuration file and AOP was trying to create proxies for Spring MVC classes. Placing AOP config in a separate file solved the problem.
| 0.833333 |
Installing AOP configuration in MVC configuration file
|
Long term vacation on Falkland islands?
|
Has anyone ever been there? I was wondering if anyone knows any "local" classifieds site there for a somewhat mid-long term accommodation (3 months?) without staying in a Hotel. Also, does anyone know how difficult is it to obtain a working visa there with a EU passport, and what costs of living for food, bed and transport I can expect?
Will it be warm enough to go swimming there for at least a few weeks during summer?
|
According to http://en.wikipedia.org/wiki/Falklands, the record high temperatures in the summer months are 22 - 24 C. I swam in Bermuda in November, when the average high is 23, but the guidebooks say "only Canadians and Scots" will do so and we had absolutely NO company - the beaches were deserted. The average high in the Falkland summer is more like 13. Couple that with ocean water, sure to be cooler than lakes, and I would guess there is not much swimming to be had.
| 1 |
The record high temperatures in the summer months are 22 - 24 C .
|
Is it better to put "Preview" on an iFrame with a specific height or just show it in full?
|
We have a page that shows a preview of another page (newsletter) on an iFrame. Now we have two ways of displaying this:
Give the iFrame a specific height so that the user can scroll up / down within the iFrame to see the embedded page fully.
Dynamically resize the iFrame to the height of the embedded page so that it actually gets displayed in full (without the iFrame
scrollbars).
Is #1 better so that the users can access the buttons at the bottom easily (button is "Next") without scrolling 'till the end of the embedded page? (Although the disadvantage is that iFrame scrollbars are ugly.)
OR
Is #2 better so that the users actually feel like they're just seeing 1 whole page (and no scrollbars)? (Although the disadvantage of this would be the page could be very long depending on newsletter's height. But one can argue that newsletters are seldom very long and that users do scroll down.)?
|
It sounds like you are describing every help widget of 10 years ago. It would be best to abandon the iframe for loading content in this manner. Definitely don't open a new window for the content either unless it's a file. There are more benefits to providing stateless url driven content, the two biggest being:
SEO
Bookmarking
You could avoid long content by providing a "read more" or "continue reading" link.
http://www.smashingmagazine.com/2009/07/28/designing-read-more-and-continue-reading-links/
| 0.888889 |
SEO Bookmarking You can avoid long content by providing "read more" or "continue reading" links
|
How to put a dollar symbol before every column and row number in google spreadsheet
|
I have a big spreadsheet in google docs with many formulas like this: =MIN(C3;C4)/500+4. Now we need to add $ before every cell row/column to make it absolute. So, the formula should look like this: =MIN($C$3;$C$4)/500+4.
Is it possible to replace all these names in bulk, so I won't need to manually change each of them? Probably, a regexp could be used.
|
It will depend upon what else you have in your spreadsheet. Text like "Minutes(Cardinal)" might require care. First I would have the formulae visible (View, All formulae or Ctrl+`).
Then it rather depends upon the formulae, of which you have only provided a single example. A column as the example that had been copied down could be changed with simple Edit, Find and Replace.... of (C with ($C and ;C with ;$C, with Also search within formulae.
With two columns the same (say Cs and also Ds), Search using regular expressions could be applied to save repeating the above for Ds, with finding:
(\()(.) and
(\;)(.)
and in both cases replacing with:
$1$ $2
Two columns for example, but it could be the whole sheet. Unfortuantely that regex introduces spaces into the formulae, though those can then be removed quite easily and in bulk.
So possible, but a peculiar requirement for which they may be a better alternative solution.
| 0.888889 |
Text like "Minutes(Cardinal)" may require care .
|
Insert a Views Block into a node in Drupal 7
|
[Drupal 7]
I have a block I created in Views called "handy_tips-block_1".
Now I want to insert it into the body field of my node.
How do I do this?
I found a guide on here, which suggests to use the following code:
<?php
print $block = module_invoke('views', 'block_view', 'handy_tips-block_1');
print render($block['content']['#content']);
?>
However, all what is printed out are the words "Array".
(I have enabled the PHP input filter for the body field).
Note: in the posted code, I have also tried substituting 'views' with various items such as "block". I have used 'handy_tips-block_1' as the ID, because that is what is displayed on the configuration link of the block administration page.
|
I realise this is an old thread now, but I was looking for this too and found the BlockReference module. It allows you to associate a block with a node as a field.
It works a treat!
| 1 |
BlockReference module
|
" not all code paths return a value" when return enum type
|
I have enum list and method and i get error: " not all code paths return a value"
Some idea whats wrong in my method ? I am sure I always return STANY type :/
Thanks for help :)
private enum STANY { PATROL, CHAT, EAT, SEARCH, DIE };
private STANY giveState(int id, List<Ludek> gracze, List<int> plansza)
{
// Sprawdz czy gracz stoi na polu z jedzeniem i nie ma 2000 jednostek jedzenia
bool onTheFood = false;
onTheFood = CzyPoleZjedzeniem(id, gracze, plansza, onTheFood);
if (onTheFood && (gracze[id].IloscJedzenia < startFood / 2))
return STANY.EAT;
// Sprawdz czy gracz nie stoi na polu z innym graczem
bool allKnowledge = true;
allKnowledge = CzyPoleZInnymGraczem(id, gracze, allKnowledge);
if (!allKnowledge)
return STANY.CHAT;
// Jesli ma ponad i rowna ilosc jedzenia patroluj
if (gracze[id].IloscJedzenia >= startFood / 2)
return STANY.PATROL;
// Jesli ma mniej niz polowe jedzenia szukaj jedzenia
if (gracze[id].IloscJedzenia > 0 && gracze[id].IloscJedzenia < startFood / 2)
return STANY.SEARCH;
// Jesli nie ma jedzenia umieraj
if (gracze[id].IloscJedzenia <= 0)
return STANY.DIE;
}
|
Maybe you're sure that a return type will always be given, but the compiler isn't [imagine that all the if conditions fail - ie: a variable was changed while your code was executing by an external program. Then what would happen?]
Just stick a return at the bottom as a "default" value. You could also throw an exception too, if you want, since the bottom should never be reached, right?
| 0.888889 |
if conditions fail, what would happen?
|
Seperation of drawing and logic in games
|
I'm a developer that's just now starting to mess around with game development. I'm a .Net guy, so I've messed with XNA and am now playing around with Cocos2d for the iPhone. My question really is more general though.
Let's say I'm building a simple Pong game. I'd have a Ball class and a Paddle class. Coming from the business world development, my first instinct is to not have any drawing or input handling code in either of these classes.
//pseudo code
class Ball
{
Vector2D position;
Vector2D velocity;
Color color;
void Move(){}
}
Nothing in the ball class handles input, or deals with drawing. I'd then have another class, my Game class, or my Scene.m (in Cocos2D) which would new up the Ball, and during the game loop, it would manipulate the ball as needed.
The thing is though, in many tutorials for both XNA and Cocos2D, I see a pattern like this:
//pseudo code
class Ball : SomeUpdatableComponent
{
Vector2D position;
Vector2D velocity;
Color color;
void Update(){}
void Draw(){}
void HandleInput(){}
}
My question is, is this right? Is this the pattern that people use in game development? It somehow goes against everything I'm used to, to have my Ball class do everything. Furthermore, in this second example, where my Ball knows how to move around, how would I handle collision detection with the Paddle? Would the Ball need to have knowledge of the Paddle? In my first example, the Game class would have references to both the Ball and the Paddle, and then ship both of those off to some CollisionDetection manager or something, but how do I deal with the complexity of various components, if each individual component does everything themselves? (I hope I'm making sense.....)
|
I think what you're probably use to in the business world is separating abstraction and implementation.
In the game dev world, you usually want to think in terms of speed. The more objects you have the more context switches will occur which may slow things down depending on the current load.
This is only my speculation since I'm a wannabe game developer but a professonial developer.
| 1 |
separating abstraction and implementation in game dev world
|
How can I model a human who gets powers from a part-time symbiote alien?
|
I had an idea for a Mutants and Masterminds (2e) character based on a video game character idea of mine: a Gestalt consisting of a human male and a smaller, roughly cat-sized alien symbiote. As a Gestalt, the symbiote could provide augmentations for the human by fusing its body mass with various regions of the human's body (i.e. arms for strength or reach, legs for speed and jump height, forming wings on his back for gliding), but due to its small size, it can only provide one benefit at a time, but can take an action to switch what benefit it is providing.
Individually though, things work differently; the human doesn't have any powers of his own (except maybe above-average physical stats as a side effect of his little friend) while the symbiote not only has small size and shapeshifting abilities, but also can bond with and control other humans to aid and protect his owner, though it cannot provide the same augmentations as when it is bonded to its owner.
I am aware there are powers available for this concept to work, I'm just wondering if the whole "human without powers + small non-human with powers" joint combo could be done within the game's rules. Is it possible, and if not, what would I need to change?
|
It's totally possible and a player did it in one of my game. The challenge with Gestalt is the "Duration: Sustained" part. You get KO? Your symbiote is kicked out or something. You can buy extras to make this continuous if you like. Just remember that gestalt is meant to represent two creatures (or more) of equal power level that together creates a single more powerful being. So if you play in a 150 PP campaign, your human and your symbiote would have 75 PP each etc. It's possible but I think there are simpler approach.
What my player did was to think about it the other way around. Why not play an alien with mind control on contact? So he played the alien and used the Boost power to increase a mundane guy and took powers (like super-strength, super-speed, strike etc.) with flaw that requires him to be physically attached to a body to function. A mix of flaws and drawbacks and you're good to go.
If you want your symbiote to be able to control other bodies and use them to protect the main host, you can use mind control on other guys here's what I suggest: Summon.
Usually people think of summon as this unnatural way to call a minion here. Magic or teleport etc. But it's actually a simple way to have quick help come from somewhere. Having a move called "Call security" (Summon Minion with flaw: delay 5 min) is a good example of how you can use it. So I would have Summon (in fiction you simply mind controlled a bystander who suddenly helps you. Add the power modifier called Sacrifice and you can use those minions to intercept attacks!
| 1 |
Why not play an alien with mind control on contact?
|
Are damage over time effects buffed retroactively from damage buffs?
|
If I cast Haunt on an enemy and it's ticking along, and then later cast Piranhas on the same enemy (which gives a 15% damage bonus against affected enemies), will Haunt do more damage for the duration of the Piranhas, or does Haunt have to be re-cast to gain the effects of the new damage buff?
|
They shoudn't.
Now, I can not say for sure about Haunt and Piranhas, and even if I could, anything could change tomorrow with a hotfix.
What I am getting at, though, is that Blizzard has successively fixed those pairs of skills/effects that "snapshot" damage. The reason for fixes is the opposite of what you describe - some builds are able to field a significant damage/skill bonus for a short while, and damage over time effects applied during that timeframe would "snapshot" the increased damage and continue to deal it for a significant amount if time, even after buffs have fallen off.
I cannot find mentions of skills being fixed in such fashion in hotfix logs since 2.0.1, and the only mention in patch notes is that before 2.1.0 Ancients did snapshot attack speed when summoned. But latest hotfixes mention fixes to legendary item procs snapshotting quite a bit.
| 0.666667 |
Fixed skills/effects that "snapshot" damage
|
Safari - is there a way to set a preferred screen size?
|
As the title says, I would like new windows to open in a set screen size. I believe that the default is that they open in the size of the last window. Sometimes, I want to make a window smaller for some reason, but I want new windows to open as usual. Is there a shell script/command to accomplish this? Thanks
|
There is a great extension available for Safari called ResponsiveResize which works great for me: http://www.midwinter-dg.com/downloads_safari-extension_responsive-resize.html
| 1 |
ResponsiveResize extension available for Safari
|
Long-ish term trailer rentals?
|
We're moving out of a flat in Paris next month and moving into another flat elsewhere in France at some indeterminate point between July and September after we travel for a while.
Is there a way to avoid moving twice by renting a sealed trailer for an extended period, maybe leaving it with family elsewhere in France for a couple months?
|
You're probably looking for something like Mobilbox. They will drive a large (8m3) storage box to your home, you load your things into it, and then they store it until you're ready and then they will bring the box to your destination and you unload it again. For an additional fee they will also load and unload for you.
| 1 |
Mobilbox will drive a large (8m3) storage box to your home
|
Silent, extremely portable instrument to learn music
|
I am currently off work for more or less a month, so I decided it could be a great time to learn an instrument and how to compose some simple tunes.
I am 29, never played anything meaningful in my life, know very little to nothing about music theory but I can comfortably read notes on a score.
Asking a search engine for suggestions brought me to the music section of stackexchange and particulary to this question. After some thought I am planning to buy the Kaossilator 2 becase I feel/think:
it is not too expensive for me (less than 200$) (otherwise I would have fancied a Teenage engineering OP1;
it can be completely silent (commuting home->work->home takes quite a long time, I would like to be able to practice in crowded places (without annoying anyone);
it is extremely portable (for the above commuting);
it can be played even without being plugged to a pc (otherwise I would have chosen this korg nano keyboard);
it can study some music theory with it;
in some six months I will be able to show some decent performance with it (so to say, I hope it has a bit of depth and is not just a toy).
Since (as I said), I know nothing of music and musical instruments, I would like to have someone savvy to 'validate' my points; alternative suggestions/idead would be appreciated, too!
I am sorry I haven't 'linkified' but, as it is my first question, stackexchange only allows me to have two hyperlinks.
|
I want a Kaossilator, but to learn music, it is strongly preferable to have more control over it.
I am a guitarist, but my recommendation would be something with a keyboard. A keyboard app on an iPad would be most portable, and there are low-end beginner keyboards available for just around the $100 level.
| 0.888889 |
Kaossilator keyboard app on an iPad
|
What is an adjective for "requires a lot of work"?
|
For example,
Starting a new business requires a lot of work.
What would be an adjective in: Starting a new business is _.
|
If you want a single word for "a lot of work", consider "onerous" or "laborious", though I'm not sure "a lot of work" captures all the relevant obstacles to starting a business.
| 1 |
"a lot of work" captures all the relevant obstacles to starting a business
|
JMS web application with Eclipse and WebSphere Application Server
|
I am new to JMS and WAS. I am grateful if someone provides any reference that helps me to create a web application in eclipse with JMS and WAS 7.0.
Also want to get answers for below questions..
How to inject ConnectionFactory or Destination object (created in WAS) into application using jndi?
How to install and run JMS web application on WAS server?
|
First you need to decide on the provider for JMS. It could be WebSphere MQ, the JMS provider that comes inbuilt with WAS or some other provider too.
Refer to the redbooks https://www.redbooks.ibm.com/Redbooks.nsf/RedbookAbstracts/sg247770.html?Open.
You can use InitialContext to lookup connection factory and Destination.
You can deploy the JMS app just like any other app. But ensure that JNDI objects are configured.
This is also a nice info-center to use for reference: http://pic.dhe.ibm.com/infocenter/prodconn/v1r0m0/topic/com.ibm.scenarios.wmqwasusing.doc/topics/scenario_overview.htm
| 0.777778 |
WebSphere MQ, the JMS provider that comes inbuilt with WAS or some other provider too
|
Asterisk for Small Business - Where to Start?
|
I have been in IT for a long time now doing software development and some system/server administration, but all mostly software-related services. I would like to help set up a small business (~50 employees) with Asterisk, but I am not very familiar with how the whole T1, data/voice channels, etc work. I have set up a personal Asterisk server (functional), but have not done so with a pipe like a T1 (which sounds more complex than residential cable/DSL).
Are there any resources out there to help me understand what may be needed of me to help set this business up with Asterisk and re-use their existing T1 pipe?
Any help would be greatly appreciated.
|
Partial answer.
First, know that Asterisk configuration is more like a programming language than, say, Apache configuration. There are numerous ways to create "nonsense" configurations. On the other hand, you can create very nifty services.
There are three aspects to setting up an Asterisk installation:
call quality
what manner of phones will you be using?
which services do the users expect?
Quality
In my experience, your company suffers in reputation from bad phone lines, so make sure you get get decent quality from your installation. Quality is among other things:
low upstream latency and high link uptime
Asterisk server uptime; use separate UPS. People tend to get cranky if they can't call the janitor and tell that there is a power failure in the house.
decent end-user equipment
Don't do a big bang implementation. Start with some users and work from there.
End user equipment
How are your users going to talk on the phone and how do you connect that equipment to Asterisk. Some users appreciate a headset connected to their PC, while others need a grey handset with analog dial pad or they will just be confused. Which will you provide and how will they connect to Asterisk?
For so called softphones (i.e. a SIP client installed on your PC) not much need to be done. You need a mechanism to handle accounts for these users (e.g. LDAP) and they need decent headsets. For connecting traditional analog phones, there are various sorts of equipment. For small installation, you may be able to get your hands on Zyxel Prestige 2002s (2 ports each), but for larger installations you need rack-mountable equipment of some sort.
Services
In my experience it is very difficult to get users to actually tell what they expect from a phone system, but once you give them something, they start having all sorts of opinions. So you need to be very clear about what services you provide and require a somewhat anal change management process (more so than is normally required in a small company).
Conclusion
This sounds dangerous and ominous, but know that the reward is equally great. The advantage of being able to create dedicated phone services, with the same sort of detailed control that you have with other IT services can be very rewarding. It will take some time for your users to get used to the thought that they can actually request fancy features from their phones, but once they get started, you can make their work a lot easier. Some features my users found very useful:
voice mail that sends mail with audio files
queues and fallback for all users
softphone and multiple phones for all users
phone conferences
redirection to mobile phones, and
routing calls through company phone system from private phones so that company picks up tab for international/expensive calls.
Also, traditionally, most phone extensions are personal, but in a modern company, most incoming calls are actually to a company function. You should probably consider not having personal extensions at all, and simply have an extension per function that rings all phones in that department/function.
| 1 |
How do you connect Asterisk to a wireless network?
|
Who counters Jayce top lane besides Yorick?
|
I'm aware that Yorick and Cho'Gath are both good counters for Jayce (in Top Lane) but who else might be a good matchup and why?
|
Jayce is an early game menace. He can be ranged which gives him sustain in his own way. Because he is able to push you away and zone you it makes it difficult to harrass him. But he can harrass you all he pleases. And gap closers at early levels tend to have highcooldowns making it so you give Jayce a window of opportunity when you initiate with it. I play Jayce almost every game and within the laning phase I usually go 4-1. When it come to champs that counter him its difficult tp find one since Jayce can keep his distance or be up close if he so chooses.
| 1 |
Jayce can harrass you all he pleases
|
Can EE handle Millions of Users?
|
I’m new to the expression engine project at our business. We are being acquired by a large company and they’re worried that expression engine cannot handle traffic for a exp_members table of 10M, and concurrent connections at about 10k.
I know that most people will naturally ask “It all depends on server resources, and how big is your database…”, and we can always have bigger boxes, I’m not really interested in theoretical limits, my question is a bit more practical than that.
Has anyone had experience with using EE for 5+ millions of users and approx 10k concurrent users, and what has been your experience been with it?
Please help me understand your experience.
It’s a classic “Executive Decision makers (and what they think they understand from a sales slick”
versus Coders and EE fans.
Thank you.
|
There's an old post (from 2012) here which might go some way to answer the question. You'll note that there are some major sites there.
Ultimately, as you've acknowledged, the matter is one of resources and network infrastructure and not one of software. No system will cope with 10K concurrent connections unless the network is built in such a way as to allow it.
| 0.777778 |
No system will cope with 10K concurrent connections unless it is built in such way that to allow it.
|
Detecting scene transitions in a video
|
How would you reliably detect scene transitions in a video? The simplest case wouldn't be too hard, but sometimes it might be a fast moving scene, or there might be an effect like lightning that would throw it off.
|
Scenes generally exhibit a fade-to-black transition. You could capture those frames with simple image processing tools, which are found in many libraries, such as OpenCV.
If you want to rely on the change of the mis-an-scene to be robust against sudden changes, then of cours algorithms for detecting temporal differences is more appropriate. For that, you might want to consider:
http://vis.uky.edu/~cheung/courses/ee639_fall04/readings/spie99.pdf
http://www.mitsubishi-electric-itce.fr/uk-rce/pubdocs/VIL07-D071.pdf
If you want a simple algorithm do as described here:
http://stackoverflow.com/questions/4801053/video-scene-detection-implementation
For harder cases, you might even try GMM-like background models to test if the transition was a temporarily quick shot or a complete change.
| 1 |
capturing a fade-to-black transition with simple image processing tools
|
Native Browser Automation using Appium 1.2.0.1 on Windows 7 Android real device: Could not find a connected Android device
|
I have looked many forums for this issue, there are quite a few answers on this topic but none of these have worked for me/match my criteria.
I recently took up Mobile Automation task and hence am completely new to Appium. I am working with Appium 1.2.0.1 on Windows 7 and trying to automate the native Android Browser(not Chrome or an App) on an Android v4.3 real device.
I have installed everything according to the instructions. I am using Selenium in Maven Build in JUnit Framework to execute the scripts through Appium. I use Appuim.exe in Admin mode and use the GUI to start the node. Then I run my scripts.
My issue is that when I try "adb devices" in cmd, I am able to see the device. Whereas, during execution, Appium is throwing an Error "Failed to start an Appium session, err was: Error: Could not find a connected Android device." I tried many troubleshooting options and verified if everything is in place. No luck. Please help.
Below is the trace of Error:
> Checking if an update is available
> Update not available
> Starting Node Server
> info: Welcome to Appium v1.2.0 (REV e53f49c706a25242e66d36685c268b599cc18da5)
> debug: Non-default server args: {"address":"127.0.0.1","fullReset":true,"logNoColors":true,"platformName":"Android","platformVersion":"18","automationName":"Appium","browserName":"Browser"}
> info: Appium REST http interface listener started on 127.0.0.1:4723
> info: LogLevel: debug
> info: --> POST /wd/hub/session {"desiredCapabilities":{"platformVersion":"4.3","browserName":"Browser","platformName":"Android","device":"Android","deviceName":"Android"}}
> debug: Appium request initiated at /wd/hub/session
> info: Retrieving device
> warn: code=ENOENT, errno=ENOENT, syscall=spawn
> debug: Request received with params: {"desiredCapabilities":{"platformVersion":"4.3","browserName":"Browser","platformName":"Android","device":"Android","deviceName":"Android"}}
> debug: The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : device
> debug: Looks like we want chrome on android
> debug: Creating new appium session fa19e382-c178-4e6b-8150-a386a51bee39
> debug: Preparing device for session
> debug: Not checking whether app is present since we are assuming it's already on the device
> debug: Checking whether adb is present
> debug: Using adb from C:\Android\android-sdk\platform-tools\adb.exe
> debug: Trying to find a connected android device
> debug: Getting connected devices...
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" devices
> debug: Could not find devices, restarting adb server...
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" kill-server
> warn: code=ENOENT, errno=ENOENT, syscall=spawn
> warn: code=ENOENT, errno=ENOENT, syscall=spawn
> debug: Getting connected devices...
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" devices
> debug: Could not find devices, restarting adb server...
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" kill-server
> error: Error killing ADB server, going to see if it's online anyway
> debug: Getting connected devices...
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" devices
> debug: Could not find devices, restarting adb server...
> warn: code=ENOENT, errno=ENOENT, syscall=spawn
> warn: code=ENOENT, errno=ENOENT, syscall=spawn
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" kill-server
> warn: code=ENOENT, errno=ENOENT, syscall=spawn
> error: Error killing ADB server, going to see if it's online anyway
> warn: code=ENOENT, errno=ENOENT, syscall=spawn
> info: <-- POST /wd/hub/session 500 20314.056 ms - 206
> debug: Getting connected devices...
> debug: executing: "C:\Android\android-sdk\platform-tools\adb.exe" devices
> debug: Cleaning up appium session
> error: Failed to start an Appium session, err was: Error: Could not find a connected Android device.
> debug: Error: Could not find a connected Android device.
> at ADB.getDevicesWithRetry (C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:600:15)
> at androidCommon.prepareActiveDevice (C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\lib\devices\android\android-common.js:349:12)
> at null.<anonymous> (C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\lib\devices\android\android-common.js:289:26)
> at C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\async\lib\async.js:610:21
> at C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\async\lib\async.js:249:17
> at iterate (C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\async\lib\async.js:149:13)
> at C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\async\lib\async.js:160:25
> at C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\async\lib\async.js:251:21
> at C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\node_modules\async\lib\async.js:615:34
> at androidCommon.prepareEmulator (C:\Selenium\AppiumForWindows-1.2.0.1\Appium\node_modules\appium\lib\devices\android\android-common.js:339:5)
> debug: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not find a connected Android device.)","origValue":"Could not find a connected Android device."},"sessionId":null}
And here is my code:
if (runEnv.equals("Android"))
{
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device","Android");
capabilities.setCapability("deviceName","Android");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("browserName", "Browser");
capabilities.setCapability("platformVersion", "4.3");
try {
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
} catch (MalformedURLException e) {
e.printStackTrace();
}
driver.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
}
Please help!
Thanks,
Arpitha
|
Please modify your code with the below one, hope so it works
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability("deviceName","sony xperia Z");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("appPackage", "com.android.calculator2");
capabilities.setCapability("appActivity", "com.android.calculator2.Calculator");
driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
| 0.888889 |
Modify code with the below one, hope so it works DesiredCapabilities capabilities = new Desiredcapabilities()
|
Force garbage collection/compaction with malloc()
|
I have a C++ program that benchmarks various algorithms on input arrays of different length. It looks more or less like this:
# (1)
for k in range(4..20):
# (2)
input = generate 2**k random points
for variant in variants:
benchmark the following call
run variant on input array
# (3)
Is it possible to reset the whole heap management at (2) to the state it had at (1)? All memory allocated on the heap that was allocated during the program is guaranteed to be freed at (3).
I am using g++ 4.3 on Linux.
Edit: I understand that there is no real garbage collection in C/C++. I want to force the memory allocation to join adjacent empty chunks of memory it has in its free list at (2).
|
There's no automatic way, you have to manually delete whatever is on the heap to get back to the state of (1).
| 1 |
Automatically delete whatever is on the heap to get back to (1)
|
Who counters Jayce top lane besides Yorick?
|
I'm aware that Yorick and Cho'Gath are both good counters for Jayce (in Top Lane) but who else might be a good matchup and why?
|
Jayce is very squishy early - pick Jax or even Lee Sin and punch him in the face as many times as possible. It is more individual play style that counters Jayce rather than the champion you're playing - one of Jayce's biggest strengths is when he gets ganks from his jungler, so ward as many times as possible.
Remember, Jayce has no sustain so if you can get a fast two Doran's or a Vamp Scepter you can punch him in the face and heal back up fast. Never let him free farm on you - keep up the pressure.
| 1 |
Jayce is very squishy early - pick Jax or even Lee Sin and punch him in the face
|
Is the Mechromancer's Little Big Trouble tree worthwhile in UVHM (72 level cap)?
|
So far, the tree seems rather underwhelming, especially the low-tier skills like Myelin, More Pep, Strength of 5 gorillas, etc.
Evil Enchantress apparently doesn't affect shock, fire and acid direct damage; it only buffs the status effects which is pretty pointless when slagging an enemy does 3X damage.
Shock storm doesn't sound useful as most enemies won't be bunched up enough.
On the other hand, the damage buffs from Wires Don't Talk and Interspersed Outburst look very useful. Make it Sparkle also apparently gives Deathtrap massive additional damage of up to 3X.
Is it worthwhile to spec into this tree just for the end-tier perks?
|
With good shock weapons and a Class Mod that boosts Shock damage you can deal insane damage. With a good Zapper class mod and 5 ranks in Wires Don't Talk you're dealing over 50% more damage with Shock, and Electrical Burn means it does a bit of extra damage to Flesh enemies.
The shock boosts also stack very well with Anarchy's effects; I survive quite well with 3 of 4 weapons being shock, due to the elemental damage boost there's rarely a reason to change weapons, especially with teammates about. And shock based badasses are pretty rare compared to fire and corrosive ones. Really the only significant limiting factor to the skill tree is you need at least decent shock weapons to make it work. Personally I use a shock Maliwan sniper rifle, a shock Dahl e-tech SMG (Dahl burst fire is immune to Anarchy's accuracy reduction by the way) and a shock Moxxie's Slow Hand.
Shock storm, One Two Boom and shock and auugh look cool but aren't as useful, and Strength of Five Gorillas isn't either as I usually don't use Death Trap that often (he gets in the way in co op). The entire tree is just there for Wires Don't Talk + Zapper class mod though. Maxing out the whole tree isn't as necessary, though Interspersed Outburst can be quite useful to slag enemies without having to use a slag weapon (no switching weapons is very nice), and Make it Sparkle also makes Deathtrap relatively useful since he can get situationally relevant elements in addition to the 3x straight-up damage boost.
| 1 |
In Wires Don't Talk you're dealing over 50% more damage with Shock .
|
Should I avoid credit card use to improve our debt-to-income ratio?
|
We put all our expenses on a credit card and pay it off every month in order to get maximize our cash back. We never charge more than we have in the checking account, so we always pay it off. Should we reconsider doing this in order to improve our debt-to-income ratio?
Our goal is to be in the best position possible to get a mortgage in the next 3-12 months.
|
If you pay it off before the cycle closes it will look like you have 100% available credit.
So if you credit card statement closes on the 7th pay it off on the 6th in full don't pay it when its due 2/3 weeks later.
Then after three months of doing that your credit score will go up based on the fact that your debt ratio is so low. That ratio is 30% of your credit score. It will help quite alot.
| 1 |
If you pay it off before the cycle closes it will look like you have 100% available credit
|
What are the rules of thumb for margins in web design?
|
My web designer tells me that in a web page, the empty margins or padding should always be multiples of a standard. For example 6 px, 12px, 18px. This should produce nicely balanced lay-outs. I would like to learn a little bit more about it:
Should one really not violate this at all?
Should the standard be the same horizontally and vertically?
|
The best learning resource for this would be a good introduction on typography – probably the seminal classic by Bringhurst (see http://webtypography.net for a good roundup applied to the web), though e. g. Spiekermann's ‘Stop Stealing Sheep…’ is not bad for starters, either – and on design grids (see my answer here on UXexchange).
When designing grids you are mostly using a basic module (proportions ideally defined by working from the content outwards) that all content is fitted to (i.e. multiples of it).
Vertical and horizontal margins between blocks are in most cases different. Vertical whitespace is often oriented on the baseline grid (see e.g. Bringhurst, again). Using one is highly recommended to achieve at a unifying vertical rhythm.
The minimum amount of horizontal whitespace, i. e. primarily the separation between columns of body text (gutter), is governed by Gestalt psychology with font size, line spacing, and line width as main influencing factors. You should place text blocks far enough from another such that your recipients will be able to see them as distinct units of their own. A traditional rule of thumb would make the gutter at least 1.5 ems wide in order to appear significantly wider than any possible whitespace within a line of text. On the screen, good line spacing tends to be a little bit wider than in traditional print, though. Hence you will probably need a little bit more than that. Using the same value as your baseline grid is a good guess to start with in most cases.
BTW: design standards – unless significantly backed up by ergonomics or cognitive psychology – are never standards in the more rigid sense of the word. You may violate any ‘standard’ as long as you know why you are doing it.
| 0.833333 |
Design grids – unless significantly backed up by cognitive psychology – are never standards in the more rigid sense of the word
|
Offline WordPress post editor/creator
|
I have a WordPress site hosted on my personal server. I will be unavailable by Internet for a little while, and I'd like to write up some posts for my blog.
Normally, you need to be connected to WordPress to start writing the blog, and it will do offline-saving automatically. But this is limited to one entry, per tab. I could use Notepad, but it doesn't have spell check built in. I could use Microsoft Word, but the "Paste from Word" leaves a lot to be desired.
What I'm looking for is a program that does the following:
Start a new post while offline
Lets me edit posts I created already with the program
Spell check
Uploads new posts when I reconnect
Has the same features as the online editor (i.e. toolbars, WYSIWYG and code editor)
Free (as in beer)
Works on either Windows or Mac OSX
Bonus features:
Edit posts currently on the website (with an offline copy)
|
StackEdit is a very nice Markdown web app editor that works off-line. I can publish as HTML, but adding a WordPress plugin to work with Markdown is an option.
Start a new post while offline
As it works offline, you can create any number of documents and update/upload when online
Lets me edit posts I created already with the program
You'll copy the post content in a new SE document and publish it against the same post ID
Spell check
IMHO, that's browser territory
Uploads new posts when I reconnect
After reconnecting, just hit the publish button and it goes live
Has the same features as the online editor (i.e. toolbars, WYSIWYG and code editor)
Just basic features for the editor
Free (as in beer)
Yes.
Works on either Windows or Mac OSX
Yes.
Edit posts currently on the website (with an offline copy)
See Upload when reconnected
StackEdit.io
StackEdit is a full-featured, open-source Markdown editor based on PageDown, the Markdown library used by Stack Overflow and the other Stack Exchange sites.
https://github.com/benweet/stackedit/
Features:
Real-time HTML preview with Scroll Link feature to bind editor and preview scrollbars
Markdown Extra/GitHub Flavored Markdown support and Prettify/Highlight.js syntax highlighting
LaTeX mathematical expressions using MathJax
WYSIWYG control buttons
Online synchronization using Google Drive (multi-accounts) and Dropbox
One click publish on Blogger, Dropbox, Gist, GitHub, Google Drive, SSH server, Tumblr, WordPress
| 0.888889 |
StackEdit is a Markdown web app editor that works offline
|
PySpark reduceByKey? to add Key/Tuple
|
I have the following data and what I want to do is
[(13, 'D'), (14, 'T'), (32, '6'), (45, 'T'), (47, '2'), (48, '0'), (49, '2'), (50, '0'), (51, 'T'), (53, '2'), (54, '0'), (13, 'A'), (14, 'T'), (32, '6'), (45, 'A'), (47, '2'), (48, '0'), (49, '2'), (50, '0'), (51, 'X')]
Is for each key count the instances of the value (a 1 string character). So I first did a map:
.map(lambda x: (x[0], [x[1], 1]))
Making it now a key/tuple of:
[(13, ['D', 1]), (14, ['T', 1]), (32, ['6', 1]), (45, ['T', 1]), (47, ['2', 1]), (48, ['0', 1]), (49, ['2', 1]), (50, ['0', 1]), (51, ['T', 1]), (53, ['2', 1]), (54, ['0', 1]), (13, ['A', 1]), (14, ['T', 1]), (32, ['6', 1]), (45, ['A', 1]), (47, ['2', 1]), (48, ['0', 1]), (49, ['2', 1]), (50, ['0', 1]), (51, ['X', 1])]
I just cant for the last part figure out how to for each key count the instances of that letter. For instance Key 13 will have 1 D and 1 A. While 14 will have 2 T's, etc.
|
I'm much more familiar with Spark in Scala, so there may be better ways than Counter to count the characters in the iterable produced by groupByKey, but here's an option:
from collections import Counter
rdd = sc.parallelize([(13, 'D'), (14, 'T'), (32, '6'), (45, 'T'), (47, '2'), (48, '0'), (49, '2'), (50, '0'), (51, 'T'), (53, '2'), (54, '0'), (13, 'A'), (14, 'T'), (32, '6'), (45, 'A'), (47, '2'), (48, '0'), (49, '2'), (50, '0'), (51, 'X')])
rdd.groupByKey().mapValues(lambda x: Counter(x)).collect()
[(48, Counter({'0': 2})),
(32, Counter({'6': 2})),
(49, Counter({'2': 2})),
(50, Counter({'0': 2})),
(51, Counter({'X': 1, 'T': 1})),
(53, Counter({'2': 1})),
(13, Counter({'A': 1, 'D': 1})),
(45, Counter({'A': 1, 'T': 1})),
(14, Counter({'T': 2})),
(54, Counter({'0': 1})),
(47, Counter({'2': 2}))]
| 0.777778 |
Counter to count the characters in the iterable produced by groupByKey
|
How to solve this stochastic integrals?
|
how can I solve these two stochastic integrals?
$$\int_0^T B_t\,dB_t$$
$$\int_0^T f(B_t)\,dB_t$$
where B_t is the BM.
Thank you very very much!
|
Besides applying the Itô formula, there is also the possibility to calculate a stochastic integral using approximation by step functions. It works fine for the integral $\int_0^T B_t \, dB_t$:
Let
$$f_n(t,\omega) := \sum_{j=1}^n 1_{[t_{j-1},t_{j})}(t) \cdot B_{t_{j-1}}(\omega)$$
where $\Pi_n$ is a partition of $[0,T]$ such that $$\max_{t_j \in \Pi_n} |t_j-t_{j+1}| \to 0 \qquad (n \to \infty)$$
Since the Brownian motion has continuous paths, it's not difficult to show that $(f_n)_{n \in \mathbb{N}}$ is an approximating sequence as required in the definition of the stochastic integral, therefore
$$\int_0^T f_n(t) \, dB_t \stackrel{L^2}{\to} \int_0^T B_t \, dB_t \qquad (n \to \infty)$$
By definition, it's easy to calculate the stochastic integral of step functions:
$$\int_0^T f_n(t) \, dB_t = \sum_{j=1}^n B_{t_{j-1}} \cdot (B_{t_{j}}-B_{t_{j-1}}) \tag{1} $$
On the other hand, we have
$$\begin{align} B_T^2 &= \left( \sum_{j=1}^n B_{t_j}-B_{t_{j-1}} \right) \cdot \left( \sum_{k=1}^n B_{t_k}-B_{t_{k-1}} \right) =\underbrace{\sum_{j=1}^n (B_{t_j}-B_{t_{j-1}})^2}_{\stackrel{L^2}{\to} T} + 2 \underbrace{\sum_{j=1}^n B_{t_{j-1}} \cdot (B_{t_j}-B_{t_{j-1}})}_{\stackrel{(1)}{\to} \int_0^T B_t \, dB_t}. \end{align}$$
Thus, $$B_T^2 = T + 2 \int_0^T B_t \, dB_t.$$
| 1 |
Calculation of stochastic integral by step functions
|
Electric current of inductor
|
I have a homework problem that was solved by our instructor:
"Calculate the electric current of the inductor at \$t=0^+\$."
He calculated \$1/30\$ but the answer sheet was says \$-1/30\$.
Which of them is correct?
Our instructor's work:
|
I would say that both answers are wrong. Imagine if the inductor were omitted from the circuit and any source of voltage or current were applied (via the 3 ohm series resistor) to what is basically a balanced bridge.
What would be the voltage at the junction of the two 1 ohm resistors - it would be the same voltage as at the junction of the two 3 ohm resistors - net voltage across the two points (where the inductor was connected) is always zero.
So, now replace the inductor and ask yourself what the net voltage across the inductor will be - it'll still be zero and never, ever will any current flow thru it.
| 0.666667 |
What would be the voltage at the junction of the two 1 ohm resistors?
|
Sharepoint 2010 list schema deployment
|
I have create a list schema definition and list instance in VS2010. I have a feature that deploys both list definition and instance, plus a feature stappler which actives the new feature for each new sub site.
My list definition schema.xml is:
<Fields>
<Field Name="StartDate" Type="DateTime" Required="FALSE" DisplayName="Start Date" StaticName="StartDate" ID="9ea1256f-6b67-43b0-8ab7-1d643bf8a834" SourceID="http://schemas.microsoft.com/sharepoint/v3" ColName="datetime1" RowOrdinal="0" />
<Field Name="EndDate" Type="DateTime" Required="FALSE" DisplayName="End Date" StaticName="EndDate" ID="900503fa-4ab1-4938-be75-b40694ab97b6" SourceID="http://schemas.microsoft.com/sharepoint/v3" ColName="datetime2" RowOrdinal="0" />
I deploy successfully and create a new site using my site definitions, list gets created successfully all things work.
Now i want to add another field to my list, i go back to visual studio 2010 edit list definition schema.xml and add another field in Metadata fields section.
The schema.xml is now:
<Fields>
<Field Name="StartDate" Type="DateTime" Required="FALSE" DisplayName="Start Date" StaticName="StartDate" ID="9ea1256f-6b67-43b0-8ab7-1d643bf8a834" SourceID="http://schemas.microsoft.com/sharepoint/v3" ColName="datetime1" RowOrdinal="0" />
<Field Name="EndDate" Type="DateTime" Required="FALSE" DisplayName="End Date" StaticName="EndDate" ID="900503fa-4ab1-4938-be75-b40694ab97b6" SourceID="http://schemas.microsoft.com/sharepoint/v3" ColName="datetime2" RowOrdinal="0" />
<!-- New Field -->
<Field Name="TestRedeploy" Type="Text" Required="FALSE" DisplayName="TestRedeploy" StaticName="TestRedeploy" RichText="True" Sortable="FALSE" ID="A5656659-CD3E-4C84-AEAC-554DCE25434B" SourceID="http://schemas.microsoft.com/sharepoint/v3" ColName="ntext3" RowOrdinal="0" />
</Fields>
I build and deploy successfully, but when i go in list settings to check if new column was added i find that all columns have been deleted. Can you help me figure out how to deploy new columns with schema.xml ?
|
You should try to reinstall the feature that deploys your list
Go to sharepoint 2010 management console and write
install-spfeature -path "feature folder name in 14'hive" -force
after this make an IISRESET and reload the page. This should be enough for the field to be visible.
By the way you should never include colname and rowordinal values in your xml. These will be provided automatically by sharepoint when field is deployed. One problem that you might face with current deployment is that there is already a list field mapped to colname="ntext3".
| 1 |
reinstall the feature that deploys your list
|
Do I need to pay income taxes for the money I earn online from a foreign website?
|
I work for a website based in Europe and they pay me every month to my bank account (salary account). Every time I receive funds, I will get a call from the bank for confirmation and they ask for the source and reason. I will tell them the website name and software consultancy. They deduct some amount as charges, and credit the remaining to my account.
The question is: do I need to pay income taxes for this money I earned online?
|
Yes, you do.
Depending on your country's laws and regulations, since you're not an employee but a self employed, you're likely to be required to file some kind of a tax return with your country's tax authority, and pay the income taxes on the money you earn.
You'll have to tell us more about the situation, at least let us know what country you're in, for more information.
| 1 |
Depending on your country's laws and regulations, you're likely to be required to file a tax return with the tax authority
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.