text:
Q: ASPX page open at 110% zoom after adding javascript and little css in CHROME I had a login page for my project, and it worked just fine before. Later, i was supposed to add a popup which i did, but after that all the pages of my project opens at 110% or something zoom level in GOOGLE CHROME, until I don't resize it to 100% again. This ruins the design completely as it's not responsive yet.
This is asp code for popup structure.

        <asp:LinkButton ID="liClose" CssClass="close" runat="server" OnClientClick="popForDownload()" OnClick="liClose_Click"></asp:LinkButton>

        <asp:TextBox ID="txtU" CssClass="popText" placeholder="username" runat="server" Width="45em"></asp:TextBox>
        <%--<asp:RegularExpressionValidator ValidationGroup="popVal" ID="revE" CssClass="v" ControlToValidate="txtE" ValidationExpression="^\d{12}$" ErrorMessage="Invalid Enrollment number!" ForeColor="#ff0000" Display="Dynamic" runat="server"></asp:RegularExpressionValidator>--%>

        <asp:TextBox ID="txtP" CssClass="popText" placeholder="password" TextMode="Password" runat="server" Width="45em"></asp:TextBox>
        <%--<asp:RegularExpressionValidator ValidationGroup="popVal" ID="revP" CssClass="v" ControlToValidate="txtP" ValidationExpression="^[\s\S]{8,}$" ErrorMessage="Password should contain minimum 8 characters!" ForeColor="#ff0000" Display="Dynamic" runat="server"></asp:RegularExpressionValidator>--%>

        <asp:DropDownList ID="ddlT" runat="server" CssClass="ddl" AutoPostBack="true">

        </asp:DropDownList>
        <asp:DropDownList ID="ddlF" runat="server" CssClass="ddl" AutoPostBack="true">

        </asp:DropDownList>
        <asp:DropDownList ID="ddlP" runat="server" CssClass="ddl" AutoPostBack="true">

        </asp:DropDownList>

        <asp:LinkButton ID="liAccepted" CausesValidation="false" CssClass="li" runat="server"> Accepted Updates</asp:LinkButton>
        <asp:LinkButton ID="liDeclined" CausesValidation="false" CssClass="li" runat="server"> Declined Updates</asp:LinkButton>
        <asp:LinkButton ID="liBoth" CausesValidation="false" CssClass="li" runat="server" > Full Update Chart</asp:LinkButton>

Here is the css for it. (Few of the following elements are from the rest of the page which I did made changes to later while creating this popup!)
    #btnAFacultyLogin {
    position: absolute;
    float: right;
    top: 5em;
    right: 15.5em;
}

#btnAStudentLogin {
    position: absolute;
    float: right;
    top: 5em;
    right: 4em;
}

#btnALogin {
    position: absolute;
    float: left;
    bottom: 10em;
    left: 46em;
}

#tblALogin {
    position: absolute;
    float: left;
    top: 11em;
    left: 28em;
}

#ti {
    position: absolute;
    float: left;
    left: 8.6em;
}

.dl {
    position: absolute;
    float: left;
    left: 3em;
    height: 5.5em;
    width: 5.5em;
    outline: none;
    top: 15px;
}

.faded {
    position: absolute;
    float: left;
    top: 7em;
    bottom: 4.3em;
    left: 15em;
    right: 15em;
    border-radius: 3em;
    background-color: rgba(255,255,255,0.65);
    transition: opacity 1s ease;
    visibility: hidden;
    text-align: center;
    text-justify: inter-word;
}

.appear {
    visibility: visible;
    animation: fadeIn 2s;
}

@-webkit-keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.close {
    position: absolute;
    float: right;
    top: 0.3em;
    right: 0.8em;
    font-size: 2em !important;
    color: rgba(0, 0, 0, 0.34);
}

    .close:hover {
        color: rgba(0, 0, 0, 0.54);
    }

    .close:focus {
        color: rgba(0, 0, 0, 0.54);
    }

.popText {
    position: absolute;
    float: left;
    left: 3.2em;
    height: 1.5em;
    padding: 0.35em;
    border-radius: 0.7em;
    outline: none;
    border: 0.14em solid rgba(0,0,0,0);
    background-color: rgba(255,255,255,1);
}

    .popText:focus {
        border-color: rgb(255, 242, 0);
    }

.v {
    position: absolute;
    float: left;
    left: 25em;
    font-size: 0.85em !important;
    font-family: 'Microsoft JhengHei UI';
}

#txtU, #revU {
    top: 1.5em;
}

#txtP, #revP {
    top: 5em;
}

.li {
    position: absolute;
    float: left;
    border: 0.2em solid rgb(255, 242, 0);
    padding: 1em 1em;
    font-size: 1.1em !important;
    font-family: 'Microsoft JhengHei UI';
    border-color: rgb(255, 242, 0);
    color: rgb(255, 242, 0);
    width: 8em;
    text-decoration: none;
    border-radius: 1.5em;
    background-color: white;
    bottom: 2em;
}

    .li:hover {
        background-color: rgb(255, 242, 0);
        color: white;
    }

    .li:focus {
        background-color: rgb(255, 242, 0);
        color: white;
    }

#liAccepted {
    left: 2em;
}

#liDeclined {
    left: 19.8em;
}

#liBoth {
    right: 2em;
}

.ddl {
    position: absolute;
    left: 3.2em;
    font-family: 'Microsoft JhengHei UI';
    color: rgb(95, 95, 95);
    /*margin: 0.5em 0em 1.8em 0em;*/
    /*margin-left: 0em;
    margin-top: 2em;*/
    padding: 0.6em 4em;
    border-radius: 0.7em;
    border: 0.2em solid rgb(95, 95, 95);
    background-color: rgba(139, 139, 139, 0.10) !important;
}

    .ddl:hover {
        color: rgb(87, 82, 0);
        background-color: rgba(87, 82, 0, 0.10);
        border-color: rgb(87, 82, 0);
    }

    .ddl:focus {
        color: rgb(255, 242, 0);
        outline: none;
        background-color: rgba(255, 242, 0, 0.10);
        border-color: rgb(255, 242, 0);
    }

#ddlT {
    top: 8.5em;
}

#ddlF {
    top: 12em;
}

#ddlP {
    top: 15.5em;
}

And this is the javascript I used:

I know this is way too much, but I've been trying to find the solution for this for 2 days, and I would had shortened it if I could. Thanks anyway.

A: I removed text-justify: inter-word; from the css and reset the browser to default. It works fine now.


text:
Q: Using VBA ADO on Excel, I am looking for an Update query to get an univocal, 1 to 1 match I have a table similar to the following (tab1):
ID Descr Related_ID
1  a     2
2  a     1
3  a     1
4  a     1
5  b     6
6  b     5
7  b     5
8  b     5

my query is something like:
Update [tab1] as T1 INNER JOIN [tab1] as t2
ON t1.[Descr] = t2.[Descr]
SET t1.[Related_ID] = t2.[ID]
WHERE t1.[ID] <> t1.[Related_ID]

the idea is to create couple/pair between the rows of the table to get for each line one on only one ID of another line.
What the query is actually doing is overwriting each time Related_ID, with the latter table2 ID.
Instead of just use any ID only once.
The result I would like is like:
ID Descr Related_ID
1  a     2
2  a     1
3  a     4
4  a     3
5  b     6
6  b     5
7  b     8
8  b     7

I would like to create a couple / pair of element where the related_id of one is the ID of the other and viceversa.
Could you help me please?
PS:
A. I am using vba adodb on excel not on access
B. I need to maintain a good degree of efficiency, if I would implement sub query such as WHERE not [ID] IN (SELECT [ID] FROM [tab2] WHERE ...)
the efficiency will be highly impacted (from few seconds to half an hour) as the table has hundreds of rows
thanks

redpajama_set_name: RedPajamaStackExchange


text:
Q: Java Queue Implementation with Pointers I need help understanding this. I know how to implement the queue but there is one small part bothering me. I drew on my notebook the flow of how things work but I don't get how the head has a nextNode without me setting it. How does the head end up pointing to the next node?
public void enqueue(T data){
        count++;
        Node<T> current = tail;
        tail = new Node<>(data);
        if(isEmpty()) {
            ///////////////////////////////////////////////////////////////////////////////
            // when this runs, doesn't head.getNextNode point to null?
            // if the list is empty, then tail is null.
            // On the deque method, I can sout head.getNextNode() and I get data back, how?
            ///////////////////////////////////////////////////////////////////////////////
            head = tail;

        } else {
            current.setNextNode(tail);
        }
    }

Below, the dequeing works fine, I think I'm having an issue understanding the whole reference/pointer thing
public T dequeue() {
        if(isEmpty()) {
            return null;
        }
        count--;
        T dataToRemove = head.getData();
        /////////////////////-+{[UPDATE]}+-////////////////////////////////
        // WHERE DOES HEAD GET THE NEXT NODE FROM? THIS WORKS, BUT WHERE IS
        // THE NEXT NODE COMING FROM IS WHAT I'M ASKING?
        ///////////////////////////////////////////////////////////////////
        head = head.getNextNode();

        return dataToRemove;
    }

A: I figured it out:
When the list is empty, the head points to tail
  then, when the enqueue method gets called again,
  current will be pointing to tail, but head will still be pointing to tail reference
   so now head is pointing to the same reference as current
    in the else statement, current sets next node to the same reference the
    head is pointing to. That's how the head gets its nextNode set.
    When the method runs again, current will
    point to another reference again but head will still be pointing to its original reference. BAM
 public void enqueue(T data){
            count++;
            Node<T> current = tail;
            tail = new Node<>(data);
            if(isEmpty()) {
                head = tail;

            } else {
                current.setNextNode(tail);
            }
        }


text:
Q: HTML & PHP arithmetic calculations based on input given I'm trying to get user input then make calculation based on the input.
Below is the main html. please help

        Welcome there, <?php echo $_POST["name"]; ?>

        ---- YOUR SELECTION -----

    <?php
        $quantity = = echo $_POST["quantity"];
        var_dump($quantity);
        $bidprice = = echo $_POST["bidprice"];
        var_dump($bidprice);
        $total = = $quantity * $bidprice;
        var_dump($total);
    ?>
        Quantity selected: <?php echo $_POST["quantity"]; ?>

        Bid price: <?php echo $_POST["bidprice"]; ?>

        Total: <?php echo $total; ?>

Below is the form that replies based on input, but it can get the name but can't perform calculation. Why?

        <form action="welcome_get.php" method="post">
            What is your name?
            <input type="text" name="name">

            Quantity:
            <input type="number" name="quantity">

            Bid Price:
            <input type="number" name="bidprice">

            <input type="submit">
        </form>

A: You have added "= ="  while assigning to variable like $quantity = = $_POST["quantity"]; This will not allow in php & you don't need to add "echo" while assigning value to variable.
Following example will help you to learn PHP Sintax

            Welcome there, <?php echo $_POST["name"]; ?>

            ---- YOUR SELECTION -----

        <?php
            $quantity = $_POST["quantity"];
           $bidprice = $_POST["bidprice"];
            $total = $quantity * $bidprice;
          ?>
            Quantity selected: <?php echo $_POST["quantity"]; ?>

            Bid price: <?php echo $_POST["bidprice"]; ?>

            Total: <?php echo $total; ?>

