EzDevInfo.com

zone.js

Implements Zones for JavaScript angular/zone.js · GitHub zone.js - implements zones for javascript

Does a DNS A record redirect slow down load speeds? (with example) [closed]

I have a website hosted on my server that is taking longer to load than our other websites despite the fact that it's built the same. To test further, I made an exact copy of the website and put it on a sub-domain.

I noticed that the sub-domain copy load anywhere from 10%-70% faster every time. The only difference I can think of is that the live site's DNS is pointed elsewhere, and just uses an A record to redirect to our servers.

Is this the reason why? If so, is there any ways to avoid this?

You can see the website and it's clone and test their speeds at whichloadsfaster.com

http://tinyurl.com/9vmebl9 vs. http://tinyurl.com/8dg6evt


Source: (StackOverflow)

Zone and Jquery issue in Tapestry5.2.6

I am migrating my web application from tapestry version 5.1.0 to 5.2.6. I am using jquery dialog to handle popped out display (instead of a pop-up window).

While using tapestry v5.1.0, I used jquery js (version 1.6.2) library with tapestry standard js library (prototype n other js) with no discrepancy. But now, when I have migrated to tapestry v5.2.6, there are conflicts in the javascripts. If I comment out jquery js import in a page, zone works i.e. gets updated but dialog doesn’t work and if I include jquery js in the page, the dialog works perfectly, but it shows error for zone updation event saying “Element 'selectZone' does not have an associated Tapestry.ZoneManager object.”

So basically, I need to use both jQuery and prototype js together in the page for tapestry v5.2.6. Please suggest a way for the same.

Regards,
Mahendra


Source: (StackOverflow)

Advertisements

Time Zones & Display Dates in a CMS

I have done a lot of reading on this question and I don't think it is quite as simple as it might sound.

We are building a proprietary CMS and after doing a lot of research have decided to store all dates and times in UTC (either as a unix timestamp in an INT field or as a DATETIME field).

I am completely familiar with HOW to handle time offsets etc.

Since we are storing all date/time value as UTC and converting these values to a particular timezone at the point of displaying those values:

  1. Is it common in CMS software that the display values will change if you change the website's time zone? For example, supposing you have an offset of +10 and the date displayed is therefore 1st March 2011 at 14:15; and you change the offset to -10, would the date and time displayed for that article change to 28th February 2011 at 18:15?

  2. If this is correct, what will happen if your timezone settings are obeying daylight saving time? Surely, when the timezone offset changes because of daylight saving time the dates and times of all previously published articles will also change, possible moving day or month too? I fail to see how this would be an appealing feature.

In essence, I'm asking how to enable time zone alteration of date and time without having the second effect. Or have I got the whole thing wrong?

Many thanks in advance!


Source: (StackOverflow)

Oracle: epoch milleseconds to date/time with time zone included

I'm a PL/SQL newbie who needs to convert milleseconds since unix epoch to a date/time. I can convert to GMT date/time but don't know how to adjust for the time zone. I'm close but not quite there.

My input is r_msg.OriginationTime, which has a value like 1382552100277

This

MpD NUMBER        := (1/24/60/60/1000);        -- Milleseconds per Day

DFmt24 VARCHAR2(21) := 'MM/DD/YYYY HH24:MI:SS';    -- Date format

TMPorig24        VARCHAR2(20);

. . .

TMPorig24 := TO_CHAR( DATE '1970-01-01' + MpD * r_msg.OriginationTime, DFmt24);

gives something like

10/23/2013 18:15:00

which is just what I want except it's GMT.

This

    TimeZoneOffset VARCHAR(7);

    . . . 

    TimeZoneOffset := tz_offset('America/New_York' );

gives

-04:00

So I just need to do something like

TMPorig24 := TMPorig24 + TimeZoneOffset;

but I get

ORA-06502: PL/SQL: numeric or value error: character to number conversion error

I've tried several variations but nothing works.

Any help appreciated.


Thanks but I'm having problems with the two solutions.

The first solution prints the same time regardless of the time zone. For example, these print the same values.

TMPorig := TO_CHAR( FROM_TZ( CAST(DATE '1970-01-01' + (1/24/60/60/1000) * r_msg.OriginationTime AS TIMESTAMP), 'America/New_York'), 'MM/DD/YYYY HH24:MI:SS');

TMPorig2 := TO_CHAR( FROM_TZ( CAST(DATE '1970-01-01' + (1/24/60/60/1000) * r_msg.OriginationTime AS TIMESTAMP), 'Pacific/Pago_Pago'), 'MM/DD/YYYY HH24:MI:SS');

The second solution

TMPorig := TO_CHAR( DATE '1970-01-01' + (1/24/60/60/1000) * r_msg.OriginationTime + INTERVAL '-04:00' HOUR TO MINUTE, 'MM/DD/YYYY HH24:MI:SS');

gives

PLS-00166: bad format for date, time, timestamp or interval literal

Moveover, '04:00' will be wrong when Daylight Savings Time ends. I need an expression for the time difference between EST/EDT and GMT.

********* WORKS PERFECT THANKS **************

