Q: Sending arrays to REST services in CakePHP I'm currently writing a REST service using CakePHP and I was wondering how can I send an array of item_ids through REST to an action.
class ItemsController extends AppController {

var $components = array('RequestHandler');
var $helpers = array('Text', 'Xml');

function index()
{

}

function create($itemsArr)
{
        //handle $itemsArr here and sends data as xml to views.
}

}

I guess my real question is, How will the request look like?
http://mysite/items/create/???
I guess I can pass the values as 1 argument using implode(someSeperator, array) but is there a better solution?
Thanks in advance

A: This is not REST.
REST is about using HTTP, not XML!
A typical HTTP REQUEST to create an item would be like this
PUT http://mysite/items/ HTTP/1.1
Host: xxxxx

<myitem>
<text> asdasdas </text>
</myitem>

And you can use whatever you want in the body of the request. XML, JSON, PHP SERIALIZE or your own data format.

A: If you truly want to be RESTful about this, you'd definitely want to use a POST request to create records. That's if you care to be strict about the standard, but it would also help you because I'm reading that your array's length could vary tremendously - sometimes 1 ID, perhaps 30 other times, etc. URI query strings do (or used to?) have a maximum character limit that you could conceivably bump up against.
If you roll with a POST request, you could easily passing in a comma-delimited list (think about how a field name with multiple checkboxes is passed) or, my favorite mechanism, a JSON-encoded array (represented as a string that can easily be JSON-decoded on the other side.

A: This actually applies to any web page, not just CakePHP.
Any web page which wants to send a large number of fields has to include them all in their POST request.
If you had a web page form with 50 inputs and a submit at the bottom, the page would by default serialise the data and send it in the form request.
If you don't want all the data sent in seperate bars, then using a seperator would work fine too and would mean they all went in 1 parameter.
Somthing like:
http://mysite/items/create?mydata=23-45-65-32-43-54-23-23-656-77

A: another option:
$safedata = base64_encode(serialize($arrayofdata));

and pass it to URL as safe string.
then uncompress it:
$data = unserialize(base64_decode($safedata);


Q: Why am I getting this 'enum' is not a class or a namespace error? I need call a method with this signature in my Manager class:
void createPlayer(Player& player, PlayerType& playerType);

I have a Player defined like so:
using namespace std;

enum PlayerType { FORWARD, DEFENSEMAN, GOALIE };

class Player {
  public:
    Player();
    void setType(PlayerType);
  private:
    PlayerType type;
};

This is how I try to call the method in main ...
#include "Player.h"
#include "Manager.h"

int main() {

  Manager manager;
  Player player;
  PlayerType t = PlayerType::FORWARD;
  manager.createPlayer(player, t);

  return 0;
}

... but it fails to compile with this error:
Main.cc: In function ‘int main()’:
Main.cc:12:18: error: ‘PlayerType’ is not a class or namespace

Any ideas?  Note: I cannot change the signature of the createPlayer method.

A: Unfortunately enum by default doesn't create an enum namespace. So when declaring:
enum PlayerType { FORWARD, DEFENSEMAN, GOALIE };

you'll have to use it like this:
auto x = FORWARD;

Thankfully, though, C++11 introduced enum class or enum struct to solve this issue:
enum class PlayerType { FORWARD, DEFENSEMAN, GOALIE };

You'll then be able to access it like you did:
auto x = PlayerType::FORWARD;

A: enum doesn´t create a namespace.
Therefor PlayerType t = PlayerType::FORWARD; should be changed to:
PlayerType t = FORWARD;

Notice that c++11 introduce enum classes, which have a namespace. Beside this MSVC has an extension which treats (regular) enums like they have namespace. So your code should actually work with MSVC.

A: Your error seems to be in this line:
PlayerType t = PlayerType::FORWARD;
As far as I know, the scope resolution operator (::) is not valid on regular C++98 enums unless your compiler supports them through non-standard extensions (like Visual Studio). Therefore you can't use it to reference an specific value from the enumerator.
Also, C++98 enums have the problem of polluting the namespace in which they are defined which can lead to name clash. Luckily C++11 solved this introducing the enum class. For more information check Stroustrup's FAQ: http://www.stroustrup.com/C++11FAQ.html#enum

A: add a static function say getForward:
class Player {
  public:
    Player();
    void setType(PlayerType);
    static PlayerType getForward {
        return FORWARD;
    }
  private:
    PlayerType type;
};

Then use it in main:
manager.createPlayer(player, Player::getForward());

This should work.


Q: how to efficiently redirect url in Cloudfront without S3 My requirement is to redirect url from Cloudfront. So for this I see there are possibilities to do using Lambda function as mentioned here.
My application is not hosted in S3, rather it is hosted in Apache webserver which is running on some EC2 instance.
Because redirect rules are many so I would like Lambda function to read configuration of redirect mapping from some other place but I do not know what could be the other place.  I see it is possible to read either from S3 or SNS topic. Could you please suggest what is the best practice to store redirect mapping and handle redirect via Lambda?
As I understood it is not possible to do using Route53 to read mapping and then do redirect. Please correct me if I am wrong.
I am new to this and would request your expert guidance!

A: I think you are mistaking some concepts. If I got it right you need a CDN for an Apache server on EC2. In that case you want Cloudfront with EC2 as origin . https://aws.amazon.com/cloudfront/getting-started/EC2/


Q: Servlet running under Grails How can I run a servlet (UploadAction from GWTUpload project) under grails? I've successfully added the servlet and use it from the web.xml file. However, I really want to wrap some logic around the doPost/doGet methods using the grails framework (gorm).
Can I just subclass the servlet as a Controller, maybe just instantiate the servlet in the controller and call init()? I'm not sure how to do this properly.

A: The simplest thing that comes to my mind is:

*

*write a grails controller, instantiate the servlet (once, in the contstructor or in @PostConstruct) and call init()`

*map the controller method (via UrlMappings.groovy) to the url that your servlet would be mapped

*call servlet.service(request, response).

It's a bit of a hack though. Another way is to get ahold of a spring (grails) bean in a filter applied to the servlet, with WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()) and invoke the custom logic there.


Q: Fluid grid layout I am creating a form. In the form I have 20+ html controls i.e. textboxes, checkboxes, textarea. I want to arrange all the html elements in a table format. But when the screen sizes is reduces the number of column should get reduced.
example. Initially there will be 4 columns. when screen size reduces no of columns becomes 3. on further screen size reduction no of columns becomes 2 and then to 1.
How this can be achieved?

A: Use Flexbox Layout to design flexible responsive layout structure:

* {box-sizing: border-box;}

/* Style Row */
.row {
  display: -webkit-flex;
  -webkit-flex-wrap: wrap;
  display: flex;
  flex-wrap: wrap;
}

/* Make the columns stack on top of each other */
.row > .column {
  width: 100%;
  padding-right: 15px;
  padding-left: 15px;
}

/* Responsive layout - makes a two column-layout (50%/50% split) */
@media screen and (min-width: 600px) {
  .row > .column {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

/* Responsive layout - makes a four column-layout (25%/25% split) */
@media screen and (min-width: 991px) {
  .row > .column {
    flex: 0 0 25%;
    max-width: 25%;
  }
}

Resize this frame to see the responsive effect!

Column 1

Some Text...

Some Text...

Some Text...

Column 2

Some Text...

Some Text...

Some Text...

Column 3

Some Text...

Some Text...

Some Text...

Column 4

Some Text...

Some Text...

Some Text...

Reference:
Create a Mixed Column Layout


Q: split column in multiple columns in sql view I have created a view for the Leco results and it is attached here as ‘Leco Teble’ excel file. I would like to have same view in database with ‘expanded table’ column based on the sample ID’s as given in the expanded table. Would you please arrange with one of your team member to create a script to expand the table in the same view. Last column in the table “Shift” should be picked up based on the time with the sample ID. 6am to 6pm is day shift.


Q: Deleting records from fact table and dimension table I want to delete records from target table as records deleted from a source. I used merge/rows and delete stop both individuals, but I solved my problem in delete case when I deleted record from source. Then, after transformation fact table had only that record which was deleted from the source while it must had all those instead of this. I want the same method for the dim table also.enter image description here


Q: Alert to detect the available space on the hard drive I would like to know if it is possible to create an alert in a google cloud platform instance, to identify that a hard drive of an instance is 90% busy, for example, and that this sends a notification to some user.
I await your response, and thanks in advance.

A: You can use Google Stackdrive to setup alerts and have an email sent.
However, disk percentage busy is not an available metric. You can chose from Disk Read I/O and Disk Write I/O bytes per second and set a threshold for the metric.

*

*Go to the Google Console Stackdriver section. Click on Monitoring.

*Select Alerting -> Create Policy in the left panel.

*Create your alerting policy based upon Conditions and Notifications

You can create custom metrics. This link describes how.
Creating Custom Metrics


Q: Missing choices 11 in case statement and failed synthesizing module LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

entity mucodec is
    port (
        din     : IN std_logic_vector(2 downto 0);
        valid   : IN std_logic;
        clr     : IN std_logic;
        clk     : IN std_logic;
        dout    : INOUT std_logic_vector(7 downto 0);
        dvalid  : OUT std_logic;
        error   : OUT std_logic);
end mucodec;

architecture Behavioral of mucodec is
    type state_type is (St_RESET, St_ERROR, St_BOS_1, St_BOS_2, St_BOS_3, St_BOS_4, St_EOS_1, St_EOS_2, St_EOS_3, St_EOS_4, St_DECODE, St_Out);
    signal state, next_state : state_type := St_RESET;

    -- Define additional signal needed here as needed
begin
    sync_process: process (clk, clr)
    begin
        if clr = '1' then
            state <= St_RESET;
        elsif rising_edge(clk) then
            state <= next_state;

        end if;
    end process;

    state_logic: process (state)
    begin
        -- Next State Logic
        -- Complete the following:
        next_state <= state;
        case(state) is
            when St_RESET =>
                if (valid = '1') THEN
                    next_state <= St_BOS_1;
                end if;
            when St_ERROR =>
                if (valid = '1' and din = "000") THEN
                    if (valid = '1' and din = "111") THEN
                        if (valid = '1' and din = "000") THEN
                            if ( valid = '1' and din = "111") THEN
                                next_state <= St_DECODE;
                            else
                                next_state <= St_ERROR;
                            end if;
                        end if;
                    end if;
                end if;
            when St_BOS_1 =>
                if (valid = '1' and din = "000") THEN
                    next_state <= St_BOS_2;
                elsif (valid = '1' and din > "111") THEN
                    next_state <= St_ERROR;
                else
                    next_state <= St_BOS_1;
                end if;
            when St_BOS_2 =>
                if (valid = '1' and din = "111") THEN
                    next_state <= St_BOS_3;
                elsif (valid = '1' and din > "111") THEN
                    next_state <= St_ERROR;
                else
                    next_state <= St_BOS_1;
                end if;
            when St_BOS_3 =>
                if (valid = '1' and din = "000") THEN
                    next_state <= St_BOS_4;
                elsif (valid = '1' and din > "111") THEN
                    next_state <= St_ERROR;
                else
                    next_state <= St_BOS_1;
                end if;
            when St_BOS_4 =>
                if (valid = '1' and din = "111") THEN
                    next_state <= St_DECODE;
                elsif (valid = '1' and din > "111") THEN
                    next_state <= St_ERROR;
                else
                    next_state <= St_BOS_1;
                end if;
            when St_EOS_1 =>
                if (valid = '1' and din = "111") THEN
                    next_state <= St_EOS_2;
                elsif (valid = '1' and din > "111") THEN
                    next_state <= St_ERROR;
                else
                    next_state <= St_BOS_1;
                end if;
            when St_EOS_2 =>
                if (valid = '1' and din = "000") THEN
                    next_state <= St_EOS_3;
                elsif (valid = '1' and din > "111") THEN
                    next_state <= St_ERROR;
                else
                    next_state <= St_BOS_1;
                end if;
            when St_EOS_3 =>
                if (valid = '1' and din = "111") THEN
                    next_state <= St_EOS_4;
                elsif (valid = '1' and din > "111") THEN
                    next_state <= St_ERROR;
                else
                    next_state <= St_BOS_1;
                end if;
            when St_EOS_4 =>
                if (valid = '1' and din = "000") THEN
                    next_state <= St_Out;
                elsif (valid = '1' and din > "111") THEN
                    next_state <= St_ERROR;
                end if;
            when St_DECODE =>
                if (valid = '1') THEN
                    for i in 0 to 7 loop
                        if (din = "001") THEN
                            if (din = "010") THEN
                                dout <= x"41";
                            elsif (din = "011") THEN
                                dout <= x"42";
                            elsif (din = "100") THEN
                                dout <= x"43";
                            elsif (din = "101") THEN
                                dout <= x"44";
                            elsif (din = "110") THEN
                                dout <= x"45";
                            end if;
                        elsif (din = "010") THEN
                            if (din = "001") THEN
                                dout <= x"46";
                            elsif (din = "011") THEN
                                dout <= x"47";
                            elsif (din = "100") THEN
                                dout <= x"48";
                            elsif (din = "101") THEN
                                dout <= x"49";
                            elsif (din = "110") THEN
                                dout <= x"4A";
                            end if;
                        elsif (din = "011") THEN
                            if (din = "001") THEN
                                dout <= x"4B";
                            elsif (din = "010") THEN
                                dout <= x"4C";
                            elsif (din = "100") THEN
                                dout <= x"4D";
                            elsif (din = "101") THEN
                                dout <= x"4E";
                            elsif (din = "110") THEN
                                dout <= x"4F";
                            end if;
                        elsif (din = "100") THEN
                            if (din = "001") THEN
                                dout <= x"50";
                            elsif (din = "010") THEN
                                dout <= x"51";
                            elsif (din = "011") THEN
                                dout <= x"52";
                            elsif (din = "101") THEN
                                dout <= x"53";
                            elsif (din = "110") THEN
                                dout <= x"54";
                            end if;
                        elsif (din = "101") THEN
                            if (din = "001") THEN
                                dout <= x"55";
                            elsif (din = "010") THEN
                                dout <= x"56";
                            elsif (din = "011") THEN
                                dout <= x"57";
                            elsif (din = "100") THEN
                                dout <= x"58";
                            elsif (din = "110") THEN
                                dout <= x"59";
                            end if;
                        elsif (din = "110") THEN
                            if (din = "001") THEN
                                dout <= x"5A";
                            elsif (din = "010") THEN
                                dout <= x"5B";
                            elsif (din = "011") THEN
                                dout <= x"5C";
                            elsif (din = "100") THEN
                                dout <= x"5D";
                            elsif (din = "101") THEN
                                dout <= x"5E";
                            end if;
                        end if;
                        dvalid <= '1';
                    end loop;
                next_state <= St_EOS_1;
                end if;
        end case;
    end process;

    output_logic: process (state)
    begin
        if (state = St_Out and valid = '1') THEN
            next_state <= St_RESET;
        end if;
    end process;

end Behavioral;

A: I suggest checking your code. It is missing a choice for St_Out of the state signal. Case statement must cover all possible values. This can be done using the when others => case, but this may not be suitable.
You will also have issues with this code. Your state_logic process is missing many signals. This will lead to simulation synthesis mismatch. You need to put every signal read inside the process inside the sensitivity list for an asynchronous process.
An easy fix for this is to use the VHDL 2008 process(all). This will force the compiler to work what the sensitivity list should be from the code inside the process.


Q: working out an average I have a nested list like so:
temperature = [["Jan", 12, 18, 16, 18], ["Feb", 10, 20, 50, 50], ["Mar", 23, 32, 10, 32]]

the list contains all the months up until December with the 3 highest temp recorded over the entire month and then the highest out of the 3 appended to the end of the list.
I have worked out the highest temp for each month in the following way:
def sortTemp():
    for temp in temperatures:
        temp = [temp[0], temp[4]]
        highest.append(temp)
    highest.sort()
    print(highest)

This works, however I had to work out the max values beforehand, and append it to the temperature list as explained above. Is there an easier way to do this?
Also, how do I work out the average temp of each month using the data provided in the temperature list, sorted by the highest average?
Output should be like:
AverageTemp = [["Month", AverageTemp], ["Month", AverageTemp]]

A: You can use a list comprehension to compute the averages
>>> AverageTemp = [[i[0], sum(i[1:])/len(i[1:])] for i in temperature]
>>> AverageTemp
[['Jan', 16.0], ['Feb', 32.5], ['Mar', 24.25]]

Or if you have numpy
>>> import numpy as np
>>> AverageTemp = [[i[0], np.mean(i[1:])] for i in temperature]
>>> AverageTemp
[['Jan', 16.0], ['Feb', 32.5], ['Mar', 24.25]]

Then to sort you can use the key and reverse arguments
>>> AverageTemp = sorted([[i[0], np.mean(i[1:])] for i in temperature], key = lambda i: i[1], reverse = True)
>>> AverageTemp
[['Feb', 32.5], ['Mar', 24.25], ['Jan', 16.0]]

A: You can use a list comprehension within sorted function :
>>> from operator import itemgetter
>>> sorted([[l[0],sum(l[1:])/4]for l in temperature],key=itemgetter(1),reverse=True)
[['Feb', 32], ['Mar', 24], ['Jan', 16]]

In preceding code you first loop over your list then get the first element and the avg of the rest by [l[0],sum(l[1:])/4] and use operator.itemgetter as the key of your sorted function to sort your result based on the second item (the average)

A: Understanding more about list comprehension and slice notation will really help you do this simply with pythonic code.
To explain @CoryKramer's first answer:
>>> AverageTemp = [[i[0], sum(i[1:4])/len(i[1:4])] for i in temperature]
>>> AverageTemp
[['Jan', 15], ['Feb', 26], ['Mar', 21]]

What he is doing is using i to cycle through the lists in temperature (which is a list of lists) and then using slice notation to get the info you need. So, obviously i[0] is your month, but the notation sum(i[1:4]) gets the sum of the items in the list from index 1 to the 3 using slice notation. He then divides by the length and creates the list of lists AverageTemp with the information you need.
Note: I have edited his answer to not include the high temperature twice per the comment from @TigerhawkT3.

A: That's not a very good structure for the given data: you have differentiated items (name of a month, temperatures, maximum temperature) as undifferentiated list elements. I would recommend dictionaries or objects.
months = {"Jan":[12, 18, 16], "Feb":[10, 20, 50], "Mar":[23, 32, 10]}
for month in sorted(months, key=lambda x: sum(months.get(x))/len(months.get(x)), reverse=True):
    temps = months.get(month)
    print(month, max(temps), sum(temps)/len(temps))

Result:
Feb 50 26.666666666666668
Mar 32 21.666666666666668
Jan 18 15.333333333333334

class Month:
    def __init__(self, name, *temps):
        self.name = name
        self.temps = temps
    def average(self):
        return sum(self.temps)/len(self.temps)
    def maximum(self):
        return max(self.temps)
months = [Month('Jan', 12, 18, 16), Month('Feb', 10, 20, 50), Month('Mar', 23, 32, 10)]
for month in sorted(months, key=lambda x: x.average(), reverse=True):
    print(month.name, month.maximum(), month.average())

Result:
Feb 50 26.666666666666668
Mar 32 21.666666666666668
Jan 18 15.333333333333334


Q: Symbol to method call Is there a way to transform a symbol to a method call? I know it's possible for a String, but not for a symbol. I have this code in conveyance.rb:
def boats
  boats = []
  User.all.each{ |u| boats += u.boats}
  boats
end
def boats_nb
  self.boats.length
end
def cars
  cars = []
  User.all.each{ |u| cars += u.cars}
  cars
end
def cars_nb
  self.cars.length
end

I would like to know if there is a means to make a method like that:
def conveyances(:symb)
  c = []
  User.all.each{ |u| c += u.to_method(:symb) }
  c
end
def conveyances_nb(:symb)
  User.to_method(:symb).length
end

A: You could use Object#public_send method:
def conveyqnces_nb(symb)
  User.public_send(symb).length
end

or, if you would like, Object#send might be suitable. The difference is that send allows to call private and protected methods, while public_send acts as typical method call - it raises an error if method is private or protected and the caller object isn't allowed to call it.

A: Use the #send instance method
u.send(:symb)


Q: input css rendering inconsistencies across browsers The input button is incorrectly higher than the input field.
I used Firebug to copy all the styles applied to the 3 elements in question (the containing p element and the 2 child input elements) to replicate the problem.
http://jsfiddle.net/XBjz3/
I have a feeling it's to do with me using negative relative positioning on the input button.
Displays as it should in

*

*Firefox 12

*Chrome 19

*Internet Explorer 9

Displays wrong in

*

*Android 2.3.5 browser

*iOS 5.1 browser

*Safari 5.1.7

*Opera 11.6

It's strange that it displays fine in Chrome when the 3 other webkit browsers renders it incorrectly.

A: Instead of using
top:-0.5em;

You can use
bottom : 0.4em;

As its not good practice to use negative values for position.

A: check this one i hope this will help you..
HTML
<p>
    <input type="password" class="pw-box" id="pwbox-33" name="post_password">
    <input type="submit" class="pw-submit" value="Submit" name="Submit">
</p>

CSS
p {

    width:50%;
    display: inline;
    float: left;
    padding-left: 1%;
    padding-right: 1%;
    position: relative;
    font-size: 1em;
    line-height: 1.5em;
    margin:20px 0 0 20px;
    background:rgba(0,0,0,0.1);

}
#pwbox-33 {
    width: 200px;
    border:0;
    background: #606D80;
    border-top:solid 1px  #1F3453;
    color: #DCE0E6;
    margin: 0;
    padding: 0.5em;
    text-shadow: 0 1px 0 #1F1F20;
    vertical-align: top;
}
.pw-submit{
cursor: pointer;
    background:#2B4C7E;
    color: #DCE0E6;
    padding: 0.5em 1em;
    position: absolute;
    text-shadow: 0 -1px 0 #1F1F20;
    top: -0.3em;
    border:0;
    font-size:12px;
    font-family:arial;
    left:200px;
    border-bottom:solid 0.5em #0E2952;
    outline:0;

}

http://jsfiddle.net/YjNJ5/3/

A: Found a solution that looks exactly the same as intended.
http://jsfiddle.net/XBjz3/8/
Here are the changes from the original.
#pwbox-33 {
    vertical-align: bottom;
}
.pw-submit {
    top: 0;
    vertical-align: bottom;
}

Tested to work on Firefox, Chrome, IE, Safari, Opera, and Android stock browser.


Q: iPhone simulator screenshot not capturing device bezel I'm trying to capture a simulator screenshot using Xcode 12. Right now, even though the "Show Device Bezels" option is enabled (and it shows the bezels on the screen), when I take the screenshot, the bezel isn't part of the resulting screenshot. I've tried through the camera button on the simulator, through the "Save Screen" menu item, through "xcrun simctl screenshot" command-line as well, but it doesn't work correctly.
Weirdly, it was working fine just yesterday, but I was playing with setting the "defaults write com.apple.screencapture disable-shadow -bool TRUE" from the command-line (to prevent the shadow in video capture of the window) ... I'm not sure if that's related to this issue, and I flipped it back to FALSE, but that doesn't seem to help either.
I've also tried restarting the simulator, restarting the Mac, switching "Show Bezel" on/off, using Xcode11, erasing contents of simulator.... but it's still not working. Very frustrating.
This is what it looks like:

Any tips of what I can try?
Thanks.

A: The bezel is not saved as part of the screenshots from Simulator.app / simctl.  The only option you have is whether or not the framebuffer mask is applied.
If you want the bezel, you'll need to use the macOS screenshot support.  Hit shift-cmd-4, then hit space to toogle from "draw the rectangle" mode to "select the window" mode.  Then click on the window to take a screenshot.


Q: Redundant distributed NFS file system and replication factor > 1. Is it safe for Kafka deployment? I have a cluster Kafka set up where the log.dir is set to a mounted NFS path pointing to distributed file system which all the brokers have access to.
Since the distributed file system provides all the redundancy I need, is it really necessary have a replication factor > 1?
Also, I read in this article https://engineering.skybettingandgaming.com/2018/07/10/kafka-nfs/ that you are not recommended to have the logs on an NFS mounted filesystem. Does this still hold and does anyone have any more experience in doing this?

A: From the storage side, maybe this is safe, but your single replica is only able to be read / sent from a single broker.
If that machine goes down, the data will still be available on your backend, sure, but you cannot serve requests for it without knowing there is another replica for that topic (replication factor < 2).


Q: Output only one blank line fresh-line outputs a newline only if we are not already at start of the line, in other words goes to the next line but never produces a blank line, in other words outputs a maximum of one consecutive newline character.
I need a function that outputs a blank line only if we have not just output one already, in other words outputs a maximum of two consecutive newline characters.
Or put another way, I'm looking for an idempotent blank-line function, one which will output exactly one blank line even if called several times.
What's the best way to do this?

A: If I understand correctly your question, I think you can use the following property of fresh-line (see the manual):

fresh-line returns true if it outputs a newline; otherwise it returns false.

to define something like:
(defun my-fresh-line ()
  (unless (fresh-line)
    (terpri)))

If, on the other hand, you want always a blank line after the current written text, be it terminated with a new line or not, you can define something like:
(define blank-line ()
  (fresh-line)
  (terpri))

and then call it after the current output.


Q: jboss-eap-6.1 oracle driver definition when installed as deployment I have several Jboss EAP 6.1 installations working with Oracle driver installed as a module.
This is the standard configuration I use in standalone.xml:
<datasource jndi-name="java:jboss/fooDatasource" pool-name="java:jboss/fooDatasource" enabled="true" use-java-context="false" >
 <connection-url>jdbc:oracle:thin:@1.2.3.4:1527/SOMEDB.foo</connection-url>
 <driver>oracle</driver>
     <security>
         <user-name>xxxxx</user-name>
             <password>xxxxxxxxx</password>
     </security>
 [...]
</datasource>
<driver name="oracle" module="oracle.jdbc">
    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
    <datasource-class>oracle.jdbc.OracleDriver</datasource-class>
</driver>

The ojdbc6.jar is in $JBOSS_HOME/modules/system/layers/base/oracle/jdbc/main/ together with the appropriate module.xml and everything works fine.
Now a customer required to install the driver as a deployment, so I moved ojdbc6.jar to $JBOSS_HOME/standalone/deployments/ and I see from logs that it is deployed without errors:
[org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) JBAS010403: Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 11.2)
INFO  [org.jboss.as.server] (ServerService Thread Pool -- 25) JBAS018559: Deployed "ojdbc6.jar" (runtime-name : "ojdbc6.jar")

But I don't know how to edit my standalone.xml to make it work again: i tried to edit the driver definition "module" attribute with several different values (ojdbc6.jar, deployment.ojdbc6.jar, oracle.jdbc.OracleDriver...) but none seem to "match" and Jboss keeps throwing errors at startup:
ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 24) JBAS014613: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "oracle")
]) - failure description: "JBAS010441: Failed to load module for driver [ojdbc6.jar]"
[...]
INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
  service jboss.jdbc-driver.oracle (missing) dependents: [service jboss.driver-demander.java:jboss/spiDatasource, service jboss.data-source.java:jboss/fooDatasource]

Could anyone please provide a working example of the driver definition?
Thanks

A: Ok, I found the answer myself.
Surprisingly, all the guides I found around explain how to do this configuration via web admin interface or via jboss-cli, but no one in the Jboss community seem to bother explaining how to manually edit the standalone.xml to do the job.
This is a working example (basically I just deleted the entire Oracle driver definition section and replaced the driver name in the datasource definition with the name of the runtime name of the deployed jar file):
<datasource jta="false" jndi-name="java:/jdbc/fooDS" pool-name="foo-ds" use-ccm="false">
    <connection-url>jdbc:oracle:thin:@1.2.3.4:1527/SOMEDB.foo</connection-url>
    <driver-class>oracle.jdbc.OracleDriver</driver-class>
    <driver>ojdbc6.jar</driver>

    [...] other datasource stuff here

</datasource>

# DELETE FROM HERE...
<driver name="oracle" module="oracle.jdbc">
    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
    <datasource-class>oracle.jdbc.OracleDriver</datasource-class>
</driver>
# ...TO HERE

That's all.

A: Probably you have to mention in this way...
<subsystem xmlns="urn:jboss:domain:datasources:1.1">
        <datasources>
            <datasource jndi-name="java:jboss/XXX" pool-name="XXX"     enabled="true" use-java-context="true">
                <connection-url>jdbc:oracle:thin:@SID:PORT:DBNAME</connection-url>
                <driver>oracle</driver>
                <security>
                    <user-name>user</user-name>
                    <password>password</password>
                </security>
            </datasource>
            <drivers>
                <driver name="oracle" module="com.oracle">
                    <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                    <datasource-class>oracle.jdbc.OracleDriver</datasource-class>
                </driver>
            </drivers>
        </datasources>
</subsystem>

A: *

*Create directories like x1/x2/main

*Create module.xml file under main directory

*Keep ojdbc6-11.1.1.3.0.jar  in main directory level

In Module.xml
<module xmlns="urn:jboss:module:1.1" name="x1.x2">
<properties>
    <property name="jboss.api" value="unsupported"/>
</properties>
<resources>
    <resource-root path="ojdbc6-11.1.1.3.0.jar"/>
</resources>
<dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
    <module name="javax.servlet.api" optional="true"/>
</dependencies>

In domain.xml
<datasource jndi-name="java:/TestName" pool-name="TestName" enabled="true" use-java-context="true">
                    <connection-url>jdbc:oracle:thin:@ldap://xxxxx:3000/UKXXX,cn=OracleContext,dc=dcm,dc=XXXX</connection-url>
                    <driver>dps</driver>
                    <security>
                        <user-name>XXXXX</user-name>
                        <password>*****</password>
                    </security>
                </datasource>
                <drivers>
                    <driver name="dps" module="x1.x2">
                        <xa-datasource-class>oracle.jdbc.driver.OracleDriver</xa-datasource-class>
                    </driver>
                    </driver>
                </drivers>

Try to keep the correct ojdbc jar, some versions won't work :)


Q: prototype.js innerHTML does not work with IE Apparently IE (10) does not like this piece of code:
$('size_list').innerHTML = '<form id="dropdown_menu"><select id="dropdown_options"></select></form>';

The dropdown menu is not being generated. I get an Unknown Run Time error, which is really "helpful". The next line of code is:
$('dropdown_options').innerHTML = '<option>Choose size</option>';

But when I debug - I don't even get till here.
The 'size_list' element is just a simple empty div:

I found some info that states .innerHTML does not really work with IE, but I have many other places in my script where I assign even bigger chunks of HTML to div elements, through .innerHTML and all works. Except the upper stated assigning of dropdown form.

A: Try this:
$('#size_list').html('<form id="dropdown_menu"><select id="dropdown_options"></select></form>');
$('#dropdown_options').html('<option>Choose size</option>');

You can't use a hammer as a wrench...
Or use document.getElementById('size_list').innerHTML or use $('#size_list').html()
Don't forget to put a # before an id selector in jQuery and a . before a class selector otherwise jQuery tries to find a <size_list> tag which won't exist in the DOM tree.

A: First of all, while it may be convenient to add select options using the direct insert html methods, it rarely works universally. The bulletproof way to add options to a select is to build them up one at a time in a loop, assigning their value and label the old-fashioned way.
var form = new Element('form', {id: 'dropdown_menu' });
var picker = new Element('select', {id: 'dropdown_options', size: 1 });
$('size_list').insert(form);
form.insert(picker);
picker.options[picker.options.length] = new Option('Choose size', '');
// want to add a list of elements in a loop?
$w('Foo Bar Baz').each(function(val){
  picker.options[picker.options.length] = new Option(val, val);
});

IE has never dealt with modifications of the select element gracefully at all, this goes back to IE 5 when I first started trying to do this sort of thing.


Q: jQuery focus after submit on last input field edited On jQuery keyup on two IDs a function is executed.
$('#supplier_name').keyup(function(){
    clearTimeout(typingTimer);
    if ($('#supplier_name').val) {
        typingTimer = setTimeout(doneTyping, doneTypingInterval);
    }
    $.cookie("inputFocus", "#supplier_name");
});

After this the form is submitted. I want to do jQuery .focus on the ID which led the keyup function to execute.
So if I entered text into #supplier_name after form submit I want the focus to be on that. Vice versa with #aircraft_type.
EDIT: I am trying to do this via cookies however it doesn't seem to be working.
How do I do this with the following jQuery code:
<script>
$(document).ready(function() {
    $("#state").change(function () {
    this.form.submit();
})
$.cookie("inputFocus").focus();
$("#supplier_name").val($("#supplier_name").val());
$("#aircraft_type").val($("#aircraft_type").val());
var typingTimer;
var doneTypingInterval = 800;

$('#supplier_name').keyup(function(){
    clearTimeout(typingTimer);
    if ($('#supplier_name').val) {
        typingTimer = setTimeout(doneTyping, doneTypingInterval);
    }
    $.cookie("inputFocus", "#supplier_name");
});

$('#aircraft_type').keyup(function(){
    clearTimeout(typingTimer);
    if ($('#aircraft_type').val) {
        typingTimer = setTimeout(doneTyping, doneTypingInterval);
    }
    $.cookie("inputFocus", "#aircraft_type"); });

function doneTyping () {
    $("form").submit();
}

});
</script>

A: The solution to the above problem was to create an object to use focus() and to add the jQquery cookie plug-in.
The change is below:
"$.cookie("inputFocus").focus();" to "$($.cookie("inputFocus")).focus()"
Added the below code to the page:
""


Q: Pass all uncaught errors from the framework to Crashlytics with custom parameter I got uncaught errors form the framework to Crashlytics. But it is difficult to fix the issue because I don't know which screen or record caused the error.
For example below error, I only know that it is invalid image from CacheNetworkImage package. But It is very difficult to find out which screen or which record.
Is there any way to pass screen name or custom parameter. I can't find the way to record.

Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError:
Exception: Invalid image data. Error thrown Instance of
'ErrorDescription'.
at .instantiateImageCodec(dart:ui)
at ImageLoader.loadAsync(_image_loader.dart:59)
at new MultiImageStreamCompleter.(multi_image_stream_completer.dart:25)

Below code pass all uncaught errors from the framework to Crashlytics.
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;

A: Use setCustomKey to add values to reports.
FirebaseCrashlytics.instance.setCustomKey('str_key', 'hello');

See Customize your Firebase Crashlytics crash reports for details.


Q: EclipseFP on Indigo, issues with Maven? I'm trying to install EclipseFP, using the usual Eclipse "Install new software" approach. However, at the "Installation Details" window, it says "This operation cannot be completed", giving me the following details:
Cannot complete the install because one or more required items could not be found.
  Software currently installed: Shared profile 1.0.0.1316138547364
      (SharedProfile_epp.package.java 1.0.0.1316138547364)
  Missing requirement: Shared profile 1.0.0.1316138547364
      (SharedProfile_epp.package.java 1.0.0.1316138547364)
    requires 'org.maven.ide.eclipse [1.0.100.20110804-1717]'
    but it could not be found

I just barely downloaded a fresh Eclipse:
Eclipse IDE for Java Developers
Version: Indigo Service Release 1
Build id: 20110916-0149

Does EclipseFP actually work on Indigo? Do I need to download an older Eclipse? Or perhaps there are additional steps I need to take to install Maven? (I don't want to download/install Maven if I don't have to.)

A: Since Kane neglected to turn his comment into an answer, I may as well state it plainly here:
This issue arises when you put the Eclipse folder in a location where Windows will have issues with access control (e.g. the Program Files folder). By moving the folder to my personal user's folder, I was able to use Eclipse normally without this issue.


Q: audio html5 with jquery to play next track I have html5 like this
<audio controls class="audioPlayer" >
     <source class="iSong" src="1.mp3" type="audio/mpeg">
     <source class="iSong" src="2.mp3" type="audio/mpeg">
     <source class="iSong" src="3.mp3" type="audio/mpeg">
     Your browser does not support the audio element.
</audio>

I want add jquery for button nextSong because my song always play only last one.

A: Adding multiple sources to an audio element does not create a playlist, it is to support different audio formats and your browser will simply play the first one it can, which is why you say only the last one is playing.
To have multiple songs you choose between you will have to write some javascript. Here is some information on audio in javascript.
It sounds like you will have to create a separate button for playing the next song, add a click event that changes the source of the audio element and plays it.


Q: Issue querying a materialized view redshift I've created a materialized view in redshift as follows:
create materialized view stats as
select *
from t1

however when i try to query it:
select * from stats

I get this error:
[2022-06-26 15:09:35] [XX000] ERROR: Failed assertion at rewriteHandler.c:883 - CheckMvInternalTables(mv_id). invalid MV internal tables.
I can't find anything on the internet about this so I'm a bit at a loss. Any clues on where i can go with this?

A: Solution:
Set AutoRefresh to ON on the mv (as it defaults to off). Or manually trigger the refresh.


Q: Code is working properly but if data is empty that time validation is not working i have made a code generated random number and save all number in database(that part of code is working) but i have problem in validation without enter any no on view page redirect this url admin_manage_epin.ctp, validation not working
admin_create_epin.ctp(view)

Add E-pin:(No of E-Pin)
<?php echo $this->Form->input('e_pin',array('label'=>false));?>

epins_controllers.php(controller)
public function admin_create_epin(){
 if(!empty($this->data)){
   $limit = $this->data['Epin']['e_pin'];

   for($i=0;$i<$limit;$i++)
     {
     $random = substr(number_format(time() * rand(),0,'',''),0,11)."
";
     $this->data['Epin']['e_pin'] = $random;
     $this->Epin->id =null;
     $this->Epin->save($this->data);
   }

      $this->Session->setFlash("Epin has been added");
      $this->Redirect(array('action'=>'admin_manage_epin'));
   }
 }

epin.php(model)
<?php class Epin extends appModel{
var $name ="Epin";
var $validate = array(
                      'e_pin'=>array(
                        'rule'=>'notEmpty',
                        'message'=>'Please type No of epin'
                      ));
  }
 ?>

i think i have problem in my controller function admin_create_epin
thanks

A: You should probably check if the actual field is empty - since submitting a form will still have an array:
if(!empty($this->data['Epin']['e_pin'])) {

Within your for() loop, you should be using create() and don't set id:
for($i=0;$i<$limit;$i++) {
    $this->Epin->create();
    $random = substr(number_format(time() * rand(),0,'',''),0,11)."
";
    $this->data['Epin']['e_pin'] = $random;
    //...

Your redirect should be lowercase:
$this->redirect(...

It's quite difficult to understand what you're actually asking, but if you're trying to redirect if the form was submitted empty, the redirect should be one more level out:
    }
    $this->Session->setFlash("Epin has been added");
    $this->Redirect(array('action'=>'admin_manage_epin'));
}


Q: Choose a number from a a given pmf in theano Say I have an array p = [ 0.27, 0.23, 0.1, 0.15, 0.2 ,0.05]. Let p be a probability mass function for a Random Variable X.  Now, I am writing a theano code, where I have a p generated at each iteration and  I also have n weight matrices. (Here[n = 6].)
Now, in each iteration I would want to select one of these weight matrices for further propagation. Could someone help out regarding how to write this piece of code. I am not sure I can write the exact code required to enable backpropagation(i.e. have the gradients corrected properly)
Note that all the W_is as well as the enter p are model parameters.

Edit

 W1,W2,W3,W4,W5,W6,x,eps = T.dmatrices("W1","W2","W3","W4","W5","W6","x","eps")

    b1,b2,b3,b4,b5,b6,pi = T.dcols("b1","b2","b3","b4","b5","b6","pi")

   h_encoder = T.tanh(T.dot(W1,x) + b1)

    rng = T.shared_randomstreams.RandomStreams(seed=124)

    i = rng.choice(size=(1,), a=self.num_model, p=T.nnet.softmax(pi))

    mu_encoder = T.dot(W2[i[0]*self.dimZ:(1+i[0])*self.dimZ].nonzero(),h_encoder) + b2[i[0]*self.dimZ:(1+i[0])*self.dimZ].nonzero()

    log_sigma_encoder = (0.5*(T.dot(W3[i[0]*self.dimZ:(1+i[0])*self.dimZ].nonzero(),h_encoder)))+ b3[i[0]*self.dimZ:(1+i[0])*self.dimZ].nonzero()

    z = mu_encoder + T.exp(log_sigma_encoder)*eps`

and my grad vaiables are gradvariables = [W1,W2,W3,W4,W5,b1,b2,b3,b4,b5,pi] Ignore the other variables as they are defined somewhere else. Now, I get the following error

  Traceback (most recent call last):
    File "trainmnist_mixture.py", line 55, in
      encoder.createGradientFunctions()
File "/home/amartya/Variational-Autoencoder/Theano/VariationalAutoencoder_mixture.py", line 118, in createGradientFunctions
      derivatives = T.grad(logp,gradvariables)
File "/usr/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg/theano/gradient.py", line 543, in grad
      grad_dict, wrt, cost_name)
File "/usr/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg/theano/gradient.py", line 1273, in _populate_grad_dict
      rval = [access_grad_cache(elem) for elem in wrt]
File "/usr/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg/theano/gradient.py", line 1233, in access_grad_cache
      term = access_term_cache(node)[idx]
File "/usr/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg/theano/gradient.py", line 944, in access_term_cache
      output_grads = [access_grad_cache(var) for var in node.outputs]
File "/usr/lib/python2.7/site-packages/Theano-0.6.0-py2.7.egg/theano/gradient.py", line 1243, in access_grad_cache
      term.type.why_null)
