text:
Q: setOnClickListener - not called I use fragments, setOnClickListener - not called, I do not understand what is wrong
public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {

        View myFragmentView = inflater.inflate(R.layout.right_panel_1, container, true);

        Button buttonStart = (Button) myFragmentView.findViewById(R.id.ButtonStart);
        Button buttonFinish = (Button)myFragmentView.findViewById(R.id.buttonFinish);

        buttonStart.setOnClickListener(new View.OnClickListener() {

             public void onClick(View v) {

                ////

            }
        });

        buttonFinish.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {

                ////
            }
        });

and layout right_panel_1.xml

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <Button
        android:id="@+id/ButtonStart"
        android:layout_width="158dp"
        android:layout_height="72dp"
        android:gravity="center_vertical|center_horizontal"
        android:text="Start"
        android:textSize="@dimen/padding_large" />

    <Button
        android:id="@+id/buttonFinish"
        android:layout_width="match_parent"
        android:layout_height="72dp"
        android:gravity="center_vertical|center_horizontal"
        android:text="Finish"
        android:textSize="@dimen/padding_large" />
</LinearLayout>

<ScrollView
    android:id="@+id/scrollViewLog"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:id="@+id/myLog"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</ScrollView>

A: You should probably try adding @Override above
@Override
public void onClick(View v)

That's the only part i see that's missing at least :)
there's a tutorial on using fragments at http://neilgoodman.net/2012/03/12/working-with-fragments-on-android-part-2/ you can take a look at and try doing it from scratch


text:
Q: HTML5 video buffer I have a video that I want to show when the user clicks on a button. I add the video code to the page using jQuery .append().
I've set autoplay and currently, the video first starts to play with audio only, and then after a while, starts again from the beginning with audio and video.
Is there a way I could prevent this glitch from happening?
Thanks in advance!

A: I had the same issue. jQuery is creating your video element and it starts playing (in the background) before it appends it to the page. It doesn't seem to happen when making the element with .html() instead of .append(): http://jsfiddle.net/cDpV9/6/
$("#player").html("<video id='v' src='http:...webm' autobuffer='auto' preload autoplay controls />");

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why is the dismissible alert not being dismissed? Note: Let me start by saying that I'm aware of this question but the solution is incomplete and I don't yet have not enough reputation on stackoverflow to comment on it. So, I was left with the only option of creating a duplicate question.
I'm trying to use angularjs and bootstrap (ui-bootstrap) to show a dismissible alert. However, even after including ui-bootstrap-tpls-*.js file (solution suggested on original question) it doesn't seem to work. Although it does work with jquery.
Please check this plunker

A: I found a way to have a dismissible alert without adding extra logic to the controller. I don't even need bootstrap-*-js.
Basically I have an alert with a close button that uses ng-click on a $scope variable to hide the parent div on ng-show. (The controller sets that variable to whether that alert should be initially shown or not.)

  <button type="button" class="close" ng-click="show_alert=false">×</button>
  Warning! Best check yo self, you're not looking too good.

The css classes alert alert-warning and close are styled by bootstrap.
Check out this plunker with the above solution.

A: There is a difference between using the native Bootstrap alert and angular-ui alert.
For the latter, you need to use a directive. Here is an example from their website.

  <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</alert>
  <button class='btn btn-default' ng-click="addAlert()">Add Alert</button>

Notice that the element is an alert.
You also need to have an Angular module which injects the ui.bootstrap module.
angular.module('plunker', ['ui.bootstrap']);

Take a look at this plunkr.

A: You just imported the bootstrap templates, but not the angular ui bootstrap javascript. The imports for your example should look like this:

<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" />

Furthermore, you don't use an angular app and controller. You need this to make the alerts work. Check the documentation here: http://angular-ui.github.io/bootstrap/
To close the alert, a close() function should be defined. Here is a working example:
<!doctype html>

    <link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" />

    <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)">{{alert.msg}}</alert>

Check out the plunker here: http://plnkr.co/edit/wV1fJO9qAbra7W6J8vz5?p=preview

A: I was experiencing the same issue(alerts not being dimissed) I had all the libraries I need imported like this
<link rel="stylesheet" href="lib/bootstrap.css">

But later on I found that the order of the library imports is the problem. And I change the import order like the following after that things are working okey.
<link rel="stylesheet" href="lib/bootstrap.css">

I hope this helps. Thank you


text:
Q: AJAX + jQuery variables do not pass to PHP I am trying to do something very simple: Pass 2 text variables to a php script and insert them into a MySQL db. For some reason however I can't get the variables to pass (so I just get empty records in my DB).
function ajaxCall(){

        $.ajax({
            type: "GET",
            url: "http://www.*.be/bubblingAjax.php",
            cache: false,
            data: "colour="+colour+"&size="+size,
        dataType: "html",
            success: onSuccess
        });
        return false;
    };

And the PHP:
<?php
    try
    {
        $connection = mysql_connect("#");
        mysql_select_db("#");

        $colour = mysql_real_escape_string($_GET['colour']);
        $size = mysql_real_escape_string($_GET['size']);

        mysql_query("INSERT INTO bubble (colour, size) VALUES ('$colour', '$size')");
        mysql_close($connection);
        echo "SUCCESS";
        echo $colour;
        echo $size;
    }
    catch(Exception $e)
    {
        echo $e->getMessage();
    }
?>

Anyone willing to take a quick look at it and point out my -probably obvious- mistake? It's been driving me nuts for over a day.

A: The "data" parameters are sent as POST varaiables rather than GET variables.
Try $_POST in the PHP

A: This has to work:

and the PHP (only changed get to post)
<?php
    try
    {
        $connection = mysql_connect("#");
        mysql_select_db("#");

        $colour = mysql_real_escape_string($_POST['colour']);
        $size = mysql_real_escape_string($_POST['size']);

        mysql_query("INSERT INTO bubble (colour, size) VALUES ('$colour', '$size')");
        mysql_close($connection);
        echo "SUCCESS";
        echo $colour;
        echo $size;
    }
    catch(Exception $e)
    {
        echo $e->getMessage();
    }
?>

Also to debug, I would suggest using firebug or chrome's build in inspect tools.

A: TEST THIS IN a test.php file (name matters):
<?PHP
if(isset($_POST['user_name']))
{
$post_output=
'Hello '.strtoupper($_POST['user_name']).' from '.strtoupper($_POST['user_city']).'!

This is an other random:'.rand(23,46).'.

The previous random is still alive!

I guess you can insert these 2 values
in the database on your own now, don\'t you?!';

$get_output=
'

___________________________________________
Well if you insist you can keep using get on parallel
This is what $_GET says:

'.strtoupper($_GET['getMessage']).'

And finally you can avoid post at all, to do that:
1.Use get instead of post inside the insertToDB function
2.Use send(null) instead of send(params)
3.Don\'t send the headers

HOWEVER I LIKE POST!';
echo $post_output;
print $get_output;
exit;
}
?>

This is a random:<?PHP echo rand(1,23);?>

<input type="text" name="name" value="your name here"  size=80 id='user_name'   >

<input type="text" name="city" value="your city goes here"  size=80  id='user_city'  >

<input type="submit" name="bttn" value="Go" onClick="insertToDB( );" >

A:
running on a mobile phone

Well I don't know if my script above will do in a mobile phone, it needs Javascript enabled!


text:
Q: linq to sql connection i used following expression in my linq to sql connection.
       int before = db.Employees.Count();

        var after = (from c in db.Employees
                     where c.emp_city == "pune"
                     select c).Count;

        Console.WriteLine("# of Customers= {0}, In pune= {1}", before, after);

        Console.ReadLine();

it give this error:
Error   1   Cannot assign method group to an implicitly-typed local variable
how to resolve it?

A: you forgot to actually call the Count method, add parentheses:
 var after = (from c in db.Employees
                 where c.emp_city == "pune"
                 select c).Count();


text:
Q: Cannot remove merged dictionaries from code I have these dictionaries:
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="Resources/Languages/English.xaml"/>
            <ResourceDictionary Source="Resources/Themes/All.xaml"/>
            <ResourceDictionary Source="Resources/Themes/Green.xaml"/>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

I want to remove the dictionaries in C#. Tried these but failed:
this.Resources.MergedDictionaries.Clear();
this.Resources.MergedDictionaries.Remove(this.Resources.MergedDictionaries[0]);

I get this error when I use .Clear() method.

A: I was able to clear the merged dictionary using this line:
this.Resources.MergedDictionaries[0].Clear();

I then added the wanted dictionary with this line:
this.Resources.MergedDictionaries.Add(languageResourceDictionary);


text:
Q: Can I include the page number when using \includepdf? I'm doing a thesis and I need to include another document I created into the document.
I tried using
\includepdf[pages=-]{usermanual.pdf}
And that works well, except that it shows only the usermanual.pdf page numberings, and what I need is to shrink each page and show both that page numbering and continue the numbers of the main document.
Is there a way to make \includepdf shrink the pages?
edit: OK, I have figured out how to scale it (by adding the scale= option) - but the page numbering is still gone. How do I get it back?

A: Yes, that is quite easy, you don't even have to shrink the page, just add the option pagecommand={} to \includepdf
e.g.:
\includepdf[pages=-,pagecommand={\thispagestyle{plain}}]{GameTheoryTutorial10.pdf}


text:
Q: JSON Definitions Using Internally Defined Variables I am trying to create a JSON object to store some parameters for a program.  Some of the parameters need to be calculated from others as they are being defined.  I would like to do this within the object definition but maybe this is not possible
var params = {
        a: 50,
        b: 70,
        c: this.a+this.b
    }

