Is there a way to coerce Axis1 to produce document literal WSDLs and SOAP?

Question: I use Apache Axis 1 to serve web services, which automatically converts Java objects into wsdl definitions and soap responses. However it seems that by default Axis serves rpc encoded data by default. Is there a way to coerce it into serving wrapped document literal data instead?
So far the documentation has not helped me much. My service declaration looks like this:
<service name="myservice" provider="java:RPC" use="literal" style="wrapped">

  <parameter name="wsdlTargetNamespace" value="http://www.acme.com/"/>
  <parameter name="className" value="com.acme.MyService" />

  <operation name="doSomething" returnQName="acme:Response">
    <documentation>Does something.</documentation>
    <fault name="MyException" type="acme:MyException" class="com.acme.MyException" />
  </operation>
</service>

Apparently I need to declare fault to get Exceptions working almost properly. (See this post for dealing with custom exceptions.)
However, this still does not work and will give me an exception as-is. I've discovered that I need to add this static method to each of my objects:
public static void registerTypeMapping(Call call) {
  final String WSDL_TARGET_NAMESPACE = "http://www.acme.com/";
  final QName QNAME = new QName(WSDL_TARGET_NAMESPACE);
  call.registerTypeMapping(Reponse.class, QNAME,
      new BeanSerializerFactory(Response.class, QNAME),
      new BeanDeserializerFactory(Response.class, QNAME));
}

This makes the exceptions go away which is not really a good thing because now nothing happens. I do not receive any XML responses from my service after making these changes. Besides that even if this worked it sucks to add weird static methods to all of my objects.
Am I missing anything? What do I really need do to get proper wrapped document literal support out of Axis 1?
Answer: Here is the related part from the Axis 1.x documentation that may be helpful:
Service Styles - RPC, Document, Wrapped, and Message


Is there a way to disable upgraded special agents?

Question: I recently used enough Banana Farmers to unlock their Pro variant, and I realized I do not like it. After running into some issues with it, is there a way to purchase normal Banana Farmers, instead of the Pro variant?
Answer: Unfortunately, no. Once you unlock the Pro Agents, they will remain the Pro variant for as long as you don't reset your progress.
The purpose of the Pro Agents is to provide a more useful alternative to each agent as a sort of reward for purchasing 50 of the same agent collectively. I guess if the Pro Farmer is causing you problems the only option is to keep the farmer out of reach from the track or close to the exit if possible.
Comment: Yeah, I started placing them in better locations. I just gotta relearn my patterns and such.
Answer: No, you cannot buy normal agents after having them as pro agents.
Comment: -1 this doesn't answer the question
Comment: You said 'you should be able to...but if not then no', certainly how I would interpret that would be 'You should be able to, that would be the best game design, but if you can't then you can't'
Comment: I agree with @DJSpicyDeluxe. You seem to be giving two contradictory statements about the same topic.


Sky from Equator at 8,000 years Before Present?

Question: The Stellarium software allows future views of the sky. I need an online resource (planetarium projector?) that shows pre-historical views, and from the Equator at 8,000 years before the present.
Answer: You can equally well just type in a negative year and Stellarium will navigate you into the corresponding year B.C. Don't forget that the year 0 didn't exist. 1 A.D. follows directly after 1 B.C.
A while ago I've confirmed that Stellarium is very accurate down to 1500 B.C. using a babylonian list of lunar occultations of stars. Thus, it should be reasonably accurate for the year 6000 B.C. as well.
Comment: Actually in Stellarium there is a year zero. 0 = 1 B.C., -1 = 2 B.C., -3 = 3 B.C. and so on. It's a very important distinction if you're trying to find something on a precise year like an eclipse.
Comment: @called2voyage: Yes, I had trouble with that as well. At first I thought Stellarium isn't that accurate at all, until I remembered that one year shift.


How do i disable unhiding columns in Excel using VBA?

Question: I have a number of columns hidden in Excel and would like to prevent users from using the format control option as well as context menu from unhiding these columns. How can i do so with VBA?
Comment: Why do you need to use VBA?  The built in sheet protection features of Excel should prevent this when done correctly?
Comment: @psubsee2003 - It doesn't work as intended. I am still able to unhide the columns
Comment: You may want to elaborate why this isn't working for you.  I am able to prevent unhiding via the context menu and the format menu without resorting to VBA.
Comment: @psubsee2003 - That's exactly the issue i am having because i want to be prevent unhiding columns but not restrict them to formatting other columns.
Comment: That probably should have been included in your question then as that is important to answering the question in my opinion.
Answer: In terms of actually preventing users from unhiding columns via the menu options, ultimately the options in VBA are limited as VBA doesn't have any special magic.  It would be utilizing the exact same functionality as you are using in the Excel application, so the same limitations that you are finding in using the Sheet protection features will be the same in a VBA solution.
There may be some VBA-like solutions that could give you close to what you need, but they won't be perfect and would be very easily defeated by simply disabling macros, rendering your security measures completely ineffective.

One option is to rehide the column anytime the selection changes, however this won't prevent  user from selecting the entire column and unhiding the row, but as soon as they select a cell, it will be hidden again.  you can prevent someone from selecting the cell by locking only the cells in this column and protecting the sheet to prevent selection of locked cells.  You won't stop anyone from unhiding and seeing the data, but you will prevent them from modifying the data and will make it difficult to see the specific formulas.
The code to do that is here and goes in the Worksheet code section (where you capture worksheet events)
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    Columns("F").EntireColumn.Hidden = True

End Sub

Another option would to disable the appropriate menu options in the Workbook, but this doesn't remove the functionality, just makes it more difficult to access.
The code to do that is here and goes in the Workbook code section (where you capture Workbook-level events)
Private Sub Workbook_BeforeClose(Cancel As Boolean)

    //Re-enable in Column Context Menu
    Application.CommandBars("Column").Controls("Unhide").Enabled = True

    //Re-enable in Ribbon Format menu
    Application.CommandBars("Format").Controls("???").Enabled = True

End Sub

Private Sub Workbook_Open()

    //Disable in Column Context Menu
    Application.CommandBars("Column").Controls("Unhide").Enabled = False

    //Disable in Ribbon Format menu
    Application.CommandBars("Format").Controls("???").Enabled = True

End Sub

I haven't found the right combination of Menu/Submenu items to disable to menu item from the "Format" menu (hence the "???"), but you would need to do it there as well.  Being a macro solution, you are still dependent on someone enabling macros when opening the Workbook.  Plus you are physically disabling the menu item so you remove the ability to selection those options for any other sheet in the workbook and any other open workbook, not just the specific columns you want.
This is also very version dependent I've found in the past, as menu options have changed in versions of Excel, so what worked in Excel 2007 or 2010, may not work the same in 2013, which means you now need to include a version check in the code and enabled/disable based on the appropriate names for the specific verson.
Additionally, if Excel crashes and the BeforeClose code does not run, you may not get the menu options re-enabled correctly.

Ultimately, the best fail safe is not to hide the columns and to move any sensitive information and formulas into another sheet, which you can then hide via VBA to make it almost invisible from the Excel application.
From the Visual Basic Editor, click on a sheet in the Project pane, then from the property pane below, click Visible and change the option to xlSheetVeryHidden

The sheet will now be hidden but will not be visible from the Sheet/Unhide menu, and will only be accessible from the Visual Basic editor (where you have to unhide it again to see it).  The best part of this solution is, while it is only accessible from the Visual Basic editor, it is NOT a VBA solution, so will not depend on someone enabling macros to function.
Answer: Once the columns are hidden protect the sheet and ensure that Format Cells/Rows/Columns are not ticked in the Protect Sheet dialog box.
Comment: Thanks. That assumes i don't want the ability to format the cells, rows or columns of existing unhidden columns.
Answer: Just hide the headings, and that makes it harder to unhide the columns


Ubuntu asks to upgrade from 13.04 to 13.10 every 5 mins, how to stop that?

Question: I've clicked don't upgrade, I've clicked any possible button, but I still get that annoying modal box asking me to upgrade. How do I stop it?
Answer: Go to "Software & Updates" > "Updates" > "Notify me of a new Ubuntu version" > Set it to "Never"
Answer: Just follow these steps to stop that annoying message.

Execute following command to open Software Sources in terminal
sudo software-properties-gtk

Go to Updates tab and uncheck all four checkboxes their. and select Never for Automatically check for updates: option.  Unchecking the checkboxes would be optional
Close the window.
Execute this command to update the repository:
sudo apt-get update

After that you'll not get any message. If you want to get again such message just follow the same procedure and do the opposite.

Hope this short description help you.. Reply if you need any further assistance..
Comment: But this will disable any notification of new updates for all of his software. If he just wants to get rid of the 13.10 update, but still want notifications on other software he should only uncheck the auto update for new Ubuntu versions.
Comment: @AsgerBjørnJørgensen I just realized after posting my answer, and Updated my answer.. Reply if still something missing.


Sub panel supplied by two different lines from main panel

Question: I looked but couldn't find this asked already.
I found a sub panel in the crawl space of my home.  It looks to supply an upstairs addition.
It has 2 different 14/2 cables going into it from the main panel, each on a 15 amp breaker.
Inside the sub panel are a 15 and 20 amp breaker, with the 20 amp connected to 12/2 running up to the addition and 14/2 on the 15 amp.
My best guess is this was done to get 20 amps up to the bathroom by "splitting" the current over the 2 lines supplying the sub panel.
Is this even legal?
I could probably replace the existing 14/2 going into the sub panel with 12/2, but I'm not sure that is an acceptable solution.
Comment: Can you post a picture of the main panel and the subpanel?
Comment: #14 feeder should not be supplying a subpanel, since it's only good for 15A and that is pointless.  It cannot power anything 20A.  The usual purpose of using dual /2 is to bring up both legs of hot and also neutral, this is the wrong way to do that.  If you replace it, use something like 10/3.  The 10 solves the ampacity problem and the /3 solves the split-cables problem.
Comment: In addition, most jurisdictions do not allow panels, sub or not, to be located in areas with restricted access like a crawl space. So you cannot legally do anything to that because it is an illegal installation to start with.
Comment: Can you post photos of the main panel and the subpanel?
Answer: Either it's 120V subpanel and he's plain paralleling... which is rather bad.
Or it's a 240V panel, and he's supplying hot/neutral/ground with one cable and the other hot with the other cable.  That's a different kind of bad.
Both are unacceptable.  You should replace both cables with a single /3 cable:

