What materials would I use to build an underwater city?

Question: I'm currently trying to set up an underwater race in my world—merpeople if you will—and I'm trying to figure out how their city would look. I'm basing their religion and lifestyle on native civilizations such as Inuits, or some Native American tribes, but I also want them to be sedentary. What materials available in the deep waters could be used to make houses?
Comment: What do you want the houses to be like, and what are they to be used for? Do they use them only to hide their young from predators, or do they watch Sea-TV on their kelp sofas, grabbing fizzy drinks from a fridge?
Comment: Welcome to Worldbuilding.SE!  We're glad you could join us!  When you have a moment, please [click here](https://worldbuilding.meta.stackexchange.com/questions/6388) to learn more about our culture and take our [tour].  Thanks!
Answer: Cegfault took the most obvious material: stone.  Let me offer a couple more.
Coral
Houses could be grown through coral polyp husbandry.  Officially, the material is calcium carbonate.  Houses of nearly any size could be made through this method, though is would be slow.  However, with a bit of engineering, walls, floors, and roofs can be built this way.  Thick coral would be a reasonable protection from break-in.
Kelp and sea grass
Agriculture isn't just for food!  Cultivated sea grasses could be planted, and woven as they grow to create sturdy walls.  This solution would be excellent for tipi style domiciles.  Or, if weaving walls isn't your cup of tea, you could cultivate personal groves of sea grass, then trim a path into the grove and rooms within the grove (think "corn maze").
Caves in ocean trenches
There are oceanic trenches all over the planet.  The wonderful thing about trenches, is that they provides sides.  Especially the deep ones.  Caves can be hewn out of the sides.  Hole households could be inside, so long as the local current isn't so strong that it can erode the cave mouth.  This solution would work anywhere there was a reasonably steep, somewhat verticalish surface (the sides of volcanic mountains are especially prized for their central heating).
Comment: Coral polyp husbandry is suck an original idea, I really like it, but I wonder if it would fit, as I've designed my merpeople to be quite tall (think 2-3 meters long)
Comment: @ChloéB due to human agricultural husbandry we have tall trees and short trees, fruit and vegetable varieties of all kinds, bushy and sparse leaves, etc.  That's the cool thing about cultivating: it's both plausible and possible to achieve your needs.  Natural coral is subject to the whim of nature.  Cultivated coral can be anything you, the author, want or need.
Answer: Whalebone.
Those bones are big.  They can be found on the ocean floor.

https://en.wikipedia.org/wiki/Whale_fall
Ancient Siberians made huts out of mammoth bones.
source

And people do make huts out of whalebone found on the beach.
https://www.pinterest.com/pin/223280094000002936

Probably there would be a lot more whale bones available to your merpeople than can be found on land.  Plus bone huts offer fun writing possibilities.  Besides whalebones, there can be other comparably large or larger bones used to make the buildings...
Answer: I like the Coral husbandry of JBH and carving out of cave/cliff walls. But I can add one more option.
A civilization may advance to a point where they need to use energy sources. Best energy source maybe geothermal vents and underwater volcanoes. this could provide energy for future technological development.
Now if your "merfolk" could harness this, they would build structures around these energy sources, maybe control the spewing lava to form the structure around it. So, you could create an igneous rock/obsidian structure.
You could augment these structures with other building materials. Unfortunately, where you would find these energy source may not be where you would also find coral or sea grasses. Sedimentary rock, such as sandstone would be readily available, or any other strong and tough rock that would hold up to currents, external forces and quakes that would most definitely accompany a volcano.
Maybe you can control the water chemistry enough to grow massive salt crystals to incorporate into your structures. This would be decorative in nature only and would be fairly difficult to do in this environment, but would make a great "temple" of some kind if your civilization advanced to a Aztec level society.
Comment: Fused ceramics, excellent answer +1
Comment: Great answer, thank you, volcanoes had escaped my mind!
Answer: Assuming the mer-people can breathe through water, and mirroring Native American style homes, then it would be practical to form homes out of sedimentary rocks at the bottom of the sea.  These would likely resemble the homes of cliff dwellers or adobe-style homes.
Most rock at the bottom of the sea is sedimentary; this makes it dense and hard.  A creature advanced enough, with the intelligence of human civilization, could go through the stone age with tools available in the ocean, and using such tools chisel out homes out of the rock formations at the bottom of the sea.  It would not be too far off from Native American style homes.
As far as the Inuits that you mention, the Igloo Construction would be a better shape for the water pressure of the ocean, but would probably be easier made as being chiselled-out into the stone (like the cliff dwellers), as mining rock only to re-form it would be difficult, especially because any type of mortar would be difficult (but not impossible) to make inside water.
Comment: Actually most of the bottom of the sea is mud. Sedimentary rocks form when pressure is high enough to consolidate the loose grains.
Comment: That's kinda what I was thinking as well, but wouldn't that stone made by high-pressure require extreme strenght to use? I really like the idea of a city carved in, Arizona cliff-dweller style, but I wonder if it would be possible on the stone found in deep waters? Most cliff-dweller cities are carved in soft stone, if I'm not mistaken.
Comment: @ChloéB difficult, but possible
Answer: So bit of an unusual suggestion but if they're an Arctic species ice! Ice floats are always bigger below the surface and carving ice is definitely possible plus you can make some truly beautiful things, personally I think an upside-down igloo would be really cool and added bonus if they're whale based and need air you can carve air pockets. Plus imagine waking up in a beautiful shining house, never get up past noon again!


arcpy selectByLocation

Question: When I start my mxd and run this code it selects a polygon. However, if I then pan to a new location - still within the bounds of the target FC - it doesn't work.
Is there some update command I need to run after panning?
It's as though the dataframe extent is lost after panning.
====
I'm trying to selectByLocation using a pointGeometry. The code below creates a pointGeometry from the center of the current dataframe extent. It works if the dataframe and the target feature class (polygon features) are in the same coordinate system but not when they're in different systems.
My usage model is that the target will usually be in a continental projected system or geographic coordinates while the dataframe will be in NAD 1983 UTM 10N to 20N.
<code>import arcpy

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]

arcpy.env.outputCoordinateSystem = df.spatialReference
**sr = arcpy.Describe('targetFC').spatialReference**

myPt = arcpy.Point((df.extent.XMax + df.extent.XMin)/2.0, (df.extent.YMax + df.extent.YMin)/2.0)
myPtGeometry = arcpy.PointGeometry(myPt, df.spatialReference)
**myPtGeometry.projectAs(sr)**
arcpy.SelectLayerByLocation_management('targetFC', 'INTERSECT', myPtGeometry)

del df, mxd
</code>
Answer: The PointGeometry object supports a method projectAs, so reproject your point into the coordinate system of your dataset before you use it.

arcpy selectByLocation


How to synchronize folders between two Windows Server 2012

Question: Is there any best practice of how to synchronize folders between two Windows Server 2012 server installed?
Answer: Windows Server has a distributed and replicated file system called DFSR. This is not a new technology to Windows Server, but the Server 2008 and later versions are substantially improved over the Server 2003 version.
There are two parts to this:

Distribution
Replication

Distribution
With DFS, you create a namespace. That namespace is generally \\domain.tld\namespace. For example, \\example.local\files. This namespace then has member servers. If your Active Directory Sites and Services is set up appropriately with the corret subnets applied to the correct sites, then each site will connect to its closest server.
This in its own isn't particularly useful though. Yes, it means that every computer on the network can use the same network path and expect a fast speed, but just connecting the namespace to different servers isn't particularly useful for your situation, as you also need the same data on each server.
Replication
DFSR replicates data between shares on multiple servers. There are a variety of different topologies you can choose from, but "Full Mesh" is a popular one. This means that every DFS node can "see" every other DFS node, and replicates all the changes from each individual DFS store. This means that a file written to one server will appear on all the other DFS members within a fairly short period of time.
With a Hub and Spoke topology, where not all the DFS members can see eachother, but they can all see one central server, then all changes are replicated to/from the central server. This effectively means that all replications take 2 steps to get to all the other nodes (Original > Central, then Central > Other Nodes).
With 2 servers, "Full Mesh" is the only viable replication option.
Using them together
Now, you actually don't need to use DFS and R together. You can replicate two folders without presenting them in a namespace, and as previously mentioned, you can present a non-replicated namespace. Generally though you would use both together.
Another thing to note is that even though it's called "Distributed File System" it's not a block-level file system like you might associate with say, GlusterFS. All changes are made at file-system level and then the deltas are replicated. This can lead to multiple changes made on different servers conflicting with eachother, as there's no locking mechanism between DFS nodes, or if there is application-level locking, the locks may take time to replicate between all the nodes to indicate that the file is locked.
Comment: Yes, it's the same.
Comment: Link points to Windows Server 2008R2 resources. Do you know if it is the same on Windows Server 2012?


On holomorphic vector bundles over compact Kahler surfaces

Question: Let $E\to X$ be a complex vector bundle over a compact Kahler surface $X$. Assume $c_{i}(E)\in H^{i,i}(X)$ for all i. Does the bundle $E$ admit a holomorphic structure?
Comment: @XinNie: unfortunately, there are situations where there is a big gap between moduli spaces and the classification of vector bundles. For instance, if $X=\mathbb{P}^2$, semistable holomorphic rank 2 bundles on $X$ satisfy $c_1^2-4c_2\leq 0$. However, every complex vector bundle has a holomorphic structure, independent of what the Chern classes are. In this case, I would say that the moduli space is empty although there is an enormous amount of holomorphic structures...
Comment: The moduli space $\mathcal{M}(E)$ of holomorphic structures on $E$ is a classic subject in gauge theory and algebraic geometry (and involves some stability issue). $\mathcal{M}(E)$ can be interpreted by differential-geometric means as the space of all integrable "partial connections" (a.k.a. pseudo connections, Dolbeault operators...) modulo gauge equivalence, see the book of Donaldson and Kronheimer Section 2.1.5. However, I can only ensure that $\mathcal{M}(E)$ is non-empty when $X$ is a curve. Higher dimensional cases should also be well known, I guess.
Answer: For line bundles, this is the Lefschetz (1,1)-theorem which says that the map $H^1(X,\mathcal{O}^\times)\to H^2(X,\mathbb{Z})$ from the exponential sequence surjects onto the $H^{1,1}(X)$-part.
For higher rank bundles, the answer is positive whenever $X$ is additionally assumed to be projective. In this case, a theorem of Schwarzenberger states that a complex vector bundle is algebraizable if and only if its determinant is algebraizable, see Theorem 9 in (R.L.E. Schwarzenberger: Vector bundles on algebraic surfaces. Proc. London Math. Soc. (3) 11 (1961), 601--622).
Comment: Thank you for your answer. By the way, I think I should modify the condition in the question to just $c_{1}(E)\in H^{1,1}(X)$ as it is alway true for compact complex surface that $H^{4}(X,\mathbb{C})=H^{2,2}(X)$.