Result
What happens
>params.c
NaN
What I wished happened
>params.c
120
Edit
After doing some further reading, I think I am using Object Literal Notation instead of JSON.

A: You can use this approach:
To avoid re-calculation, use the function Object.assign.

The get syntax binds an object property to a function that will be called when that property is looked up.

var params = {
  a: 50,
  b: 70,
  get c() {
    console.log('Called!');
    return this.a + this.b;
  }
};

console.log(params.c); // Prints 120 then Called!
console.log(params.c); // Prints 120 then Called!

var params = Object.assign({}, {
  a: 50,
  b: 70,
  get c() {
    console.log('Called from function Object.assign!');
    return this.a + this.b;
  }
});

params.a = 1000; // To illustrate.

console.log(params.c); // Prints 120
console.log(params.c); // Prints 120
.as-console-wrapper {
  max-height: 100% !important
}

Resources

*

*Object initializer

*getter

A: Personally, I would create constants (since magic numbers are the devil), but this is an overly-simplistic example:
const FIFTY = 50;
const SEVENTY = 70;
var params = {
  a: FIFTY,
  b: SEVENTY,
  c: FIFTY + SEVENTY
};

A: What I would recommend doing is starting with an object that does not contain c, and taking the calculation outside of the object. Once the calculation has occurred, simply add the sum back to the object as a new key/value pair:

var params = {
  a: 50,
  b: 70,
}

var sum = 0;

for (var el in params) {
  if (params.hasOwnProperty(el)) {
    sum += params[el];
  }
}

params['c'] = sum;
console.log(params);


text:
Q: Using a generic with an unspecified type parameter as a value in a Dictionary I'm writing a method that returns a different instance of a class based on the type passed in, for a load process.
The method I'm trying to write will be used like:
Loader<MyType> loader = context.GetLoader<MyType>();
loader.Load(myTypeArray);

Internally, I'm planning on keeping a Dictionary<Type, T> with the loader as the value.  However, I'm not sure what type T should be.
I could make T object, but I'd prefer to keep it as some sort of Loader<>.  I know I'll need to cast it either way, but using Loader<> would give a little more type safety.
Is there any good way to implement this?

A: You have two choices. Both require you to add an interface.

*

*Add a plain ILoader (with no type arguments) interface, and implement it in your loader as class Loader<T> : ILoader. The common interface will allow you to store all loaders in a List<ILoader>.
interface ILoader {}

class Loader<T> : ILoader {}

void Example()
{
    var loaders = new List<ILoader>();
    loaders.Add( new Loader<Foo>() );
    loaders.Add( new Loader<Bar>() );
}

*Define a new covariant interface ILoader<out T> and implement it in your Loader as class Loader<T> : ILoader<T>. The covariance will allow you to store all loaders in a List<ILoader<object>>. This option only works if T is a reference type, and is only viable if none of your interface methods accept T as an argument.
interface ILoader<out T>
{
    //void SetLoader(T input);         //Does not compile due to covariance
    T GetLoader();                     //Read is allowed
}

class Loader<T> : ILoader<T>
{
    public void SetLoader(T input) {}  //Works when not in interface
    public T GetLoader() { return default(T); }
}

void Example()
{
    var loaders = new List<ILoader<object>>();
    loaders.Add( new Loader<Foo>() );
    loaders.Add( new Loader<Bar>() );
}

Code sample on DotNetFiddle

A:
I could make T object, but I'd prefer to keep it as some sort of Loader<>. I know I'll need to cast it either way, but using Loader<> would give a little more type safety.

No it will not; this sentence contradicts itself! You say both "I know I'll need to cast" so there is already zero compile-time type safety, and that you can get more type safety, but zero is not more than zero!
Remember the function of a representation-preserving cast is precisely "I know a fact that will be true at runtime that the compiler does not know at compile time".  That's the purpose of a cast.
There is no way to represent in the C# type system "this is a thing of type C<?>", so don't try to find one.  You've already embraced run-time type checking, so go for it.  You have an invariant that your dict[typeof(T)] produces something of type Loader<T>; the only person that can maintain that invariant is you, so don't even try to rely on the compiler to do it for you.


text:
Q: How to render custom field with to_xml? I am working on a custom accessor method like an example below:
class Forest < ActiveRecord : Base
  has_many :trees

  def total_water_usage
    # summarize each tree's water_usage in this forest.
    # return as string
  end

end

class Tree < ActiveRecord : Base
  belongs_to :forest

end

That is, I need your help for 2 questions:

*

*How can I access each tree just for an instance of Forest class. (Like example below, the total water usage shouldn't summarize another forest's tree)
asiaForest = Forest.find_by_name( 'asia' )
asiaForest.total_water_usage

*How can I force this method to be rendered by to_xml method? for example, I think the result should be similar to this:
asiaForest.to_xml
<asiaForest>
   ...
   <total_water_usage>239000</total_water_usage>
   ...
</asiaForest>

Could you help me to do this?

A: records.to_xml(:methods => :total_water_usage)

A: To implement on a global model scale you could add this to your model file.
 alias_method :ar_to_xml, :to_xml

  def time_zone_offset
       get_my_time_zone_offset_or_something
  end

  def to_xml(options = {}, &block)
    default_options = { :methods => [ :time_zone_offset ]}
    self.ar_to_xml(options.merge(default_options), &block)
  end

A: The answers are as follows:
class Forest < ActiveRecord::Base
  has_many :trees

  def total_water_usage
    trees.sum(:water_usage)
  end

  def to_xml
    attributes["total_water_usage"] = total_water_usage
    attributes.to_xml({:root => self.class.element_name})
  end
end

class Tree < ActiveRecord::Base
  belongs_to :forest

  def water_usage
    # place your water usage calculation for a tree here
  end
end

Explanation:
Part 1 of the question is answered in total_water_usage which will call water_usage in each trees and sum it.
Part 2 we have to override the to_xml method to include the total_water_usage key.  Taken from the original to_xml method.