TMPorig2 := TO_CHAR ( FROM_TZ ( CAST (DATE '1970-01-01' + (1/24/60/60/1000) * r_msg.OriginationTime AS TIMESTAMP), 'UTC') AT TIME ZONE 'America/New_York', 'MM/DD/YYYY HH24:MI:SS');



Source: (StackOverflow)

Tapestry Prototype selecting element by ID on zone updates

I have a zone on my page that contains a select element.

I'm adding an onChange listener on that element via JavaScript (thanks to http://jsfiddle.net/AnbmU/6/)

void afterRender() {
    javaScriptSupport.addScript(
        "$('groupSelecter').observe('change', function() {" + 
        "    var width = $(this).getWidth();" + 
        "    var selectBox = $('groupSelecter');" + 
        "    var chosen = selectBox.selectedIndex >= 0 ? selectBox.options[selectBox.selectedIndex].innerHTML : undefined;" + 
        "    $(this).next('.ninja-input')" + 
        "         .toggleClassName('hidden', chosen != 'Create New Group...')" + 
        "         .select();" + 
        "});",
        ""
    );
}

The problem occurs when I trigger a zone refresh, my select changes id to something like this: groupSelecter_846e54edd0b5.

Is there a way to either keep the select's element id constant or to be able to change javascript and select's id on each zone update?

EDIT: Another issue I was not aware of before.

Hidden input field is toggled each second change of selected elements, regardless of its contents. For example, if I had GROUP_1, GROUP_2, GROUP_3 and Create New Group... and GROUP_1 initially selected, and changed to GROUP_2, the input box appears. When I change it to Create New Group..., the input is hidden again. Again, when I change to GROUP_3, the input field appears. Mind you, in JSfiddle, this works just fine. But for some reason, it doesn't work in my Tapestry project.

EDIT2: OK, I tried some more fiddling:

Tapestry generated select element with id=groupSelecter_d769af562f89. It also generated inserted this JavaScript (on the bottom of HTML):

$$('.groupSelecter').invoke('observe', 'change', function() {
    var width = $(this).getWidth();
    var chosen = $(this).selectedIndex >= 0 ? $(this).options[$(this).selectedIndex].innerHTML : undefined;
    $(this).next('.ninja-input')
        .toggleClassName('ninja-hidden', chosen != 'Create New Group...');
});

I inpected the element in Firefox, navigated to tags, found the generated code and cut it out. After that, I opened firefox JS console and pasted that same exact code I just cut. And, voila, it works, for some reason. (Class selecting, that is).


Source: (StackOverflow)

Sharepoint Foundation - Create page with zones

I would like to create a page with default left and right zone, but I'm just able to create a rich page with column-based text layouts.
How can I achieve that? Are there some kind of templates?

Setup: Sharepoint Foundation 2010 (without access to SP Designer)

I also learned from this question, that I'm not able to create custom layouts without designer.


Source: (StackOverflow)

Set windows 7 time zone with Python

I have the Local Time Zone, for example: Europe/Zurich How can I set it in Windows 7 with Python ? I know it's possible with tzutil in CMD.


Source: (StackOverflow)

Tapestry 5 : 2 dependent select fields using zone

As I never worked on a tapestry project, this issue might seem dumb to some of you. Anyway, I really need help for this.

What I want to do is the following: I have a first dropdown list for example :

  • Numbers
  • Letters
  • Special Chars

And a second dropdown list which content depends on the value selected in the first list. For Numbers we should have a list of numbers from 0 to 9. For Letters, a list of letters from A to Z. And for Special Chars, a list of special characters (e.g: *,/+$%).

Does anyone have an idea how I can do this? Thank you for helping.


Source: (StackOverflow)

NoMethodError: undefined method `zone' for Time:Class

How do i use Time.zone in ruby if I am not using rails I want to do Time.now but that's available in rails but not ruby

I thought that

require 'time'

would fix this and make it available in ruby but it didn't and I get

NoMethodError: undefined method `zone' for Time:Class

Source: (StackOverflow)

Rails query find result with partiular day with where cluase

I want to orders which are confirmed particular day.

This is particular day:

today = Time.zone.now

Wed, 10 Jun 2015 13:31:16 IST +05:30

This is range of particular day

value = today.beginning_of_day()..today.end_of_day()
Wed, 10 Jun 2015 00:00:00 IST +05:30..Wed, 10 Jun 2015 23:59:59 IST +05:30

But when I execute this, SQL query date range is changed,

orders = Order.where(confirmed_at: value)

SELECT "orders".* FROM "orders" WHERE "orders"."confirmed_at" BETWEEN '2015-06-09 18:30:00.000000' AND '2015-06-10 18:29:59.999999' ORDER BY orders.confirmed_at DESC

In this orders confiremed between '2015-06-09 18:30:00.000000' AND '2015-06-10 18:29:59.999999'

But I wants confirmed between 'Wed, 10 Jun 2015 00:00:00 IST +05:30..Wed, 10 Jun 2015 23:59:59 IST +05:30'


Source: (StackOverflow)

aws 2 vpc in different zones same region: communication using private IPs