Output:
Welcome there, Shivrudra Samshette

---- YOUR SELECTION -----

Quantity selected: 2
Bid price: 100
Total: 200


text:
Q: PHP: Variables in a Postgresql Query Let's say I have these two variables
$number = 1;
$word = "one";

and I want to use them in a pg_query.
This is what I've got:
$result = pg_query($con, 'UPDATE a SET z = ARRAY[{$number}] WHERE word = {pg_escape_literal($word)}');

But it doesn't work..

A: To use string interpolation, you have to use double quotes:
 $x = 3;
 "This works: $x"     // This works: 3
 'This does not: $x'; // This does not: $x

You also can't interpolate function calls into strings like you're attempting with {pg_escape_literal($word)}. You'll need to escape the variable before interpolating it into the string:
$word_esc = pg_escape_literal($word);
$result = pg_query(
  $con,
  "UPDATE a SET z = ARRAY[$number] WHERE word = $word_esc"
);

You could also use sprintf:
$result = pg_query(
  $con,
  sprintf(
    "update a set z=ARRAY[%d] where word = %s",
    $number,
    pg_escape_literal($word)
  )
);

But the best and safest is to use pg_query_params function, as you don't escape any parameter. And it is very easy to forget and expose your site to SQL-injection attacks.
$result = pg_query_params(
  'update a set z=ARRAY[$1] where word = $2',
  array($number,$word)
)

A: Use double instead of single quotes: Double quoted strings expand variables into their values.


text:
Q: Use of DllRegisterServer DllRegisterServer is called, when Windows or OLE wants me to register my classes under HKEY_CLASSES_ROOT\CLSID. But I don't understand why this function has to be implemented, because when Windows/OLE can make calls to my DLL, then my classes are already registered with their CLSIDs and their path to the correct DLL. Can somebody tell me, what I am misunderstanding?

A: You are confounding the chicken and the egg.  In order for COM to help a client app to create objects and marshal calls, it needs to know where your COM server is located.  The client app just uses a number, a GUID, to tell COM what object it needs.  The mapping from a GUID to code in an executable file requires COM to know where that file is located first.  And, if necessary, how to marshal a call on an interface from one apartment to another.
It is registering the server that provides COM with that knowledge.  It writes keys in the registry that COM uses to find the file back.  Like the CLSID key, its InProcServer32 sub-key provides the path to the file.  Etcetera.  Or the manifest embedded in the client app if it chooses to use reg-free COM.
Observing this with SysInternals' Process Monitor can provide a lot of insight.  You'll see what DllRegisterServer() does and how a client app uses those keys.

A: For the peoples wondering about Title of Question
Example of COM object is Dynamic Context Menu ( which would be a DLL)
to register it-
First Make a Random GUID under HKEY_CLASSES_ROOT
Under That GUID make key named "InProcServer32"
set value of this key as full path of your DLL
This is called Manual Registration
people's with no knowledge of registry editing should also be able to register your dll too.
for that, you should write codes to make these GUIDS and InprocServer32 keys etc programatically Under the DLLRegisterServer() Function in your DLL
so that , people with no knoledge of registry editing will be able to type -
regsvr32.exe "full path of your DLL"
in command prompt for registring your DLL
when they type that command, regsvr32.exe will do nothing but call that DLLRegisterServer() in your DLL
and by calling this function, codes of writing registry keys such as making random GUID and InprocServer32 keys will be Executed ( which you have written )
so registry entries will be made and that is called Registration.
so , according to me regsvr32.exe was just created for the people who have less knowledge of how to edit registry.


text:
Q: And multiple values like IN clause How do I get the Cars and Features which have both Feature1 & Feature2 in below table (BMW and Toyota)?
Select Car,Feature
    from Table
    where Feature in ('Feature1','Feature2')

gives all 3 cars, including Honda which has Feature1 only. This is just a simplified example of the actual query, which can have hundreds of values in the IN clause.
Car    Feature
-----  --------
BMW    Feature1
BMW    Feature2
BMW    Feature3
Toyota Feature1
Toyota Feature2
Honda  Feature1

Thanks,
Kiran

A: select Car
from your_table
where feature in ('f1', 'f2')
group by car
having count(distinct feature) >= 2

A: Use a GROUP/HAVING construct where the HAVING tests for the number of elements in your IN clause. This way you guarantee that both features are present.
SELECT cf.Car
    FROM CarFeature cf
    WHERE cf.Feature IN ('Feature1', 'Feature2')
    GROUP BY cf.Car
    HAVING COUNT(DISTINCT cf.Feature) = 2;

A: The IN clause is effectively a nested OR. The following will get you all the cars that have both features.
SELECT U.Car FROM
  (
   Select Car from Table where Feature ='Feature1'
   UNION ALL
   Select Car from Table where Feature ='Feature2'
  ) AS U
WHERE COUNT(U.Car) > 1


text:
Q: Headphones not showing up in playback devices menu - windows 10 I recently upgraded my computer to windows 10 from windows 8.1, and I'd like to set my audio output quality to studio, and apply the same audio enhancements that I used on windows 8.1 .
I can't do this, because my computer isn't displaying the headphones as a separate from the built in speakers in the "playback devices" menu. When I plug in the headphones it tells me that I've plugged something into the audio jack and the output switches over to the headphones exclusively, but I still can't see them listed.
My other windows 10 machine does this too, but I was able to get around this by applying the enhancements and the quality switch directly to the built in speakers.
Any idea why it's doing this?

A: Here's what you need to do;
Plug in your headphones
Right-click the speaker icon in the system tray and go to 'Sounds'
In the playback tab, right-click the default speakers and select show disabled devices and show disconnected devices. Your headphones should now appear here.
Right-click the headphones and select 'enable'
If you need images, this is a tutorial: http://www.addictivetips.com/windows-tips/how-to-auto-adjust-volume-for-headphones-in-windows-10/
Disclaimer: I'm the editor for the blog I've linked to above.

A: I know this is a necro post.. but it might help somebody else.
I had the same issue after reinstalling Windows 10 recently.  The problem for me was that it installed "old" version of Windows 10 and I didn't know it.  Using update to current version of Windows added in the ability to choose between different speakers and headphones in the playback devices menu.  That was included in the Anniversary update I believe.
I had spent hours trying to research why I wouldn't have those options in the drop down menu of playback devices.  Hopefully that's just your issue too as it's an easy fix if so.


text:
Q: How to get missing Source Image name in Unity3d? Is there way to get the missing image name directly?
Missing Sprite

A: Go to image inside your project files, click on it and in Inspector you will see Texture type property. Check if it is set to Sprite (2D and UI) since by default when you add image it is set to default and some unity components can't see it.


text:
Q: show custom toolbar only with certain xls-file i have a macro (Makro1) that is assigned to a button in a custom toolbar (Custom1) with caption "Schutzstatus". i want the toolbar only to be loaded with this very xls-file.
can someone help me out with the code?
i managed to customize the tooltip:
Application.CommandBars("Custom1").Controls(1).TooltipText = "Abfrage des Schutzstatus der Arten im Zwischenspeicher"

but i fail in creating the whole thing by vba..
thanks in advance,
kay

A: You don't actually need to (re)create the whole toolbar on loading your XLS, but you need to display/hide it during certain navigations
1 create the toolbar
2 attach it to your XLS (view / toolbars / customize .... / attach)
3 create event procedures to show/hide your toolbar; unless you want to have a specific behaviour for different sheets, the following should be enough to care for all navigation:
Private Sub Workbook_Activate()
    ' show toolbar
    Application.CommandBars("CoolBar").Visible = True
    Application.CommandBars("CoolBar").Controls(1).TooltipText = "C'mon squeeze me"
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ' drop toolbar
    Application.CommandBars("CoolBar").Delete
End Sub

Private Sub Workbook_Deactivate()
' see if we have a toolbar (it might have been already deleted by "Workbook_BeforeClose"
' if yes - hide it
Dim Idx As Integer

    For Idx = 1 To Application.CommandBars.Count
        If Application.CommandBars(Idx).Name = "CoolBar" Then
            Application.CommandBars("CoolBar").Visible = False
        End If
    Next Idx
End Sub

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
' display toolbar
    Application.CommandBars("CoolBar").Visible = True
End Sub

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
    Application.CommandBars("CoolBar").Visible = False
End Sub

Place all in the "ThisWorkbook" object - so they fire on all sheets.
4 After saving the toolbar with the XLS and testing, close the XLS - the toolbar will be still present in your application object - and delete the toolbar from there. Don't panic, it's coming back when you re-open your XLS file.
Hope this helps
Tschüss MikeD

A: Actually the answer was close but didn't work for me. That .Delete does delete the command bar completely as confirmed by Kay in his last comment. You basically had to recreate but bar and button again when the workbook is opened. Below is the improved code:
Private Sub Workbook_Activate()
    ' show toolbar
    Dim SortBar As CommandBar
    Dim BarControl As CommandBarControl

    Set SortBar = FindCommandBar("SortBar")

    If SortBar Is Nothing Then
        Set SortBar = Application.CommandBars.Add("SortBar")

        Set BarControl = SortBar.Controls.Add
        BarControl.OnAction = "Your_Macro_Name"
        BarControl.Caption = "Text for your button"
        BarControl.Style = msoButtonCaption
    End If
    SortBar.Visible = True
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ' drop toolbar
    Application.CommandBars("SortBar").Delete
End Sub

Private Sub Workbook_Deactivate()
' see if we have a toolbar (it might have been already deleted by "Workbook_BeforeClose"
' if yes - hide it
    Dim SortBar As CommandBar
    Set SortBar = FindCommandBar("SortBar")
    If Not SortBar Is Nothing Then
        SortBar.Visible = False
    End If
End Sub

Private Function FindCommandBar(Name As String) As CommandBar
Dim Idx As Integer
    For Idx = 1 To Application.CommandBars.Count
        Set FindCommandBar = Application.CommandBars(Idx)
        If FindCommandBar.Name = Name Then
             Exit Function
        End If
    Next Idx
    Set FindCommandBar = Nothing
End Function

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
' display toolbar
    Application.CommandBars("SortBar").Visible = True
End Sub

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
    Application.CommandBars("SortBar").Visible = False
End Sub


text:
Q: How can I enter data into a new column based on the value of another column in a data frame? I have a very large data frame with campaign finance data - the data frame has a column for the candidate's committee name, but not one for the candidates name.
How can I add a new column for the candidates name automatically based on the committee name? I want the code to read the committee name in each row, and then assign the appropriate candidate name.

A: Assuming there is a one to one mapping between committee name and candidate name, which you can describe in a dictionary, you would just need to use the map function.
Example Code:
>>> import pandas as pd
>>> data  = pd.DataFrame([["A"], ["B"], ["A"], ["C"]], columns=["Committee Name"])
>>> data
  Committee Name
0              A
1              B
2              A
3              C
>>> committee_name_mapping = {"A": "AName", "B": "BName", "C": "CName"}
>>> data["Candidate Name"] = data["Committee Name"].map(committee_name_mapping)
>>> data
  Committee Name Candidate Name
0              A          AName
1              B          BName
2              A          AName
3              C          CName


text:
Q: Elementos HTML ultrapassam a largura da tela Como posso fazer para o componente criado respeitar a largura da tela? O que estou criando está ultrapassando os limites da tela e não consigo fazê-los respeitar esses limites.
Abaixo segue o meu código de treino.