text:
Q: Strange behaviour with outline-offset and Chrome Testing the CSS property outline-offset, I noticed that Chrome only seems to insert spacing to the left and top of the element (Firefox, Opera and Safari (Windows) all place spacing on all edges, while IE9 doesn't support the property). Does anyone have an idea why this is so?
jsFiddle: http://jsfiddle.net/hydrurga/WChhS/
The html at jsFiddle above is:

First paragraph

Here is the first span and the
second span of the paragraph

Another paragraph

with style:
p {background-color:blue; color:red; line-height: 3em}
span.first {outline: 5px solid red}
span.second {outline: 5px solid red; outline-offset: 5px}


text:
Q: pass a method as a parameter in Java 8? I have the method send below, the method pass a method eventService.send(request) as parameter.
I don't like it to be written as is, since the  eventService.send(request) is the main functionality in the code.
I am wondering is there an inelegant way to pass the method as parameter or the other option is to extract it to an object :
One option :
     public Response send(EventServiceRequest request){
       ResponseEntity<ServiceResponse> responseEntity;

       responseEntity = handleResponse(eventService.send(request),request);
     return Response.status(responseEntity.getStatusCode().value()).entity(responseEntity.getBody()).build();
     }

Second option :
     public Response send(EventServiceRequest request){
       ResponseEntity<ServiceResponse> responseEntity;
       EventServiceResponse resp = eventService.send(request);
       responseEntity = handleResponse(resp,request);
     return Response.status(responseEntity.getStatusCode().value()).entity(responseEntity.getBody()).build();
     }

     private ResponseEntity<EventServiceResponse> handleResponse(EventServiceResponse response, EventServiceRequest request) {
        return handleResponse(response, request, null, null);
    }

A: You can only use lambda's to pass logic to methods if they expect a functional interface. A functional interface in this case is an interface with a single abstract method (SAM).
Out of the box, java 8 offers a few of these interfaces, like Function<T, R>. This is a method that converts something of type T into something of type R.
As an example, it can be defined as follows:
    public void printFunctionResult(Function<String, String> function)
    {
        System.out.println(function.apply("input"));
    }

And then used in this way:
    printFunctionResult(string -> "passed: " + string);

In this case, it would print passed: input


text:
Q: What is the best way to divide a collection into 2 different collections? I have a Set of numbers :
 Set<Integer> mySet = [ 1,2,3,4,5,6,7,8,9]

I want to divide it into 2 sets of odds and evens.
My way was to use filter twice :
Set<Integer> set1 = mySet.stream().filter(y -> y % 2 == 0).collect(Collectors.toSet())
Set<Integer> set2 =mySet.stream().filter(y -> y % 2 != 0).collect(Collectors.toSet())

I don't like this solution because I go over the whole set twice.
Is there any smarter way to do it?

A: Map<Boolean, List<Integer>> partitioned =
    set.stream().collect(Collectors.partitioningBy(x -> x%2 == 0));

The elements in partitioned.get(true) are even; the elements in partitioned.get(false) are odd.
Unlike doing this using groupingBy, it is guaranteed that both true and false lists will be present in the map even if they are empty. (Not documented in Java 8, but it was true; Java 9's doc now states it explicitly).

A: Simple loop and if/else would be a clean and simple solution
Set<Integer> setEven = new HashSet<>();
Set<Integer> setOdd = new HashSet<>();

for (Integer val : mySet) {
    if (val % 2 == 0)
        setEven.add(val);
    else
        setOdd.add(val);
}

Or using a ternary operator works well to simplify the code even more
for(Integer val : mySet) {
    ((val % 2 == 0) ? setEven : setOdd).add(val);
}

A: You can use Collectors#partitioningBy like below.
Map<Boolean,List<Integer>> evenOddMap  = mySet.stream().collect(Collectors.partitioningBy(e -> e % 2 == 0));
System.out.println("Even : "+evenOddMap.get(true));
System.out.println("Odd : "+evenOddMap.get(false));

A: You can use Collectors.partitioningBy:
        Map< Boolean, Set<Integer> > map =
        mySet.stream().collect( Collectors.partitioningBy( y -> y % 2 == 0,
        Collectors.toSet() ) );

        Set<Integer> odds = map.get(Boolean.TRUE);
        Set<Integer> evens = map.get(Boolean.FALSE);

EDIT:
I see there are a couple of similar answers. The slight difference here is that it shows how to get the collections as Set instead of List in case OP wanted it that way.

A: Provided you already have collections to hold values, the below can be a solution.
data.stream().forEach(x -> {
if(x%2==0){
//add to collection holding even nums
} else {
//add to collection holding odd nums
}
})

A: You can use a groupingBy
public void test(String[] args) {
    Integer[] test = {1,2,3,4,5,6,7,8,9};
    Map<Integer, List<Integer>> evenOdd = Arrays.stream(test).collect(Collectors.groupingBy(i -> i & 1));
    Set<Integer> evens = new HashSet<>(evenOdd.get(0));
    Set<Integer> odds = new HashSet<>(evenOdd.get(1));
    System.out.println("Evens "+evens+" Odds "+odds);
}


text:
Q: How to get the selected payment method when the "sales_order_save_after" event is fired? I'm developing an observable that listen to the sales_order_save_after event.
I have the order information executing $observer->getEvent()->getOrder() but i cannot get the payment method selected (cash on delivery or check/money order, etc).
I did try with $order->getPayment()->getMethod() but this works only when the order already has been payed. (And I need to know what payment method was selected when the order was placed).
Thanx in advance

A: Please use below code in your Observer to get payment method data
Method 1
$payment = $order->getPayment();
$method = $payment->getMethodInstance();
$methodTitle = $method->getTitle();
//print_r($method->getData());

Method 2
$order->getPayment()->getAdditionalInformation("method_title")

A: You can try below to get the payment method from the order.
$payment = $order->getPayment();
$method = $payment->getMethodInstance();
$methodTitle = $method->getTitle();


text:
Q: FontMetrics.getStringBounds for AttributedString gives wrong result? As shown in the following picture, an AttributedString is drawn on a JPanel (500X500).
The FontMetrics.getStringBounds() of that AttributedString gives a width of 164.0, as indicated by the trace output.
java.awt.geom.Rectangle2D$Float[x=0.0,y=-12.064453,w=164.0,h=15.09375]

However, the picture suggests the width should be 300-400 (because the width of the panel is 500).
Could you help to comment the reason and the workaround ?

MyJFrame.java
import javax.swing.*;
import java.awt.*;
import java.awt.font.TextAttribute;
import java.text.AttributedString;

class MyJPanel extends JPanel {
    MyJPanel() {
        setPreferredSize(new Dimension(500,500));
    }

    @Override
    public void paintComponent(Graphics gold) {
        super.paintComponent(gold);
        Graphics2D g = (Graphics2D)gold;
        //
        AttributedString text = new AttributedString("Bunny rabits and flying ponies");
        text.addAttribute(TextAttribute.FONT, new Font("Arial", Font.BOLD, 24), 0, "Bunny rabits".length());
        text.addAttribute(TextAttribute.FOREGROUND, Color.RED, 0, "Bunny rabits".length());

        text.addAttribute(TextAttribute.FONT, new Font("Arial", Font.BOLD & Font.ITALIC, 32), 17, 17 + "flying ponies".length());
        text.addAttribute(TextAttribute.FOREGROUND, Color.BLUE, 17, 17 + "flying ponies".length());

        FontMetrics fm = g.getFontMetrics();

        System.out.println(fm.getStringBounds(text.getIterator(), 0, text.getIterator().getEndIndex(), g));
        g.drawString(text.getIterator(), 50, 50);
        //
        g.dispose();
    }
}

public class MyJFrame extends JFrame {

    public static void main(String[] args) {
        MyJFrame frame = new MyJFrame();
        frame.setContentPane(new MyJPanel());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setVisible(true);
    }
}

A: FontMetrics fontMetrics = graphics.getFontMetrics() returns a FontMetrics object based on the single font currently set on the graphics object. You are not changing the font used by graphics explicitly so it uses the default font designated for JPanel by the current L&F.
FontMetrics methods related to bounds calculation accept a "simple" CharacterIterator (which does not provide font information) instead of AttributedCharacterIterator (which does). Hence fontMetrics.getStringBounds() simply calculates the text bounds based on the single font of the same size.
You need to use java.awt.font.TextLayout to determine the proper bounds when using AttributedCharacterIterator with different fonts and font sizes:
TextLayout textLayout = new TextLayout(
        text.getIterator(),
        g.getFontRenderContext()
);
Rectangle2D.Float textBounds = ( Rectangle2D.Float ) textLayout.getBounds();

g.drawString( text.getIterator(), 50, 50 );
// lets draw a bounding rect exactly around our text
// to be sure we calculated it properly
g.draw( new Rectangle2D.Float(
        50 + textBounds.x, 50 + textBounds.y,
        textBounds.width, textBounds.height
) );

A: The FontMetrics only receives a CharacterIterator, and does not take into account that it is actually an AttributedCharacterIterator. You can use a TextMeasurer to compute the actual bounds of your string. For comparison, add this after you called the drawString method:
    // Compensate for the 50,50 of the drawString position
    g.translate(50, 50);

    g.setColor(Color.RED);
    Rectangle2D wrongBounds = fm.getStringBounds(
            text.getIterator(), 0, text.getIterator().getEndIndex(), g);
    g.draw(wrongBounds);
    System.out.println("wrong: "+wrongBounds);

    g.setColor(Color.BLUE);
    AttributedCharacterIterator iterator = text.getIterator();
    TextMeasurer tm = new TextMeasurer(iterator, g.getFontRenderContext());
    Rectangle2D rightBounds = tm.getLayout(0, iterator.getEndIndex()).getBounds();
    g.draw(rightBounds);
    System.out.println("right: "+rightBounds);

(And BTW: Don't call g.dispose() on the Graphics that was handed to you in the paintComponent method)


text:
Q: Stuck in Hades in Zork I was really far in the game and went to the cellar to then being eaten by something (I forgot) and got transported to Hades.
I read a thing saying to go to an altar and pray but I don't know where it is. You start off with being in front of a bell which you can't pick up (your hand goes through it). The only way you can go is South (or East) and get to the candles, matchbook and black book. You can't read the book, light candles or light a match. You can only go back to where you started, AKA going North. What do I do? I'd rather not start over.

A: The route from the Entrance to Hades to the altar is:

*

*Up to the first cave

*North three times to the Round Room

*Southeast to the Engravings Cave

*East to the dome, where you automatically float down to the Torch Room.

*Down to the temple.

*South to the altar. You can then pray there to come back to life.

Also note that it's generally advisable in Interactive Fiction games like Zork to save frequently, so you can just restore when you die rather that worrying about the extra life mechanics.

A: Okay so I was able to find the Altar. When I prayed, I resurrected to a forest.
I couldnt interact with the book, candle, nor bell though when I was dead. I'm just winging it now.


text:
Q: Quartz: How to remove a set of jobs when another job is started? Is there a mechanism in Quartz to remove existing jobs when another job is started?  The reason I need to pause other jobs is because the new job requires all the resources to be available which is only true when other jobs aren't running.
Here is an example:
I have 2 Jobs: Job A and Job B
Job A runs through the day.
Job B is executed once every 24 hours.
Is there a way to remove or pause Job A while Job B is running.

A: If your jobs implement InterruptableJob, then you can interrupt Job A from Job B by calling interrupt(jobKey) on the Quartz scheduler.
Javadocs:
http://www.quartz-scheduler.org/api/2.2.1/index.html
http://www.quartz-scheduler.org/api/2.2.1/org/quartz/Scheduler.html#interrupt(org.quartz.JobKey)
Example:
https://github.com/elventear/quartz-scheduler/blob/master/distribution/examples/src/main/java/org/quartz/examples/example7/InterruptExample.java


text:
Q: Connect to an irc server with password I'm writing script in remote.ini The script looks like
on 1:start:{
    server some.irc.server
    server -m another.irc.server
}

The script works well as when I open mIRC, it automatically connect to 2 servers above
Now, I want to connect to an irc server that require password, say abcdef
How can I write script in remote.ini to connect to this server?

A: The syntax for /server in mIRC is:
/server [-emnsarpfoc] <server/groupname> [port] [password] [-i nick anick email name] [-jn #channel pass]

So, try:
on 1:start:{
    server some.irc.server
    server -m another.irc.server
    server -m third.irc.server 6667 abcdef
}


text:
Q: HTML and CSS3 menu questions Thank you for reading my question.
I still have a lot to learn regarding HTML and CSS, yet I'm trying. However, this brought me to a problem (I searched around a bit, but couldn't find a good answer):
I want to make a menu on the top of my page, as header. However, in the middle of this menu there is an image, as logo.
Failing to get them next to each other correctly, I used them in a list

MENU ITEM 1

MENU ITEM 2

MENU ITEM 3

MENU ITEM 4

Here I'm stuck:
 - I want the 'MENU ITEM 1-4' to be almost at the middle(height) of the image. However the image has to stay were it is(so be at the very center, just at the bottom). If possible being able to change its position too if needed.
 - I want the 'MENU ITEM 1-4' to be underlined by a 2px high,colored line, not sure how to do that.
It'll have to look something like this:
empty space                   THE IMAGE
MENU ITEM 1    MENU ITEM 2    THE IMAGE    MENU ITEM 3    MENU ITEM 4
empty space                   THE IMAGE

A: I'm not sure whether I understood the question. But to my answer would be:

MENU ITEM 1

MENU ITEM 2

MENU ITEM 3

MENU ITEM 4

And style it like so:
    ul li{
            margin-right:20px;
            line-height:200px;
            float:left;
    }
    ul li img{
            height:200px;
            width:auto;
   }
   ul li a {
            text-decoration:none;
            border-bottom:2px solid red;
   }

You need to put line height equal to the image height and then vertically align it. To underline text with a color you chose you will need to add border-bottom.
Here you can see jsFiddle


text:
Q: How to make a bot delete its own message after 5 seconds I can't get the bot to delete its own message.
I have tried await ctx.message.delete() and ctx.message.delete(embed)
@bot.command()
async def help(ctx):
    embed=discord.Embed(title="List of commands.", description="", colour=discord.Color.orange(), url="")
    await ctx.send(embed=embed)
    await ctx.message.delete()
    await asyncio.sleep(5)
    await message.delete()

I'm wanting the bot to delete the command then send an embed: "A list of commands has been sent to your DM's" then wait 5 secs and delete the embed

A: ctx.message.delete() deletes the message from the user.
But to delete the bot's message you need the bot's message object
from the return of ctx.send() :

bot.remove_command('help') # Removes default help command

@bot.command()
async def help(ctx):
    embed=discord.Embed(title="List of commands.", description="", colour=discord.Color.orange())
    msg = await ctx.send(embed=embed) # Get bot's message

    await ctx.message.delete() # Delete user's message
    await asyncio.sleep(5)

    await msg.delete() # Delete bot's message

EDIT:
You can use parameter delete_after=(float)
await ctx.send(embed=embed, delete_after=5.0)


text:
Q: Get value from c# anonymous Type using HierarchyId I am trying to use SqlHierarchyId in .net
In my controller I am using anonymous type to get value from database.
[HttpGet("{id}")]
public async Task<ActionResult<object>> GetDomain(int id)
{
    object domain = from x in _context.Domains.Where(x => x.DomainId == id)
                 select new
                 {
                     Id = x.DomainId,
                     Name = x.DomainName,
                     Type = x.DomainTypeId,
                     Parent = x.Parentt,
                     Path = x.Level.ToString()
                 };
    return domain;
}

Then I want to get the Path to convert to an SqlHierarchyId in order to apply different methods supported by .Net
I've try Reflection:
System.Type type = domain.GetType();
string strNode = (string) type.GetProperty("Path").GetValue(domain, null);

I have this error:

System.NullReferenceException: Object reference not set to an instance
  of an object.

When I debuged my code I found that strNode is null, but the domain contain all value I need when I test with Postman.
I try Dynamic:
dynamic dyn= domain;
string strNode= dyn.Path;

And I have this error:

Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable<<>f__AnonymousType1>'
  does not contain a definition for 'Path

I also try several others propositions (Clone, define the anonymous type as a class...) found on similar question but no result.
Note:
I am trying to use anonymous type because I can't get the value when direclty use my model. I have a casting error like.

Unable to cast object of type 'Microsoft.SqlServer.Types.SqlHierarchyId' to type 'Microsoft.Data.SqlClient.Server.IBinarySerialize'.

But with anonymous I am able to get the values so I want to access those value and pass it to my model now.

A: Your problem is that domain is actually an IEnumerable of an anonymous object. The select statement generates the IEnumerable even if there's only one instance.
If you want to get the actual object then you can grab it like this.
var obj = domain.FirstOrDefault();

or
var obj = domain.Single();

And then do your reflection lookup:
var type = obj.GetType();
var strNode = (string) type.GetProperty("Path").GetValue(obj, null);

A: The main issue or assumption is with the return value from GetDomain Action.
Linq Where returns collection (of type on which you are applying this filter), and hence in this case domain will hold anonymous IQueryable as opposed to single domain.
If you want to return single domain, then please use FirstOrDefault as shown below:
[HttpGet("{id}")]
public async Task<ActionResult<object>> GetDomain(int id)
{
    object domain = (from x in _context.Domains.Where(x => x.DomainId == id)
                 select new
                 {
                     Id = x.DomainId,
                     Name = x.DomainName,
                     Type = x.DomainTypeId,
                     Parent = x.Parentt,
                     Path = x.Level.ToString()
                 }).FirstOrDefault();
    /*
    // Or use FirstOrDefault in place of Where as shown below
     object domain = (from x in _context.Domains
                 select new
                 {
                     Id = x.DomainId,
                     Name = x.DomainName,
                     Type = x.DomainTypeId,
                     Parent = x.Parentt,
                     Path = x.Level.ToString()
                 }).FirstOrDefault(x => x.Id == id);
    */
    return domain;
}

After this change, your rest of code should work as expected.


text:
Q: Crear tabla estática con header fijo Estoy intentando crear una tabla estática y con un header fijo con Html y Css. La idea sería que la tabla (que está dentro de un modal) esté fija para que el modal no sea extenso, sino que se pueda scrollear la tabla sin necesidad de scrollear el modal. Probé con scripts de Jquery como GridViewScroll y con estilos independientes pero no pude llegar a nada bien hecho y estético visualmente. Dejo por acá mi código... Cualquier ayuda es agradecida! Estoy utilizando a su vez Django, por las dudas...
Aclaración: No hay código css de la tabla "tabla_articulos_pedidos" que es a la que le quiero crear el header fijo, por eso no lo posteo, y en el HTML hay restos de las pruebas con GridViewScroll...
Html:
{% extends 'BASE.html' %}

{% load cart_tags %}

{% load static %}

{% block title %}
Crear pedido
{% endblock %}

{% block content %}

Nuevo pedido

Cliente:

        <select class="objetos_inline">
            <option value="">Seleccione un cliente...</option>
            {% for cliente in clientes %}
                <option class="opcion">{{cliente.nombre}}</option>
            {% endfor %}
        </select>

Pedido N°: {{numero_pedido}}

                <button type="button" class="btn botones_pedidos" data-toggle="modal" data-target="#modal_articulos">

                    Agregar artículo
                </button>

                <button type="button" class="btn botones_pedidos">

                    Eliminar artículo
                </button>

                                    Código
                                    Descripción
                                    P.Venta

                                        None
                                        FIAT 600 MODELO 1968
                                        20.000,0

                                        None
                                        FORD RANGER MODELO 1975
                                        30.000,0

                                        B-005-23656-2
                                        BOMBA DE ACEITE CENTRÍFUGA
                                        20,0

                                        HIE-012
                                        HIERRO DEL 12
                                        1,0

                                        HIE-014
                                        HIERRO DEL 14
                                        250,0

                                        None
                                        NAFTA PREMIUM
                                        0,0

                                        None
                                        ESCRITORIO DE PC MELAMINA
                                        3.000,0

                                        CH-050
                                        CHECKEO GENERAL
                                        100,0

                                        None
                                        SILLA DE ESCRITORIO
                                        1.000,0

Agregar artículo

                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        ×
                    </button>

Articulos

                                Código
                                Descripción
                                P.Venta

                            {% for articulo in articulos %}

                                    {{articulo.codigo_de_barras}}
                                    {{articulo.descripcion_larga}}
                                    {{articulo.precio_venta}}

                            {% endfor %}

                    Cantidad: <input class="objeto_inline" id="cantidad_articulo" type="text" placeholder="Ingrese la cantidad...">

                    <button type="button" class="btn btn-secondary" data-dismiss="modal">

                        Cerrar
                    </button>
                    <button form="form_ver_pedido" type="submit" class="btn btn-info" id="boton_ver_pedido">

                        Agregar artículo
                    </button>

{% endblock %}

Este es el css de la tabla: (editado)
    #tabla_articulos_pedidos{
  position: relative;
}

#tabla_articulos_pedidos tbody{
  height: 300px;
  overflow-y: scroll;
}

#tabla_articulos_pedidos tbody{
  display: block;
}

