text:
Q: Django channels using secured WebSocket connection - WSS:// When I tried to run the Django application using sslserver as shown below,
python manage.py runsslserver

Errors:
Traceback:
Validating models...

System check identified no issues (0 silenced).
November 08, 2019 - 11:17:26
Django version 2.0.7, using settings 'dashboard_channels.settings'
Starting development server at https://127.0.0.1:8000/
Using SSL certificate: \lib\site-packages\sslserver\certs\development.crt
Using SSL key: \lib\site-packages\sslserver\certs\development.key
Quit the server with CTRL-BREAK.
[08/Nov/2019 11:18:33] "GET / HTTP/1.1" 200 1299
[08/Nov/2019 11:18:34] "GET / HTTP/1.1" 200 1299
[08/Nov/2019 11:18:35] "GET /static/js/jquery.js HTTP/1.1" 200 270575
Not Found: /ws/home
[08/Nov/2019 11:18:36] "GET /ws/home HTTP/1.1" 404 2134

Browser Console:
(index):31 WebSocket connection to 'wss://127.0.0.1:8000/ws/home' failed: Error during WebSocket handshake: Unexpected response code: 404
(index):41 error Event
(index):44 close CloseEvent

Code:
Javascript:
 var loc = window.location;
 var wsStart = 'ws://';
 if (loc.protocol == 'https:') {
     wsStart = 'wss://'
 }
 var endpoint = wsStart + loc.host + '/ws/home';

 var socket = new WebSocket(endpoint);

It's working fine with python manage.py runserver command, means for http it's working but not with https.
How to resolve this issue? (How to debug to sort out this issue?)
Is there any other way to deploy WebSockets on https portal?
Still facing this issue. Can anyone please help?
Anyhow this is for testing purposes, finally, I need to deploy it on Apache2.4 in the windows server machine. Where I have already set up for https but not for web sockets.

A: I found the answer, the runserver command correctly detects asgi.py file and run the Django channels application on WebSockets using daphne. Somehow runsslserver is not doing the same job, It's running the wsgi.py file instead of asgi.py file.
After reading different approaches, I get to know that we can handle HTTPS request using our normal development server (i.e., using wsgi.py file) and wss request by using Daphne(i.e., using asgi.py file).
Daphne was an officially designed server to handle django-channels(built on the top of the twisted module).
So, finally, we need to run two servers to handle https and wss separately.
# In command prompt 1 (For production, use Apache or Nginx to serve HTTP requests)
python manage.py runsslserver 0.0.0.0:8000

# In command prompt 2 (This works for production as well).
daphne -e ssl:8001:privateKey=cert\\private.pem:certKey=cert\\public.pem real_time_table.asgi:application

We should use the same SSL certificates used by runsslserver for
  testing.

Finally, in JavaScript:
var loc = window.location;
var wsStart = 'ws://';
if (loc.protocol == 'https:') {
     wsStart = 'wss://'
}
// var endpoint = wsStart + 'your_ip_address:port_given_to_daphne_server' + '/ws/home';
// For above command, it look like this
var endpoint = wsStart + 'xxx.xx.xx.xxx:8001' + '/ws/home';
// Note the websocket port is 8001
var socket = new WebSocket(endpoint);

I hope, this will save someone's time.


text:
Q: Reorder rows and save update to core data I never imagined it'd be so hard to reorder a table and save the new order to Core Data (and perhaps I'm overthinking it). The bit of code below is throwing me the following error: "The number of rows contained in an existing section after the update must be equal to the number of rows contained in that section before the update."
override func tableView(tableView: UITableView, moveRowAtIndexPath fromIndexPath: NSIndexPath, toIndexPath: NSIndexPath) {

    initializeFetchedResultsController()

    let appDel: AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
    let context2: NSManagedObjectContext = appDel.managedObjectContext
    let request2 = NSFetchRequest(entityName: "Activities")
    let activityOrderSort = NSSortDescriptor(key: "activityOrder", ascending: true)
    request2.sortDescriptors = [activityOrderSort]

    let predicate = NSPredicate(format: "date == %@", date)
    request2.predicate = predicate

    var fetchResults2: [NSManagedObject]

    do {
        try fetchResults2 = (appDel.managedObjectContext.executeFetchRequest(request2) as! [NSManagedObject])

        if fromIndexPath.row > toIndexPath.row {
            for i in toIndexPath.row..<fromIndexPath.row {
                fetchResults2[i].setValue(i+1, forKey: "activityOrder")
            }
            fetchResults2[fromIndexPath.row].setValue(toIndexPath.row, forKey: "activityOrder")
        }
        if fromIndexPath.row < toIndexPath.row {
            for i in fromIndexPath.row + 1...toIndexPath.row {
                fetchResults2[i].setValue(i-1, forKey: "activityOrder")
            }
            fetchResults2[fromIndexPath.row].setValue(toIndexPath.row, forKey: "activityOrder")
        }

    } catch let error as NSError {
        print("Error: \(error.localizedDescription)")
    }

    do {
        try appDel.managedObjectContext.save()
    } catch let error as NSError {
        print("Saving error: \(error.localizedDescription)")
    }

    initializeFetchedResultsController()

}

Here is the initializeFetchedResultsController() code for reference:
func initializeFetchedResultsController() {

    let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
    context = appDelegate.managedObjectContext

    let fetchRequest = NSFetchRequest(entityName: "Activities")
    let orderSort = NSSortDescriptor(key: "activityOrder", ascending: true)
    fetchRequest.sortDescriptors = [orderSort]

    let predicate = NSPredicate(format: "date == %@", date)
    fetchRequest.predicate = predicate

    fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest,
        managedObjectContext: self.context,
        sectionNameKeyPath: nil,
        cacheName: nil)

    fetchedResultsController.delegate = self

    do {
        try fetchedResultsController.performFetch()
    } catch let error as NSError {
        print("Error: \(error.localizedDescription)")
    }
}

I tried to pull as much as I could from the answer from a previous post here: Save new order to core data after the using the tableView:moveRowAtIndexPath:toIndexPath: method. Also, I have the canEditRowAtIndexPath function set up and it appears to be functioning properly. Is there anything obvious that I'm messing up in the provided code? Is there an easier solution? Thanks for the support.

redpajama_set_name: RedPajamaStackExchange