Digital Multimeter "Continuity test" only one single beep

Question: Well I have two electronic circuit, one is broken and the other is solid and working. While I am making Continuity test with Fluke Multimeter on working electronic circuit, the bip voice heared only once time. but broken part is giving continutiy bip voice. How can a digital multimeter give only once bip voice. what does it mean.
Comment: You did remember to disconnect the system being tested from all power sources, right?
Answer: A short burst of beeping from a continuity tester generally means that there is momentary current flow in the circuit from the tester until some capacitance gets charged up and the current flow stops.
On the other hand the continuous tone indicates an actual short and the current from the tester flows as long as the probes are attached to the circuit under test.
So if you are seeing your "bad unit" show the continuous beeping it probably means that there is a short circuit.
Comment: well there are lots of smd capacitance on circuit. how can I find easly the short circuit capacitance? do you have any tips?
Comment: Easiest Way: Use a capacitance measurement meter.
Answer: A charging capacitance appears as a short and then an open when fully charged.


Different fill-column for comments than code in programming modes

Question: I don't mind if the occasional code line runs long.  For example, the Shopify ruby standard allows lines of 120.  But I want comments to be restricted to the first 78 lines or so.  Is there any way in a programming major mode to have a different fill column for comment lines than for code line?
Comment: Not that I know of. But it's easy to just `C-x f` to change the fill-column here or there. Then `M-q` to re-fill.
Comment: What are `fill-paragraph-function` and `fill-forward-paragraph-function` set to? Emacs actually has some logic for filling comments differently than the code, but it may not be relevant in your case, if `ruby-mode` overrides the default behavior (which it probably does). Anyways, my approach would be to look for `ruby-mode`'s function to fill paragraph, and see if it is possible to extend / replace it with something of your own design that deals with comments the way you want.
Answer: OK.  With some prodding from @wvxvw, I looked at some source code, though the code for fill-paragraph rather than ruby-mode.  There is a function for filling comments, but it does not take a fill-column parameter.  So, I tried the following advice, which appears to do the trick:
  (defvar ded:fill-column-for-progs 78)

  (defun ded:prog-fill-paragraph (orig-fun &rest args)
    (let ((fill-column ded:fill-column-for-progs))
      (apply orig-fun args)))

  (advice-add 'fill-comment-paragraph :around #'ded:prog-fill-paragraph)

The ded: is just my personal prefix.  So far, so good.  It even uses justification when used with the universal argument.


Does ulimit change resource limits at runtime?

Question: Does ulimit change the limits of running programs? Are their specific resources which can not be changed at run time? If ulimit doesn't change limits at run time, does this mean that you have to restart all daemons to work with the new specified limits?
Answer: Correct, the ulimit command doesn't change the limits of running programs as far as I know. You can however call set_rlimit and friends from a running program. You may also want to look at resource control stuff, man rctl, but it requires rebuilding your kernel.
Answer: You can limit the resources for a daemon by using ulimit (or limit, depending on the shell), or you can set them using /etc/login.conf (hence the user account per daemon type).
After updating /etc/login.conf make sure you follow the steps at the top of the file to regenerate the db version of the file. Then restart the daemon, assuming that the daemon changes user account.


Add quicktag buttons to the HTML editor

Question: I am trying to figure out how to modify the HTML editor in wordpress; on the image below you can see a screenshot of the editor and the buttons on the top. Is it possible to add new buttons? I would like to add a button that will insert "" tags and some custom short-code tags as well.  I know it's not impossible, but does anyone know how to do it?
Answer: If it's getting too hard and complicated, you can simply add new buttons by using jQuery. Simply clone an existing or create a new button, and append it to the editor's toolbar. You can wrap the javascript with a php function, and run it in the admin footer or something.
Or you can use the edButton function. Here is a dirty and fast written example for adding p and pre buttons.
// Add buttons to html editor
add_action('admin_print_footer_scripts','eg_quicktags');
function eg_quicktags() {
?>

<?php
}

EDIT: In Wordpress 3.3 (and above), the quicktag addition is changed. However, the edButton lazy solution is somehow working, some plugins might cancel it out.
The new and the right way of adding new buttons to html editor is like this :
// Add buttons to html editor
add_action('admin_print_footer_scripts','eg_quicktags');
function eg_quicktags() {
?>

<?php
}

I don't know if the QTags is added to the Wordpress Codex yet, so I added the required parameters in the comment section of the code.
Comment: I fell in love with the plugin mentioned above for adding these custom buttons, after viewing source, I just realized the plugin works the same way as your code here, I love it even more now, thank you very much, a MUST HAVE for any wordpress function file!
Comment: The new Wordpress 3.3 has broke this along with all the plugins that do this, if you happened to find another way would really appreciate an update if you get a chance
Comment: The old edbutton solution works in 3.4-alpha. Just to let you know that the code is still in there. But possible is depreciated, so it would be better to use the QTags solution.
Comment: Could not find the documention in codex, possibly not added yet. But found the QTags js file in wp-includes/js/quicktags.dev.js. edButton function is simply calling the QTags.addButton, so that is why it still works for me. The JS file has some good documentation in it.
Answer: See the following in wp-includes/js/quicktags.dev.js
/**
     * Main API function for adding a button to Quicktags
     *
     * Adds qt.Button or qt.TagButton depending on the args. The first three args are always required.
     * To be able to add button(s) to Quicktags, your script should be enqueued as dependent
     * on "quicktags" and outputted in the footer. If you are echoing JS directly from PHP,
     * use add_action( 'admin_print_footer_scripts', 'output_my_js', 100 ) or add_action( 'wp_footer', 'output_my_js', 100 )
     *
     * Minimum required to add a button that calls an external function:
     *     QTags.addButton( 'my_id', 'my button', my_callback );
     *     function my_callback() { alert('yeah!'); }
     *
     * Minimum required to add a button that inserts a tag:
     *     QTags.addButton( 'my_id', 'my button', '', '' );
     *     QTags.addButton( 'my_id2', 'my button', '
' );
     *
     * @param id string required Button HTML ID
     * @param display string required Button's value="..."
     * @param arg1 string || function required Either a starting tag to be inserted like "" or a callback that is executed when the button is clicked.
     * @param arg2 string optional Ending tag like ""
     * @param access_key string optional Access key for the button.
     * @param title string optional Button's title="..."
     * @param priority int optional Number representing the desired position of the button in the toolbar. 1 - 9 = first, 11 - 19 = second, 21 - 29 = third, etc.
     * @param instance string optional Limit the button to a specifric instance of Quicktags, add to all instances if not present.
     * @return mixed null or the button object that is needed for back-compat.
     */
    qt.addButton = function( id, display, arg1, arg2, access_key, title, priority, instance ) {

Answer: This might be helpful to some one as well...
http://scribu.net/wordpress/right-way-to-add-custom-quicktags.html
Answer: Download and install HTML Editor Reloaded Plugin and go to setting pages and you can add your own new buttons.
http://wordpress.org/extend/plugins/html-editor-reloaded/
Comment: This is amazing, I have been searching for this thank you
Comment: The plugin is broken now. So I googled a bit, and found this: [http://wordpress.org/extend/plugins/post-editor-buttons-fork/](http://wordpress.org/extend/plugins/post-editor-buttons-fork/). Hope that helps.
Comment: @its_me α I just realized all the plugins similar to this are broke with the new WP, even the Fork one does not work for me
Comment: @jasondavis but the fork plugin worked flawlessly for me. Aren't you looking for the button in the HTML editor tab? (The button won't show in the visual editor tab!)
Comment: I only use HTML tab, I found a better solution though, I am going to add to my new question here http://wordpress.stackexchange.com/questions/37849/add-custom-shortcode-button-to-editor
Comment: You can also use the plugin http://wordpress.org/extend/plugins/addquicktag/, it works also with custom post type and different views for visual, html-mode and post type.
Answer: Here is my example of how to add buttons  &  &  to editor text wp
add this code to functions.php and save file after check your editor text
i hope help u ^^
/*-----------------------------------------------*/
/* Add Text Editor Buttons
/*-----------------------------------------------*/
function urban_add_quicktags() {
//check to see if the 'quicktags' script is in use to avoid errors
 if (wp_script_is('quicktags')){
?>

<?php
 }
}
//Print to admin footer
add_action( 'admin_print_footer_scripts', 'urban_add_quicktags' );

Answer: You need to use the tinymce api to add buttons on the editor
http://codex.wordpress.org/TinyMCE_Custom_Buttons
Answer: EDIT
Oh, wait: you're using the HTML editor. The below filter is for adding buttons to the Visual editor.
Almost every reference I can find instructs to edit quicktags.js (and is in fact what I used to do), but I do not recommend editing core files. I did find this (completely untested) Plugin that purports to allow for modification/addition of HTML editor quicktag buttons.
ORIGINAL ANSWER
You can add buttons to Row 1, Row 2, or Row 3.
Here is an example of how to add buttons to Row 3:
function mytheme_mce_buttons_row_3( $buttons ) {

    $buttons[] = 'fontselect';
    $buttons[] = 'fontsizeselect';
    $buttons[] = 'code';
    $buttons[] = 'sup';
    $buttons[] = 'sub';
    $buttons[] = 'backcolor';
    $buttons[] = 'separator';
    $buttons[] = 'hr';
    $buttons[] = 'wp_page';

    return $buttons;

}
add_filter( 'mce_buttons_3', 'mytheme_mce_buttons_row_3' );

Obviously, you would use 'mce_buttons_1' to add buttons to Row 1, and 'mce_buttons_2' to add buttons to Row 2.
If you want to add your own, arbitrary button, you need to pass the button markup to the array, rather than just the HTML tag name.

Add quicktag buttons to the HTML editor


How to get an old answered question updated

Question: I have found a question about technology choice with regards to web developent, which is two and a half years old. I have tried to give it a bump, but since it has already been answered, I guess nobody will think about adding a new updated answer. I am relatively new here so I might not be in the possition to come with drastical suggestions, but could it be a good idea to turn all questions and answers that are more than two years old into community wikis? Maybe also that the answers need to be reconfirmed? I know this is really drastical, but the reason for this is that technology advances fast, which means that we will get a lot of correct, but obsolete answeres around.
Comment: I do agree we need tools to bring attention to old questions. I don't agree with your suggestions, but the problem exists. We need to incentive people to answer again by means of the rep (the main tool). Bounty is not a good approach here: costs too much, has time limit problems, and you need to keep attention to the deadline. (Ok, this comment should be an answer now). The site has intrinsic problem with inflation. It is just the way it is designed. Don't think bounty would save the problem. We need tools to give rep, and inflation control. One suggestion: privileges should also increase.
Answer: I would tend to create a new question. In that new question mention the old one (link to it) stating that it is outdated.
If in doubt you should just ask here on meta how to proceed with that specific question like you already did.
Comment: +1 good point, and just as you suggest this should be decided on a case-to-case basis
Comment: Today I asked my 1st question. It's harder every day to ask something "new enough", to begin with. I read the FAQ, did my Google homework, researched old questions, linked some in the new one, even added a relevant new aspect not discussed before. I also remembered a hint (somewhere on SO) how important Google is for driving traffic to the questions here. I also told my reasons for the new Q. Well, soon I got comments that I should not ask new, but improve "the" old one. Noone said which "the" old (I did ask), and it got downvoted & closed before I could blink. Not very enouraging, I'd say.
Answer: NEW ANSWER -
I think instead of flagging as pointed out in below comments, you should leave a comment on such old obsolete answers/questions, so that other people can notice and act accordingly.
OLD ANSWER -
We do have flagging system in place to flag for moderator's attention if you see some answer or question is obsolete and not valid anymore.
Comment: flagging should be used for troublesome posts, but not as a "is this answer still valid?" mechanism. For that you should use comments or bounties
Comment: @Tobias - I guess you are right. Afterall why overburden mods with such stuff. Edited my answer to put comments instead of flagging.
Answer: Since you have enough rep, you can leave a comment at the answer mentioning your doubts. Or add a bounty (50 rep should be bearable if the answer is important for you) and leave a comment at the question stating you'd like to know if the accepted answer is still valid or a new one should be there.
Comment: Let's say that I put my hard earned reputation into a bounty and got a better answer. It would maybe be way down the list and the obsolete answer would most likely stay as the accepted answer for another two years. I think that we some kind of mechanism to facilitate this sooner or later.
Comment: @David: the answer would get your personal accepted check in the form of "+50", and if others agree the answer will follow directly behind the accepted answer due to upvotes. You could still leave a comment to the OP asking him to re-check the accepted answer. I think other meta questions were clear on that only the OP may influence which answer is accepted, though. If the accepted answer is really obsolete or even wrong, downvote and/or leave a comment there asking the user to revise their answer
Comment: if you think about Stackoverflow in three years time, do you really think that what you describe would be sustainable? Given that people would need to loose 50 rep each time they discover an obsolete answer and want to help.  I think that unless a mechanism is in place for this then Stackoverflow will become a nice place to read about historical technologies (I love to put some drama into the discussion ;) ).
Comment: @David: yeah, you're right there, maybe votes should decay in time or something. Feel free to post your solution as [feature-request] ;-)


