text:
Q: How to clone multiple git repos into the same workspace folder in Jenkins
Jenkins - v2.148
Multiple SCMs plugin - v0.6

There are multiple microservices in my project, In VSTS each falls under different git repository URLs. I'm trying to configure each of these microservice repos in jenkins.
Using Multiple SCMs plugin, I was able to add each repository using Add Repository option but whenever I initiate the build job, each repositories are being cloned into the same workspace folder. When the next repository in the queue is cloned, previously cloned code is removed. At the end, only the last repository source remains in the workspace folder.
Check out to sub-directory option didn't work, as this option is not available for each repository so that I could have configured each repo to clone into respective sub folders under the work space.

Is there a way to clone all the repos configured in Jenkins into separate folders into the workspace folder during a build job?

A: Instead of using

you should use Add SCM and specify your git repository there. This way you will be able to set Additional Behaviours -> Add -> Checkout to a sub-directory for the new SCM. You can add as much SCMs as you need, each one with the option to be checked out to a sub-dir.


text:
Q: Excel pivot table: move value fields from row to column I'm developing an excel addin in c# and have to create a pivot table, which I don't know how to organize the data, how it should be.
First of all the datasource:

This is, how the final Pivot Table should looks like:

But I only get something like this and I have no Idea where I have to how to change my code:

Finally my code to arrange the data source columns:
/* PIVOT RowFields */
Excel.PivotField nameField = pTable.PivotFields("Name");
nameField.Orientation = Excel.XlPivotFieldOrientation.xlRowField;
nameField.Position = 1;

Excel.PivotField monthField = pTable.PivotFields("Monat");
monthField.Orientation = Excel.XlPivotFieldOrientation.xlRowField;
monthField.Position = 2;

/* PIVOT Data */
Excel.PivotField sum200Field = pTable.PivotFields("Summe 1");
sum200Field.Orientation = Excel.XlPivotFieldOrientation.xlDataField;

Excel.PivotField sum700Field = pTable.PivotFields("Summe 2");
sum700Field.Orientation = Excel.XlPivotFieldOrientation.xlDataField;

Excel.PivotField sumDiffField = pTable.PivotFields("Differenz");
sumDiffField.Orientation = Excel.XlPivotFieldOrientation.xlDataField;

I'm using .NET Framework 4 ... I read a lot of articles in the internet, but nothing I read was useful...
Does anyone have an Idea?
UPDATE:
As @MP24 posted, adding these two C#-Lines at the end of my code, the columns will be display right exclusive the grouping of name and month:
Excel.PivotField dataField = pTable.DataPivotField;
dataField.Orientation = Excel.XlPivotFieldOrientation.xlColumnField;

UPDATE2:
To group Month and Name Column, the following code will show how to:
/* PIVOT ZEILEN */
Excel.PivotField monthField = pTable.PivotFields("Monat");
monthField.Orientation = Excel.XlPivotFieldOrientation.xlRowField;
monthField.LayoutCompactRow = true;
monthField.LayoutForm = Excel.XlLayoutFormType.xlOutline;
monthField.set_Subtotals(1, false);

Excel.PivotField nameField = pTable.PivotFields("Name");
nameField.Orientation = Excel.XlPivotFieldOrientation.xlRowField;
nameField.LayoutCompactRow = true;
nameField.set_Subtotals(2, false);

A: You will have to change the orientation of your data fields:
The VBA code is
ActiveSheet.PivotTables("PivotTable1").DataPivotField.Orientation = xlColumnField

This translates into C# code:
Excel.PivotField dataField = pTable.DataPivotField;
dataField.Orientation = Excel.XlPivotFieldOrientation.xlColumnField;

Edit: Note that for understanding the pivot tables, the macro recorder will give you good hints. Just start recording the macro just before you perform your desired action, and stop the macro afterwards. Transferring the insights from the code into C# will then be easy.

A: Try this:
pivotTable.DataOnRows = false;

A: PivotField fld = pivotTable.RowFields("Data");
fld.Orientation = XlPivotFieldOrientation.xlColumnField;

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to counting number of pixel every region in a binary image ( Android ) I take photo of two  object. I removing noise, convert RGB to Grayscale, improve the contrast and convert Grayscale to biner. Finally,I wanna counting number of pixel every region in this case can see the picture. How I counting the every region in android ? do i have to detect the square region in advance? and decreasing the total number of pixels with pixel square region ? Any idea? What algorithm should I use ?

A: Ok, if you want to "count" all black pixels, for example, you need to perform two loops (one horizontal and one vertical) at image. Something like this:
Drawable d = imageView.getDrawable();
Bitmap bitmap = ((BitmapDrawable) d).getBitmap();
for(int x = 0; x < imageView.getWidth();x++){
    for(int y = 0; y < imageView.getWidth();y++){
        int color = bitmap.getPixel(x, y);
        // here you have the color
    }
}

code reference

A: You could invert your image and then sum up every pixel in the bounding rectangle of your Contour. Since Black=0 and White=1 The sum of the inverted Blacks will be the number of Black Pixels in your contour. As long as there is no other contour in your bounding rectangle it should work fine.


text:
Q: Как одновременно запустить асинхронный telethon и aiogram? Всех приветствую! Как можно сделать так, что бы асинхронные функции срабатывали как для aiogram, так и для telethon?
@client.on(events.NewMessage(chats=channels))
async def my_event_handler(event):
    if event.message.video:
        random_string = ''.join(random.choices(string.ascii_uppercase + string.digits, k = 15))
        os.mkdir('videos/'+random_string)

        video_path = str(str(os.getcwd())+'/videos/'+random_string+'/').replace('\\','/')
        await client.download_media(event.media, video_path)

        file = os.listdir(video_path)
        random_id = int(admins_id_list[random.randint(0, len(admins_id_list) - 1)])
        await bot.send_video(random_id, open(video_path+file[0], 'rb'))

        markup = types.InlineKeyboardMarkup()
        markup.add(types.InlineKeyboardButton("Да", callback_data='video_add_'+str(event.message.video.id)))
        markup.add(types.InlineKeyboardButton("Нет", callback_data='video_remove_'))
        await bot.send_message(random_id, event.message.message+'\n\nЗанести видео в канал?', reply_markup=markup)

@dp.callback_query_handler(lambda event: event.data.startswith('video_add_'))
async def video_adder(event: types.callback_query.CallbackQuery):
    event_message = str(event.data).replace('video_add_','')
    print(event_message)

if __name__ == "__main__":
    client.start()
    client.run_until_disconnected()
    executor.start_polling(dp, skip_updates=True)

После включение скрипта, запускается только telethon. (Ну или только aiogram, если поставить его запуск выше, чем telethon). Помогите пожалуйста, а то по ботам в интернете очень мало информации :/

A: Господи.. Решением оказалось обычное удаление строки: client.run_until_disconnected()
Я её тупо скопировал с примера telethon, не зная за что она отвечает... Целую неделю мучился :/


text:
Q: Looking for Google Apps script to find and highlight dates from past month in red I have a Google spreadsheet with columns I and J with data as headers Est Closing Month and Est Closing Calendar Year respectively, I need a script which will loop through columns I and J and find dates which are in the past month of this year and highlight them in Red.
Following is example data
ColI ColJ
Aug 2014
Nov 2014
Aug 2014
Jul 2014
Jul 2014
Dec 2014
Dec 2014
After I run the script the output put should be
Aug 2014
Nov 2014
Aug 2014
Jul 2014 -> Both Cells should be in red
Jul 2014 -> Both Cells should be in red
Dec 2014
Dec 2014
Thank you for all the help.

A: have you tried conditional formatting ?


text:
Q: TurfJS get bbox given two Points I'm trying to move a client side method on the backend:
The client side method is using TurfJS and Leaflet to perform some operations. The only problem is that server side (nodejs) window is not available, hence I cannot use Leaflet.
I'm looking for a way to transform this piece of code in the vanilla Turf equivalent:
    const pointA = turf.point([originCoords.lng, originCoords.lat]);
    const pointB = turf.destination.default(pointA, 50, 45, { units: 'kilometers' });

    // here I'm using leaflet to get a BBox
    const latLngBounds = L.latLngBounds(
        L.latLng(pointA.geometry.coordinates[1],
            pointA.geometry.coordinates[0]),
        L.latLng(pointB.geometry.coordinates[1], pointB.geometry.coordinates[0]),
    );

    // using that BBox I then create the rectangle, again with leaflet
    tile = L.rectangle(latLngBounds);

I'm still newbie with this whole GeoJSON thing, and maybe I'm missing something, can someone help me?

A: Here is the code that uses Turf.JS only.
var turf = require('@turf/turf');
var pointA = turf.point([-75.343, 39.984]);
var pointB = turf.destination(pointA, 50, 45, { units: 'kilometers' });
//create a bbox that extends to include all the features
var bbx = turf.bbox(turf.featureCollection([pointA, pointB]));
var pgn = turf.bboxPolygon(bbx);  //convert it to Polygon feature
console.log(JSON.stringify(pgn)); //output to console

The output:
{"type":"Feature","properties":{},
    "geometry":{
    "type":"Polygon",
    "coordinates":[[
        [-75.343,39.984],
        [-74.92609,39.984],
        [-74.92609,40.3012],
        [-75.343,40.3012],
        [-75.343,39.984]]]
    }
}

Edit 1
Add ability to run the code:

//var turf = require('@turf/turf');
var pointA = turf.point([-75.343, 39.984]);
var pointB = turf.destination(pointA, 50, 45, { units: 'kilometers' });
//create a bbox that extends to include all the features
var bbx = turf.bbox(turf.featureCollection([pointA, pointB]));
var pgn = turf.bboxPolygon(bbx);  //convert it to Polygon feature
console.log(JSON.stringify(pgn)); //output to console
<script src="https://cdnjs.cloudflare.com/ajax/libs/Turf.js/5.1.5/turf.min.js"></script>


text:
Q: Why do we care about Cauchy principal value? Question is in the title, basically. I don't understand the motivation behind assigning the Cauchy principal value to otherwise divergent integrals. I'm more comfortable with things like Abel summation that assign values to divergent series, because in my (limited) experience, all the reasonable ways you can do this lead to the same values. But Cauchy p.v. isn't compatible with substitutions, which are normally one of the fundamental tools for evaluating integrals. So why do we care about Cauchy principal value?

A: The Cauchy principal value of the "integrals" $f\to \int {f(x)\over x}\,dx$ is (uniquely) characterizable in various ways. These are not so much related to complex analysis, as to functional analysis, although certainly an understanding of complex analysis is necessary for some aspects.
For one, up to constant multiples, it is the unique distribution (=continuous linear functional on test functions) that is odd, and is homogeneous of degree $-1$ (suitably normalized).
Up to a constant, it is the Fourier transform of the (tempered) distribution given by integration against the sign function.
Up to a constant, it is the analytic continuation of the distribution-valued function $s\to x/|x|^s$ to $s=2$.
Up to a constant, it is the unique odd distribution $u$ such that $xu=1$. (Note that $x\delta=0$, but/and $\delta$ is even.)