/* =============== RESET =============== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-radius: 0.5rem;
}

body {
  display: flex;
  width: 100%;
  /* overflow-x: hidden; */
}

#profile {
  position: absolute;
  width: 21.75rem;
  /*348px*/
  height: 18.25rem;
  /*292px*/
  left: 2.5rem;
  /*40px*/
  top: 2.5rem;
  /*40px*/
  background-color: blue;
}

#links {
  position: absolute;
  width: 21.75rem;
  /*348px*/
  height: 21.75rem;
  /*348px*/
  left: 2.5rem;
  /*40px*/
  top: 22.625rem;
  /*362px*/
  background-color: blueviolet;
}

#technologies {
  position: absolute;
  width: 21.75rem;
  /*348px*/
  height: 13rem;
  /*208px*/
  left: 2.5rem;
  /*40px*/
  top: 46.25rem;
  /*740px*/
  background-color: brown;
}

#experiences {
  position: absolute;
  width: 21.75rem;
  /*348px*/
  height: 21.8125rem;
  /*349px*/
  left: 2.5rem;
  /*40px*/
  top: 61.125rem;
  /*978px*/
  background-color: cornflowerblue;
}

#education {
  position: absolute;
  width: 21.75rem;
  /*348px*/
  height: 22rem;
  /*352px*/
  left: 2.5rem;
  /*40px*/
  top: 84.8125rem;
  /*1357px*/
  background-color: deeppink;
}

#my-projects {
  position: absolute;
  width: 59.5rem;
  /*952px*/
  height: 5.375rem;
  /*86px*/
  left: 28rem;
  /*448px*/
  top: 2.5rem;
  /*40px*/
  background-color: green;
}

#my-projects .project1 {
  position: absolute;
  width: 28.8125rem;
  /*461px*/
  height: 11.625rem;
  /*186px*/
  left: 0;
  /*448px*/
  /*LEFT=0 POIS ESTÁ EM RELAÇÃO AO MY-PROJECTS*/
  top: 7.9375rem;
  /*157px*/
  background-color: greenyellow;
}

#my-projects .project2 {
  position: absolute;
  width: 28.8125rem;
  /*461px*/
  height: 11.625rem;
  /*186px*/
  left: 30.6875rem;
  /*491x*/
  top: 7.9375rem;
  /*157px*/
  background-color: mediumspringgreen;
}

#recent-posts {
  position: absolute;
  width: 59.5rem;
  /*952px*/
  height: 5.375rem;
  /*86px*/
  left: 28rem;
  /*448px*/
  top: 25.1875rem;
  /*403px*/
  background-color: mediumvioletred;
}

#recent-posts .post {
  position: absolute;
  width: 59.5rem;
  /*952px*/
  height: 12.5625rem;
  /*201px*/
  left: 0;
  /*LEFT=0 POIS ESTÁ EM RELAÇÃO AO PROJECT1 E PROJECT2*/
  top: 9.125rem;
  /*146px*/
  /*LEFT=0 POIS ESTÁ EM RELAÇÃO AO PROJECT1 E PROJECT2*/
  background-color: violet;
}
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Estudo</title>

  <link rel="stylesheet" href="style.css">

A: A unidade rem pode ser útil para elementos de layout, porém, foi especificada para definir tamanhos de fonte (font-size). 1rem equivale ao valor de font-size do elemento html. Pelo que entendi, o comportamento que você espera é que as caixas caibam dentro da viewport, então, você pode utilizar uma unidade que é relativa ao tamanho da viewport, como por exemplo:

*

*1vw Relativo a 1% da largura da viewport.

*1vh Relativo a 1% da altura da viewport.

*% Relativo ao tamanho da propriedade no elemento pai.

Se você substituir as unidades dos width e height para %, e definir width: 100vw; para o body para que ele ocupe a tela inteira, pode alcançar o resultado esperado.
Se o que você deseja é que os elementos 'vazem' para fora da tela, porém com a scrollbar oculta, overflow-x: hidden; no body deve resolver.

A: Oi, então pelo que entendi, vc quer uma tela responsiva e pra isso é precisa estudar grid e flexbox, que já vi no seu código. Além disso, position absolute nesse caso pode atrapalhar a responsividade, tenta também uso de % ou px.Em resumo, não desiste e corrigi esses detalhes, estuda mais flex e testa em seu código. No início é assim mesmo, bons estudos!!


text:
Q: Cassandra: error when querying based on a value in a set collection I've got a table called place_ratings with column headers rating_id, place_id, place_name, place_rating, and cuisines.
The primary key is rating_id and it is an integer.
place_id is an integer, as is place_rating.
place_name is of type text.
cuisines is a set collection of type text.
Sample data for one row in the table is as follows:
rating_id = 5
place_id = 658
place_name = 'Bobbys Burgers'
place_rating = 10
cuisines = { 'Burgers', 'Chips', 'Milkshakes' }
I am trying to write a query to return all of the rows where the cuisine is 'Pizzeria' only.
This is my code:
SELECT place_id, place_name, place_rating FROM place_ratings WHERE cuisines = { 'Pizzeria' };
However, I get the following error message:
InvalidRequest: Error from server: code=2200 [Invalid query] message="Collection column 'cuisines' (set<text>) cannot be restricted by a '=' relation"
What changes do I need to make to my code to get my query to run correctly?
Thanks!

A: You can create a secondary index for that column, and then search using this index (see documentation for more information):
CREATE INDEX cousine_idx ON place_ratings ( cuisines );
SELECT * FROM place_ratings WHERE cuisines CONTAINS 'Pizzeria';

But usually such queries aren't the good fit for Cassandra as they require the scanning of data on all nodes to find the actual rows containing the data - because you didn't provide the partition key.  Although if you'll add a restriction on partition key, for example, search for pizzerias in specific city, then it will work better.


text:
Q: Is liquibase using a timestamp to create its temp folders? We run a lot of releases, and because of this we have threaded them, all kicking off at the same time, on the same server.
We've noticed, however, that when multiple releases with liquibase kick off at the same time, to different databases, they invariably fail.
This leads me to wonder how they are stepping on each other. It seems to be time-based, as running these releases individually after they have failed is successful.
Am I right about this? Is there a way to avoid it?


text:
Q: Can a bipartite summation graph have a unique solution? Suppose we define a summation graph $G$ as follows:
Each vertex $v \in G$ has a unique but unknown value ascribed to it. Each edge $e \in G$ is labelled with the sum of the values of the two vertices it joins.
This construction corresponds to a system of equations where each equation is of the form $v_a + v_b = e_{ab}$ where $v_1$ and $v_2$ correspond to the unknown values of two vertices $a$ and $b$, and $e_{ab}$ the value of the edge joining the two.
Now, if there is any odd cycle, it's known that there will always be a unique solution for just that cycle. But with an even cycle, there are either an infinite number of possible values, or an inherent contradiction in the values of the edges that make a solution impossible.
So my question is this: is it possible that there is some bipartite graph (which has no odd cycles, but can have a bunch of even cycles joined together) that has a configuration of values with a unique solution?

A: No, you can just add $x$ to the nodes in one part and $-x$ to the nodes in the other part to get another solution.
It might be possible to get such a case if your values had to be non-negative.


text:
Q: Google maps api autocomplete to flex How can I use the Google maps auto complete api in flex?
I want to perform simple HTTP call that will give me result with all the suggestions in XML or JSON format


text:
Q: MonoTouch - type load exception, updated program not registered in simulator I've installed trial version of MonoTouch, and I'm evaluating it for use.
This strange error has occurred:

Could not load 'MyProductName' for registration. This could be due to
  an outdated assembly kept by the simulator, location: /PathToMyProduct

Followed by:

A type load exception has occurred.

My guess is that, somehow some assembly is not up to date. So I've tried to remove it from the given path. But still it's there. So I performed a purge (reinstalled MonoTouch, removed binary build path, in simulator path, uninstalled from simulator, reset simulator, and finally restarted the OSX). But still it's there.
Any hints on how to solve this peculiar problem?
regards,
Kate

A: That message covered most of the cases where such an exception occurred. This was fixed (actually we worked around the simulator bug) in MonoTouch 5.0+ (even earlier but I don't recall exactly which version). Simply resetting the simulator is enough to fix this condition.
However this is unlikely the situation you're facing since you did a lot more than what would have been required.
My guess would be that the project includes an assembly that refers to types that are not available in MonoTouch (e.g. from System.Reflection.Emit) or compiled against a different version of the framework (e.g. reusing an assembly binary compiled against .NET 4.0). However both cases do not generally lead to this error message so it could be something else.
It will be hard to further diagnose the problem without having the binaries. Could you either open a bug report on http://bugzilla.xamarin.com (you can mark the attachment as private) or send an email to support@xamarin.com (with the project attached) ?

A: So after a sleepless night and 24 hour streak, I've finally figured it out! There was an abstract class, and this descendant class doesn't implemented its method. So whenever this class was mentioned in a code, it caused a type load exception. There was no warning in MonoDevelop, it compiled fine, it run fine, it crashed terribly. That's madness! I've implemented the override on this abstracted method, and voilà, it now works as nothing happened. This is possibly a MonoDevelop error, but it also could be in some special iPhone compiler. So be aware of that. This is a simplied situation:

    public abstract class Parent : UITableViewDataSource
    {
        ..fields/constructors/methods and things

        // one method overriden just fine
        public override Int32 RowsInSection(UITableView tableView, Int32 section)
        {
            return SomeReasonableResult;
        }

        // other one is made abstract, and passed to descendants
        public abstract override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath);
    }

Now later on descendant class:

    public class Child : Parent
    {
        // GetCell method not implemented! No error or warning in compiler, or run log!
        // but when mentioned in a different class (for example) it crashes.
    }

Maybe it's a known behavior or limitation. But still madness.
I'm going to sleep now...


text:
Q: windows 10: some icons show default picture at the quick launch bar Quite a while ago I created a "separator" icon to get a more neat quick launch bar. I do not remember anymore how I finally created the .ico file.
Unfortunately only the default picture is shown (magnified view)
:
The icon looks like this:  when the .ico file is opened for example in Photo.
Question: where can I find the right setting so that the icon will be displayed correctly?
Thanks in advance!

A: The quick launch bar shows icons for the items in your Quick Launch folder ([user folder]\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch). If you open the Properties dialog for those "shortcut" files, on the Shortcut tab, towards the bottom will be a button labeled "Change Icon ...". Pressing it will show the icon and where it is located. A "Browse" button will let you explore various folders that contain icons, so find where the icon file you wish to show is, and choose it.

A: @kreemoweet: I had put several .ico files in the quick launch folder. You can see the result in the clipped screenshot of my initial posting.
If I click on the properties in the quick launch bar of those .ico files no option is shown for change icon.
Based on your answer I put the .ico file in another folder and added actual shortcuts in the quick launch folder. Then I changed the icon for each of the (relevant) shortcuts.
And that seems to work out (I am curious what will happen after the next restart, tough). Thanks for your swift reaction to my posting!
The result now looks like this:
Brief update on December 2022: This approach works like a charm even more than a year and many reboots later. Problem solved.