Check if apps have been transferred in iPad backup to iTunes

Question: I just backed up my iPad 1st Gen into iTunes on my MacBook Pro, but I need to make sure all my apps have been transferred. How can I check this?
Answer: You could use an app such as iPhone / iPod Touch Backup Extractor (for Mac) and iPhone Backup Extractor (for Windows) to check the backup to make sure that the files that you require have been successfully backed up.
If necessary, you could attempt to restore the files to be certain that you have access to them.


Mainstage external send effect with RME TotalMix

Question: How do I set up an FX unit, (G Major) to be used as an external send effect? I have selected "Add Aux Channel Strip" by the "Send" area on my guitar track in Mainstage. What should the setting in the RME TotalMix be? I'm not having any luck sending audio via SPDIF to G Major using the IO plugin on the aux track. The only way I can get sound to the G-Major is by increasing the "PSA-1 CAB 6" input on the SPDIF-output submix (second image), but that causes the Aux Send track and the Send amount to be unusable to adjust the effect as it is always on. I want to be able to route the return signal from G-Major from SPDIF input to Audio 1-2 output.
Answer: The solution was to enable output on the Software Playback SPDIF, and select channel 9-10 as both input and output in Mainstage's I/O plugin.


SSL with Rails 3.1: config.force_ssl = true not working in development mode

Question: I am running rails 3.1  in development mode on Ubuntu with sqlite. The rails server is running on port 3000, and I have nginx set up to proxy_pass ports 80 and 443 to port 3000. when I put config.force_ssl = true into my Application.rb and restart the rails server, I get an error that looks like:
    Secure Connection Failed
    An error occurred during a connection to localhost:3000.

    SSL received a record that exceeded the maximum permissible length.

    (Error code: ssl_error_rx_record_too_long)

    The page you are trying to view can not be shown because the authenticity of the received data could not be verified.
    Please contact the web site owners to inform them of this problem. Alternatively, use the command found in the help menu to report this broken site.

When I change it back to config.force_ssl = false and restart the rails server,  I still get an error, [2011-12-30 09:48:02] ERROR bad URI 9W\x0Fe���h=9��ݔ|�#��)�/6\x00\x00H\x00��'. in the rails console. This goes away and everything is back to normal if I also clear the browser cache. But how do I get force_ssl = true to work?
Here is part of my Application.rb:
    module Regi
      class Application < Rails::Application
        # Settings in config/environments/* take precedence over those specified here.
        # Application configuration should go into files in config/initializers
        # -- all .rb files in that directory are automatically loaded.
        config.generators do |g|
          g.template_engine :haml
        end
        config.force_ssl = true
      end
    end

And here is my /etc/nginx/sites-enabled/default:
server {
    #listen   80; ## listen for ipv4; this line is default and implied
    #listen   [::]:80 default ipv6only=on; ## listen for ipv6

    root /usr/share/nginx/www;
    index index.html index.htm;

    # Make site accessible from http://localhost/
    server_name localhost;

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to index.html
            proxy_pass      http://localhost:3000;
            try_files $uri $uri/ /index.html;
    }

    #error_page 404 /404.html;

    # redirect server error pages to the static page /50x.html
    #
    #error_page 500 502 503 504 /50x.html;
    #location = /50x.html {
    #       root /usr/share/nginx/www;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #       fastcgi_split_path_info ^(.+\.php)(/.+)$;
    #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
    #
    #       fastcgi_pass 127.0.0.1:9000;
    #       fastcgi_index index.php;
    #       include fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #       deny all;
    #}
}

