text:
Q: What is the general name/description for what I thought was "Makeout Creek"? In The Simpsons, and many old movies from/set in the 1950s, there is a common scene where a couple sits in a parked car at what appears to be a high hill, in the evening or night, looking out over the city underneath. They're kissing/making out. It's romantic and stuff.
For some reason, I have internally labeled this the "Makeout Creek". But a "creek" doesn't seem to match: https://en.wiktionary.org/wiki/Creek
I don't really understand what a "creek" is, even after reading that page.
What is the general description/name for the place located high up in the mountains (or a hill?) where young couples drive to make out/kiss and (barely) look out over the city?
Would be nice to finally get this straightened out.

A: It seems that this television and movie trope is referred to as "makeout point".

A standard teenage hang out where all sorts of canoodling takes place in cars...Often involves a tourist-trap-type scenic bluff, so as to overlook the city lights at night

TV Tropes
I don't know where the editors of TV Tropes get the names for their entries, and I was skeptical that this term was in widespread use, but you can find quite a number of citations in Google Books.1
The reason I was skeptical is that I've never heard anyone use this term.  That's likely because these "makeout points" are common in movies and TV, but not in the real world.  Most cities don't have a perfect secluded viewpoint that you can drive right up to.
Of course, people, especially people without their own houses, do need to find places to make out.  If there's a place where people commonly go to make out, it might be called a makeout spot.2
It also looks like makeout spot is at least occasionally used to refer to the TV and movie trope: "Since you didn't have a famed 'makeout spot' on a leafy hill overlooking the town (thanks, every teen movie ever)" (Cosmo)

*

*Some examples of "makeout point":

Lori thought they were headed up to Johnson's Reservoir to the makeout point.

The Coy Circle

They were parked at Makeout Point, a discreet distance away from the other cars

Out of the Madhouse

Many of the makeout point scenes were filmed on Mulholland Drive near the current home of the Skirball Cultural Center.

Grease is the Word: Exploring a Cultural Phenomenon

*For some reason, the top Google results for "makeout spot" are mostly reviews or recommendations for these kinds of places, e.g. "Best make out spot in Los Angeles, CA - Yelp", "Where's The Best Makeout Spot In The Treasure Valley?", "Best makeout spot | Newcity"

A: I would call it lovers' lane

The generic name for a place, often one with a scenic view, that teenagers and young adults go to kiss and potentially engage in other sexual activity, typically in a car.
If a boy takes you to lovers' lane, it's not because he wants to talk about the weather, OK?

The "lane" is probably used in the sense of "a narrow country road" or "A narrow way or passage between walls, hedges, or fences", not "a strip delineated on a street or highway". This term might be old fashioned, but I think it's still well known.


text:
Q: Entity Framework on different project - saving? I have an established SQL Server database setup. I then generated an Entity Framework model in a Console Application to test some selecting, editing and adding to the database. All went well.
I am now moving more towards my final physical design of my WinForms and WebApp. So, I have decided to do the project in separate projects. I moved the Entity Framework to a Data project, I created a Services project, and I still have my console app as a test application (All in the same solution).
I have a ClassLib with data transfer objects to pass between my layers. So my GUI layer and Service layer don't know of the Entity Framework. I have helper methods in my EF project that convert the EF data into List etc...
Eg of a helper method:
using ClassLib;

namespace Data
{
    public class PayeeDAL : EntityBase
    {

    public static List<PayeeDto> GetPayees()
    {
        var payees = (from payee in Db.payees
                      select payee).ToList();

        List<PayeeDto> reply = new List<PayeeDto>();

        foreach (var pa in payees)
        {
            PayeeDto p = new PayeeDto
                             {
                                 PayeeId = pa.payee_id,
                                 Name = pa.name,
                                 Deleted = pa.deleted == null
                             };
            reply.Add(p);
        }
        return reply;

    }
}
}

And my data transfer object looks like this:
namespace ClassLib
{
    public class PayeeDto
    {
        public int PayeeId { get; set; }
        public string Name { get; set; }
        public bool Deleted { get; set; }
    }
}

So, my selection is working well with this design... but...  have no idea how to handle saving.
In my console application, when the EF was available to me, I did this:
                        db.AddToaccount_transaction(ac);

                    account_transaction_line atl = new account_transaction_line
                    {
                        amount = amount,
                        cost_centre =
                            db.cost_centre.FirstOrDefault(
                                cc => cc.cost_centre_id == costcentreid),
                        sub_category =
                            db.sub_category.First(
                                sc => sc.sub_category_id == subcategoryId),
                        account_transaction = ac,
                        budget = db.budgets.FirstOrDefault(b => b.budget_id == budgetid)

                    };

                    db.AddToaccount_transaction_line(atl);

                }

                db.SaveChanges();

But now I don't have access to .AddTo.... and .SaveChanges... In my Console app, I'd create a parent object, and then add a few child objects... and then add the child objects to the parent object, and save.
But how would this be done in my new structure? I'm thinking I'd have a Save method in each of my helper classes... And then pass a List<> of the child objects, along with a single Parent class to the save method... and then transfor the Dtos to EF models, and then save it that way?
Is that an acceptable plan?

A: I only use DTO objects to transfer data from A to B. The updating, adding, removing etc., I always encapsulate in Commands (Command Pattern).
Retrieving data I do similarily with "Helper" classes.
Example of command pattern:
The base classes:
namespace Busker.Data.Commands
{
    /// <summary>
    /// The 'Command' abstract class
    /// </summary>
    public abstract class Command
    {

        private string message = "";
        public string Message
        {
            get { return message; }
            set { message = value; }
        }

        private bool success = false;
        public bool Success
        {
            get { return success; }
            set { success = value; }
        }

        private Validator validator = new Validator();
        public Validator Validator
        {
            get { return validator; }
            set { validator = value; }
        }

        private CommandStatusCode statusCode = CommandStatusCode.OK;
        public CommandStatusCode StatusCode
        {
            get { return statusCode; }
            set { statusCode = value; }
        }

        public LoggingLevel LoggingLevel = LoggingLevel.Debug;

        //public BuskerContext BuskerContext;

        public bool IsValid()
        {
            if (validator.Errors.Count > 0)
                return false;
            return true;

        }

        public abstract void Execute();

        public void FailedSubCommand(Command cmd)
        {
            this.Success = cmd.Success;
            this.Message = cmd.message;
        }
    }
}

namespace Busker.Data.Commands
{
    public class Invoker
    {
        private Command command;

        public Command Command
        {
            get { return command; }
            set { command = value; }
        }

        public void SetCommand(Command command)
        {
            this.Command = command;
        }

        public virtual void ExecuteCommand()
        {
            if (command == null)
                throw new Exception("You forgot to set the command!!");

            try
            {
                log(this.command.GetType().Name + " starting execution ");
                command.Execute();
                if (!command.Success)
                {
                    log(this.command.GetType().Name + " completed execution but failed. Message: " + command.Message + " " + command.StatusCode.ToString());
                }
                else
                    log(this.command.GetType().Name + " completed execution. Success!");

            }
            catch (Exception ex)
            {
                command.StatusCode = CommandStatusCode.Error;
                Loggy.AddError("An unhandled error was caught in " + this.command.GetType().Name + ": " + ex.Message, ex);
                command.Message = ex.ToString();
                //throw;
            }
        }

        private void log(string msg)
        {
            switch (command.LoggingLevel)
            {
                case Busker.Data.Constants.LoggingLevel.Debug:
                    Loggy.Debug(msg);
                    break;
                case Busker.Data.Constants.LoggingLevel.Off:
                    break;
                default:
                    Loggy.Add(msg);
                    break;

            }

        }

        public virtual void ExecuteLinqCommand()
        {
            this.ExecuteCommand();
        }
    }
}

namespace Busker.Data.Commands
{
  public static class Extensions
  {
        /// <summary>
        /// Executes the command using the default invoker.
        /// </summary>
        /// <param name="aCommand"></param>
        public static void Invoke(this Command aCommand)
        {
            System.Diagnostics.StackTrace stackTrace = new System.Diagnostics.StackTrace();
            System.Reflection.MethodBase m = stackTrace.GetFrame(1).GetMethod();
            String strMethodName = m.DeclaringType.Name + "." + m.Name;

            try
            {
                Invoker invoker = new Invoker();
                invoker.SetCommand(aCommand);
                invoker.ExecuteCommand();
            }
            catch (Exception ex)
            {
                Loggy.AddError("An error occured in Extensions.Invoke. + " + strMethodName ,ex);
                throw ex;
            }

        }
}

Implementation Example:
namespace Busker.Data.Commands.Message
{
    public class CreateMessageCommand :Command
    {

        public CreateMessageCommand (int from, int to, string title, string body)
        {
                // set private variable..
        }