text:
Q: Coded width is displaying and reporting incorrectly We're sending out marketing emails through Pardot and we've encountered a problem where the main table that houses the content is showing up as 640px even though there are several explicit inline and CSS codes setting it to 600px. This is a problem because we set our images to 600px and the extra width creates a visual imbalance. We've tried expanding everything out to 640px as a workaround but we'd love a more robust solution. This also is a relatively new issue.
Under Chrome developer tools, the "Computed" tab reports a width of 640px, but when you expand it to see the computed code, it only reports the original 600px callout.
I've tried editing the code in Chrome, and there's something that's prohibiting it from displaying less than 640px. It'll go wider but not skinnier.
Pardot's email previewer doesn't show this problem, and their rendering tests that predict the email's appearance in different clients all show 600px width. But in all my testing every browser and email client shows the 640px issue once we send an actual test.
I can't find anything in the code to my knowledge that is causing this. Any ideas? Here's a link to view the problem code: http://go.pardot.com/webmail/230162/23104123/8b59c2b28e0bfe75832f8b05f1cffe75db30d7e629d62bb911837a69fb41b773
And here's a link to view the "good" code: http://bfoneill.com/pardottest/
Any help is greatly appreciated. We're not handcuffed, but these go out to a good amount of people and if we could get them looking sharp that'd be ideal.

A: Try this:
Add width:100% to the img tag under the title "Video of the Week".

A: There is padding of 20px around Video of the week that is causing the issue. The image is 600px wide and adding 20px padding on the sides makes it 640px. Below is the code fixed.
What I have done to fix the video of the week section:

*

*Removed padding around the

*added padding-left for the heading

*added a table for the copy and adding padding around it

     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

    <meta property="og:title" content="Proof - Subject" />

    <title>Proof - Subject</title>

         Welcome to this week's PULSE!
         Email not displaying correctly?

         View it in your browser.

         New look, same great content!

Enjoy Dominion Riverrock and Plenty of Outdoor Adventures in RVA

Travel Pulse

         Whether going on a stroll through walkable neighborhoods, relaxing along the riverfront, or taking part in Dominion Riverrock, the country's largest outdoor music and sports festival, Richmond has a lot to offer. Read More

         Movement Makers Attendees Ready for Active
Learning

Sports Backers Blog

         The Movement Makers National Active Living Summit presented by VCU Health takes place May 17-19 and there's no better way to illustrate what you'll learn at the Summit than to hear from those attending. Read More

         10 Classic Running Rules to Apply to Everyday Life

Runner's World

         The main principles that make you a better runner can also help you out in other areas of your everyday life. Read More

         Biking Opportunities for All in
RVA

Boomer Magazine

Whether you're cruising the countryside, riding around the city, or exploring the Virginia Capital Trail, cycling in RVA can be just about whatever you want to make it. Read More

         15 Tips for Getting in 15,000 Steps A Day

Houston Chronicle

Moving more throughout the day will not only reduce your risks for cardiovascular disease, but also significantly improve your health. Use these tips to hit that 15,000 step mark each day. Read More

         The Bicycle Name Game

Bicycle Times

         Ever wonder who comes up with the names for bikes? It turns out the process can be one of the most fun, and frustrating, jobs in the bike industry. Read More

Video of the Week

          Outdoors in the City: Local filmmaker and outdoor enthusiast Christian Wood put together this short film titled 'Outdoors in the City,' highlighting a few of Richmond's most popular outdoor pursuits including rock climbing, mountain biking, and kayaking. Take a look and enjoy!

Who is Sports Backers?

We're a non-profit organization, dedicated to building a more active community! Donate, volunteer or enter an event to help support our mission!

Have some thoughts, suggestions, or story ideas? Email pulse@sportsbackers.org

          Forward to Friend

Copyright © 2017, All rights reserved.

         Our mailing address is:

Sports Backers
100 Avenue of Champions
Richmond, VA 23230

unsubscribe from all emails   update subscription preferences

Let me know if this works for you.
Cheers


text:
Q: Prop.test on count data with multi-level factors in R I'm having trouble figuring out if prop.test can run this much data (See below) or if I would need to run the code for each level of the factor "Zone" individually. So far I've seen many examples written in this format, but I have many more factor levels:
# Whipray "Zone"
prop.test(c(4,4,0), c(9,7,15))

I'd like to know if there are statistically different proportions of fish with empty stomachs over the years and between locations all at once, i.e test the null that there are no differences at any point in time or place (along with a pairwise test to see where those differences are, if they exist).
Count of fish with empty stomachs
> table1 <- xtabs(empty_count ~ Zone + Year, data = df)
> table1
           Year
Zone        2016 2017 2018
  Crocodile    0    8    2
  Rankin       3   17    8
  West         7   31   17
  Whipray      4    4    0

Count of all fish caught
> table2 <- xtabs(total_count ~ Zone + Year, data = df)
> table2
           Year
Zone        2016 2017 2018
  Crocodile    1   18    7
  Rankin      14   46   69
  West        29   67   58
  Whipray      9    7   15

A: I think I've managed to reverse-engineer your original data frame from the cross-tabs:
df
#>         Zone Year total_count empty_count
#> 1  Crocodile 2016           1           0
#> 2     Rankin 2016          14           3
#> 3       West 2016          29           7
#> 4    Whipray 2016           9           4
#> 5  Crocodile 2017          18           8
#> 6     Rankin 2017          46          17
#> 7       West 2017          67          31
#> 8    Whipray 2017           7           4
#> 9  Crocodile 2018           7           2
#> 10    Rankin 2018          69           8
#> 11      West 2018          58          17
#> 12   Whipray 2018          15           0

It seems to me that rather than attempting multiple pairwise comparisons you could carry out a single logistic regression to find out where the significant differences are. Just ensure you have a "non-empty" count column, and that your years are factors:
df$non_empty_count <- df$total_count - df$empty_count
df$Year <- as.factor(df$Year)

And your logistic regression looks like this:
model <- glm(cbind(empty_count, non_empty_count) ~ Zone + Year,
             data = df, family = binomial)

summary(model)
#>
#> Call:
#> glm(formula = cbind(empty_count, non_empty_count) ~ Zone + Year,
#>     family = binomial, data = df)
#>
#> Deviance Residuals:
#>      Min        1Q    Median        3Q       Max
#> -2.47563  -0.59548   0.04512   0.56564   1.26509
#>
#> Coefficients:
#>             Estimate Std. Error z value Pr(>|z|)
#> (Intercept)  -0.9588     0.5360  -1.789   0.0737 .
#> ZoneRankin   -0.4864     0.4740  -1.026   0.3048
#> ZoneWest      0.1281     0.4552   0.281   0.7784
#> ZoneWhipray  -0.1395     0.6038  -0.231   0.8173
#> Year2017      0.7975     0.3659   2.180   0.0293 *
#> Year2018     -0.3861     0.3831  -1.008   0.3136
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
#> (Dispersion parameter for binomial family taken to be 1)
#>
#>     Null deviance: 39.255  on 11  degrees of freedom
#> Residual deviance: 11.800  on  6  degrees of freedom
#> AIC: 57.905
#>
#> Number of Fisher Scoring iterations: 5

Which you can interpret as saying that while the proportion of empty stomachs didn't vary significantly between sites, there was a significantly higher proportion of fish with empty stomachs in 2017 compared to other years across all sites.

Reproducible data
df <- structure(list(Zone = structure(c(1L, 2L, 3L, 4L, 1L, 2L, 3L,
4L, 1L, 2L, 3L, 4L), .Label = c("Crocodile", "Rankin", "West",
"Whipray"), class = "factor"), Year = c(2016, 2016, 2016, 2016,
2017, 2017, 2017, 2017, 2018, 2018, 2018, 2018), total_count = c(1L,
14L, 29L, 9L, 18L, 46L, 67L, 7L, 7L, 69L, 58L, 15L), empty_count = c(0L,
3L, 7L, 4L, 8L, 17L, 31L, 4L, 2L, 8L, 17L, 0L)), row.names = c(NA,
-12L), class = "data.frame")

Created on 2022-02-09 by the reprex package (v2.0.1)


text:
Q: facebook comment box error: The comments plugin requires an href parameter i am using facebook connect apps for facebook comment box on my website i have follow tutorial on https://developers.facebook.com/blog/post/2009/02/19/commenting-with-facebook-connect/
and put the things step by step on my website and its works fine but when i put same thing in my other website its show me this error
The comments plugin requires an href parameter.
what am i doing worng?

A: Just create the comment plugin with the official generator and you are fine:

https://developers.facebook.com/docs/reference/plugins/comments/

of course you need a link for the comment plugin, just take your actual page. it´s kind of a unique id for the comment plugin, so you should never change it when you got comments already.
Btw, the tutorial link you posted is from 2009. If you want to implement something, try to find a newer source next time ;)


text:
Q: Accessing nested XML - going upwards How do I find Item No = "0002" , if Detail ID = "5" is given?
const Detail_id= "5";

let xRes = xmlDoc.evaluate(`//Item/Details/Detail[@Id="${Detail_id}"]`,
xmlDoc.documentElement);

How do I go upward now to find Item No = "0002"
<xml>
  <Items>
    <Item No="0001">
      <Details>
        <Detail Id="3">
          <Colors>
            <Color colorName="green" />
            <Color colorName="yellow" />
          </Colors>
        </Detail>
      </Details>
    </Item>
    <Item No="0002">
      <Details>
        <Detail Id="5">
          <Colors>
            <Color colorName="purple" />
            <Color colorName="pink" />
          </Colors>
        </Detail>
        <Detail Id="6">
          <Colors>
            <Color colorName="grey" />
            <Color colorName="orange" />
          </Colors>
        </Detail>
      </Details>
    </Item>
  </Items>
</xml>

Below code works fine. For going downwards. Below gives all details of <Item No="0002">. Like Detail Ids and colorNames
const SEARCH_NO = "0002";

let xRes = xmlDoc.evaluate(`//Item[@No="${SEARCH_NO}"]`, xmlDoc.documentElement);
const foundNode = xRes.iterateNext();
if (foundNode) {
  xRes = xmlDoc.evaluate('Details/Detail', foundNode);
  let detailNode;
  while ( !!( detailNode = xRes.iterateNext() ) ) {
    const li = showDetail(detailNode.getAttribute("Id"));
    const colXres = xmlDoc.evaluate('Colors/Color/@colorName', detailNode);
    let colorTextNode;
    while ( !!( colorTextNode = colXres.iterateNext() ) ) {
      showColor(li, colorTextNode.textContent);
    }
  }
}

A: Instead of "going upward" after selecting your targeted Detail, adapt your XPath to select the targeted Item directly by adding a predicate to it.
Change
//Item/Details/Detail[@Id="${Detail_id}"]

to
//Item[@No="${SEARCH_NO}" and Details/Detail/@Id="${Detail_id}"]

Or, if you don't know SEARCH_NO and just wish to find the Item ancestor of the targeted Detail,
//Item[Details/Detail/@Id="${Detail_id}"]

From comments:

Yes, I need to find the search_no.

Then
//Item[Details/Detail/@Id="${Detail_id}"]/@No

See also

*

*Use a predicate rather than the parent:: or ancestor:: axis