# HTTPS server
server {
    listen       443;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;
    ssl    on;
    ssl_certificate    /usr/local/conf/ssl_keys/server.crt;
    ssl_certificate_key    /usr/local/conf/ssl_keys/server.key;

    location / {
        proxy_pass        http://localhost:3000;
        proxy_set_header  X-Real-IP  $remote_addr;
        # root   html;
        # index  index.html index.htm;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }
}

Answer: I've encountered the exact same error message when i configure a nginx ssl server.That's because i didn't have ssl crt and key.And in your nginx configure file,I've notice there has been crt and key.So are you sure both the crt and key are ok?
If you are not sure, you can try following link to create self_assigned crt.
http://devcenter.heroku.com/articles/ssl-certificate-self
p.s. I want to append this answer as a small comment, but seems I did not have this permission
Answer: The ActionController::ForceSSL tells it not to redirect it when its on 'development' mode.
https://github.com/rails/rails/blob/391e6a47dbd46fdce0a472819e8d27792cc91984/actionpack/lib/action_controller/metal/force_ssl.rb#L29


How to do page grouping in ssrs?

Question: How can I page grouping SSRS after I've create a report? I can do it if creating new report, but do not know how to do it if I already have created reprot.
Answer: In order to break groups on page, you right click on the group at the bottom of the report and select "Group Properties".  The second tab on the left in the "Group Properties" is "Page Breaks".  You can select the check box, "Page break options" " "Between each instance of a group".
Then ensure that your headers and your footers you want to repeat with each page are in that group.  If they are not add new headers and footers in the group and remove the old ones.
Answer: If by page grouping you mean grouping data in a Data region, such as a Table, then this is how you can do it.
At the bottom of your report is a section showing Row Groups and Column Groups. Click on the Data region, Row Groups will show a line that says "Details". It represents every row in your data set. Suppose my data set has Country and Region columns, I can drag Country into the Row Groups pane. My data rows will be grouped by Country. I can again drag Region and drop it between Country and Details to create a subgroup.
Answer: To display a static tablix member (row or column) on multiple pages.
On the design surface, click the row or column handle of the tablix data region to select it. The Grouping pane displays the row and column groups.
On the right side of the Grouping pane, click the down arrow, and then click Advanced Mode. The Row Groups pane displays the hierarchical static and dynamic members for the row groups hierarchy and the Column groups pane shows a similar display for the column groups hierarchy.
Click the static member that corresponds to the static member (row or column) that you want to remain visible while scrolling. The Properties pane displays the Tablix Member properties.
In the Properties pane, set RepeatOnNewPage to True.
Repeat this for as many adjacent members as you want to repeat.

How to do page grouping in ssrs?


Why only after 3-duplicate ACK retransmission takes place in TCP?

Question: Is there any reason of choosing "3" only for retransmission. why not 2 or 4 or any other number?
Answer: You're referring to 'Fast Retransmit' in the TCP Reno implementation. It is basically an assumption.
RFC 2001, TCP Slow Start, Congestion Avoidance, Fast Retransmit, and Fast Recovery Algorithms covers this:

Since TCP does not know whether a duplicate ACK is caused by a lost
segment or just a reordering of segments, it waits for a small number
of duplicate ACKs to be received.
It is assumed that if there is just a reordering of the segments,
there will be only one or two duplicate ACKs before the reordered
segment is processed, which will then generate a new ACK. If three or
more duplicate ACKs are received in a row, it is a strong indication
that a segment has been lost.

The key here is that Reno wants to avoid slow-start it makes the assumption that 3 dup-acks received without any intervening packets is the receiver indicating that it wants that single segment resent(fast re-transmit). If a timeout occurs that is when Reno will trigger slow start.
RFC 2001, TCP Slow Start, Congestion Avoidance, Fast Retransmit, and Fast Recovery Algorithms, Section 4, Fast Recovery:

After fast retransmit sends what appears to be the missing segment,
congestion avoidance, but not slow start is performed.  This is the
fast recovery algorithm.  It is an improvement that allows high
throughput under moderate congestion, especially for large windows.
The reason for not performing slow start in this case is that the
receipt of the duplicate ACKs tells TCP more than just a packet has
been lost.  Since the receiver can only generate the duplicate ACK
when another segment is received, that segment has left the network
and is in the receiver's buffer.  That is, there is still data flowing
between the two ends, and TCP does not want to reduce the flow
abruptly by going into slow start.
The fast retransmit and fast recovery algorithms are usually
implemented together as follows.

When the third duplicate ACK in a row is received, set ssthresh to
one-half the current congestion window, cwnd, but no less than two
segments.  Retransmit the missing segment.  Set cwnd to ssthresh
plus 3 times the segment size.  This inflates the congestion window
by the number of segments that have left the network and which the
other end has cached (3).

Each time another duplicate ACK arrives, increment cwnd by the
segment size.  This inflates the congestion window for the
additional segment that has left the network.  Transmit a
packet, if allowed by the new value of cwnd.

When the next ACK arrives that acknowledges new data, set cwnd
to ssthresh (the value set in step 1).  This ACK should be the
acknowledgment of the retransmission from step 1, one round-trip
time after the retransmission.  Additionally, this ACK should
acknowledge all the intermediate segments sent between the lost
packet and the receipt of the first duplicate ACK.  This step is
congestion avoidance, since TCP is down to one-half the rate it
was at when the packet was lost.

The fast retransmit algorithm first appeared in the 4.3BSD Tahoe
release, and it was followed by slow start.  The fast recovery
algorithm appeared in the 4.3BSD Reno release.
Answer: I created two GIFs to illustrate the 2 cases.

Either DUP ACK just means out-of-order segment (there will be no loss and the sending TCP doesn't need to retransmit anything).
It's just the sending TCP sent 1, 2, 3, but the receiver receives 1, 3, 2.
So there is temporarily a "hole" in the reassembly process, that will be filled quickly later as the delayed segment eventually arrives.

Or it means there is a segment that will never arrive (loss) and the sender will eventually need to retransmit it.
There will be a permanent "hole" in the reassembly process on receiver side, so receiver will keep repeating "thank you for the new segments, but I still need that previous missing one before we can slide the window further".

We can't know it at first, so, 3 DUP ACKs is considered a "sweet spot" (probability of having 3 out-of-order segments in a row is very low).
DUP ACK for out-of-order segment (no loss)

DUP ACK for lost segment (retransmission needed)


SVN options in STS - Existing Maven project

Question: I'm new to STS and SVN. In my workstation I'm having the SVN checked out source code (Maven Project) in a folder. And I have imported that maven project into SpringSource tool Suite (STS) using the option Import --> Maven --> Existing Maven Projects.
After importing like this, I can work with the code, what I'm having as of now in my machine. But I cant use the SVN options in STS like update, commit and annotate. These features are not enabled for me.
I have installed Subclipse for SVN in my STS tool.
Please guide me to solve this problem. Thanks in advance.
Comment: Not sure about STS, but Eclipse, you could right-click on the project and select `Team -> Share...`
Answer: If it is already in SVN then you want to use the SVN explorer to find the project and checkout from there. (Subclipse is a decent plugin for that)
Subclipse 1.6.x Update Site - http://subclipse.tigris.org/update_1.6.x
(you may want 1.7, 1.8 however)
Install the "M2E connector for subclipse" and you get an awesome new option called "Check out as Maven Project" which will pul out the project and all sub-modules as Maven projects in the STS workspace.  YOu will have full reversion history and can commit away.
Maven Integration for Eclipse Extras Update Site - http://m2eclipse.sonatype.org/sites/m2e-extras
Answer: To install SVNKit as an Eclipse plugin or to make sure that you have the latest version installed, use http://eclipse.svnkit.com/1.8.x/ as an update site location in Eclipse Update Manager.
In Eclipse menu select Help->Software Updates
Then choose 'Available Software' tab
Click 'Add Site...' button
Type http://eclipse.svnkit.com/1.8.x/ in the 'Location' field and press 'OK'.
Check the new site (it should appear in the list of update sites) and follow further steps as prompted by Eclipse.

Answer: or

In Eclipse, go to the Help menu → Install New Software...
Click Add... http://community.polarion.com/projects/subversive/download/eclipse/3.0/kepler-site/
In Location copy the URL for the Subversive SVN Connectors
Click OK
Check Subversive SVN Connectors
Click Next, and then follow the instructions to complete installation


Source of Debian packages older than 2005

Question: I want to download packages for years 2000, 2001, 2002, 2003 and 2004 but Debian snapshots are maintained from March 2005 only. How can I get the source of packages before 2005?
Comment: There's a completely different reason for the unavailability of Chromium from 2004.  (-:
Comment: What packages precisely?
Comment: there are almost 10 packages i am looking for.. linux, chrominum/browser, icedove, wireshark, xulrunner, openjdk,php,imagemagick, mysql.
Comment: what's the reason? and what about other packages? Is there any link from where i can download the source of all these for previous years?
Comment: @Hazel  the first release of Chromium came out in 2008.
Answer: You can find old releases of Debian here. You won't find all the snapshots of packages, only the versions that were released.
Answer: You can find cd images at archive.org.
https://archive.org/search.php?query=creator%3A%22Debian+Project%22
Comment: I am not looking for debain image. I am looking for packages. After year 2005 , i can get them from snapshots maintained by debian.. but before 2005 i dont know how to get them. there are almost 10 packages i am looking for.. linux, chrominum/browser, icedove, wireshark, xulrunner, openjdk,php,imagemagick, mysql
Comment: CD images contain all binary and source packages. (1st release of chromium was in 2008)


Xcode for iPad?

Question: I don't have an Apple computer, only iPad and Debian computer but I still would like to add a feature to iOS app here. Earlier I found out that I can download Xcode, more here, from Apple Store. Now I cannot find Xcode from Apple Store in iPad. I want to get this one here for iPad so how can I get Xcode for iPad?
Answer: Xcode is an IDE available exclusively for the Mac OS operating system. There is no mobile version of the software. The link you provided is to the Mac App Store, which is its own separate entity from the App Store for iOS devices.
Comment: iPad runs iOS; Mac runs OS X. While they have some common code, they are different operating systems.
Comment: To quote the **[Wikipedia article](http://en.wikipedia.org/wiki/IOS)**: "iOS is derived from OS X, with which it shares the Darwin foundation, and is therefore a Unix operating system. iOS is Apple's mobile version of the OS X operating system used on Apple computers."
Comment: @hhh That's what "XCode is a OS X app" means. iTunes, as a rare exception for Apple, has both an OS X version and a Windows version.
Comment: ...iPad does not have Mac OS operation system?
Comment: @hhh It does in a way. iOS is a much smaller, streamlined version of the Mac OS operating system that's optimized for Apple's line of mobile devices.
Comment: You mean that Xcode does not run even with Windows, even though Windows has iTunes?
Comment: @hhh That is correct. The only way that you could run Xcode on a Windows machine is if you were to set up a Virtual Machine running the Mac OS platform, or some other sort of thirt-party workaround. Otherwise, the only official source is via an official Apple system.
Answer: You currently cannot install Xcode on an iPad or iPhone, or any device other than a mac running OSX. There have been discussions & questions asked about it before; basically you shouldn't hold your breath.
If you have a mac you can always consider VNC if you want to do work remotely on your iPad, but to me it sounds like you don't have a mac and were hoping the iPad could serve as your development environment.
Comment: @hhh Yes. Provided the machine you purchase meets the requirements for Xcode (e.g., OS X 10.7.4 or later), you can use any Mac for development.
Comment: `"If you have a mac you can always consider VNC if you want to do work remotely on your iPad, but to me it sounds like you don't have a mac and were hoping the iPad could serve as your development environment."` <--- I cannot understand this, could you clarify? Yes, I try to use iPad as a development environment and I don't have a mac (only iPad).
Comment: Is it sufficient to buy any old mac for development? Like old Macbook air?
Comment: Can you recommend some VNC client? Screens? iSSH? I have never really understand what VNC really is, why not just SSH with XY -flags? Moved [here](http://superuser.com/questions/482477/vnc-over-ssh-with-xy-flags).
Comment: I believe that either Screens or iSSH have gotten good reviews and are regarded as quality software. Looks like Screens is more user friendly, but you would get more power use out of iSSH, so choose what you think suits your style best :)

As for why not ssh -x straight from the iPad: you may be able to... I've never tried, but I think it'd take a bit more setup and work to get to work correctly than is worth just grabbing an app and letting the developer worry about that.
Answer: Xcode is a Mac App, not an iOS App. As such, it doesn't run on the iPad. The program you linked to, http://itunes.apple.com/us/app/xcode/id497799835?mt=12, is in the Mac app store, not the iOS App store.
There might be some confusion because Xcode can be used to develop iOS apps, but it itself is a Mac app only.
Answer: As with the other answers, you can't directly because OS X and iOS are different platforms with different restrictions and apps (duh).  You can however accomplish what you're attempting to do with an OS X machine running and connected to the Internet in order to compile the builds for your iPad.
This is exactly how the Dringend app works (http://dringend.cc/).  It runs on your iPad as a slimmed-down 3rd-party Xcode replacement (it even understands <code>.xcodeproj</code> files!), and uses Xcode via remote OS X host to do the dirty-work.
I thought I read something somewhere about another start-up working towards a product with the same premise, but provides the OS X build-machines as a paid service— I'll update this if I find their name.  Until then, there's always OS X hosting.
Answer: The iPad's processor's power is way too small to run Xcode. You can let Apple think about it or just get a Mac.

Xcode for iPad?


Is it possible to bypass two step authentication process?

Question: Is it possible for a hacker to bypass two step authentication process if the hacker has no physical access to my phone?
Comment: The generic answer is "Yes, anything's possible". If you want a more specific answer, you'll need to give us more specific information like what type of 2FA (SMS, app, physical token, fingerprint, iris)? What type of service is this for (Gmail, github, ...)? What kind of attacker are you trying to protect against (your kid sister, some random hacker trying to bruteforce your password, the NSA)?
Comment: its about some random hacker who want to gain access to login into my bank account where bank uses 2FA for authentication by sending OTP through an automated call or SMS.
Comment: Yes it is possible. Especially SMS are highly insecure. Apps can intercept the SMS on the phone. Also the SMS can be intercepted on the air.
Answer: You don't say what kind of 2FA process you are using and which kind of phone you have. But if the hacker manages to install a privileged application to your phone he might be able to capture 2FA tokens send with SMS or extracts the secrets from some OTP apps you use.
And installing an app to your phone without having physical access might be easier than you believe, like sending a MMS or using a drive-by download.
Comment: also if 2FA is done via a text message and the attacker cloned your sim card and or intercepted the sms message
Answer: The difficulty of bypassing 2FA depends on the mechanism used for the second factor, but with SMS codes it's definitely possible and has been done before. In an actual incident recently, hackers were able to trick Verizon employees into redirecting the texts to a different phone by simply impersonating the subscriber.
Answer: The short answer is yes.
They could install malware onto your phone, add an SMS redirect, hack a phone service, or just hack the target site.
Answer: In case of codes sent with SMS or email, in addition to an already mentioned maliciuos app being planted on a device:

recently a social engineering hack has been revealed where an attacker sends a message convincing the victim to forward (or input on attacker site) the legitimate authentication message (login attempt from the attacker) that will follow
you can subvert the security yourself by running apps like Google Hangouts (configured to handle SMS) or Pushbullet which forward the message or just the contents of screen notifications to other devices that might not be in your vicinity, but might automatically display the contents (like a tablet left at your office)
Answer: Yes. I speak from experience. Our company account has been hacked while we had 2FA in place.

Service provider: Amazon AWS
The technique: social engineering.

The hacker convinced the AWS servicedesk to disable 2FA.
The other answers here all talk about hacking your phone, or the website. This "hack" is another route and very effective.
If the hacker can somehow take over your email, that's another way. Many 2FA mechanisms have a reset or failback via email. If they control your mail, they can reset anything that can be reset via mail.


How do I unit test a repository that uses DbContext with NSubstitute?

Question: I have a solution in which I have a Data project that contains an EF6 .edmx file, generated from an existing database. I split the entities into a separate Entities project, and have a Repositories project that references them both.
I have added a BaseRepository with some common methods, and want to unit test it. The top of the class looks like this...
public class BaseRepository<T> : BaseRepositoryInterface<T> where T : class {
  private readonly MyEntities _ctx;
  private readonly DbSet<T> _dbSet;

  public BaseRepository(MyEntities ctx) {
    _ctx = ctx;
    _dbSet = _ctx.Set<T>();
  }

  public IEnumerable<T> GetAll() {
    return _dbSet;
  }

  //...
}

Following the code I found at https://stackoverflow.com/a/21074664/706346, I tried the following...
[TestMethod]
public void BaseRepository_GetAll() {
  IDbSet<Patient> mockDbSet = Substitute.For<IDbSet<Patient>>();
  mockDbSet.Provider.Returns(GetPatients().Provider);
  mockDbSet.Expression.Returns(GetPatients().Expression);
  mockDbSet.ElementType.Returns(GetPatients().ElementType);
  mockDbSet.GetEnumerator().Returns(GetPatients().GetEnumerator());
  MyEntities mockContext = Substitute.For<MyEntities>();
  mockContext.Patients.Returns(mockDbSet);

  BaseRepositoryInterface<Patient> patientsRepository
                          = new BaseRepository<Patient>(mockContext);
  List<Patient> patients = patientsRepository.GetAll().ToList();
  Assert.AreEqual(GetPatients().Count(), patients.Count);
}

private IQueryable<Patient> GetPatients() {
  return new List<Patient> {
    new Patient {
      ID = 1,
      FirstName = "Fred",
      Surname = "Ferret"
    }
  }
    .AsQueryable();
}

Note that I changed the context TT file to use IDbSet, as suggested by Stuart Clement in his comment on Dec 4 '15 at 22:41
However, when I run this test, it gives a null reference exception, as the line in the base repository constructor that sets _dbSet leaves it null...
_dbSet = _ctx.Set<T>();

I would guess I need to add another line when I set up my mock context, but I'm not sure what. I thought the code above should be enough to populate the DbSet.
Anyone able to explain what I've missed or done wrong?
Comment: In EF Core consider in-memory providers https://learn.microsoft.com/en-us/ef/core/testing/
Comment: @MichaelFreidgeim Thanks, I use in-memory now. I asked this question six and a half years ago, when I was  still using EF6.
Comment: The comment was mostly for new readers, not for you. Sorry, if it was confusing.
Answer: Well, having driven myself mad trying to do it the way I showed in my question, I came across Effort, which was designed for the task, and followed this tutorial, which got me going. I had a few problems with his code, which I'l explain below.
Briefly, what I did was...
*) Install Effort.EF6 in the test project. I made a mistake at first and installed Effort (without the EF6 bit), and had all sorts of problems. If you're using EF6 (or EF5 I think), make sure you install this version.
*) Modified the MyModel.Context.tt file to include an extra constructor that took a DbConnection... public MyEntities(DbConnection connection) : base(connection, true) { }
*) Added the connection string to the test project's App.Config file. I copied this verbatim from the data project.
*) Added an initialisation method to the test class to set up the context...
private MyEntities _ctx;
private BaseRepository<Patient> _patientsRepository;
private List<Patient> _patients;