text:
Q: locked or unlocked the conditional formatting cells xlsxwriter I have protected the complete sheet, then I am unlocking the conditional formatting cell, but its not working for me.
Please help any one.
format1 = wb.add_format({'bg_color':#87c2ff ,'locked': False})

ws.conditional_format(colrang, {'type':     'cell',
                                    'criteria': 'not equal to',
                                     'value':   rowIndx,
                                    'format':   format1,
                                    })

But the cell is not unlocked.

A:
I have protected the complete sheet, then I am unlocking the conditional formatting cell, but its not working for me.

This isn't supported in conditional formats in Excel. From the XlsxWriter docs:

Note
In Excel, a conditional format is superimposed over the existing cell format and not all cell format properties can be modified. Properties that cannot be modified in a conditional format are font name, font size, superscript and subscript, diagonal borders, all alignment properties and all protection properties.


text:
Q: Service Desk sends 2 Updated workbooks daily- we need to copy to our internal Sheet without overriding our columns for Team Notes We have our own internal Excel workbook, which has additional columns where the team makes notes. We don't want these to go away, that's why we have to manually copy the data from the 2 workbooks our ticketing system emails us daily with the updated info. So now we just download the updated reports, combine them manually, and then manually take care of the notes columns- where team member's own comments are written down.
Both external workbooks data has to be combined - and from one of the workbooks, we need to filter and use only one person's data.
It would be great if we can track what changed in a status report. And have a column for latest updates. Like a daily status tracker.
Would appreciate any help. Thanks.
Not sure how to even begin or approach it- do we need VLOOKUP? Macros? VBA?


text:
Q: How to get marker position after dragging in vue2-google-map? I am using the vue2-google-map library to display a map with a marker.
<gmap-map ref="mymap" :center="mapStartLocation" :zoom="17" style="width: 100%; height: 300px">
    <gmap-marker v-on:change="updateCoordinates()" :position="mapStartLocation" :draggable="true" @closeclick="updateCoordinates()"/>
</gmap-map>

This works and puts the marker on the coordinates of mapStartLocation
How do I  get the new coordinates after the user draggs the marker on the map?
I tried with a @closeClick and v-on:change but neither registers. Even if they would, the question of how to get the new coordinate values remains.
Any pointers on how to operate with this library.
Nothing in the documentation.

A: So, You can add Event on stop drag
<GmapMarker
   :position="jdata.geo"
   :clickable="true"
   :draggable="true"
   @dragend="gMapFunc($event.latLng)"
 </GmapMarker>

////////////////////////
 methods: {
      //set after merker end drag
      gMapFunc(evnt) {
        this.jdata = {"geo": {"lat":evnt.lat(), "lng":evnt.lng()}};
      },

A: I found @drag to be the best solution. However, the event is emitted while the user is dragging, not only after, to which @dragend should work according to source-code, but for some reason doesn't in my case.
<template>
    <gmap-map ref="mymap" :center="mapStartLocation" :zoom="17" style="width: 100%; height: 300px">
        <gmap-marker :position="mapStartLocation" :draggable="true" @drag="updateCoordinates" />
    </gmap-map>
</template>

<script>
export default {
    data() {
        return {
            coordinates: null,
        }
    },
    methods: {
        updateCoordinates(location) {
            this.coordinates = {
                lat: location.latLng.lat(),
                lng: location.latLng.lng(),
            };
        },
    },
}
</script>


text:
Q: Two updater icons in Lubuntu 20.04 I upgraded to Lubuntu 20.04 (from 19.10). Now I see two icons for software updates in panel.

The tooltip for both is "Benachichtigungsdienst für Aktualisierungen" (German language version).
Right-clicking on the second one just shows one menu item "Livepatch-Einstellungen" which leads me to the Livepatch-Tab of "Apps and Updates" (Livepatch is not availiable on my machine).
The first one shows a bigger menu, e.g. to open the same window "Apps and Updates" or to show availiable updates.
Both icons disappear by killing the "update-notifier"-task.
In 19.10 the updater showed me – when there were updates availiable – a detailed window like this:

Now I just see a small notification ("update-notifier") that there are some updates with "upgrade" and "close" buttons. On upgrade it starts
/usr/bin/lubuntu-upgrader --full-upgrade.
Only sometimes I see the first mentioned old and much more detailed window.
My lxqt-autostart:

Why are there two different ways to tell me about updates?
Why are there two icons by the same app?
How can I always get the window with the detailed update information again?

A:
Why are there two different ways to tell me about updates?

There's not. The second one is for Livepatch, as you've already discovered.

Why are there two icons by the same app?

They're not. I mean look at the icons— they're only stylistically similar rather than being the same. The first is for Lubuntu's Update Notifier. Since the Update Notifier was built around GTK and the Qt-compatible version Kubuntu uses doesn't work as well for Lubuntu, they created their own. This is why it looks different than the old one.

How can I always get the window with the detailed update information again?

If you want the exact same thing but don't mind the extra overhead of having more GTK dependencies, you can install the update-notifier package and run it instead.
Alternately, and most likely better, you can upgrade to 20.10 and use the new version of Lubuntu's Update Notifier, which now comes with details:


text:
Q: Canonical way to reload classes/constants used within package configs I have been getting the familiar DEPRECATION WARNING: Initialization autoloaded the constant <foo> error message for one of my apps.
I have a Rails6 app that uses the dragonfly gem which comes with image resizing processors, and I use them for making thumbnails. I also have a custom processor used for making opengraph versions of images, and as such I need to pass in that configuration to dragonfly on start-up. The use of this specific gem is not strictly relevant, because it could be like any gem where it requires an initializer with a config block to set up on app boot.
The trimmed version of the initializer app/config/initializers/dragonfly.rb:
Dragonfly.app.configure do
  plugin :imagemagick
  processor :open_graph, OpenGraphProcessor.new
  # ... lots more configuration ...
end

The OpenGraphProcessor class lives within app/lib.
I can easily resolve this using the standard approach:
Rails.application.reloader.to_prepare do
  Dragonfly.app.configure do
    plugin :imagemagick
    processor :open_graph, OpenGraphProcessor.new
    # ... lots more configuration ...
  end
end

My question relates to whether there is a better/more canonical way of handling situations like this where initializers reference classes from within the app itself? Several of my initializers are basically now wrapped in  Rails.application.reloader.to_prepare do ... end yet it feels like a hack and perhaps I'm simply missing something.

A: There are several ways to address this.
First, let's assume the processor is reloadable.
The gem could ask for a processor class name in its configuration, instead of a processor class instance. When the gem needs the processor, it constantizes the class name. That way, if there is a reload, the gem always gets the current class. Gems that are defined to play well with reloading do this, one case is Devise. If Dragonfly does not support such interface, we need to look for other options.
Because, you know, the problem with the original snippet is that Dragonfly was getting an instance of the OpenGraphProcessor class by the time the app boots. If your class is reloadable, you expect changes to the class to be effective, but the processor in Dragonfly was already instantiated from the previous version of the class and won't reflect these changes.
So, the second way to address this is what you are doing. You configure when the application boots and also when there is a reload. That way, Dragonfly has the current processor. That is what the to_prepare block is doing.
This is not hacky, it is what logically you have to do. The name to_prepare is obscure for my taste, on_boot_and_reload would be more clear. But, in any case, this is what you logically want to do.
It has to be seen if Dragonfly supports being configured in mutliple rounds. If it does not support this, this solution would not be valid for Dragonfly in particular. If that was the case, basically the gem would not designed to work with reloading.
Then, one final option that works in all scenarios is to make the processor non-reloadable. In that case, you can leave the original initializer as it was, because you don't expect reloads to change the processor.
There is two basic ways to do this. One is to have processors in app/processors and add that directory to config.autoload_once_paths in config/application.rb. The other one is moving this particular class to lib (assuming it is not in the autoload paths), and in the initializer issue an ordinary require for the file.
Your application had an inconsistency with reloading this is uncovering. This is an error condition in Rails 7 to prevent such inconsistency from being possible.


text:
Q: yfrog API to pull in photos to website I have a yfrog account and would like to pull in those posted photos to a gallery on my site, but I can't find any info about pulling in photos - only posting photos.
Is this an available function of the yfrog API?
Thanks.

A: Go to yfrog API to pull in photos to website. It seems like you should be able to pull all the photos from a specific yfrog account with this.


text:
Q: Is there a more elegant way to chop of the leading character after a stream.reduce? Is there a more elegant way to join the elements of a stream, separating each with a "\n", but not starting with "\n", without having to do that substring(1) call as in the following example?
    List<String> strings = someList;

    String rval = strings.stream()
            .map(this::someOperation)
            .reduce("", (p1, p2) -> p1 + "\n" + p2);

    if(rval.length() > 0)
    {
        // trim off the leading "\n"
        rval = rval.substring(1);
    }
    return rval;
}

Of course I can replace it with an internal loop, but that would lose the obvious functional readability

A: Use
.collect(Collectors.joining("\n"))

It will solve your problem, be much more readable, and also way more efficient, by not creating a whole lot of temporary strings and copies.

A: There are specific collectors that deal with strings efficiently. If you look at Collectors.joining, you'll see that it is exaclty what you are looking for:
String joined = strings.stream()
    .map(this::someOperation)
    .collect(Collectors.joining("\n"));


text:
Q: asp:calendar binds last value to date from database I have to bind an <asp:calendar> with data fetched from a database using a linq query.
Here is the linq code
public List<AllCalander> SearchCalender(int month, int zip, string type, int cause)
{
        var xyz = (from m in DB.Calenders
                   where(m.DateFrom.Value.Month==month || m.Zip==zip || m.ActivityType==type || m.CauseID==cause)
                   group m by new { m.DateFrom } into grp
                   select new
                   {
                       caustitle = grp.Select(x => x.Caus.CauseTitle),
                       datfrm = grp.Key.DateFrom,
                       total = grp.Count()
                   })
          .ToList()
          .Select(m => new AllCalander
          {

              DateFrom =Convert.ToDateTime(m.datfrm),
              CauseTitle = string.Join(",", m.caustitle),
              Total = m.total
          });

My aspx.cs code is here
List<AllCalander> calnder = calbll.SearchCalender(mnth,ZipString,type,causeString);

foreach (var myItem in calnder)
{
    string datetime = myItem.DateFrom.ToString();

    Literal myEventNameLiteral = new Literal();
    myEventNameLiteral.ID = i + myItem.CauseID.ToString();

    // string currentcalanderDate = e.Day.Date.Day.ToString() ;
    if (string.Equals(DateTime.Parse(datetime).ToString("MMM dd yyyy"), e.Day.Date.ToString("MMM dd yyyy")))
    {
        string a = myItem.CauseTitle;

        if (a != cause)
            cause = a;

        coun++;

        myEventNameLiteral.Mode = LiteralMode.PassThrough;
        myEventNameLiteral.Text = "
" + myItem.CauseTitle + "(" + myItem.Total + ")"+ " ";
        e.Cell.Controls.Add(myEventNameLiteral);
    }

    i++;
}

but on output it only shows the last value from database instead of showing all the data.
Can somebody please tell me what's wrong?
Thanks in advance

A: group m by new { m.DateFrom, m.Caus.CauseTitle } into grp


text:
Q: Fiware: Broken integration with Knowage Since several days I'm trying to implement my solution based on different fiware components with Knowage platform. What I'm trying to do is simply connect Knowage to HDFS to perform simple queries on the data that is stored via Cygnus. I managed to set up the DataSource correctly and the connection test is ok, but when I try to query creating my DataSet I keep getting the error "Method not supported". I have already found and solved several problems related to missing Jar and I have done manually inserting them, but this last error continues to appear without offering a way out.
I'm currently using Knowage 7.2 CE with docker, image taken from dockerhub. I've tried different versions, for example 8 and 8.1, but they all lead to the same error. Even an installation on Windows 10 has the same errors.
The HDFS database was deployed via the Hortonworks container via the official image.
I have been stuck on this issue for several days now, is anyone able to help me?


text:
Q: How to get average sales of an employee before certain sale in MySQL? Suppose I have a table with 3 columns: EMPLOYEE_ID, NUM_SALES, DATE. Simply this is the table of Employees indicating daily sales. For each row in the table, I try to compute this; average number of sales of that EMPLOYEE_ID in the last K days excluding this day.
How can I query this in MySQL? I try to group by with EMPLOYEE_ID and DATE but I cannot figure out how to find last K sales for each row.

A: To select an interval of days, you can use MySQL's DATE_SUB() function:
WHERE `date` >= DATE_SUB(NOW(), INTERVAL 3 DAY)

This will select all records that are from the past 3 days. However, to exclude "today" from that:
WHERE `date` BETWEEN
     DATE_SUB(NOW(), INTERVAL 3 DAY)
     AND DATE_SUB(NOW(), INTERVAL 1 DAY)

After that you should be able to GROUP BY the employee_id to get what you're after:
SELECT
    employee_id, avg(num_sales) AS avg_num_sales
FROM
    employee_table
WHERE `date` BETWEEN
     DATE_SUB(NOW(), INTERVAL 3 DAY)
     AND DATE_SUB(NOW(), INTERVAL 1 DAY)
GROUP BY
    employee_id

A: You need to be able to select items from your table, let's call it dailysale, by date.
Here's what you do.
SELECT employee_id, AVG(num_sales) AS avg_sales
  FROM dailysale
 WHERE date >= CURDATE() - INTERVAL 3 DAY
   AND date < CURDATE()
 GROUP BY employee_id

This uses two WHERE clauses to winnow down the date range you're using. date >= CURDATE() - INTERVAL 3 DAY excludes all records before midnight three days ago, and date < CURDATE() excludes all records on or after midnight today.
You need to use CURDATE() rather than NOW() because, well, NOW() includes the date and the present time of day. date < NOW() will include today's sales, because your date column only records dates and not times.
If you want to list the employees in order of sales, you could add
 ORDER BY AVG(num_sales) DESC, employee_id

to the query.


text:
Q: Upload any documents into telegram bot I would like to upload any documents into telegram bot.
For example:

The user type /sendpic, and then the bot waits for uploading a
  document by the user.

Here the code:
import config
import telebot

@bot.message_handler(func=lambda message: True,content_types=['document'])
def handle_docs_photo(message):
    try:
        chat_id = message.chat.id

        file_info = bot.get_file(message.document.file_id)
        downloaded_file = bot.download_file(file_info.file_path)

        src = 'B:/' + message.document.file_name;
        with open(src, 'wb') as new_file:
            new_file.write(downloaded_file)

        bot.reply_to(message, "Saved that.")
    except Exception as e:
        bot.reply_to(message, e)

But this function don't have any reaction. Can you help me , in what am I wrong?
I was searching for answers here, but all examples I saw that it downloads FROM a bot, but I need upload INTO the bot


text:
Q: select statement with where condition (select all or some) I have to following tables:
images:
imageID    userId    Translated    theImage
--------------------------------------------
    1         2         1           image1
    2         3         0           image2
    3         3         0           image3
    4         3         0           image4
    5         3         1           image5

and translationChains:
imageID    sourceLang    targetLang
------------------------------------
   1           2            3
   2           4            1
   3           5            1
   4           4            2
   5           1            4

now I have two options:
I want either to choose all the images the wasn't translated for a specific user in any language
or to choose all the images for this user that wasn't translated in a specific language.
I have the following query for the first option:
"Select images.imageid, images.theimage, images.translationRating
From images where images.userID=? And images.translated =0"

and for the second option I have:
"Select images.imageid, images.theimage, images.translationRating
From images, translationchains
where images.userID=? And images.translated =0 and
translationchains.imageId = images.imageid
and translationchains.targetLang = ? "

for example if i'll use the first query with user 3 I want the result to be:
2         3         0           image2
3         3         0           image3
4         3         0           image4

and for the second query with user 3 and targerLang = 1 I want the result to be:
    2         3         0           image2
    3         3         0           image3

I want to combine this two queries into one query that will work in all cases (according to the parameters that i'll send)
how can I do it?
I was trying to send as the second parameter (translationchains.targetLang = ?) the string " " (empty string) so it will ignore this condition but it didn't work

A: you may try this
FIRST  query
      Select * From images where userID=3 And translated =0

DEMO HERE
OUTPUT:
  imageID   userId  Translated  theImage
   2          3          0      image2
   3          3          0      image3
   4          3          0      image4

SECOND query
   Select i.imageID, userId, Translated, theImage
   From images i
   inner join translationchains  t
   on t.imageId = i.imageid
   where i.userID=3 And i.translated =0
   and t.targetLang = 1

DEMO HERE
OUTPUT:
 imageID    userId  Translated  theImage
    2         3         0       image2
    3         3         0       image3

THE COMBINE:
 Select i.imageID, userId, Translated, theImage
 From images i
 inner join translationchains  t
 on t.imageId = i.imageid
 where i.userID=3 And i.translated =0
 and t.targetLang in (select targetLang from translationChains  )
                                ^^^^^-------replace this by 1 or 2 or 3 or let it like that for all

    //-- if you want change targetLang just replace it by any number
    //--like that (select 1 from translationChains  )

DEMO HERE
OBS: you could also do it in php when you select the language then you put
   $sql .= "AND t.targetLang = the_id_selected_of_language ";

A: Try below query
SELECT images.imageid, images.theimage, images.translationRating
FROM images
INNER JOIN translationchains ON translationchains.imageId = images.imageid
WHERE images.userID=?
AND (
    (images.translated =1 AND translationchains.targetLang = ?)
    OR (images.translated =0)
)

A: Try the below query
SELECT a.imageid, a.theimage , a.translationRating
FROM images a , translationchains b
WHERE a.imageId = b.imageid
AND a.translated = 0
GROUP BY b.targetLang

The above query will be group the result based on the target language


text:
Q: Iwahori-Hecke algebra of $GL_2$ I had make an old post about this, but since seeing it now shows that I had no idea how to explain my question (because I didn't understand it) I'll try to do it normally here.
So I am studying this paper https://arxiv.org/pdf/math/0309168.pdf on Iwahori-Hecke algebras, and I am trying to apply this in the group $G=GL_2(\mathbf{Q}_p)$. Setting $K=GL_2(\mathbf{Z}_p)$ and $I=K\cap B$ where $B$ is the Borel subgroup of upper triangular matrices, I would like to understand two algebras: the algebra $H=C_c(I \setminus G / I)$ and the algebra $H_K=C_c(K\backslash G / K).$ The confusion in the previous post came from the fact that they both mainly go under the name "the Hecke algebra". Now, for $GL_2$, from high-tech things such as the Satake isomorphism we can see that $H_K\cong Z(H)\cong \mathbf{C}[s_1^{\pm},s_2^{\pm}].$ But I am also curious what $H$ exactly is in this case.
My thought is: Using lemma 1.7.1, it is enough to find just $R,H_0$. Now $H_0$ is $C_c(I \setminus K / Ι)$. These double cosets seem like they should be just $I, wI$ where $w$ is the permutation matrix (the nontrivial element of the Weyl group). So $H_0=\mathbf{C}^2$, since complex functions in these two elements are just pairs of complex numbers. $R=\mathbf{C}[Χ_*]$, where $X_*$ are essentially the elements
$\begin{pmatrix}p^m & 0\\ 0 & p^n \end{pmatrix},$ so we can identify $R$ with $\mathbf{C}[s_1^{\pm},s_2^{\pm}]$, where the coefficient of the $z_1^mz_2^n$ term corresponds to the value of the function in $\begin{pmatrix}p^m & 0\\ 0 & p^n \end{pmatrix}$.
Now the lemma should give $H=R\otimes H_0\cong \mathbf{C}^2[s_1^{\pm},s_2^{\pm}]\cong (\mathbf{C}[s_1^{\pm},s_2^{\pm}])^2,$ but this is absurd since this algebra is cmmutative and we know that the center will be $H_K$. My impression would be that $H$ should something similar to what we found, but maybe something like $H=\mathbf{C}[s_1^{\pm},s_2^{\pm}]\rtimes S_2$ where $S_2$ acts by permuting the variables, which would imply that the center is what we want, and is kind of similar to $(\mathbf{C}[s_1^{\pm},s_2^{\pm}])^2$. The problem is that although I feel that my above argument was messy, I can't pinpoint the exact mistake, which may be obvious.
Could you tell me my mistakes in the above, and also help me calculate $H$?


text:
Q: Java List of CompletableFutures to CompletableFuture List with allOf() I have a piece of asynchronous code which contains more methods and I need to make it return CompletableFuture<List> in the end.
I need to use 2 methods:

*

*the first method getConfigsByType() returns a Flux of type Config

*the second one, which needs to be applied to every individual Config object, returns CompletableFuture of type Config.

I want to use allOf() in order to get the expected result, but I have an error and I do not know why: "no instance(s) of type variable(s) U exist so that Boolean conforms to CompletionStage". The error is at this line: .thenCompose(segmentedConfig -> finalEvents.add(segmentedConfig));
private CompletableFuture<List<Config>> getConfigs(User user) {

Queue<Config> finalEvents = new ConcurrentLinkedQueue<>();
List<CompletableFuture<Config>> completableFutureList =  admin.getConfigsByType(configurationProperties.getEvents()) // returns Flux<Config>
                .map(config -> {
                    return segmentConfig(config, user) // returns CompletableFuture<Config>
                            .thenCompose(segmentedConfig -> finalEvents.add(segmentedConfig));
                })
                .collect(Collectors.toList());

return allOf(completableFutureList)
                .thenApply(list -> finalEvents);

private CompletableFuture<Void> allOf(List<CompletableFuture<Config>> futuresList) {
        return CompletableFuture.allOf(futuresList.toArray(new CompletableFuture[0]));
    }

    private CompletableFuture<Config> segmentConfig(Config config, User user) {
        return configurationApi.getSegmentedConfig(new DefaultCombinedConfigProvider<>(config), user);
    }

What am I doing wrong?

A: You can not produce the list of results before the future created by allOf(completableFutureList) has been completed. Further, a Queue<Config> won't become a List<Config>.
So, remove your attempt to produce the result list from the stream operation that produces the List<CompletableFuture<Config>>. Then, add an actual operation producing the result list to allOf(completableFutureList).
private CompletableFuture<List<Config>> getConfigs(User user) {
  List<CompletableFuture<Config>> completableFutureList
      = admin.getConfigsByType(configurationProperties.getEvents())
          .map(config -> segmentConfig(config, user))
          .collect(Collectors.toList());

  return CompletableFuture.allOf(completableFutureList.toArray(new CompletableFuture[0]))
      .thenApply(voidArg -> completableFutureList.stream()
          .map(CompletableFuture::join)
          .collect(Collectors.toList()));
}


text:
Q: Why does pinging of 200 bytes take long than pinging of 5000 bytes? So I have 5 machines connected in a LAN, each running Ubuntu 14 and have assigned a unique static IP. I am trying to calculate an estimate of the time it takes for a group of bytes to be transmitted and received to one of these machines. Here are some ping results I got by averaging 20 iterations of the ping each:
ping -s [size] -c 20 [IP address]

*

*200 bytes - roughly 0.6ms

*2,500 bytes - roughly 0.4ms

*10,000 bytes - roughly 0.4ms

How is it possible for a smaller packet size of 200 bytes take longer than 2500 or 10000 bytes?
Please note that they were tested all on the same machine, to the same address.

A: ping reported a similar result for me to localhost:

...
208 bytes from 127.0.0.1: icmp_seq=99 ttl=64 time=0.163 ms

--- localhost ping statistics ---
100 packets transmitted, 100 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.078/0.172/0.269/0.044 ms

2008 bytes from 127.0.0.1: icmp_seq=99 ttl=64 time=0.188 ms

--- localhost ping statistics ---
100 packets transmitted, 100 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.065/0.170/0.262/0.042 ms

However, ping isn't particularly precise with respect to reporting round-trip times, say, compared to tcpdump:
ping reports a RTT of 0.076 ms for a 208 byte packet, while tcpdump shows the packet leaving and returning in just 0.033 ms:

tcpdump -i lo0 -nK -t 5 -c 2 icmp

 00:00:00.000000 IP 127.0.0.1 > 127.0.0.1: ICMP echo request, id 37477, seq 0, length 208
 00:00:00.000033 IP 127.0.0.1 > 127.0.0.1: ICMP echo reply, id 37477, seq 0, length 208

For a 2008 byte packet, ping reported a RTT of 0.087 ms, though tcpdump reported just 0.042 ms.
In short, ping is a program that has overhead, and system dependencies that make it unsuitable for measuring tiny differences:  it's not a precision tool.


text:
Q: SQL Query in FME I am working on FME 2013 with XP machine and I want to run SQL query. I used InlineQuerier, SQLExecuter, SQLCreator but none of them is compatible with my requirement. I want to run SQLQuerry on a shapefile and give me the selected outputs like -
Select * from N_12 Where HNR1 Is Null

InlineQuerier is giving the output but it is only providing two automated columns(OID and Shape). Are there any other solutions or I am doing something wrong?

Actually, none of the above suggestions are working appropriately and is not fitting in my criteria. I am working on NULL and REPLACE, and I am not able to reach to get my destination till now.

A: You can add Shapefile reader and add tester there.
Edit: looks like people want more content to this.
Readers -> Add reader -> Add shapefile
And in workspace draw lines in order :
Shapefile -> Tester (select value and test) -> AttributeSetter/Replacer/Creator for replace
Shapefile ->  AttributeFilter -> AttributeSetter is other option.
InlineQuerier looks like "slow" (not 100% sure about it) solution, because it may force workspace to read all input features into it , process and after that pipe data to next transformer.

A: Many options are available...
NullReplacer for replace the null value by -999 and use the filter transformer.

A: InlineQuerier seems overkill for this purpose, but I was able to use it fine with FME 2014. Note that Shapefiles are not actually capable of storing null values, so check for empty values instead, e.g. SELECT * FROM N_12 WHERE "HNR1" = ''

A: I would go for a nullAttributeReplacer first to turn whatever null you may have in your data into something else like "test_attribute" and after with a tester = "test_attribute" to filter those pseudo nulls. You can always revert them to null back if that is a requirement.
NullAttributeReplacer.
Checks all the selected attributes and sets them to the value given in the Default Value parameter if they were null (if they had no value).
More information about nulls and how FME handles it can be found on safe blog:
http://blog.safe.com/2013/11/fmeevangelist119/
This transformer is useful when an output format requires non-null attributes.
Hope it helps.
Jorge Vidinha


text:
Q: how to use ffmpeg -cookies to download aes encrypted hls stream i need this cookies, so i can download stream from a m3u8 file,(it has this line
#EXT-X-KEY:METHOD=AES-128,URI="https://xxx/myStream.php?wowzasessionid=861683502"

so i can get the key right ? ( i have the login credential cookies to that site )
according to this discussion, it was there, and i checked the code on github, it has the option.
but when i compile it with the default options, there is no cookies option. how do i turn it on ?
> ./ffmpeg -buildconf
ffmpeg version N-61050-g2dcaa1b Copyright (c) 2000-2014 the FFmpeg developers
  built on Mar  3 2014 14:31:05 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3)
  configuration:
  libavutil      52. 66.100 / 52. 66.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  2.100 /  4.  2.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 18.100 /  0. 18.100

  configuration:

> ffmpeg -cookies
/sww/gfx/lib64/python2.6/pytz/__init__.py:32: UserWarning: Module argparse was already imported from /sww/tools/lib64/python2.6/argparse.py, but /usr/lib/python2.6/site-packages is being added to sys.path
  from pkg_resources import resource_stream
ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar 22 2013 09:58:42 with gcc 4.1.2 (GCC) 20080704 (Red Hat 4.1.2-44)
  configuration: --prefix=/dept/srd/vendor/ffmpeg/bundle.rhel5/ffmpeg1.2.0 --enable-static --enable-pthreads --enable-gpl --disable-ffserver --disable-ffplay --disable-ffprobe --extra-cflags=-I/dept/srd/vendor/ffmpeg/extern/rhel5/include --extra-ldflags=-L/dept/srd/vendor/ffmpeg/extern/rhel5/lib --enable-x11grab --enable-libx264 --enable-nonfree --enable-fontconfig --enable-libfreetype --enable-swscale --enable-libmp3lame --enable-libfaac
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Unrecognized option 'cookies'.
Error splitting the argument list: Option not found


text:
Q: How to hide toolbar automatically if I scroll down the recyclerView inside a fragment? Just Like my title says, I was trying to hide my toolbar dynamically when I scroll down the RecycledView inside of a fragment by using the coordinator layout. But it is not working. I think it is because something wrong with my XML file. I will be really grateful if someone helps me.
Here is my fragment XML file, this fragment is contained inside a tab layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.jinyu.jiaodian.MainActivity"
>

<android.support.v7.widget.RecyclerView
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:id="@+id/my_recycler_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scrollbars="vertical"
    />
<android.support.design.widget.FloatingActionButton
    android:id="@+id/upload_a_word"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentEnd="true"
    android:layout_alignParentBottom="true"
    android:layout_margin="@dimen/fab_margin"
    app:srcCompat="@android:drawable/ic_input_add"
    android:layout_alignParentRight="true" />

Here is my app_bar layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout       xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.jinyu.jiaodian.MainActivity">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay"
    >

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:layout_scrollFlags="scroll|enterAlways"
        app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

<include
    layout="@layout/tab_layout"/>

A: Put app:layout_behavior="@string/appbar_scrolling_view_behavior" on your include, not on the AppBarLayout. That behavior is what propagates nested scrolling events to your AppBarLayout.


text: Q: Google compute: Red hat Gui I would understand this is not recommended for security perspective. However, if person wants to GUI if installed Red hat linux what should be the process. The one mentioned in medium instruction is for Ubuntu only seems.


text:
Q: What is mixed transmission mode on my router? In my EDIXMAX router's configuration I can choose B, G or B+G.
What are the pros and cons of each and which should I choose to make transmission faster?

A: These represent different WLAN protocols.  B means 802.11b, G means 802.11g.  802.11g is the faster of the two protocols.  For maximum performance and compatibility, use the B+G mode.
On a side note, your router does not appear to support the latest and fastest protocol, 802.11n which can currently reach up to 450 Mbps (theoretically up to 600 Mbps; 802.11g allows up to 54 Mbps).

A: For most people, there is very little reason to enable B at this point as most newer computers, yours included, support the faster G, or even N. Since you are only going to be using one or the other, which would you prefer: 11Mb/sec for B, or 54Mb/sec for G?
The only reason to enable both would be if you have friends that might come over with older laptops, which only have a B wireless card, and you want them to connect. If they still use B, the heck with them (kidding, kind of). There is no performance hit for enabling both.
From a slight security point, there is no reason to have B enabled if you are not going to connect to it. Who will then, your neighbor, who wants to break in and download kiddy porn? I know, not likely, since they can still try to attack you on the G band, but there is still no real reason for you to enable B.

A: Even G- and N-capable devices can use B rates to their advantage at range. B rates use simpler modulation schemes that  work successfully at longer distances and lower signal-to-noise ratios than G and N rates.
Well-designed Wi-Fi routers implement G-only mode in a way that keeps B-only devices from joining, but keeps the B rates available for G-capable devices that might want to use them at range. Some poorly-designed Wi-Fi routers might implement G-only mode in a way that completely disables all the B rates, and thus hurts G-capable devices.
If you can't tell whether your router leaves the B rates enabled even in G-only mode, it's probably best to leave B+G enabled.


text:
Q: Unable to include Magick++.h for image processing: "no such file or directory" I'm setting up a c++ visual studio project to use ImageMagick's api, Magick++, for image processing. However, when I try to include <Magick++.h> in the only cpp file in the whole solution/project, I encounter this error:
fatal error C1083: Cannot open include file: 'Magick++.h': No such file or directory

I tried right-clicking Magick++.h in my code and pressing open document <Magick++.h>. This lead to an error message, which says the file is not found in current source file's directory or in build system paths. However, in the error message, the Build System Path clearly says the path to the include directory.
I have:

*

*added the include directory of ImageMagick-7.0.9-Q16 in the project's properties->C/C++
->Additional Include Directories.

*added the lib directory of ImageMagick-7.0.9-Q16 in the project's properties->Linker->Additional Library Directories

*added CORE_RL_Magick++_.lib, CORE_RL_MagickCore_.lib, and CORE_RL_MagickWand_.lib in the project's properties->Linker->Additional Dependencies

*Made sure everything is x64

*Set the configuration to release

*I somehow made Magick+++_demo project, the one that comes with magick++, work after tinkering with the settings. However, I cannot make other projects/solutions work. I have checked the settings of the demo project and tried to replicate it in my project where appropriate, but I cannot make my own project work.
this is the only code:
#include "pch.h"
#include <Magick++.h>
#include <iostream>
int main()
{
    std::cout << "Hello World!\n";
}

I have been googling and trying to make this work for the last 6 hours. Any help is hugely appreciated.


text:
Q: Linear Algebra - Changing bases?
Let $T: \mathbb{R}^3\rightarrow M_{2\times2}(\mathbb{R})$ be the linear transformation defined by $T((a,b,c)) = \begin{bmatrix}a&5a\\c&3c\end{bmatrix}$. Consider the bases $\alpha=\left\{(0,1,0),(0,1,1),(1,1,0)\right\}$ of $\mathbb{R}^3$, and $\beta=\left\{\begin{bmatrix}1&-1\\0&0\end{bmatrix},\begin{bmatrix}0&1\\-1&0\end{bmatrix},\begin{bmatrix}0&0\\1&1\end{bmatrix},\begin{bmatrix}0&1\\0&-1\end{bmatrix}\right\}$ of $M_{2\times2}(\mathbb{R})$. Find $\left[\strut T\right]_\alpha^\beta$.

Here is the question I've been struggling with. I am a little new to changing bases and coordinates etc.
Either way, it looks like I'm trying to find a transformation matrix that somehow also changes the bases? And how can I go from a vector to a $2\times2$ matrix? I know this is allowed in linear transformation but this question is just very confusing to me and any help is much appreciated.
I've tried some different things with change of basis matrices and some tranformation matrices but it all seems to be a dead end.


text:
Q: ASP.Net Core API routing based on folders or namespaces Is there a way to configure ASP.Net Core API routing based on folder structure or namespaces. Let's say I create a subfolder Documents in the Controllers folder, and then a controller WatermarksController in it. Then I want the routes to its actions to be /Documents/Watermarks/[action].
I know I can achieve this by manually applying the Route() attribute to the controller class, but is there a way to programmatically set up routes on application start, using either namespaces of file system?


text:
Q: Forecast for ARIMA in R doesn't seem to fit I've been trying to implement some ARIMA modelling of data in R (haven't been using R for long so not sure how well this is done), using the forecast library, but the forecasting part itself doesn't seem to work properly and I haven't been able to find why.
The function I use is roughly this :
arimamodel = function(valset, timeset, valtest, timetest)
{
    linear      = lm(valset ~ timeset)
    intercept   = linear$coefficients[[1]]
slope = linear$coefficients[[2]]
    lineardata  = (slope * timeset) + intercept
    residue     = lineardata - valset

    lineartest  = lm(valtest ~ timetest)
    intercepttest   = lineartest$coefficients[[1]]
slopetest = lineartest$coefficients[[2]]
    lineardatatest  = (slopetest * timetest) + intercepttest
    residuetest     = lineardatatest - valtest

    partautocorr = pacf(residue, lag.max = 500, plot=TRUE)
    lags = partautocorr$lag[abs(partautocorr$acf) > 0.1]
    highpacf = partautocorr$acf[lags]
arorder = ifelse(length(lags[lags < 6])>0, max(lags[lags < 6]), 1)
period = partautocorr$acf[lags[lags > 5]]

    arimamodel = Arima(residue, order=c(arorder,1,0), seasonal=list(order=c(0,1,1)), method="ML")
    arimadata = arimamodel$fitted
    arimaforecast = forecast(object = arimamodel, h = length(valtest))
    forecastdata = arimaforecast[["mean"]]
}

After removing the trends from both the training data and the test data and finding a rough order for the autoregression (some improvements to be done on that part), I train some ARIMA model on the data. The results aren't too bad, here's an example of the training data (black) vs. the ARIMA model (red)

On the other hand, the forecast part seems completely unrelated to those results. Here's the test data (black) vs. the ARIMA forecast (red) :

The plot doesn't seem related at all to even the ARIMA model on the training data. Am I misunderstanding how to use this library?
Edit : Here's some results using autoarima :
Training data :

Test data :

A: You should note a few things:

*

*Your series has no discernible structure, trend, or seasonality, so you're not really going to get much of a forecast out of it. In situations like this, your best bet is going to be a flat forecast anyway.

*You're trying to forecast 50 steps ahead using 50 steps of history, which is ambitious in the best of cases and unrealistic in your case given the quality of data.

*There seems to be a level shift between your training data and your test data, based on a visual inspection: Most of your data points in the training set are above 0, while most of your data points in the test set are below 0 leading to a lower mean in the test set than in the training set, it's almost as if there is a structural break between your train and test sets, which means no forecasting algorithm will be able to perform well, given the train/test split you have.


text:
Q: HTML 5 Video Tag not working from Tomcat (Edited) Video not playing from the Tomcat 7 server using absolute path & relative path of the file:
Edit Summary: Altered the example for the relative path, and i am placing the videos inside application Root-Folder (Still not able to resolve the video bug).
We are building a small application for video viewing for local usage. As HTML-5 gives us tremendous support for video viewing we opted to write a program using simple Servlet/JSP,  deploy it on Tomcat 7 Web server.
The Application logic is as follows:

*

*Root path (Absolute Path) is set to a root folder of my application in tomcat.

*All the files and directories inside root are displayed with a 'go' button beside.

*If a video file in the folder is selected by clicking 'go', a video viewing page appears.

*The relative of the video file is supplied to the video page using Expression langauge (EL) to the source of video tag.

*Video should be played from the localhost's hard disk to all the browser end points.

The Problem I am facing is my video is not playing from tomcat server, but the same rendered 'source' code of html on a browser when copied and pasted on a file the video is working fine. How to make it work from tomcat server?
After Edit: I modified my app to adjust for a relative path inside tomcat myapp's root folder, still it is not working. Below is the edited question.
Screen shorts of my app are:

Stage One: Click the Link

Stage Two: Select the video or folder to browse

Stage Three: Play the Video (Here I am getting Error)

Server Rendered the following HTML on the browser(Copied from view source):
<!doctype html>

<title>Cluster Video App</title>

Enjoy the Video

    <video controls autoplay width="512" height="288">
        <source src="G:\\To-See\\Ravi_sir_joke.m4v"> </source>
    </video>

When the Same source is copied and pasted on a sample html page anywhere in the computer the video works fine. The below image proves that.

After Edit: The server rendered proper relative path which contains the video.
The video is not working yet.
<!doctype html>

<title>Cluster Video App</title>

Enjoy the Video

    <video controls autoplay width="512" height="288">
        <source src="../ROOT-VIDEO/Ravi_sir_joke.m4v" > </source>
    </video>

The video is present in my application's root directory:

I have pasted the edited program in this page for reference. Please correct me and help me clear the video bug.

Program
Package Structure:

Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">

    <servlet>
        <servlet-name>Controller</servlet-name>
        <servlet-class>com.cluster.vapp.controller.ControllerServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Controller</servlet-name>
        <url-pattern>*.do</url-pattern>
    </servlet-mapping>

</web-app>

Controller Servlet:
   package com.cluster.vapp.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cluster.vapp.fileutils.FileUtil;
import com.cluster.vapp.fileutils.SearchResult;
import com.cluster.vapp.service.VappService;
import com.cluster.vapp.service.VappServiceImpl;

public class ControllerServlet extends HttpServlet {

    private static final long serialVersionUID = 1L;

    private VappService service;

    public void init() throws ServletException {

        service = new VappServiceImpl();
    }

    protected void service(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {

        response.setContentType("text/html");

        // HttpSession session = request.getSession();
        String strServletPath = request.getServletPath();

        // debug
        System.out.println(strServletPath);
        // end of debug
        int intServletpath = 0;

        if (strServletPath.equalsIgnoreCase("/welcome.do")) {

            intServletpath = 1;

        }

        if (strServletPath.equalsIgnoreCase("/verify.do")) {

            intServletpath = 2;

        }

        if (strServletPath.equalsIgnoreCase("/searchRoot.do")) {

            intServletpath = 3;

        }

        switch (intServletpath) {

        case 1: {// welcome.do

            RequestDispatcher requestDispatcher = request
                    .getRequestDispatcher("./JSP/welcome.jsp");
            requestDispatcher.forward(request, response);

            break;
        }

        case 2: { // verify.do

            if (service.isVideoFile(request.getParameter("path_name"))) {

                String strVideoPath = service.findRelative(request
                        .getParameter("path_name"));
                request.setAttribute("VIDEO_PATH", FileUtil.adjustPathName(strVideoPath));
                RequestDispatcher requestDispatcher = request
                        .getRequestDispatcher("./JSP/video.jsp");
                requestDispatcher.forward(request, response);
            }

            else {

                List<SearchResult> listSearchResults = service
                        .searchDirectory(request.getParameter("path_name"));
                request.setAttribute("LIST_SEARCH_RESULT", listSearchResults);
                RequestDispatcher requestDispatcher = request
                        .getRequestDispatcher("./JSP/search.jsp");
                requestDispatcher.forward(request, response);
            }

            break;
        }

        case 3: {// searchRoot.do

            List<SearchResult> listSearchResults = service
                    .searchRootDirectory();
            request.setAttribute("LIST_SEARCH_RESULT", listSearchResults);

            RequestDispatcher requestDispatcher = request
                    .getRequestDispatcher("./JSP/search.jsp");
            requestDispatcher.forward(request, response);
            break;
        }

        }
    }
}

VappServiceImpl.java
package com.cluster.vapp.service;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import com.cluster.vapp.fileutils.FileUtil;
import com.cluster.vapp.fileutils.SearchResult;

public class VappServiceImpl implements VappService{

    public static final String ROOT_PATH = "F:\\apache-tomcat-7.0.33\\webapps\\balaji\\ROOT-VIDEO";
    public static final String BASE_PATH = "F:\\apache-tomcat-7.0.33\\webapps\\balaji";

    public List<SearchResult> searchRootDirectory() {

        List<String> listDirectoryNames = FileUtil.fetchFileNames(ROOT_PATH);

        List<SearchResult> listSearchResults = new ArrayList<SearchResult>();

        for (String dirName : listDirectoryNames) {
            SearchResult result = new SearchResult();
            result.setStrName(dirName);
            result.setStrPath(ROOT_PATH + "\\" + dirName);
            listSearchResults.add(result);
        }

        return listSearchResults;
    }

    public boolean isVideoFile(String pStrPath) {

        File file = new File(pStrPath);

        // System.out.println("Is file There: " + file.exists());

        if (file.isFile())
            return true;
        else
            return false;
    }

    public List<SearchResult> searchDirectory(String pStrPath) {

        List<String> listDirectoryNames = FileUtil.fetchFileNames(pStrPath);

        List<SearchResult> listSearchResults = new ArrayList<SearchResult>();

        for (String dirName : listDirectoryNames) {
            SearchResult result = new SearchResult();
            result.setStrName(dirName);
            result.setStrPath(pStrPath + "\\" + dirName);
            listSearchResults.add(result);
        }

        return listSearchResults;
    }

    public String findRelative(String pStrVideoPath){

        return FileUtil.findRelativePath(BASE_PATH, pStrVideoPath);
    }

}

FileUtil.java
package com.cluster.vapp.fileutils;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import com.cluster.vapp.fileutils.exceptions.InvalidAbsolutePathException;
import com.cluster.vapp.fileutils.exceptions.InvalidDirectoryNameException;

/**
 * @author Balaji.K.R
 *
 * @version 1.0
 *
 *          The class Contains methods for various file operations. All methods
 *          present will accept only absolute string path of the source and
 *          destination file structure.
 *
 */
public class FileUtil {

    /**
     * The Method returns the names of the files as a list, in the path given.
     *
     * Note: The path name should be a absolute path, and should be a existing
     * directory. Any violation will lead to corresponding run-time exception.
     *
     *
     * @param pStrDirectory
     *            Location of the directory where it needs to be searched.
     * @return List of file names as string existing in the directory.
     */
    public static List<String> fetchFileNames(String pStrDirectory) {
        List<String> listFileNames = new ArrayList<String>();

        File directory = new File(pStrDirectory);

        if (directory.isAbsolute() == false) {
            throw new InvalidAbsolutePathException(
                    "Directory Path is not Absolute");
        }

        if ((directory.exists() && directory.isDirectory()) == false) {
            throw new InvalidDirectoryNameException();
        }

        String[] strFileNames = directory.list();

        for (String name : strFileNames) {

            listFileNames.add(name);
        }

        return listFileNames;
    }

    public static String adjustPathName(String pStrPath) {

        StringBuilder sb = new StringBuilder(pStrPath);
        sb.insert(0, "../");

        return sb.toString();

    }

    public static String findRelativePath(String pStrBasePath,
            String pStrAbsolutePath) {

        return new File(pStrBasePath).toURI()
                .relativize(new File(pStrAbsolutePath).toURI()).getPath();

    }

}

welcome.jsp
<!DOCTYPE html>

<title>Cluster Video App</title>

Cluster Video Application

Browse Videos

    </form>

search.jsp
<!DOCTYPE html>

<%@page isELIgnored="false"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="jstl"%>

<title>Cluster Video App</title>

Click to proceed...

    <jstl:forEach var="result"
                items="${requestScope.LIST_SEARCH_RESULT}">

    <form action="./verify.do" method="post">

            ${result.strName} <input type="button" value="Go" onclick="submitForm(this.form);"/>
            <input type="hidden" name="path_name" value="${result.strPath}">

    </form>

    </jstl:forEach>

video.jsp
<!doctype html>

<title>Cluster Video App</title>

Enjoy the Video

    <video controls autoplay width="512" height="288">
        <source src="${requestScope.VIDEO_PATH}"> </source>
    </video>

A: That's for security reason. Pages loaded from some server can't load files from local drive. Copy video to src/main/webapp/video.m4v. Change JSP to this:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!doctype html>

<title>Cluster Video App</title>

Enjoy the Video

    <video controls autoplay width="512" height="288">
        <source src="<c:url value="/video.m4v" />"> </source>
    </video>

A: place the the folder inside your WebContent folder or webapps folder then give path like
./folder1/file.mp4
if WebContent is not there then create a new project setup using eclipse with DynamicWebProject paste the tour files inside that.
i am also getting this issue but now its [SOLVED]
and i am using tomcat 8 and java 7

A: How about check the video.js
It really works. I tested with Apache-Tomcat 8.5.
First, include these two lines
<link href="//vjs.zencdn.net/5.11/video-js.min.css" rel="stylesheet">

and use video tag like this.
<video
    id="my-player"
    class="video-js"
    controls
    preload="auto"
    poster="//vjs.zencdn.net/v/oceans.png"
    data-setup='{}'>
  <source src="//vjs.zencdn.net/v/oceans.mp4#t=5,10" type="video/mp4"></source>
  <source src="//vjs.zencdn.net/v/oceans.webm" type="video/webm"></source>
  <source src="//vjs.zencdn.net/v/oceans.ogv" type="video/ogg"></source>

    To view this video please enable JavaScript, and consider upgrading to a
    web browser that

      supports HTML5 video

</video>


text:
Q: Logging all Firefox HTTP Request Headers? I'm using Ruby+Watir to request pages through Firefox.
I would like to record the headers and content of every http request made through the browser.
Would it be possible to configure a proxy solution to store this information, either in a file or pipe it into an application?
I'm running Ubuntu x64.
// Edit:
I would like to store the data in logs because I would like to view it later. Preferably, I am looking for a solution that runs quietly in the background and stores the headers/content in files.

A: If you have access to a Windows virtual machine or any other Windows physical machine, you can run Fiddler which should do exactly what you want.
After a brief look, I did find a program called Charles which some people refer to as "Fiddler for Linux", but I have no experience using it.

A: Check Proxy Sniffer - it has free edition.

A: I use the HttpFox extension for this sort of thing.

A: Try to use this Free HTTP Testing tool.

A: Burp Proxy
You can also try the Wireshark sniffer with appropriate filtering options. One general note on Windows self sniffing (sniffing on the loopback device) is that it is hard. But you use Ubuntu so it should work fine.

A: If it's just Firefox you want, you can use the Tamper Data addon to view (and edit) these requests.

A: You can access the firefox log to trace each http request.  It is not done by default.  Instructions are available at Mozilla


text:
Q: iPad 3 set auto-width on webpage I am creating a website. The width of my page is too wide, that means I have to scroll to the side. On the page there is no element with fixed width, so why do I still have to scroll sidewards? I thought the following meta tag would handle this issue.
Markup:
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />


text:
Q: What is the sense of converting PVOID buffer to PCHAR? I see next code in the MS code examples:
PVOID alignedBuffer[BUFFER_SIZE/sizeof( PVOID )];
PCHAR buffer = (PCHAR) alignedBuffer;

hResult = FilterSendMessage( context->Port,
                                 &commandMessage,
                                 sizeof( COMMAND_MESSAGE ),
                                 buffer,
                                 sizeof(alignedBuffer),
                                 &bytesReturned );

(alignedBuffer will hold the array of structures that are passed as replay  to FilterSendMessage call)
What is the sense of  converting PVOID to PCHAR, does this helps with aligment, how?

A: You are not converting PVOID to PCHAR. You are converting an array of PVOIDs (decaying to a PVOID *) to PCHAR.
PVOID alignedBuffer[BUFFER_SIZE/sizeof( PVOID )];

This defines alignedBuffer as an array of PVOIDs (or void *s). As an array of pointers, it will be suitably aligned (usually 4-bytes on 32-bit, 8 bytes on 64-bit). If you do simply
CHAR buffer[BUFFER_SIZE];

There's no similar guarantee, since there's no alignment requirement for CHARs.


text:
Q: how to set a form's target to a fancybox with jquery? I have a form:
<form id="form" method="GET" action="">
    <input type="hidden" name="hashKey" value="123" >
    <input type="text"  name="orderID" placeholder="orderid">
    <input type="hidden"  name="currencyCode" value="USD">
    <input type="text"  name="amount" value="10.0">
    <input type="hidden" name="payModel" value="sandbox">

    <button type="submit" id="payModel" name="payModel" value="sandbox">click to buy</button>
</form>

when the form is submitted the values are stored using javascript below
$(document).ready(function(){      //selecting the form upon submit
    $("#form").submit(function(){
        var formAction = $(this).attr("action");
        var hash = $("input[name=hashKey]").val();
        var id = $("input[name=orderID]").val();
        var code = $("input[name=currencyCode]").val();
        var amount = $("input[name=amount]").val();
        var pay = $("input[name=payModel]").val();

        var link = formAction+"?hashKey="+hash+"&orderID="+id+"&currencyCode="+code+"&amount="+amount+"&payModel="+pay;

        var testlink = "http://google.com";

        $("#form").attr('target',"_self");
        $("#form").attr('action',testlink);
    }
}

the links are working fine, but the thing is i want the final form 'action' to be opened in a fancybox iframe. any idea??
it is very easy to open fancybox with a

fiddle

A: You can use it like below:
$.fancybox.open({
    href: link,
    type: 'iframe',
    padding: 0
});

A: i got it!!!
by using the second method from this solution.
How do I submit the data of a form to an iframe in Fancybox?
       $(function() {

$("#form").submit(function() {

    $form = $(this);

    $.fancybox({
            'title': "form submission",
            'href': $form.attr("action") + "?" + $form.serialize(),
            'type': 'iframe'
    });

    return false;

});

});


text:
Q: Jquery Fadeout won't work upon clicking of button I would like to show a <div> that displays "Saved!" every time the user clicks the save button.
I have here some jQuery code but it works only once.  The second time I click the button the div won't show up.
$("#loading").html("Saved!").fadeOut(4000);

A: Possibly because it is hidden. Try:
$("#loading").html("Saved!").show().fadeOut(4000);

Or
$("#loading").html("Saved!").fadeIn(200).fadeOut(4000);

A: That is because the div is still "faded out"
try this...
$("#loading").html("Saved!").fadeOut(4000, function(){
    $("#loading").empty();
    $("#loading").show();
});

It empties the #loading div and then re-displays it and readies it for the next click.

A: You need to bind a click event to a a div.
$(document).ready(function() {
        $('#element').click(function() {
            $('#para').html("Saved!").fadeOut(4000);
        });
    });


text:
Q: Large Delphi exe and maintenance issues I have a project with hundreds of VCL forms, when compile it the exe size is around 80MB which is not an issue. When a customer askes for an update on a single form or debugging a single form then updating 80mb for a single change is a big issue.
What are possible options or good practices to split these forms in  different files and loading them from one exe.
And when any change is needed then send/update that particular form or section.
Delphi 10.1 berlin
And I always send release file.
Thanks

A: try to split up your application into packages (.Bpl-files).
Here is an example how to do this.


text:
Q: Spring @Transactional does not work when I call a method inside of it. How can I slove it? I have an entity with 3 field (id, name and age). I have created a repository (PersonRepository) in which I want to see how Transaction works.
I find strange that if I insert a method call inside a method, this does not work as expected.
public void nestedTransaction() {
        personRepository.save(new Person(11L, "A1", 26));
        childTransaction();
}

@Transactional(propagation = Propagation.REQUIRED)
public void childTransaction() {
    personRepository.save(new Person(10L, "A2", 26));
    throw new RuntimeException("ExceptionTest child");
}

After the autowiring of PersonRepository that contain the above methods, I call:
try {
    serviceTransaction.nestedTransaction();
} catch (Exception e) {
    System.out.println("Exception: "+e.getMessage());
}

Please do not pay attention on the fact that I'm using System.out.println instead of logging, this is just a test for understanding @Transactional. However, I expect that in my DB there is the entity (11L, "A1", 26) but not the entity (10L, "A2", 26)) instead I have both. Why this happen?
I already know that I can use transactionTemplate and it works using it. For example:
public void nestedTransaction() {
    transactionTemplate.setTimeout(1000);
    transactionTemplate.setIsolationLevel(TransactionDefinition.ISOLATION_REPEATABLE_READ);
    transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
    personRepository.save(new Person(11L, "Ale2", 26));
    transactionTemplate.execute(new TransactionCallbackWithoutResult() {

       @Override
       protected void doInTransactionWithoutResult(TransactionStatus status) {
            childTransaction();
       }
    });
}

Can anyone explain this behaviour and how to solve it?

A: You need to put the @Transactional annotation above the nestedTransaction() method as well for the transaction to commit. Also, the propagation = Propagation.REQUIRED property is default, so you don't need to specify it.

A: Transaction works only if you call it outside from the class. Default Spring use AOP to start and finish the transaction, which is an around advice. So when you call method inside the class, it can't go throught that proxy. You have to annotate the method you call outside from the class with transactional, any method called from that method inside that class (and lower in calling stack outside that class which dont create new transaction) will join to that transaction.
You can use nasted transaction with, modify isolation levels etc, but not in same class.
You can visualize something like:


text:
Q: pandas: dataframes row-wise comparison I have two data frames that I would like to compare for equality in a row-wise manner. I am interested in computing the number of rows that have the same values for non-joined attributes.
For example,
import pandas as pd

df1 = pd.DataFrame({'a': [1,2,3,5], 'b': [2,3,4,6], 'c':[60,20,40,30], 'd':[50,90,10,30]})
df2 = pd.DataFrame({'a': [1,2,3,5], 'b': [2,3,4,6], 'c':[60,20,40,30], 'd':[50,90,40,40]})

I will be joining these two data frames on column a and b. There are two rows (first two) that have the same values for c and d in both the data frames.
I am currently using the following approach where I first join these two data frames, and then compute each row's values for equality.
df = df1.merge(df2, on=['a','b'])
cols1 = [c for c in df.columns.tolist() if c.endswith("_x")]
cols2 = [c for c in df.columns.tolist() if c.endswith("_y")]
num_rows_equal = 0

for index, row in df.iterrows():
    not_equal = False
    for col1,col2 in zip(cols1,cols2):
        if row[col1] != row[col2]:
            not_equal = True
            break
    if not not_equal:  # row values are equal
        num_rows_equal += 1

num_rows_equal

Is there a more efficient (pythonic) way to achieve the same result?

A: use pandas merge ordered, merging with 'inner'. From there, you can get your dataframe shape and by extension your number of rows.
 df_r = pd.merge_ordered(df1,df2,how='inner')

    a   b   c   d
0   1   2   60  50
1   2   3   20  90

no_of_rows = df_r.shape[0]

#print(no_of_rows)
#2

A: A shorter way of achieving that:
import pandas as pd

df1 = pd.DataFrame({'a': [1,2,3,5], 'b': [2,3,4,6], 'c':[60,20,40,30], 'd':[50,90,10,30]})
df2 = pd.DataFrame({'a': [1,2,3,5], 'b': [2,3,4,6], 'c':[60,20,40,30], 'd':[50,90,40,40]})
df = df1.merge(df2, on=['a','b'])

comparison_cols = [c.strip('_x') for c in df.columns.tolist() if c.endswith("_x")]
num_rows_equal = (df1[comparison_cols][df1[comparison_cols] == df2[comparison_cols]].isna().sum(axis=1) == 0).sum()


text:
Q: two sample t-test not matching R I'm trying to do a hypothesis test and I've been told that my alternative hypothesis is that male students are older on average than female students in this particular survey.
I've set it up as follows:
H(alternative): u1 > u2
H(null): u1 < u2
my n1  = 24, n2 = 32
s1 = 3.27042
s2 = 1.840133
sample mean 1 = 21.5
sample mean 2 = 20.03125
My variances are also unequal so I am using this test:

my S^2 spooled I found was 6.499 (3dp)
so when I came to finding t-statistic I did the following:
t = (21.5 - 20.03125) / sqrt((6.499/24) + (6.499/32))
and got a t value of 2.13359
however in R I am getting a t-value of 1.9778. Is this just a rounding error on my end or have I done something wrong in my calculations?

A: Hint:
The hypotheses are
$H_0:U_1 = U_2$
and $H_a: U_1 > U_2$
I a two sample t-test, you are assuming the U_1-U_2 = 0 and the formula in the numerator is just $(\bar X_1 - \bar X_2) - (U_1-U_2)$ and the later is zero according to your hypothesis. U_1 and U_2 are the population means  and you don't need them.
An example of this is as follows.
Male Height: $$\bar X_1 = 564.9, n_1 = 10, s_1^2 = 21544.76667$$
Female Height:    $$\bar X_2 = 484.5, n_2 = 10, s_2^2 = 17221.16667$$
$s_p^2 = \dfrac{(n_1-1)S_1^2 + (n_2-1)S_2^2}{(n_1 + n_2-2)} = 19382.96667$
                       $alpha = .05$

Hypothesis
        $H_0 :  \mu_2 = \mu_1$
        $H_a :  \mu_2 > \mu_1$
Test Statistic:
$$ t = \dfrac{\bar x_2- \bar x_1}{\sqrt{s_p^2/n}} = - 1.82619$$
The test statistic is distributed as Student's t distribution with $(n_1+n_2-2)$ degrees of freedom.
    (b) Decision rule

With alpha = .05 and df , find the t-critical.  We reject H0 if t > t_critical.
(6) Statistical decision
We reject $H_0$ because t-statistic > t-critical and conclude that the males are on average taller than females.
Something of this sort.
Thanks
Satish


text:
Q: Moving remote subversion server to a new local subversion server I'm currently working with a remote svn server. However sometimes I have to work offline (because the remote server is on a closed network there is no connection to internet). What I want to do is to copy the svn server to my local server (a.k.a my Laptop).
I should probaly setup a local subversion server (as mentioned here: http://www.subversionary.org/howto/setting-up-a-subversion-server-on-ubuntu-gutsy-gibbon-server)
However what should I do to copy the remote subversion server to my local laptop? I mean a simple svn checkout is not what I want. I want a replicate of the remote server, but it should be running in my own laptop server.
Actually think of moving(copying) the subversion server to another location. I just don't know where to begin. Any keywords or how to begin explanations would be helpful.
Also note, that I can commit and checkout from the svn server, but I probably don't have any administrator rights to acces the remote servers shell,etc..

A: If you only can access the remote subversion repository via the subversion protocol, you can still use svnsync to create a copy of the repository:
svnadmin create /tmp/svn
ln -s /bin/true /tmp/svn/hooks/pre-revprop-change
svnsync init file:///tmp/svn https://svn.example.org/svn/my-project
svnsync sync file:///tmp/svn
rm /tmp/svn/hooks/pre-revprop-change

A: It sounds like you need to use the Subversion write-through proxy. This means that you have a local repository that is kept in sync with the master when you are online, but if you try to commit then your local mirror will forward the request to the master and then re-sync. Note that there is no way of being able to commit when you aren't online.  If you want a way of saving local changes while you're offline then you might want to look at git-svn which creates a local git repository that you can commit to and then separately you can commit those changes back to SVN.


text:
Q: How can I generate an incrementing Billing number that contains text codes? I have a billing form in my Winform app. I want to increment the bill number automatically upon billing. I have a new button to clear everything and start a fresh billing. so i created a code in that buttons click event.
 SqlCommand cmd = new SqlCommand("SELECT TOP 1 Bill_No FROM POS order by Bill_No Desc", con);
            int a = Convert.ToInt32(cmd.ExecuteScalar());
            int b = a + 1;
            string Bill = "Bill";
            txt_BillNo.Text = Bill+b.ToString();

Now problem is When i click that button for the second time i. 'a' gets varchar data. Like Bill12. For the next click i want to increment as Bill13. But as it gets data from database as varchar it cant increment number alone. So is there any way to get the number from the varchar ? like 12 from bill12?

A: You can use Regex for identifying integer from string.\d+ is the regex for an integer number. So
 //System.Text.RegularExpressions.Regex

 resultString = Regex.Match(subjectString, @"\d+").Value;
 returns a string containing the first occurrence of a number in subjectString.

 Int32.Parse(resultString) will then give you the number.

A: You can use stuff to replace Prefix, that will give you numeric value
Select STUFF('Bill1',1,4,'')


text:
Q: How to insert into parent and child tables at once in bookshelf.js I got a table called companies and another called companies_posts, where company_posts.company_id is a foreign key to companies.id
Supposing I got the following json:
  {

       "name" : "Teste",
       "username" : "teste1",
       "password" : "teste1",
       "email" : "teste2@teste",
       "photo" : "teste",
       "description" : "teste",
       "company_posts" : [
          {"text" : "oi"},
          {"text" : "olá"}
       ]

   }

Is there any way in bookshelf.js to insert it at once? Like mongodb, I suppose. Or I need to insert company, get lastInsertId and then insert each company_posts right after?
Thanks.
Edit: (Btw, I just learned how to select using withRelated and hasMany. Now I must learn how to insert / update)

A: No, bookshelf.js uses knex.js, which is based on relational database. Thus, you must firstly insert the company. In the callback function you get the inserted id, and you can insert the posts as well.
You can of course use transactions for this, which have been greatly improved in the recent update of knex.js.
I haven't tested this, but I think something like that should work, more or less:
var Company = bookshelf.Model.extend({
  tableName: 'companies',
  posts: function(){
    return this.hasMany(Post);
  }
});

var Post = bookshelf.Model.extend({
  tableName: 'posts',
  companies: function(){
    return this.belongsTo(Company);
  }
});

new Company().save({...}).then(function(company){
    new Post().save({
        ...
        company_id: company.get('id')
    }).then(function(post){
        //final result
    });
});


text:
Q: Eclipse crashes I've been having problems running eclipse. This is the exception that was thrown after the crash today.  I don't understand why I can't run the standard eclipse on my Linux machine. Does anyone have any idea what the problem could be? I've tried changing the JVM a hundred times. Messed with the eclipse.ini nothing seems to work.
I'm running Eclipse 64 3.7.1 on RHEL5 AMD64;
Exception in thread "Worker-4"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i                                         n thread "Worker-4"
Exception in thread "Keep-Alive-Timer"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i                                         n thread "Keep-Alive-Timer"
Exception in thread "Worker-2"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i                                         n thread "Worker-2"
Exception in thread "Worker-6"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i                                         n thread "Worker-6"
Error while logging event loop exception:
Exception in thread "Worker-3"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i                                         n thread "Worker-3"
Exception in thread "Worker-7"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i                                         n thread "Worker-7"
Exception in thread "[Timer] - Main Queue Handler"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler i                                         n thread "[Timer] - Main Queue Handler"
Exception in thread "Worker-5"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Worker-5"
Exception in thread "Worker-8"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Worker-8"
Exception in thread "Worker-10"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Worker-10"
Exception in thread "Worker-9"

I have tried increasing the memory int he eclipse.ini file. Here are some more errors on crash:
Error while informing user about event loop exception:
java.lang.OutOfMemoryError: PermGen space
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(
DefaultClassLoader.java:188)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(Clas
spathManager.java:601)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(Cl
asspathManager.java:567)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassIm
pl(ClasspathManager.java:490)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_L
ockClassName(ClasspathManager.java:469)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(C
lasspathManager.java:456)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalCla
ss(DefaultClassLoader.java:216)
        at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLo
ader.java:400)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(Bundl
eLoader.java:476)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.
java:429)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.
java:417)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(De
faultClassLoader.java:107)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(
DefaultClassLoader.java:188)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(Clas
spathManager.java:601)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(Cl
asspathManager.java:567)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassIm
pl(ClasspathManager.java:490)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_L
ockClassName(ClasspathManager.java:469)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(C
lasspathManager.java:456)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalCla
ss(DefaultClassLoader.java:216)
        at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLo
ader.java:400)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(Bundl
eLoader.java:476)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.
java:429)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.
java:417)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(De
faultClassLoader.java:107)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at org.eclipse.equinox.internal.p2.metadata.expression.CollectionFilter.
getInnerIterator(CollectionFilter.java:106)
        at org.eclipse.equinox.internal.p2.metadata.expression.CollectionFilter.
evaluate(CollectionFilter.java:56)
Dialog open exception:
java.lang.OutOfMemoryError: PermGen space
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(
DefaultClassLoader.java:188)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(Clas
spathManager.java:601)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(Cl
asspathManager.java:567)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassIm
pl(ClasspathManager.java:490)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_L
ockClassName(ClasspathManager.java:469)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(C
lasspathManager.java:456)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalCla
ss(DefaultClassLoader.java:216)
        at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLo
ader.java:400)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(Bundl
eLoader.java:476)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.
java:429)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.
java:417)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(De
faultClassLoader.java:107)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(
DefaultClassLoader.java:188)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(Clas
spathManager.java:601)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(Cl
asspathManager.java:567)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassIm
pl(ClasspathManager.java:490)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_L
ockClassName(ClasspathManager.java:469)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(C
lasspathManager.java:456)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalCla
ss(DefaultClassLoader.java:216)
        at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLo
ader.java:400)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(Bundl
eLoader.java:476)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.
java:429)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.
java:417)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(De
faultClassLoader.java:107)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler.openInternalQues
tionDialog(IDEWorkbenchErrorHandler.java:225)
        at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler.openQuestionDial