A: Como ponía en los comentarios, se pueden poner las cabeceras fijas sólo con HTML y CSS, aunque es una solución un poco hacky.
La idea es hacer que las celdas de la cabecera tengan position: sticky (no funciona con todo el thead o la fila del thead, debe hacerse en las celdas directamente, por eso digo que es un poco hacky).
thead th {
  position: sticky;   /* queremos que las celdas estén fijas    */
  top: 0;             /* en lo más alto de la tabla/página.     */
  background: white;  /* esto debería ser el fondo de la celda  */
  z-index: 1;         /* debe quedar encima de las otras celdas */
}

Aquí puedes ver un ejemplo:

.contenedor-tabla {
  max-height: 300px;
  overflow: auto;
  border: 1px solid;
  display: inline-block;
}

table {
  position: relative;
}

thead th {
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
  border-bottom: 2px solid;
}

th,
td {
  padding: 1rem;
}

        Código
        Descripción
        Cantidad
        Precio Unitario
        Total

        1
        Número 1
        1
        $1
        $1

        2
        Número 2
        2
        $2
        $4

        3
        Número 3
        3
        $3
        $9

        4
        Número 4
        4
        $4
        $16

        5
        Número 5
        5
        $5
        $25

        6
        Número 6
        6
        $6
        $36

        7
        Número 7
        7
        $7
        $49

        8
        Número 8
        8
        $8
        $64

        9
        Número 9
        9
        $9
        $81

A: No se bien que versión de bootstrap usas en este caso esto lo implemente con la versión 4.0
lo que yo haría en tu caso solo seria modificar desde el código añadiéndole los valores que deseo, acá te dejo el código y te explico lo que hice.