text:
Q: Getting error while executing program to swipe down the screen using Appium I am getting an error while executing program to swipe down the screen using Appium.
Whilst the code works fine for a swipe right or left, I  get an error when swiping down the screen.
I am almost banging my head for few days. Please help. I have attached the code and the error message for your review.
Thanks in advance.
code:-
public class SwipeScreen {
    AndroidDriver dr;
    @Test
    public void testApp() throws MalformedURLException, InterruptedException{
    DesiredCapabilities capabilities = new DesiredCapabilities("appWaitActivity", null, null);
    File app =new File(System.getProperty("user.dir")+"\\app\\net.one97.paytm (1).apk");
    capabilities.setCapability(CapabilityType.BROWSER_NAME, "android");
     capabilities.setCapability("deviceName","samsung-gt_i9060-42035bec4397 c000");
      capabilities.setCapability("PlatformVersion","4.2.2");
      capabilities.setCapability("PlatformName","Android");
      capabilities.setCapability("app",app.getAbsolutePath());
     // capabilities.setCapability("appPackage","com.android.settings");
     // capabilities.setCapability("appActivity","com.android.settings.SettingsTabActivity");
      dr = new AndroidDriver(new URL("http://192.168.10.165:4723/wd/hub"),capabilities);
      dr.manage().timeouts().implicitlyWait(4, TimeUnit.SECONDS);
    Thread.sleep(50000);
    System.out.println(dr.manage().window().getSize().getWidth());
    System.out.println(dr.manage().window().getSize().getHeight());
    int screenWidth = dr.manage().window().getSize().getWidth();
    int screenHeight = dr.manage().window().getSize().getHeight();
    //Swipe Right
    int startx = screenWidth*8/9;
    int endx = screenWidth/9;
    int starty = screenHeight/2;
    int endy = screenHeight/2;
    dr.swipe(startx, starty, endx, endy, 5000);
    Thread.sleep(50000);
     //Swipe Left
    startx = screenWidth/9;
    endx = screenWidth*8/9;
    starty = screenHeight/2;
    endy = screenHeight/2;
    dr.swipe(startx, starty, endx, endy, 5000);
    Thread.sleep(50000);
    //swipe down
    startx = screenWidth/2;
    endx = screenWidth/2;
    starty = screenHeight*6/7;
    endy = screenHeight/5;
    dr.swipe(startx, starty, endx, endy, 10000);
    Thread.sleep(50000);
    //swipe up
    startx = screenWidth/2;
    endx = screenWidth/2;
    starty = screenHeight/6;
    endy = screenHeight*5/6;
    dr.swipe(startx, starty, endx, endy, 5000);

    }

}

Error:-
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session.
Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:58'
System info: host: 'Halcyon2-PC', ip: '192.168.140.172', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_67'
Driver info: driver.version: AndroidDriver

A: As your problem was already mentioned few times on the Internet with no strict solution:link1 link2 link3
I'll post here line of code which you can try to implement. It does the job for me.
action.press(startX1,startY1).waitAction(2000).moveTo(endX1,endY1).release().perform();


text:
Q: What is the output of the following code in C? Please take a look at this code.
 #include <stdio.h>

int main()
{
    char *p;
    p = "%d";
    p++;
    p++;
    printf(p-2,23);
    return 0;
}

I have the following questions
1) How can a pointer to a character data type can hold a string data type?
2) What happens when p is incremented twice?
3) How can the printf()can print a string when no apparent quotation marks are used?

A: the following explains each statement in the posted code:
 #include <stdio.h>// include the header file that has the prototype for 'printf()'

int main( void )   // correct signature of 'main' function
{
    char *p;       // declare a pointer to char, do not initialize
    p = "%d";      // assign address of string to pointer
    p++;           // increment pointer (so points to second char in string
    p++;           // increment pointer (so points to third char in string
    printf(p-2,23);// use string as 'format string' in print statement,
                   // and pass a parameter of 23
    return 0;      // exit the program, returning 0 to the OS
}

A: 1) How can a pointer to a character data type can hold a string data type?
Ans: String is not a basic data type in C. String is nothing but a continuous placement of char in memory until '\0' is encountered.
2) What happens when p is incremented twice?
Ans: It now points to the '\0' character.
3) How can the printf()can print a string when no apparent quotation marks are used
Ans: A string is always represented in quotation marks so extra quotes are not needed.

A: "How can a pointer to a character data type can hold a string data type?"  Well, it's partly true that in C, type 'pointer to char' is the string type.  Any function that operates on strings (including printf) will be found to accept these strings via parameters of type char *.
"How can printf() print a string when no apparent quotation marks are used?"  There's no rule that says you need quotation marks to have a string!  That thing with quotation marks is a string constant or string literal, and it's one way to get a string into your program, but it's not at all the only way.  There are lots of ways to construct (and manipulate, and modify) strings that don't involve any quotation marks at all.
Let's draw some pictures representing your code:
char *p;

p is a pointer to char, but as you correctly note, it doesn't point anywhere yet.  We can represent it graphically like this:
   +-----------+
p: |    ???    |
   +-----------+

Next you set p to point somewhere:
p = "%d";

This allocates the string "%d" somewhere (it doesn't matter where), and sets p to point to it:
   +---+---+---+
   | % | d |\0 |
   +---+---+---+
     ^
     |
      \
       \
        \
         |
   +-----|-----+
p: |     *     |
   +-----------+

Next, you start incrementing p:
p++;

As you said, this makes p point one past where it used to, to the second character of the string:
   +---+---+---+
   | % | d |\0 |
   +---+---+---+
         ^
         |
         |
         |
         |
         |
   +-----|-----+
p: |     *     |
   +-----------+

Next,
p++;

Now we have:
   +---+---+---+
   | % | d |\0 |
   +---+---+---+
             ^
             |
            /
           /
          /
         |
   +-----|-----+
p: |     *     |
   +-----------+

Next you called printf, but somewhat strangely:
printf(p-2,23);

The key to that is the expression p-2.  If p points to the third character in the string, then p-2 points to the first character in the string:
         +---+---+---+
         | % | d |\0 |
         +---+---+---+
           ^       ^
      +----|----+  |
 p-2: |    *    | /
      +---------+/
                /
               |
         +-----|-----+
      p: |     *     |
         +-----------+

And that pointer, p-2, is more or less the same pointer that printf would have received if you're more conventionally called printf("%d", 23).
Now, if you thought printf received a string, it may surprise you to hear that printf is happy to receive a char * instead — and that in fact it always receives a char *.  If this is surprising, ask yourself, what did you thing printf did receive, if not a pointer to char?
Strictly speaking, a string in C is an array of characters (terminated with the '\0' character).  But there's this super-important secret fact about C, which if you haven't encountered yet you will real soon (because it's really not a secret at all):

You can't do much with arrays in C.  Whenever you mention an array in an expression in C, whenever it looks like you're trying to do something with the value of the array, what you get is a pointer to the array's first element.

That pointer is pretty much the "value" of the array.  Due to the way pointer arithmetic works, you can use pointers to access arrays pretty much transparently (almost as if the pointer was the array, but of course it's not).  And this all applies perfectly well to arrays of (and pointers to) characters, as well.
So since a string in C is an array of characters, when you write
"%d"

that's an array of three characters.  But when you use it in an expression, what you get is a pointer to the array's first element.  For example, if you write
printf("%d", 23);

you've got an array of characters, and you're mentioning it in an expression, so what you get is a pointer to the array's first element, and that's what gets passed to printf.
If we said
char *p = "%d";
printf(p, 23);

we've done the same thing, just a bit more explicitly: again, we've mentioned the array "%d" in an expression, so what we get as its value is a pointer to its first element, so that's the pointer that's used to initialize the pointer variable p, and that's the pointer that gets passed as the first argument to printf, so printf is happy.
Up above, I said "it's partly true that in C, type 'pointer to char' is the string type".  Later I said that "a string in C is an array of characters".  So which is it?  An array or a pointer?  Strictly speaking, a string is an array of characters.  But like all arrays, we can't do much with an array of characters, and when we try, what we get is a pointer to the first element.  So most of the time, strings in C are accessed and manipulated and modified via pointers to characters.  All functions that operate on strings (including printf) actually receive pointers to char, pointing at the strings they'll manipulate.

A: 1. How can a pointer to a character data type can hold a string data type?
-> Char pointer will hold the address of char datatype, since string is collection of char datatypes. Hence char pointer can hold the string data type..
2. What happens when p is incremented twice?
-> When you assign the char pointer to string pointer will point to first char. So when you increment the pointer twice, it will hold the address of 3rd char, in your case it is'\0';
3. How can the printf()can print a string when no apparent quotation marks are used?
->    printf(p-2,23); Uses string as format identifier in your case it is "%d".


text:
Q: return focus from iframe to parent I have some keyboard shortcuts binded to the document object using the keydown event (I am using the jquery.hotkeys plugin to do this, but I doubt this matters).
I then have an iframe which I insert dynamically into the DOM and after some actions remove it. My problem is that after removing the iframe, I need to click back on the parent document in order to be able to use the keyboard shortcuts, otherwise the keydown events are not detected.
I have tried using .focus(), .click(), .mousedown() etc on the document element as well as on other elements on the parent page, but I could not get the focus back to the parent page.
How can I get the focus back to the page without requiring the user to click on the page?
Thanks!!

A: if you have an iframe that is contained in the document you can store the "main" document as a variable prior to creating the iframe.
Then when you remove the iframe just call top.doc.focus() or top.doc.getElement('id').focus().

A: I just spent a while struggling with a similar issue, and what I've concluded is that the script running in the child frame keeps stealing focus back to that frame. Then when the script terminates, the child frame has already been removed, so the browser doesn't know where to focus anymore.
How I solved this was to create a function in the parent (or top) frame, that first removes the child frame, and then restores focus to itself. Now, from the child frame, I simply call the parent's function, and that fixes it.
Example:
outer.html:
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    Outer content - press [Enter] to load the iframe

inner.html:
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    Inner content - press [Esc] to close the iframe


text:
Q: Make one EditText row clickable and not editable Android I'm showing a list of items on the activity and I'm using an ArrayAdapter so I can only have a TextView/EditText in my xml. But I want to be able to edit the text and save that somehow. Right now... I can only edit but since I have no buttons, I can't save the content. Can I make one row from the list to be uneditable but clickable? To simulate the action of a button?
<?xml version="1.0" encoding="utf-8"?>
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/my_edit_text"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:background="#035E7B"
    />

Something like :
Row1Editable
Row2Editable
Row3Editable
ClickHere to save your edits
    public class SingleListItem extends ListActivity {
    SweetsXmlController controller;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_single_list_item);
        controller = new SweetsXmlController();

        Intent intent = getIntent();
        int position = intent.getIntExtra("position", 1);
        String[] mTestArray = getResources().getStringArray(R.array.sections);
        Sweet toShow = controller.getSweetByPosition(position, mTestArray);

        ArrayList<String> res = new ArrayList<>();
        res.add(toShow.getName());
        res.add("$" + toShow.getPrice());
        res.add(toShow.getDescription());
        res.add(toShow.getCalories() + "kcal");res.add("Click here to save your changes!");

        EditText editText = (EditText) findViewById(R.id.my_edit_text);
        editText.addTextChangedListener(new TextWatcher() {

            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
                Log.d("HAAAAAAAAAAAAH", "Trying to MOVE TO NEXT ITEM ");
            }

            @Override
            public void afterTextChanged(Editable editable) {

            }
        });

        ArrayAdapter<String> adapter;
        adapter = new ArrayAdapter<String>(
                this,
                R.layout.activity_single_list_item,
                res);
        setListAdapter(adapter);

    }

A: You will need to write a custom adapter for this - have a look at http://www.vogella.com/tutorials/AndroidListView/article.html. In the adapter's getView() method, you can use the EditText.setEnabled(boolean) method to toggle whether it is editable or not.
Also, if all you need is a single button, it would be easier to have a separate listview + a button in your layout.

A: I think you can use this method below:
EditText myEditTextField = new EditText(this);

myEditTextField.addTextChangedListener(new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    }

    @Override
    public void afterTextChanged(Editable s) {

    }
});