        public override void Execute()
        {

            // Do your stuff here

            be.SaveChanges();
            this.Success = true;

        }
    }
}

Usage:
CreateMessageCommand  cmd = new CreateMessageCommand (...);
//Don't use the execute method of the command
//the invoker, because implemented as an extension can be exchange in different
//environments
cmd.Invoke();

redpajama_set_name: RedPajamaStackExchange


text:
Q: Black screen after I login I switched to Xubuntu from windows and things have been pretty smooth until I tried to connect another monitor to my laptop (using vga). The screen suddenly went black, and since then, even with my external monitor disconnected, all I see is a black screen after I enter the login details. I can use the guest account to login without any problems.
I looked around before posting and found the exact same problem and the solution there was to delete this file /.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml, but unfortunately that file doesn't seem to exist in my pc.

A: Try looking for the file in
/home/USERNAME/.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml (replacing USERNAME as appropriate) instead of
/.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml.
The path to the file you wrote above is an absolute path starting in the root file system.


text:
Q: Ring containing a Dedekind ring Suppose I have two domains, $A\subset B$, where $A$ is Dedekind and $\operatorname{Frac}(A)=\operatorname{Frac}(B)$. I also know that $B$ is both integrally closed and has height $1$. Is $B$ necessarily Dedekind? If not, I'd love to see a counterexample.
(Note: I'm adding the homework tag since this is motivated by (and would finish off) a homework problem about global function fields, although I now know another way, with slightly stronger hypotheses, to get the necessary result with Riemann-Roch.)

A: In the multiplicative theory of ideals it is well known that the overrings of Dedekind domains are also Dedekind. See, for instance, Larsen and McCarthy, Multiplicative Theory of Ideals, Theorem 6.21 or these notes, Proposition 22.2.


text:
Q: Hiding the Quick Time logo and controls when an audio file is played using MPMoviePlayerController Hai all,
in my application i need to play a streaming audio, i used MPMoviePlayerController to play the audio, it works fine, but i don't want the Logo and controls appearing on the screen( like playing in the background).
is there any way to hide the logo and controls ?
thanks

A: There is no way to do this with the current Apple api.  If you want to use undocumented api's, you can always access the private methods.  Here is a good place to start looking:
Erica Sadun's Core Dumps 1
Erica Sadun's Core Dumps 2

A: Take a look at:
MPMusicPlayerController
or
AVAudioPlayer


text:
Q: Export a huge django queryset in CSV format with rest-framework I'm trying to create an endpoint that exports user information as a CSV file.
The queryset I'm attempting to export contains more than 250,000 users.
But, this method takes too much time and causes the server to timeout.
In my existing code, I create the CSV file on my server and write the queryset content to it.
for idx, user in enumerate(queryset):
    print('{}/{}'.format(idx+1, total))
    row = [user.first_name, user.last_name, user.email]
    # some logic
    if user.is_vip():
    # .....
    if user.profile and user.profile.phone:
    # .....
    csv_writer.writerow(row)

Once the loop is complete I send the file:
file = open('export_users.csv', 'rb')
response = FileResponse(file, content_type='text/csv')
response['Content-Length'] = os.fstat(file.fileno()).st_size
response['Content-Disposition'] = 'attachment; filename="%s"' % '{}_export_users.csv'.format(date_now.strftime('%Y-%m-%d:%M:%S'))
return response

How can I generate the CSV file and send the response faster so that it doesn't cause a timeout?

A: You can make the response much faster by streaming the content, writing each row to the user as it's generated.
Django has documentation to help with this exact problem:
https://docs.djangoproject.com/en/2.2/howto/outputting-csv/#streaming-large-csv-files
import csv

from django.http import StreamingHttpResponse

class Echo:
    def write(self, value):
        return value

def streaming_csv_view(request):
    queryset = User.objects.values_list("first_name", "last_name", "email")
    echo_buffer = Echo()
    csv_writer = csv.writer(echo_buffer)

    # By using a generator expression to write each row in the queryset
    # python calculates each row as needed, rather than all at once.
    # Note that the generator uses parentheses, instead of square
    # brackets – ( ) instead of [ ].
    rows = (csv_writer.writerow(row) for row in queryset)

    response = StreamingHttpResponse(rows, content_type="text/csv")
    response["Content-Disposition"] = 'attachment; filename="users.csv"'
    return response

For more information on the differences between generator expressions and list comprehensions, this python howto is a good resource:
https://docs.python.org/3/howto/functional.html#generator-expressions-and-list-comprehensions
Here's the important part:

With a list comprehension, you get back a Python list; ...a list containing the resulting lines, not an iterator. Generator expressions return an iterator that computes the values as necessary, not needing to materialize all the values at once.

To optimize your query, use a values_list query instead of calling all(). With a values_list query, you can still fetch fields through relationships. For example:
User.objects.values_list(
    "first_name",
    "last_name",
    "email",
    "profile__phone",  # get the profile.phone value
)


text:
Q: AJAX database access in PHP. The simplest way I'm looking for the simplest possible solution to get mysql database records as XML output using PHP. That means no third party APIs. Just pure php code and as little of it as possible.
I posted a similar article for c# in my blog and im looking for an equivalent that will work on any hosting company.
Here is the link (i couldn't add  tag from my iphone)
http://desalasworks.com/ajax-database-access-in-c-sharp-the-simple-way/
Thanks in advance.
Steven

A: Have a look at this for one solution:
http://www.kirupa.com/web/mysql_xml_php.htm
Or to utilise PHP5 specific functionality:
http://www.tonymarston.net/php-mysql/dom.html


text:
Q: Question regarding Excel VBA on invalid qualifier I am currently working on a vba assignment...but I got stuck in this. It says there are invalid qualifiers and is unable to run. Please help and many thanks!!!!
Dim i As Integer
Dim RowCount As Integer
Dim category As String
Dim product As String
Dim quantity As String

With Sheets("Sheet1")
    RowCount = Cells(Rows.Count, 1).End(xlUp).Row

    ' Another way to count the number of rows needed

    Range("A1").Select
    category = ActiveCell.Offset(i, 0).Value
    product = ActiveCell.Offset(i, 1).Value
    quantity = ActiveCell.Offset(i, 2).Value

    For i = 2 To RowCount
        ' insert the IF/THEN/ELSE structure here to
        ' format the font color of Fruits to blue,
        ' and the rest of the others to magenta

    If category = "Fruits" Then
    category.Font.Color = vbBlue
    product.Font.Color = vbBlue
    quantity.Font.Color = vbBlue

    Else
    category.Font.Color = vbMagenta
    product.Font.Color = vbMagenta
    quantity.Font.Color = vbMagenta
    End If
    Next

End With

A: use Ranges and Longs.  Move the set into the loop.
Dim i As Long
Dim RowCount As Long
Dim category As Range
Dim product As Range
Dim quantity As Range

With Sheets("Sheet1")
    RowCount = .Cells(.Rows.Count, 1).End(xlUp).Row

    ' Another way to count the number of rows needed

    For i = 2 To RowCount
    Set category = .Cells(i, 1)
    Set product = .Cells(i, 2)
    Set quantity = .Cells(i, 3)
        ' insert the IF/THEN/ELSE structure here to
        ' format the font color of Fruits to blue,
        ' and the rest of the others to magenta

        If category = "Fruits" Then
            category.Font.Color = vbBlue
            product.Font.Color = vbBlue
            quantity.Font.Color = vbBlue
        Else
            category.Font.Color = vbMagenta
            product.Font.Color = vbMagenta
            quantity.Font.Color = vbMagenta
        End If
    Next

End With

or skip the variables:
With Sheets("Sheet1")
    Dim RowCount As Long
    RowCount = .Cells(.Rows.Count, 1).End(xlUp).Row

    Dim i As Long
    For i = 2 To RowCount
        ' insert the IF/THEN/ELSE structure here to
        ' format the font color of Fruits to blue,
        ' and the rest of the others to magenta

        If .Cells(i, 1) = "Fruits" Then
            .Range(.Cells(i, 1), .Cells(i, 3)).Font.Color = vbBlue
        Else
            .Range(.Cells(i, 1), .Cells(i, 3)).Font.Color = vbMagenta
        End If
    Next

End With


text:
Q: cant connect to database using cakephp and wampserver I am using 64bit WampServer and cakephp 3.2 and win10. I have a new computer and need to transfer a cakephp project.  There is a user Root with all privileges, with no password and database 'aptutori_apt4' n exists on phpmyadmin
The project loads if it doesnt need the database but this is what I get
error: sqlstate[hy000] [1049] unknown database 'aptutori_apt4'
I cant connect the database!
Is the host setting wrong ?
 'Datasources' => [
        'default' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Mysql',
            'persistent' => false,
            'host' => 'localhost',

            //'port' => 'non_standard_port_number',
            'username' => 'root',
            'password' => '',
            'database' => 'aptutori_apt4',
            'encoding' => 'utf8',
            'timezone' => '+11:00',
            'flags' => [],
            'cacheMetadata' => true,
            'log' => false,

It is the same settings as my other computer on phpmyadmin and app.php. The new computer shows on phpmyadmin under database tab  Server:Mysql:3308

A: I think your problem is that recently mariaDB became the default database in WAMPServer, so therefore mariaDB is using port 3306 (the default for almost everything MySQL) and MySQL is listening on port 3308
However, if you want to use MySQL, the simple solution would be to swap the default database in WAMPServer, and of course there is a tool for that on the WAMPManager Menus.
Right-click Wampmanager icon -> Tools -> Invert default DBMS MariaDB <-> MySQL

Now MySQL will use port 3306 and mariaDB will use port 3307.
Now your cake config should work and find the correct DBMS on port 3306 and therefore the database you have created in there.
This is the safest solution as when you move code to a live server it will almost definitely have its MySQL/mariaDB configured to use port 3306 and you wont need to change anything in your config.
Alternatively
You could put the port number that MySQL is Listening on in this param
'port' => '3308',

But you will almost definitely have to change this when the site get moved to a Live Server, and then you dev code and your live code will be different, unless you remember not to transfer this file after the first time.
Oh and remember you can reverse this change in default database, just go back to the menus and the menu you used last time should say
Right-click Wampmanager icon -> Tools -> Invert default DBMS MySQL <-> MariaDB

Do that and you are back to mariaDB using port 3306


text:
Q: axios response interceptor not working properly Im trying to use axios interceptor with refresh token but when my token has expired. My error code within in interceptors.response is not executing. What can i do to fix this issue, i am also getting a status code of 200 which does not make much sense to me.

Also here is my code
proctedInstance.interceptors.request.use(
    async config => {
        const accesstoken = localStorage.getItem('accesstoken');
        config.headers = {
            'Authorization': `Bearer ${accesstoken}`,
            'Accept': 'application/json',
            'Content-Type': 'application/x-www-form-urlencoded'
        }

        return config;
    },
    error => {
        Promise.reject(error);
    }
)

proctedInstance.interceptors.response.use((response) => {
    console.log(response);
    return response
},
function (error) {
    const originalRequest = error.config;
    if (error.response.status === 401 && !originalRequest._retry) {

        originalRequest._retry = true;
        return axios.post('http://localhost:4000/refresh_token')
            .then(res => {
                if (res.status === 200) {
                    localStorage.setItem('accesstoken', res.data.accesstoken)
                    console.log('my token res.data.accesstoken', res.data.accesstoken);
                    axios.defaults.headers.common['Authorization'] = 'Bearer ' + localStorage.getItem('accesstoken');
                    return axios(originalRequest);
                }
            })
    }

    return Promise.reject(error);
})

export const onProtected = async () => {
    const results = await (await proctedInstance.post('/protected')).data

    if(results.data === 'This is protected data.'){
        return true;
    } else
        return false;
}

any help is appreciated

A: Try letting it like this:
proctedInstance.interceptors.response.use(
    function (response) {
        return response;
    },
    function (error) {
        const access_token = localStorage.getItem("accesstoken");
        if (error.response.status === 401 && access_token) {
            //Your logic to refresh token and reattempt request
        } else {
            console.error(error);
        }
        return Promise.reject(error);
    }
);


text:
Q: How can I determine the types of generic parameters of a class that is itself generic? I need to determine the type of a generic parameter in a situation where the type in question can have its own generic types. Below is code that worked until this nesting of generics came up.
inline fun <reified T : Units> Units?.zero(): Measure<T> {
    return when (T::class) {
        Energy::class -> 0.0 * (joules as T)
        Frequency::class -> 0.0 * (hertz as T)
        Time::class -> 0.0 * (seconds as T)
        Spin::class -> 0.0 * (rpm as T)
        Volume::class -> 0.0 * (liters as T)
        Temperature::class -> 0.0 * (celsius as T)
        UnitsRatio<Energy, Time>::class -> 0.0 * (watts as T) // this does not work
        else -> throw RuntimeException()
    }
}

Is there a way to get this generic type information about UnitsRatio?
Background
I'm using Measured, a library to help with managing physical measurement units. Basically, my function is supposed to be a way to obtain a measure with a value of 0 without knowing the exact measurement unit explicitly, as it should be inferred by the compiler. This would enable me to get a sum of measurement values from a collection.
val SUnits: Units? = null
inline fun <T, reified U : Units> Collection<T>.sumOf(selector: (T) -> Measure<U>): Measure<U> {
    var sum: Measure<U> = SUnits.zero()
    for (element in this) {
        sum += selector(element)
    }
    return sum
}

This makes the usage clean and similar to existing sumOf variants. For example:
val totalVolume = bodies.sumOf { it.volume }

A: One way would be to compare against the types, rather than the classes of T and the unit types.
inline fun <reified T : Units> Units?.zero(): Measure<T> {
    return when (typeOf<T>()) {
        typeOf<Energy>() -> 0.0 * (joules as T)
        typeOf<Frequency>() -> 0.0 * (hertz as T)
        typeOf<Time>() -> 0.0 * (seconds as T)
        typeOf<Spin>() -> 0.0 * (rpm as T)
        typeOf<Volume>() -> 0.0 * (liters as T)
        typeOf<Temperature>() -> 0.0 * (celsius as T)
        typeOf<UnitsRatio<Energy, Time>>() -> 0.0 * (watts as T)
        else -> throw RuntimeException()
    }
}

Note that this requires kotlin.reflect. There might be a better solution specific to the Measured library that you are using, which I am not familiar with.


text:
Q: Starting & Stopping a Brightcove Video from Sitecore programmatically in a Fancybox Overlay So I have an issue with starting/stopping a Brightcove video that is coming from the Brightcove Video Connector with Sitecore 6.5.
Essentially, the built in  video connector provides with a "go and render the video in a Rich text Editor" and then wait until output time to get the iFrame with Brightcove JS content, et al.
To avoid the autostart from happening (as I want the autostart to occur after the video populates a Fancybox2 overlay), I am stuffing the HTML of the Rich Text Box into an input hidden value.  This makes me feel dirty all over, but it does work.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SitecoreSublayout.ascx.cs" Inherits="Assembly.SitecoreSublayout" %>
<%--CONTENT REMOVED--%>

                <customControl:Image Item="<%# DataOrContextItem %>" Field="VideoPlayLink" RemoveWidthHeight="true" runat="server" />

                    <%--CONTENT REMOVED--%>

<sc:FieldRenderer ID="FieldRenderer1" FieldName="FieldName" runat="server" />

                Expand For Full Story

            <%--CONTENT REMOVED--%>

    <input id="hdnVideoContent" type="hidden" value='<%# DataOrContextItem.Fields["VideoFieldName"] %>' />

When I call the JQuery event to open the Fancybox, I stuff the hidden's value into the content of the Fancybox2.  Since this includes an autoplay, it plays just fine.  In most browsers, this is working.  Unfortunately, I am supporting IE8, Android 4.1, iOS 7, et al.  They are not handling this transition to stop the video very well when the Fancybox closes.
GlobalObject.brightcoveOverlay = function () {
    $(".mobile-video-container, .video-container").on('click', function () {
        $.fancybox({
            'hideOnContentClick': false,
            'autoScale': false,
            'transitionIn': 'fade',
            'transitionOut': 'fade',
            content: $('#hdnVideoContent').val()
        }); // fancybox
        return false;
    }); // click
}();

Unfortunately, I cannot post the video code.  We under a client license and we have some NDAs preventing me from disclosing more than this functionality.
Anybody know of a good way to find the a Brightcove video by selector, hijack, and stop the video from playing before the Fancybox2 closes?  I inject my own Brightcove APIs, but I don't seem to have access via the normal Brightcove.API route.
Any and all suggestions are appreciated.  Just trying to mitigate things so I can solve some of the issues at hand.


text:
Q: Wordpress Custom Theme: Plugins Won't Load or Display Only Code This is my first attempt at creating a theme purely from scratch. Before this I just used underscores_me and made most of my changes to style.css and left the majority of PHP alone, because I'm a novice with it.
My issue is that plugins are not working. None of the ones I have installed work. At this point I have been trying plugins that create an event calendar, but I'm assuming that any and all plugins will have issues. In the areas that are meant to display the calendar, there are two things I'm seeing. Plugin-generated pages show nothing at all (aside from the theme visuals) and plugins that are inserted into an admin-created page display plugin-generated code.
I am using WampServer. I have wp_footer(); and wp_head(); in the correct places. My functions.php file was created from the example found at https://scanwp.net/blog/create-a-wordpress-starter-theme-from-scratch/ and the only adjustment I have made to it so far is to remove the fontawesome line of code.
My index.php file looks like this:
<?php get_header(); ?>

<?php echo "&#9755 "; ?><?php the_title(); ?>

 if ( have_posts() ) :
    while ( have_posts() ) : the_post();
        // Display post content
    endwhile;
endif;
?>

<?php get_footer(); ?>

And my page.php file looks like this:
<?php get_header(); ?>

<?php echo "&#9755 "; ?><?php the_title(); ?>

 <?= get_post_field('post_content', $post->ID) ?>

<?php get_footer(); ?>

A: First of all, you have to understand that in your displayed files, there are no functions that recall objects that will later show the page content.
Then, in your index.php file there is an error, besides what was said above, because you're calling the_title () (function) that extrapolates the title of a post or page via the post object, which in this case should be extracted within the while loop contained within the if condition.
Then try editing the files as follows.
index.php
<?php

get_header(); ?>

<?php if( have_posts() ) : ?>
    <?php while( have_posts() ) : the_post(); ?>

<?php the_title(); ?>

        <?php if( is_singular() ) : ?>
            <?php the_content(); ?>
        <?php else : ?>
            <?php the_excerpt(); ?>
        <?php endif; ?>
    <?php endwhile; ?>
<?php else: ?>

No posts to display

<?php endif; ?>

<?php get_footer(); ?>

and page.php
<?php

get_header(); ?>

<?php while( have_posts() ) : the_post(); ?>

<?php the_title(); ?>

    <?php the_content(); ?>
<?php endwhile; ?>

<?php get_footer(); ?>

However, within the wordpress codex you will find all the guides well written on any type of function, look no further.
source: https://codex.wordpress.org/


text:
Q: File Upload from FLEX or ActionScript 3 to ASPX .NET? I would like to know how to upload a file from ActionScript 3 (From a FLEX Application) to a Dot Net Back End, maybe to an ASHX file, an ASPX file or similar and using C# as core backend language.
Thanks!!

A: Use the FileREference class to pass the file from Flash Player to the backend service.  Googling provides a bunch of examples on how to do this, here are the top 2:
http://algorithmist.wordpress.com/2007/10/19/flex-file-upload-with-aspnet/
http://dotnetslackers.com/community/blogs/haissam/archive/2008/03/29/upload-multiple-files-using-asp-net-amp-adobe-flex.aspx


text:
Q: SolrClient::query() Solr HTTP Error : 'Couldn't resolve host name' Solr using with Yii Framework and getting this error:
SolrClient::query() [solrclient.query]: Solr HTTP Error:
'Couldn't resolve host name'
I have defined hostname: localhost:81 port: 8983
Tried many ways on using localhost but not getting right solution.

A: Whenever there's a separate 'port' field, don't put the port in the 'hostname' field.


text:
Q: Table of content isn't generated when converting DOCX to PDF using xDocReport I need to convert a DOCX file to PDF in Java app. I tried xDocReport lib, but it doesn't convert a table of content. In the output PDF file there is empty space instead of ToC.
Source DOCX file
Output PDF file
Here is my code, it's simple:
import java.io.*;
import org.apache.poi.xwpf.converter.pdf.PdfConverter;
import org.apache.poi.xwpf.converter.pdf.PdfOptions;
import org.apache.poi.xwpf.usermodel.XWPFDocument;

public class DocxToPDFService {
    public void generatePDF(String srcPath, String destPath) throws Exception {

        XWPFDocument docx;

        try {
            docx = new XWPFDocument(new FileInputStream(srcPath));
        } catch (IOException ioE) {
            throw ioE;
        }

        PdfOptions options = PdfOptions.create().fontEncoding("windows-1250");
        FileOutputStream pdf = new FileOutputStream(destPath);
        PdfConverter.getInstance().convert(docx, pdf, options);
    }
}

Is there any workaround to make it convert ToC?


text:
Q: How can i disable eventValidation in EditForm.aspx in sharepoint 2010 I am adding new items to a Lookup column Dropdown list with less than 20 items  on an edit form using some javascript.
When I click save I get an error saying
Invalid postback or callback argument.  Event validation is enabled using  in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
If I add  Page  EnableEventValidation="false" I get a Parser error saying  Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: The enableeventvalidation attribute on the page directive is not allowed in this page.
The eventlog says
Microsoft.SharePoint.WebPartPages.WebPartPageUserException: The enableeventvalidation attribute on the page directive is not allowed in this page.
STACKTRACE:
Microsoft.SharePoint.WebPartPages.WebPartPageUserException: The enableeventvalidation attribute on the page directive is not allowed in this page.
 at Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter.PreprocessDirective(String directiveName, IDictionary attributes)
 at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
I checked my web.config and it has no pages enableEventValidation
How can I disable eventValidation in sharepoint. [hopefully on a per-page basis]? Or do I have to use infopath?

A: Setting EnableEventValidation="False" is not a good solution in sharepoint, because it is security feature. I have an experince about modify dropdownlist elements using javascript, and it gives me same error message. I have found the solution for this error by adding method protected override void Render(HtmlTextWriter writer) in code behind.
protected override void Render(HtmlTextWriter writer)
{
   //Set Dropdownlist Value
   ddlOption.Add("value");
   base.Render(writer);
}


text:
Q: Make the whole gridLayoutWidget clickable I have the following code which shows me 7 of the widgets in a history window of my application. Each widget has a name, icon and an address to a previously opened file. I want all widgets to be clickable and write a function which exactly knows which widget was clicked. I have no clue on how to make a whole widget act as a single clickable item.
This is my code for showing the widgets.
class MainWindow(QtWidgets.QMainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        for i in range (7):
            self.gridLayoutWidget = QWidget(self)
            self.gridLayoutWidget.setGeometry(QRect(40, 40 + i * 60, 350, 40))

            self.gridLayout = QGridLayout(self.gridLayoutWidget)
            self.gridLayout.setContentsMargins(0, 0, 0, 0)
            self.Label1 = QLabel(self.gridLayoutWidget)
            self.Label1.setText("the name of the file")
            self.Label1.setFont(QFont('Arial', 14))

            self.gridLayout.addWidget(self.Label1, 0, 1, 1, 9)

            self.Label2 = QLabel(self.gridLayoutWidget)
            self.Label2.setText("the address of the file")
            self.gridLayout.addWidget(self.Label2, 1, 1, 1, 9)

            self.im = QPixmap("img.ico")
            self.icon = QLabel()
            self.icon.setPixmap(self.im)

            self.gridLayout.addWidget(self.icon , 0, 0, 2, 1)

A: In this case it is better to create a class that inherits from widget and implements the logic of the complex widget to avoid repetitive code that can cause problems (for example self.Label2 what does QLabel refer to? Does it refer to the first, the second, ...? , since it refers to the latter). On the other hand, that allows us to override the mouseReleaseEvent method, causing a signal to be emitted that later allows us to identify the widget using the sender method.
class GridLayoutWidget(QWidget):
    clicked = pyqtSignal()

    def __init__(self, parent=None):
        super().__init__(parent)

        self.Label1 = QLabel(text="the name of the file", font=QFont("Arial", 14))

        self.Label2 = QLabel(text="the address of the file")
        self.icon = QLabel(pixmap=QPixmap("img.ico"))

        self.gridLayout = QGridLayout(self)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.addWidget(self.Label1, 0, 1, 1, 9)
        self.gridLayout.addWidget(self.Label2, 1, 1, 1, 9)
        self.gridLayout.addWidget(self.icon, 0, 0, 2, 1)

    def mouseReleaseEvent(self, event):
        super().mouseReleaseEvent(event)
        self.clicked.emit()

class MainWindow(QMainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        rect = QRect(40, 40, 350, 40)

        for i in range(7):
            widget = GridLayoutWidget(self)
            widget.setGeometry(rect.translated(0, 60 * i))
            widget.clicked.connect(self.handle_clicked)

        self.resize(640, 480)

    @pyqtSlot()
    def handle_clicked(self):
        widget = self.sender()
        print(widget)


text:
Q: Thread Safety in ArrayList Why the ArrayList class in Java doesn't implemented with thread safety. But prior class Vector is implemented with thread safety ? Is there any particular reason for not implementing with thread safe ?

A: Taken from Why is Java Vector (and Stack) class considered obsolete or deprecated?

Vector synchronizes on each individual operation. That's almost never what you want to do.
Generally you want to synchronize a whole sequence of operations. Synchronizing individual operations is both less safe (if you iterate over a Vector, for instance, you still need to take out a lock to avoid anyone else changing the collection at the same time, which would cause a ConcurrentModificationException in the iterating thread) but also slower (why take out a lock repeatedly when once will be enough)?
Of course, it also has the overhead of locking even when you don't need to.
Basically, it's a very flawed approach to synchronization in most situations. As Mr Brian Henk pointed out, you can decorate a collection using the calls such as Collections.synchronizedList - the fact that Vector combines both the "resized array" collection implementation with the "synchronize every operation" bit is another example of poor design; the decoration approach gives cleaner separation of concerns.


text:
Q: map operations(find most occurence element) here is code
#include <iostream>
#include <map>
using namespace std;
int main(){
map<int ,int>a;
    map<int,int>::iterator it;
    int b[]={2,4,3,5,2,6,6,3,6,4};
     for (int i=0;i<(sizeof(b)/sizeof(b[0]));i++){
         ++a[b[i]];
     }
    // for (it=a.begin();it!=a.end();it++){
        // cout<<(*it).first<<" =>"<<(*it).second<<"\n";
     //}
     int max=a.begin()->second;
     for (it=a.begin();it!=a.end();it++){
         if ((*it).second>max){
             max=(*it).second;
         }
     }
     for (it!=a.begin();it!=a.end();it++){
         if ((*it).second==max){
             cout<<(*it).first<<"\n";
         }
     }

      return 0;
}

what i am trying is following  according to  number of occurence of each keys   i  want it print  element which occurs most often in this case 6 but it does not show me result what is mistake?

A: You have a typo in your second loop. This:
for (it!=a.begin();it!=a.end();it++){

Should be this:
for (it=a.begin();it!=a.end();it++){

By the way, (*it).first can be more idiomatically written as it->first. The arrow operator (->) is a combination of the dereference (*) and member access (.) operators.

A: Your second loop should begin with it=a.begin(), not it!=a.begin(). But why don't you just capture the number that's occurring most frequently when you capture max, and get rid of the second loop altogether?

A: Given what you're doing, you might consider using a Boost bimap instead of a plain map. With it, your code would work out something like this:
#include <boost/bimap.hpp>
#include <boost/bimap/list_of.hpp>
#include <iostream>

int main() {
    int b[]={2,4,3,5,2,6,6,3,6,4};

    boost::bimap<int, boost::bimaps::list_of<unsigned> > a;

    for (int i=0; i<elements(b); i++)
        ++a.left[b[i]];

    std::cout << a.right.rbegin()->second;
}

The one bit of ugliness here is that it depends on what would be the value type to initialize itself properly in the default ctor, which int doesn't, so we have to change it from list_of<unsigned> to list_of<uint_proxy>, with uint_proxy defined something like this:
class uint_proxy {
    unsigned value;
public:
    uint_proxy() : value(0) {}
    uint_proxy& operator++() { ++value; return *this; }
    unsigned operator++(int) { return value++; }
    operator unsigned() const { return value; }
};

In this case, the proxy type adds a bit more length than we'd like, but the main stream of the code is still pretty simple by comparison, and will generally be considerably more efficient -- in particular, it avoids the linear scan to find the key that had the highest count. For the test case that's probably irrelevant, but with a large amount of data is likely to be more significant.


text:
Q: Sys.InvalidOperationException when trying to edit page in sharepoint 2010 I added a webpart through VS2010. It is a Simple webpart containing ajax script manager,timer and update panel. what it does is it shows the current server time in a label.
After i deploy it into my sharepoint site i get following error when clicking on edit page.

"Sys.Invalid Operation exception: Could not find updatePanel with ID 'ctl00_m_....pnlTimer'. If it is being updated dynamically then it must be inside another Update Panel."

This error goes when i remove the updatepanel in my code.How can i get rid of this error?

A: You may be surprise why you are getting this message though your UpdatePanel is very much on the page. Generally this error comes when you are trying to update an UpdatePanel from code behind and that UpdatePanel is inside an element (parent) that has hidden visibility.
Some techies suggest you to use another UpdatePanel as a container of your this UpdatePanel. Keeping in mind that UpdatePanels are the region like PlaceHolders and not like asp.net Panel element.
Please read complete post here: InvalidOperationException could not Find UpdatePanel with ID

A: My error got resolved automatically after a system restart. Without any changes being made in the code or anywhere else.


text:
Q: How to get random password while working with range value? I am developing a password generator app with JavaScript, I am unable to create a function that successfully generates a password, also I want to be able to get the range working in the function too so when I slide through the range input and click on the generate password button it should return a password with the range values length.

let rangeSlider = document.getElementById("rangeSlider");
let rangeNumber = document.getElementById("rangeNumber");

rangeNumber.innerText = rangeSlider.value;
rangeSlider.oninput = function() {
    rangeNumber.innerText = this.value;
};

const includeUppercase = document.getElementById('upperCase');
const includeLowercase = document.getElementById('lowerCase');
const includeNumbers = document.getElementById('numbers');
const includeSymbols = document.getElementById('symbols');

function getRandomUpperCase() {
    return String.fromCharCode(Math.floor(Math.random() * 26 ) + 65);
}

function getRandomLowerCase() {
    return String.fromCharCode(Math.floor(Math.random() * 26 ) + 97);
}

function getRandomNumbers() {
    return String.fromCharCode(Math.floor(Math.random() * 10 ) + 48);
}

function getRandomSymbol() {
    const symbolsChar = "!@#$%^&*()_+=-/*+{}|\][~`,.<>?/;".split('')
    return symbolsChar[Math.floor(Math.random() * symbolsChar.length)];
}

const randomPasswordFunc = {
    getUpper: getRandomUpperCase,
    getLower: getRandomLowerCase,
    getNumbers: getRandomNumbers,
    getSymbol: getRandomSymbol,
}
// Generate Password Function

function generatePassword() {
    const upper = includeUppercase.checked;
    const lower = includeLowercase.checked;
    const numbers = includeNumbers.checked;
    const symbols = includeSymbols.checked;
}

let generateBtn = document.getElementById('generateBtn');
generateBtn.addEventListener('click', () => {
    generatePassword()
});
.password-input {
    background-color: var(--card);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding-left: 2.6rem;
    outline: none;
}

.password-input input {
    width: 90%;
    background-color: transparent;
    border: none;
    color: hsl(0, 0%, 67%);
    font-size: 1.9rem;
    font-weight: 600;
}

.password-input .copy-password {
    display: flex;
    gap: 0.5rem;
    cursor: pointer;
    padding: 1rem;
    width: 10%;
    text-align: center;
    /* transform: translateX(-50px); */
}

.password-input .copy-password .hidden {
    text-transform: uppercase;
    font-weight: 600;
    color: var(--accent);
    display: none;
}

.password-input .copy-password:hover {
    background-color: hsl(0 100% 100% / 0.05);
}

.password-input .copy-password > img {
    width: 1.5rem;
}

.password-props {
    width: 100%;
    background-color: var(--card);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 2rem;
}

.password-props > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.password-props > header h2 {
    font-size: 1.4rem;
}

.password-props > header p {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
}

.password-props .slider-range {
    width: 100%;
}

.password-props .slider-range > input {
    width: 100%;
    cursor: pointer;
    background-image: var(--accent);
}

input[type="range"]::-webkit-slider-thumb, input[type="range"]::-moz-range-thumb, input[type="range"]::-ms-thumb  {
    -webkit-appearance: none;
    height: 3.5rem;
    width: 3.5rem;
    border-radius: 50%;
    cursor: pointer;
    background: black;
}

input[type="range"]::-webkit-slider-runnable-track, input[type="range"]::-moz-range-track, input[type="range"]::-ms-track {
    background: transparent;
}

.password-props .password-adds {
    display: flex;
    flex-direction: column;
    gap: 1.7rem;
}

.password-props .password-adds .checkbox {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.1rem;
    font-weight: 600;
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    width: 1.3rem;
    height: 1.3rem;
    border: 2px solid white;
    cursor: pointer;
}

input[type="checkbox"]:hover {
    border-color: var(--accent) ;
}

input[type="checkbox"]:checked {
    background-color: var(--accent);
    background-image: url(/check.svg);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
    border: 0;
}

            <input type="text" placeholder="P4$W0rD!" id="passwordResult" disabled>

Copied

Character length

                <input type="range" min="4" max="18" value="9" id="rangeSlider">

                    <input type="checkbox" name="uppercase" id="upperCase" checked>
                    Include Uppercase Letters

                    <input type="checkbox" name="lowercase" id="lowerCase">
                    Include Lowercase Letters

                    <input type="checkbox" name="numbers" id="numbers" checked>
                    Include Numbers

                    <input type="checkbox" name="symbols" id="symbols">
                    Include Symbols


text:
Q: How to Include object in c# I have 3 table
public class Request{
    [Key]
    public int ID { set; get; }
    [Required]
    [MaxLength(128)]
    public string  UserId{ set; get; }
    [ForeignKey("UserId")]
    public virtual AppUser AppUser { get; set; }
}
public class AppUser{
    [Key]
    public int ID { set; get; }
    [Required]
    public int GroupID { get; set; }
    [ForeignKey("GroupID")]
    public virtual Group Group { get; set; }
}
 public class Group{
    [Key]
    public int ID { set; get; }
    public string Name { get; set; }
}

I have function GetAll
    public IEnumerable<T> GetAll(string[] includes = null)
      {
        if (includes != null && includes.Count() > 0)
        {
            var query = dataContext.Set<T>().Include(includes.First());
            foreach (var include in includes.Skip(1))
                query = query.Include(include);
            return query.AsQueryable();
        }

        return dataContext.Set<T>().AsQueryable();
    }

When run function get All
     request.GetAll(new string[] {"AppUser"});

the result have object appUser but in AppUser ,Group is null . How i include group in AppUser


text:
Q: Testing MySQL database with node API locally I created a simple MySQL database and hosted it on my local machine using XAMP.
I then create an api using node and express js. Testing using Postman everything seems to work, however if I try to use the API from an external app I get errors related to SSL Certificate. Following a tutorial on Medium I managed to get the error go away but still can't test the api I always get these errors:

Failed to load resource: net::ERR_CONNECTION_CLOSED
app.js:18 Request failed TypeError: Failed to fetch.

This is my api
const express = require('express')
const app = express()
const fs = require('fs')
const https = require('https');
const bodyParser = require('body-parser');
const mysql = require('mysql');

//local host port
const port = 8080;

//read the certificate
const httpsOptions = {
  key: fs.readFileSync('../security/test-privatekey.pem'),
  cert: fs.readFileSync('../security/my-certificate.pem')
}

app.use(express.json());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

//databse info
var db = mysql.createConnection({
  host:'localhost',
  user:'admin',
  password:'password',
  database:'tutorial'
});

//connect to the database
db.connect((err) => {
  if(err){
    console.log('error',);
    throw err;
  }
  console.log('database working');
})

app.get('/', (req, res)=>{
  res.send('running database');
});

//get students
app.get('/api/getstudent', (req, responce)=> {
  const sql = 'SELECT * FROM `students` ORDER BY `students`.`name` ASC';

  db.query(sql, (err, res)=> {
    if (err) throw err;

    const str = JSON.stringify(res);

    responce.send('retuning data' + str);
  });
});

//insert student
app.post('/api/inserstudent', (req, responce)=> {
  const sql = "INSERT INTO students (name, age) VALUES ('test-student', 15)";

  db.query(sql, (err, res)=> {
    if (err) throw err;
    console.log('inserted');
    responce.send('retuning data');
  });
});

https.createServer(httpsOptions, app)
  .listen(port, () => {
      console.log('server running at ' + port)
  })

this is how I am making the request
init = () =>{
  const req = 'https://localhost:8080/api/getstudent';
  fetch(req)
    .then(function(response) {
      console.log(response);
    }).catch(function(error) {
      console.log('Request failed', error)
    });
}

and this is how chrome shows the page if I navigate to the api url


text:
Q: Modify NSError localizedDescription Do you guys know if there is a nice way to set/modify a NSError's localizedDescription after it has been instantiated other than recreating it? I didn't find any.

A: If you create your NSError manually specifying the userInfo, then you can rewrite this dictionary's value for key NSLocalizedDescriptionKey. Just cast error.userInfo to NSMutableDictionary or whichever class you used when created NSError object

A: The NSError class is - like many Cocoa classes - immutable.
However, the doc states for -localizedDescription that:

By default this method returns the object in the user info dictionary
  for the key NSLocalizedDescriptionKey. If the user info dictionary
  doesn't contain a value for NSLocalizedDescriptionKey, a default
  string is constructed from the domain and code.

So just use errorWithDomain:code:userInfo: to create a new instance or copy and supply an appropriate user info.
Here's another nice introduction to the NSError class.

A: NSError declares no setters for its properties.  From this you can deduce that it probably is not meant to be modified after it has been created.  I could see writing a category on NSError that would create an error out of another error but with a different value for the NSLocalizedDescriptionKey key.


text:
Q: Merge App Profile Page fans with Page fans (without being an admin) One of the Pages I manage also has an App with the same name and its own followers/users. I'm not an admin of the App so I can't see the Merge prompt shown in this blog post. But I am an admin of the official Page.
Is there a way I can manually request that the users of the App be merged into the brand's official Page?
Any help you can provide would be appreciated. Thanks!

A: this is not possible without admin normally you can simply request the person to make you admin of app page than you can merge the both pages


text:
Q: Syncing employee list with activities during the week many to many relationship I have a form where you choose the employees in a dropdown continous form.(From tblEmployee) that worked this week and store them in TSLabor table. In another form I track what activities were done during the days of the week (could have multiple activities for any given day) in tblActivities. In this form I have a sub form list of all the employees who are in tsLabor for this week. This way the user can input the hours for each employee. (Not all employees will have hours in every activity, but I can handle zero hours.) These records are stored in tsActivityLabor. I add a record for each employee in the TSLabor table with the activityID it each time a new activity record is created.
User can not add/delete in the subfom, but they can in the First form.  My issue is how do I add/Delete from the tsActivityLabor table (for each activityID) when an employee is added/deleted from the First form.
I need to check to see if the employee has a record for each activityID for that week. If not add it.
Right now I create a record set of activityIDs for the week from tblActivities. I then create another recordset from the tblTSLabor of all the employees in that week. I then take each ActivityID from the first recordset and create a third recordset of all the employees for that ActivityID in the tsActivityLabor table.  I then verify that each employee from the second recordset has a record in the third recordset.
There has to be a quicker way of doing this but I can't figure it out.  One thought is to create an update query that could look at the tsActivityLabor table and verify that there is an employee record for each employee for each activity. Researched but can't find any examples of a query like this. any help would be appreciated.
Adolph

A: In short when queries underlying forms get complicated Access doesn't know how to update the tables and so chooses not to try.
https://learn.microsoft.com/en-us/office/troubleshoot/access/errors-updating-query-form-data
This is not a problem for your case  as the TSLabor table in your example can be replaced by a date column in the TSActivityLabor Table.  Access is supposed to be user friendly so I'm going to suggest a workflow that lets access help.  here is an example:
create the following tables and hook up the relationships under the Database Tools-Relationships Tab.

Now click on any table and hit create form and access will create a working form which properly updates the tables.  Here is the form after hitting the Employee table:

Because we set up the relationships in advance Access automatically added the many side of the relationship as a subform.  Play with the highlighted record selectors to see how to cycle through records and add new ones.
Next we Start improving the forms.  In the EmployeeActivity Form  I Replaced Foreign Keys with combo boxes, removed the ID which the user should never see and added an unbound combobox to filter the records.

P.S. if the weekly Activities is still a thing Relate Activities to employees through a weeklyactivities table (a type of super many to many relationship).


text:
Q: How to make meta_query according to dynamic meta_key values in Wordpress? I'm trying to list some users using the get_users function.
An online learning plugin I use saves some data in user metadata as course_COURSEID_access_from. For example; If the course ID is 123, the metadata is saved as: course_123_access_from. And the value of this metadata is a timestamp. For example; 1600724678.
// First day of the month.
$first_day = strtotime( date( 'Y-m-01' ) );
// Last day of the month.
$last_day = strtotime( date( 'Y-m-t' ) );

$args = array(
    'fields'     => 'ID',
    'role'       => 'customer',
    'meta_query' => array(
        'relation' => 'AND',
        array(
            'key' => 'course_%_access_from',
            'value' => array( $first_day, $last_day ),
            'type' => 'numeric',
            'compare' => 'BETWEEN'
        ),
    )
);
$users = get_users($args);

But I can not get any results. Where am I making a mistake?
How can I query on wordpress metadata based on dynamic meta_keys?

A: try this code :
<?php
function filter_request_sql_where($where)
{
    if (strpos($where, "meta_key = 'course_$_access_from")) {
        $where = str_replace("meta_key = 'course_$_access_from", "meta_key LIKE 'course_%_access_from", $where);
    }
    return $where;
}

add_filter('posts_where', 'filter_request_sql_where');

// First day of the month.
$first_day = strtotime(date('Y-m-01'));
// Last day of the month.
$last_day = strtotime(date('Y-m-t'));

$args = array(
    'fields' => 'ID',
    'role' => 'customer',
    'meta_query' => array(
        'relation' => 'AND',
        array(
            'key' => 'course_$_access_from',
            'value' => array($first_day, $last_day),
            'type' => 'numeric',
            'compare' => 'BETWEEN'
        ),
    )
);
$users = get_users($args);

A: Based on Fabien's answer, I realized that I could solve this problem with a custom SQL query. And I created the following SQL query:
global $wpdb;
$user_ids = $wpdb->get_results( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key LIKE 'course_%_access_from' AND meta_value > $first_day AND meta_value < $last_day" );,

Thanks Fabien.


text:
Q: Pedestal early termination is not working http://pedestal.io/reference/servlet-interceptor Says this

Before invoking the :enter functions, the servlet interceptor sets up a "terminator" predicate on the context. It terminates the interceptor chain when the context map returned by an interceptor has a response map attached.

My server has this:
(ns wp-server.server
  (:gen-class)                                              ; for -main method in uberjar
  (:require
    [io.pedestal.http :as server]
    [io.pedestal.http.route :as route]
    [wp-server.service :as service]
    [wp-server.datomic :as datomic]))

(defonce runnable-service (atom nil))

(defn -main
  "The entry-point for 'lein run'"
  [& args]
  (println "/nConnecting to datomic...")
  (datomic/connect!)
  (println "\nCreating your server...")
  (reset! runnable-service (server/create-servlet service/service))
  (server/start runnable-service))

(defn create-runnable-dev-service
  "The entry-point for 'lein run-dev'"
  [& args]
  (println "\nConnecting to [DEV] database...")
  (datomic/connect-dev!)
  (println "\nCreating your [DEV] server...")
  (-> service/service
      (merge {:env                     :dev
              ::server/join?           false
              ::server/routes          #(route/expand-routes (deref #'service/routes))
              ::server/allowed-origins {:creds true :allowed-origins (constantly true)}
              ::server/secure-headers  {:content-security-policy-settings {:object-src "none"}}})
      server/default-interceptors
      server/dev-interceptors
      server/create-servlet))

(defn start-dev []
  (when-not @runnable-service
    (reset! runnable-service (create-runnable-dev-service)))
  (server/start @runnable-service))

(defn stop-dev []
  (server/stop @runnable-service))

(defn restart-dev []
  (stop-dev)
  (start-dev))

My service looks like this:
(ns wp-server.service
  (:require
    [datomic.api :as d]
    [io.pedestal.http :as http]
    [io.pedestal.http.body-params :as body-params]
    [io.pedestal.http.route :as route]
    [ring.util.response :as ring-resp]
    [wp-server.datomic :as datomic]
    [wp-common.client :as wp-common-client]
    [wp-common.core :as wp-common-core]
    [clojure.spec.alpha :as s]
    [ring.util.response :as ring-response]))

(defn about-page
  [request]
  (ring-resp/response (format "Clojure %s - served from %s"
                              (clojure-version)
                              (route/url-for ::about-page))))

(def home-page
  {:name  :home-page
   :enter (fn [context]
            (prn "TWO")
            (assoc context :response {:status 200 :body "Hello, world!"}))})

(defn db-test-page
  [{:keys [:database]}]
  (ring-resp/response
    (prn-str
      (d/q '[:find ?text
             :where
             [?e :advisor/first-name ?text]]
           database))))

(def common-interceptors [datomic/db-interceptor (body-params/body-params) http/html-body])

(defn create-spec-validator
  [spec]
  {:name :validate-spec
   :enter
         (fn [{{:keys [:edn-params]} :request :as context}]
           (prn "ONE")
           (if-let [explained (s/explain-data spec edn-params)]
             (assoc context
               :response {:status 400 :body explained})))})

(def routes #{
              ;["/" :get (conj common-interceptors `home-page)]
              ["/clients" :post (conj common-interceptors (create-spec-validator ::wp-common-client/schema) home-page)]
              ["/db-test" :get (conj common-interceptors `db-test-page)]
              ["/about" :get (conj common-interceptors `about-page)]})

(def service {:env                     :prod
              ::http/routes            routes
              ::http/type              :jetty
              ::http/port              5000
              ::http/container-options {:h2c? true
                                        :h2?  false
                                        :ssl? false}})

When sending a request to localhost:5000/clients with a body that does not pass spec, the create-spec-validator interceptor adds a response to the context. I have confirmed this by logging the context in the home-page interceptor. I would expect the home-page interceptor to be skipped as per documentation. This does not happen. Instead the :enter function of the home-page interceptor is called and the response overwritten.
Why isn't the home-page interceptor being skipped when the create-spec-validator prior to it is returning context with a response?

A: If you track down the termination code, it invokes
(defn response?
  "True if the supplied value is a valid response map."
  {:added "1.1"}
  [resp]
  (and (map? resp)
       (integer? (:status resp))
       (map? (:headers resp))))

to test if there is a valid response-map in :response. Try setting an empty map in :headers in your response: it should terminate then.
Ideally, of course, you'll set Content-Type to be something meaningful.


text:
Q: Delegation: How to Pass a Property Between Custom Views In the code below, which (I hope) includes all that's relevant to my question, a mouseEntered/-Exited event in ChangerView is supposed to change the display in ChangingView. (ChangerView and ChangingView are displayed side-by-side and share a view controller.) As an OOP newbie, though, I'm seriously missing something about how to set up delegation between these views. Here's ChangerView (in which DoThis?.show = nil, despite that I thought I was setting it to true or false):
import Cocoa

protocol DoThis { var show: Bool { get set } }

class ChangerView: NSView {

    var changeDelegate: DoThis?

    // Set up for mouseEntered/-Exited
    override func mouseEntered(theEvent: NSEvent) { DoThis?.show = true }
    override func mouseExited(theEvent: NSEvent) { DoThis?.show = false }
}

And here's changing view:
import Cocoa

class ChangingView: NSView, DoThis {

    var show: Bool = false { didSet { needsDisplay = true } }

    // Draw into the view
    override func drawRect(dirtyRect: NSRect) {

        switch show {
        case true:  // Display setup contingent on show = true
        case false: // Display setup contingent on show = false
        }
        // Draw contingent display
    }
}

As I understand things, views should do their own basic display work, and view controllers should handle model-related and higher-level display changes. For that reason, and to keep things simple, I want ChangerView and ChangingView to communicate directly. Unfortunately, I couldn't find any explanations about delegation close enough to this situation—at least not that I could understand.
What am I missing (besides a properly functioning brain)?
Thanks!

A: It looks like there are two issues.
In your ChangerView class, you should be using the delegate to set the show variable, like this:
import Cocoa

protocol DoThis { var show: Bool { get set } }

class ChangerView: NSView {

    var changeDelegate: DoThis?

    // Set up for mouseEntered/-Exited
    override func mouseEntered(theEvent: NSEvent) { changeDelegate?.show = true }
    override func mouseExited(theEvent: NSEvent) { changeDelegate?.show = false }
}

You may want to make the delegate variable weak to prevent reference cycles
The other issue is you've forgot the step where you assign the delegate. I (and I think everyone else) forget this often. Once you get used to setting up delegates you'll remember to check for it if things don't work at first.
So at some point you need to set the changeDelegate var to an instance of the ChangingView class (this is often done in the viewDidLoad() function.
It will look something like this:
class SomeViewController: UIViewController {
    @IBOutlet weak var SomeChangerView: ChangerView!
    @IBOutlet weak var SomeChangingView: ChangingView!

    override func viewDidLoad() {
        super.viewDidLoad()

        SomeChangerView.changerDelegate = SomeChangingView
}


text:
Q: Using gdal_grid in Python with np array I use Python 2.7. The gdal 2.1.2 library is installed.
I have a np array like this:
[[  2.34845824  48.84626174  15.20369   ]
[  2.34966283  48.84910128  13.88528   ]
[  2.35120647  48.85098931  15.76322   ]
...,
[  2.3556567   48.8415611   15.42184   ]
[  2.34394085  48.84248672  15.51128   ]
[  2.34926763  48.85128456  15.0685    ]]

where first and second columns represent my coordinates (specifically, latitude and longitude) and the third one gathers variable values associated to locations. I would like to use gdal_grid directly in Python to obtain an image where at every pixel I have an interpolation of the values of my array using a method like inverse distance weighted.
I found how to do it with gdal_grid, if my data are collected in a csv file (that I will call 'test.csv') and if I create a 'test.vrt' file like this:
<OGRVRTDataSource>
    <OGRVRTLayer name="test">
        <SrcDataSource>test.csv</SrcDataSource>
        <GeometryType>wkbPoint</GeometryType>
        <LayerSRS>WGS84</LayerSRS>
        <GeometryField separator=" " encoding="PointFromColumns" x="field_1" y="field_2" z="field_3"/>
    </OGRVRTLayer>
</OGRVRTDataSource>

I tried to run it in python with the command:
gdal.Grid('test_python.tiff', 'test.vrt', layers='test', algorithm='invdistnn:max_points=10:min_points=1:radius=0.001', format='GTiff', width=333, height=240)

and it works. The problem is that I would like to avoid the conversion of the np array into a .csv, because I need to replicate this operation several times.
How can i do it using directly my np array?
Thank you very much in advance for your help.

A: You cannot.
The input to gdal_grid must be a GDAL-readable format, of which VRT is one. Alternatively, you can save the numpy array as a Tiff/GeoTiff file.
An other alternative, with GDAL >= 2.1, is to use the python binding rather than the command line utility, along with a 'MEM' dataset populated from the numpy array (which at least avoid saving it to disk).


text:
Q: Why do only capital Latin letters respond all font switches in math mode? $\mathbf{\omega}$, for example, does not respond the font switch. Why do only capital Latin letters respond all font switches in math mode?
Note: To bold the \omega, we have to use \boldsymbol{\omega}.
\documentclass{article}
\usepackage{amsmath}
\usepackage{bm}
\begin{document}
Need \verb|\boldsymbol| to bold the \verb|\omega|: $\boldsymbol{\omega}$

No need \verb|\boldsymbol| to bold A: $\mathbf{A}$
\end{document}

A: (Things are different if you use xelatex or lualatex and unicode-math, this is a classic TeX answer)
\mathbf changes the current math group (\fam) This means that characters or commands defined by \chardef (\DeclareMathSymbol) such that their math class is 7 will switch to the specified font. In the standard TeX font settings this only affects upper and lower case latin letters. \omega is treated as a symbol from a fixed font (and in the standard TeX math font encodings changing fonts would not produce the desired result as most of the fonts do not have Greek letters.
Despite the Question Title lower case latin letters do change family (and are affected by \mathbf although some fonts notable \mathcal and \mathbb only have uppercase so while the font switches for lowercase letters, an undesired glyph is selected.


text:
Q: Not sure why I cannot graph in 3D with data successfully plotted in 2D I am working with pandas to graph some data. I successfully plotted in 2D. I now what to use the same x and y used to plot in 2D with the addition of a 3rd variable to graph in 3d.
My dataframe looks something like:
Total attempts     Num Lines Last Attempt      Time of Last Submission
4                     15                       2019-09-01 17:18:43.800202
12                   127                      2019-09-01 17:18:43.822987
3                    148                       2019-09-01 17:18:43.830904
10                    15                      2019-09-01 17:18:43.853714
NaN                  NaN                                NaN
48                    134                       2019-09-01 17:18:43.877629

To plot in in 2d I used the following code:
def vizData(df, asg):
    df['Time of Last Submission'] = pd.to_datetime(df['Time of Last Submission'], errors='coerce')
    mask = ( df['Time of Last Submission'] > '2018-01-01 00:00:00') & (df['Time of Last Submission'] <= '2018-12-31 00:00:00')
    df = df.loc[mask]
    df['Num Lines Last Attempt'] = df['Num Lines Last Attempt'].apply(pd.to_numeric)

    fig, ax = plt.subplots()
    ax.scatter(df['Time of Last Submission'], df['Num Lines Last Attempt'])

    x_min = df['Time of Last Submission'].min() - datetime.timedelta(days=1)
    x_max = df['Time of Last Submission'].max() + datetime.timedelta(days=1)
    y_min = df['Num Lines Last Attempt'].min() - 5
    y_max = df['Num Lines Last Attempt'].max() + 15

    plt.xlim(x_min,x_max)
    plt.ylim(y_min,y_max)
    plt.xlabel('Time of Submission', fontsize=20)
    plt.ylabel('Number of Lines Changed for Last Submission', fontsize=15)
    plt.tick_params(labelsize=18)
    plt.rcParams['figure.figsize'] = [20, 10]
    plt.grid()
    plt.suptitle(asg, fontsize=30)
    plt.title('Time and Number of Lines Changed for the Last Submission', fontsize=25)
    labels = df['Student']
    datacursor(formatter='{label}'.format)
    plt.show()
    plt.close()

I have attempted to plot in 3D using the following:
from mpl_toolkits.mplot3d import Axes3D

def viz3d(df, asg):
    df['Time of Last Submission'] = pd.to_datetime(df['Time of Last Submission'], errors='coerce')
    mask = ( df['Time of Last Submission'] > '2018-01-01 00:00:00') & (df['Time of Last Submission'] <= '2018-12-31 00:00:00')
    df = df.loc[mask]

    df['Num Lines Last Attempt'] = df['Num Lines Last Attempt'].apply(pd.to_numeric)
    df.to_csv('test.csv')
    x = df['Time of Last Submission']
    y = df['Num Lines Last Attempt']
    z = df['Total attempts']

    threedee = plt.figure().gca(projection='3d')
    threedee.plot(x, y, z)
    plt.show()

The 2D plotting works great. When I try the 3D plotting I get the error:
ValueError: view limit minimum -0.05 is less than 1 and is an invalid Matplotlib date value. This often happens if you pass a non-datetime value to an axis that has datetime units

I double-checked the dataframe that there was nothing but datetime values in the intended datetime column. Everything seemed fine, so I am not sure what the issue is.


text:
Q: How to render header footer and main contain separate in nestjs i try this it's working but I have multi pages and i wanna make the same header footer and render on each page ..
@Get('test')
@Render('B2B/test.hbs')
createClient() {
   return { message: 'Hello create_client!' };
}


text:
Q: Need a ruby daemon I'm trying to follow Skinny Daemon tutorial from Head Labs since it does exactly what I need. I also like how the app is make as a gem, but it contains a thin server so I can get my app's pulse if I need it.
I've followed the tutorial and fiddled with it until the point where the gem can be built and installed. But when I try to start my gem it using the following command I get this:
$ myservice start
-bash: myservice: command not found

I suspect the tutorial is a little old and for some reason the gem installer doesn't add the gem location to my path.
How can I make this tutorial work?

A: Firstly, using Jeweler is a little bit obsolete. Use bundle gem instead. Also I don't see in tutorial to specify in .gemfile that there is executable file in bin. How to do this you have here http://guides.rubygems.org/make-your-own-gem/#adding-an-executable. But if you use Bundler to create your gem scaffold then it will be automatically set to:
gem.files         = `git ls-files`.split($\)
gem.executables   = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }


text:
Q: ruby - require & cannot load such file I'm new to ruby and I have a problem loading gems.
I've read every topic about this on SO but I couldn't figure out how to make it work :/
I'm on a fresh install of Ruby 1.9.3 and RubyGems 1.8.11
RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.11
  - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [i386-mingw32]
  - INSTALLATION DIRECTORY: D:/dev/Ruby/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: D:/dev/Ruby/bin/ruby.exe
  - EXECUTABLE DIRECTORY: D:/dev/Ruby/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - D:/dev/Ruby/lib/ruby/gems/1.9.1
     - D:/aoi/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

I've installed the gem twice, once from command line
gem install soap4r

And second time i've tried to use RubyMine installer, but the result where the same,
when I try to
require 'rubygems'
resuire 'soap'

The output is the same :
    LoadError: cannot load such file -- soap
        from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from (irb):1
        from D:/dev/Ruby/bin/irb:12:in `<main>'

Thank you for your help.

A: Get this https://github.com/spox/soap4r-spox and patch your ruby with it, its the default soap module for ruby but was pulled out of 1.9 versions

A: Try to add this to the top of your file:
gem 'soap4r'
require 'soap/wsdlDriver'

Or as an alternative try Savon

A: Have you checked that you do not run multiple different ruby versions ? Then your gems are not bound to the correct ruby version.
Moreover, I notice something strange :

http://rubygems.org/gems/soap : "This gem has been yanked, but it is still available for download for other gems that may have depended on it"

On the contrary, there seems to be another more interesting gem around : soap4r.
There is a tuto here. I especially noticed that sort of lines :

require "soap/rpc/standaloneserver"

That means "require soap" may not be sufficient in your case.


text:
Q: Multiple sliders, buttons controlling all sliders I am trying to use this slider: http://codepen.io/zuraizm/pen/vGDHl
I need to have multiple sliders on the page, up to 10 maybe more. It is for a property listings page, and this is a really light slider.
Currently when you press next, it slides the images for every slider. I know its an ID issue, but is there a simple way to fix this without having to have tens of different id's?
UPDATE!
This is my updated pen, with the sliders working: http://codepen.io/LukeD1uk/pen/LEKBa But it appears each slider is loading the last LI in UL

A: I was thinking something like this...
function moveRight(slider) {
    slider = $(slider);
    slider.find('ul').animate({
        left: - slideWidth
    }, 200, function () {
        slider.find('ul li:first-child').appendTo(slider.find('ul'));
        slider.find('ul').css('left', '');
    });
};

$('a.control_next').click(function () {
    moveRight($(this).parent());
});

Makes it so that the only global selection is a.control_next and then the rest are scoped to where the click actually happened.
EDIT: There are some additional issues with selecting more than you want. Here's another fixed spot.
This
$('#slider ul li:last-child').prependTo('#slider ul');

Becomes this
$('.slider').each(function(slider){
  slider = $(slider);
  slider.find('ul li:last-child').prependTo(slider.find('ul'));
});

This takes the last image in each slider and prepends it to the list so the back button will work. You will run into additional issues if the picture width/height/count differ or if you choose to implement the checkbox autoscroll.
To fix those though you would need to implement a much better structure in the js so that each slider has it's own variables. I don't really have the time to go through and set that up, sorry.


text:
Q: How to put a brace and a title? I would like to put a brace between the Q_s and Q_d of the following diagram
    \begin{tikzpicture}[domain=0:5,scale=1,thick]
\usetikzlibrary{calc}   %allows coordinate calculations.

%Define linear parameters for supply and demand
\def\dint{4.5}          %Y-intercept for DEMAND.
\def\dslp{-0.5}         %Slope for DEMAND.
\def\sint{1.2}          %Y-intercept for SUPPLY.
\def\sslp{0.8}          %Slope for SUPPLY.

\def\pfc{2.5}           %Price floor or ceiling

\def\demand{\x,{\dslp*\x+\dint}}
\def\supply{\x,{\sslp*\x+\sint}}

% Define coordinates.
    \coordinate (ints) at ({(\sint-\dint)/(\dslp-\sslp)},{(\sint-\dint)/(\dslp-\sslp)*\sslp+\sint});
    \coordinate (ep) at  (0,{(\sint-\dint)/(\dslp-\sslp)*\sslp+\sint});
    \coordinate (eq) at  ({(\sint-\dint)/(\dslp-\sslp)},0);
    \coordinate (dint) at (0,{\dint});
    \coordinate (sint) at (0,{\sint});
    \coordinate (pfq) at  ({(\pfc-\dint)/(\dslp)},0);
    \coordinate (pfp) at  ({(\pfc-\dint)/(\dslp)},{\pfc});
    \coordinate (sfq) at  ({(\pfc-\sint)/(\sslp)},0);
    \coordinate (sfp) at  ({(\pfc-\sint)/(\sslp)},{\pfc});

% DEMAND
    \draw[thick,color=blue] plot (\demand) node[right] {$P(q) = -\frac{1}{2}q+\frac{9}{2}$};

% SUPPLY
    \draw[thick,color=purple] plot (\supply) node[right] {Supply};

% Draw axes, and dotted equilibrium lines.
    \draw[->] (0,0) -- (6.2,0) node[right] {$Q$};
    \draw[->] (0,0) -- (0,6.2) node[above] {$P$};

    %Price floor and ceiling lines
    \draw[dashed,color=black] plot (\x,{\pfc}) node[right] {$P_c$};
    \draw[dashed] (pfp) -- (pfq) node[below] {$Q_d$};
    \draw[dashed] (sfp) -- (sfq) node[below] {$Q_s$};

\draw[->,baseline=5] ($(0,{\pfc})+(-1.5,0.7)$) node[label= left:Price Ceiling] {} -- ($(0,{\pfc})+(-.1,0.1)$);

\end{tikzpicture}

The result of the code above WITHOUT the brace wanted is:

Also I would like to know how to make a title when I'm making the above diagram using
\documentclass[class=minimal,border=0pt]{standalone}

A: For the braces, you can use a brace decoration (from the decorations.pathreplacing library); for the title, you can use a \node placed at (current bounding box.north) (or any other desired location), for example:
\documentclass[class=minimal,border=0pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.pathreplacing}

\begin{document}

    \begin{tikzpicture}[domain=0:5,scale=1,thick]

%Define linear parameters for supply and demand
\def\dint{4.5}          %Y-intercept for DEMAND.
\def\dslp{-0.5}         %Slope for DEMAND.
\def\sint{1.2}          %Y-intercept for SUPPLY.
\def\sslp{0.8}          %Slope for SUPPLY.

\def\pfc{2.5}           %Price floor or ceiling

\def\demand{\x,{\dslp*\x+\dint}}
\def\supply{\x,{\sslp*\x+\sint}}

% Define coordinates.
    \coordinate (ints) at ({(\sint-\dint)/(\dslp-\sslp)},{(\sint-\dint)/(\dslp-\sslp)*\sslp+\sint});
    \coordinate (ep) at  (0,{(\sint-\dint)/(\dslp-\sslp)*\sslp+\sint});
    \coordinate (eq) at  ({(\sint-\dint)/(\dslp-\sslp)},0);
    \coordinate (dint) at (0,{\dint});
    \coordinate (sint) at (0,{\sint});
    \coordinate (pfq) at  ({(\pfc-\dint)/(\dslp)},0);
    \coordinate (pfp) at  ({(\pfc-\dint)/(\dslp)},{\pfc});
    \coordinate (sfq) at  ({(\pfc-\sint)/(\sslp)},0);
    \coordinate (sfp) at  ({(\pfc-\sint)/(\sslp)},{\pfc});

% DEMAND
    \draw[thick,color=blue] plot (\demand) node[right] {$P(q) = -\frac{1}{2}q+\frac{9}{2}$};

% SUPPLY
    \draw[thick,color=purple] plot (\supply) node[right] {Supply};

% Draw axes, and dotted equilibrium lines.
    \draw[->] (0,0) -- (6.2,0) node[right] {$Q$};
    \draw[->] (0,0) -- (0,6.2) node[above] {$P$};

    %Price floor and ceiling lines
    \draw[dashed,color=black] plot (\x,{\pfc}) node[right] {$P_c$};
    \draw[dashed] (pfp) -- (pfq) node[below] (qd) {$Q_d$};
    \draw[dashed] (sfp) -- (sfq) node[below] (qs) {$Q_s$};

\draw[->,baseline=5] ($(0,{\pfc})+(-1.5,0.7)$) node[label= left:Price Ceiling] {} -- ($(0,{\pfc})+(-.1,0.1)$);

\draw[decorate,decoration={brace,mirror}] (qs.south) -- node[below] {some text} (qd.south);

\draw[decorate,decoration={brace,mirror}]
  ([yshift=-1.2cm]0,0) -- node[below] {some text} ([yshift=-1.2cm]6.2,0);

\node at ([yshift=10pt]current bounding box.north) {A diagram illustrating supply versus demand};
\end{tikzpicture}

\end{document}


text:
Q: How to get data from Task after running Task.WhenAll(taks) I have multiple Async methods that I can run one by one but When I Use Task.WhenAll, I really don't know how to get the result. Following are my Async methods
    public async Task<IEnumerable<MyModel>> Method1Async()
    {
        return await Task<IEnumerable<MyModel>>.Run<IEnumerable<MyModel>>(() => GetMethod1Data());
    }
    //Here Method1Async().Result will get me the data but don't know how to get the result when I am using Task.WhenAll()

    public async Task<IEnumerable<MyModel>> Method2Async()
    {
        return await Task<IEnumerable<MyModel>>.Run<IEnumerable<MyModel>>(() => GetMethod2Data());
    }

    public async Task<IEnumerable<MyModel>> Method3Async()
    {
        return await Task<IEnumerable<MyModel>>.Run<IEnumerable<MyModel>>(() => GetMethod3Data());
    }

And here is my code where I am using Task.WhenAll
    public async Task GetDataAsync()
    {
        Task[] tasks = new Task[3];

        tasks[0] = Method1Async();
        tasks[1] = Method2Async();
        tasks[2] = Method2Async();

        await Task.WhenAll(tasks).ConfigureAwait(false);
    }

Now if I call

GetDataAsync()

method, I get all ok but don't know how to get the result from the returned task?

A: It will return an Array of type IEnumerable<MyModel> so you can set the return type of your async method to that :
public Task<IEnumerable<MyModel>[]> GetDataAsync()
{
    Task[] tasks = new Task[3];

    tasks[0] = staticDataService.Method1Async();
    tasks[1] = staticDataService.Method2Async();
    tasks[2] = staticDataService.Method3Async();

    return Task.WhenAll(tasks);
}

and then consume it:
IEnumerable<MyModel>[] results = await GetDataAsync();


text:
Q: How to patch Wine and use it In playonlinux I have Wine installed with a ppa on my system and I do not want to change it.
What I want to do is to apply a patch to (This one) and use it in Playonlinux.
I know I can use custom Wine versions in playonlinux, a nice person long time ago send me a patched Wine that I placed in playonlinux wine folder and it used to work.
So can some one help me with this ??
Thank you in advanced

A: I'm not sure what you really want to do (use your PPA'd wine in POL? build wine from source for POL?) but here's what I did to patch a beta wine (1.7 at the time of writing) for testing with POL.
Notes:

*

*I'm using wine instead of wine1.7 because it maps to the newest wine so it will work when the beta is 1.8

*I'm building on an amd64 architecture, which means I'm doing it the hard way. I'm assuming most people now are on amd64, so you should be fine. If you are on i386, then life is simpler for you, but unfortunately this guide will not cover you well. Either figure it out on your own or ping me and I'll see how I can help.

Instructions

*

*Install the ubuntu dev tools: sudo apt-get install ubuntu-dev-tools

*Add the Wine beta PPA to ubuntu as explained here: sudo apt-add-repository -sy ppa:ubuntu-wine/ppa && sudo apt-get update (the -s flag is needed to enable source download)

*Download and patch wine as explained here:

*

*Install build dependencies: sudo apt-add-repository -y ppa:ubuntu-wine/ppa

*Download source to a build directory: mkdir -p ~/src/wine-patches; cd ~/src/wine-patches; apt-get source wine

*patch your source: cd wine*-*; patch -p1 < your.patch
(you may need to massage your patch a bit to fit)

*commit your changes to the package: dpkg-source --commit
This will ask you for your patch name (just type something that makes sense) then open an editor with a lot of template text followed by the text of your patch. make sure to edit the Description field and remove all the boiler plate comments, then save.

*build the deb: dpkg-buildpackage

*wait... go get a cup of coffee... wait some more... go see a show on tv... wait even more... until it is done.

*get back to the root of the build tree, where dpkg put our deb files: cd ..

*Now, because we are on amd64, we just got some amd64 deb files, and we also need the i386 deb files (that's how wine on amd64 works, as it has to load 32-bit windows binaries). So we'll need to cross-build the i386 binaries (if you are on a i386 already, then you can skip this step):

*

*Load some variables: source /etc/lsb-release (I use it so I won't have to know the env code name)

*Create the pbuilder environment for i386: pbuilder-dist $DISTRIB_CODENAME i386 create

*Build wine again with pbuilder: pbuilder-dist $DISTRIB_CODENAME i386 build wine*.dsc --buildresult .

*Wait some more... you know the drill.

*Now the next bit is a bit hacky, because dpkg built us some deb files that are meant to be installed to the root of a FSH-compliant Linux system and thus have everything inside a /usr directory, which the PlayOnLinux type install does not need, so we'll need to extract the deb files into a structure that makes sense to POL:

*

*create a temporary working area: mkdir root

*extract the deb files: for deb in *.deb; do dpkg -x $deb root; done (this will extract the dev and dbg package as well. I don't care, but if you do - write your own command :-p ).

*The above command creates lots of files in root/usr which we will need to move to the new POL wine tree, but first we'd need to create a base directory: mkdir -p ~/.PlayOnLinux/wine/linux-x86/<version>-<your-patch-name> (I'm installing into the wine 32 bit directory, because I'm only interested in using 32 bit under POL. its possible to install to amd64 if you've built on an amd64).

*Move some files around: mv root/usr/{bin,share} <your-pol-wine-dir>

*Move the correct lib directory: mv root/usr/lib/i386-linux-gnu <your-pol-wine-dir>/lib
That's it - your new wine version should be listed in PlayOnLinux's UI and you should be able to use it. This set of instructions are for the beta releases, which tend to be a bit unstable at times - so YMMV. If it doesn't look good, try to repeat the process with a stable version, such as wine1.6.


text:
Q: Alternatives to SQL Server CE? What good alternatives are there to SQL Server CE?
I was also thinking of writing something of my own. But I don't know about performance with 40,000 - 100,000 rows.
All data will be only in string format and it will be only one column. So is it actually worth writing my own data storage?
I will not need to order or sort data in any way, just to add and remove.

A: You can use SQLite.  I guess it really depends on your feature set.  Are you going to be ordering the data often?  Only selecting a subset?  Or loading the entire thing into memory all at once for some reason?

A: If you only want to store a single list of strings, and always load/save them all at once, then a simple text file will be the fastest and easiest.
As soon as you want to do queries etc it this is no longer true.
string[] lines = System.IO.File.ReadAllLines(fileName);


text:
Q: Transparent toolbar for expanded collapsing toolbar I have a collapsing toolbar in my activity with a navigationview. I have followed tutorials to set the collapsing toolbar but I can't have the toolbar transparent as I see on the website.
I want this to be transparent when it's expanded (see the image below) and not transparent when collapsed :

Here is my main.xml :
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="fr.djey.secretapp.MainActivity">

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

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapse_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            android:fitsSystemWindows="true"
            app:expandedTitleMarginStart="48dp"
            app:expandedTitleMarginEnd="64dp">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/image"
                android:fitsSystemWindows="true"
                app:layout_collapseMode="parallax"
                android:scaleType="centerCrop"/>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                app:layout_collapseMode="pin"/>

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

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

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="fill_vertical"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="16dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="16dp">

                <TextView
                    android:id="@+id/description"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/lorem_ipsum"
                    android:textColor="@android:color/black"/>

            </LinearLayout>

        </android.support.v7.widget.CardView>

    </android.support.v4.widget.NestedScrollView>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_dialog_email" />

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

A: Try adding contentScrim to CollapsingToolbarLayout and removing background from your Toolbar
<android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapse_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_scrollFlags="scroll|exitUntilCollapsed"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleMarginStart="48dp"
        app:expandedTitleMarginEnd="64dp">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/image"
            android:fitsSystemWindows="true"
            app:layout_collapseMode="parallax"
            android:scaleType="centerCrop"/>

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            app:layout_collapseMode="pin"/>

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


text:
Q: Removing all traces of Nvidia Drivers Changed my hardware from Nvidia to AMD in PC pretty much for gaming on my windows install. But now i have booted back into Ubuntu and its taking a hissy fit at the change of hardware.
I want to remove all types of drivers, X11 configs, EVERYTHING. Then start from scratch. I have been un-installing and reinstalling drivers for past couple of days with no luck of getting catalyst running successfully.
Any help would be great thanks alot.
Bill

A: Right here goes on how I fixed this.
After uninstalling and reinstalling the drivers multiple times, it wouldn't successfully install the catalyst drivers without some form of issues.
sudo apt-get remove --purge fglrx fglrx-amdcccle

This removed all the AMD drivers or what was left from previous installs.
sudo apt-get --purge remove xserver-xorg-video-nouveau
sudo apt-get purge nvidia-current

Both of these commands then removed what I had from Nvidia drivers.
I then rebooted and instead of installing the AMD drivers from apt-get I used the additional drivers in the system menu. They installed fine and i rebooted again. And boom! They were there.
The thing was I had tried using the additional drivers option before only for it to fail. but not to bother it worked and im now using the latest drivers. I made a complete hash of this one and its not a great solution but a solution nevertheless.
Thanks
Bill