4/3 Aluminum or 6/3 Copper if you want 60A in this subpanel
8/3 Copper if you want 40A
10/3 if you want 30A
12/3 if you want 20A
14/3 if you want 15A, but this is fairly pointless.

And, both hot wires need to land on a 2-pole breaker which has common trip, meaning both legs trip together, and, move either handle, the other goes too.

Note that a duplex/tandem/twin/double-stuff has independent handles and must not be used, as it will create a dangerous situation if you do.


Exon skipping in mammals

Question: I've heard from several sources that the predominant form of alternative splicing (at least in mammals) is exon skipping. However, my personal evidence is only anecdotal: I've heard it and read it, but have not seen references to literature. Is there a seminal paper or set of papers establishing this finding that I can cite?
Answer: You can see this review.

There are several different types of alternative splicing (AS) events,
  which can be classified into four main subgroups. The first type is
  exon skipping, in which a type of exon known as a cassette exon is
  spliced out of the transcript together with its flanking introns (see
  the figure, part a). Exon skipping accounts for nearly 40% of AS
  events in higher eukaryotes [17, 111] but is extremely rare in lower
  eukaryotes.

Exon skipping in mammals


Getting a List of Currently Available Roles on a WordPress Site?

Question: When writing WordPress plugins there is often a need to set up options for which roles on the site have access to certain functionality or content. To do this a plugin dev needs to fetch the list of roles that exist on the site to use in the option. Because custom roles can be created we cannot assume the default roles are the only ones available.
What is the best way to fetch the list?
Comment: Note: This question was originally asked by Ryan Bilesky on the wp-hackers mailing list and answered by me. I added it here because it's a clear case of best-practice question that people might ask google :)
Comment: Hey *@Jeremy Clarke* - Really glad to have your participation here and these are exactly the types of things we are looking for here; answers related to common questions that can also reveal best practices. Kudos!
Answer: Roles are stored in the global variable $wp_roles.
The ideal function is get_editable_roles() from /wp-admin/includes/user.php
function get_editable_roles() {
    global $wp_roles;

    $all_roles = $wp_roles->roles;
    $editable_roles = apply_filters('editable_roles', $all_roles);

    return $editable_roles;
}