theano.gradient.NullTypeGradError: tensor.grad encountered a NaN. This variable is Null because the grad method for input 0 (Subtensor{int64:int64:}.0) of the Nonzero op is mathematically undefined

A: You can use the choice method of a RandomStreams instance. More on random numbers in Theano can be found in the documentation here and here.
Here's an example:
import numpy
import theano
import theano.tensor as tt
import theano.tensor.shared_randomstreams

n = 6
alpha = [1] * n
seed = 1
w = theano.shared(numpy.random.randn(n, 2, 2).astype(theano.config.floatX))
p = theano.shared(numpy.random.dirichlet(alpha).astype(theano.config.floatX))
rng = tt.shared_randomstreams.RandomStreams(seed=seed)
i = rng.choice(size=(1,), a=n, p=p)
f = theano.function([], [p, i, w[i]])
print f()
print f()
print f()
print f()


Q: SSRS-what is the syntax for the Target Server URL in SSRS2008R2 can anyone help me out with the syntax and example for the target server URL in SSRS 2008R2 inorder to deploy my reports??

A: are you deploying to sharepoint or a standalone (native-mode) report server?
http://msdn.microsoft.com/en-us/library/ms155802(v=sql.105).aspx

10.In the TargetServerURL text box, type the URL of the target report server. Before you publish a report, you must set this property to a
  valid report server URL. When publishing to a report server running in
  native mode, use the URL of the virtual directory of the report server
  (for example, http://server/reportserver or
  https://server/reportserver). This is the virtual directory of the
  report server, not Report Manager.
When publishing to a report server running in SharePoint integrated
  mode, use a URL to a SharePoint top-level site or subsite. If you do
  not specify a site, the default top-level site is used (for example,
  http://servername, http://servername/site or
  http://servername/site/subsite).


Q: Mailbox unavailable. The server response was: 5.7.1 Invalid credentials for relay At our office others can use the .NET SMTP client to send email via our Google Apps account.  Using the exact same settings and credentials this does not work on a particular machine.  It seems to be just this one machine with this issue.  I get:
Mailbox unavailable. The server response was: 5.7.1 Invalid credentials for relay

We are all on the same external IP, so it's not

A: Aha!  We found the smoking gun.  Here is what the message actually says:

SmtpException: Mailbox unavailable. The server response was: 5.7.1
  Invalid credentials for relay [ffff:fff:ffff:ffff:ffff:ffff:ffff:ffff]

I've obfuscated the last part, but note that the IP address this appears to come from is an IPV6 address.  Out relay whitelist only includes IPV4 addresses.  So I turned IPV6 off on that machine - because honestly, what is that good for anyway?


Q: How to draw a Polygon on MapView, fill it, and put a onTouch Event on it Is it possible to set an EventListener in a drawn Polygon in a osmdroid MapView Overlay ? I would like to print on a Overlay and after touching it I would like to change its color or handle data behind a Polygon.
For Example:
Poly1: ID = 1337, P1(0,0),P2(1,0),......,Pn(0,0)
Poly2: ID = 42 , P1(10,7),P2(18,39),......,Pn(10,7)
After touching in Poly1 I want to know aha ID 1337 is pressed. An want to change its color.
How could I implement such a behavior ?

A: Use this documentation to draw the polygons
Use this to listen for map clicks
Use this to determine if a touch is inside one of the polygons
I'm not sure that geometry library can run on android, so feel free to replace the third component.
EDIT:
Misread the question and associated it with google maps, sorry.

A: Here is how to draw and fill a polygon (rectangle example):
ArrayList bgRectPoints = new ArrayList<>();
    GeoPoint pt1 = new GeoPoint(-15.953548, 126.036911);
    bgRectPoints.add(pt1);
    GeoPoint pt2 = pt1.destinationPoint(10000, 0);
    bgRectPoints.add(pt2);
    GeoPoint pt3 = pt2.destinationPoint(10000, 90);
    bgRectPoints.add(pt3);
    GeoPoint pt4 = pt3.destinationPoint(10000, 180);
    bgRectPoints.add(pt4);
    bgRectPoints.add(pt1);

    Polygon polygon = new Polygon();
    polygon.setPoints(bgRectPoints);
    polygon.setFillColor(Color.BLACK);

    mapView.getOverlays().add(polygon);

To receive touch/Tap initialize polygon like this:
    Polygon polygon = new Polygon(){
        @Override
        public boolean onSingleTapConfirmed(MotionEvent event, MapView mapView) {
            Toast.makeText(context, "Polygon clicked!",Toast.LENGTH_SHORT).show();
            return super.onSingleTapConfirmed(event, mapView);
        }
    };

More can be found here


Q: Why does my div dont go fullscreen? why does my button expand down in height and not equally to the top and bottom so it would cover the fullscreen?
And the Border lines should stop at the size of the parent div... I cant make it work.. do you have any ideas? (to make the doggies disappear :DD)

var main = function(){
    $('#Music').click(function(){
        $('#soundcloud').animate({
            bottom:'0px'
        },200);

        $('body').animate({
            bottom:'285px'
        }, 200);

    });

    $('#Home').click(function(){
        $('#title').css("-webkit-text-fill-color", "transparent")
        $('.dick').css("background-image", "url(RegenBack.jpg)")
        $('#soundcloud').animate({
            bottom:'-285px'
        },200);

        $('body').animate({
            bottom:'0px'
            },200);
    });

    $('#button').mouseup(function () {
        var d = {};
        $('#button').removeClass('shadow')
        $('#button').find('p').removeClass('textshadow')
        $('#button').find('p').css("visibility", "hidden")
        $('#button').css("z-index", "999")
        $('#button').removeClass('shadow')
        $('#button').animate({
            width: '100%'
        },500,function() {
            $('#button').animate({
                height: '100%'
            }, 500);
        });

    });

    $('#button').mousedown(function() {
        $('#button').find('p').addClass('textshadow')
        $('#button').addClass('shadow')

    });

};

$(document).ready(main);
.menu{
    overflow: hidden;
    margin-top: 50px;
}

#button p{
    margin-left: auto;
    margin-right: auto;
    margin-top: -15px;
    font-size: 100px;
    font-family: mySecondFont;
    -webkit-user-select: none; /* Chrome/Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+ */
}
#button{
    background: url(https://pbs.twimg.com/profile_images/378800000532546226/dbe5f0727b69487016ffd67a6689e75a.jpeg) fixed;
    width: 622px;
    height: 148px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 200px;
    margin-bottom: auto;
    cursor: pointer;
    border-style: solid;
    border-width: 10px 10px 10px 10px;
    border-color: white black black white;
    border-radius: 10px;
    -webkit-box-shadow: inset -3px -3px 0px 0px rgba(255,255,255,1);
}

.textshadow{
    background-color: #000000;
    color: transparent;
    text-shadow: 0px 2px 3px rgba(255,255,255,0.5);
    -webkit-background-clip: text;
    -moz-background-clip: text;
    background-clip: text;
}

.shadow {
    -webkit-box-shadow: inset 9px 9px 15px 0px rgba(0,0,0,0.75).inset -2px -2px 15px 0px rgba(255,255,255,1) !important;
    -moz-box-shadow: inset 9px 9px 15px 0px rgba(0,0,0,0.75), inset -2px -2px 15px 0px rgba(255,255,255,1) !important;
    box-shadow: inset 9px 9px 15px 0px rgba(0,0,0,0.75), inset -2px -2px 15px 0px rgba(255,255,255,1) !important;
}

#soundcloud{
    bottom: -200px;  /* start off behind the scenes */
    height: 200px;
    position: fixed;
    width: 100%;
    background-color: #ffffff;
}