og(IDEWorkbenchErrorHandler.java:194)
Fatal error happened during workbench emergency close.
java.lang.OutOfMemoryError: PermGen space
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.defineClass(
DefaultClassLoader.java:188)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(Clas
spathManager.java:601)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(Cl
asspathManager.java:567)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassIm
pl(ClasspathManager.java:490)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_L
ockClassName(ClasspathManager.java:469)
        at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(C
lasspathManager.java:456)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalCla
ss(DefaultClassLoader.java:216)
        at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLo
ader.java:400)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(Bundl
eLoader.java:476)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.
java:429)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.
java:417)
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(De
faultClassLoader.java:107)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at org.eclipse.ui.internal.Workbench.close(Workbench.java:1277)
        at org.eclipse.ui.internal.WorkbenchConfigurer.emergencyClose(WorkbenchC
onfigurer.java:165)
        at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler.closeWorkbench(I
DEWorkbenchErrorHandler.java:253)
        at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler.handleException(
IDEWorkbenchErrorHandler.java:155)
        at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler.access$0(IDEWork
benchErrorHandler.java:146)
        at org.eclipse.ui.internal.ide.IDEWorkbenchErrorHandler$1.runInUIThread(
IDEWorkbenchErrorHandler.java:121)
        at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.ja                                  va:135)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
        at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
        at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.ja                                  va:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.jav                                  a:667)