After text changed, just save the output in textView.


text:
Q: list being printed out weirdly python I have a list like this
[796, 829, 1159, 1162]
I also have a list like this:
['144 154', '145 151', '145 152', '145 153', '145 154', '146 152', '146 153', '146 154', '147 153', '147 154']
These are not to scale
What I want to do is use the first lists elements as index for the last array
I have tried this piece of code:
contacts = []
for i in findres:
    contacts += rulelines[i]
print contacts

where findres is the first list and rulelines is the last list
However this prints the contacts list out weirdly:
['5', ' ', '7', '2', '5', ' ', '1', '0', '5', '7', ' ', '1', '5', '0', '7', ' ', '1', '5', '3']
I'm sure its easy but where am I going wrong??
The desirable output I believe is ['5 72','5 105', '7 150',7 153']
I have not put down all of the list elements as there are over 100 elements in each

A: Looks like when you assign contacts = rulelines[i] you're actually assigning the rulelines[i] string. You should do contacts.append(rulelines[i]) to add the the contact to the list, otherwise you're constantly overwriting over the last assignment.

A: Use this as a template:
findres = [5, 7, 15, 22]
contacts = list('abcdefghijklmnopqrstuvwxyz') # dummy list

result = [ contacts[index] for index in findres ]
print result

# ['f', 'h', 'p', 'w']

A: If I understand correctly, you need to extract the first number in every elements of findres first. Then, use those extracted numbers as an index for another array
>>> findres = ['144 154', '145 151', '145 152', '145 153', '145 154', '146 152', '146 153', '146 154', '147 153', '147 154']
>>> first_elements = [c.split()[0] for c in findres]
>>> print first_elements

['144', '145', '145', '145', '145', '146', '146', '146', '147', '147']

>>> contact = []
>>> for i in first_elements:
        contacts.append(rulelines[i])


text:
Q: Curl not showing any errors or output Im trying to fetch the source of a wordpress post, then look in the source and grab a specific string of text, lets say the post date. I am using tor as the wordpress blog is blocked on my end. Right now it doesnt display any errors and doesnt display anything in terminal. Its a valid website and doesnt block Tor or anything like that. There are no errors displayed in terminal or in PHPs error log, and Ive run out of places to look for errors, anybody have an idea why its doing this? Curl works properly in another instance to correctly fetch a websites source. (Also the variable tport is the correct port on this machine, 9150)
$url = 'http://subdomain.domain.com/2015/02/01/page/'; $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_PROXY, "udp://127.0.0.1:$tport/");
curl_setopt($ch, CURLOPT_PROXYTYPE, 7);
curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
$output = curl_exec($ch); echo $output;
echo curl_error($ch); curl_close($ch);