div div div div  p{
    border: 5px solid white;
    text-align: center;
    color: #ffffff;
    font-size: 70px;
    font-family: myFirstFont;
    text-decoration: none;
}

div div div div p:hover{
    cursor: pointer;
    border-color: grey;
    text-decoration: none;
    color: grey;
}

#Music {
    margin-left: auto;
    margin-right: auto;
    width: 70%;
}

#Home {
    margin-left: auto;
    margin-right: auto;
    width: 70%;
}

#About {
    margin-left: auto;
    margin-right: auto;
    width: 70%;
}

#Media {
    margin-left: auto;
    margin-right: auto;
    width: 70%;
}

.dick {
    position: absolute;
    height: 100%;
    width: 100%;
    background-image: url(http://www.prevention.com/sites/default/files/imagecache/slideshow_display/dog-dogue-de-bordeaux-puppy-410x290.jpg);
}

#title {
    -webkit-user-select: none; /* Chrome/Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+ */
    cursor: default;
    overflow: hidden;
    float: inherit;
    background: url(Textur1.jpg) no-repeat fixed;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-family: mySecondFont;
    font-size: 200px;
    margin-top: 50px;
}

div p{
    text-align: center;
    font-size: 70px;
    color: #ffffff;
}

@font-face {
    font-family: myFirstFont;
    src: url(/Fonts/Bask/BaskOldFace.woff);
}
@font-face {
    font-family: mySecondFont;
    src: url(Fonts/Script/ScriptMTBold.woff);
}