Error while logging event loop exception:
java.lang.OutOfMemoryError: PermGen space
Logging exception:
java.lang.OutOfMemoryError: PermGen space
Error while informing user about event loop exception:
java.lang.OutOfMemoryError: PermGen space
Dialog open exception:
java.lang.OutOfMemoryError: PermGen space
Error while informing user about event loop exception:
java.lang.OutOfMemoryError: PermGen space
Dialog open exception:
java.lang.OutOfMemoryError: PermGen space
Error while logging event loop exception:
java.lang.OutOfMemoryError: PermGen space
Logging exception:
java.lang.OutOfMemoryError: PermGen space
Error while logging event loop exception:
java.lang.OutOfMemoryError: PermGen space

Here is my Eclipse.ini file:
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vmargs
-Dosgi.requiredJavaVersion=1.5
-XX:MaxPermSize=256m
-Xms1024m
-Xmx1800m

I asked this question again here: Setting JVM maxperm size outside of Eclipse.ini and received a good answer for anyone else with this problem.

A: There may be many underlying problems responsible for your eclipse crashing with java.lang.OutOfMemoryError.
Check whether you machine is not low on memory. You can do this with the free command. Running low on memory would most likely not manifest this way, though, unless you've disabled overcommit.
Check your per process  virtual memory size limits using the ulimit -v command.
Allow the JVM to grab a larger heap using the -Xmx flag.
Your eclipse may be loading a lot of plugins. Each plugin contains a number of classes and all these classes are stored in the permanent generation of the heap. Try to disable some plugins or increase permanent generation size with the -XX:MaxPermSize JVM flag.
EDIT: Now that the question has been extended with a full stack trace and exception message string, it is apparent that permanent generation size is inadequate. Thus, as suggested above, increase its size with the -XX:MaxPermSize or try to disable some plugins. Perhaps you've recently added a plugin which includes a lot of classes?