[TestInitialize]
public void Initialize() {
  string connStr = ConfigurationManager.ConnectionStrings["MyEntities"].ConnectionString;
  DbConnection connection = EntityConnectionFactory.CreateTransient(connStr);
  _ctx = new MyEntities(connection);
  _patientsRepository = new BaseRepository<Patient>(_ctx);
  _patients = GetPatients();
}

Important - In the linked article, he uses DbConnectionFactory.CreateTransient(), which gave an exception when I tried to run the tests. It seems that this is for Code First, and as I'm using Model First, I had to change it to use EntityConnectionFactory.CreateTransient() instead.
*) The actual test was fairly simple. I added some helper methods to try and tidy it up, and make it more reusable. I'll probably do several more rounds of refactoring before I'm done, but this works, and is clean enough for now...
[TestMethod]
public void BaseRepository_Update() {
  AddAllPatients();
  Assert.AreEqual(_patients.Count, _patientsRepository.GetAll().Count());
}

#region Helper methods

private List<Patient> GetPatients() {
  return Enumerable.Range(1, 10).Select(CreatePatient).ToList();
}

private static Patient CreatePatient(int id) {
  return new Patient {
    ID = id,
    FirstName = "FirstName_" + id,
    Surname = "Surname_" + id,
    Address1 = "Address1_" + id,
    City = "City_" + id,
    Postcode = "PC_" + id,
    Telephone = "Telephone_" + id
  };
}

private void AddAllPatients() {
  _patients.ForEach(p => _patientsRepository.Update(p));
}

#endregion

The bit that needed a mind-shift here was that with Effort, unlike other mocking, you don't tell the mocking framework what to return for a particular argument. Instead, you have to think of Effort as a real database, albeit a temporary one in memory. Therefore, I set up a list of mock patients in the initialisation, added them to the database, and only then did the actual testing.
Hope this helps someone. It turned out to be a lot easier than the way I was trying to do it originally.
Comment: Effort has moved here: https://entityframework-effort.net/?z=codeplex
Comment: @MattBecker Thanks for the update Matt, I modified my answer to use the new link
Answer: I created a NSubstitute extension to help unit test the repository layer, you can find it on GitHub DbContextMockForUnitTests. The main file you want to reference is DbContextMockForUnitTests/MockHelpers/MockExtension.cs (it has 3 dependent code files in that same folder used for testing with async) , copy and paste all 4 files into your project. You can see this unit test that shows how to use it DbContextMockForUnitTests/DbSetTests.cs.
To make that relevant to your code lets assume that you have copied the main file and referenced the correct namespace in your using statements. Your code would be something like this (If MyEntities is not sealed you would not need to change it but I still would as a general rule of coding is try accept the least specific type possible):
// Slight change to BaseRepository, see comments
public class BaseRepository<T> : BaseRepositoryInterface<T> where T : class {
    private readonly DbContext _ctx; // replaced with DbContext as there is no need to have a strong reference to MyEntities, keep it generic as possible unless there is a good reason not to
    private readonly DbSet<T> _dbSet;

    // replaced with DbContext as there is no need to have a strong reference to MyEntities, keep it generic as possible unless there is a good reason not to
    public BaseRepository(DbContext ctx) {
        _ctx = ctx;
        _dbSet = _ctx.Set<T>();
    }

    public IEnumerable<T> GetAll() {
        return _dbSet;
    }

    //...
}

Unit test code:
// unit test
[TestMethod]
public void BaseRepository_GetAll() {
    // arrange

    // this is the mocked data contained in your mocked DbContext
    var patients = new List<Patient>(){
      new Patient(){/*set properties for mocked patient 1*/},
      new Patient(){/*set properties for mocked patient 2*/},
      new Patient(){/*set properties for mocked patient 3*/},
      new Patient(){/*set properties for mocked patient 4*/},
      /*and more if needed*/
    };
    // Create a fake/Mocked DbContext
    var mockedContext = NSubstitute.Substitute.For<DbContext>();
    // call to extension method which mocks the DbSet and adds it to the DbContext
    mockedContext.AddToDbSet(patients);

    // create your repository that you want to test and pass in the fake DbContext
    var repo = new BaseRepository<Patient>(mockedContext);

    // act
    var results = repo.GetAll();

    // assert
    Assert.AreEqual(results.Count(), patients.Count);
}

Disclaimer - I am the author of the aforementioned repository but it was partially based on Testing with Your Own Test Doubles (EF6 onwards)


Are kernel modules specific for linux or a general mechanism?