The "editable" part is because it offers other plugins a chance to filter the list in case someone other than admin has 'edit_users' privilege (and thus 'admin' needs to be removed from the list, else that user could make themselves admin). Role management plugins used to create custom roles are the ones that would be using that filter. Otherwise this function is essentially get_roles() (which doesn't exist).
Presumably your plugin will only offer the settings page in question to someone who has admin-level capabilities like 'manage_options' and is basically an admin with access to all roles, so the filter shouldn't affect you.
There is also wp_dropdown_roles() which gives you the roles as <option> fields for a <select> list (though checkboxes are likely to work better in many scenarios where you're choosing who has access to something).
Comment: Note: I created this function as part of a patch to make WP more secure, so I'm biased in its favor ;)
Comment: I'm not sure if this is the best solution to the question, as according to the documentation, `get_editable_roles()` retrieves a filtered list of user roles that the **current user is allowed to edit**. Maybe `wp_roles()` would be a better choice. Please, check [my answer](https://wordpress.stackexchange.com/a/405185/25264).
Comment: Pablo's or Rarst answer are the correct ones. This answer will only show all users *if you have access to editing all user roles*.
Answer: Try this:
function get_role_names() {

global $wp_roles;

if ( ! isset( $wp_roles ) )
    $wp_roles = new WP_Roles();

return $wp_roles->get_names();
}

PS heh, missed that explanation and reply, too fast me :)
Answer: For those which have multilingual site, function
function wp_roles_array() {
    $editable_roles = get_editable_roles();
    foreach ($editable_roles as $role => $details) {
        $sub['role'] = esc_attr($role);
        $sub['name'] = translate_user_role($details['name']);
        $roles[] = $sub;
    }
    return $roles;
}

returns localized array like this (role names are in Slovak language):
Array
(
    [0] => Array
        (
            [role] => administrator
            [name] => Administrátor
        )

    [1] => Array
        (
            [role] => editor
            [name] => Editor
        )

    [2] => Array
        (
            [role] => author
            [name] => Autor
        )

    [3] => Array
        (
            [role] => contributor
            [name] => Prispievateľ
        )
)

Answer: This is how to get an array of all the existing user roles, and the capabilities for each role, in WordPress. If you don't want to print it to the screen, omit the last line. The $roles variable on line 2 will hold the array of users and capabilities so that you can use it however you need to. See below for an example of the returned array.
global $wp_roles;
$roles = $wp_roles->roles;

// print it to the screen
echo '
' . print_r( $roles, true ) . '
';

Answer: I'm not sure if the accepted answer is the best solution to the question, as according to the documentation, get_editable_roles() retrieves a filtered list of user roles that the current user is allowed to edit.
Maybe we just need to use wp_roles(). It retrieves the global WP_Roles instance and instantiates it if necessary. And if you just want an array with the roles ids as keys and names as values you can do this:
$roles = wp_roles()->get_names();

Answer: Here is how you can find the list of roles without any plugins or function
http://screencast.com/t/uaWsGLAR3Sh
Comment: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.


Does morality apply to an individual's behaviour alone or does it also include those of a group taken as one entity?

Question: If it should also apply to groups, I am wondering if it's possible to act morally within the group yet have an immoral group response. I assume this is possible, but then working it backwards seems tricky: i.e. how would a group with an immoral group response whereby every member acted morally correct itself into acting morally the next time?
Comment: Killing is legal in war but not in daily life. So killing is regarded as moral when done by governments. Are you asking whether this happens? Or are you asking whether it *should* happen? In other words, is war immoral if killing is?
Comment: Does legal imply moral? I'm asking if the moral code book is applied to the group in the same manner as to the individual. From your example the answer is no. Killing by governments is not viewed as moral when you have protesting members of society. I'm not asking any of the questions you listed. This moral stuff seems too brittle/outdated to be of any practical appeal.
Answer: As far as violating codes goes though, it matters what kind of code it is and I think that that should be noted. If violation of the law or code is malum in se (or wrong in and of itself based on individual belief) then that is when the reality of the group is dissolved as there can be no union if individuals are divided from one another.
However, if the violation is only determined as being wrong by the group, and any violation of the "code" is not a violation of individual beliefs, only group beliefs, then the group would not really dissolve as the individuals themselves are not yet divided.
One final note, an individual or even multiple individuals can be severed from a group, and yet the entirety of the group can retain its solidity though some members no  longer are really a part of the group.
Answer: This is a great question which calls into discussion the nature of groups at all.
Systems are only organic ( natural and legitimately being ) if they are emergences. Morality only applies to groups, Ethics apply to individuals. The "moral code book" is only applicable to groups.
So the situation is: can individuals act ethically, and the group behave immorally? Yes.
However, in this case, the system is not longer emergent at that point, so in reality: No.
This is similar to corporate law. If I incorporate a legal entity and work within the law, which is what makes the corporation legitimate, the corporation shields me from liability, and it directly "is." However if I violate my own bylaws and further distort the statutes which give corporations legal validity, it is not only that the corporation is in violation, it legally does not exist. Courts ( moral contexts ) will not grant the "being" of a corporation because its "being" is not in effect. Therefore the actions taken are my actions only, I am liable, and the entity is not even there in the situation, it is a non-entity.
Trying to pry my self out of the metaphor here and return to the point: If the group behaves immorally by the ethical moves of its individuals, the group itself is not in existence any longer. It is now an illusory body which is not emergent, but divergent from the reality around it. It is a phantom. And not even in the way a cancer is not an organ of a body, or how a dream is not waking experience. Both those realities are more real than a group which is not emergent. A group which is not emergent is actually a force of will, it is a deception. It is an imposition of one group on another, even if that entails sub-groups having a war within one group ( which is not actually one group any longer ). So, the answer to your question is that when the group behaves immorally by the ethical moves of its individuals, the group no longer "is."
Comment: Thanks, this was an enlightening answer for me. I wonder if you can elaborate a little on this "A group which is not emergent is actually a force of will, it is a deception. It is an imposition of one group on another,"
Comment: Thanks @val, I am almost back to elaborate further and have not forgotten.


Actionscript 2.0: Where can I place a class instance so that I can access it from other classes?

Question: I currently have three classes, Main, Externals, and Page.
The Main class creates an instance of the Externals class, which loads XML, and, once the XML is loaded, that Externals instance also creates an instance of the Page class which will then use information from the Externals class to populate itself.
I originally wanted Externals to be a static class, then I found out that there are no static classes in Actionscript 2.0, only static methods.
Then I declared all my Externals methods as static, but found that when I tried to access them, the constructor was not run, and the XML was not loaded and parsed. I thought about rewriting the methods to load and parse the XML every time, but realized that A: that would be really wasteful of network resources; and B: since the network is slower than the processor, I would run into timing issues, as the code would try to access data that wasn't yet loaded.
So then I decided to revert everything to instance methods and create an instance in the Main class that would run its constructor, load itself up with XML, parse everything into neat getters, and only then, create an instance of Page, which creates the page that will consume the XML data.
But I was (and still am) left with a conundrum: I can only create the instance of the Page class from inside the Externals class, because it can only start AFTER the XML data has already been loaded, but I can't access the data that I've gathered into my instance of Externals from anywhere but the Main class. The only way for me to get at it in my instance of Page is to create a new instance, but this is a very bad idea for two reasons: 1: the above-mentioned timing issues; and 2: the Externals class creates a new Page when it finishes loading the XML, so it ends up making a new Page instance, which makes a new Externals instance, which makes a new Page instance, and so on.
I tried placing the instance of Externals on the movie's root like this:
<code>_root.externals:Externals = new Externals();
</code>
but I couldn't access it there either.
Now I'm a bit stumped. I really don't understand how this can be done, but I know that there has to be a way. Does anybody see what I am doing wrong here?
Answer: I suppose you can try Singleton design pattern: http://voices.yahoo.com/building-singleton-actionscript-2-as2-4849702.html
Answer: I am guessing the Externals class is a singleton? You could just pass in a reference of the one Externals object to all your other objects.
Or another way (though I don't always recommend it, but seems like what you are leaning to do) is to create the object at the root level like normal, then access it in your other objects by going: _root.externalsObject


Is there a VIM plugin that lets you google the selected text?

Question: I want to be able to select a text and have a command to open a google search in a browser.
Right now, I"m just copying and pasting. Are there any plugins that do this? I'm using Mac OSX.
Answer: Why not use:
xnoremap <f1> "zy:!firefox "http://www.google.com/search?q=<c-r>=substitute(@z,' ','%20','g')<cr>"<return>gv

?
(as you are a mac user, you might replace firefox with another browser!)
Note that if your word contains & or # you might have to escape them as well as %26 and %23.
Comment: what does the zy part of the text do?
Comment: It is not `zy` but `"zy`. `"z` selects the z register for yanking your text, which is then available by either the variable `@z` or `getreg('z')`.
Answer: I wrote this in about 5 minutes when I read your question, but it works on Linux anyway. Of course, change "firefox" to the command for your favorite browser, and change <F6> to whatever key or key combination you want to do this.
function! GoogleSearch()
     let searchterm = getreg("g")
     silent! exec "silent! !firefox \"http://google.com/search?q=" . searchterm . "\" &"
endfunction
vnoremap <F6> "gy<Esc>:call GoogleSearch()<CR>

This uses the g register, so don't use the g register for anything you don't want overwritten by calling this command. I haven't tested it much either.
It's possible that for a mac, the third line would need to be changed slightly:
silent! exec "silent! !firefox \"http://google.com/search?q=" . searchterm . "\""
but without a mac to test on, I don't know.
Comment: Missed Benoit's command, which is more or less the same thing.
Comment: You have the clarity, I have the conciseness (and maybe space escaping, but I forgot to escape &'s and #'s as well.
Comment: Good point. How about adding `let searchterm = shellescape(searchterm)`" between lines 2 and 3 of mine?
Answer: Expanding on frabjous's idea because the function as it was blacked my screen and printed "Created new window in existing browser session" in the middle (which is the terminal output from running google-chrome directly).
function! GoogleSearch()
  " Now with > /dev/null to prevent writing to the screen
  silent! exec "silent! !google-chrome \"http://google.com/search?q=" . @g . "\" > /dev/null"
  " Without this, vim goes blank
  redraw!
endfunction
vnoremap <F6> "gy<Esc>:call GoogleSearch()<CR>
" Added this to google the word under the cursor
nnoremap <leader>goo b"gye:call GoogleSearch()<CR>

Answer: My first spontaneous thought was Urxvt's Perl capabilities. If you used that terminal emulator, it would be easy to make any text googleable (that's how I would have solved it if I wanted the function since I already use Urxvt). This wouldn't work with GVim, however.
My second spontaneous thought is that Vim is open source, and thus it should be possible to customize GVim to do this. More or less work craving though, probably there are better solutions.
Answer: If you switch firefox in the above commands with open this will work with whatever your default browser is set to. As long as you are on OS X.
Answer:
Are there any plugins that do this?

Yes, https://github.com/szw/vim-g.
Answer: Thanks for all the help everybody. I put this together based on everything here (and fixed a bunch of bugs). It works in nvim, but I don't see why it wouldn't work in regular vim.
I use these keymaps:
" google the word under the cursor
nmap <silent> <leader>gg "gyiw:call GoogleSearch()<CR>

" google the visual selection
vmap <silent> <leader>gg "gy:call GoogleSearch()<CR>

with this code:
" http://www.danielbigham.ca/cgi-bin/document.pl?mode=Display&DocumentID=1053
" URL encode a string. ie. Percent-encode characters as necessary.
function! UrlEncode(string)

    let result = ""

    let characters = split(a:string, '.\zs')
    for character in characters
        if character == " "
            let result = result . "+"
        elseif CharacterRequiresUrlEncoding(character)
            let i = 0
            while i < strlen(character)
                let byte = strpart(character, i, 1)
                let decimal = char2nr(byte)
                let result = result . "%" . printf("%02x", decimal)
                let i += 1
            endwhile
        else
            let result = result . character
        endif
    endfor

    return result

endfunction

" Returns 1 if the given character should be percent-encoded in a URL encoded
" string.
function! CharacterRequiresUrlEncoding(character)

    let ascii_code = char2nr(a:character)
    if ascii_code >= 48 && ascii_code <= 57
        return 0
    elseif ascii_code >= 65 && ascii_code <= 90
        return 0
    elseif ascii_code >= 97 && ascii_code <= 122
        return 0
    elseif a:character == "-" || a:character == "_" || a:character == "." || a:character == "~"
        return 0
    endif

    return 1

endfunction

function! GoogleSearch()
   let searchterm = getreg("g")
   let searchterm = substitute(searchterm, "\n", " ", "g")
   let searchterm = UrlEncode(searchterm)
   let searchterm = shellescape(searchterm, 1)
   " echo "searchterm: " . searchterm
   silent! exec "!open 'https://google.com/search?q=" . searchterm . "'"
   " exec "!echo 'https://google.com/search?q=" . searchterm . "'"
   " redraw!
endfunction


Trying to change the color scheme through the css file, but no permission

Question: I have been trying to switch out the orange color scheme in Ubuntu 11.10 through the css files. I know where the files are and what I need to change in them, but every time i try to save it it says that I can not since I don't have permission. Is there a way to get permission?
I am using Bluefish editor fyi.
Answer: To put it bluntly, you're doing it wrong.
You need to copy the GTK theme into /home/yourname/.themes/
Then you should be able to edit it, rename it and then select it in the appearance settings.
Related question.
Answer: Try editing as root. The easiest way to do that is in the command line, so start by going to the folder where the files are:
user@localhost:~$ cd /path/to/files

(don't forget you can press tab to complete long or complex names!)
Then load up your editor of choice. I assume that bluefish loads with 'bluefish' but if not, try tab-completion to find what the name of it is:
user@localhost:/path/to/files$ gksu bluefish style.css

It will prompt you for your password then, hopefully, run bluefish as superuser with the ability to make changes to the file.
THAT SAID, consider what jrg said, as if you have to go in as superuser to change a user setting, there's probably something you're not quite doing right.


Your criteria in using a new technology or programming language

Question: What are your criteria or things that you consider when you are an early adopter of a programming language or technology?
Two of the most common explanations I've heard are:

It should be "fun" (what I've heard from technical people).
It should be capable of solving our problem (what I've heard from business people).

So what's yours?
Answer: I've made this change several times over my career spanning various companies, moving from C to Java to Ruby to Haskell for the majority of my software development.
In all cases, I've been looking for more expressive power and better abstractions. This is always driven by business needs: how can I develop better software more cheaply? To me, the challenge of this problem is "fun," so fun rather automatically comes along with it. Justifying the business value to managers can be difficult, however; they often don't have the technical skills to understand why one programming language can be better than another, and are worried about moving to technology that they understand even less than the current one. (I solved this problem by taking over the manager's job as well: I started a company.)
It's hard to say what exactly to look for in a new language. You obviously don't have a detailed grasp of the language, or you would already be using it or know why you're not. Vast experience will bring an instinct that will make certain languages "smell" better than others, but—and this can make it especially hard to convince others to look at a new language—you won't know precisely what features give you big advantages. An example would be pattern matching: it's a feature found in relatively few languages, and though I knew about it, I had no idea when I started in with Haskell that this would be a key contributor to productivity improvement.
While it's negative ("avoid this") advice rather than positive ("do this") advice, one fairly easy rule is to avoid spending a lot of time on languages very similar to ones you already know well. If you already know Ruby, learning Python is not likely to teach you much in the way of big new things; C# and Java would be another example. (Although C# is starting to get a few interesting features that Java doesn't have.)
Looking at what the academic community is doing with a language may be helpful. If it's a fertile area of research for academics, there's almost certainly going to be interesting stuff in there, whereas if it's not it's quite possible that there's nothing interesting there to learn.
Answer: My criteria is simple:

wow factor
simple
gets things done
quick
Answer: I want it to do something easily that is hard to do with the tools I'm used to.  So I moved to Python, and then Ruby, over Java because I could build a program incrementally, add functions easily, and express programs more concisely (esp. with Ruby, where I can pass blocks/Procs and have clean closures, plus the ability to define nice DSLs making use of blocks and yield.)
I took up Erlang because it expresses Actor-based concurrency well; this makes for easier network programs.
I took up Haskell because it fit with a number of formal methods tools I wanted to experiment with.
Answer:
Open source.
Active developer community
Active user community, with a friendly mailing list or forum.
Some examples and documentation, preferably a tutorial
Desirable features (solves problems).
Answer: If it's for my personal fun, I need very little excuse, as I do love learning new things, and the best way of learning is by doing. If it's for an employer, customer, or client, the bar is MUCH higher -- I must be convinced that the "new stuff", even after accounting for ramp-up effects and the costs that come with being at the bleeding edge, will do a substantially better job at delivering value to the client (or customer or employer). It's a matter of professional attitude: my job's to deliver top value to the client -- having fun while so doing is auxiliary and secondary. So, in practice, "new" technologies (including languages) that I introduce in a professional setting will generally be ones I've previously grown comfortable and confident with in my own spare time.
Answer: Someone has once said something to the effect of:
"If learning a programming language doesn't change the way you think about programming, it's not worth learning."
That's one metric (out of many) to judge the value of learning new languages (or other technology) by.  Using this, one might suggest learning the following languages:

C, because it makes you understand the Von Neumann architecture better than any other language (and it's sort-of random-access Turing Machine like, sorta'...).
LaTeX (as a programming language, not only as a typesetting system) because it makes you learn about string rewriting systems as a model of computation.  Here, sed is similar; learn both, because they're also both useful tools :-)
Haskell, because it teaches you about functional programming, lambda calculus (yet another model of computation), lazy evaluation, type inference, algebraic datatypes (done with ease), decidability of type systems (i.e. learn to fear C++)
Scheme `(or (another) ,Lisp) for its macro system, and dynamic typing, and functional programming done somewhat differently.
SmallTalk, to learn Object-orientation (so I hear)
Java, to learn what earning money feels like :D
Forth, because wisdom bestowed forth learned implies.

... that doesn't explain why I learn python or shell scripting, though.  I think you should take enlightenment with a grain of salt and a shovelful of pragmatism :)
Answer:
Should be capable of solving the problem
Should be more adequate to solve the problem than other alternatives
Should be fun
Should have prompt support, either from a community or the company promoting it
Answer: A language should be:

Easy to use, to learn and to code in.
Consistent. Many languages have 50 legacy ways of doing things, this increases the learning curve and turns quite annoying. C# for me is one of those languages.
It should provide the most useful solution with the least amount of code. On the other hand sometimes you do need a bit of expressiveness to make sure you're not making a huge mistake.
The right tool for the right job and maybe the right tool for any job
Answer: My criteria that the language should have:
1.  New ideas - If the language is just another Scheme variant, if you know one than I don't feel the need to learn this new one.  I will learn it if I think I will learn something new.
2.  Similar to another language, but better.  For example, while Java and C++ have many of the same ideas, Java's automatic garbage collection makes it a better choice in many cases.
Answer:
Gets the most done with the least amount of effort
Extremely interoperable with different protocols, out of the box
Fast
Has lots of libraries built in for stuff 99% of web developers do (PDF's, emailing, reporting, etc..)
Answer: It depends on why I'm learning the new language.  If I'm learning it for fun, then it has to meet these criteria:

Is well it supported on my platform?
Something that runs only on Linux
isn't interesting to a Windows
programmer.
Will I learn something new?  In
other words, does it come up with a
new way of doing things?
Does it look fun?  I don't want to learn Ada even if it has new ways of doing things.

If I'm learning it for work, the criteria are different:

How mature is it?  Has it been
proven to work in the real world?
How big is the community?
Will it make my job easier?  I.e. is
it worth the time investment versus
just doing the task with a language
I already know.


What's the max RAM my computer will take?

Question: I have an Asus 1005HAB RBLU005S and need to add more memory. What's the max RAM it will take?
Comment: It sounds like you have a number of questions: what is the max RAM, the ins&outs of an SSD, how to speed up a slow computer. Each should be a separate question. However, the SSD question is too broad. Super User focuses on specific questions rather than general learning on a topic. How to speed up a slow computer is also very broad because everything affects its speed.  If you use the search box at the top and look up slow computer, there are over 1400 answers.  This one will get you started: http://superuser.com/questions/404617/what-is-the-proper-way-of-debugging-a-slow-windows-installation.
Comment: I edited your question to focus on the main issue.  Please ask additional, specific questions you may have on the other topics after doing a little reading.
Answer: Officially, the Asus eeePC line (which I believe that product number refers to) take up to 2GB RAM.
Answer: Provided you're running Windows I would go to the crucial website and use their free memory compatibility tool. It's a good download with no viruses or anything.  It doesn't install, it's just a temporary exe. The tool tells you system information. It tells you hard drives and how much ram you have and how much you can have and in which slots. I use it when friends ask me this question.

What’s the max RAM my computer will take?


detecting changes in a mysql database

Question: I have someone else's code and also a db. To understand the code, I want to see that If I run a particular php process, which tables are updated in the db. Something like I start a listner and then carry out the process. After that the listner will show me a list of changes that happened in the database. Is this possible?
Note: As I understand, mysql TRIGGER does something similar but it is for a specific table and also on trigger adds rows to another table. I just want a change log sort of a thing. Thanks in advance.
Answer: You could use logging - turn it on, run the code, turn it off, then review the log file.
This article talks you through how to do this:
http://www.howtogeek.com/howto/database/monitor-all-sql-queries-in-mysql/

detecting changes in a mysql database


Samba - WebDAV - SFTP

Question: I have an external online space and I can access the disk with SFTP, Samba or WebDAV. Which of these methods are the most secure? I am planning to copy about 200MB of data per day.
Comment: Define "most secure"?
Answer: SFTP is secure as underlying SSH, which is usually good, if the implementation is reasonable and proper cipherset is chosen.  If you don't go down to version 1, you are usually good.
WebDAV can be using TLS (over HTTP), which had several flaws and you can use some broken versions. But also depends on configuration.
Samba can use encryption since version 3.3. But also it does not have to.
This is really broad, opinion based and you didn't specify the most of the important variables. I would choose sftp for world-wild-web.
Comment: Alternatively, if you have a weak password for your sftp user, it will (by default) expose the whole folder structure of your server, as readable by that user, to anyone who logs in. If your WebDAV server is misconfigured, anyone can modify the uploaded contents. And various versions of Samba provide all kinds of ways into servers for malicious people.
Comment: @Matthew Yes, you are right. You can set up weak password everywhere, but since there is selection between these three in one place, I believe there will be some shared password and if you set it week, you break all of the services. If you have got notes to WebDav/Samba where I am not so knowledgeable, feel free to update the answer.

Samba - WebDAV - SFTP


Adding Windows 8 on Windows 7 PC's 2nd HD

Question: If I install a new HD with the intention of of installing Windows 8, how would I be able to boot to the OS of my choice? Dual-boot option needed.
Answer: When you Install Windows 8 it will detect W7 on the old drive and install a W8 style bootloader to choose your OS, this will load automatically at startup after W8 is successfully installed.
The W7 drive needs to be connected at the time W8 is installed, so be careful and choose the right drive to install W8 onto.
Some do not like the new W8 bootloader and want the old legacy W7 bootloader, which can be changed after install of W8 if you like.


Is there a clan/bloodline that has all physical desciplines at in clan cost?

Question: I am currently looking towards building a very physical character, in Vampire the Requiem. I am wondering if there is any clan/ bloodline, that gains all physical disciplines (Celerity, Resilience, and Vigor) at a in clan cost?
Comment: That would be quite a boring clan...
Comment: Very true. I know that most bloodlines have four disciplines. I didn't know, if maybe there was one of the five clans that got such a thing, while retaining their normal clan power. Example: If a Daeva bloodline maybe got all three of those, while still having Majesty, or something similar.
Answer: No.
No such clan or bloodline exists.
It's easy to see why, from a game design point of view.  Such a clan would be superior in all physical activity - especially combat - while not possessing any original discipline or distinctive feel, since all it's abilities would be common across many clans.  (What would the defining 'feel' of such a clan be?  What kind of people would they Embrace, other than "physically fit"?)
Characters from this clan would have little to contribute in non-physical situations.  In a game about social interaction like Vampire, that would be the kiss of death to game design.  (Compare to, say, Gangrel - an example of a clan with a strongly physical nature, but a completely distinctive feel dripping with a personality that encourages several types of character design.)
It's perfectly OK to design a physical-only character, of course, but game designers wouldn't want to include a clan that doesn't allow any other kind of character.


To add one single validation for checkbox group and input field

Question: I have created a custom form in magento 2. I have placed a checkbox group having different company names as checkbox values like cmpy1, cmpy2, cmpy3 etc. I have also added an input field inside that group for which If somebody didn't belong to the specified company than he/she can enter their own company name.
Now I want to give a required validation to this group and I want to use magento 2's default validation if possible.
Answer: add the required class in the checkbox input like
<input class="required" type="checkbox" name="product[category_ids][]" value='<?php echo $cat_model['entity_id'] ?>' />


is formless better than formed?

Question: I recall it being said by the Buddha that the formless - jhana perhaps - is better than the formed.  in which sutta does this say this?  I remember reading that, but I can no longer find the text
Answer: The escape from form is listed in several suttas:

iti72:2.3: Renunciation is the escape from sensual pleasures. Formlessness is the escape from form. Cessation is the escape from whatever is created, conditioned, and dependently originated.

In addition, meditations deepen through the four jhanas, progressing into the subtler formless meditations:

AN9.41:11.2: 'Why don't I, going totally beyond perceptions of form, with the ending of perceptions of impingement, not focusing on perceptions of diversity, aware that "space is infinite", enter and remain in the dimension of infinite space?'

Furthermore, understanding that form is necessarily limited simply because it serves to distinguish between that which is the form and that which is not the form, we may also find the following relevant:

SN41.7:6.2: Greed, hate, and delusion are makers of limits.

Lastly, "better" may not be quite the word to use in comparing the form and formless. In MN121, the Buddha discusses the meditation on emptiness, which teaches that meditation towards emptiness is less stressful but some stress related to form is necessary for living itself. Indeed, even the formless here is perceived as "stressful."

MN121:10.3: They understand:
MN121:10.4: 'Here there is no stress due to the perception of the dimension of nothingness or the perception of the dimension of neither perception nor non-perception.
MN121:10.5: There is only this modicum of stress, namely that associated with the six sense fields dependent on this body and conditioned by life.'
Comment: Ah. OK. There is indeed a "better" one:

> [AN2.76:1.5](https://suttacentral.net/an2.76/en/sujato#an2.76:1.5): The better of these two kinds of happiness is happiness that relies on the formless."

Generally speaking, you may find it helpful to search the suttas using https://voice.suttacentral.net   with the phrase "better formless"
Comment: Nice but not the one I recall
Comment: the word 'better' was in the text. i can't find it :(
Answer: The quote you are thinking of, I think, is from the Santatarasutta, located in Chapter 3 of the "Book of Threes" (Tikanipāta) of the Itivuttaka (Iti 73). From the translation of John D. Ireland:

"Rūpehi, bhikkhave, arūpā santatarā, arūpehi nirodho santataro"ti.
"Bhikkhus, the formless is more peaceful than the form realm, and cessation is more peaceful than the formless."
Comment: that's the one :)
Answer: *Rupa-states/mindless ones" (asaññasatta) isn't at all desired, yet often common. If good householder asks about the four jhanas via the four-perceptions (arupa-jhana)... the four Jhanas, at least the first, is required for insight (leaving, world, home, sense sphere). While arupa-perceptions can be reached even without virtue, in this area the first step, compression of form, can not be archived as well as Dhamma not understood. Lacking the four Jhanas, useless.
As for livelihood (to maintain some happiness) the third Jhana is praised.
Good to mind minds in tune, since right (t)here, in the Dhamma-Vinaya, is the best place and freaks outside are mostly lost.
First: leaving home, making the hometask. Done, going up the mountains, where ever. But if not having left home, even if going up a mountain, aside of hardly finding space to do, bond to always return, not able to go beyond. The arupa-Jhanas are equal other awareness releases, like by metta, yet can be also and are often, maintained without having made the hometask, gained right view, considering the Dhamma. 1. Jhana is quite good and sufficient for the path.

is formless better than formed?


Is it possible to bring fudge from New Zealand to UK?

Question: I have bought fudge for gifts in NZ but am now unsure whether I will be allowed to take it inti UK - will I?
Comment: @Gagravarr That page isn't very helpful for fudge, since it offers no clues as to whether it's considered a "dairy" product or not.
Comment: It's a confectionary
Comment: Did you try looking at the [gov.uk page on brining food to the UK](https://www.gov.uk/bringing-food-animals-plants-into-uk/food)?
Answer: Turns out you can bring any amount of fudge you wish to in the UK, as long as it is for personal use (i.e. not for resale). Fudge should be a confectionery, and according to UK customs rules  confectioneries are exempt from import restrictions:

Exempted food products
The following products are exempted from the rules:
[...]

chocolate and confectionery (but not if the sweets are made with high levels of unprocessed dairy ingredients)*

[...]
*Confectionery, chocolate or cakes (including Christmas cake, Simnel cake or cakes containing nuts) are permitted from any country as long as they are for your personal consumption and do not contain fresh cream or high levels of dairy products. Confectionery that contain high levels of dairy products include Burfi, Gulab Jaman, Halwah or Halva, Ras Malai, RasGullah, Ladoos, and Chum Chum.
Comment: Surely fudge *does* contain high levels of dairy products?
Comment: @e100 Makes sense. But it doesn't figure in the list according to the UK customs guidelines on the website. Probably because fudge *is* available in the UK. I would therefore try it anyway.


Back up system to hdd

Question: I have a hdd connected to one of my raspberry pi's that is on raspbian, now I would like to be able to backup my Linux machines 2 or more to that hdd on a regular basis to help with system restores. Rsync would probably be a good start from my searching but I need a hand with the proper syntax and switches .
Comment: First question I would ask is - are the two target machines able to be backed up live or will you do better to back up data only and rebuild the O/S from scratch?
Comment: The 2 or more was just in general, however I actually have two machines one kali machine and another in a virtual box environment , so I believe that the main Os would be able to be backed up live, honestly I'm not sure. But backing up the data is fine I could reinstall a system and if all of my configurations were stored somewhere that would be just fine with me , drivers, software etc..
Answer: I use the code in Backup image of SD Card to perform incremental backups.
You can backup to a network drive or local HDD.
There are a number of other examples using rsync e.g.
can-a-raspberry-pi-be-used-to-create-a-backup-of-itself creates full backup images to attached HDD.
(Some of the other Answers in Can a Raspberry Pi be used to create a backup of itself? need to be used with caution)
Comment: +1 for "used with caution."  *However* you back something up, you must test that a proper restore can be performed from your backup.  You don't want to find out your backup drive is really a paperweight at a time when you *really need it.*

Back up system to hdd


Modular Exponentiation Equivalence Problem

Question:
Find the integer $a$ such that $0 \leq a < 113$ and $102^{70} + 1 \equiv a^{37} \bmod{113}$.

I started off by using modular exponentiation to realize that the left side of the congruence is logically equivalent to 99 (mod 113). Then I know that $a^{37} = 113t + 99$. This is where I'm stuck.
How do I solve $a^{37} (mod 113) \equiv 99 \bmod{113}$?
Answer: Hint: Cube both sides and use Fermat's Little Theorem


When is it permissible to abandon another Muslim?

Question: As-Salamu alaikum brothers and sisters, I have a Muslim classmate that would everyday pick on me. If I speak to him he will mock me or do other mean things, and in class he humiliates me and make others laugh at me even when it isn't funny. Even in the lunch hall he'd play with the food and make tabzeer. And when I tell him to stop, he just ignores or mocks me. At this point, is it permissible for me to abandon him? If I don't he will continue doing haram things, but Allah knows best.
Edit: I'm not asking for interpersonal help, I'm just asking if it's halal to abandon a Muslim, because there was a Hadith that forbids, but in this case I'm abandoning a Muslim to stop him from doing haram.
Comment: As-written, this really appears to be an interpersonal skills issue rather than anything to do with the topic of Islam. I am closing this for now; I recommend either focussing the question so it's clearly on topic here, or posting over at interpersonal.stackexchange.com .
Comment: what is a tabzeer, also has this person ever thrown something at you or hit you in anyway.
Comment: Yes, both hit and thrown. And tabzeer is wastage of materials.
Comment: I ansewered this but would like to know if you think this person would completely stop if you abandoned him. the way you describe him it does not seem like it
Comment: goldPseuso brother or sister you misunderstood, I was asking if it was HALAL for me to abandon another Muslim. Because I heard of a Hadith that forbids us from abandoning a Muslim for more than three days. But I've been told that's it's haram to stay in bad company. Sorry for lack of clarity, I'll edit my question in shaa Allah.
Answer: In the name of God, the Beneficent, the Most Just
All praise and thanks are due to God, the Lord of the worlds. We cannot find words to praise Him, as He only sees fit how laudation should be addressed to Him. We seek refuge in God from the evils within ourselves and the evils of our bad deeds. Whosoever God guides will never be led astray, and whosoever He leads astray will never find guidance. We bear witness that there is no god but God, the One without any associate, and We bear witness that Muhammad is His Messenger and bondman, peace and blessings be upon him, his kith and kin, his Companions and all those who follow their guidance until the Day of Judgment.

Your statement: "I have a Muslim classmate that would everyday pick on me. If I speak to him he will mock me or do other mean things, and in class he humiliates me and make others laugh at me even when it isn't funny. Even in the lunch hall he'd play with the food and make tabzeer. And when I tell him to stop, he just ignores or mocks me. At this point, is it permissible for me to abandon him? If I don't he will continue doing haram things, but Allah knows best." is wrong, you should not abandon him just because he has done this, for it is a major sin to do that unless you abandon him for good, then yes it is a major sin.
Answer: I'm sorry to hear this. Have you tried to talk to him and ask him why is she doing this to you? Have you tried to ask teacher's help for this or your parents's help? it is a grave sin to abandon another Muslim.
Abandoning one's fellow Muslims is a grave major sin if it lasts for more than three days, and if it is not for a shariah-approved reason as this leads to the severing of relations as well as harm and corruption. This is supported by many narrations like that one on the authority of Abu Ayyoob Al-Ansaari, may Allah be pleased with him, where the Prophet ( may  Allah exalt his mention ) said: "It is not lawful for a Muslim to abandon his brother for more than three nights [such that], when they meet, they turn their backs to each other - and the better of the two is the one who is the first to greet the other." [Al-Bukhari and Muslim]
In a narration on the authority of Abu Hurayrah, may Allah be pleased with him, the Prophet ( may  Allah exalt his mention ) said: "It is not lawful for a Muslim to abandon his Muslim brother for more than three days; and whoever does so and then dies, will enter Hell." [Abu Daawood, Al-Albaani - Hasan]
Have you tried to advise him to stop? In Islam, it is prohibited to mock others based on what Allah The Almighty Says (what means): {O you who have believed, let not a people ridicule [another] people; perhaps they may be better than them.} [Quran 49:11]
Don't worry, because at the end of the day, on the day of judgment, those who are mocked at will mock at those criminals while enjoying luxuries beyond what Dunya would offer them. They will sit back, relax, enjoy things that they love doing with the best quality of materials and, above all, they will enjoy the fate of those criminals and will pity them, seeing them experience what the Lord decided what they best deserve – the Hell-fire. This is what is written for them.
If your class mate ignores you, that is due to Satan as the following narration:

It was narrated that Jabir ibn 'Abd-Allah (may Allah be pleased with him) said: I heard the Prophet (peace and blessings of Allah be upon him) said: "Satan has despaired of being worshipped by the worshippers in the Arabian Peninsula, but his aim is to create troubles among them."

Hence Allah has forbidden everything that may lead to enmity and resentment among the Muslims. Allah says (interpretation of the meaning):

"Satan wants only to incite enmity and hatred between you with intoxicants (alcoholic drinks) and gambling, and hinder you from the remembrance of Allah and from the prayer. So, will you not then abstain?" [5:91]

I have found a list which might help you in this kind of situation:

Do not mock, backbit or lie about others
Khutbah by Nouman Ali Khan: Mocking Others and Arrogance
Worship in Islam: An In-Depth Study of Ibadah, Salah and Sawm

The Noble Prophet (S) said:

"If a person humiliates a believer, indigent or otherwise, Allah shall always abhor and humiliate him."

Allah Says:

"And it has already come down to you in the Book that when you hear the verses of Allah [recited], they are denied [by them] and ridiculed; so do not sit with them until they enter into another conversation. Indeed, you would then be like them. Indeed Allah will gather the hypocrites and disbelievers in Hell all together" [The Women, 4:140]

But if your class mate does not stop committing the sin, then you must leave him for 3 days, but it is better to explain to (the sinner) the reason for leaving, if that will have an effect on him and prompt him to give up the evil action.

References:

Abandonment - I
Ignoring a Person Who Offends You 100 Times
25. Humiliation
She has friends who are openly committing sin – should she continue to be friends with them?
Comment: The vast majority of this answer has nothing whatsoever to do with the topic of Islam and just dismisses the *actual* question asked. We are not interpersonal.stackexchange.com.
Comment: @goldPseudo What? Does that mean I have wasted all my effort?! I have tried to answer according to his question.
Comment: @AlexA, I only skim read but I think he/she means that you have not addressed whether this person is allowed to abandon his brother
Comment: @AsanRamzan Aaaa, well... in that case, I have not found any clear evidence that one should abandon a Muslim, I only find that another Muslim should advice another Muslim, or to go against the Muslim transgressor as a warning sign. If non has worked, then he may leave him.
Comment: @AlexA, in islam there are certain thing that Allah has commanded to be joined, including the Muslims, to severe these is going against the commad of Allah 13:25, Also every Muslim has certain right over his brother e.g. to return salaam. You have not reference this idea of  leaving his brother from the Quran. I only have heard one hadith where you can do such a thing but only for 3 days.


How to resynchronize replica in Postgresql

Question: I have a server with Centos6 and Postgresql 9.2, I have set up a replica in postgresql to another server of the same characteristics, today in the morning I have an error in the archiver process on the primary server, the replica does not configure it I, I really do not have a lot of knowledge about this topic, yesterday I had to delete some archived files in the primary for lack of space but later I checked the replica creating some tables and they replicated to the secondary, I thought it was all right ... I would like to know how to verify that the replica is working and if not how I can resynchronize the secondary. Thank you very much in advance
Comment: What was the ERROR message?
Comment: You deleted from the archive directory, or from the live pg_xlog directory?
Comment: If the replica can't find the files it needs, it will leave messages in the replica server's database server's log file about it.  Do you see such messages?
Comment: Delete in the pg_xlog directory because I started running a full vacuum and generated many files that filled the partition, I don't know what happens if the archiver process is not running and my fear is losing the replica, if so, do you know how I could resynchronize? Thank you for such quick responses! ... I am somewhat worried here
Answer: Since you deleted from pg_xlog, not from the archive, your first concern should be that you might lose the master, not just the replica.
Cross your fingers, and immediately perform a checkpoint on the master.
If you get into the situation again where the archive process can't keep up and is threatening to fill up all space on the pg_xlog partition, rather than manually deleting from pg_xlog you should instead change archive_command to 'true'.  (Or change it to copy to somewhere else which is faster than its current setting is, but still preserves the files.  Make sure to then manually copy those files to their final, slow, destination once the emergency is over.)
As for saving the replica, please answer my other two questions, preferably by editing the question to incorporate that information.
Comment: If the master has successfully checkpointed since then, the master should be OK.  Since the default checkpoint timeout is 5 minutes and the max is one hour (on 9.2), you should be good.  The replica should also be good if it has already applied and made visible changes you made to master since the removal. It must have already received what it needed before you removed it.  Sometimes you can do dangerous things and come out OK.
Comment: WHAT !!! ... do not tell me that ... until now postgres has not stopped ... does it mean that it was not corrupted? Or could it be that despite deleting the files it keeps running? As I said, after deleting the files 1 or 2 hours later, I created a table with data and replicated ... can this be possible if the database is corrupt?
As I do the checkpoint in the master ???, excuse the ignorance is that I do not usually work with postgres. Thanks for the support
Comment: Ufff !!! I do not know how much peace of mind this last comment ... but I do not see any archiver process in the system and in the log it goes out :
LOG:  checkpoint complete: wrote 978 buffers (0.2%); 0 transaction log file(s) added, 0 removed, 0 recycled; write=99.348 s, sync=0.031 s, total=99.402 s; sync files=161, longest=0.003 s, average=0.000 s
FATAL:  could not open archive status directory "pg_xlog/archive_status": No such file or directory
LOG:  archiver process (PID 566889) exited


Calculate calories burned

Question: I want to calculate the calorie burned by any person.If i have the height ,weight,sex,distance walks or run.Is there any formula that help me to calculate the calorie burned just by above four factors.
Comment: related: [Metabolic Equations for Anaerobic Exercise?](http://fitness.stackexchange.com/questions/14961/metabolic-equations-for-anaerobic-exercise)
Comment: related: [How can I calculate calories burned during an activity?](http://fitness.stackexchange.com/questions/51/how-can-i-calculate-calories-burned-during-an-activity?lq=1)
Answer: No. There are formulas for estimating basal metabolic rate (BMR) and total daily energy expenditure (TDEE). For exercises like walking or running you could estimate the calories burned based on measured performance data. Say, you have height, weight, sex, distance traveled and the time for this, as well as a measurement of burned calories, then those first parameters could be used as a prediction of the last one. These are the sort of methods used in machine learning, where inputs are used to "train" an algorithm for finding predicted output.
Even so, there's simply too many unknown parameters left that will have a large impact. If you're running on an incline or decline, the "distance" as would be measured on a map would be different from that actual traveled, yet the intensity of the walk or run would be influenced. Height and weight don't tell you anything about body composition. You could have two people for which these parameters are identical yet one has a large body fat percentage, the other a very low one with a lot of muscle mass. Fitness level and adaptation to exercise is going to affect efficiency and heart rate, further making estimates inaccurate.
The easiest thing to do is to use a heart rate monitor that takes said input and then uses the heart rate measured at short intervals to constantly calculate energy expenditure. But even that won't be entirely accurate. Possibly, if you have a monitor that allows you to export the heart rate data for a workout, it could be plugged into program that takes body composition into account as well. I wouldn't know about the existence of something like that. (If it doesn't exit, making something like it sure sounds like a very interesting project. It would take only a basic knowledge of machine learning and a technique like gradient descent.)
A simple formula, however, is at best going to be very inaccurate.
Comment: If I don't want to calculate calorie burned by calculating the bmr, is there any way to calculate calorie burned without calculating bmr or knowing the heartbeat
Comment: Did you read the answer? It states all of that. Since sites like MyFitnessPal will calculate calories burned based on the selected exercise, time and possibly your body stats, there are indeed such formulas. What I'm telling you is they're close to useless.
Comment: One of the reasons I'm talking about BMR is that common calculations use MET (Metabolic Equivalent of Task), which expresses used energy as a ratio of BMR: https://en.wikipedia.org/wiki/Metabolic_equivalent. You're gonna need MET values of tasks like walking or running, which will vary depending on intensity (e.g. speed).
Answer: There is a simple general formula to calculate BMR (calories you burn per day without exercise). It is rather accurate as long as you are not far from "average" person. Eg very lean, very muscular, very obese:
<code>English BMR Formula
Women: BMR = 655 + ( 4.35 x weight in pounds ) + ( 4.7 x height in inches ) - ( 4.7 x age in years )
Men: BMR = 66 + ( 6.23 x weight in pounds ) + ( 12.7 x height in inches ) - ( 6.8 x age in year )

Metric BMR Formula
Women: BMR = 655 + ( 9.6 x weight in kilos ) + ( 1.8 x height in cm ) - ( 4.7 x age in years )
Men: BMR = 66 + ( 13.7 x weight in kilos ) + ( 5 x height in cm ) - ( 6.8 x age in years )
</code>
There is also a formula based on body fat that is more accurate.
Now, there is a Harris-Benedict equation that helps you calculate the calories burned based on your activity lavel. Here is a simplified version:

BMR x 1.2  if you are sedentary + little or no exercise
BMR x 1.4  if you are lightly active + light exercise/sports few days a week. This is where most people with office job and working out few times a week are.
BMR x 1.6  if you are moderately active. For example if you are cycling/walking to work, or work a standing job, and exercise a few times a week.
Above that are mostly people that workout hard, everyday and combine it with a physical job of some sort.

The above is a good guideline to plan initial caloric intake if starting a diet. As everyone has slightly different metabolic rate, different lifestyle and daily activity routines, caloric intake should be adjusted according to progress.

Calculate calories burned


Same external hard drive for time machine and storage

Question: I have a MacBook Pro (250GB with about 100GB free). I'm planning to get an external hard drive (1 TB). Is it possible to use the external hard drive for both time machine's purposes and as a general storage device (for movies and games)?
Answer: Yes, That is exactly what I have done.
The important thing to be aware of is that Time Machine will try to manage itself using all of the volume it is on.
What you need to do is decide how large a TM you need to hold your data together with old versions of it. Then partition the disk using Disk Utility so the TM is on one partition and the movies etc are on the other.
Answer: Depends on your setup. But most likely it will work.
You can also have your data and backups in the same partition, as long as it is properly formatted.
Comment: Why wouldit not work?
Comment: Time machine is very picky on how the drive is partitioned and formatted. I found it most reliable to let it setup the drive.


I've got some problems on Ubuntu 13.04, any help!

Question:
I can't set script (or by any other way through terminal) for making thresholds for battery charging, Also I know that Lenovo users provided tp_smapi kernel module which make this issue not considered as an unsolvable problem unless for Dell users, Also i tried this http://www.serkey.com/ubuntu-thinkpad-battery-threshold-tool-easy-script-bebzu4.html but it is not working for me, any solutions for controlling thresholds charging by any way?
I think my laptop temperature getting high with no reason which makes it produces extra heat even if the laptop is in its idle state, considering also my trying to use Jupiter but it have not effect on the heat also in its power saving plan, so is there a way to make power plan to save the battery power?
Answer: Try the TLP power management application. Lower power consumption should reduce heat. I've been using it on my Acer Aspire laptop and it has drastically lengthened life of the battery. Run these commands to install it:
sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tlp tlp-rdw

Then reboot your computer or run sudo tlp start
If you're running on a Thinkpad, you must also install these:
sudo apt-get install tp-smapi-dkms acpi-call-tools

Hope this tool helps you!
Comment: TLP doesn't have any good approach affects my Laptop temperature, also what about battery charging thresholds ?
Comment: I'm not very familiar with thresholds, but it looks like tp-smapi allows you to alter them. Check out [this wiki page](http://www.thinkwiki.org/wiki/Tp_smapi).


Lifting Iron (strength training) vs pushups ( knuckle)+ body weight squats+situps

Question: Assuming your aim is to get better at martial arts not bodybuilding (hence strength training: lets take Rippetoe's 3x5). Which would improve performance? Also can they be done side by side? because I know that after lifting heavy you have to wait a day and train on alternate days.
Comment: If you want to go the bodyweight route, you might like *Convict Conditioning*. Not that I'm recommending the bodyweight route, just mentioning a well received bodyweight program.
Comment: If you post your karate class schedule it would be easier to help schedule the lifting.
Comment: Karate classes : Tuesdays, Wednesdays , Thursdays and Saturdays Last 2 Hours.
During the class: warming up exercises, kihon basics , combinations for 1 hour and a half then katas at the end or we spar.
Answer: Knuckle pushups, bodyweight squats, and sit-ups, as a program, would mostly increase muscular endurance and cardio. A 3x5 program like Rippetoe's Starting Strength would actually increase your strength and power.
Muscular endurance is great for fighting, but A) you're probably already doing those exercises in class and B) if you're stronger you have better muscular endurance anyway. So rational general strength and power training is better for martial arts than bodyweight work chosen because it's bodyweight.
You can lift alongside martial arts training, but you have to take care for lifting not to interfere with skill development. Generally this just means 1) scheduling your lifting so you're not beat down when you go to class, and 2) adding weight less frequently than recommended for someone not playing a sport. With a T/W/Th/Sat karate schedule, I'd definitely lift either after class on Saturday, or on Sunday. If I managed to lift on Saturday then I'd try to lift on Monday too. If I were feeling good about my training, not feeling overworked or under-recovered, then I wouldn't mind lifting Friday and Monday (but not Saturday or Sunday). I'd add 2.5 or 5 pounds to each exercise every two or three workout sessions.
If I were feeling really good about training, full of energy even after lifting twice a week and doing karate 4x/week for a few months, I'd try adding a third lifting session. I wouldn't really care where it went.
Comment: +1. Would you change the actual content of the lifting? Or stick with something like SS but just lower the frequency and rate of weight increase?
Comment: @half-pass People in this position need a general strength program, which SS provides. I'm not beholden to it as a program, but there's no particular reason to change it for this purpose. I used it in this example because the OP mentioned it.
Answer: I had a lot of success doing bodyweight training for the couple of years that I was more-or-less forced to, living in a developing nation with no real gym options.
If you go the bodyweight route, I'd recommend these strategies:

Realize that "some pushups and pullups" isn't going to cut it. Just like most people in a gym have no idea what they're doing, most people doing bodyweight training are wasting time.
You need to effectively target your major muscle groups, maintain a balance of development, and progress through more and more challenging movements.
A lot of people view bodyweight training as more simplistic then weights, but in reality they both have similar challenges: maximizing (in your case) power and force production throughout your body in an effective way.
Bodyweight training, for me, includes such things as gymnastic rings and plyometrics. The increased power work doing plyometrics and the increased leverage with rings really is a game changer over just you and your body. No matter how you slice it, hamstring and back development is poor at best with bodyweight training alone.
This is one of my preferred bodyweight books. For rings, and really other great sources of gym-less activities, beastskills.com is regarded by pretty much any athlete as a terrific resource.

If you go the barbell route, I don't see any reason why you shouldn't start something like Starting Strength's novice program. If you're past that, the Texas method is a template you can eventually modify, and it was designed for Olympic lifters originally.
I'd say to jump right into Olympic lifts, but the background months of properly performing big barbell movements is really necessary.
Either way, you're going to want to aim for power and strength. Olympic lifts, box jumps, shoulder stability, pistol squats with a jump at the end, etc. There's a lot of range in there to pick from, but whichever way you go make sure you're targeting power.
Comment: This doesn't really address the question: which is better for martial arts, lifting or bodyweight?
Comment: @DaveLiepmann I guess my point is that neither is inherently better. The "better" one will be the one that's a real program that does what a real program is supposed to do.
Answer: If you split your routine up (chest one day, back another, biceps another day) etc, then you don't have to gym on alternating days, you could train daily.
You won't necessarily bulk huge by going to gym but you will get that strength and core that you won't by just doing pushups and exercises that use your own body weight.  It just won't happen, your stabilising muscles won't develop as much as you aren't putting as much strain on your body.
People are often afraid to join a gym because they don't want to look like a bodybuilder but those guys dedicate years and thousands into the right diets to look like that, it doesnt happen easily.


Moen shower trim handle replacement

Question:

I have a white Moen shower that came with the house. The diverter leaks but there not really any white replacements. So I went to home Depot to buy a new set and since I don't know if I have a posi valve currently, I just decided to change out the fixtures. Good on the shower and spout but I can't get whatever is behind the handle/trim to come off.any help on what I'm screwing up so I can pull and replace the handle would be appreciated. Also, I have no idea what a posi temp is but if you can tell by the pick and let me know if that's what I have it'd be appreciated as well. Thank you
Comment: is there a small hex screw on the side ? and what is in the center hole ?
Answer: There is a screw, ( usually Philips) down in the hole in the temperature stop   ( Grey Thing) remove the screw and that part will come off. You may have to pull hard, so turn the water off to then house or you will get a shower. Then the sleave slides off and the trim plate can be removed.
The "Positemp" is an anti-scald mixing valve. It can be identified by the screw holes in the trim plate that are diagonally opposed. Older first gen Moen valves have 2 holes closer to each other at the bottom of the trim plate.
Comment: generally the moen shower's I have taken apart has a clip that holds the valve in place so you can remove the escutcheon plate and access the integrated shutoffs.  also the piece that usually goes bad is the o-ring on the valve which can be replaced though I've never bothered as the moen valves are lifetime?  I got my replacements free at homedepot.

Moen shower trim handle replacement


Does a vegetable oil that is used for Shabbos lamps need a hechsher?

Question: Does a vegetable oil that is used to light the Shabbos lamp need a hechsher? I am talking specifically about extra virgin olive oil and coconut oil.
Comment: I'd never have described olives or coconuts as vegetables.
Comment: @DoubleAA no, but (in the United States) oil from vegetation source, including fruit seeds, vegetable seeds, and other, are called generally "vegetable oil". (See e.g. 40 CFR 112 (1.2.9): "_Vegetable oil_ means a non-petroleum oil or fat of vegetable origin, including but not limited to oils and fats derived from plant seeds, nuts, fruits, and kernels.")
Answer: Although shabas oil/candle need not be kosher for eating, it can't be made of orla or anything else that we may not drive benefit from (Beur Halacha 264 "Chutz"). If you have the right to be confident that your oil lacks those things, you're fine. Ask your rabbi for practical guidance.
Comment: I dont understand why that should only apply to 'shabbos' candles. In the middle of the week it should also apply.
Comment: @interested I agree


USGS National Map Ortho - Digitizing

Question: As a part of project scope we have to deliver to the Client digitized data sets – some houses and roads. Can we use USGS Orthoimagery from The National Map layer for feature digitizing?

http://www.arcgis.com/home/item.html?id=5903c82adf4a42cfa525463593d0c66a
http://raster.nationalmap.gov/arcgis/rest/services/Orthoimagery
Answer: Yes, you can definitely use USGS National map ortho-imagery to extract features, using heads-up digitizing methods (HUD.) The trick here is to work within a projected environment using UTM or State Plane as a coordinate system to ensure fidelity. Another consideration should be the age of the image. Ensure you are working with the most current image possible for feature extraction.
Regarding licensing: USGS does not restrict the use of their data but does require proper citation for re-use and derived products. Please read the following from USGS on the topic. http://www.usgs.gov/faq/categories/10154/3550
Answer: Orthoimagery from The National Map is technically already digital data. Regardless, you may conduct manual on-screen digitizing with USGS orthoimagery as a base to trace specific entities such as houses and roads.
Bear in mind the coordinate system of imagery and the feature class you are doing your tracing with to ensure they match while tracing. Also, some human error will be introduced while tracing due to visual acuity and pointing ability of the tracer.
If the location of the entities you are interested in are accessible to your organization and you have a access to a Global Navigation Satellite System (e.g., GPS) that has a better positional accuracy than that of the USGS Orthoimagery, you can conduct fieldwork to increase the accuracy of your work.

USGS National Map Ortho - Digitizing


Is this a gas valve behind stove? I can't move it to turn it off

Question: I want to get a new stove and when I pulled out the old stove I found the gas line within a hole in the wall and the gas line had a metal bar on its side. I am thinking this bar is a gas valve but I am not sure I haven't seen a pic of a gas valve that looks like this on the internet. Also when I tried to move it it seems to jiggle a little but I couldn't get it to move. Has anyone seen this before and can let me know if it is the gas valve and how I can get it unstuck to move it to turn off the gas?
Comment: Hello, and welcome to Home Improvement. If an answer is helpful, please click the large check mark next to it to accept. And, be careful out there when dealing with gas. And, please [take our tour](//diy.stackexchange.com/tour) so you'll know the details of contributing here.
Answer: Yes it's a gas valve. Sometimes they become very stiff when they aren't operated for a long time. In the photo you posted, notice the little tab sticking down from the silver lever. That's a stopper; it limits the rotation of the lever. Make sure you're attempting to rotate the lever in the correct direction, ie not pushing against that limiter (or another less visible one).
The shutoff valve at an appliance should work reliably so that gas can be shut off in case of emergency (or convenience, as in the case of replacing an appliance). I suggest the following:

Learn where your gas meter and main shutoff are located and how to operate that shutoff.
Be prepared to replace this appliance shutoff valve - have parts and tools on hand, or a plumber identified, and work at a time when you can deal with having a gas outage for a few hours at least.
Attempt to turn the lever on the valve with a wrench. If it turns easy, operates properly, and doesn't start leaking out the valve stem then you're all done. If it breaks, leaks, or things otherwise go badly then at least you went into it prepared with a recovery plan!
Comment: I would urge a bit of extra caution. Water leaking from a valve can be dealt with using a bucket. Gas leaking from a valve, not so much...
Comment: Hello Greg, Thanks for answering! Since the valve is in between the wallboards.I had to actually cut open the hole more to even get my hand in to try to turn it. Do you think I should create a bigger hole to see what I am doing with the wrench? Right now I can't really see beyond what I showed in that picture. The other side of the wall has my water heater in front of it and I can't access it from there. I'm not really sure how to access this valve or see like you said if there is any other limiter etc. What would your advice be?
Comment: @JoshH You might get a better view by using a mirror. A smart phone selfie-camera sometimes works; a pocket mirror of the sort found in compacts for makeup also could be useful. This could be one of those cans of worms for which there's no easy fix -- manassehkatz's suggestion to have the valve moved so it isn't embedded in the wall is a good one (add an elbow so the valve and flex pipe become parallel to the wall, rather than sticking perpendicularly out of it). A bigger hole gives room to try to manipulate this valve.. but it can be replaced/rearranged without making the hole bigger.
Comment: Remember the handle will only rotate 90 degrees ( 1/4 turn)  between off and on.
Answer: I am very much in favor of DIY. But gas, not so much. "Little" mistakes/can't-quite-finish-the-job situations with water very often mean "a drip in a bucket until the plumber gets there". Similar issues with electrical mean "turn off or disconnect one circuit until the electrician gets there". But with gas there is (a) often no easy way to shut off the entire supply (which might mean no heat/hot water too, but at least be safe) and (b) you can't catch a gas leak in a bucket like a water leak.
While I can't say if it is to code or not, my gut feeling is that there should never be any operable valves, and almost never any joints of any type inside the wall. Which is what you have here.
In addition, there may be firestop issues - drywall is relatively fire resistant and is relied upon to delay a fire from making it from one room to another, particularly from garages to habitable spaces. I don't if that is the case here, but if it is then this big hole is a big problem.
Based on this, I suspect that the original installation was for the hot water heater and the gas line to the stove was added later (which is not that unusual), and that the line to the stove was not installed properly.
My recommendation is to get a qualified plumber/gas-fitter (not all plumbers do gas, and the licensing varies by jurisdiction) in, to do the following:

Disconnect the flexible line.
Replace the rigid line from the hot water heater with a longer line that goes all the way through the wall. This might be "replace all the way to the end" or it might be "cut off a few inches on the other side of the wall and couple a new line to the end of the old line.
Install a new cutoff valve and an appropriately sized flexible line.
Install the new stove.
Leak check everything.

The last part - installation of the new stove - anyone can do when you have good flexible line and a functioning valve. The advantage of (this time) letting the plumber do it is that he can check everything for leaks all at one time.
After that, you can do the drywall repairs yourself. If the room on the other side is another regular room in the house then I would just patch up to 1" or so around the new line. If the other side is a garage (or other room that requires a proper firestop) then you should find out the rules and the recommended procedure to seal around the gas line.


Is it possible to reverse GHASH from GCM?

Question: How can I create a "reverse" GHASH algorithm for GCM that allows me to compute an input value that generates a specific chosen output, given that I know the authentication key H? If this is possible, what is the process for achieving this?
Answer:
If this is possible, what is the process for achieving this?

It's actually quite easy, if you know how to do operations in $GF(2^{128})$, specifically, addition, multiplication and computing inverses (note that you already need to know how to do addition and multiplication to perform GHASH in the forward direction).
What GHASH does is take the message [1] and convert it into a series of 128 bit values $a_n, a_{n-1}, ..., a_1$; and it does it in such a way that the bits from $a_n, a_{n-2}, ..., a_2$ come directly from the message.  Then, it computes:
$$GHASH_H(\text{Message}) = a_nH^N + a_{n-1}H^{N-1} + ... + a_1H^1$$
So, to find a message that GHASH's to a specific value $T$, you select a message length and a position 16 bytes long which set a specific $a_j$ value (for any $j$).  Then, set the bytes on that position to 0 for now, and set the rest of the message bytes arbitrarily, and evaluate the GHASH for that message, it will be a value $T'$.
Then, set those 16 bytes to the value that makes $a_j = H^{-j}(T + T')$, and you're done; when you GHASH that modified message, it'll evaluate to $T$.

[1]: As defined in GCM, GHASH actually takes two messages; one the AAD and one the ciphertext.  This doesn't complicate things, and so I'll ignore it
Comment: Can you clarify what is meant on the last step, where one takes the inverse of H, and solves for $a_j$? Are you just trying a bunch of values for $T'$, or is there a more elegant way?
Comment: $H^{-j}$ is that value for which $H^{-j} \times H^j = 1$; this is the multiplicative inverse.  One (inefficient) way of computing it is $H^{-j} = (H^j)^{2^{128}-2}$.  And, no, we're not trying a bunch of values of $T'$; we're doing one test value and then the final one.  I was originally going to write up the equations you need to solve; I then realized that just evaluating it for $a_j=0$ makes the explanation much simpler...


Droid Memory Wipe

Question: So in various stages of the books and movies, droid memory wipes are mentioned.  This made me wonder why didn't the Jawa's wipe the memory of R2D2 and C3PO before they sold them?  I would think it would be standard practice to prevent the exact issue that arouse that droids go off on their own because of the programming left by their former masters.  Especially since they 'scavanged' the droids.  If they bought them from a reputable dealer to resell, then that is different, but they technically stole them or at least didn't care who their owner was.  One would think that to cover your tracks, you would wipe their memory before selling them.
Comment: It is never been really clear to me what is involved in a wipe.  Is it a completely reinstall of the base OS.  Would C3PO have to re-(learn/install) his six million forms of communication?  Do they have some form of DRM, so that re-purchasing the language database would cost lots of credits?
Comment: @Zoredache: "Do they have some form of DRM?" Star Wars was a long time ago. Before the DRM. Before the Empire.
Comment: Also, it just seems like good practice. When you sell a used computer (whether it's yours or someone else's) you _always_ want to reformat the drives for security/data sanitization purposes.
Comment: @Zoredache: I was wondering something similar, but more along the lines of the droid losing all those years of knowledge and experience. Language databases can be easily reinstalled (perhaps even pirated), but years of battle/engineering/human interaction experience can't be so easily replaced (though in theory you should be able to copy a "clean" veteran personality over to the new droid). The value of a freshly graduated electrical engineer is not the same as that of a senior EE with over a decade of industry experience.
Comment: @Lèsemajesté: But don't you want them to lose all that experience? Otherwise they might start to think they're unique individuals with rights and that's just not proper thinking for a droid.
Comment: @mu is too short: Ideally, you want them to lose non-relevant experience that could cause you and/or their future owners problems, but without losing their engineering experience, survival experience, and other useful knowledge/experience. I mean, if you wipe out a combat veteran's memories to make them easier to control but also reduce them to the intelligence of a 5-year-old, then what good is that soldier?
Comment: It's possible also that the Jawas simply didn't get around to it. We don't know how much time elapsed between the droids being picked up and sold to the Skywalkers. BTW, it occurs to me that wiping a sentient being's memory to make it more submissive seems to have moral implications that Lucas didn't tackle. ;-)
Answer: Droid memory wipes are established in The New Rebellion as only affecting a droid's personal memories, not their hardwired memories. I'll paraphrase from memory here, as I don't have the book with me:

Security Droid: "When you get a memory wipe, do you need to re-learn all 6 million forms of communication?"
C-3PO: "Of course not, that's hard-wired in."

To use an analogy; when a human gets amnesia, they may forget who their spouse, parents and children are, but they usually remember their skills. A painter may not remember any of their paintings, but they will still remember how to paint. We don't actually know why this occurs, but I'm not a neurologist, I just need an example.
Droids in the Star Wars universe are also shown to be able to 'download' (my word) knowledge and skills which would be unaffected by memory wipes. Again in The New Rebellion, C-3PO passes the time when he's "bored" (that word is actually in the book, though I think Threepio is denying that he's bored) by downloading new languages into his hard-wired memory; this process is shown taking less time than a human learning a new language, but more than simply pressing a button and gaining instantaneous knowledge. It seems akin to the skill downloads in The Matrix.
That answers the question of what a memory-wipe actually entails. As to why the Jawas don't perform a memory-wipe, it is never actually stated in either the film or the novelisation. I don't recall even noticing it mentioned in any EU material either. My supposition would be that memory-wipes on droids require equipment that the Jawas, technological scavengers, simply don't have. We know the Lars family does not have the capacity to wipe droids' memories; they need to visit the nearby town of Anchorhead to do so.
C-3PO's memory is wiped in Revenge of the Sith, but that was a consular ship; a spaceship is likely far larger than a Jawa sand-crawler, with better technology, and a diplomatic vessel is itself quite likely to have specialised software and hardwire onboard for dealing with protocol and translation droids. This is a possible explanation of why they don't also wipe R2-D2's memory; the ship isn't set-up to deal with astromechs in the same way as it is protocol droids.
Comment: Yeah, I assumed that it was something like that.  It makes sense anyway with the way modern computing works.
Answer: I assume that a droid is built like a computer, this makes a memory wipe a different procedure on each droid, to know what commands to issue, files to delete, or something along those lines.
In addition, C-3PO was not a standard manufactured robot, it was handmade by Anakin, so even if there was a droid standard, it would most likely not conform to it, so it would require research to wipe it's memory.
So wiping their memory could become a process that is lengthy, expensive, requires lots of skills, simply impossible without prior knowledge (of a password for example) or all of the above.
Comment: C-3P0 was not build by Anakin.  Anakin **re**built him, using some limbs from similar droid.  It's not an insignificant task, but it's a far cry from designing and building a bipedal robot with a functioning AI.
Answer: Maybe the Jawas don't wipe memories because they sell stolen secrets along with stolen droids.
Just as people who scavenge hard drives from computers left at the city dumps sometimes sell them on the black market. Crime rings look for any secrets on the hard drive. Password files, financial information, and bank accounts are used to commit identity theft. They check use old emails for blackmail.

Droid Memory Wipe


Solve Max 3 color problem using 3 color decision problem

Question: I've been stumped on this question for a while and can't find a solution. How can I find the max 3 colorability of a graph(optimization problem) with 3 colorability (decision problem) without brute force searching every combinations of edges?
Comment: Sorry, but what is "max 3 colorability"?
Comment: One can think of two optimization variants of 3-colorability: (legally) coloring the maximal number of vertices, coloring all vertices while minimizing the number of monochromatic edges. Which one are you interested in?
Answer: The problem "Can a given graph $G$ be 3-colored so that at least $m$ edges are bichromatic?" is in NP, and therefore can be reduced to 3-colorability (since 3-colorability is NP-hard). Using this, you can solve maximum 3 colorability, employing a simple binary search that invokes a 3-colorability oracle $O(\log n)$ times.
There might be a more direct reduction (which might have been the point of the question), but there is no real problem with this answer as well.