body, hmtl{
    height: 100%;
    width: 100%;
}

<!DOCTYPE html>

        <meta charset="UTF-8">
        <title>Bolle | Music</title>
        <link href="bootstrap-3.3.2-dist/css/bootstrap.css" rel="stylesheet">
        <link href="Bolle%20Music.css" rel="stylesheet">

Get Happy

Im thankful for any tips :)
Greetings
Bolle

A: You have a margin-top property set to 200px on the button. That property stays after the button expands.


Q: combined coffee and js development with Gulp Using Gulp to streamline my build process on a per-save basis, while eliminating the need for "temp" files is my goal (and why I chose to use Gulp over Grunt)
I've recently discovered that, apparently, the coffeescript compiler cannot handle dealing with basic Javascript as a source
So this, errors out:
gulp.task('scripts', function() {

    var stream =
            gulp.src([
                "bower_components/d3/d3.js",
                "bower_components/angular/angular.js",
                "bower_components/foundation/js/foundation.js",
                "public-dev/scripts/app.js",
                "public-dev/scripts/**/*.js",
                "public-dev/scripts/**/*.coffee"
            ])
                .pipe(coffee())
                .pipe(concat('compiled.js'))
                .pipe(gulp.dest('./public/scripts'))
        ;

    return stream;
});