Question: I read in Tanenbaum's book about operating systems that there are protection rings and ring 0 belongs to the kernel. Is it in general that one may say that "kernel modules handle the I/O and memory management of ring 0" or is "kernel module" specific for linux and not applicable for example for OpenBSD and MULTICS?
Comment: "Kernel module" isn't specific to Linux, but is it correct to say that modules are handling that? I'd think the kernel itself is. That's not a part of the kernel that would be (un)loadable in the way modules could be, I think.
Answer: The ideas presented by Andrew Tanenbaum are usually not directly applicable to Linux (or any traditional monolithic Unix kernel). The answer to your question is much simpler than you are suggesting: a Linux kernel module is kernel code that has been compiled and linked into a separate file, instead of being linked into the kernel image. This separate kernel object file (.ko) can be loaded into the kernel address space, on demand, at run time. Practically all the drivers that can be compiled as kernel modules can also be statically linked into the kernel image, without any difference in functionality once  code has been loaded.
The module code is kernel code and it runs with the same privilege as all other kernel code. A kernel module can in principle replace any kernel code, but to do so cleanly the kernel proper must provide a mechanism for the module to hook into.
A side note on terminology: Protection Rings is a concept introduced with the Multics operating system. "Ring 0" to "Ring 3" are terms that are specific to Intel processors. Other processor architectures use other terms, like User/Supervisor mode. Although Intel processors provide four different levels of privilege, most operating systems have only used two: Ring 3 for user level code and Ring 0 for kernel code, mirroring the User/Supervisor modes of other processors. (The exception is OS/2, which used three levels of privilege.)
The privilege level concept has been expanded lately with the advent of hardware level virtualization technology. For example, the ARM architecture defines three privilege levels: User, Supervisor and Hypervisor. Jokingly, it has been said that finally four rings are used on Intel-based machines: Ring 3 for user level code, Ring 0 for (virtual machine) kernel code, Ring -1 for hypervisor code and Ring -2 for SMM mode.
Answer: The concept of kernel does not apply to all operating systems. It is widespread but exactly how to apply it to a particular system can be a matter of debate.
In the case of multiprogramming systems where programs are isolated from each other, there is a precise definition of the kernel: the kernel is the part of the system which has access to everything. The kernel is the part that isn't isolated. The role of the kernel is at least to provide the isolation mechanism, but it can do more. In a traditional Unix kernel architecture, which includes Linux, the kernel also contains hardware drivers, network protocols, filesystem drivers, etc.
On most systems, the isolation between running programs relies on hardware features (processor privilege modes, memory management unit). The kernel is then the part of the system that runs in the processor's highest privilege mode, the mode where the privileges of the whole system can be controlled. On x86 processors, this mode is called "ring 0"; note that "ring 0" is x86 terminology, not a general concept. The general concept is called "kernel mode" or "privileged mode" or "supervisor mode".
The statement "kernel modules handle the I/O and memory management of ring 0" doesn't make sense. The kernel, as a whole, handles memory management (at the level of deciding which process owns which memory and at what address it accesses it) and I/O (at the level of copying data in and out of peripherals). The kernel, as a whole, runs in the processor's kernel mode, which is ring 0 on an x86 processor.
A kernel module is a part of the kernel which is loaded after boot time. The only difference between a module and boot-time code is how it's loaded. Code in a kernel module runs at the same level of privileges as kernel code loaded at boot time and can perform the same functions (any code that can be loaded as a module can also be included in the boot-time image). Many modern Unix systems have kernel modules, including Solaris, *BSD, Linux, etc.


Why doesn't Python need a compiler?