Modal title

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          ×
        </button>

            #
            First
            Last
            Handle

                1
                Mark
                Otto
                @mdo

                2
                Jacob
                Thornton
                @fat

                3
                Larry
                the Bird
                @twitter

                1
                Mark
                Otto
                @mdo

                2
                Jacob
                Thornton
                @fat

                3
                Larry
                the Bird
                @twitter

                1
                Mark
                Otto
                @mdo

                2
                Jacob
                Thornton
                @fat

                3
                Larry
                the Bird
                @twitter

                1
                Mark
                Otto
                @mdo

                2
                Jacob
                Thornton
                @fat

                3
                Larry
                the Bird
                @twitter

                1
                Mark
                Otto
                @mdo

                2
                Jacob
                Thornton
                @fat

                3
                Larry
                the Bird
                @twitter

                1
                Mark
                Otto
                @mdo

                2
                Jacob
                Thornton
                @fat

                3
                Larry
                the Bird
                @twitter

                1
                Mark
                Otto
                @mdo

                2
                Jacob
                Thornton
                @fat

                3
                Larry
                the Bird
                @twitter

                1
                Mark
                Otto
                @mdo

                2
                Jacob
                Thornton
                @fat

                3
                Larry
                the Bird
                @twitter

                1
                Mark
                Otto
                @mdo

                2
                Jacob
                Thornton
                @fat

                3
                Larry
                the Bird
                @twitter

                1
                Mark
                Otto
                @mdo

                2
                Jacob
                Thornton
                @fat

                3
                Larry
                the Bird
                @twitter

                1
                Mark
                Otto
                @mdo

                2
                Jacob
                Thornton
                @fat

                3
                Larry
                the Bird
                @twitter

                1
                Mark
                Otto
                @mdo

                2
                Jacob
                Thornton
                @fat

                3
                Larry
                the Bird
                @twitter

        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>

Espero ayudarte con esto, cualquier cosa me comentas, Suerte.