I have setup two VPCs in a particular AWS region, however each of these belongs to a different zone. As such i am trying to get the ec2 instance from zone A to communicate with the instance in zone B via the private IPs. Has anybody had any luck doing so.

Currently an elastic IP is attached to the zone A machine which cannot ping the private IP in zone B. When testing within the same zone pinging the private IP was successful. All ports and IPs are open in both VPC security groups.

zone a subnet 10.0.0.0/24 zone b subnet 10.0.1.0/24

routing tables for both VPC allow traffic from 10.0.0.0/16 to local and 0.0.0.0. to igw

Any advice would be appreciated.

Thanks.


Source: (StackOverflow)

Multiple use of a custom component containing a zone

I'm facing a problem when using tapestry 5.2.0 : using multiple times a component containing a zone.

At this point, the component is used 3 times on the same page but only one instance is working well. The tml associated to the component looks this way :

<t:container xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd">
    <t:zone t:id="myZoneId">
        <!-- component's zone content goes there -->
    </t:zone>
</t:container>

The cause of this problem is very simple, as we can see, if we use this component multiple times on the same page, then the zone id will not be unique, and multiple zones with the same id will be present in the page.

Now here's my question : what approach can be used in order to make the zone id in the component unique, whenever the component is used once or several times and without using the zone outside of the container.

Thank you in advance for your ideas.


Source: (StackOverflow)

PostgreSQL round timestamp seconds down for a postgres pre-created date with milliseconds

I have a query that unfortunately has to compare 2 timestamps. One timestamp is given to the DB from the PHP date() function, stored as timestamp without time zone, so there's no milliseconds added to this date. The other is a PG timestamp with time zone. So both dates have already been created and inserted into the tables, here is an example of the dates:

timestamp without time zone = 2012-09-19 18:13:26

PG's timestamp with time zone = 2012-09-19 18:13:26.893878-04

I can cast the PG date::timestamp(0) which gets me close but as would be expected the date is rounded up; 2012-09-19 18:13:27

So my question is how can I get the seconds to round down?


Source: (StackOverflow)

Failure writing parameter 'value' null value on a parameter field (ajax)

I encounter this issue when I am trying to update a zone of a component in a handled event (onValueChanged of a select box).

[ERROR] TapestryModule.RequestExceptionHandler Processing of request failed with uncaught exception: Failure writing parameter 'value' of component calendar/Stereotype:daycomponent.selectcategoryactivity: Property 'day' (within property expression 'day.category', of com.hb.craproject.web.components.calendar.stereotype.AddDayStereotypeComponent@3a6b9a8a) is null.
org.apache.tapestry5.ioc.internal.OperationException: Failure writing parameter 'value' of component calendar/Stereotype:daycomponent.selectcategoryactivity: Property 'day' (within property expression 'day.category', of com.hb.craproject.web.components.calendar.stereotype.AddDayStereotypeComponent@3a6b9a8a) is null. [at classpath:com/hb/craproject/web/components/calendar/stereotype/AddDayStereotypeComponent.tml, line 24]

"Day" is a parameter defined like this :

@Parameter(required=true)
@Property
private DayStereotypeBean day

And when the component is rendering for the first time, all works fine. It's only when I try to change the selected value that it crashes and given that error message.

My DayComponents are declared like this in my tml page :

<t:loop source="week" value="dayBean">
  <tr style="border :0.1em solid blue; border-radius : 0.5em">
    <t:day t:id="dayComponent" day="dayBean" /></tr></t:loop>

So this is a List of Day beans. This list is feeded in the setuprender event handler of the page.

I don't understand why the Day parameter lost his reference in the event handler of the select component :

public Object onValueChangedFromSelectDuree(String duree)
{    
//throwing exception, day.Day is a String, this line is just for showing you that the object doesn't exist anymore in the method, if this line is not here, the exception is throwed too because my select tml component use (like many oher components) that object
    day.getDay(); 
    return request.isXHR() ? zoneDuree.getBody() : null;
}

And now you can see the select tml component :

<t:zone t:id="zoneDuree">
        <t:select t:id="selectDuree"
            model="literal:journée,demi-journée,définir" value="day.duree"  zone="zoneDuree" /> <!-- here some fields depending of the select value --></t:zone>

Any idea should be appreciated.

(sorry for my bad english ;) )


Source: (StackOverflow)

Ruby Time.new giving time zone offset of 14 minutes

When I create a time object in Ruby 1.9.2 with a date earlier than 1 September 1919, the time zone is set to +0014 rather than to the system zone (+0100) or UTC. Now that I discovered the problem being the early date, and since all I want is a time without a date, I will just use a recent date. But does anyone know why this happens?

ruby-1.9.2-p0 :034 > Time.new(1919,9,1,0,0,0)
=> 1919-09-01 00:46:24 +0100 
ruby-1.9.2-p0 :035 > Time.new(1919,8,31,23,59,59)
=> 1919-08-31 23:59:59 +0014 
ruby-1.9.2-p0 :036 > Time.new(1919,8,31,1,0,0)
=> 1919-08-31 01:00:00 +0014 

Source: (StackOverflow)