Question: Just wondering (now that I've started with C++ which needs a compiler) why Python doesn't need a compiler?
I just enter the code, save it as an exec, and run it. In C++ I have to make builds and all of that other fun stuff.
Comment: @gbjbaanb but then again English is not compiled and the semantic analysis of one sentence might yield two equally valid results and the above could be read as "iron python is compiled just as C# and C++ is compiled"
Comment: Python is just a language with many implementations. Iron Python is compiled in the same way C# and C++ is compiled, and there may be other implementations like it.
Comment: C# and C++ are not compiled the same way - though you could argue that they both end up as machine instructions eventually, but if you do then you can say BASIC is compiled the same way too.
Comment: What platform / software are you using to write your Python code? If you write a .py file, it is not an executable. It is still a source code file. From the command line you are using the `python` command to interpret the .py file or if you use IDLE or Eclipse the IDE does it for you.
Answer: Python has a compiler! You just don't notice it because it runs automatically. You can tell it's there, though: look at the .pyc (or .pyo if you have the optimizer turned on) files that are generated for modules that you import.
Also, it does not compile to the native machine's code. Instead, it compiles to a byte code that is used by a virtual machine. The virtual machine is itself a compiled program. This is very similar to how Java works; so similar, in fact, that there is a Python variant (Jython) that compiles to the Java Virtual Machine's byte code instead! There's also IronPython, which compiles to Microsoft's CLR (used by .NET). (The normal Python byte code compiler is sometimes called CPython to disambiguate it from these alternatives.)
C++ needs to expose its compilation process because the language itself is incomplete; it does not specify everything the linker needs to know to build your program, nor can it specify compile options portably (some compilers let you use #pragma, but that's not standard). So you have to do the rest of the work with makefiles and possibly auto hell (autoconf/automake/libtool). This is really just a holdover from how C did it. And C did it that way because it made the compiler simple, which is one main reason it is so popular (anyone could crank out a simple C compiler in the 80's).

Some things that can affect the compiler's or linker's operation but are not specified within C or C++'s syntax:

dependency resolution
external library requirements (including dependency order)
optimizer level
warning settings
language specification version
linker mappings (which section goes where in the final program)
target architecture

Some of these can be detected, but they can't be specified; e.g. I can detect which C++ is in use with __cplusplus, but I can't specify that C++98 is the one used for my code within the code itself; I have to pass it as a flag to the compiler in the Makefile, or make a setting in a dialog.
While you might think that a "dependency resolution" system exists in the compiler, automatically generating dependency records, these records only say which header files a given source file uses. They cannot indicate what additional source code modules are required to link into an executable program, because there is no standard way in C or C++ to indicate that a given header file is the interface definition for another source code module as opposed to just a bunch of lines you want to show up in multiple places so you don't repeat yourself. There are traditions in file naming conventions, but these are not known or enforced by the compiler and linker.
Several of these can be set using #pragma, but this is non-standard, and I was speaking of the standard. All of these things could be specified by a standard, but have not been in the interest of backward compatibility. The prevailing wisdom is that makefiles and IDEs aren't broke, so don't fix them.
Python handles all this in the language. For example, import specifies an explicit module dependency, implies the dependency tree, and modules are not split into header and source files (i.e. interface and implementation).
Comment: Other reasons why C compiled to machine code were that it was intended to be little more than a glorified assembler, because bytecode interpreters were technically unfeasible on the hardware they had, and because one of the most important tasks was writing an OS kernel.
Comment: The C implementation of Python is **CPython**, [Cython](http://cython.org/) is something different.
Comment: _"C++ needs to expose its compilation process because the language itself is incomplete"_ Er, what??
Comment: You read the part *right after that*, right? "it does not specify everything the linker needs to know to build your program, nor can it specify compile options portably." You can't just build *any* C++ file by feeding it to a compiler; frequently you have to provide metadata like compile flags, include paths, etc. This metadata isn't specified by the standard and is not portable, which is why we have to drag in other things like make, cmake, Visual Studio, or whatever to finish the job. So the standard has to call out some things as in the compilation unit and others as program-wide.
Comment: @BillyONeal with the one big exception that in c/c++ you as a programmer has to do stuff in a certain way (either makefiles or dump every thing into the same blob) in python you just do your work and the compiler together with the VM takes care of the rest
Comment: I don't see how C/C++ doesn't specify what the linker needs; after all, there are a lot of C and C++ programs out there.
Comment: @Billy: I expanded on that in my answer. Short version is that makefiles aren't actually part of C or C++.
Comment: @RuneFS: Python has no object files to induce dependencies. There's nothing like make involved because everything is parsed on every run. I would call that a limitation of Python (that the entire source must be parsed every time) more than I'd call it a limitation of other languages.
Comment: @Billy I didn't say anything about object files I said there were things you need to do in C/c++ that you don't need to do when developing in Python which yur statement supports so I guess we agree
Comment: Guess my memory got scrambled back in a "Why can't we get rid of the GIL" thread. Fixed.
Comment: @Mike: Erm, Python has the same problem, because it doesn't do dependency resolution at all (it always reads/parses all executed code on every run, even with JIT optimized implementations). You could make C++ compilation behave like Python compilation if you'd put everything in a single translation unit.
Comment: Unless you delete the `.pyc`/`.pyo` files, everything is *not* parsed on every run. This is actually a known source of unexpected behavior. For example, if you delete a `.py` file but not its corresponding `.pyc` file, Python will act as if the module still exists; it won't look for the `.py` file once it finds the `.pyc` file.
Answer: Python is an interpreted language. This means that there is software on your computer that reads the Python code, and sends the "instructions" to the machine. The Wikipedia article on interpreted languages might be of interest.
When a language like C++ (a compiled language) is compiled, it means that it is converted into machine code to be read directly by the hardware when executed. The Wikipedia article on compiled languages might provide an interesting contrast.
Comment: There is no such thing as an interpreted or a compiled language. A language is an abstract set of mathematical rules. A language isn't compiled or interpreted. A language just *is*. Compilation and interpretation are traits of the compiler or interpreter (duh!), not the language. Every language can be implemented with a compiler and every language can be implemented with an interpreter. Most languages have both compiled and interpreted implementations. There are interpreters for C++ and there are compilers for Python. (In fact, *all* currently existing Python implementations have compilers.)
Comment: @JörgWMittag: You are technically right. However, most languages were designed for an interpreted context or for full compilation. Writing an interpreter for GW BASIC or Common Lisp is much easier than writing one for, say, C++ or C#; Python loses many of its selling points without the interactive environment; writing a compiler for PHP is pretty damn hard, and probably horribly inefficient, as the compiled executable would have to contain the entire PHP interpreter, due to eval() and similar constructs - one could argue that such a compiler would be cheating.
Comment: The majority of modern high-performance language implementations combine both an interpreter and a compiler (or even several compilers) for maximum performance. Actually, it is *impossible* to run *any* program *without* an interpreter. After all, a compiler is just a program which translates a program from one language to another language. But at *some* point you have to actually *run* the program, which is done by an interpreter (which may or may not be implemented in silicon).
Comment: @tdammers, yes. We can reasonably use "compiled language" to mean "language usually compiled." But that misses the point that PHP, Java, Python, Lua, and C# are all implemented as compilers to bytecode. All of these languages have also had JIT's implemented for them. So really, you can't really call some of these languages compiled and some interpreted because they've got the same implementation strategy.
Comment: @BillyONeal, not true at least for python. You can distribute python bytecode and run that without the source. But is true that you can't distribute python without a compiler.
Comment: @Winston ["Its also worth pointing out that there is a PHP compiler called HipHop developed by facebook."](http://programmers.stackexchange.com/questions/136942/why-doesnt-python-need-a-compiler/136943#comment257326_136943) ;P (not important, really)
Comment: @Jörg W Mittag: Python interpreter is called so because people agreed to call the facility that translates Python code to bytecode and then interprets it a Python interpreter. For example check the first two paragraphs of the latest official [Python tutorial](https://docs.python.org/3/tutorial/index.html). They call Python language *interpreted* and use *Python interpreter* term. When a processor interprets machine code they say that process executes it, though you can always say that processor just interprets the opcodes. It's just that you will be understood by less people. Terms may be ...
Comment: ... technically wrong, but if they let people understand what is going on more easily and clearly they will be preferred to more complex abstractions.
Comment: Its also worth pointing out that there is a PHP compiler called HipHop developed by facebook. However, it works by not including features like `eval`.
Comment: @WinstonEwert: Strictly speaking, C# and Java are compiled, and their language semantics work that way. The bytecode is JIT'd of course.
Comment: @YannisRizos, I swear I did a page search to see where if I mentioned that...
Comment: @Jörg W Mittag: When people say that *Python is an interpreted language* they refer to the reference implementation of Python that uses interpreter; the don't say that it is impossible to write a Python compiler. It is just a matter of agreed upon terms. Right or wrong, like it or not, but that's what most of the people use to classify programming languages in this regard.
Comment: @golem: However, CPython also uses a compiler. In fact, CPython *never* interprets Python, it *always* compiles it to a completely different language and then interprets *that* language. So, CPython compiles Python and interprets a completely different language, how does that make it a Python interpreter? If the completely different language it compiles to happened to be x66 machine code which then gets interpreted by the CPU, would that still make it a Python interpreter? What is the difference between Python getting compiled to a different language and that language then being interpreted …
Comment: There are a lot more steps than "reads Python and sends the instructions to the machine". One of those steps is indeed a *compiler*. Now, you might say that the bytecode used by CPython is interpreted, but that's just a CPython thing and isn't the same across all Python implementations. For example, Jython compiles to the Java VM which gets JIT compiled to machine code. Or, [PyPy](http://pypy.org) compiles directly from Python to machine code.
Comment: Coming back to my original point: the term "compiled language" doesn't make sense. It's not even *wrong*, it's simply nonsensical. If English were a typed language, "compiled language" would be a compile error.
Comment: My point is that I think it is reasonable to talk about "compiled" vs. "interpreted" languages; even though the terms are technically wrong, it should be somewhat obvious what is meant.
Comment: @BillyONeal, but PHP/Python/Lua are also all compiled to a bytecode just like C# and Java. I do no think there is a useful distinction between compiled and interpreted languages as they stand today.
Comment: @Winston: The difference is that Python/PHP/Lua require the source to be available during execution; the bytecode bit for these languages is an implementation detail rather than being part of the language itself. These languages take advantage of the fact that you have to deploy the entire interpreter to a machine in order to run code written in such languages. There are good things and bad things about either approach, of course. At the end though, Python/PHP/Lua are designed like scripting languages. C/C++/C#/Java/Pascal/etc. are not. A lot of that is the result of their compilation models.
Comment: @WinstonEwert Strictly speaking HipHop is not a compiler, but a [translator](http://en.wikipedia.org/wiki/Translator_(computing)). The difference being that the output is a high level language.
Comment: @YannisRizos, I don't see that I've mentioned HipHop anywhere in this discussion much less called it a compiler.
Comment: … by a "virtual CPU" and C being compiled to a different language and that language then being interpreted by a virtual CPU (e.g. QEmu)?
Answer: Not all compiled languages have an in-your-face edit-compile-link-run cycle.
What you're running into is a feature/limitation of C++ (or at least C++ implementations).
To do anything, you must store your code into files, and build a monolithic image by a process called linking.
In particular, it's this monolithic linking process which is mistaken for the distinction between compiling and interpreting.
Some languages do all this stuff much more dynamically, by eliminating the clumsy monolithic linking step, not by eliminating compiling to machine code. Source is still compiled to object files, but these are loaded into a run-time image, rather than linked into a monolithic executable.
You say "reload this module", and it loads the source and interprets it, or compiles it, depending on some mode switch.
Linux kernel programming has some of this flavor even though you're working in C. You can recompile a module and load and unload it. Of course, you're still aware that you're producing some executable thing, and it's managed by a complex build system, with still some manual steps. But the fact is that in the end you can unload and re-load just that small module and not have to restart the whole kernel.
Some languages have an even more fine grained modularization than this, and the building and loading is done from within their run-time, so it is more seamless.
Answer: what a diversion from the initial question... A point not mentioned is that the source of a python program is what you use and distribute,  from a user perspective it IS the program.  We tend to simplify things into categories that are not well defined.
Compiled programs are usually considered to be stand alone files of machine code. (admittedly often containing links to dynamic link libraries associated with specific operating systems). This said... there are variation of most programing language that could be described as compiled or interpreted.
Python does not need a compiler because it relies on an application (called an interpreter) that compiles and runs the code without storing the machine code being created in a form that you can easily access or distribute.
Answer: All programming languages require translation from human concepts into a target machine code. Even assembly language must be translated into machine code. That translation usually takes place in the following phases:
Phase 1: Analysis and translation (parsing) into an intermediate code.
Phase 2: Translation of the intermediate code into target machine code with place holders for external references.
Phase 3: Resolution of the external references and packaging into a machine executable program.
This translation is often referred to as pre-compiling and "Just in time" (JIT)  or run-time-compiling.
Languages such as C, C++, COBOL, Fortran, Pascal (not all) and Assembly are precompiled languages that can be executed directly by the opertating system without need of an interpreter.
Languages like Java, BASIC, C# and Python are interpreted. They all use that intermediate code created in Phase 1, but will sometimes differ in how they translate it into machine code. The simplest forms use that intermediate code to execute machine code routines that do the expected work. Others will compile the intermediate code down to machine code and do the external dependency fixing during runtime. Once compiled it can be immediately executed. As well the machine code is stored in a cache of previously-compiled reusable machine code that can later be reused if the function is needed again later. If a function has already been cached, the interpreter does not need to compile it again.
Most modern high level languages fall into the interpreted (with JIT) category. It is mostly the older languages like C & C++ that is precompiled.

Why doesn't Python need a compiler?


How do you change multiple column names in a Julia (version 0.3) DataFrame?

Question: For example say you create a Julia DataFrame like so with 20 columns:
y=convert(DataFrame, randn(10,20))

How do you convert the column names (:x1 ... :x20) to something else, like (:col1, ..., :col20) for example, all at once?
Comment: I've tried the below for v0.6 with no success, can we reopen?
Answer: You might find the names! function more concise:
julia> using DataFrames

julia> df = DataFrame(x1 = 1:2, x2 = 2:3, x3 = 3:4)
2x3 DataFrame
|-------|----|----|----|
| Row # | x1 | x2 | x3 |
| 1     | 1  | 2  | 3  |
| 2     | 2  | 3  | 4  |

julia> names!(df, [symbol("col$i") for i in 1:3])
Index([:col2=>2,:col1=>1,:col3=>3],[:col1,:col2,:col3])

julia> df
2x3 DataFrame
|-------|------|------|------|
| Row # | col1 | col2 | col3 |
| 1     | 1    | 2    | 3    |
| 2     | 2    | 3    | 4    |

Comment: names!() is deprecated now, you can use the above if you replace `names!` by `rename!`
Comment: In julia v0.6.2, change `symbol` to `Symbol`
Comment: I would like this more concise solution, but it does not seem to work with new Julia versions (e.g. 0.6.2). Solution with `rename!` still works.
Answer: One way to do this is with the rename! function. The method of the rename function takes a DataFrame as input though only allows you to change a single column name at a time (as of the development version 0.3 branch on 1/4/2014). Looking into the code of Index.jl in the DataFrames repository lead me to this solution which works for me:
rename!(y.colindex, [(symbol("x$i")=>symbol("col$i")) for i in 1:20])

y.colindex returns the index for the dataframe y, and the next argument creates a dictionary mapping the old column symbols to the new column symbols. I imagine that by the time someone else needs this, there will be a nicer way to do this, but I just spent a few hours figuring this out in the development version 0.3 of Julia, so I thought i would share!
Answer: As an update to the answer of @JohnMylesWhite, the names! function has been deprecated in DataFrames v 0.20.2. The latest way of going about this is by using the rename! function:
import DataFrames
DF = DataFrames

df = DF.DataFrame(x1 = 1:2, x2 = 2:3, x3 = 3:4)
println(df)
DF.rename!(df, [Symbol("Col$i") for i in 1:size(df,2)])
println(df)

Answer: v1.1.0
One can directly change the column names by
names!(df, colNames_as_Symbols)

To rename the columns with a vector of strings, this can be done via
names!(df, Symbol.(colNames_as_strings) )

Comment: Just trying this, I think this should be name*s*!
Comment: @Crown42: yep! That leaves me asking why didn't I copy and paste?
Answer: # import Pkg; Pkg.add("DataFrames")
using DataFrames

The question has been answered, but for the additional clarity, sometimes you just want to specify the names without using loops (i.e. over-engineering):
rename!(df, [:Date, :feature_1, :feature_2 ], makeunique=true)

Example output:
141 rows × 3 columns

Date    feature_1   feature_2
Date    Float64?    Float64?
1   2020-08-03  44.3    missing

Answer: Update:
For Julia 0.4, as described by John Myles White, all the names can be changed with:
names!(df::AbstractDataFrame, vals)

where vals is a Vector{Symbol} the same length as
  the number of columns in df.
Specific names can be changed with:
rename!(df::AbstractDataFrame, from::Symbol, to::Symbol)
rename!(df::AbstractDataFrame, d::Associative)
rename!(f::Function, df::AbstractDataFrame)

where d is an Associative type that maps the original name to a new name
and f is a function that has the old column name (a symbol) as input
  and new column name (a symbol) as output.
This is documented in the code at https://github.com/JuliaStats/DataFrames.jl/blob/7e2f48ad9f31185d279fdd81d6413a79b7e42e87/src/abstractdataframe/abstractdataframe.jl
Answer: This is the short and simple answer for Julia 1.1.1:
names!(df, [Symbol("Col$i") for i in 1:size(df,2)])

Answer: Use the rename function with an array containing the new names:
Vector_with_names = ["col1","col2","col3"]
rename!(df,Vector_with_names)

Answer: Using John's dataframe, i had to use colnames! instead of names!
df = DataFrame(x1 = 1:2, x2 = 2:3, x3 = 3:4)
colnames!(df, ["col$i" for i in 1:3])

My  version of Julia is 0.2.1
Comment: As far as I can tell, this is depreciated (Julia v1.1.0)


How to have arduinos work together?

Question: I want to have an Arduino based game you can play on a nokia 5110 screen. The problem is you cant make a medium sized game on an Arduino because the flash size is only 32k. I sit possible to have multiple Arduino's connected to each other, communicating to make it possible to have a bigger game. If it is possible how does it work?
Comment: You could store things like bitmaps, and level data in an external EEPROM.
Comment: You can. Probably the easiest solution is so make them communicate through serial connection. Or SPI. Just divide the visualization part (so all the bitmaps and the screen driver) and the input/game logic part and make them communicate. Or, if you can, follow @Gerben 's advice and use an external EEPROM for the big amount of data (even if screen libraries are quite big sometimes).
Answer: Yes and no.
Yes you can make Arduinos communicate with each other and send messages to each other.
Can you use that to make a game?  Possibly.
Is it worth the effort?  No.
It would be a huge amount of work and be overly complex when you could just use a bigger Arduino, like a Mega2560 or a Due.
Answer: You can make quite an impressive game.

Features

Based on ATmega328P running at 16 Mhz (same as Arduino Uno).
The game has a display resolution of 104x80 with 256 colors.
Video mode is tile based and supports up to 3 sprites per scan line.
Sprites are multiplexed so there can be unlimited number of sprites vertically on the screen.
4 audio channels with triangle, pulse, sawtooth and noise waveforms.
Chiptune music playroutine and sound effects.
NES controller support.

Video of it in action:
https://www.youtube.com/watch?v=sLvgW_zb6bQ
Original post on the Arduino forum.

So, before you start wanting to connect lots of Arduinos together, investigate what can be achieved with just one. :)
The first thing to do, as others have mentioned, is to store static information into PROGMEM (see Putting constant data into program memory (PROGMEM) for more details).
If Petri Häkkinen can get his title screen, levels, sprites, music, and game logic into an Atmega328P you can too! Have fun!
Answer: You can have two Arduinos communicate with each other but it is fairly complex.  See this instructable.  One process is using the I2C protocol.
A far easier option is to use a larger Arduino model.  Consider the Mega 2560 since it has 8 times the Flash memory.
Comment: Instead of I2C use serial. Much faster and more lightweight.

How to have arduinos work together?


Security with Kernel IP Forwarding Enabled

Question: I recently enabled IP Forwarding on a production web server that also acts as a VPN server.  What, if any, security issues did I just set myself up for?  And are there any iptables rules I should set up to limit forwarding to my VPN tunnel?
Answer: You will only have security issues if your server gets compromised. Anyone/thing that gets into your server will have access to machines on your network, as if it was the server (your machines probably trust your server). You should definitely have some iptables rules! Basically you want iptables to block everything from the outside world to your firewall, except your webserver port(s) and VPN server port(s).
I would recommend something like shorewall http://www.shorewall.net/ to set this up for you, but some people think coming up with the iptables rules yourself if better since you'll understand more about what's going on.
Comment: I must say that the sentence *"You will only have security issues if your server gets compromised."* looks funny :)
Answer: You should definitely minimize any routing-capability of that server by using iptables (FORWARD).
Which VPN-server do you run? Do you have fixed addresses for your VPN-accounts?
I suppose you have basic knowledge how iptables should be called (what option/argument does what)?
Some example-rules might look like that, you have to replace XXXX and variables with sensible values fitting your setup:
<code>IPT=/usr/sbin/iptables
# deactivate FORWARD by default as you only want to grant access with a whitelist.
$IPT -P FORWARD DROP
# allow established connections
$IPT -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
# allow access to your VPN-server from the outside
$IPT -A INPUT -i $OUTER_INTERFACE -p XXXX --dport XXXX -j ACCEPT
# allow access to some host (-d)/protocol (-p)/destination port (--dport) from one VPN-account
$IPT -A FORWARD -i $VPN_INTERFACE -o $LAN_OR_OUTER_INTERFACE -s $IP_FROM_VPN -d $SOME_HOST -p XXXX --dport XXXX
# allow access from your LAN-network/-host to the VPN-clients
$IPT -A FORWARD -i $LAN_INTERFACE -o $VPN_INTERFACE -s $LAN_NET_OR_HOST -j ACCEPT
# allow access from the VPN to the WAN
$IPT -A FORWARD -i $VPN_INTERFACE -o $OUTER_INTERFACE -s $VPN_NET_OR_HOST -j ACCEPT
</code>


In M theory, what size are the branes/D branes?

Question: In string theory strings are around Planck length, but how big are the D branes in M theory? Can we see them with the LHC?
Comment: There are no actual strings in string theory, therefore they cannot be of any size. Same holds for the branes. They are artificial fields whose action onto some spaces give rise to a particle content in some specified ways.
Answer: It's not really true that strings are Planck length.  That's just the typical size of the low energy strings for which string perturbation theory works best.  Strings can be arbitrarily large, in principle.
Similarly, branes can be of arbitrary size.  They can wrap around compact dimensions, or fill all of space.


Pro licence error - Craft is unable to purchase an edition upgrade at this time

Question: I'm trying to purchase a pro license for Craft 2. The site was on a staging server which is now uploaded to the live server. At first, there were 2 warning messages. First saying running Craft Pro on Solo license. And another saying you are using a license belonging to the staging site.
I removed the license .key from the config folder and cleared the cache and this re-created the license and cleared the staging site message. However, when I go to purchase a pro license it goes through the fields and ends with a message.
Craft is unable to purchase an edition upgrade at this time.
Does anyone have any idea what is going on and how to resolve this? The site needs to go live today.
Cheers
Answer: According to their Tweet it seems there was an error on P&T's end:
https://twitter.com/CraftCMS/status/1085975322443448321


How to set the language for the user while it is created?

Question: How to set the language for a user while it is created from admin/people/create?
Answer: Actually it was a simple thing, just that I didn't enabled the language. So the steps are:

install and activate i18n module
go to admin/config/regional/language and add the languages you want
then in admin/people/create you will have a language selector.
Answer: Drupal 7 doesn't need third-party modules to have a language selector for user profiles.

Enable the Local module.
Enable one or more languages in /admin/config/regional/language; the settings page initially shows only English, generally. It would show another language if Drupal has been installed using a different language.
When you now edit a user profile, you can set the language associated with the user by choosing between the languages you enabled.
Comment: True. I was thinking in my case because I am using it.


how to dynamically get icon of the files using file extension

Question: Is there any way to dynamically get the icon of the files using its extensions in Sharepoint SPFX?
Thanks in Advance!
Answer: You can use approaches like SP.Web.mapToIcon as Rob says (as a general rule, you should always listen to what Rob says!), but if you simply want to render a file icon, you can use the PnP React Reusable Controls; There is a FileTypeIcon control which does all the hard work for you.
After you install the control in your SPFx project (using npm install @pnp/spfx-controls-react --save --save-exact)
In your code, you need to import the control:
import { FileTypeIcon, ApplicationType, IconType, ImageSize } from "@pnp/spfx-controls-react/lib/FileTypeIcon";

And then place the controls where you'd like to display them, passing the filename as a parameter:
/* Showing the icons font */
<FileTypeIcon type={IconType.font} path="https://contoso.sharepoint.com/documents/filename.docx" />
<FileTypeIcon type={IconType.font} path="https://contoso.sharepoint.com/documents/filename.xslx" />

/* Showing the icon image */
<FileTypeIcon type={IconType.image} path="https://contoso.sharepoint.com/documents/filename.docx" />

/* Icon image allows three different sizes */
<FileTypeIcon type={IconType.image} size={ImageSize.small} application={ApplicationType.Excel} />
<FileTypeIcon type={IconType.image} size={ImageSize.medium} application={ApplicationType.Excel} />
<FileTypeIcon type={IconType.image} size={ImageSize.large} application={ApplicationType.Excel} />

For more information, take a look at https://pnp.github.io/sp-dev-fx-controls-react/controls/FileTypeIcon/
I hope this helps?
Answer: You can use the SP.Web.mapToIcon method to map a file name to an icon. To use it from SPFx, you would make a REST API call to /_api/web/maptoicon(filename, progid, size).
An example call would be /_api/web/maptoicon(filename='filename.pdf', progid='', size='0').
Here are some additional resources that may help you.
SP.Web.mapToIcon Method
Getting the default document icon using Office 365 SharePoint REST API


How to return only the person names who belong to a group?

Question: I could classify words in all sentences in a text file as PERSON, LOCATION, ORGANIZATION etc. using Stanford's Named Entity Recognition. But how to extract names of a specific group of persons (eg: All borrowers names)?
Comment: You may need to tell us more about your setup and environment. Also, we don't deliver answers "ASAP"; due to the very nature of Stack Exchange, sometimes the best answer come months or years after the question was asked.
Comment: I've some text files from which I've to extract only "borrower names" from all sentences.

Ex:
Credit Agreement
Dated as of July 1, 2017
among
Hub Group, Inc. and
Hub City Terminals, Inc.,
as Borrowers,
........

I'm using Stanford's NER jar and classifiers in Java to classify all person names as "PERSON". I have to extract only borrower details from all other names
Answer: You are looking for Knowledge Extraction, a task that goes far beyond Named Entity Recognition. It is an area of ongoing research, don't expect ready-made tools for this right now.
Comment: Oh okay. Thanks for your clarification. I'm a student experimenting on NLP.