text:
Q: HTML Email table displays weird border on certain screen sizes I am developing an HTML email and I am getting a weird issue; when viewing the email in chrome with responsive mode on there is a faint border on some of the cells.  I am not sure what is causing it, none of the cells have any border and it only shows when the screen size you have set in chrome is such that the email is full width.  I have tested the email using email on acid testing previews and the issue is showing on iPhone tests. Anyone know what's causing this and how to fix it?
The issue does not show in code pen, I am just using it to share the html:
https://codepen.io/jmona789/pen/ZELjrOv
Relevent portion of html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta content="telephone=no" name="format-detection">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="x-apple-disable-message-reformatting">
    <!--[if gte mso 9]><xml>
        <o:OfficeDocumentSettings>
            <o:AllowPNG/>
            <o:PixelsPerInch>96</o:PixelsPerInch>
        </o:OfficeDocumentSettings>
    </xml><![endif]-->
    <!--[if !mso]><!-- -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!--<![endif]-->
    <title>Test</title>
    <style type="text/css">
        /* Some resets and issue fixes */
        #outlook a {
            padding: 0;
        }

        body {
            width: 100% !important;
            -webkit-text;
            size-adjust: 100%;
            -ms-text-size-adjust: 100%;
            margin: 0;
            padding: 0;
        }

        .ReadMsgBody {
            width: 100%;
        }

        .ExternalClass {
            width: 100%;
        }

        .backgroundTable {
            margin: 0 auto;
            padding: 0;
            width: 100%;
             !important;
        }

        table td {
            border-collapse: collapse;
        }

        .ExternalClass * {
            line-height: 115%;
        }

        /* End reset */

        @import url(https://imcsecuresftp.s3.amazonaws.com/fonts/Arboria-Bold_1.otf);

        /*Calling our web font*/
        /*==============REGULAR NOTATION===================*/
        @media only screen and (max-width:480px) {
            .full-column {
                float: none !important;
                width: 100% !important;
                height: auto !important;
                display: table !important;
            }

            .center-on-mobile {
                text-align: center !important;
            }

            .column-td {
                padding: 0px 24px !important;
            }

            .column-td-right-only {
                padding: 0px 24px 0px 0px !important;
            }

            .column-td-left-only {
                padding: 0px 0px 0px 24px !important;
            }

            .mobile-line-br {
                line-height: 30px !important;
            }

            .hide {
                display: none !important;
            }

            .show {
                display: block !important;
            }

            table.full-width-table {
                height: px;
            }

            img.full-width {
                width: 100% !important;
                height: auto !important;
            }
        }

        /* Colors
                * #6caae3 = Dark Blue
                * #6caae3 = Light Blue
                * #f3f3f3 = Light Grey - Background
                * #333333 = Dark Grey - Body Copy
                * #555759 = Sub Header Grey
                * #ee3134 = Red
                --------------------------------------------- */

        @font-face {
            src: url("http://imc-secure.com/immunoCAP/Fonts/HelveticaNeueLTStd-MdCn.otf") format("truetype");
            font-family: "HelveticaNeueLTStd-MdCn";
            font-style: normal;
            font-weight: normal;
        }

        @font-face {
            src: url("https://s3.amazonaws.com/imcsecuresftp/fonts/HelveticaNeueLTStd-Md.otf") format("truetype");
            font-family: "HelveticaNeueLTStd-Md";
            font-style: normal;
            font-weight: normal;
        }

        @font-face {
            src: url("https://s3.amazonaws.com/imcsecuresftp/fonts/HelveticaNeueLTStd-Bd.otf") format("truetype");
            font-family: "HelveticaNeueLTStd-Bd";
            font-style: normal;
            font-weight: normal;
        }

        @font-face {
            src: url("https://s3.amazonaws.com/imcsecuresftp/fonts/HelveticaNeueLTStd-Hv.otf") format("truetype");
            font-family: "HelveticaNeueLTStd-Hv";
            font-style: normal;
            font-weight: normal;
        }

        @font-face {
            src: url("https://s3.amazonaws.com/imcsecuresftp/fonts/HelveticaNeueLTStd-Lt.otf") format("truetype");
            font-family: "HelveticaNeueLTStd-Lt";
            font-style: normal;
            font-weight: normal;
        }

        @font-face {
            src: url("https://s3.amazonaws.com/imcsecuresftp/fonts/HelveticaNeueLTStd-LtIt.otf") format("truetype");
            font-family: "HelveticaNeueLTStd-LtIt";
            font-style: normal;
            font-weight: normal;
        }

        @font-face {
            src: url("https://s3.amazonaws.com/imcsecuresftp/fonts/HelveticaNeueLTStd-It.otf") format("truetype");
            font-family: "HelveticaNeueLTStd-It";
            font-weight: normal;
        }

        @font-face {
            src: url("https://s3.amazonaws.com/imcsecuresftp/fonts/HelveticaNeueLTStd-Roman.otf") format("truetype");
            font-family: "HelveticaNeueLTStd-Roman";
            font-weight: normal;
        }

        @font-face {
            src: url("https://imcsecuresftp.s3.amazonaws.com/fonts/Arboria-Bold_1.otf") format("truetype");
            font-family: "Arboria-Bold";
            font-style: normal;
            font-weight: normal;
        }

        [style*="Arboria-Bold"] {
            font-family: 'Arboria-Bold', Helvetica-Bold, "Arial Black", Helvetica, Arial, sans-serif !important;
        }

        [style*="HelveticaNeueLTStd-Hv"] {
            font-family: 'HelveticaNeueLTStd-Hv', Helvetica, Arial, sans-serif !important;
        }

        [style*="HelveticaNeueLTStd-Md"] {
            font-family: 'HelveticaNeueLTStd-Md', Helvetica, Arial, sans-serif !important;
        }

        [style*="HelveticaNeueLTStd-Bd"] {
            font-family: 'HelveticaNeueLTStd-Bd', Helvetica, Arial, sans-serif !important;
            font-weight: normal;
        }

        [style*="HelveticaNeueLTStd-Roman"] {
            font-family: 'HelveticaNeueLTStd-Roman', Helvetica, Arial, sans-serif !important;
        }

        [style*="HelveticaNeueLTStd-Lt"] {
            font-family: 'HelveticaNeueLTStd-Lt', Helvetica, Arial, sans-serif !important;
        }

        [style*="HelveticaNeueLTStd-LtIt"] {
            //font-family: 'HelveticaNeueLTStd-LtIt', Helvetica, Arial, sans-serif !important;
            font-style: italic;

        }

        [style*="HelveticaNeueLTStd-It"] {
            //font-family: 'HelveticaNeueLTStd-It', Helvetica, Arial, sans-serif !important;
            font-style: italic;
        }

        /* Client-specific Styles */
        table {
            mso-table-lspace: 0pt;
            mso-table-rspace: 0pt;
        }

        #outlook a {
            padding: 0;
        }

        /* Force Outlook to provide a "view in browser" menu link. */
        body {
            width: 100% !important;
            -webkit-text-size-adjust: 100%;
            -ms-text-size-adjust: 100%;
            margin: 0;
            padding: 0;
        }

        /* Prevent Webkit and Windows Mobile platforms from changing default font sizes, while not breaking desktop design. */
        .ExternalClass {
            width: 100%;
        }

        /* Force Hotmail to display emails at full width */
        .ExternalClass,
        .ExternalClass p,
        .ExternalClass span,
        .ExternalClass font,
        .ExternalClass td,
        .ExternalClass div {
            line-height: 100%;
        }

        /* Force Hotmail to display normal line spacing.*/
        #backgroundTable {
            margin: 0;
            padding: 0;
            width: 100% !important;
            line-height: 100% !important;
        }

        img {
            outline: none;
            text-decoration: none;
            border: none;
            -ms-interpolation-mode: bicubic;
        }

        a img {
            border: none;
        }

        .image_fix {
            display: block;
        }

        a[x-apple-data-detectors] {
            color: inherit !important;
            text-decoration: none !important;
            font-size: inherit !important;
            font-family: inherit !important;
            font-weight: inherit !important;
            line-height: inherit !important;
        }

        table td {
            border-collapse: collapse;
        }

        table {
            border-collapse: collapse;
            border-spacing: 0;
            mso-table-lspace: 0pt;
            mso-table-rspace: 0pt;
        }

        /*STYLES*/
        table.full {
            width: 100%;
            clear: both;
        }

        .appleLinks a {
            color: #ffffff;
            text-decoration: none;
        }

        .appleLinksGray a {
            color: #a7a9ac;
            text-decoration: none;
        }

        /*IPHONE STYLES*/
        @media only screen and (max-width:480px) {
            table#DesktopOnly {
                width: 0px !important;
                display: none !important;
                height: 0px !important;
                mso-hide: all !important;
                max-height: 0 !important;
                overflow: hidden !important;
            }

            table#FooterDesktopOnly {
                width: 0px !important;
                display: none !important;
                height: 0px !important;
                width: 0px !important;
                display: none !important;
                height: 0px !important;
                mso-hide: all !important;
                max-height: 0 !important;
                overflow: hidden !important;
            }

            #image1 {
                width: 390px;
                height: 314px;
            }

            a[x-apple-data-detectors] {
                color: inherit !important;
                text-decoration: none !important;
                font-size: inherit !important;
                font-family: inherit !important;
                font-weight: inherit !important;
                line-height: inherit !important;
            }

            a[href^="tel"],
            a[href^="sms"] {
                text-decoration: none;
                color: #0a8cce;
                /* or whatever your want */
                pointer-events: none;
                cursor: default;
            }

            table.devicewidth {
                width: 390px !important;
                text-align: center !important;
            }

            /*tr.devicewidth {width: 390px!important;text-align:center!important;}*/
            /*td.devicewidth {width: 390px!important;text-align:center!important;}*/
            table.devicewidthinner {
                width: 360px !important;
                text-align: center !important;
            }

            table#footer {
                width: 360px !important;
            }

            table#HeaderTable {
                width: 360px !important;
            }

            img.colimg2 {
                width: 280px !important;
                height: 140px !important;
            }

            td#FooterTD {
                width: 255px !important;
            }

            br#MobileOnlyBR {
                display: block !important;
            }

            table#DesktopOnly {
                width: 0px !important;
                display: none !important;
                height: 0px !important;
            }

            tr#DesktopOnly {
                max-height: 0px !important;
                height: 0px !important;
                display: none !important;
                line-height: 0px !important;
                padding: 0px !important;
                margin: 0px !important;
                width: 0px !important;
            }

            td#DesktopOnly {
                max-height: 0px !important;
                height: 0px !important;
                display: none !important;
                line-height: 0px !important;
                padding: 0px !important;
                margin: 0px !important;
                width: 0px !important;
            }

            tr#MobileOnlyTR {
                overflow: visible !important;
                display: table-row !important;
                line-height: 100% !important;
                mso-hide: none !important;
                max-height: none !important;
            }

            td#MobileOnlyTD {
                overflow: visible !important;
                display: table-cell !important;
                line-height: 100% !important;
                mso-hide: none !important;
                max-height: none !important;
            }

            div#MobileOnlyDiv {
                overflow: visible !important;
                display: block !important;
                line-height: 100% !important;
                mso-hide: none !important;
                max-height: none !important;
            }

            table#MobileOnly {
                width: 390px !important;
                min-width: 390px !important;
                overflow: visible !important;
                float: none !important;
                display: table !important;
                line-height: 100% !important;
                max-height: none !important;
                position: relative !important;
                margin-left: auto !important;
                margin-right: auto !important;
            }

            table#MobileOnlyInnerTable {
                overflow: visible !important;
                float: none !important;
                display: table !important;
                line-height: 100% !important;
                max-height: none !important;
                position: relative !important;
                /*margin-left: auto!important;
                        margin-right: auto!important;*/
            }

            table#MobileOnlyTable {
                width: 100% !important;
                overflow: visible !important;
                float: left !important;
                display: table-cell !important;
                line-height: 100% !important;
                max-height: none !important;
                position: relative !important;
                margin-left: auto !important;
                margin-right: auto !important;
                float: left !important;
                display: table !important;
            }

            /* --------------- Responsive Footer Code Start --------------------------------- */
            table#HeaderTable {
                width: 360px !important;
            }

            td.MobileHeight20 {
                height: 20px !important;
            }

            td#FooterMobileText {
                font-family: Arial, Helvetica, sans-serif;
                font-size: 12px !important;
                line-height: 14px !important;
                text-align: left !important;
                color: #888888 !important;
                padding-bottom: 20px !important;
            }

            table#FooterDesktopOnly {
                width: 0px !important;
                display: none !important;
                height: 0px !important;
            }

            table#MobileOnlyFooter {
                width: 390px !important;
                min-width: 390px !important;
                overflow: visible !important;
                float: none !important;
                display: block !important;
                line-height: 100% !important;
                max-height: none !important;
                position: relative !important;
                margin-left: auto !important;
                margin-right: auto !important;
            }

            table#MobileOnlyFooter2 {
                width: 390px !important;
                min-width: 390px !important;
                overflow: visible !important;
                float: none !important;
                display: block !important;
                line-height: 100% !important;
                max-height: none !important;
                position: relative !important;
                margin-left: auto !important;
                margin-right: auto !important;
            }

            div#FooterSocialImages {
                width: 100% !important;
                min-width: 390px !important;
                overflow: visible !important;
                float: none !important;
                display: block !important;
                line-height: 100% !important;
                max-height: none !important;
                height: 100% !important;
                min-height: 100% !important;
                text-align: center !important;
            }

            div#FooterSocialImages2 {
                width: 100% !important;
                min-width: 390px !important;
                overflow: visible !important;
                float: none !important;
                display: block !important;
                line-height: 100% !important;
                max-height: none !important;
                height: 100% !important;
                min-height: 100% !important;
                text-align: center !important;
            }

            table#FooterSocialImagesTable {
                width: 100% !important;
                min-width: 390px !important;
                overflow: visible !important;
                float: none !important;
                display: block !important;
                line-height: 100% !important;
                max-height: none !important;
                height: 100% !important;
                min-height: 100% !important;
                text-align: center !important;
            }

            img#FooterLogoMobile {
                width: 180px !important;
                position: relative !important;
                margin-top: 13px !important;
                margin-left: 105px !important;
                margin-bottom: 13px !important;
                margin-right: 105px !important;
            }

            /* --------------- Responsive Footer Code End --------------------------------- */
        }

        table.em_show,
        tr.em_show,
        td.em_show,
        br.em_show,
        span.em_show {
            display: none;
            overflow: hidden;
            line-height: 0px;
            mso-hide: all;
            max-height: 0px;
            mso-line-height-rule: exactly;
        }

        @media only screen and (max-width:480px) {
            td.em_show_nonText {
                overflow: visible !important;
                display: table-cell !important;
                mso-hide: none !important;
                max-height: none !important;
                mso-line-height-rule: exactly;
            }

            table.em_show,
            tr.em_show,
            td.em_show,
            br.em_show {
                overflow: visible !important;
                display: table-cell !important;
                line-height: 100% !important;
                mso-hide: none !important;
                max-height: none !important;
                mso-line-height-rule: exactly;
            }

            span.em_show {
                overflow: visible !important;
                display: inline !important;
                line-height: 100% !important;
                mso-hide: none !important;
                max-height: none !important;
                mso-line-height-rule: exactly;
            }

            td.em_align_center {
                text-align: center !important;
            }

            td.em_align_right {
                text-align: center !important;
            }

            table.em_hide,
            tr.em_hide,
            td.em_hide,
            br.em_hide,
            span.em_hide {
                display: none !important;
                overflow: hidden;
                line-height: 0px;
                mso-hide: all;
                max-height: 0px;
                font-size: 0px;
                mso-line-height-rule: exactly;
            }
        }

        /*==============END REGULAR NOTATION===================*/
        /*prevent superscripts from pushing line above them*/
        sup {
            line-height: 0;
            /*vertical-align: baseline;*/
            /*position: relative;*/
            /*top: -0.4em;*/
        }

        sub {
            line-height: 0;
        }

        /*  @media only screen and (min-width:480px) and (max-width:650px) {
                    table[class=em_wrapper] {
                        width: 100% !important;
                    }
                }*/
        @media only screen and (max-width:480px) {
            table[class=em_wrapper] {
                width: 100% !important;
            }
        }

        @media only screen and (max-width:480px) {
            table.em_wrapper {
                width: 100% !important;
            }
        }

        @media only screen and (min-width:1px) {

            /*gmail doesnt support media queries so this table will only show on gmail*/
            .gmail-app-fix,
            table.gmail-app-fix {
                display: none !important;
                overflow: hidden;
                line-height: 0px;
                mso-hide: all;
                max-height: 0px;
                font-size: 0px;
            }
        }
    </style>

</head>

<body style="margin:0;">
    <div style="display:none;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;margin-right:100%;">
        Explore allergy diagnostic resources
    </div>