This produces the output/errpr:
[11:58:51] Starting 'scripts'...

events.js:72
        throw er; // Unhandled 'error' event
              ^
/var/www/node.fortiguard.dev/bower_components/d3/d3.js:1:2: error: reserved word "function"
!function() {
 ^

How should I set this up, without again creating any temp files?
What I liked about the LESS compiler, is that it can still be fed straight CSS files and it'd be fine. I was kind of hoping the Coffee compiler would react the same way

A: I use gulp-add-src to do that.
var gulp = require('gulp'),
    coffee = require('gulp-coffee'),
    concat = require('gulp-concat'),
    addsrc = require('gulp-add-src');

// Scripts
gulp.task('coffee', function () {
  return gulp.src('src/coffee/**/*.coffee')
    .pipe(coffee())
    .pipe(addsrc('src/coffee/lib/*.js'))
    .pipe(concat('compiled.js'))
    .pipe(gulp.dest('dist'));
});

A: Sadly, it doesn't. What you can do, is using the underlying event-stream's merge method. Then you'll have one pipeline for the coffee files that gets compiled and one for the javascript side.
Here is an example Gulpfile.coffee:
coffee = require 'gulp-coffee'
es     = require 'event-stream'

gulp.task 'scripts', () ->
  es.merge(
    gulp.src(["public-dev/app.js", "public-dev/scripts/**/*.js"]) # ...
    gulp.src("public-dev/**/*.coffee").pipe coffee()
    )
  .pipe concat 'all.js'
  .pipe gulp.dest "build"

A: I marked Patrick J. S.'s answer as "Correct" becuase in reality, this is exactly what I needed to do.
That said, "event-stream" isn't what I ended up going with, simply because I needed to preserve my dependency structure of files, and event-stream's merge() method does not preserver order nor does it have options to.
Instead I opted for a package called streamqueue, which does preserve order of glob. Probably slower, but order matters in my app unfortunately.  In the future I will try to be as modular as possible.


Q: oracle apex tabular form validation How to add validation to a newly created row in tabular form ?. in normal method when I add validation to a tabular form column it applies to the existing records but not for newly created rows which are added after page load.


Q: PHP - How Can I make this array work? So I've got an array, which gets random images and display them with certain text. Unfortunately, the text won't appear and the if it does, the hyperlink doesn't appear UNDER  the image. Please someone help!!
<?php
define('RANDOM_IMAGES_COUNT', 3);
define('RANDOM_IMAGES_FORMAT', ' alt="%s" title="%3$s"   style="margin-right:10px">');

#------------------------------------------------------------------------------

$images = array (
    array ( 'title' => 'Test 2', 'src' => 'pic2.jpg', 'href' => 'Click Me' ),
    array ( 'title' => 'Test 3', 'src' => 'pic3.jpg', 'href' => 'Click Me' ),
    array ( 'title' => 'Test 4', 'src' => 'pic4.jpg', 'href' => 'Click Me' )
);

#------------------------------------------------------------------------------

if ( count($images) < RANDOM_IMAGES_COUNT ) {
    trigger_error('Not enough images given', E_USER_WARNING);
    exit;
}

#------------------------------------------------------------------------------

for ($i = 0; $i < RANDOM_IMAGES_COUNT; $i++) {
    shuffle($images);

    $tmp = array_shift($images);
    printf( RANDOM_IMAGES_FORMAT, $tmp['src'],$tmp['href'], $tmp['title'] );
}
?>

A: For the positioning of your link under the image, you'd have to work on your CSS. For proper working of the code sample, make following changes:

*

*Update RANDOM_IMAGES_FORMAT to
define('RANDOM_IMAGES_FORMAT', 'Click Me');

*Change the array to:
$images = array (
    array ( 'title' => 'Test 2', 'src' => 'pic2.jpg', 'href' => 'http://mylink.com/path/' ),
    array ( 'title' => 'Test 3', 'src' => 'pic3.jpg', 'href' => 'http://mylink.com/path/' ),
    array ( 'title' => 'Test 4', 'src' => 'pic4.jpg', 'href' => 'http://mylink.com/path/' )
);

*Use printf like this:
printf( RANDOM_IMAGES_FORMAT, $tmp['src'], $tmp['href'], $tmp['title'], $tmp['title'] );

A: Your code have multiple issues:
Constant RANDOM_IMAGES_FORMAT is poorly formatted as HTML it should look like:
define('RANDOM_IMAGES_FORMAT', '');

As for that, the order of printf arguments should be reordered, because we have modified displaying them in RANDOM_IMAGES_FORMAT:
printf( RANDOM_IMAGES_FORMAT, $tmp['src'],$tmp['href'], $tmp['title'] );

In your $images array, links should be only URL, not full links, as you defined then already in RANDOM_IMAGES_FORMAT.
Full code you presented should look like this:
define('RANDOM_IMAGES_COUNT', 3);
define('RANDOM_IMAGES_FORMAT', '');

$images = array (
    array ( 'title' => 'Test 2', 'src' => 'pic2.jpg', 'href' => 'http://mylink.com/path/' ),
    array ( 'title' => 'Test 3', 'src' => 'pic3.jpg', 'href' => 'http://mylink.com/path/' ),
    array ( 'title' => 'Test 4', 'src' => 'pic4.jpg', 'href' => 'http://mylink.com/path/' )
);

if ( count($images) < RANDOM_IMAGES_COUNT ) {
    trigger_error('Not enough images given', E_USER_WARNING);
    exit;
}

for ($i = 0; $i < RANDOM_IMAGES_COUNT; $i++) {
    shuffle($images);

    $tmp = array_shift($images);
    printf( RANDOM_IMAGES_FORMAT, $tmp['src'],$tmp['href'], $tmp['title'] );
}

A:  alt="%s" title="%3$s"   style="margin-right:10px">

do not close the tag a after href="%s"
and put img inside of a tag, like this:

A: Check
 define('RANDOM_IMAGES_FORMAT', ' alt="%s" title="%3$s"   style="margin-right:10px">');

and
 array ( 'title' => 'Test 2', 'src' => 'pic2.jpg', 'href' => 'Click Me' ),

their is a problem with href try to give only link in href


Q: Angular 14 mat date picker won't work and display properly I have trouble with material date picker.
I've imported this modules:
MatFormFieldModule,
MatInputModule,
MatDatepickerModule,
MatNativeDateModule
but no luck.
Only code that i have is in html template:
<div>
<mat-form-field appearance="fill">
<mat-label>Choose a date</mat-label>
<input matInput >
<mat-hint>MM/DD/YYYY</mat-hint>
<mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
</div>

Any suggestion is welcome. Thank you!
My ng version:
Angular CLI: 14.2.8
Node: 18.12.1 (Unsupported)
Package Manager: npm 8.19.2
OS: darwin x64

Angular: 14.2.9
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1402.8
@angular-devkit/build-angular   14.2.8
@angular-devkit/core            14.2.8
@angular-devkit/schematics      14.2.8
@angular/cli                    14.2.8
@angular/material               7.0.0
@schematics/angular             14.2.8
rxjs                            7.5.7
typescript                      4.7.4