text:
Q: .NET MVC Store image on localdb and rewrite it each time I am trying to capture a photo with a webcam and then save it on the localdb. After that i want to asign it to a user and each time  a new photo is taken to rewrite the original photo on the server and all the references.
Capture photo code:
public ActionResult Capture()
        {
            var stream = Request.InputStream;
            string dump;

            using (var reader = new StreamReader(stream))
            {
                dump = reader.ReadToEnd();

                DateTime nm = DateTime.Now;

                string date = nm.ToString("yyyymmddMMss");

                var path = Server.MapPath("~/WebImages/" + date + "test.jpg");

                System.IO.File.WriteAllBytes(path, String_To_Bytes2(dump));

                ViewData["path"] = date + "test.jpg";

                Session["val"] = date + "test.jpg";
            }

            return View("Index");
        }

The problem I am facing is that i am not sure how i can rewrite it each time and change all references in the db to it.
Any help is welcomed! Thank you!

A: You can also add column Image in user table of binary type and save the binary format image to that column.
Use below code to convert image to binary format and the converted bytes that you have to save in the column.
   public byte[] ConvertToBytes(HttpPostedFileBase image)
 {
    byte [] imageBytes = null;
    BinaryReader reader = new        BinaryReader
   (image.InputStream);
    imageBytes = reader.ReadBytes
    ((int )image.ContentLength);
     return imageBytes;
  }

For complete tutorial please refer link
http://www.c-sharpcorner.com/UploadFile/b696c4/how-to-upload-and-display-image-in-mvc/


text:
Q: Javascript Ajax stops working in Chrome after few iterations I am breaking my head on an embedded project: Microchip ethernet/ wifi. I have a webpage where the data is loaded via ajax. Due to size limits, I am not using jquery, just Javascript AJAX.
PROBLEM:
It seems to be all good in firefox. But in Chrome, It starts, and If I refresh, the AJAX stops working (sometimes, after repeated refreshes). No error is logged in the console.
I created a stripped down demo on
pastebin.com/test4/ajaxTest.html. It uses just the mchp.js from the microchip demo.  The page loads a number from another page via AJAX. This is repeated 100 ms, and If I cant get anything in 5 seconds ( ie ~50 attempts), it times out.
To recreate this error, open the demo link in Chrome, and keep refreshing. I have a time out of 5 seconds. I am using latest version of Chrome. Appreciate any hints. Thanks.
NOTE: Once it breaks, even if i keep refreshing, it wont work. but if I close the tab and open a new one, it works.

A: Thanks to @kol, figured it was a cache issue. So I have modified the url with a random number in the argument. Seems to be working now.

A: WireShark shows that after a while, your AJAX code gets HTTP/1.1 304 Not Modified instead of HTTP/1.1 200 OK. I think the answer gets cached by Chrome. You could append a random number argument to the URL to prevent caching (see here).

A: function getXMLHTTP() { //function to return the xml http object
var xmlhttp=false;
try{
xmlhttp=new XMLHttpRequest();
}
catch(e){
try{
xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1){
xmlhttp=false;
}
}
}

return xmlhttp;
}

function getdef()
{
alert('str');
if (str=="")
{
document.getElementById("def1").innerHTML="";
return;
}
if (window.XMLHttpRequest)


text:
Q: Transforming response data select2 do not working I use select2 (v4) and use remote data. The response is correct, but processResults function do not call and select2 do not displaying anything.
 $('#country').select2({
     placeholder: 'Select a country',
     minimumInputLength: 3,
     ajax: {
         url: 'https://battuta.medunes.net/api/country/search/?key=xx',
         dataType: 'json',
         processResults: function(data) {
            var results = [];
            $.each(data, function (index, country) {
                 results.push({
                     id: country.code,
                     text: country.name
                 });
             });

             return {
                results: results
             };
         },
         data: function(params) {
            var query = {
               country: params.term
            }

            return query;
        }
     },
     width: 'resolve',
  });

Example response from ajax request:
[
  {"name": "Indonesia", "code": "Id"},
  {"name": "French Polynesia", "code": "pf"}
]

A: Hi below is the select code for it
$('#country').select2({
     placeholder: 'Select a country',
     minimumInputLength: 3,
     ajax: {
         url: function(param){return 'https://battuta.medunes.net/api/country/search/'},
         dataType: 'jsonp' ,
         data: function (params) {

      var query = {
       country: params.term,
      // callback :"?",
       key:"00000000000000000000000000000000" //put your key here
      }
//this is important to make sure no extra params are added becuase the api rejects anything that has wrong params
      // Query parameters will be ?city=[term]&callback=?,key=
      return query;
    },
          processResults: function(data) {
            var results = [];
            $.each(data, function (index, country) {
                 results.push({
                     id: country.code,
                     text: country.name
                 });
             });

             return {
              "results":results
             };
         },

     },

     width: 'resolve',
  });

and this is my fiddle showing the working country search https://jsfiddle.net/shyamjoshi/jbfrnqLd/37/


text:
Q: Как происходит работа с соотношением сторон экрана? Не могли бы вы мне слегка объяснить как происходит работа с соотношением сторон экрана? Ведь там все в процентном соотношении! Если посмотреть на фото, то видно что в режиме 16:9 горизонтальный отрезок получается длиннее вертикального при проецировании на плоскость экрана. Как тогда рисовать квадраты? Матрица переделывается или как?

A: Это корректируется матрицей проекции. Например, в GLM функция glm::perspective вторым параметром принимает соотношение сторон экрана (aspect ratio):
GLM_FUNC_DECL mat<4, 4, T, defaultp> glm::perspective(T fovy, T aspect, T near, T far);


text:
Q: Is "Never mind" a phrasal verb? When we say "never mind that" to mean disregard or don't worry about, is it a verb altogether (a phrasal verb) or is "mind" the verb that's modified by the adverb never? Examples:
Never mind what he told you
Never mind his suggestions

You can say "Mind his suggestions." although that would sound old-fashioned. Is "never mind" just the negation of that with the adverb never?

A: 'Never' is certainly not used with the usual meaning here; 'Never mind what he said to you last week' is very different from 'Never worry about what he said to you'. I'd agree that there is a cohesiveness between 'never' and 'mind'.
In fact, never mind is listed by the dictionaries I've checked in as a 'phrase' or an 'idiom', eg by the Cambridge Dictionary of American Idioms:

never mind (somebody/something): do not worry about someone or
  something
"I lost that wallet you gave me." "Well, never mind, I can
  always buy you another one."
Never mind Susan – she can get a ride
  home with someone else.

I avoid the term 'phrasal verb' as being too ambiguous, and this is different again from what most people using the terms would include as a 'phrasal verb' (* I never mind etc) but this is surely better regarded as a multi-word construction than 'adverb + verb'.

A: If you want to desperately enough, you can get away with analyzing "never mind" as a phrasal verb, but it would be a strangely vestigal example of one: It exists only in the imperative, and loses its idiomatic meaning if you try to make an infinitive or indicative form of it.
However, it doesn't appear to be terribly useful to consider "never mind" a phrasal verb.
Namely, "never mind" does not have the form that ordinary phrasal verbs in English have, which consists of an ordinary verb first, followed by a stressed particle. The purpose of singling out a class of expressions as "phrasal verbs" is so that we can identify commonalities between their syntax -- for example, phrasal verbs follow common patterns for whether the particle comes before of after a direct object, and those patterns do not apply to "never mind" at all.

A: This is an idiomatic expression, not a phrasal verb.  In this expression, the word mind means 'consider' or 'remember', a usage still current in Scots English, where one might routinely say, 'Mind we're going for a beer later,' or 'Mind that game last Friday.' (The BBC gives a couple of historical examples here).  A familiar example is Auld Lang Syne:

Should auld acquaintance be forgot,
And never brought to mind?

'Mind', here, is 'active, conscious memory' (paralleling 'forgot').
The expression 'Never mind' still carries this sense.  Its general sense is, 'Don't spend time reflecting on [whatever it was].'
A subtlety in this context is that 'never' means 'don't ever'.  That might seem identical, and as a literal instruction it would of course be equivalent.  In this case, however, the important idea is 'don't', and it is intensified by 'ever'.
The initial meaning of 'mind' here is something like 'remember with focused attention'.  'Never mind' therefore ends up meaning something like 'It's not worth conscious effort.'
The force of the expression evolves like this, then:

Mind something (remember it and reflect on it)
Don't mind it (ignore it:  it isn't that important)
Never mind it (do not ever waste your time giving it any attention)

This is all related to the sense of 'mind' in usages like 'Mind the gap', familiar to any regular user of the London Underground.  This common announcement is an instruction to remember and attend to the gap between train and platform, when embarking or alighting.
In fact, this announcement reminds you:  it puts something back into your conscious attention, just in case you were about to act without attending to it.
And if someone ever says to you something along the lines of, 'But that was your turn, mind' (a pretty common kind of construction in British English), once again 'mind' essentially means 'specifically recall'.

A: Few days before I have installed idioms and phrases application and I found "Never mind" in that application.
Here is the full definition.
Never mind:
Don't be concerned about it; ignore what was just said
Example
■ When he spilled his drink on my coat, I said, "Never mind. It needs to be cleaned anyway."
■ So you weren't listening to me again. Never mind; it wasn't important.


text:
Q: Auto File SharePoint Incoming Email I have a request to setup a doc lib to capture all emails for a particular project and file it in a particular folder within the library.  Here's the a quick run thru:

*

*I have a doc lib called BCDL with the incoming email option enabled. The email address for the doc lib is bcdl@mydomain.com.

*The user will, in advance, manually create folders with naming convention of "Proj-XXXXX" where XXXXX is the project number

*All emails (with or without attachment) going to bcdl@mydomain.com will be forwardedto the BCDL library.  The subject of the email will include the "Proj-XXXXX" text in it.  Note, the  position of this text can vary is it is a response to an email.

*After the email arrived, a workflow or task of some sort needs to parse the subject
and look for the "Proj-XXXXX" and move that email to the "Prox-XXXXX" folder which was pre created in step 2.

In summary, I want to setup a Doc Lib where all incoming email will be filed to the respective "Proj-XXXXX" folder parsed in the subject line.
Not sure where to start.  I have look at the doc lib, one of the issues I am seeing is that email to a doc lib MUST contain an attachment or it will not accept it.  A custom list does not have incoming email option.
Update 20/11 after answer and comments:
The problem with grouping is that I can't apply permission to it. Someone would have to apply the permission to each entry. With folder, the user would apply the permission when the folder was first created.

A: email to a document library MUST have an attachment? Don't think that's true.