<span style="display:none !important;visibility:hidden;mso-hide:all;font-size:1px;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;">
<!--EOA COMMENT: This snippet of white space has been added to ensure short preview text does not run into the following text of your email.-->
                                                            </span>
    <div style="display:none;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;margin-right:100%;">
    </div>

    <center>

        <table style="width:600px; margin:auto;" cellpadding="0" cellspacing="0" border="0" class="devicewidth" width="600" role="presentation">

            <tr>
                <td>
                    <table style="width:600px; margin:auto;" cellpadding="0" cellspacing="0" border="0" class="devicewidth" width="600" role="presentation">
                        <tr>
                            <!--[if mso]>
                                <td width="3%" class="em_hide" style="width:3%;background-color:#098fa1;mso-line-height-rule: exactly;margin:0;padding:0;"> </td>
                            <![endif]-->
                            <!--[if !mso]><!-->
                                <td width="50" class="em_hide" style="width:50px;background-color:#098fa1;mso-line-height-rule: exactly;margin:0;padding:0;"> </td>
                            <!--<![endif]-->
                            <td width="25" class="em_show" style="display: none;overflow:hidden;line-height:0px;mso-hide:all;max-height:0px;mso-line-height-rule: exactly;width:25px;background-color:#098fa1;"> </td>

                            <td>
                                <table cellspacing="0" cellpadding="0" border="0" style="width:100%;" role="presentation">

                                    <tr>
                                        <td style="padding-bottom:0px;background-color:#098fa1;" bgcolor="#098fa1">
                                            <table cellspacing="0" cellpadding="0" border="0" style="width:100%;background-color:#098fa1" role="presentation">
                                                <tr>

                                                    <td>
                                                        <table class="full-column" style="float:left; display:table-cell; width:100%;background-color:#098fa1" cellspacing="0" cellpadding="0" border="0" align="center" role="presentation">
                                                            <tbody>
                                                                <tr>
                                                                    <td height="45" style="border-collapse:collapse; font-size:45px; line-height:45px;"> </td>
                                                                </tr>

                                                                <tr style="background-color:#098fa1">
                                                                    <td width="498" class="column-td " style="padding-left:0; padding-right:0; padding-top:0; padding-bottom:0px; width:498px;
                                                                                font-family: Helvetica, HelveticaArial, sans-serif, HelveticaNeueLTStd-Bd;font-size:20px; color:#ffffff; line-height: 30px; mso-line-height: exactly; vertical-align: middle; text-align: left;background-color:#098fa1" valign="top">
                                                                        <div style="background-color:#098fa1">
                                                                            <b style="font-family:Helvetica, HelveticaArial, sans-serif, HelveticaNeueLTStd-Bd;">

                                                                                COPY COPY COPY COPY COPY COPY COPY COPY

                                                                            </b>
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td height="21" style="border-collapse:collapse; font-size:21px; line-height:21px;"> </td>
                                                                </tr>
                                                                <tr style="background-color:#098fa1">
                                                                    <td width="498" class="column-td " style="padding-left:0; padding-right:0; padding-top:0; padding-bottom:0px; width:498px;
                                                                                font-family: Helvetica, HelveticaArial, sans-serif, HelveticaNeueLTStd-Roman;font-size:16px; color:#ffffff; line-height: 22px; mso-line-height: exactly; vertical-align: middle; text-align: left;background-color:#098fa1" valign="top">
                                                                        <div style="background-color:#098fa1">

                                                                            COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY COPY

                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td height="31" style="border-collapse:collapse; font-size:31px; line-height:31px;"> </td>
                                                                </tr>
                                                                <tr style="background-color:#098fa1">
                                                                    <td width="498" class="column-td " style="padding-left:0; padding-right:0; padding-top:0; padding-bottom:0px; width:498px;
                                                                                font-family: Helvetica, HelveticaArial, sans-serif, HelveticaNeueLTStd-Bd;font-size:18px; color:#ffffff; line-height: 24px; mso-line-height: exactly; vertical-align: middle; text-align: left;background-color:#098fa1" valign="top">
                                                                        <div style="background-color:#098fa1">
                                                                            <b style="font-family:Helvetica, HelveticaArial, sans-serif, HelveticaNeueLTStd-Bd;">

                                                                                COPY COPY COPY COPY COPY COPY COPY COPY

                                                                            </b>
                                                                        </div>
                                                                    </td>
                                                                </tr>

                                                                <tr>
                                                                    <td height="15" style="border-collapse:collapse; font-size:15px; line-height:15px;"> </td>
                                                                </tr>

                                                            </tbody>
                                                        </table>
                                                    </td>

                                                </tr>
                                            </table>
                                        </td>
                                    </tr>

                                    <tr>
                                        <td style="padding-bottom:0px;background-color:#098fa1;" bgcolor="#098fa1">
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0" role="presentation">
                                                <tr>

                                                    <td class="column-td">
                                                        <table width="100%" border="0" cellspacing="0" cellpadding="0" role="presentation">
                                                            <tr>
                                                                <!--[if !mso]><!-->
                                                                <td id="MobileOnlyTD" align="left" style="max-height: 0px;height: 0px; display: none; line-height: 0px; padding: 0px; margin: 0px; width: 0px;">
                                                                    <div>
                                                                        <a target="_blank" href="https://example.com/?elqTrackId=1d6421fd2ca1472bb6411c63a31fa818" style="background-color:#E71316;
                                                                                border:1px solid #E71316;border-radius:1px;color:#ffffff;display:inline-block;font-family:Helvetica, HelveticaArial, sans-serif, HelveticaNeueLTStd-Md;font-size:16px;line-height:30px;text-align:center;text-decoration:none;width:166px;-webkit-text-size-adjust:none;mso-hide:all;">
                                                                            <span style="position:relative;top:2px;">
                                                                                FPO CTA
                                                                            </span>
                                                                        </a>
                                                                    </div>
                                                                </td>
                                                                <!--<![endif]-->
                                                                <td id="DesktopOnly" align="left">
                                                                    <div>
                                                                        <!--[if mso]>
                                                                                <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="https://example.com/" style="height:30px;v-text-anchor:middle;width:166px;" arcsize="1%" strokecolor="#E71316"
                                                                                fillcolor="#E71316">
                                                                                <w:anchorlock/>
                                                                                <center style="color:#ffffff;font-family:Helvetica, HelveticaArial, sans-serif, HelveticaNeueLTStd-Md;font-size:16px;">
                                                                                <span style='position:relative;top:2px;'>
                                                                                FPO CTA
                                                                                </span>
                                                                                </center>
                                                                                </v:roundrect>
                                                                                <![endif]-->
                                                                        <!--[if !mso]><!-->
                                                                        <a target="_blank" href="https://example.com/?elqTrackId=9f1232b523164fd4adf1e73ba8201850" style="background-color:#E71316;
                                                                                border:1px solid #E71316;border-radius:1px;color:#ffffff;display:inline-block;font-family:Helvetica, HelveticaArial, sans-serif, HelveticaNeueLTStd-Md;font-size:16px;line-height:30px;text-align:center;text-decoration:none;width:166px;-webkit-text-size-adjust:none;mso-hide:all;">
                                                                            <span style="position:relative;top:2px;">
                                                                                FPO CTA
                                                                            </span>
                                                                        </a>
                                                                        <!--<![endif]-->
                                                                    </div>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                    <td width="216" class="em_hide" style="width:216px;mso-line-height-rule: exactly;margin:0;padding:0;"> </td>

                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td height="50" style="border-collapse:collapse; font-size:50px; line-height:50px;background-color:#098fa1;" bgcolor="#098fa1"> </td>
                                    </tr>

A: The email is scaling down on phones, causing this, because you have things like width="498" and other wide elements (mobiles can get down to 280px--including all padding). Make the email responsive and the issue should go away. I suggest a complete rebuild, sorry - the code is much too complex for what it needs to be. There are plenty of HTML Email examples and tutorials out there.

A: From what I see you haven't applied border:none to table (just border-spacing: 0;) - I think you should add that.


text:
Q: Оповещение администратора о новом пользователе. WordPress Здравствуйте. Подскажите плагин для WP, который будет отсылать письмо на почту админа о новом пользователе.
Спасибо
A: Нашел в сети, как отключить такое оповещение. Т.е. вам надо, как я понимаю, проделать обратные действия, указанные в этой статье.
P.S. Вообще, эта опция по идее должна быть включена по умолчанию. Может вы просто не указали свой email (Параметры > Общие > Адрес e-mail)?  Там даже пояснение рядом стоит: "Этот адрес используется в целях администрирования. Например, для уведомления о новых пользователях."


text:
Q: Redundant gateway with same IP I have a need where a physical site requires redundant control hardware.
Assume 10 devices require control signal to be sent to it from a master controller. If this controller for some reason goes down, I require a secondary controller to take its place.
During this transition, I would like the controller to have a common IP address. Otherwise the end devices require an update which is tedious.
So what are the options I have if I require two controllers to potentially have the same IP, if not simultaneously, at least on switchover.

A: We have many such setups running and we typically use keepalived, as it provides fast and reliable failover while being very easy to configure and maintain.
If the machines in question are Windows, we typically do this within a routing layer in between, that also helps isolating the often vulnerable Windows hosts from the rest of the network.


text:
Q: Bash function can't seem take in directories with spaces in them I created the following function is ~/.bashrc:
function cl {cd $1; echo $1; ls -al $1}

(I put the echo command in there just to see what it's actually reading in)
In my home directory, I created a folder called "example folder", and I tried cl "example folder" and cl example\ folder and cl ~/"example folder". All of them printed out the same thing:
-bash: cd: too many arguments
example folder

Followed by the ls command, which just lists out my current directory.
So, is there a way around this? How can I pass in a directory that contains spaces?

A: function cl {cd $1; echo $1; ls -al $1}

is closer to zsh syntax than bash syntax, but even then, still has many issues.
In bash

*

*you need whitespace after {, and } to be preceded by a command delimiter (;, &, newline, though ) would also do).  Doesn't apply to zsh.