A: Maybe stating the obvious but it says out of memory, is your computer running low on memory?
Try running it with vm args to allocate more memory.
eclipse -vmargs -Xmx512m

A: Going only on this log. As far as I can see this is an Memory size related issue. Have you tried taking a look at the amount of memory given too Eclipse when started? Did you perhaps configure any default JVM parameters. You might check the running Eclipse process with 'ps -aux' from the terminal after Eclipse has started.
You should see something like -Xmx512m or -XX:MaxPermSize=128m. You might also want to take a look at your eclipse.ini to see if some memory related settings is there.


text:
Q: sonarqube elasticsearch not starting I installed sonarqube on centos. After making all the required configuration changes when I start sonarqube service, it doesn't start. In logs I see error that elasticsearch could not be started. In es log it mentions that elasticsearch could not be started as root user. I'm running as centos user and not root. Also I have made centos as owner on sonarqube folder recursively. I have also set run_as_user as centos in the config. Still the issue is coming. Looking for help.

A: I am late in this conversation.
I faced the same issue while running sonarqube in Ubuntu and found that elasticsearch is failed as its trying to run as root user. Elasticsearch will not run on root user, instead you should create a user say sonar and then give all grants and permission in order to run.
I followed below steps to the issue.

*

*Add user
sudo useradd sonar

*Add group
sudo groupadd sonar

*grant permission to sonar
sudo chown -R sonar:sonar {sonar-installed-folder}/

*Edit sonar.properties file to user 'sonar' user
now edit the sonar.sh file which is location under /sonar/conf
and change the #RUN_AS_USER to be RUN_AS_USER=sonar

*Run sonar go to folder where sonar is installed (/opt/sonar in my case)
/sonar/bin/linux-x86-64$ sudo ./sonar.sh start

*Check status
/sonar/bin/linux-x86-64$ ./sonar.sh status
Happy coding