Check out the screenshot above (it's a bit small, sorry). Ensure you have set the "Save Original Email" set to true.
Let's assume for now that would fix it, you have answered a large part of your question already. I would implement an event receiver to handle the parsing of the email + moving the file.


text:
Q: Why standard Office 365 Excel Add-in Template in Visual Studio does not work? I have just created a simple Excel Web Add-in in Visual Studio 2019 with standard template. I didn't change anything in the code. I am using Office 365 Excel Desktop and Windows 10 OS.
I run the project then Excel is being opened. But, When I click the Default "Show Taskpane button"then I have faced an Exception which is "Unhandled exception at 0x00007FFDA1F415BB (EdgeManager.dll) in Win32WebViewHost.exe: Fatal program exit requested. occurred"
But also, I have noticed that none of Office Store Apps are running anymore.


text:
Q: NavBar not working in Bootstrap using integrity parameter in link I am trying to include NavBar in my html code, but it is not succeeding since the integrity parameter in the link statement is posing a problem.
I have included to change the integrity parameter to other values, yet the problem persists.

<!DOCTYPE html>

  <meta charset="utf-8">
  <link rel="stylesheet" type="text/css" href="css2.css">
  <link href="https://fonts.googleapis.com/css?family=Gamja+Flower" rel="stylesheet">
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrapcdn.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
  <title></title>

        Active

        Link

        Link

        Disabled

I expected a perfect NavBar to be displayed.
It instead results in an ordinary unordered list.

A: Change your bootstrap links to

<!DOCTYPE html>

  <meta charset="utf-8">
  <link rel="stylesheet" type="text/css" href="css2.css">
  <link href="https://fonts.googleapis.com/css?family=Gamja+Flower" rel="stylesheet">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
  <title></title>

        Active

        Link

        Link

        Disabled


text:
Q: How can I get Powershell TabExpansion to print all the possible completions? The default TabExpansion in Powershell cycles through the possible completions for the fragment on the command prompt.  Internally in the PowerShell host, there's a circular buffer, and the first TAB fills the buffer and puts the first potential completion on the prompt.  Subsequent TABs cycle through the list of possible completions.
How can I modify TabExpansion to just display the set of possible completions when I hit ?
Also, can I invoke the TabExpansion function explicitly from the command prompt, and if so, how?
(If you don't know what I mean by "modify TabExpansion", see this link.)

A: Check out PowerTab. It's pretty cool.
UPDATE
Download PowerTab at CodePlex.

A: see here.
http://www.leeholmes.com/blog/AddingDoubleTapTabCompletionToPowerShell.aspx

A: You can modify it directly at the prompt --or in your profile script--  it's just a function, so you could type this at a prompt to alter it to print all answers:
Copy Function:\TabExpansion Function:\OriginalTabExpansion
function TabExpansion([string] $line, [string] $lastword) {
   OriginalTabExpansion $line $lastword | Out-Host
   $line
}

Or you can go a little further and format it wide:
Copy Function:\TabExpansion Function:\OriginalTabExpansion
function TabExpansion([string] $line, [string] $lastword) {
   Write-Host # an emtpy newline to avoid outputting on the prompt line
   # A hack, because Format-Wide doesn't work on strings
   $obj = new-object psobject | add-member noteproperty value "" -Passthru
   OriginalTabExpansion $line $lastword | ForEach { $obj.value = $_; $obj } |
      Format-Wide -auto value | Out-Host
   ## Maybe even re-output your prompt function... depending on how it's written
   Write-Host $(prompt) -NoNewLine
   return $line # keep the command as it was
}

PS: Vote for the bug on Format-Wide

A: This one-liner seems to work around the problem with format-wide and an array of strings:
$ComputerList | Select-Object -Property @{Expression={[Object[]] $_};Name="Name"} | Format-Wide -Property Name -Column 5
The array of strings in this case is $ComputerList defined like this:
[array] $ComputerList = @("WINSRV2003-32B","WINSRV2003-64B")


text:
Q: Multidimensional Array or Multidimensional arraylist I have a problem in my code where I need to compare four doubles against other sets of four doubles. I tried creating a four dimensional array for this:
double[][][][] myArray = new double[][][][] {{{{1.1}, {1.2}, {1.3},{1.4}}}};

But the problem with this is I do not know the size of the array and I need to be able to add elements to it dynamically. I am unfamiliar with array lists but I was wondering if this would be the solution? Can you have mutli-dimensional array lists?
Edit to provide better explanation of the problem:
The reason I have four doubles is they store locations concering journeys.
Double 1 = lattitude of start location.
Double 2 = longitude of start location.
Double 3 = lattitude of end location.
Double 4 = longitude of end location.

So I have 4 doubles associated with a journey and I need to be able to take those values and compare them with other sets of 4 doubles to see if these locations are within a reasonable distance of each other. I have already resolved that side of the problem. Its just comparing one set of 4 doubles against n other sets is what I am trying to do. I ultimately want to be able to run every set off each other to determine if they are similar.

A: First of all, there is no reason to use a 4-dimensional array. No offense but this kind of code looks ugly!
To add elements to the array dynamically, instead use an ArrayList<Double>. There is no fixed size to this data structure. You could initialize it like such:
List<Double> dblList = Arrays.asList(1.1, 1.2, 1.3, 1.4);

Or
List<Double> dblList = new ArrayList<Double>(new Double[] {1.1, 1.2, 1.3, 1.4});

UPDATE
Sorry, I just realized that you want to compare multiple list to each other. But still, this answer should be able to help you.

A: To compare sets of 4 doubles against each other, you don't need 4 dimensions, only 2.  The first dimension is for however many sets of doubles you have, and the second dimension is for the 4 doubles each.
double[][] myArray = new double[2 /*sets*/][4 /*doubles each*/] = {
    {1.1, 1.2, 1.3, 1.4}, {2.1, 2.2, 2.3, 2.4}};

If you need to add to the list, then you probably want an ArrayList<ArrayList<Double>> so can add lists of 4 doubles.  Or perhaps an ArrayList<double[]> so that you can add arrays of 4 doubles each to a growing ArrayList.

A: If I get it well, what you want is a collection of an object containing four double.
This can be represented using a List containing some List of Double.
This way you can use built in equals and hashcode methods of the Collection api of Java to make operations on your List<Double>.
Therefor you can have your code like this :
List<List<Double>> dblList = new ArrayList<List<Double>>();

And add some lists of four Double to it.
The main advantage of this methods is that you can check the equality of two of your sublist using the method equals of the List interface.

A: I was a bit confused about the term "set", because that implies that order of the double values does not matter.  Based on your update to the question, I am assuming that the order does matter.
If all you're wanting to do is iterate through the existing values and call your method, that is pretty simple:
List<List<Double>> doubles = new ArrayList<List<Double>>();
doubles.add(Arrays.asList(1.1, 1.2, 1.3, 1.4));
doubles.add(Arrays.asList(2.1, 1.2, 1.3, 1.4));
doubles.add(Arrays.asList(1.1, 1.2, 1.3, 1.4));
doubles.add(Arrays.asList(3.1, 1.2, 1.3, 1.4));

List<Double> newValue = Arrays.asList(1.1, 1.2, 1.3, 1.4);
for (List<Double> vals : doubles) {
    compareJourneys(newValue, vals); //this is your comparison method
}

If it turns out that I misinterpreted your use of the word "set", you could use a List<Set<Double>> instead of a List<List<Double>>.

A: From my understanding of your problem, I don't believe a multidimensional array is suitable. Given that your four doubles, each which have significant meaning, perhaps grouping them into a class would be more meaningful. For example...
class JourneyCoords {
 private double latStart;
 private double latEnd;
 private double longStart;
 private double longEnd;
 JourneyCoords(double latStart,double latEnd,double longStart, double longEnd){
  this.latStart = latStart;
  this.latEnd = latEnd;
  this.longStart = longStart;
  this.longEnd = longEnd;
 }
 public Boolean isWithinReasonableDistance(JourneyCoords other){
  // What you define to be within reasonable distance
  return true;
 }
}

Then with an array or list of JourneyCoords objects you can run pairwise comparison between each as follows:
JourneyCoords[] myJourneyCoords = new JourneyCoords[10];

// Initialization of values
for(int i=0;i<myJourneyCoords.length;i++){
 myJourneyCoords = new JourneyCoords(0.0,0.0,0.0,0.0);
}

// Pairwise comparison
for(int i=0;i<myJourneyCoords.length;i++){
 for(int j=i+1;j<myJourneyCoords.length;j++){
  if(myJourneyCoords[i].isWithinReasonableDistance(myJourneyCoords[j])){
   // These two are within reasonable distance
  }
 }
}

I didn't test the code, but hopefully you get the concept.


text:
Q: How many fake examples are required for training a GAN? I recently trained a GAN with ~1000 real images and 64 fake images. This obviously wasn't enough fake images, so most of the "latent space" in the GAN just creates the same image. How many fake images are GANs usually trained with in order to make their latent space usable?

A: The number of fake images that you generate depends on the size of the noise vector that you sample. Ideally, in a single step of training, you would sample a noise vector of dimension batch_size x noise_dim and use the generator to generate batch_size fake images. Similarly, your discriminator would see the batch_size number of real images.
This way, at every step, your discriminator sees an equal number of fake and real images, and the total number of fake images seen by your discriminator would be equal to the total number of images in your training set itself.


text:
Q: Deploy shiny app that can call runApp() inside application itself (specifically for tabulizer package) I'm trying to deploy a Shiny app that allows the user to upload a pdf document and extract a table from a selected page. For this I'm using the package tabulizer. A basic reproducible example:
library(shiny)
library(tabulizer)

ui <- fluidPage(
  fileInput("report", NULL,buttonLabel = "Upload report"),
  numericInput("page","Specify page number",value = 1),
  actionButton("extract","Extract"),
  verbatimTextOutput("data")
)

server <- function(input, output, session) {
  generate_data <- reactive({
    req(input$report)
    # This locate_area function calls runApp() from the tabulizer package
    area <- locate_areas(file = input$report$datapath,
                         pages = input$page,
                         widget = "reduced")
    table <- extract_tables(file = input$report$datapath,
                            pages = input$page,
                            area = area)
    return(table)
  })%>% bindCache(input$page) %>% bindEvent(input$extract)

  output$data <- renderPrint({
    # Just for the sake of this example to show it works
    generate_data()
  })
}

shinyApp(ui = ui, server = server)

If I run this locally, the locate_area() will make the pdf page pop-up on my viewer in RStudio and all is well. However, if I publish the app it doesn't run after clicking the action button. I know the problem comes from the locate_area() as it essentially calls another runApp within the shiny app. I have tried using different widgets for locate_area() to no avail. Does anybody know a way to circumvent this issue?

A: Judging by the relevant issues - issue 15 and issue 53 - it appears that your best way to go is really to copy the functionality from the original tabulizer function into your own app, as currently the package does not provide an easy integration with other Shiny apps.


text:
Q: strategy for maintaining both native and wcf service layer I've got a web application that will sometimes call a service layer from a codebehind as well as call some restful WCF services from clientside code (e.g. JQuery).
I've found that there is a bit of work maintaining both service layers.  I've considered doing away with the native dot.net service layer and using WCF services only, however in my experience this can result in performance that is 4-10x slower due to the web services overhead.
How do the rest of you handle this? Do you manually maintain both layers? Are there practices/tools/frameworks that make this maintenance/synchronization process easier?  Or do you take the performance hit and live solely with a web services layer?

A: One suggestion that i can give you regarding design of WCF layer is that keep is as thin as possible. The WCF layer should only be responsible for send and receiving data and should be voided of any business functionality\validation. Most of the time it should be delegating work to the service layer. This way maintenance of the service layer is the only major task to take care. WCF wrapper then should be easier to create and maintain. This way you can continue using the old approach with all the performance benefits.


text:
Q: how to debug sun.security package in eclipse I want to debug sun.security.rsa.RSAKeyFactorysource code with eclipse, but how ?
ProviderConfig: Loading provider: sun.security.rsa.SunRsaSign
Provider: Set SunRsaSign provider property     [KeyFactory.RSA/sun.security.rsa.RSAKeyFactory]
Provider: Set SunRsaSign provider property     [KeyPairGenerator.RSA/sun.security.rsa.RSAKeyPairGenerator]
Provider: Set SunRsaSign provider property     [Signature.MD2withRSA/sun.security.rsa.RSASignature$MD2withRSA]
Provider: Set SunRsaSign provider property     [Signature.MD5withRSA/sun.security.rsa.RSASignature$MD5withRSA]
Provider: Set SunRsaSign provider property     [Signature.SHA1withRSA/sun.security.rsa.RSASignature$SHA1withRSA]
Provider: Set SunRsaSign provider property     [Signature.SHA256withRSA/sun.security.rsa.RSASignature$SHA256withRSA]
Provider: Set SunRsaSign provider property     [Signature.SHA384withRSA/sun.security.rsa.RSASignature$SHA384withRSA]
Provider: Set SunRsaSign provider property     [Signature.SHA512withRSA/sun.security.rsa.RSASignature$SHA512withRSA]
Provider: Set SunRsaSign provider property     [Signature.MD2withRSA SupportedKeyClasses/java.security.interfaces.]

A: Not all sources with jdk
Some people say that sources should be included with jdk's src.zip file.
This is what I got in C:\Program Files\Java\jdk1.8.0_25\src.zip\com\sun\security
auth
jgss

So there is no provider directory nor rsa etc.
Solution
You can see the file source here.
To get it working in Eclipse using F3, download the zipped source. Rename it to
C:\Program Files\Java\jdk1.8.0_25\src.zip

Linux's jdk src.zip is also incomplete.
Eclipse settings

*

*If you cannot find the declaration with F3 in Eclipse try this

*Also if you want to open implementation declaration try this


text:
Q: Invertible elements and identity element in $\mathbb Z_6$ under the circle product Let's define the operation $\odot$ on $\mathbb Z_{6}$ as follows:
$$\begin{aligned}x\odot y=x+y+xy\end{aligned}$$
Show:

*

*$(\mathbb Z_6, \odot)$ is a monoid;

*if $3 \in \mathbb Z_6$ is an invertible element, if so use an appropriate congruential equation to determine its invertible element;

*define all the invertible elements in $\mathbb Z_6$.

I've started proving the last two items first. The element $3$ is not an invertible element in $\mathbb Z_6$ because $gcd(3,6) \neq 1$.
In order to define all the invertible elements in $\mathbb Z_6$ I thought it would be enough to enumerate all the elements $[a] \in \mathbb Z_6 : gcd(a,6)=1$. So I concluded all invertible elements in $\mathbb Z_6$ are:
$$\begin{aligned}\{1+6k:k\in\mathbb Z\} = 1+6 \mathbb Z\end{aligned}$$ and
$$\begin{aligned}\{5+6k:k\in\mathbb Z\} = 5+6 \mathbb Z\end{aligned}$$
In order to prove $(\mathbb Z_6, \odot)$ to be a monoid, we require $\odot$ to be associative and $\exists \mathbb 1_{\mathbb Z_{6}} : x \odot \mathbb 1_{\mathbb Z_{6}} = \mathbb 1_{\mathbb Z_{6}} \odot x = x$
Associativity
$$\begin{aligned}(a \odot b) \odot c = a \odot (b \odot c)\end{aligned}$$
$$\begin{aligned}(a+b+ab) \odot c = a \odot (b+c+bc)\end{aligned}$$
$$\begin{aligned}a+b+ab+c+ac+bc+abc = a+b+c+bc+ab+ac+abc\end{aligned}$$
And the point is proved.
Identity element
$$\begin{aligned}a \odot \mathbb 1_{\mathbb Z_{6}} = a\end{aligned}$$
$$\begin{aligned}1_{\mathbb Z_{6}} + a1_{\mathbb Z_{6}} = 0 \end{aligned}$$
... and now I am stuck because I don't know how to proceed in order to evaluate $1_{\mathbb Z_{6}}$.
Is it correct stating $1_{\mathbb Z_{6}} + a1_{\mathbb Z_{6}} = 0 \Rightarrow a1_{\mathbb Z_{6}} = 0$? How do I take it from here?

A: First, your problem in particular.
You should not answer the second question first. Your answer is assuming you are talking about the usual multiplicative structure of $\mathbb{Z}_6$, but that is not the case. Once you prove that $(\mathbb{Z},\odot)$ is a monoid, the question is asking you to determine whether $3$ is invertible relative to the operation $\odot$. So checking whether $\gcd(3,6)=1$ may not do you any good.  Likewise, the third question is not really asking you to find the elements of $\mathbb{Z}_6$ that are invertible under the usual multiplication, but rather to find the elements that are invertible relative to the operation $\odot$. So you've correctly answered a different question from what you are being asked, and incorrectly answered the question you were really asked.
So, let's talk about $\odot$.
You've shown that $\odot$ is associative, so that means $(\mathbb{Z}_6,\odot)$ is a semigroup. To prove that it is a monoid, you need to find some element $z$ of $\mathbb{Z}_6$ with the property that $a\odot z=z\odot a = a$ for all $a$. So you need
$$a = a\odot z = a+z+az.$$
Therefore, we need $a=a+z+az$, which means $0=z+az = z(1+a)$. This has to hold for every $a\in\mathbb{Z}_6$. So... what must $z$ be?
(Note that since $b\odot a = b+a+ba = a+b+ab=a\odot b$, you in fact can save yourself a bit of work; you don't actually need to check that $z\odot a= a$ also holds).
Once you determine what $z$ is, the second part of the question is asking you to determine whether there exists $a\in\mathbb{Z}_6$ such that $3\odot a = z$.
Finally, the problem asks you to figure out all elements $a\in\mathbb{Z}_6$ with the property that there exists $b\in\mathbb{Z}_6$ such that $a\odot b = z$.

Now, general comments. Do not read this until you attempt the problem as outlined above.
The operation you are talking about is known as the "circle operation" (sometimes it is defined as $x\odot y = x+y-xy$, in which case some of the pluses signs below need to be turned into minuses, and vice versa).  In a ring, the elements that are invertible under the circle operation are known as "quasi-units", and the group of quasi-units of the ring is known as the "circle group" of the ring. (Associativity of the circle operation guarantees that if $x$ and $y$ are quasi-units, then so is $x\odot y$).
If $R$ is a ring, the identity of the $\odot$ operation is $0_R$, since $x\odot 0_R = x+0_R + x0_r = x$ and $0_R\odot x = 0_R + x + 0_Rx = x$. If $R$ is commutative, then the circle monoid $(R,\odot)$ is commutative.
When $R$ has a multiplicative identity, $1_R$, then the circle group of the ring is isomorphic to the group of units of $R$ by the map $x\mapsto 1_R+x$.
Indeed, if $x$ is quasi-invertible, then there exists $y$ such that $x\odot y = 0_R$ (and $y\odot x = 0_R$ when we don't assume $R$ is commutative). Then $x+y+xy=0_R$, so
$$(1_R+x)(1_R+y) = 1_R + x + y + xy = 1_R.$$
Conversely, if $z$ is a unit in $R$, then there exists $w$ such that $zw=1_R$. Then
$$(z-1_R)\odot(w-1_R) = (z-1_R)+(w-1_R) + (z-1_R)(w-1_R) = z+w-1_R-1_R+zw - z-w-1_R = 0_R$$
so $z-1_R$ is a quasi-unit. Thus, the map is a bijection between quasi-units and units.
Finally, note that $x\odot y + 1_R = x+y+xy+1_R$, and $(x+1_R)(y+1_R) = xy +x+y+1_R$, so the map is a group homomorphism.


text:
Q: Black Ops 2 Zombies permanent perks I've seen many articles online claiming that there are permanent perks in Tranzit that can be unlocked through challenges. I've managed to earn permanent quick revive by reviving the  same player 15ish times. However, there are supposedly other permanent perks that you can earn such as phd flopper, stamina-up, and one that allows you to rebuild stronger barriers.
I've searched all over through Google looking for ways to get these perks. But, all I've managed to find are discussion boards talking about them with contradicting solutions for how these perks can be unlocked, or Youtube videos showing a player with the perk unlocked without any explanation of how to get it.
If anyone can provide a solid testable answer listing which permanent perks can be unlocked, and explanation of how to get them it would be greatly appreciated.

A: This link will help.
http://www.se7ensins.com/forums/threads/how-to-get-permanent-perks-will-be-updated.817134/
It provides detailed information about the permanent perks and how to get them.
Although, note that "Deadshot Daiquiri" can only be earned after round 3.


text:
Q: AppleScript does not understand "ApplicationIsRunning" message I am new to AppleScript and trying to incorporate a script associated with the logging out of my VPN. Basically, if my VPN fails or I log out, I want it to close my browser for security purposes. However, Applescript won't "understand" the ApplicationIsRunning check that I have found everywhere online... any thoughts??
set apps to {"Firefox", "uTorrent"}
repeat with thisApp in apps
    if ApplicationIsRunning(thisApp) then
        tell application thisApp to quit
    end if
end repeat

Error:
error "«script» doesn't understand the "ApplicationIsRunning" message." number -1708 from «script»

A: Try:
set apps to {"Firefox", "uTorrent"}
repeat with thisApp in apps
  if application thisApp is running then
    tell application thisApp to quit
  end if
end repeat


text:
Q: I want to hide the script of a stored procedure in SQL Server 2008 I have written a stored procedure in SQL Server.
Now its just that I don't want any one to see my script or edit it.
Please remember that I am working on the a standard login id and password.
Which is shared with every one.
Hence some way where I can allow every one to execute the procedure.
But they shouldn't see the script.
Cheers!
thanks

A: You're looking for WITH ENCRYPTION, which encrypts the code behind your stored proc.
CREATE PROCEDURE usp_MyProc
WITH ENCRYPTION
AS
SELECT *
FROM myTable

Just a caveat, from MSDN:

Users who have no access to system tables or database files cannot retrieve the obfuscated text. However, the text will be available to privileged users who can either access system tables over the DAC port or directly access database files.

Some references and further reading:

*

*http://blog.sqlauthority.com/2007/07/01/sql-server-explanation-of-with-encryption-clause-for-stored-procedure-and-user-defined-functions/

*http://msdn.microsoft.com/en-us/library/ms187926.aspx

A: SQL Server doesn't truly provide a foolproof method to protect module code. The WITH ENCRYPTION clause should be named something along the lines of WITH LOOSE_OBFUSCATION, since the "encryption" is very easily thwarted. You're not going to be able to use anything in SQL Server to make the code undecipherable by anyone except the most casual onlookers - anyone determined is going to be able to beat native methods without breaking a sweat.
While this may be good enough for your needs, probably a safer way (but still not perfect) is to put some or all of the procedure's business logic into the CLR (read more here).

A: Use the encryption keyword for your stored procedure. This will hide the code:
CREATE PROCEDURE dbo.foo
WITH ENCRYPTION
AS
BEGIN
    SELECT 'foo'
END

A: Avoid using the WITH ENCRYPTION option other than for very specified requirements. It may lead to administrative problems later.
Using WITH ENCRYPTION is not a recommended best practice to hide the definition/code of an object. Luckily, there is an alternative approach for SQL Server.
If it is required to hide the definition/code of any object from a user then standard permissions can be used for this purpose. This can be done by granting or revoking View Definition rights.
If permission View Definition is denied for an object to any user then the user would not be able to view the object in SSMS or view its code through the system stored procedure sp_helptext.
The View Definition permission may also be used for other objects in SQL Server like tables, synonyms etc. View Definition permissions can be granted or denied using both T-SQL or SSMS
For implementation of permissions through SSMS :

*

*Right click on the object that is required to hide the definition

*Click on Properties, a frame will appear, select grant or deny View Definition permission on the object for the selected user or role

Denying View Definition permission will hide the object for a specific user and also the user will not be able to see the definition using sp_helptext
Other permissions like SELECT, INSERT etc will remain intact.
The permissions are flexible and can be implemented on the following four levels:

*

*Server level. At server level this permission will be listed as View Any Definition
2 .Database level

*Schema level

*Individual entity level

Thank you hope it will clear confusion.


text:
Q: Laravel - too many redirects issue I'm on a project, the website have two types of users Admin and User. I made an middleware for the admin, the middleware is working correctly but when I try to login an issue showed up:

too many redirects

my routes:
<?php

Route::get('/', [
    'uses' => 'UserController@getIndex',
    'as' => 'welcome'
]);
Route::get('/{form?}', [
    'uses' => 'UserController@getIndex',
    'as' => 'index'
]);
Route::post('/exsist',[
    'uses' => 'UserController@postLogin',
    'as' => 'login'
]);
Route::group(['middleware' => 'auth'],function(){
    Route::group(['prefix' => '/admin','middleware' => 'admin'],function(){
        Route::group(['prefix' => '/my'],function(){
            Route::get('/home', [
                'uses' => 'AdminController@getHome',
                'as' => 'admin.home'
            ]);
        });
    });
    Route::group(['prefix' => '/'],function(){
        Route::get('/home', [
            'uses' => 'UserController@getHome',
            'as' => 'home'
        ]);
    });
});

and my controller:
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

use App\Http\Requests;
use App\User;
class UserController extends Controller
{
        //main page
    public function getIndex($form = ''){
            if(Auth::check()){
                if(Auth::user()->isAdmin()){
                    return redirect()->route('admin.home');
                }else{
                    return redirect()->route('home');
                }
            }
            return view('welcome', ['form' => $form]);
        }
        //main login (index page)
        public function postLogin(Request $request){
            //validation
            $this->validate($request,[
                'email' => 'required|email',
                'pass' => 'required'
            ]);
            //authintecating user
            if(Auth::attempt(['email'=>$request['email'], 'password'=>$request['pass']])){
                if(Auth::user()->isAdmin()){
                    return redirect()->route('admin.home')->with(['success'=>'You have successfuly loged in as Admin!']);
                }else{
                    return redirect()->route('home')->with(['success'=>'You have successfuly loged in as User!']);
                }
            }
            return redirect()->route('index')->with(['fail'=>'Wrong Email or Password!']);
        }
        public function getHome(){
            return view('home');
        }
}

why does the browser gives me an error?

A: Try changing:
Route::get('/{form?}', [
'uses' => 'UserController@getIndex',
'as' => 'index'
]);

To:
Route::get('/form/{form?}', [
'uses' => 'UserController@getIndex',
'as' => 'index'
]);

I believe when you go to the '/' route, the '/{form?}' route is being executed.


text:
Q: what is the default color scheme for sublime text 2? I've changed the color scheme on sublime text 2 and I really hate the colors it changed to.
So what is the name of the default settings? Because I want to change it back to the standard.

A: The default Color Schema for ST2 is Monokai

A: Color Scheme for Sublime 3
Preferences -> Color Scheme -> Color Scheme - Default -> Monokai


text:
Q: Floating exponent exponentiation algorithm I must to write a algorithm that exponentiates a base (integer or float) in a integer or float argument. I wrote this algorithm for Deluge (zoho.com), but it can only use integer exponents:
float math.potencia(float base, int expoente)
{
   if(expoente>0)
    {
    base = base * thisapp.math.potencia(base, (input.expoente  -  1));
    }
    else if (expoente == 0)
    {
    base = 1;
    }
    return base;
}

(Deluge doesn't have a potentiation operator or function). Thanks!

A: Suppose that you can use sqrt, you can use the following algorithm:
double EPS = 0.0001;

double exponentiation(double base, double exp) {
  if(exp >= 1) {
    double temp = exponentiation(base, exp / 2);
    return temp * temp;
  } else {
    double low = 0;
    double high = 1.0;

    double sqr = sqrt(base);
    double acc = sqr;
    double mid = high / 2;

    while(fabs(mid - exp) > EPS) {
      sqr = sqrt(sqr);

      if (mid <= exp) {
          low = mid;
          acc *= sqr;
      } else {
          high = mid;
          acc *= (1 / sqr);
      }

      mid = (low + high) / 2;
    }

    return acc;
  }
}

A: Well, more than 17 hours without a reply, finally I've found an answer to my own question:
In the simplest way, we can solve the problem using the value of "e" exponentiating to the logarithm of the number divided by the index:
e^(Log(number)/index)
where number is the radicand and index is the desired root.
Eg: The 10th root of the number 1024:
e^(Log(1024)/10) = 2.
PS: the base of the Log function is also "e".
the rounded value for "e" is: 2.718281828459045
I hope this technique may be usefull for you.


text:
Q: How to retrieve ArrayList with Volley and put it in PullToRefreshListView? I am actually working on a ListView. I read data from a server and I use Volley to do this.
I have a News class who has a title, a description and a picture.
I have my function getNewsList(Context context) which I want to return an ArrayList.
But I return a null value.
Here is my function :
    public ArrayList<News> getNewsList(final Context context) {

    apws = new APWSManager(context, new APWSRequestState() {

        @Override
        public void customURLFinishedDownload(String response) {
            // TODO Auto-generated method stub
            Log.i("RESPONSE LISTVIEWPARSER : ", response);
            try {
                JSONArray   array = new JSONArray(response);
                for (int i = 0; i < array.length(); i++) {
                    JSONObject myJson = array.getJSONObject(i);
                    parseJsonItem(myJson);
                    //listCount += INTERVALLE;
                    myAdapter.notifyDataSetChanged();
                }
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } finally {
            }
        }

        @Override
        public void customURLFailedDownload(String errorMessage) {
            // TODO Auto-generated method stub
            Log.i("ERROR REQUEST : ", errorMessage.toString());
        }
    });
    HashMap<String, String> mapGet = new HashMap<String, String>();
    mapGet.put("&start=", String.valueOf(listCount));
    mapGet.put("&end=", String.valueOf((listCount+INTERVALLE)));

    apws.callAPWSRequest("getnews", mapGet, null, TypeMethod.GET, true);

    return m_ListItem;
}

When I get my response, I parse it with my function parseJsonItem(JSONObject object) to get values "title", "picture" and "description".
Here is my function :
    private void parseJsonItem(JSONObject myItem) {
    try {
        Log.i("NEWS " + myItem.getString("title"), myItem.toString());
        mNews = new News(myItem.getString("title"), myItem.getString("value_out"), myItem.getString("picture"));

        m_ListItem.add(mNews);
    } catch (JSONException e) {
        e.printStackTrace();
    }
}

My problem is the next : I implement a custom ListView who's called PullToRefreshListView.
I have three steps in that Object : the first load, the onLoadMore and the onRefresh. I retrieve correctly my data in my ListView, you can see the result here :
http://imagizer.imageshack.us/a/img842/6004/8wi4.png
I have two booleans : firstLoad to know if I load for the first time, and isRefreshing to know if my ListView is refreshing or not.
I need to implement it in my ListView. I have a constant value 'INTERVALLE = 5' because i am loading data 5 by 5.
My function getNewsList return null value for my ArrayList. Do you have an idea what I am doing wrong and anyone used onLoadMore and onRefresh and can explain to me?
Thank you guys !


text:
Q: Use "X" to close userform and maximize Excel window On a worksheet there's a command button to show UserForm1 and also minimize the Excel application's window.
Private Sub CommandButton1_Click()

Application.WindowState = xlMinimized
UserForm1.Show vbModeless

End Sub

There's code for UserForm1's "X" that unloads UserForm1 and should maximize the Excel window as the front window.
Private Sub cmdExit_Click()
If ExitAsk = vbYes Then
    Unload Me
    Application.WindowState = xlMaximized
End If
End Sub

Everything works but Excel stays minimized.

A:
There's code for UserForm1's "X" that unloads UserForm1 and should maximize the Excel window as the front window.

Is this what you are trying? This will maximize the userform the moment you press the X on the userform.
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    Application.WindowState = xlMaximized
End Sub

You can also use the UserForm_Terminate event for this
Private Sub UserForm_Terminate()
    Application.WindowState = xlMaximized
End Sub


text:
Q: Cordova 3.0.0 with dojo toolkit 1.9 return "unknown chromium error: -6" on android 4.2.2 I am having "unknown chromium error: -6" for a very simple Cordova/Dojo application. It did not happen with Cordova 2.9.0? Do anyone has this problem? If I run the same index.html on a desktop, the console throw this error
Cross origin requests are only supported for HTTP. dojo.js.uncompressed.js:308
req.getText dojo.js.uncompressed.js:308
injectModule dojo.js.uncompressed.js:1522
doRequire dojo.js.uncompressed.js:6703
dojo.require dojo.js.uncompressed.js:6740
(anonymous function) index.html:63

Does anyone encounter this problem?

My application looks like this

        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" href="js/dojo-1.9.1/dojox/mobile/themes/android/android.css" type="text/css" media="screen" title="no title" charset="utf-8">
        <link rel="stylesheet" type="text/css" href="css/index.css" />

A: Have you tried with the brand new released Cordova 3.1? With a bit of luck this might fix the problem.

A: After days of debugging, I have finally found the problem, it is due to some of dojo javascript file name starts with underscore _ . Apparently it is a known problem in Android webkit where it refuses to load any filename starts with a underscore from the local file system.
The workaround is to use dojo build.


text:
Q: producing a stock market game based on variable data I recently launched a stock market game (http://linkdaq.net) based on the top 50,000 sites ordered by the amount of links, it works reasonably well but I'm not 100% happy with the maths behind it.
Let me first be upfront and say I've no experience in the stock market, this was just a little weekend project that has taken a life of it own.
Each morning I get a list of sites, what rank they are (1-50000) the amount of links they have today and the amount of links they had yesterday.
I currently use this as my formula
(((50000 - rank ) + number_of_links) * 0.0010)
This gives me a dollar amount that is reasonable
I also work under the assumption that a site will gain 0.03% of its links per day, if it does more than this, it gets a daily bonus of 0.05% if it does less it loses 0.05% due to lack of growth.
So my question is two fold really,
1) How should I go about improving this, all the current stock market formulas I've found are based on the number of people investing in a stock and I'm not ready to use that model yet.
 2) My next task is to add other elements such as twitter shares and facebook likes but I'm a little uneasy about giving them a dollar value the difference is just massive 999736 vs 4 for some urls, do you have any reading suggestions on how I can combat this?
Thanks a lot


text:
Q: sum of column returning double the value I have the following SQL query:
SELECT s.name, s.learner_tag, s.guild_id, s.id, ifnull(sum(t.xp),0) as xp, ifnull(sum(a.ap),0) as ap, (ifnull(sum(t.xp),0)/1000+ifnull(sum(a.ap),0)/100) as level, g.name
    FROM student s
    INNER JOIN guild g ON g.id = s.guild_id
    LEFT JOIN student_task t ON s.id = t.student_id
    LEFT JOIN student_achievement a ON s.id = a.student_id
    WHERE s.class_id = ".$realm_id."
    GROUP BY s.name, s.learner_tag, s.guild_id, s.id, g.name
    ORDER BY level DESC LIMIT 10";

However the query returns double the expected value for the ap column. There is only 1 record in the student_achievement table and the value is 25. However my query returns 50 as the value of sum(a.ap). If I edit the value, it still doubles. sum(t.xp) is working fine. Can anyone spot my mistake?
Table Structure:
 CREATE TABLE student
(
    id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
    name VARCHAR(64) NOT NULL,
    guild_id INT,
    class_id INT NOT NULL,
    time_updated INT,
    ap INT NOT NULL,
    learner_tag VARCHAR(64) NOT NULL,
    schoology_id INT NOT NULL,
    enrollment_id INT NOT NULL,
    FOREIGN KEY (guild_id) REFERENCES guild (id),
    FOREIGN KEY (class_id) REFERENCES class (id)
);

    CREATE TABLE student_achievement
(
    id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
    student_id INT NOT NULL,
    achievement_id INT NOT NULL,
    time_added INT,
    ap INT NOT NULL,
    FOREIGN KEY (student_id) REFERENCES student (id),
    FOREIGN KEY (achievement_id) REFERENCES achievement (id)
);

    CREATE TABLE achievement
(
    id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
    name VARCHAR(64) NOT NULL,
    value INT NOT NULL,
    repeatable TINYINT NOT NULL,
    image_url VARCHAR(200) NOT NULL,
    description VARCHAR(240) NOT NULL
);
CREATE TABLE task
(
    id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
    name VARCHAR(64) NOT NULL,
    max_xp INT,
    schoology_id INT,
    class_id INT NOT NULL,
    processed TINYINT,
    type VARCHAR(15) NOT NULL,
    FOREIGN KEY (class_id) REFERENCES class (id)
);


text:
Q: How come all my http URLs are turned to https? Even though I type "http://aoafinc.org/wp-admin" into the address bar, it was turned into "https://aoafinc.org/wp-admin". Also, all the links to images on my site are "https" instead of "http". Since my SSL certificate has expired, all these images can't be loaded.
I just take over this website from someone and don't want to renew the SSL, also I am not very familiar with WP or SSL either, but I guess I don't have to manually edit all the image links, there should be somewhere on WP's back end to set the website as non-ssl and hopefully all links will become "http". And more essentially, why the browser is requesting HTTPS url even though I type in a HTTP url?

A: *

*Check your .htaccess file and remove the https. e.g:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://url.com

*Check the wp-config.php file and remove define('FORCE_SSL_ADMIN', true);  if exists

*Also, you can change the URL from WordPress backend: General Settings -> General

*Lastly, If you can't access the wp-admin then you should check the WordPress table options. There are two options you have to change:

*

*siteurl

*home

Make sure these two options have http url not https.

A: I think you should just get the certificate renewed, and if you need a free one go to letsencrypt.com. A growing number of hosts offer Lets Encrypt certificates as an "easy click" type option on their control panel too.
If you're real keen on taking down the TLS/SSL functionality, I hope you'll at least mention that to your client before removing a good part of their websites security all on your own.

A: For multisite, you can only change this in the database. Go to your database, and look for table:
_options

Then look for rows
siteurl

home

And change https to http.
Then look for table
_sitemeta

and look for row siteurl and change the https to http
I would do a database backup before editing your database.
If it's still showing https after this, you might need to clear the browser cache, for chrome go to settings > clear browsing data > tick 'browsing history, cached images and files' and clear the history.


text:
Q: Embedding Gmaps in HTML I am working on embedding Google maps on HTML...
I want a javascript code that works same as creating one we do in Mymaps of Google maps. I want to add the function markers, polyline and polylines on a road..
I tried hard to do the same but did get exactly the look and the polylines doesnot work
I will be very thankful if I get the answer

A: YOu need to research how to interact with the Google Maps API.


text:
Q: angular.js:88 Uncaught Error: [$injector:modulerr] I have an error like this:

Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.6.9/$injector/modulerr?p0=myApp&p1=Error%3A%2…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.6.9%2Fangular.min.js%3A22%3A332)

this is my index.html
<html ng-app='myApp'>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <meta content="" name="description">
  <meta content="" name="author">
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular-route.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.6/angular-animate.js"></script>
  <!-- CORE CSS FRAMEWORK - START -->
  <link href="assets/plugins/pace/pace-theme-flash.css" rel="stylesheet" type="text/css" media="screen">
  <link href=" assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
  <link href="assets/plugins/bootstrap/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">
  <link href="assets/fonts/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
  <link href="assets/css/animate.min.css" rel="stylesheet" type="text/css">
  <link href="assets/plugins/perfect-scrollbar/perfect-scrollbar.css" rel="stylesheet" type="text/css">
  <link href="assets/css/style.css" rel="stylesheet" type="text/css">

  <script src="assets/app.js"></script>
  <script src="assets/approute.js"></script>
  <script src="assets/js/controller/logincontroller.js"></script>
  <script src="assets/js/controller/dashboardcontroller.js"></script>

</head>

<body class=" ">
  <div ui-view></div>

  <script src="assets/js/jquery-1.11.2.min.js"></script>
  <script src="assets/js/jquery.easing.min.js"></script>
  <script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
  <script src="assets/plugins/pace/pace.min.js"></script>
  <script src="assets/plugins/perfect-scrollbar/perfect-scrollbar.min.js"></script>
  <script src="assets/plugins/viewport/viewportchecker.js"></script>
  <script>
    window.jQuery || document.write('<script src="assets/js/jquery-1.11.2.min.js"><\/script>');
  </script>

  <script src="assets/js/scripts.js"></script>
</body>

</html>

and this is app.js
var app = angular.module("myApp", ['ui.router','ngAnimate']);

this is approute.js
app.config(function($stateProvider, $urlRouterProvider, $locationProvider) {
  $urlRouterProvider.otherwise('/login');
  //$urlRouterProvider.otherwise('/login');
  $stateProvider
    .state('login', {
      url: "/login",
      templateUrl: "views/ui-login.html",
      controller: 'LoginController',

    })
    .state('index-dashboard', {
      url: "/index-dashboard",
      templateUrl: "views/index-dashboard.html",
      controller: 'DashboardController',

    })
});

A: issued solve
I can't believe but it's work  for me using
ng-app="app" to ng-app"app"
Angular JS Error: [$injector:modulerr]


text:
Q: MySQL server [Version 5.0.96] installation fails on Mac Mountain Lion MySQL Installation fails when installing it on Mac os Mountain Lion.
I don't why this simple installation fails.
The file that I am trying to install is mysql-5.0.96-osx10.5-x86.dmg.

A: I would suggest you try Homebrew as your installation method instead. It's very well maintained across a lot of core packages for developers.
You start with this command:
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"

Follow the installation instructions, then:
brew install mysql

I've had two successful installs with no problems on Mountain Lion.

A: On Mountain Lion you should be using the 64-bit DMG I had no problem installing MySQL on Mountain Lion.


text:
Q: Can't initialize variable import javax.swing.JOptionPane;
import java.text.DecimalFormat;

public class Assignment3
{
 public static void main(String[] args)
 {
   double width;
   double length;
   double height;
   double weight;
   double totalDimen;         // (width * length * height) + weight
   double shipping;
   double totalCost;
   double cost12 = 12;
   double cost14 = 14;
   double cost17 = 17;
   double cost21 = 21;
   double cost33 = 33;
   double cost105 = 105;
   double surcharge;
   int zipCode;               //gets the zip code
   char zipCode2;

   String input;

   //changing the decimal format
   DecimalFormat formatter = new DecimalFormat("#0.00");

   //getting weight
   input = JOptionPane.showInputDialog("Enter the total weight");
   weight = Double.parseDouble(input);

   //getting height
   input = JOptionPane.showInputDialog("Enter the total height");
   height = Double.parseDouble(input);

   //getting length
   input = JOptionPane.showInputDialog("Enter the total length");
   length = Double.parseDouble(input);

   //getting width
   input = JOptionPane.showInputDialog("Enter the total width");
   width = Double.parseDouble(input);

   //getting zipCode
   input = JOptionPane.showInputDialog("Enter Zip Code");
   zipCode = Integer.parseInt(input);
   zipCode = (char)zipCode;

    //getting zipCode - now gives zipCode a CHAR value, which I can use to compare.
   zipCode2 = ((String)JOptionPane.showInputDialog("Re-Type Zip Code")).charAt(0);
   JOptionPane.showMessageDialog(null, "Zip Code: " + zipCode2);

//===================================================================================

   //Display weight, height, lenth, width |||| DEBUG
   JOptionPane.showMessageDialog(null, "Here is your input" + "\n" + weight + "\n" + width + "\n" + height + "\n" + length + "\n" + "Zip Code: " +zipCode);

   //getting total dimensions
   totalDimen = (length * width * height) + weight;
   JOptionPane.showMessageDialog(null, "Total Dimensions:\n" + totalDimen); //DEBUG
//====================================================================================

   //if weight is <= 5 pounds, shipping = $12.00
   if ( weight <= 5 )
   {
      shipping = 12;
      JOptionPane.showMessageDialog(null, "Shipping is: " + cost12);
   }

   //if weight is > 5 pounds and <= 15 pounds, shipping = $14.00
   if ( weight > 5 && weight <= 15 )
   {
      shipping = 14;
      JOptionPane.showMessageDialog(null, "Shipping is: " + cost14);
   }

   //if weight is > 15 pounds and <= 34 pounds, shipping = $17.00
   if ( weight > 15 && weight <= 34 )
   {
      shipping = 17;
      JOptionPane.showMessageDialog(null, "Shipping is: " + cost17);
   }

   //if weigth is > 34 pounds and <= 45 pounds, shipping = $21.00
   if ( weight > 34 && weight <= 45 )
   {
      shipping = 21;
      JOptionPane.showMessageDialog(null, "Shipping is: " + cost21);
   }

   //if weigth is > 45 pounds and <= 60 pounds, shipping = $33.00
   if ( weight > 45 && weight <= 60 )
   {
      shipping = 33;
      JOptionPane.showMessageDialog(null, "Shipping is: " + cost33);
   }

   //if weigth is > 60 pounds, shipping = $105.00
   if ( weight > 60 )
   {
      shipping = 105;
      JOptionPane.showMessageDialog(null, "Shipping is: " + cost105);
   }
//====================================================================================

   //applying the surcharge using zip code
   if ( zipCode2 == 4 )
   {
      surcharge = (shipping * .05);
      JOptionPane.showMessageDialog(null, "Your surcharge cost at 5% is: $" + surcharge);
   }
   else if ( zipCode2 == 9 )
   {
      surcharge = (shipping * .09);
      JOptionPane.showMessageDialog(null, "Your surcharge cost at 9% is: $" + surcharge);
   }
   else
   {
      surcharge = (shipping * .14);
      JOptionPane.showMessageDialog(null, "Your surcharge cost at 14% is: $" + surcharge);
   }
//====================================================================================

   //if the zip code is even, + 2% additional surcharge fee

 }
}

This is the output error:
Assignment3.java:122: error: variable shipping might not have been initialized
      surcharge = (shipping * .05);
                   ^
Assignment3.java:127: error: variable shipping might not have been initialized
      surcharge = (shipping * .09);
                   ^
Assignment3.java:132: error: variable shipping might not have been initialized
      surcharge = (shipping * .14);

What can I do to fix this? I want it to go to the if statement, grab the shipping variable, then go down to the next if statement where it decides the surcharge rate based on the Zip code.
I did some tweeking while typing this:
I don't know if it's better, but it works differently. Now it doesn't do the surcharge correctly.
import javax.swing.JOptionPane;
import java.text.DecimalFormat;

public class Assignment3
{
 public static void main(String[] args)
 {
   double width;
   double length;
   double height;
   double weight;
   double totalDimen;         // (width * length * height) + weight
   double shipping;
   double totalCost;
   double cost12 = 12;
   double cost14 = 14;
   double cost17 = 17;
   double cost21 = 21;
   double cost33 = 33;
   double cost105 = 105;
   double surcharge;
   int zipCode;               //gets the zip code
   char zipCode2;

   String input;

   //changing the decimal format
   DecimalFormat formatter = new DecimalFormat("#0.00");

   //getting weight
   input = JOptionPane.showInputDialog("Enter the total weight");
   weight = Double.parseDouble(input);

   //getting height
   input = JOptionPane.showInputDialog("Enter the total height");
   height = Double.parseDouble(input);

   //getting length
   input = JOptionPane.showInputDialog("Enter the total length");
   length = Double.parseDouble(input);

   //getting width
   input = JOptionPane.showInputDialog("Enter the total width");
   width = Double.parseDouble(input);

   //getting zipCode
   input = JOptionPane.showInputDialog("Enter Zip Code");
   zipCode = Integer.parseInt(input);
   zipCode = (char)zipCode;

    //getting zipCode - now gives zipCode a CHAR value, which I can use to compare.
   zipCode2 = ((String)JOptionPane.showInputDialog("Re-Type Zip Code")).charAt(0);
   JOptionPane.showMessageDialog(null, "Zip Code: " + zipCode2);

//===================================================================================

   //Display weight, height, lenth, width |||| DEBUG
   JOptionPane.showMessageDialog(null, "Here is your input" + "\n" + weight + "\n" + width + "\n" + height + "\n" + length + "\n" + "Zip Code: " +zipCode);

   //getting total dimensions
   totalDimen = (length * width * height) + weight;
   JOptionPane.showMessageDialog(null, "Total Dimensions:\n" + totalDimen); //DEBUG
//====================================================================================

   //if weight is <= 5 pounds, shipping = $12.00
   if ( weight <= 5 )
   {
      shipping = 12;
      JOptionPane.showMessageDialog(null, "Shipping is: " + cost12);
   }

   //if weight is > 5 pounds and <= 15 pounds, shipping = $14.00
   if ( weight > 5 && weight <= 15 )
   {
      shipping = 14;
      JOptionPane.showMessageDialog(null, "Shipping is: " + cost14);
   }

   //if weight is > 15 pounds and <= 34 pounds, shipping = $17.00
   else if ( weight > 15 && weight <= 34 )
   {
      shipping = 17;
      JOptionPane.showMessageDialog(null, "Shipping is: " + cost17);
   }

   //if weigth is > 34 pounds and <= 45 pounds, shipping = $21.00
   else if ( weight > 34 && weight <= 45 )
   {
      shipping = 21;
      JOptionPane.showMessageDialog(null, "Shipping is: " + cost21);
   }

   //if weigth is > 45 pounds and <= 60 pounds, shipping = $33.00
   else if ( weight > 45 && weight <= 60 )
   {
      shipping = 33;
      JOptionPane.showMessageDialog(null, "Shipping is: " + cost33);
   }

   //if weigth is > 60 pounds, shipping = $105.00
   else
   {
      shipping = 105;
      JOptionPane.showMessageDialog(null, "Shipping is: " + cost105);
   }
//====================================================================================

   //applying the surcharge using zip code
   if ( zipCode2 == 4 )
   {
      surcharge = (shipping * .05);
      JOptionPane.showMessageDialog(null, "Your surcharge cost at 5% is: $" + surcharge);
   }
   else if ( zipCode2 == 9 )
   {
      surcharge = (shipping * .09);
      JOptionPane.showMessageDialog(null, "Your surcharge cost at 9% is: $" + surcharge);
   }
   else
   {
      surcharge = (shipping * .14);
      JOptionPane.showMessageDialog(null, "Your surcharge cost at 14% is: $" + surcharge);
   }

//====================================================================================

   //if the zip code is even, + 2% additional surcharge fee

 }
}

A: You need to initialize the local variable double shipping; with a value. In your code if all the conditions where shipping is assigned a value doesn't hold true, and you reach the point where you calculate surcharge using shipping value, then shipping doesn't have a value and since its a local variable the compiler makes sure it is assigned before being accessed.
Assign a value: double shipping = 0.0;

A: From the initial code you just change change
double shipping = 0;

You cannot use a local variable with out initializing

A: Try modifying your comparisons in the "surcharge" if/else block to compare the value entered against a character value (whereas right now you're comparing to an int value).
    // applying the surcharge using zip code
    if (zipCode2 == '4') {
        surcharge = (shipping * .05);
        JOptionPane.showMessageDialog(null, "Your surcharge cost at 5% is: $" + surcharge);
    } else if (zipCode2 == '9') {
        surcharge = (shipping * .09);
        JOptionPane.showMessageDialog(null, "Your surcharge cost at 9% is: $" + surcharge);
    } else {
        surcharge = (shipping * .14);
        JOptionPane.showMessageDialog(null, "Your surcharge cost at 14% is: $" + surcharge);
    }


text:
Q: Replacing dynamic breadcrumb character I just created the below fiddle with the issue
LIVE ISSUE
The Code:

    ABC
     >
    DEF
     >
    g

The HTML that you can see is a structure that is being populated from a dynamic data
what I want is that I need to change ">" i.e the breadcrumb divider to my custom character or a custom background class but when I am trying to put my css, by using :after, visibility:hidden, etc.. it is not showing up what I need are two solutions

*

*I can add a custom character by replacing ">" which is coming dynamically

*I need to create a css class where if I want a background image to be a character, it can be integrated via class.

Awaiting solutions.
PS: I am looking only for CSS based solutions.

A: Try this:
.BreadcrumbsDivider:before{content:" hello ";color:red;visibility:visible;}
.BreadcrumbsDivider{margin-right:-12px;}
a,.BreadcrumbsDivider{display:inline;}
.BreadcrumbsDivider{visibility:hidden;}

DEMO
I have made .BreadcrumbsDivider transparent and used pseudo class :before to insert text.

A: Try this mate http://jsfiddle.net/Godinall/Hc76h/5/
You can use both customise dividers and background image
.BreadcrumbsDivider:after {content:"||"}


text:
Q: How to define mongodb ArrayField in Djongo's model class question(models.Model):
    question_id = models.IntegerField()
    choice = models.CharField(max_length=100)
    tags = models.ArrayField(models.CharField(max_length=100))

ERROR:
packages\djongo\models\fields.py", line 116, in _validate_container
for field in self.model_container._meta._get_fields(reverse=False):
    AttributeError: 'CharField' object has no attribute '_meta'

I want to add a ArrayField in my models using djongo models. i hope 'tags' looks like ['tag1', 'tag2', 'tag3' ...]. But djongo requeirs model_container, but i only want an array contains strings, not a model ,please help~~

A: I was experiencing a similar situation: wanted to create an IntegerField array. I solved it with this workaround:
Create an intermediate model which stores your field.
For example, for my use case (with integers that represent quantity by each second) I created a model called Second which holds an attribute called data of type models.IntegerField():
class Second(models.Model):
    data = models.IntegerField(null=False)

    class Meta:
        abstract = True

class ParentModel(models.Model):
    _id = models.ObjectIdField()

    by_second = models.ArrayField(
      model_container=Second
    )

    objects = models.DjongoManager()

So I guess in your case you could use the same but changing models.IntegerField()by models.CharField(max_length=100)
I know it has been a long time since the question was asked, but I hope this helps someone having this issue :)


text:
Q: Find the Laurent series of $\frac{1}{(z+2)(1+z^2)}$ in the domains (1), $D:1<|z|<4$, (ii) $D:4<|z|<\infty$ I found this exercise and it seemed a bit weird to me:

Find the Laurent series of $\frac{1}{(z+2)(1+z^2)}$ in the domains (1), $D:1<|z|<4$, (ii) $D:4<|z|<\infty$

I have been trying to find this Laurent series, but somehow the domains $D$ just don't seem to work. When I use partial fractions I get:
$\dfrac{1}{(z+2)(z+i)(z-i)}=\dfrac{1}{5} \dfrac{1}{z}\dfrac{1}{1+%
\dfrac{2}{z}}-\dfrac{1}{z}\dfrac{\dfrac{1}{10}+\dfrac{1}{5}i}{1-\dfrac{i}{z}}-%
\dfrac{1}{z}\dfrac{\dfrac{1}{10}-\dfrac{1}{5}i}{1+\dfrac{i}{z}}$ which shows that the "outer" domain for each series would be at first sight:
$|z|>2$, $|z|>1$ and $|z|>1$ respectively, to get a series for $|z|>2$. For the inner  $1<|z|<2$ I can use a normal geometric series for the first term of the right side. For $0<|z|<1$ I can use a normal geometric series for all the terms.
But I don't see where would I be able to get the $4$.
Can I get it somehow?


text:
Q: To where do `IDBOpenDBRequest` "error" events bubble up? What is the significance of the "error"-type events dispatched on an IDBOpenDBRequest (i.e., open and deleteDatabase) being described as bubbling? Should they bubble to window or do they not really go anywhere?*
(And for a bonus question, do "error" events on the non-standard webkitGetDatabaseNames similarly "bubble", and if so, where?)
* The spec states:

The firing of "success" or "error" events do not follow the normal
  steps to fire a success event or fire an error event as there is no
  active transaction at the time when they fire.

A: This is a spec issue:
https://github.com/w3c/IndexedDB/issues/86
It appears to be a "copy/paste" bug in the spec, but when window.onerror (and the corresponding global error hook in workers, etc) is integrated it will matter there. Firefox already implements.
Chrome is the only browser that implements the nonstandard webkitGetDatabaseNames and does not implement global onerror reporting yet, so they don't go anywhere.


text:
Q: Extjs4 link click functionality error i am working in extjs4. i have gridview as=
{
            margin : '10 0 5 100',
            xtype : 'grid',
            id : 'g2',
            //title : 'Educational Details',
            store : 'qb.qbquestionoptionStore',
            columns : [ {
                text : 'Options',
                dataIndex : 'option',
                flex : 1
            }, {
                text : 'Answer',
                dataIndex : 'isAnswer',
                flex : 2.5
            },{
                header : 'edit',
                renderer : function(val) {
                    return 'Edit';
                }
            },
            {
            header : 'Remove',
            renderer : function(val) {
                return 'Remove';
            }
        }

For these above edit and remove links i had written code in controller as-
deleterow : function(cmp) {
        cmp.mon(cmp.getEl(), 'click', function(event, target) {
        if (target.id == 'edit') {
            console.log('edit');
            listview = Ext.getCmp('g2');

            listview.on({
                itemClick : function(dv, record, item, index, e, opts) {
                    var view = Ext.widget('useredit');
                    view.down('form').loadRecord(record);

                }
            });

        }

        if (target.id == 'remove') {
            //alert("hello");
            listview = Ext.getCmp('g2');

            listview.on({
                itemClick : function(dv, record, item, index, e, opts) {
                    //var grid = button.up('g3');
                    var store = listview.getStore();
                    var selected = listview.getSelectionModel()
                            .getSelection();
                    console.log(selected);

                    if (selected && selected.length == 1) {
                        store.remove(selected);
                        console.log(store);
                    }
                }});}}, this, {
        delegate : "a"
    });},

But on both links click,same edit link functionality is executing. So how to execute specific function on specific link click?

A: This is not an ideal way to get the functionality you are looking for.  You are using the html id attribute, which is theoretically only supposed to be used one time on a page.  Also, you are doing some unnecessary hacks just to add click events to the dom elements, and that is not a best practice.
Here are 2 possibilities.  First, you could use an Ext.grid.column.Action, which allows you to use a handler function for each action.  This is a clean way to do things, and can look crisp with good icons for edit/remove.  The Sencha examples have your exact scenario as their actions, and you can see the documentation here: http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.grid.column.Action
An alternative to this would be to add an onclick attribute to your links, and make that call the function you need on your controller, passing in the right arguments:
{
    header : 'edit',
    renderer : function(val, meta, rec) {
        return 'Edit';
    }
},
{
    header : 'Remove',
    renderer : function(val) {
        return 'Remove';
    }
}

Then, in your controller, you can retrieve that record based on the id and do what you need to do with it:
editRow: function(recordId) {
    var view = Ext.widget('useredit'),
        record = Ext.getCmp('g2').getStore().findExact('id', recordId);
    view.down('form').loadRecord(record);
},

removeRow: function(recordId) {
    var store = Ext.getCmp('g2').getStore(),
        record = store.findExact('id', recordId);
    store.remove(record);
}


text:
Q: Why do different energy levels affect the probability amplitude of the wave function? When you solve the Schrödinger equation for the classic particle in a box you get that $$\psi=\sqrt{ \frac{2}{l}} \sin{(\frac {n\pi x}l)}$$
where $x$ is the length from the leftmost point of the box, $l$ is the length of the box and $n$ is an integer where $$n=\sqrt{\frac{El^2}{\pi^2}}$$($E$ is equal to the energy in the quantum particle or whatever) and so the wave function clearly depends on the energy of the particle or the system right? So my question is:
why is that so? Why does the quantum wavefunction have to depend on the energy level of the particle or the quantum system? I mean what we're calculating through the wavefunction is the probability of a quantum particle being at a specific place between some certain potentials right? So how does the energy effect where an electron or any other quantum particle is? I had this idea that since the electron is in a superposition of every possible place it could be in, it interacts with its own energy level that's at another position but I'm not sure about it.

A: By solving the TISE and wondering why its solutions depend on the energy, you are begging the question. The TISE reads $$\hat H\lvert\psi\rangle = E\lvert\psi\rangle$$ where $E$ is the energy eigenvalue, i.e. the energy of the system when it is in the state $\lvert\psi\rangle$. In other words, the $\psi$ that you have obtained above came from a process of looking for wavefunctions with specific energy levels, so of course the wavefunctions you'll find will depend on the energy level.
In general, the quantum wavefunction need not depend on the energy level, or even have a well defined energy for that matter. The solutions to the TISE are the set of quantum states that have well defined energies, and they form a complete basis, so any state can be expressed as a linear combination (superposition) of them. The main reason why it is useful to express states in this basis is because the time evolution is just a phase factor in this basis.

A: $\newcommand{\ket}[1]{|#1\rangle}$
The time-independent Schrödinger Equation written in Dirac notation is often expressed as $$ H\ket{\psi_n} = E_n\ket{\psi_n}, $$ which is know in Mathematics as an eigenvalue equation. It is "more proper" to see the dependencies of the energy eigen-value as having dependencies on $n$, instead of the $n$ in the $n$-th eigenstate/eigenfunction or eigen-energy as being a function of energy. However, it is indeed possible to "invert" the function as you have done to make $n$ the subject, improperly eluding to the probability amplitude being a function a the energy levels.

A: Go to a more complicated system, the orbitals of the hydrogen atom which give the solution for the possible locations in (x,y,z) of an electron trapped around a proton.

1,2,3 is the $n$ , the quantum number connected with the energy level, and there is a difference in space for the probability of the electron.
Why?
That's what the solution gives.


text:
Q: Upload to Sharepoint using FrontPage RPC I am trying to upload documents with their metadata to sharepoint using the RPC method.
well it is working fine except some type of files like docx, xlsx..
I don't get any errors or exceptions, they are(docx, xlsx.) uploaded to sharepoint correctly but without the associated metadata.
How can i fix this problem?
Below is the code i use to upload with metadata:
 private static bool Upload(string webUrl, string documentName, byte[] bytes, Dictionary<string, object> metaInfo, NetworkCredential netAccess, out string result)
    {
        string putOption = "overwrite,createdir,migrationsemantics";  // see http://msdn2.microsoft.com/en-us/library/ms455325.aspx
        string comment = null;
        bool keepCheckedOut = false;
        string method = "method=put+document%3a12.0.4518.1016&service_name=%2f&document=[document_name={0};meta_info=[{1}]]&put_option={2}&comment={3}&keep_checked_out={4}\n";
        method = String.Format(method, documentName, EncodeMetaInfo(metaInfo), putOption, HttpUtility.UrlEncode(comment), keepCheckedOut.ToString().ToLower());
        List<byte> data = new List<byte>();
        data.AddRange(Encoding.UTF8.GetBytes(method));
        data.AddRange(bytes);

       try
        {
            using (WebClient webClient = new WebClient())
            {
                webClient.Credentials = netAccess;
                webClient.Headers.Add("Content-Type", "application/x-vermeer-urlencoded");
                webClient.Headers.Add("X-Vermeer-Content-Type", "application/x-vermeer-urlencoded");
                result = Encoding.UTF8.GetString(webClient.UploadData(webUrl + "/_vti_bin/_vti_aut/author.dll", "POST", data.ToArray()));
                if (result.IndexOf("\n<p>message=successfully") < 0)
                    throw new Exception(result);
            }
        }
        catch (Exception ex)
        {
            result = ex.Message;
            return false;
        }
        return true;
    }

A: This is old, but the metadata is not set for office files because of property-promotion in SharePoint.
If you make you own webservice you can disable this whenyou add the document.
To use FrontPage rpc, just set the metadata again after the first 'PUT'-mthode call, you get another version, but the secondtime the metadata is applyed.

A: I'm not sure what the exact problem is with your code, but there is some similar code which uploads files to Sharepoint 2007 via RPC calls on this blog which you may like to try.

A: Gaby,
I have similar behavior for docx and xlsx files.
After uploading the document, if the file is of type docx or xlsx, I call a sp webservice to update the metadata.
This is the code immediately after the file upload succeeds:
                    int extlength = 0;
                    extlength = documentName.Length - documentName.LastIndexOf(".") - 1;
                    string docext = documentName.Substring(documentName.LastIndexOf(".") + 1, extlength);
                    if (docext == "xlsx" || docext == "docx")
                    {
                        string doclookupname = metaInfo["PermitApplicationID"].ToString() + "_" + metaInfo["Title"].ToString();
                        UpdateMetaData("Shared Documents", "1", doclookupname, "PermitApplicationID", metaInfo["PermitApplicationID"].ToString());
                        UpdateMetaData("Shared Documents", "1", doclookupname, "DocumentCategories", metaInfo["DocumentCategories"].ToString());
                        UpdateMetaData("Shared Documents", "1", doclookupname, "Title", metaInfo["Title"].ToString());

                    }

This is the Function that the above code calls to update the metadata using the sp list service.  I call this function for each metadata value I want to update.
        private static void UpdateMetaData(string strListName, string rowLimit, string strDocTitle, string FieldName, string NewValue)
        {
            Lists_WinAuth.Lists li = new Lists_WinAuth.Lists();
            li.Credentials = new NetworkCredential("yourUserID", "YourPwd", "YourDomain");

            XmlDocument xmlDoc = new System.Xml.XmlDocument();

            /////////get id
            XmlNode ndQuery = xmlDoc.CreateNode(XmlNodeType.Element, "Query", "");
            XmlNode ndViewFields = xmlDoc.CreateNode(XmlNodeType.Element, "ViewFields", "");
            XmlNode ndQueryOptions = xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions", "");

            ndQueryOptions.InnerXml = "<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>" +
                                      "<DateInUtc>TRUE</DateInUtc>";

            ndViewFields.InnerXml = "<FieldRef Name='ID' /> ";

            ndQuery.InnerXml = "<Where>" +
                                "<Eq>" +
                                "<FieldRef Name='FileLeafRef' />" +
                                "<Value Type='Text'>" + strDocTitle + "</Value>" +
                                "</Eq>" +
                                "</Where>";

            XmlNode ndListItems = li.GetListItems(strListName, "", ndQuery, ndViewFields, rowLimit, ndQueryOptions, null);
            string strDocID = ndListItems.ChildNodes[1].ChildNodes[1].Attributes[0].Value.ToString();

            //////////update
            string strBatch = "<Method ID='1' Cmd='Update'>" +
                              "<Field Name='ID'>" + strDocID + "</Field>" +
                              "<Field Name='" + FieldName + "'>" + NewValue + "</Field></Method>";

            System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");
            elBatch.SetAttribute("OnError", "Continue");
            elBatch.InnerXml = strBatch;

            try
            {
                XmlNode ndReturn = li.UpdateListItems("Shared Documents", elBatch);
            }
            catch (Exception ex)
            {
                throw;
            }

            return;
        }