*Parameter expansions must be quoted or otherwise they undergo split+glob. Doesn't apply to zsh.

*If you pass variable data to be meant to be a regular argument, not an option, you should make sure you precede it with the end-of-option marker (--) to avoid the data be taken as an option if it starts with -.

*you're not checking the exit status of cd after running the next command.

*echo can't be used to output arbitrary data. Use printf instead.

*after you have cded into $1, ls -la $1 (or the more correct ls -la -- "$1") won't work anymore if $1 was a relative path. Most likely you want only ls -la (or ls -lA).

*In scripts, you generally want to use cd with -P, and after having made sure $CDPATH is unset or empty (CDPATH= cd -P -- "$1") so that it behaves more like the chdir() of any other language. Does probably not  apply if the function is to be used from an interactive shell though.

*function f { ...; } is the ksh syntax for function definition. In bash, there's little reason to prefer that over the standard f() { ...; } syntax.

So:
cl() {
  cd -- "$1" || return
  printf '%s\n' "$1"
  ls -Al
}

Note that when not passed any argument, cd changes directory to your home directory (cd is like cd ~ or cd "$HOME").
However, here when cl is called with no argument "$1" expands to one empty argument instead of no argument at all (and cd would likely choke on that). To call cd with no argument if cl is called with no argument (so that cl alone brings you to your home directory and list the files there), you'd replace "$1" there with ${1+"$1"}. Or you could call cd with the same list of arguments that cl received using "$@" so you can do for instance cl -P ../bin or cl -- -dir-whose-name-starts-with-dash.
Then, you'd likely want to print the current working directory after cd rather than the first argument with either printf '%s\n' "$PWD" or just pwd.
cl() {
  cd "$@" || return
  pwd
  ls -Al
}

More reading:

*

*Why does my shell script choke on whitespace or other special characters?

*Why is printf better than echo?

*What does "--" (double-dash) mean?


text:
Q: Git asks for non-existing path bash: /usr/share/gitolite/gl-auth-command The command git that always worked well started to ask for the non-existing path:
$ git pull origin master
Enter passphrase for key '/home/xxxxx/.ssh/xxxxxxxx_rsa':
bash: /usr/share/gitolite/gl-auth-command: No such file or directory
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

The path, indeed, is missing on both server and workstation side and I even cannot understand which side (server or workstation) is responsible for the problem. How to get the git working again?
The passphrase protected key and the authentication itself seems ok as it is possible to use them for ssh login.

A: I finally found that after installing gitolite3 on the server side and then running gitolite as git results the error message that .gitolite.rc has the wrong content for the old version. After moving this file away, it was possible to fix everything with gitolite setup. All content was surely backed up during this migration. Maybe somebody will post a more consistent answer.


text:
Q: IE7 CSS rendering issue I am using Kartris for an ecommerce site. Looks great in all browsers except for IE7.
The page in question is:
http://mellcrest.thecalicotree.co.uk/kartris/Default.aspx?
The following elements are both displaying strangely, the searchbox is not displaying at all.
 <user:NavigationMenu ID="UC_NavigationMenu" runat="server" EnableViewState="False" />
 <user:SearchBox runat="server" ID="UC_SearchBox" />

CSS for navigation menu is:
#section_searchbox
{
    background-color:#5e99d2;
    height: 23px;
    background-image: url(images/menu_back.jpg);
    background-repeat: repeat-x;
    border-bottom: solid 1px #01366A;
    border-top: solid 1px #01366A;
    position:relative;
    z-index:1;

}

#section_searchbox #searchprogress
{

    padding: 0 0 0 0;
    background-color:#5e99d2;
}

#section_searchbox #searchboxes
{
    position: relative;
    padding: 2px 7px 1px 7px;
    float: left;
    background-color:#5e99d2;
    background-image: url(images/menu_back.jpg);
    background-repeat: repeat-x;
}

#section_searchbox #searchboxes input
{
    width: 200px;
}

#section_searchbox #searchboxes input.button
{
    width: 50px;
}

#section_searchbox #searchboxes input.button:focus
{
    border: 0px;
}

A: Add this script just before the closing of the </head> tag:
<!--[if IE 7]>
    <style type="text/css">

        /* Fixes the display of the menu */
        #header {
            height:113px;
        }

        /* Fixes the search box display */
        #menubar {
            width: 640px;
        }

        /* Fixes the display of boxes in rows
           (IE7 doesn't understand display: inline-block)
        */
        .slideshow, .slideshow2, .slideshow3, .slideshow4, .slideshow5, .slideshow6 {
            float: left;
        }

        /* Fixes the animation transition */
        .slideshow a, .slideshow2 a, .slideshow3 a, .slideshow4 a, .slideshow5 a, .slideshow6 a {
            height: 233px;
            width: 233px;
        }

        /* Fixes the focus of the searchbox. */
        #searchboxes {
            position: relative;
            z-index: 100;
        }
    </style>
<![endif]-->

It fixes most of your display problems.
For me, the menu and header are displayed the same way (in my IETester) as on recent browsers (I compared with chrome).


text:
Q: How to display all products in a single page in opencart? I want to display all products in onepage while clicking a single button in main menu and also need to display category in main menu...
thank in advance...!

A: I suggest don't make any change in the default theme codes and structure. If you already using a custom theme you can easily create a menu and define to all categories included all products under the one menu or button.
Lets get over with in that way :
For example you have 5 categories. Every category includes over ten products or much.

*

*Create a brand (Manifacturer). This brand will be contain just 1 category. Give it a name like "All Products"

*Create a category and name it as "All Products".

*Create a menu which will display all products and define the menu display as category. Select the "All Products" category which is you just created.

*Go to product pages and click edit for each one. Click the "link" tab and the category textbox, choose "All Products" category. Make this simple edit for every product. I tried for you and it takes 4 / 5 seconds.

*Go to "Theme Setting" in your theme. Find "Display Products" or "Products in Category" setting. There are always pre-defined display limit in every theme and it goes next with pagination. Make a simple calculation like that ; how many product in your store, 50 ? 100 ?

*Setup the display limit bigger than your total product count.

That's it !
Maybe you would like to play menu css a bit. Like i said before, if you already using a custom theme, you dont need to fork your core codes especially the default theme.
Let me know if any help.

A: The way i did its something like this
Controller : ControllerProductCategory
inside the index function replace
if (isset($this->request->get['limit'])) {
    $limit = $this->request->get['limit'];
} else {
    $limit = $this->config->get('config_product_limit');
}

with
if (isset($this->request->get['viewall'])) {
            $limit = "";
} else if (isset($this->request->get['limit'])) {
            $limit = $this->config->get('config_product_limit');
} else {
            $limit = $this->config->get('config_product_limit');
}

Also make this change to display all the products without category filter
replace this code
    if ($category_info) {
                $this->document->setTitle($category_info['meta_title']);
                $this->document->setDescription($category_info['meta_description']);
                $this->document->setKeywords($category_info['meta_keyword']);

With this code
if (($category_info) || ($category_id == 0)) {
    if ($category_id == 0) {
                $this->document->setTitle('all products');
                $this->document->setDescription('all products');
                $this->document->setKeywords('all products');
                $this->data['heading_title'] = 'all products';
                $category_info['description'] = '';
                $category_info['image'] = '';
      } else {
                $this->document->setTitle($category_info['name']);
                $this->document->setDescription($category_info['meta_description']);
                $this->document->setKeywords($category_info['meta_keyword']);
                $this->data['heading_title'] = $category_info['name'];
            }

and at the last create a new category , you can name it to anything you want. and give the link something like this
https://www.yourwebsite.com/yourCategoryname?viewall=viewall?viewall=viewall

You can place this link anywhere you want and it will load all the products without any pagination.
let me know if you still don't understand anything anyehere.

A: *

*Display Alll Product in one Page You have to create separate page for displaying all products.

*

*Create Model file catalog\model\catalog\allproduct.php and paste
code this http://pastebin.com/suF5TP3z

*Create Controller file catalog\controller\productallproduct.php and
paste below code http://pastebin.com/jZq3hZyc

*Create View file
catalog\view\theme\default\template\productallproduct.tpl and paste
below code http://pastebin.com/1HNh3x73
4 . Create Language file catalog\language\en-gb\product\allproduct.php
and paste below code http://pastebin.com/EcyJH7F9

*Enable module from back-end You can see link in menu

*Display All Category in Menu

*

*Open and edit your category:

*Select tab Data:

*Find and Check:Top: Display in the top menu bar.

Note : Only works for the top parent categories.You will need to check all the top level categories.It's Opencart bugs.


text:
Q: CSS3 label tag facing right and using position or :after I am trying to construct this shape in CSS:

But I can't figure out how to put the triangle shape (considering I have a rectangle for the "body" of the tag and a triangle for the tip) facing right. Because I'm working with positions, how can I tell the triangle to appear right after the rectangle, when tags can all have different sizes? I just can't work it out.
You can check the fiddle: http://jsfiddle.net/ExZFe/ with a similar tag to the one I'm making. This example uses just positions, so giving the triangle a fixed position is useless. I tried with :after but got stuck too, because of the same reason. What am I missing? Thank you in advance.

A: Simply position the triangle using the right property (which start from the right of the rectangle) instead of the left (which starts from the left of the rectangle and is useless here as you can't know the width of the tags): http://jsfiddle.net/Gv3rf/

A: Just add a line-height to .tag
.tag {
line-height: 10px;
/* the rest of your styles here */
}

http://jsfiddle.net/ExZFe/3/