EDIT: Header information. What makes it a bad request?
* Connected to 127.0.0.1 (127.0.0.1) port 9150 (#1)
 HTTP/1.115/02/01/page/
Host: subdomain.domain.com
Accept: */*

< HTTP/1.1 400 Bad Request
* Server nginx is not blacklisted
< Server: nginx
< Date: Wed, 05 Aug 2015 22:44:12 GMT
< Content-Type: text/html
< Content-Length: 1245
< Connection: close
< ETag: "53f497d2-4dd"
< X-ac: 1.fra _dca
<
* Closing connection 1
Connected to host successfully


text:
Q: Error in Raspberry Pi 3 attribute error sslerror I am trying to run a program; here is the link,
and I'm stuck in the second step. I am new in Raspberry Pi and Python.
conda create -n ears python=3.6

I am trying to run this command line but it gives me:

attribute =error: sslerror object has no attribute message

I'm using Python 3.4 version. I also tried conda create -n ears python=3.4 which gives the same error.

A: try this:
conda config --set ssl_verify false


text:
Q: Странная ситуация с одинаковыми экранами Подскажите как сделать правильно...У меня 2 реальных устройства для теста, один самсунг с5 , а второй какой то китайский... Когда я работаю с текстом, то на одном экране он смотриться больше на другом меньше.
Я думал что разная плотность экранов и создал папки ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi и начал тестировать какая папка для какого устройства будет определяться системой. Конечно в каждую вложил такие dimen ресурсы
<resources>
<dimen name="activity_header_button_size">14sp</dimen>
<dimen name="activity_text_size">8sp</dimen>
</resources>

Сначала подключил китайца и изменил размеры в папке для самой маленькой плотности ldpi на
<resources>
<dimen name="activity_header_button_size">20sp</dimen>
<dimen name="activity_text_size">14sp</dimen>
</resources>

Ничего не поменялось... я все вернул в исходное состояние и продолжил повозрастающе менять в каждой папке и методом научного тыка определил, что этот китайский девайс реагирует когда я меняю размер в папке
xxhdpi

И все, только на нее.
Я подключил самсунг и начал делать тоже самое и мое удивление было когда я определил, что он тоже реагирует только на эту папку xxhdpi
Но почему тогда если система определяет плотности их экранов как одинаковые, размеры на них смотрятся совсем не одинаково??
Когда я устанавливаю в этой папке xxhdpi вот такие размеры
<resources>
<dimen name="activity_header_button_size">20sp</dimen>
<dimen name="activity_text_size">14sp</dimen>
</resources>

То на китайце получаю вот такую картинку

А на самсунге вот такую

Видно, что на китайский девайс нужно установить меньшие размеры чтоб получить ожидаемый результат, но как это сделать если система определяет для них одну и туже ресурсную папку?


text:
Q: file.truncate() leaves white space in front of file python When I use truncate() it leaves white space at the front of the file. Which leads to me having gigabytes of white space that needs to be loaded into ram
f = open("test.txt","r+")
for i in range(0,100):
    f.truncate(0)
    f.write("End of file")
f.close()

Leaves a file that looks something like this

                                                                                End of file

How can I solve this?

A: It behaves correctly when you use f.seek(0) in each iteration as follows:
    f = open("test.txt","r+")
    for i in range(0,100):
        f.seek(0)
        f.truncate(0)
        f.write("End of file")
    f.close()


text:
Q: Accessing methods when using react-bodymovin to loop animation segments I am using the react-bodymovin package (https://www.npmjs.com/package/react-bodymovin) to embed a Bodymovin animation, but I wanted to loop a section of the animation after it has played through once.
I can see is simple using the HTML version of Bodymovin, as you simply use the relevant methods to do this, for example, (assuming the div has ID bodymovin:
const params = {
    container: document.getElementById('bodymovin'),
    renderer: 'svg',
    loop: false,
    autoplay: false,
    animationData: animationData,
}

const anim = bodymovin.loadAnimation(params)

anim.playSegments([[0, 65]], true)

However, I am not sure how to access these same methods when using the React component.
Here is my component:
import React from 'react'
import ReactBodymovin from 'react-bodymovin'
import animation from './animation.json'

const App = () => {
  const bodymovinOptions = {
    loop: true,
    autoplay: true,
    prerender: true,
    animationData: animation
  }

  return (

      <ReactBodymovin options={bodymovinOptions} />

  )
}

I have a feeling that due to the nature of the way this React wrapper works with Bodymovin, it may not be possible to access the methods within the file, but if anyone knows a way to do this, i would love to hear it. Thanks.

A: Why don't you try react-lottie package instead? It has way more npm-downloads than react-bodymovin and you can achieve what you want and play segments like so:
import React from 'react'
import animation from './animation.json'

import Lottie from 'react-lottie';

const App = () => {
  const options= {
    loop: true,
    autoplay: true,
    prerender: true,
    animationData: animation
  }

  return (

      <Lottie options={options} segments={[0, 65]} />

  )
}

However, with both packges you won't have full control over the lottie object and thus can't call methods like loadAnimation or loadSegments manually. However you could use the lottie-web package like you would do in normal javascript, just as you have shown. Here is an example how you should do it in react with hooks:
import React, { useEffect, useRef } from "react";
import lottie from "lottie-web";
import animation from "./animation.json";

const App = () => {
 const animContainer = useRef<HTMLDivElement>(null);

 useEffect(() => {
    if (ref.current) {
      const anim = lottie.loadAnimation({
        container: animContainer.current,
        renderer: "svg",
        loop: true,
        autoplay: true,
        animationData: animation
      });

     anim.playSegments([[0, 65]], true);
    }
  });

  return

;
}


text:
Q: Can I consolidate several BigQuery columns into a single repeated field via a single query? I have a large table in BigQuery that looks like this:
ref_id code1 code2 code3 code4 code5 code6 code7 code8
     1    47   742    89   374   893    27     4    68
     2   766     9    84     8  4576    49    76     4

I would like to transform this table, using a BigQuery query, into a format that uses a repeated field for all the code columns. So the result would look like this (represented with JSON to demonstrate the repeated field for the codes):

[{
  "ref_id": 1,
  "codes": [
    46,
    742,
    89,
    374,
    893,
    27,
    4,
    68
  ]
}, {
  "ref_id": 2,
  "codes": [
    766,
    9,
    84,
    8,
    4576,
    49,
    76,
    4
  ]
}]

Can I do that via a BigQuery query that outputs to another table? I know I could download the data, reformat it into JSON and then re-insert, but with several billion rows I was hoping I could do it via a query on the original data.

A: Here is one approach - concatenate the codes with "," as separator, and then use SPLIT to produce REPEATED field, i.e.
select id, split(concat(string(code1), ",", string(code2))) codes from
(select 1 id, 47 code1, 742 code2),
(select 2 id, 766 code1, 9 code2)


text:
Q: Vertical text with responsiveness I am struggling with the vertical text
Here is my plunker
What i am trying to do is making a vertical text where:

*

*If a short text comes inside the div of vertical text then it should be in the middle of the div

*If long text is comes inside the div it should be started from bottom of the page but it should be responsive (for example if i minimize my window bottom text should not hide it will go up in the div) and ... ellipses should be there at the last of the large text in vertical text

I have achieved 1. But 2nd is not completely working, there is no responsiveness and text is going inside the div and not visible.

A: This may help you

.main{
 transform: translate(0, 50%) rotate(-90deg);

}
.sub{
    white-space: nowrap;
    width: 250px;
    height:20px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align:center;
    position: absolute;
    cursor: pointer;
    border: 1px solid grey;
    background: linear-gradient(to right, white, lightgrey);
    border-radius: 2px;
}
.two{
  top:20px;
}

Hello world!

a large text too large to contain tin the div. large text too large to contain tin the div.


text:
Q: PHPMailer siteground trouble with mail SMTP connection trouble Please tell me how to make the phpmailer module work for siteground hosting?
I noticed that if I comment or remove $mail->isSMTP(); this line, sending mail starts working. But this breaks the logic of my code, because I cannot display success message
Also works if i replace $mail->isMail(); instead of  $mail->isSMTP();
Does this mean that SMTP is blocked by the hosting?
My PHPMailer SMTP Config is:
<?php
MAIL_FROM = 'MAIL_ACC_CREATED_ON_SITEGROUND.com',
MAIL_SMTP_HOST = 'mail.mydomain.com',
MAIL_SMTP_PORT = 465;
MAIL_SMTP_USERNAME = 'MAIL_ACC_CREATED_ON_SITEGROUND.com',
MAIL_SMTP_PASSWORD = 'password';
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->Host = MAIL_SMTP_HOST;
$mail->Port = MAIL_SMTP_PORT;
$mail->Username = MAIL_SMTP_USERNAME;
$mail->Password = MAIL_SMTP_PASSWORD;
$mail->SMTPSecure = 'ssl';

I would be grateful for any tip and help!

A: I don't know how, but I fixed this problem. The problem was my code, not the hosting.


text:
Q: Paypal sandbox Payment Data Transfer I have a problem with paypal sandbox 'Payment Data Transfer'.
After recieve the tansaction Id, I am sending it back to paypal with Identity tocken to get the transaction details.
I have followed this document 'http://media.albendas.com/Web2py_Paypal_Integration.pdf'.
password_mgr= urllib2.HTTPPasswordMgrWithDefaultRealm()
base_url='https://www.sandbox.paypal.com'
header = {'Content-Type ':' application/x-www-form-urlencoded'}
path = '/cgi-bin/webscr'
data = "cmd=_notify-synch&tx="+trans+"&at="+key
password_mgr.add_password(self.realm,base_url,self.username,self.password)
handler = urllib2.HTTPBasicAuthHandler(password_mgr)
opener =urllib2.build_opener(handler)
urllib2.install_opener(opener)
req=urllib2.Request(base_url+path,data,header)
ret = opener.open(req)

normally I should get a message either SUCCESS of FAIL. But for me always getting the return page as
We are unable to complete your request at this time. Please click Retry or try again later. We apologize for the inconvenience.
Message 3004.
Plese advise.
Also please let me know, what is the realm parameter.
Thanks in advance.


text:
Q: Unable to execute Preparedstatement batch JDBC statements This is the code below where I am trying to execute the batch PreparedStatement. These statements are running fine without batch but I am unable to batch
insert using the "?" parameters .
Getting the following error :
java.sql.BatchUpdateException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?,?,?,?,?,?)' at line 1
Same I am unable to insert using Statement batch insert too.
  public void insertValuesInTotalResponseWithPSwithBatch(List<A> details) throws SQLException {

        Connection conn;
        int batch_count = 0;

        conn = MySqlConnectionUtility.getConnection();

        PreparedStatement ps = null;
        conn.setAutoCommit(false);
        for (A record : details) {
            if (!record.getLon().trim().equals("bac")) {
                System.out.println("the record is " + record);

                String query = "INSERT INTO AwithbatchwitPS " + " VALUES (?,?,?,?,?,?)";

                ps = conn.prepareStatement(query);
                ps.setInt(1, Integer.parseInt(record.getOne()));
                ps.setFloat(2, Float.parseFloat(record.getTwo()));
                ps.setFloat(3, Float.parseFloat(record.getThree()));
                ps.setString(4, record.getDayofyear());
                ps.setDouble(5, Double.parseDouble(record.getFive()));
                ps.setInt(6, Integer.parseInt(record.getCount()));

                System.out.println(ps);

                ps.addBatch(query);
                System.out.println("Btach1 coutn1 is " + batch_count);
                batch_count++;
                System.out.println("Btach2 coutn2 is " + batch_count);
                if (batch_count % 200 == 0) {
                    try {

                        ps.executeBatch();

                    } catch (Exception e) {
                        System.out.println("Btach coutn is " + batch_count);
                        // e.printStackTrace();
                    } finally {
                        conn.commit();
                        ps.clearBatch();
                    }
                    batch_count = 0;
                }
            }
            details_size = details.size();

        }
        if (batch_count != 0) {
            try {
                ps.executeBatch();
                conn.commit();
            } catch (BatchUpdateException e) {
                // e.printStackTrace();
            }
            batch_count = 0;
        }
    }


text:
Q: Acceder desde PHP normal a una función de CodeIgniter Buenas tardes tengo un problema con mi sitio web hecho con CodeIgniter y PHP sin framework, tengo la siguiente estructura de archivos.

En la carpeta inertent-dedicado tengo un archivo index.php y se visualiza correctamente, esta página esta fuera del framework por lo tanto la base_url no funciona, ahora mi duda es como accedo a una función de mi controlador pero accediendo sin la base_url y con Ajax.

Normalmente con la base_url se accede de la siguiente forma:

                                            url: "<?php echo base_url('Abacom/ajax_send_form'); ?>",

Pero ahora sin la base_url como accedo a esa función del controlador
  Abacom?

Esto es lo que tengo pero no funciono

 url: "../application/controllers/Abacom/ajax_send_form"

Espero que me puedan apoyar.

A: No hace falta que definas el base_url para tus peticiones AJAX solo pon la ruta de tu controlador por ejemplo:
url: '/Abacom/ajax_send_form'

en automatico sabra que debera buscar esa ruta en el dominio actual.


text:
Q: Easiest way to scale Mongo with limited resources? I have a web server (40gig hd, 1 gig ram) that runs Mongo and a Rails application.
The Mongo DB is a document store of Twitter tweets and users, which has several million records. I perform map-reduce queries on the data to extract things like most common hashtags, words, mentions etc (very standard stuff). The meta-data of each tweet is already stored, so the map-reduce is really as efficient as a single collect.
However, since it is run on a (fairly) large dataset, it can't be done in real-time anymore - for example I have a report generator that works out a whole bunch of these map-reduces in a row and takes about 2 minutes for 20 thousand tweets.
What is the quickest, cheapest way to scale mongo, especially in map-reduce performance? I can set up an additional server and split the load, but wonder if I should use sharding, replication or both? Sharding may be overkill for this situation.
Would love some input on my mysql-mongo connection. mysql contains twitter profiles that store twitter ids for each profile. each time a map reduce is done, it collects all IDs to be fed as options into the mapreduce ie:
@profile_tweet_ids = current_profile_tweet_ids # array of ids
@daily_trend = TwitterTweet.daily_trend :query => {:twitter_id => {"$in" => @profile_tweet_ids}}

The mapreduce function in TwitterTweet looks like:
def daily_trend(options={})
  options[:out] = "daily_trend"

  map = %Q( function(){
                if (this.created_at != null)
                {
                  emit(this.created_at.toDateString(), 1);
                }
            })

  result = collection.map_reduce(map, standard_reduce, options)
  normalize_results(result)
end

Any advice is appreciated!

A: If you are doing simple counts, sums, uniques etc, you may be able to avoid using map-reduce completely. You can use the $inc operator to get most of the stuff that you need in real-time.
I have explained this in detail in my blog post on real-time analytics with MongoDB.

A: Sounds like your use case is more in the lines of online stream / event processing.
You can use mongo or other databases / caching product to store reference data, and an event processing framework for receiving and processing the events. There are a few tools that can help you with that - out the back of my head here are a few: Twitter Storm, Apache S4, GigaSpaces XAP (disclaimer - I work for GigaSpaces) and GridGain.

A: Use one of the cloud services like MongoLab.. Depends on your definition of cheap though..

A: The answer regarding using operators rather than MapReduce has merits, and may be far more beneficial to your efforts to get real time responses.  Map Reduce on mongodb does not lend itself to yielding real time responses.
Further to that, you may also benefit from the new aggregation framework (http://www.mongodb.org/display/DOCS/Aggregation+Framework), once that is available in the next release.
To answer the more general question about how to scale out MapReduce, adding a new server may not help if you are simply going to add it as a secondary, as a secondary it will not have the capability to store your M/R results in a collection, so inline is your only option.  If you do not need to store results in a collection then this is your easiest way forward.  For more information, see an in-depth discussion here: http://groups.google.com/group/mongodb-user/browse_thread/thread/bd8f5734dc64117a
Sharding can help with scaling out, but bear in mind that you will need to run everything through a mongos process, have config servers and that the mongos will need to finalize the result sets returned from each shard, so you add a new potential bottleneck depending on your data and you will need more than just one extra machine to have it working in a reliable manner.

A: It is the connections between different data items that is most valuable to them (they let the public do the work of categorising the data to make it valuable) and hence also the most dangerous to you http://indresult.com


text:
Q: Find and Replace in entire project in Android Studio I'm sure this is not a difficult question to answer.
I'm able to replace a specific word or regex expression within a file in Android Studio.
But, I can't seem to know how to do it project wide.
I'm clicking ctrl-R and click on replaceAll button, but it only changes within the current file.
Any idea how to do the same but in the entire project.

A: Click CTRL+SHIFT+R
This will do a whole project, or folder, or scope replacement.
You can click on any folder on the left window, and do CTRL+SHIFT+R this will confine the replacement to that folder.
You can also do CTRL+SHIFT+F to do a global search without the replacement.
Android Studio is based on IntelliJ and shares all default shortcuts, if you can't find an AndroidStudio answer, its ok to search for Intellij also:
Find and Replace symbol for whole project intellij? https://stackoverflow.com/a/38444457/413127


text:
Q: How to conditionally skin an existing site (for partner branding) I've got an existing Django site, with a largish variety of templates in use.  We've agreed to offer a custom-skinned version of our site for use by one of our partners, who want the visual design to harmonize with their own website.  This will be on a separate URL (which we can determine), using a subset of the functionality and data from our main site.
So my question is: what's the best way to add reskin functionality to my site, without duplicating a lot of code or templates?
As I see it, there are several components which need to work together:

*

*URL: need to have a different set of URLs which points to the partner-branded version of the site, but which can contain all the standard path info the site needs to build pages.

*Template 'extends': need to have the templates extend a different base, like {% extends 'partner.html' %} instead of {% extends 'base.html' %}

*View logic: need to let the views know when this is the partner-branded version, so they can change the business logic appropriately
My idea so far is to put the partner site on a subdomain, then use a middleware to parse the domain name and add 'partner' and 'partner_template' variables to the request object.  Thus, I can access request.partner inside my views, to handle business logic.  Then, I have to edit all my templates to look like this:
{% extends request.partner_template|default:'base.html' %}

(According to this answer, 'extends' takes a variable just like any other template tag.)
Will this work properly?  Is there a better way?

A: If you are using different settings.py for the different sites you can
specifiy different template loading directories. (Which may default to your unskinned pages.)
Personally I'm not convinced by having different business logic in the same view code, that smells like a hack to me - the same as extensive conditional compilation does in C.
So to sum up.

*

*Use django.contrib.sites and different settings.py

*Get a clear idea, how much this is a new app/website using the same data, or just different css/templates.


text:
Q: Skewed images in ImageView on Android 4.1.2 I have an app that displays an image in an ImageView, and am experiencing problem specifically for Android 4.1.2. It is confirmed to not work on three separate 4.1.2 devices, while working on 2.3.7, 4.2.1, 4.3 and 4.4.2. The error occurs for several different images, but not all. There seems to be something about some specific JPEG-files that doesn't work as intended.
How it actually looks, and how it shows on Android 4.1.2:

The above image (left) is one such problematic image file.
A summary of the code behind setting the displayed image is:
Bitmap bitmap, background;
ImageView imageView = (ImageView)findViewById(R.id.imageView);

BitmapFactory.Options options = new BitmapFactory.Options();
options.inScaled = false;
options.inPurgeable = true;
options.inInputShareable = true;
bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.dog, options);

background = bitmap.copy(Bitmap.Config.RGB_565, true);

Canvas canvas = new Canvas(background);
canvas.drawBitmap(bitmap, 0, 0, null);
// Some calls to canvas.drawText(....) here, but doesn't have to happen for the error to occur

imageView.setImageBitmap(background);

I've figured that I am able to resize and re-save the above photo in Photoshop to make it work, without knowing why. Since I have several I'd prefer not having to do so.
I am wondering what is the source of this error on Android 4.1.2, and if there might be some programmatic way of fixing it?
I've tried my luck on Google view "skewed", "tilted", "distorted" and similar, but there are very few mentions of it and no fixes. This is the mention with screenshot I've found:

*

*Anyone else getting distorted album art in Play Music? (Screenshot)

A: Based on the comment of rupps I changed from:
bitmap.copy(Bitmap.Config.RGB_565, true)

To:
bitmap.copy(Bitmap.Config.ARGB_8888, true)

This did in fact solve the problem for 4.1.2 devices, while remaining similar in functionality for all other tested devices. This does programatically solve my issue. Note however that it does require double the memory, as each pixel is stored on 4 bytes instead of 2 bytes.
As for the source of the problem, I read from the documentation of RGB_565 that:

This configuration can produce slight visual artifacts depending on the configuration of the source.

I think this mostly relates to banding/color/dithering issues and this does not explain the version specific problem, but perhaps why this setting is troublesome.


text:
Q: On demand population of dropdown menu Java/Swing? When I code a popup menu, I can check the mouse event and then
before calling show() prepare the menu.
Now I want a similar functionality for drop down menus, that
live in the menu bar. For example I have the following menu
bar layout:
Menu 1
   MenuItem 1.1
      MenuItem 1.1.1
      MenuItem 1.1.2
      ..
      MenuItem 1.1.n
Menu 2

Basically I want to generate the list MenuItem 1.1.1, MenuItem 1.1.2,
..., MenuItem 1.1.n dynamically when the drop down menu is invoked and
before it is shown.
How could I do this in Java/Swing? Is there a call back that covers both
L&F specific keyboard/mouse invokations of the menu bar?
Best Regards

A: You need to use a javax.swing.JMenuBar instead of a java.awt.MenuBar.
These MenuBars can add javax.swing.JMenus which have a addMenuListener(MenuListener l) method.
In this MenuListener you can dynamically add and delete the menus.
@Override
public void menuSelected(MenuEvent e) {
    // Put your logic here
    JMenu dynamicMenu = (JMenu) e.getSource();
    dynamicMenu.add(new JMenuItem("MenuItem 1.1.1"));
}

@Override
public void menuDeselected(MenuEvent e) {
    // Remove all MenuItems
    JMenu dynamicMenu = (JMenu) e.getSource();
    dynamicMenu.removeAll();
}

@Override
public void menuCanceled(MenuEvent e) {
    // Remove all MenuItems
    JMenu dynamicMenu = (JMenu) e.getSource();
    dynamicMenu.removeAll();
}

To add the JMenuBar to a JFrame use the setJMenuBar(JMenuBar menubar) method.


text:
Q: Почему локальный терминал в pycharm не работает Cannot open Local Terminal
Failed to start [powershell.exe, -NoExit, -File, C:/Users/пк/PycharmProjects/pythonPit/venv/Scripts/activate.ps1] in C:\Users\пк\PycharmProjects\pythonPit

Error running process: lost connection to agent. Code 0

See IDE log (Help | Show Log in Explorer) for the details

Как исправить?


text:
Q: Android: как сделать неубиваемый сервис Господа! Прошу помощи!
много примеров уже смотрел и никак не пойму: как же мне, все-таки, сделать на android сервис, который после закрытия фактического приложения - не умрет?
явный пример того что я хочу - яндекс.музыка. Качаете яндекс.музыку, запускаете, выбираете трек и слушаете. Потом выходите из приложения, открываете просмотр всех запущенных приложений и убиваете их все. а музыке хоть бы что!
вот какой я нашел пример и он все равно не работает
public class UnKilledService extends Service {

        final String LOG_TAG = "myLogs";

        public void onCreate() {
            super.onCreate();
            Log.d(LOG_TAG, "MyService onCreate");
        }

        public void onDestroy() {
            super.onDestroy();
            Log.d(LOG_TAG, "MyService onDestroy");
        }

        public int onStartCommand(Intent intent, int flags, int startId) {
            Log.d(LOG_TAG, "MyService onStartCommand, FLAG: "+flags);
            //readFlags(flags);
            return START_NOT_STICKY;
        }

        public IBinder onBind(Intent arg0) {
            return null;
        }

        @Override
        public void onTaskRemoved(Intent rootIntent) {
            Log.d(LOG_TAG, "MyService onTaskRemoved");
        }
    }

в фоне - работает. убиваю приложение - не работает.
Как это сделать? прошу, пожалуйста, помочь действительным советом, а не вопросами "да зачем? а там глядел? и т.д."
так же, хотелось бы не ответ типа
попадалась где-то тема, что в новых android версиях такой сервис будет иметь и обязательное уведомление в нотификациях - это даже хорошо, если найдется именно такой пример!
спасибо всем ответившим.

A: К сожалению единого, точного рецепта здесь нет, к тому же это считается антипаттерном и именно поэтому начиная с версии 4.3 ось будет добавлять автоматическую нотификацию о запущенном "неубиваемом" сервисе.
Есть комплекс мероприятий, который в итоге (в зависимости от версии) может привести к успеху:

*

*Декларировать Service в манифесте в поименованном процессе: android:process="name"

*Пытаться запустить в Service не в фоне, то есть указать startForeground() - с недавних пор эта опция объявлена как deprecated

*Запускать Service с флагом START_REDELIVER_INTENT - в этом случае при убивании приложения сервис будет поднят заново (если стартовал до этого)

A: Попробуйте действительно с уведомлением сервис. Для этого в сервисе есть метод startForeground()
Добавьте и вызовите этот метод в сервисе:
private final static int NOTIFICATION_ID = 42;

private void runAsForeground(){
    //Intent notificationIntent = new Intent(this, RecorderMainActivity.class);
    //PendingIntent pendingIntent=PendingIntent.getActivity(this, 0,
            //notificationIntent, Intent.FLAG_ACTIVITY_NEW_TASK);

    Notification notification=new NotificationCompat.Builder(this)
                                .setSmallIcon(R.drawable.ic_launcher)
                                .setContentText(getString(R.string.isRecording))
                                //.setContentIntent(pendingIntent)
                                .build();

    startForeground(NOTIFICATION_ID, notification);
}

A: Спасибо всем откликнувшимся!
Решил вопрос путем добавления startForeground()
итог - именно тот, который мне был нужен!


text:
Q: This location could not be displayed You do not the permissions necessary to view the contents of www I cant acces /var/www all of the sudden... also I would like to just give the user "loko" all the permissions. How can i get the error I am getting all of the sudden and how to fix it? Yesterday it worked fine.

A: Ok I figured it out.
These are the commands to give a directory or a file the permissions:
chmod 400 mydoc.txt read by owner
chmod 040 mydoc.txt read by group
chmod 004 mydoc.txt read by anybody (other)
chmod 200 mydoc.txt write by owner
chmod 020 mydoc.txt write by group
chmod 002 mydoc.txt write by anybody
chmod 100 mydoc.txt execute by owner
chmod 010 mydoc.txt execute by group
chmod 001 mydoc.txt execute by anybody

and I used this to give myself all the permissions:
sudo chown -R loko:sudo /home


text:
Q: Draw regression line per row in R I have the following data.
HEIrank1
     HEI.ID X2007 X2008 X2009 X2010 X2011 X2012
1        OP  41.8 147.6  90.3  82.9 106.8  63.0
2        MO  20.0  20.8  21.1  20.9  12.6  20.6
3        SD  21.2  32.3  25.7  23.9  25.0  40.1
4        UN  51.8  39.8  19.9  20.9  21.6  22.5
5        WS  18.0  19.9  15.3  13.6  15.7  15.2
6        BF  11.5  36.9  20.0  23.2  18.2  23.8
7        ME  34.2  30.3  28.4  30.1  31.5  25.6
8        IM   7.7  18.1  20.5  14.6  17.2  17.1
9        OM  11.4  11.2  12.2  11.1  13.4  19.2
10       DC  14.3  28.7  20.1  17.0  22.3  16.2
11       OC  28.6  44.0  24.9  27.9  34.0  30.7
12       TH   7.4  10.0   5.8   8.8   8.7   8.6
13       CC  12.1  11.0  12.2  12.1  14.9  15.0
14       MM  11.7  24.2  18.4  18.6  31.9  31.7
15       MC  19.0  13.7  17.0  20.4  20.5  12.1
16       SH  11.4  24.8  26.1  12.7  19.9  25.9
17       SB  13.0  22.8  15.9  17.6  17.2   9.6
18       SN  11.5  18.6  22.9  12.0  20.3  11.6
19       ER  10.8  13.2  20.0  11.0  14.9  14.2
20       SL  44.9  21.6  21.3  26.5  17.0   8.0

I try following commends to draw regression line for each HEIs.
year <- c(2007 ,   2008  ,  2009  ,  2010 ,   2011, 2012)

op <- as.numeric(HEIrank1[1,])
lm.r <- lm(op~year)
plot(year, op)
abline(lm.r)

I want to draw to draw regression line for each college in one graph and I do not how.can you help me.

A: Here's my approach with ggplot2 but the graph is uninterpretable with that many lines.
library(ggplot2);library(reshape2)
mdat <- melt(HEIrank1, variable.name="year")
mdat$year <- as.numeric(substring(mdat$year, 2))
ggplot(mdat, aes(year, value, colour=HEI.ID, group=HEI.ID)) +
    geom_point() + stat_smooth(se = FALSE, method="lm")

Faceting may be a better way to got:
ggplot(mdat, aes(year, value, group=HEI.ID)) +
    geom_point() + stat_smooth(se = FALSE, method="lm") +
    facet_wrap(~HEI.ID)


text:
Q: Unity vs_4_0 instruction error when trying to set vertex normal in PBR shader graph I'm trying to create a ocean PBR shader using Universal Render Pipeline's PBR Shader Graph, but when I try to assign the normal in master, it throws the errors:

Assertion failed on expression: '0 == m_CurrentBufferBindMask[kUnityPerDraw]'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

and

Cannot map expression to vs_4_0 instruction set at line 132 (on d3d11)

The calculated normal is a global normal transformed to object's space using direction mode on transform node.
This is my current shader graph:

The "WaveNoise" node is a custom subgraph shader that outputs wave height from position using stacked sine and cossine waves.
This is the PBR master node's configuration:

I'm using two master nodes, but the active one is the PBR, I put a Unlit Master to test if the same error happen, in my tests this didn't happened. I don't know if someone is having this issue too.