text:
Q: Is Visual Studio 2003 still available/supported Pretty much what the title says really.
We have some code that is .NET 1.1 based and no real desire to up-convert it.  However, we are looking to add developers to the team and they will need copies of Visual Studio.
My understanding is that they will need VS 2003 - as this is the only IDE that supports .NET 1.1 but I am wondering if we are still able to purchase it!

A: You can build 1.1 projects in Visual Studio 2005:
http://www.hanselman.com/blog/BuildingNET11ProjectsUsingVisualStudio2005.aspx
The MSBuild Everett Environment (MSBEE) has been announced, and soon this will be a (reasonably) supported scenario and we'll all be able to build both 1.1 and 2.0 versions of .NET code on Visual Studio 2005.
Also read this post about this issue:
http://blogs.msdn.com/clichten/archive/2005/11/08/490541.aspx
And also:
MSBuild Extras – Toolkit for .NET 1.1 "MSBee" is an addition to MSBuild that allows developers to build managed applications using Visual Studio 2005 projects that target .NET 1.1.

A: Visual Studio 2003 is still available to download for MSDN subscribers.
The EULA for Visual Studio includes a 'downgrade' clause, which appears, IMNAL, to allow you to buy Visual Studio 2008 and then install 2003 under the same license.

DOWNGRADE. You may install and use
  this version and an earlier version of
  the software at the same time. This
  agreement applies to your use of the
  earlier version. If the earlier
  version includes different components,
  any terms for those components in the
  agreement that comes with the earlier
  version apply to your use of them.
  Microsoft is not obligated to supply
  earlier versions to you.

A: Mainstream support for VS2003 ends in October of this year:
http://support.microsoft.com/lifecycle/search/?sort=PN&alpha=Visual+Studio
Extended support (whatever that means) is still available for quite some time.

A: In addition to Espo's link, look into MSBee, an enhancements kit for MSBuild to better support .NET Framework 1.1.
It seems you can even use .NET 1.1 with Visual Studio 2008, though, so you should have no problem.
That said, I'd be interested in hearing what made you choose against upgrading.

A: Supported:  Yes
Available:  Not through normal channels.  You might still find a boxed copy on Amazon or somewhere.

A: .NET 1.1 code can be imported in VS 2005, as .NET 2.0 is backward compatible with .NET 1.1.
You'll probably have to convert the project, but it should still run in VS 2005.

A: I believe that vs2003 looses support in october


text:
Q: Fancybox - unbinding thumbnails from launching slideshow Ok here's the dilemma.
Got a slider that when you click on the thumbnails the larger image appears in the div above.
Pretty straight forward.
Now I've successfully assigned a click function to the larger image so that Fancybox pop up.
$('#launchImg').click(function(){
    $('.room-thumbnail').fancybox({
            'transitionIn'      : 'elastic',
            'transitionOut'     : 'elastic',
            'titlePosition'     : 'over'
            }).trigger('click');
            return false;
});

The only catch is that, when clicking on the larger image, it's getting the images from the thumbnails (which aren't really thumbnails, but are just the full sized image resized) and there is already a click function assigned to them.
$('.room-thumbnail').click(function() {
    var img = new Image();

    $(img)
        .load(function () {
            $('#room-ajax-loader').css('display', 'none');
            $(this).hide();

            $('#room-big-image a').attr('href', $(this).attr('src'));

            $('#room-big-image a').append(img);

            $(this).fadeIn(function() {
                $('#room-big-image img:first-child').remove();
            });
        })
        .attr('src', $(this).attr('href'));
    if (!$(this).hasClass('thumbnail-current')) {
        grayscale($('.thumbnail-current'));
    }

    $('.room-thumbnail').removeClass('thumbnail-current');
    $(this).addClass('thumbnail-current');
    $('#room-ajax-loader').css('display', 'block');
    return false;
});

So the problem I get is that once I've clicked on the larger image which open fancybox and everything works as palnned but after I close fancybox the thumbnails no longer change the larger image above them but launch the fancybox from the slider, which I donèt want to happen.
So basically,how I do unbind the fancybox from my thumbnails?
Here's the html:

Thanks if youève already read this far !
Peace.

A: If clicking on the big image is what fires fancybox, why don't you do?
$('#launchImg').fancybox({
 'transitionIn'      : 'elastic',
 'transitionOut'     : 'elastic',
 'titlePosition'     : 'over'
});

redpajama_set_name: RedPajamaStackExchange


text:
Q: Use Zend_Autoloader for Models does someone knows how to use the "new" Zend Autoloader to Load Models ? In the Moment my Configuration looks like this :
application.ini
# Autoloader Namespace
autoloadernamespaces.0 = "Sl_"

Bootstrap.php
   /**
     * Start Autoloader
     *
     * @access protected
     * @return Zend_Application_Module_Autoloader
     */
    protected function _initAutoload()
    {
        $autoloader = new Zend_Application_Module_Autoloader(array(
            'namespace' => 'Sl_',
            'basePath'  => dirname(__FILE__),
        ));

        return $autoloader;
    }

So when I place a Model in /Models/User.php with
class Sl_Model_User{}

and create an new object , everything works like designed. But how can i use the Autoloader to load a Model placed in /Models/Dao/UserDB.php ?
class Dao_UserDB{}

A: Check the documentation on the Resource_Autoloader (its purpose is to load resources that reside in the models directory or elsewhere - i.e outside the /library folder).
"Resource autoloaders are intended to manage namespaced library code that follow Zend Framework coding standard guidelines, but which do not have a 1:1 mapping between the class name and the directory structure. Their primary purpose is to facilitate autoloading application resource code, such as application-specific models, forms, and ACLs.
Resource autoloaders register with the autoloader on instantiation, with the namespace to which they are associated. This allows you to easily namespace code in specific directories, and still reap the benefits of autoloading."
path/to/some/directory/
    acls/
         Site.php
    forms/
        Login.php
    models/
        User.php

$resourceLoader = new Zend_Loader_Autoloader_Resource(array(
'basePath'  => 'path/to/some/directory',
'namespace' => 'My',

));
$resourceLoader->addResourceTypes(array(
'acl' => array(
    'path'      => 'acls/',
    'namespace' => 'Acl',
),
'form' => array(
    'path'      => 'forms/',
    'namespace' => 'Form',
),
'model' => array(
    'path'      => 'models/',
),

));
Try this in your boostrap file:
protected function _initLoaderResource()
{
    $resourceLoader = new Zend_Loader_Autoloader_Resource(array(
        'basePath'  => 'your_doc_root' . '/application',
        'namespace' => 'MyNamespace'
    ));
    $resourceLoader->addResourceTypes(array(
        'model' => array(
            'namespace' => 'Model',
            'path'      => 'models'
        )
    ));
}

A: Depending on your current setup
ClassFile:
/Models/Dao/UserDB.php
ClassName:
class Dao_UserDB{}
should be:
$autoloader = new Zend_Application_Module_Autoloader(array(
    'namespace' => 'Dao_',
    'basePath'  => APPLICATION_ROOT.'/Models/Dao/',
));

But you also could name the Class:
S1_Dao_UserDB() this should work without changing.

A: To define autoloader rules for custom models (in custom library dir) like:
|-application
|-library
  |-Foo
    |-Models
      |-Bar.php (holds Foo_Model_Bar class - mind no 's' in class name)
    |-Forms
      |-Bar.php (holds Foo_Form_Bar class - mind no 's' in class name)
  |-Zend
|-public
|-test

You should add this in your Bootstrap.php
/**
 * Enable loading custom  classes
 */
public function _initAutoloaders()
{
    $resourceLoader = new Zend_Loader_Autoloader_Resource(array(
        'basePath' => APPLICATION_PATH . '/../library/Foo',
        'namespace' => 'Foo_'
    ));

    $resourceLoader->addResourceTypes(array(
        'foomodels' => array(
            'namespace' => 'Model_',
            'path' => 'Models')
        ),
        'fooforms' => array(
            'namespace' => 'Form_',
            'path' => 'Forms')
        ),
    );
}

Took me a while to figure it out, hope it saves someones time.


text:
Q: Field not being sorted in ascending order in Visual Studio 2010 I have the following SQL:
;WITH times AS (
    SELECT '0830' AS t
    UNION
    SELECT '0930' AS t
    UNION
    SELECT '1030' AS t
    UNION
    SELECT '1130' AS t
    UNION
    SELECT '1230' AS t
)
SELECT t as time
FROM times
;

When I execute this in SSMS (SQL Server Management Studio), it displayed correctly as

0830
0930
1030
1130
1230

However, when I put this into a drop down list inside Visual Studio 2010, the list becomes incorrectly sorted:

1030
1130
1230
830
930

The 0 is disappearing from the 0830 and 0930 and both 0830 to 0930 is being shifted from the 1st two items in the list to the last two items.
How can I make the drop-down show the list in the correct order?

A: Specials thanks to Shark, Aaron Bertrand and Jon Seigel that have enlighten me.
I have use the ORDER BY CONVERT(INT, time) and it now solved the application issue problem. (Fortunately, the change to the SQL statement was a quick way to solve this problem)


text:
Q: Neuvector multi cluster configuration Neuvector - It is a container security solution .
I have a Neuvector setup in both Azure(openshift cluster) and AWS environment, Now using multi cluster option available in Neuvector, I want to promote the Azure Neuvector setup as master and want AWS Neuvector setup to join in this cluster.
When I wish to upgrade that to master, It requires "Master cluster Server" details (hostname or ip address ), Since I installed on Openshift cluster where can I find or How to get the Master Cluster Server details in my openshift environment.
Can anyone provide me any blog or documentation to get more details on this thing?
Thank you.

A: Create a OpenShift route to expose the neuvector-route-fed-managed service. I guess the service name depends on your installation method e.g. HELM.
Then you can join the cluster using hostname (something like neuvector-route-fed-managed-neuvector.apps.yourdomain.com) and port 443.
Unfortunately it's not possible to create this routs using the HELM chart so I created a Pull-Request.


text:
Q: Find inverse of this function... $f(x) = \sin(x)-\cos(x)$
I got to this point: $$f^2(x)=1-\sin(2x)$$
But I have no idea what to do next. Please help me, give me a hint :D

A: First, this function is not invertible, as it is not injective.
$$f(x)=f(x+2k\pi), \forall k \in \mathbb{Z}$$
Although it can be inverted on some small intervals such as $[a,b]$ where $a=\max \limits_x \{ f(x)=0, x<0 \}$ and $b=\min\limits_x \{ f(x)=1, x>0 \}$  simply find such interval by solving $$f(x)=0$$
and $$f(x)=1$$
and then try to invert the function there.
It should be helpful, that
$$f^2(x)=1-sin(2x) \iff 1-f^2(x)=sin(2x)$$
and on the limited domain of $\arcsin$ you have
$$2x=\arcsin(1-f^2(x)) \iff x = \frac{\arcsin(1-f^2(x))}{2}$$
but the most helpful idea is to look at its plot, which looks like scaled and shifted sinusoid, it should give you a hint.

A: Hint: rewrite the initial function as $f(x)=\sqrt{2}\left(\frac 1{\sqrt{2}}\sin(x)-\frac 1{\sqrt{2}}\cos(x)\right)$ an then as $\sqrt{2}\,\sin(x-?)\;$ (or as $\;-\sqrt{2}\,\cos(x+?)\,$).

A: From $$f(x) =y= \sin(x)-\cos(x)$$ follow that
$$f^2(x)=y^2=(\sin(x)-\cos(x))^2=\sin^2x-2\sin x\cos x+\cos^2x=1-\sin(2x)$$
since
$\sin^2x+\cos^2x=1$ and $2\sin x\cos x=\sin(2x)$
$$\sin(2x)=1-f^2(x)=1-y^2$$
$$2x=\arcsin(1-y^2)$$
$$x=\frac{1}{2}\arcsin(1-y^2)$$


text:
Q: Join two functions to one If I have, for example
sol1 = NDSolve[{u'[t] == u[t], u[0] == 1}, u, {t, 0, 1}]
sol2 = NDSolve[{u'[t] == u[t], u[0] == 1}, u, {t, 1, 2}]
sol = Join[sol1, sol2]

I expected to get one function that goes from 0 to 2, but intead I get a list of two functions.
How can I join sol1 and sol2 in order to get one function on a larger interval?

A: How bout this
sol1 = NDSolveValue[{u'[t] == u[t], u[0] == 1}, u, {t, 0, 1}]
sol2 = NDSolveValue[{u'[t] == u[t], u[0] == 1}, u, {t, 1, 2}]

sol[t_?NumericQ] :=  Piecewise[{{sol1[t], 0 <= t <= 1}, {sol2[t], 1 < t <= 2}}];

Plot[sol[t], {t, 0, 2}]


text:
Q: setup to allow third party cookies while invoking a browser using playwright How to enable third party cookies while invoking chrome incognito using playwright automation tool?
I couldn't able to find a solution for this. Please help

A: According to this thread, it is apparently not currently possible with Playwright: https://github.com/microsoft/playwright/issues/11072

We don't have a feature that enables all cookies in Chrome, we only use default settings.


text:
Q: Return to beginning state at the end of the video I'm using video.js (4.1.0), and would like to return to the ready-to-start state at the end of the video. I don't see how to do this.
If I do
myPlayer.on("ended", function(){
});
and load the poster frame in there, using myPlayer.posterImage.show(); it covers the entire video object, even if a user starts playing the video again.
If, at the end, I do this:
this.pause();
this.currentTime(0);
it has the video paused at the beginning, rather than the ready state with poster frame.
Any thoughts on how I can accomplish this?

A: The poster image should disappear again when playback restarts - do you have a link where it does not? It does in this fiddle, where the posterImage and bigPlayButton are shown and currentTime is set to 0.
var vid = videojs("myVideo");
vid.on("ended", function(){
  vid.posterImage.show();
  vid.bigPlayButton.show();
  vid.currentTime(0);
})


text:
Q: When trying to create a trigger in RDS I get an error about binary logging When trying to create a trigger in RDS, I get the following error:
ERROR 1419 (HY000): You do not have the SUPER privilege and binary logging is
enabled (you *might* want to use the less safe log_bin_trust_function_creators
variable)

Is there a way to get SUPER privileges or to disable binary logging?

A: I don't know if there is a way to get SUPER privileges, but there is a way to disable binary logging (thereby removing the need to have SUPER privileges for creating triggers). This is done by setting the variable log_bin_trust_create_function_creators to 1.

*

*Create a new RDS Parameter Group. Alternatively, you may modify your current parameter group (if its not the default parameter group) and skip steps 3-5.

*Change the value of log_bin_trust_create_function_creators to 1 for that parameter group

*Also change any parameters that have non-default values in the parameter group that your RDS instance is currently using. This is necessary because an RDS instance can only be associated with one parameter group

*Modify your RDS instance so that it uses your new parameter group

*Wait for the parameter group change to show in the event log

*Restard the RDS instance. log_bin_trust_create_function_creators is labeled as dynamic vairable, and therefore shouldn't require a restart, but I have always needed to restart the RDS instance for the change to take effect. Perhaps there is another way but I haven't found it.


text:
Q: Code file and header paths hard-coded in static library? I've opened a static library (compiled with VC++) in a hex editor and I see the paths of all code files and headers. I don't understand what purpose they serve there.
Is there a way to not have them embedded in the binary? I've been through all the options (I think) but couldn't find anything.

A: Yes, the compiler embeds a lot of contextual information in a static library.  Keep in mind that a static lib is a pretty weak code abstraction, it is nothing but a bag of .obj files.  Think of it as a .zip file with a lousy compression ratio :)
There is a very hard requirement for that information, the rest of the tool-chain depends on it.  Like the library manager, it needs to merge the program databases.  And the linker, it needs to be able to restart the compiler's back-end to rebuild the binary with profile-guided optimization data.
Which is probably what you see, the /GL compile option embeds the command line that the compiler used.  So PGO can be properly done, using the exact same compile options.  Notable also for being very handy to the client programmer, he can reverse-engineer the compile options he needs to use to be able to properly link your library.  A very important detail that everybody forgets to document :)
Do note that you cannot reasonably remove this information, PGO is important.  If you don't like this kind of information disclosure then use a build server or ship a binary instead of a library.  A DLL.


text:
Q: Qt : Child graphic items hover event I have two items of type QGraphicsRectItem. One over the other.
The first one is a custom class called Wall. Inside the wall there are windows and doors.
In fact, i have a list of Doors and Windows inside this custom Wall class.
The Doors are Items too, and are drawn inside the wall.
When i move the mouse over the door, the hover function of the wall is emited, but the hover of the door is not. Both of them correctly copied one from each other as virtual void protected.
Why is that happening? How can i make the door and window items realize about the hover?.

A: I have tried with a custom QGraphicsItem instead of a custom QGraphicsRectItem. It seems the hover event handler is successfully called for both Wall and Door. This is happening when explicitly setting QGraphicsItem with setAcceptHoverEvents(true). This is not tested with custom QGraphicsRectItem.

#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QGraphicsItem>
#include <QPainter>

class Item : public QGraphicsItem
{
    QBrush m_brush;
public:
    explicit Item(bool nested = true, QGraphicsItem* parent = 0) : QGraphicsItem(parent), m_brush(Qt::white)
    {
        if (nested) {
            Item* item = new Item(false, this);
            item->setPos(10,10);
            m_brush = Qt::red;
        }
        setAcceptHoverEvents(true);
    }
    QRectF boundingRect() const
    {
        return QRectF(0,0,100,100);
    }
    void hoverEnterEvent(QGraphicsSceneHoverEvent *)
    {
        m_brush = Qt::red;
        update();
    }
    void hoverLeaveEvent(QGraphicsSceneHoverEvent *)
    {
        m_brush = Qt::white;
        update();
    }
    void paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
    {
        p->setBrush(m_brush);
        p->drawRoundRect(boundingRect());
    }
};

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QGraphicsScene scene;
    scene.addItem(new Item);
    QGraphicsView view;
    view.setScene(&scene);
    view.setMouseTracking(true);
    view.show();
    return app.exec();
}


text:
Q: Mac or Motherboard as a unique identifier for licensing purpose? OK so i was using MAC address as a unique identifier , all went good until i activated a VPN and the mac address changed.....
So, i have 2 options:
1) Get the MAC Address of the actual physical network card
For mac address i found several tips on how to achieve this:

*

*Link1

*Link2
2.) Get the motherboard ID and use that instead, and hope we dont get 2 computer with same id( is that possible? )
public String getMotherBoardID()
{
    String serial = "";
    try
    {
        ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT SerialNumber FROM Win32_BaseBoard");
        ManagementObjectCollection moc = mos.Get();

        foreach (ManagementObject mo in moc)
        {
            serial = mo["SerialNumber"].ToString();
        }
        return serial;
    }
    catch (Exception)
    {
        return serial;
    }
}

What do you say? Should i try to dig and find code that gets the mac address from the card and not the virtual ones, or should i just switch to motherboard? And i don't need to combine anything, i just need something that is not going to change so easily on the targeted computer.

A: Its better if you could use a combination of values from Motherboard, NIC and harddrive.
You may check this article: How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...)

A: I think an approach similar to the following would be as secure as it can get

*

*you give the user a license key for the software, tied to e.g. customer's name or company

*user inputs this data in the program

*each time the program is fired, it "phones home" sending licensing info

*if license is verified (by your system) to be valid, the software would receive back some data which actually make it able to function. Otherwise it wouldn't work no matter what (some parts would be missing).

An example (i'm thinking C# from now on) of not being able to run unless it's licensed, would be to make some fundamental method extern. You'll send the required assembly in response to a valid license, or fallback to a "Gotcha!" warning.

A: Use something provided by microsoft for this. they use a combination of hardware identifiers. MACs are bad because they can usually be changed. Microsoft is bound to have some unique instlalation identifier.
Windows Unique Identifier?

A: I would personally do the following,

*

*Grab a number of hardware keys.

*

*UUID

*Serial Number

*Hard disk serial number

*Physical MAC address (for tips on how to do this one see my solution here)

*Allow one (or even two) of those to change whilst keeping the license alive.

*Require a re-activation of your license.

*Track the number of reactivations for a customer and have a maximum of some sort before you get suspicious.

Don't use WMI I'd estimate that at least 1/10 times it doesn't work.  You will need to bypass WMI and get these hardware details using Windows APIs.
Developed something similar personally, it tracks 10 different things (including software attributes) with some logic to allow for changes.  Using WMI fell flat on its face in the first release.


text:
Q: How does << work and what is it called?
Possible Duplicate:
Correct textual name for <<

I am learning about Go and saw this usage I've never seen before (from http://golang.org/doc/install.html):
$ cat >hello.go <<EOF
package main

import "fmt"

func main() {
    fmt.Printf("hello, world\n")
}
EOF

Curious, I tried it myself:
$ echo <<EOF hello
> asdf
> asdf
> EOF
hello

$ echo <<test hello
> hello
> test
hello

I am aware of redirecting standard input to read from a file instead (via < operator), but I've never seen <<, and not with this start/end delimiter business.  (I know about >> for appending but this seems different)  It's extremely hard to search for <<; could someone point me in the right direction?


text:
Q: Pandas appending across columns (or SQL) I have the following dataframe where - and $ is data
A B C 01/01/18 01/08/18
- - -     $        $
- - -     $        $
- - -     $        $

I would like to transform into the following
A B C  Period   Cost
- - -  01/01/18 $
- - -  01/01/18 $
- - -  01/01/18 $
- - -  01/08/18 $
- - -  01/08/18 $
- - -  01/08/18 $

I know I can create two dataframes for each period df1 and df2 then total = df2.append(df1) but I would have to create 52 dataframes for the year. Is there an easier way to do this using some fancy transpose?
Updated Approach
I am trying to do the following df.grouby(['A','B',C']) but I need to df.transpose() first I believe. If someone can help me out with this approach even if its in SQL I would appreciate it.

A: That's what pandas.melt does:
pd.melt(df, id_vars=['A', 'B', 'C'], var_name='Period', value_name='Cost')

#   A  B  C    Period Cost
#0  -  -  -  01/01/18    $
#1  -  -  -  01/01/18    $
#2  -  -  -  01/01/18    $
#3  -  -  -  01/08/18    $
#4  -  -  -  01/08/18    $
#5  -  -  -  01/08/18    $

You can also set unchanged columns as index and then stack the other columns:
ids = ['A', 'B', 'C']
df.set_index(ids).stack().rename_axis(ids + ['Period']).rename('Cost').reset_index()

#   A  B  C    Period Cost
#0  -  -  -  01/01/18    $
#1  -  -  -  01/08/18    $
#2  -  -  -  01/01/18    $
#3  -  -  -  01/08/18    $
#4  -  -  -  01/01/18    $
#5  -  -  -  01/08/18    $


text:
Q: Firebase queryEqual to any of multiple values I'm writing a chat app using a Firebase database. I need to query my data to find the messages to show to the user. I am currently using queryEqual to find all the posts FROM the specified user:
databaseRef.child("posts").queryOrdered(byChild: "uid").queryEqual(toValue: FirebaseManager.currentUser?.uid)

This returns all the posts sent from the logged in user, but doesn't return anything sent TO the logged in user. I can get the messages sent to the logged in user by changing 'uid' to 'toId' as follows:
databaseRef.child("posts").queryOrdered(byChild: "toId").queryEqual(toValue: FirebaseManager.currentUser?.uid)

But how can I combine the two into one query that says "give me all the posts where either 'uid' or 'toId' is equal to this value"?
Here is my database:


text:
Q: Looking for some Java good practice advice regarding distributed applications and message passing Some background information. This is a distributed application with multiples nodes. A 'communication' thread sends and receives all messages sent between these nodes. This cannot be changed.
A 'doStuff' thread asks the 'communication' thread to send a message to a node. It then needs to wait for a response from the other node. The 'communication' thread will receive this response message. It then needs to deliver this message to the correct 'doStuff' thread.
I am unsure what sort of information needs to be stored at the node or within the message to ensure that the correct thread always receives the response message.
Looking for some advice upon how to achieve this. Thanks for reading :)

A: You probably want to attach some sort of message id to the outgoing message to be included in the response. A sequential number or a UUID would probably do the job. Your communicator thread can then keep track (a map?) of what "doStuff" thread was waiting for a given response and pass it back.
You could also keep track of when the request was sent so that if a response isn't received the communicator thread can notify the doStuff thread that the response wasn't received.

A: It doesn't seem very difficult
Use either a thread id, or other opaque token invented by the doStuff thread which is stored by the Communication thread (mapped to the calling thread id) and returned with the response The communication thread looks it up in the Map to identify the corresponding thread.
Or am I missing something?

A: Is using JMS an option at all?  If so, you might find that more practical than doing "roll your own."  Asynchronous message passing, in general, is a solved problem.  If JMS is an option, look at TopicRequestor and/or QueueRequestor in particular.


text:
Q: Combine dataframes with custom indices and overlapping columns I want to combine two dataframes with custom indices and potentially(but not gauranteed) overlapping columns. For overlapping columns, if there is a collision (same index both dfs have values), i want to take the value of the right df. If columns are completely distinct just take the union of the columns and replace values with nan as appropriate
Ex:

df1:
       'fruit'   'vehicle'   'plant'
'abc'   apple     truck       tree
'def'   orange    car         bush
'ghi'   peach     bike        shrub

df2:
       'fruit'    'phone'
'ghi'   plum       android

Result would be:

result:
       'fruit'   'vehicle'   'plant'   'phone'
'abc'   apple     truck       tree     'nan'
'def'   orange    car         bush     'nan'
'ghi'   plum     bike        shrub    'android'

I've played around with join/merge, but can't seem to get my use case working.(End up with _x and _y on column names etc) Keeping the indices are compulsory as well (the 'abc', 'def', 'ghi')
Is this possible?


text:
Q: How to implement ConnectEx, AcceptEx in Winsock SPI These are Microsoft specific extensions and I wonder if it is possible to implement them in third-party drivers. They are both needed to implement pure IOCP client and server code.
The Function Extension Mechanism in the SPI page is a little thin on information...

A: It is achieved by intercepting SIO_GET_EXTENSION_FUNCTION_POINTER inside WSPIoctl in the SP.
Example in the SDK sample netds\winsock\lsp\ifslsp


text:
Q: Pagination in code igniter I am do pagination in code igniter ,join two tables for Search purpose
my Models's

public function main_search_count($term)
    {
 if ($term == "NIL") $term = "";
 $this->db->select('*');
 $this->db->from('tbl_doctor');
 $this->db->join("tbl_specialisation", "tbl_specialisation.spec_id = tbl_doctor.spec_id",'left');
$this->db->where("(tbl_doctor.dr_name LIKE '%".$term."%' OR tbl_doctor.district LIKE '%".$term."%' OR tbl_specialisation.spec_specialise LIKE '%".$term."%')");
$query= $this->db->get();
return $query->num_rows();
    }
    public function fetch_data($limit, $offset, $term)
    {
if ($term == "NIL") $term = "";
$this->db->select('*');
$this->db->from('tbl_doctor');
$this->db->join("tbl_specialisation", "tbl_specialisation.spec_id =         tbl_doctor.spec_id",'left');
$this->db->where("(tbl_doctor.dr_name LIKE '%".$term."%' OR tbl_doctor.district LIKE '%".$term."%' OR tbl_specialisation.spec_specialise LIKE '%".$term."%')");
$this->db->limit($limit, $offset);
$query = $this->db->get();
if($query->num_rows()>0)
{
 return $query;
 }
 }

my controller

 function get_quick_doct($offset = 0)
    {
$term = ($this->input->post("term"))? $this->input->post("term") : "NIL";
$term = ($this->uri->segment(3)) ? $this->uri->segment(3) : $term;
$config = array();
   $config["base_url"] = base_url() . "User/get_quick_doct/$term";
    $config['total_rows'] = $this->Search_model->main_search_count($term);
    $config['per_page'] = 5;
    $config['full_tag_open'] = '
';
    $config['full_tag_close'] = '
';
    $config['first_link'] = false;
    $config['last_link'] = false;
    $config['first_tag_open'] = '
';
    $config['first_tag_close'] = '
';
    $config['prev_link'] = 'Prev';
    $config['prev_tag_open'] = '
';
    $config['prev_tag_close'] = '
';
    $config['next_link'] = 'Next';
    $config['next_tag_open'] = '
';
    $config['next_tag_close'] = '
';
    $config['last_tag_open'] = '
';
    $config['last_tag_close'] = '
';
    $config['cur_tag_open'] = '
';
    $config['cur_tag_close'] = '
';
    $config['num_tag_open'] = '
';
    $config['num_tag_close'] = '
';
    $this->pagination->initialize($config);
$data['quick_doc'] = $this->Search_model->fetch_data($config['per_page'], $offset,$term);
$data['get_specs'] = $this->specialisation_model->get_specialisation();
$data['get_specs'] = $this->specialisation_model->specialisation_get();
if($data){
$this->load->helper(array('form', 'url'));
$this->load->view('customer/header', $data);
$this->load->view('customer/side_view',$data);
$this->load->view('customer/quick_search',$data);
$this->load->view('customer/footer');
        }
else{
$this->session->set_flashdata('msg','
No sdfdsfds Results available for your search!!!
');
$this->load->view('customer/header', $data);
$this->load->view('customer/side_view',$data);
$this->load->view('customer/main_search');
 $this->load->view('customer/footer');
}}

here the problem is  the pagination work only one page click next link show same item here show only 5 content only totally more than 5 item but next page show same element

A: Try the function like this, it will definitely solve your problem. Again I am requesting you to go for the documentation for more understanding.
function get_quick_doct()
{
    $term = ($this->input->post("term"))? $this->input->post("term") : "";

    $config = array();
    $config["base_url"] = base_url() . "User/get_quick_doct/";
    $config['total_rows'] = $this->Search_model->main_search_count($term);
    $config['per_page'] = 5;
    $config['full_tag_open'] = '
';
    $config['full_tag_close'] = '
';
    $config['first_link'] = false;
    $config['last_link'] = false;
    $config['first_tag_open'] = '
';
    $config['first_tag_close'] = '
';
    $config['prev_link'] = 'Prev';
    $config['prev_tag_open'] = '
';
    $config['prev_tag_close'] = '
';
    $config['next_link'] = 'Next';
    $config['next_tag_open'] = '
';
    $config['next_tag_close'] = '
';
    $config['last_tag_open'] = '
';
    $config['last_tag_close'] = '
';
    $config['cur_tag_open'] = '
';
    $config['cur_tag_close'] = '
';
    $config['num_tag_open'] = '
';
    $config['num_tag_close'] = '
';
    $this->pagination->initialize($config);

    $segment = $this->uri->segment (2); // 2 or 3 -- as per your url depth

    $data['quick_doc'] = $this->Search_model->fetch_data($config['per_page'], $segment, $term);
    $data['get_specs'] = $this->specialisation_model->get_specialisation();
    $data['get_specs'] = $this->specialisation_model->specialisation_get();
    if($data)
    {
        $this->load->helper(array('form', 'url'));
        $this->load->view('customer/header', $data);
        $this->load->view('customer/side_view',$data);
        $this->load->view('customer/quick_search',$data);
        $this->load->view('customer/footer');
    }
    else{
        $this->session->set_flashdata('msg','
No sdfdsfds Results available for your search!!!
');
        $this->load->view('customer/header', $data);
        $this->load->view('customer/side_view',$data);
        $this->load->view('customer/main_search');
        $this->load->view('customer/footer');
    }
}


text:
Q: Is it possible to cache JSP bytecode to avoid recompiles w/ Tomcat? Is there any way of caching the bytecode for JSP webapps/ In particular, using Tomcat as the Java servlet? I'm getting really fed up of Tomcat taking up all the CPU for 10 minutes while it compiles 4 different webapps every time I restart it....
I'm already using Jikes to "speed up" the compiles, but it's really killing me. The code does not change unless the webapp is upgraded (very rarely), and I cannot believe that there is no way to cache the compiled java bytecode instead of recompiling it each and every time.
I'd appreciate any advice on the matter!

A: You can try JSP Weaver:
http://www.zeroturnaround.com/jsp-weaver/

A: Have you tried precompiling your JSPs ? See this page for more info, and examples on how to compile into the web deployment directory, so Tomcat doesn't have to do this itself.


text:
Q: Display text from ID in other ID I'm trying to display text from one ID in another, but it only works once. So I load the page, hover over the title with the ID and then another and it just stays on the first one.
HTML

'.get_the_title().'';

Test

jQuery
  jQuery(document).ready(function()
    {
        (function ($)
        {
            $('#portfolio_title_area').hover(function()
            {
                $('#title_hover').text($('#portfolio_title_area').text());
            });
        })(jQuery);
    });

A: To me, your comments indicate that you have multiple titles, which should be displayed in #title_hover when hovering. If so, don't use ids, use a class selector, e.g.:

jQuery(function ($) {
  // keep a reference to the target, so we
  // don't need to query on every enter/leave
  const $title = $('#title_hover');

  // store original text
  const fallback = $title.text();

  $('.cp_widget_title').on({
    // on enter
    'mouseenter': function() {
      // overwrite with text from hovered element
      $title.text($(this).text());
    },
    // on leave
    'mouseleave': function() {
      // reset to previous text
      $title.text(fallback);
    },
  })
});

Some title 1
Some title 2
Some title 3
Some title 4

Test

On a side note, regarding the boilerplate to get a reference to jQuery as $ in noConflict-mode, instead of:
jQuery(document).ready(function() {
    (function ($) {
        // code
    })(jQuery);
});

you can use the following, which is equivalent:
jQuery(function ($) {
    // code
});

A: Try this code.
jQuery(document).ready(function()
    {
        (function ($)
        {
            $('#portfolio_title_area').hover(function()
            {
                $('#title_hover').text($('#portfolio_title_area').text());
            }, function() {
                $('#title_hover').text('');
            });
        })(jQuery);
    });

A: It's because you once change it and never ask it to change back when you're done hovering:

  jQuery(document).ready(function()
    {
        (function ($)
        {
          var text = $('#title_hover').text();
            $('#portfolio_title_area').mouseover(function()
            {
                $('#title_hover').text($('#portfolio_title_area').text());
            });
            $('#portfolio_title_area').mouseout(function()
            {
                $('#title_hover').text(text);
            });
        })(jQuery);
    });

'.get_the_title().'';

Test

Use mouseover and mouseout instead of hover.

A: Add mouseleave  function
 jQuery(document).ready(function()
{
    (function ($)
    {
        $('#portfolio_title_area').hover(function()
        {
            $('#title_hover').text($('#portfolio_title_area').text());
        });
            $('#portfolio_title_area').mouseleave(function()
        {
            $('#title_hover').text('Test');
        });
    })(jQuery);
});

A:

function disp(idname)
{
 var x=document.getElementById(idname).innerHTML;
 document.getElementById("title_hover").innerHTML=x;
}
function def()
{
 document.getElementById("title_hover").innerHTML="Test";
}

'.get_the_title().'';

Test

JScript version...

A: You are using IIFE (i.e Immediately Invoked Function Expression)
((function ($)
{

})(jQuery);

This is executed only once and that too even before document.ready is executed. So it is working only once.
You can even do it without IIFE.


text:
Q: Prove that $z_{n+1} = \frac12 \left(z_n +\frac{1}{z_n} \right) $ converges to $1$ For a complex sequence $\{z_n\} $ defined by the recurrence relation $$z_{n+1}=\frac12  \Bigg(z_n +\frac{1}{z_n} \Bigg) $$ where $\arg z_n \in (-\frac{\pi}{2},\frac{\pi}{2})$, prove that it converges to $1$.

A: From the recursion relation we get, $$\left(\frac{z_{n+1}+1}{z_{n+1}-1}\right)=\left(\frac{z_{n}+1}{z_{n}-1}\right)^2, \forall n\geq1 $$ So iteratively, we get, $$\left(\frac{z_{n+1}+1}{z_{n+1}-1}\right)=\left(\frac{z_{0}+1}{z_{0}-1}\right)^{2^{n+1}}$$ Rearranging, we get, $$z_{n+1}=\frac{1+w^{2^{n+1}}}{1-w^{2^{n+1}}}$$ where $$w=\frac{z_0-1}{z_0+1}$$ Clearly, $|w|<1$ and $\arg{w}\in[-\pi/2, \pi/2]$ (I'm omitting the proofs but they are not difficult). Hence $$\lim_{n\rightarrow \infty}w^{2^{n+1}}=0 e^{j0}=0
$$ Thus $$\lim_{n\rightarrow \infty}z_n=1 \hspace{0.6cm}\Box$$


text:
Q: Java converting nested JSON to CSV I am creating a Java service that gets a JSON Object from a HTTP GET Request.
This is an example of the JSON Object I am getting:
{
    "data": [{
        "itemNumber": "547325645",
        "manufacturer": "LV3",
        "name": "Levis 501",
        "minimumQuantity": "1.0",
        "maximumQuantity": "10.0",
        "prices": [{
            "currency": "EUR",
            "amount": "80.0"
        }]
    }, {
        "itemNumber": "224145625",
        "manufacturer": "LV3",
        "name": "Levis 502",
        "minimumQuantity": "1.0",
        "maximumQuantity": "10.0",
        "prices": [{
            "currency": "EUR",
            "amount": "90.0"
        }]
    }],
    "pagination": {
        "offset": 0,
        "limit": 2,
        "total": 1925
    }
}

Right now I am using Jackson to map my HttpResponse into a JSON Object:
    productListResponse = new BufferedReader (
        new InputStreamReader(getResponse.getEntity().getContent(), StandardCharsets.UTF_8))
            .lines()
            .collect(Collectors.joining("\n"));
    JsonNode productListJson = mapper.readTree(productListResponse);

The problem where I run into now is that I can't parse this JSON properly. For example, I want to omit many values, like the quantities or the currencies. I also want to convert the manufacturer value to another text, in this case "Levis". But what fails for now is the data list, this does not get along with the mapper. I get an empty object back, which does not contain the JSON, but I have already tested if I get a response at all and I do. The next problem would be, of course, that the prices are also in a list and there I also do not know how to go on.
Simply put, I just want a semicolon-separated CSV file where I pull individual values out of the JSON. Of course, I have already done a lot of research and also found reliable information, but it does not apply to my case.
These are some of the sources I have already used:
https://www.baeldung.com/java-converting-json-to-csv
Converting JSON to XLS/CSV in Java
https://docs.aspose.com/cells/java/convert-json-to-csv/


text:
Q: Free text in Select2ListView django-autocomplete-light I'll expose my case as detailed as possible:
I'm using the functionality of autocomplete to automatically populate a value that is dynamic into the form. The form has several values, when you fill the first 3 I'm able to run an operation (with those values) and return a suggested value to the user.
I needed to adapt a bit the return of parameters but I achieved it with Select2ListView
class MyFunctionAutocomplete(autocomplete.Select2ListView):
    def get_list(self):
        if not self.request.user.is_authenticated:
            return [""]
        try:
            field1_pk = self.forwarded["field1"]
            field2_pk = self.forwarded["field2"]
            field3_pk = self.forwarded["field3"]
        except AttributeError:
            return [""]
        try:
            ObjField1 = ModelField1.objects.get(pk=field1_pk)
            ObjField2 = ModelField2.objects.get(pk=field2_pk)
            ObjField3 = ModelField3.objects.get(pk=field3_pk)
            return_value = ObjField1.get_result(param1=ObjField2, param2=ObjField3)
        except (ModelField1.DoesNotExist, ModelField2.DoesNotExist, ModelField3.DoesNotExist):
            return [""]
        return [return_value]

With this code I'm able to do what I need when the requirements (forwarded value) are present. So far, so good
My problem:
I cannot ADD any value as an extra option. This value IS NOT a ForeignKey, it's a simple Float. I want the user to be able to use my suggested value or instead just replace it by another value of their choice. Let's say in the dropdown they have the value 3.22221 and they want to write 12.11.
Since it can be practically ANY value I was thinking free text makes sense (I'll take care of cleaning data if necessary later). I checked and it looks like https://select2.org/tagging is what I want but not sure if I can use it here.
My form field in the form in case that helps is like:
result_field = Select2ListCreateChoiceField(
        widget=autocomplete.Select2(
            url="myapp:result_field_autocomplete",
            forward=["field1", "field2", "field3"],
            attrs={"data-container-css-class": ""},
        ),
        help_text=constants.RESULT_HELP,
)

Desired functionality:
result_field = Select2ListCreateChoiceField(
        widget=autocomplete.Select2(
            url="myapp:result_field_autocomplete",
            forward=["field1", "field2", "field3"],
            attrs={"data-container-css-class": ""},
            **free_text=True,**
        ),
        help_text=constants.RESULT_HELP,
)

And that the flag will allow me to enter ANY text of my choice.
I can get somewhere by changing the widget to TaggingSelect2 but that for sure it's not the option, is clumsy and the user will have multiple option which is NOT what I want.
Ideally all I would need (if someone can think of another option) is the info to appear as initial data in the form once I filled the other 3 elements by running that function. If that can be done with just another method it will be great as well.
I hope it makes sense :)

A: In case someone finds the same problem, my experience with Javascript is very limited but I compromised on having a button and creating a Javascript function that calls a view (in the same way django-autocomplete-light does):
Final code:
urls.py:
path(
    "result-autocomplete/",
    views.MyFunctionAutocomplete,
    name="result_autocomplete",
),

views.py:
def MyFunctionAutocomplete(request):
    if not request.user.is_authenticated:
        return HttpResponse("")
    try:
        field1 = request.GET["field1"]
        field2 = request.GET["field2"]
        field3_name = request.GET["field3"]
        obj_Field3 = ModelField3.objects.get(name=field3_name)
    except AttributeError:
        return HttpResponse("")
    except ModelField3.DoesNotExist:
        return HttpResponse("")

    current_result = obj_Field3.get_result(f"{field1}{field2}")
    return HttpResponse(current_result["result"])

getresult.js:
function getResult(url){
 var field1 = document.querySelector('[id=select2-id_field1-container]').innerText
 var field2 = document.querySelector('[id=select2-id_field2-container]').innerText
 var field3_name = document.querySelector("#id_field3").selectedOptions[0].innerHTML
 if ( field1 && field2 && field3_name){
   $.ajax({                       // initialize an AJAX request
    url: url,
    data: {
      'field1': field1,       // add the field1 to the GET parameters
      'field2': field2,           // add the field2 to the GET parameters
      'field3_name': field3_name    // add the field3_name to the GET parameters
    },
    success: function (data) {   // `data` is the return of the `MyFunctionAutocomplete` view function
      $("#id_result")[0].value = data ;  // replace the contents of the price input with the data that came from the server
      $("#id_result")[0].placeholder = data // Not needed really
    }
  });
 }
}

django-template.html:
[...]
      <form method="post">
        {% csrf_token %}
      {% for field in form %}
        {% if field.name == "result" %}
          <script defer src="{% static 'js/getresult.js' %}"></script>
          <button type="button" id="getresult" onclick="getresult('{% url "result_autocomplete"%}')">Get live result</button>
          {% bootstrap_field field show_label=True label_class="result" %}
        {% else %}
          {% bootstrap_field field %}
        {% endif %}
      {% endfor %}
[...]

I hope this helps other people like me with not really great JS skills and are stuck with something similar. I deployed this solution and it works, but if someone sees something wrong, let me know :-)


text:
Q: Multiple regression to only output residuals in VBA I'm currently working on a project where I need the residuals of a multiple regression in VBA.
I'm using the following code to run the multiple linear regression. Where my y variable is in R11:R376 and the X range is in S11:U376.
I want the final output to look like this:

I run the regression like this:
Application.Run "ATPVBAEN.XLAM!Regress",
ActiveSheet.Range("$R$11:$R$376") _
    , ActiveSheet.Range("$S$11:$U$376"), False, False, , ActiveSheet.Range( _
    "$X$11"), True, False, False, False, , False
Application.CommandBars("Format Object").Visible = False

Which gives me this output:

However, I want only the residual serie. Is there a way in VBA to not output all other information? I could of course just delete the part of the output that I don't want but the problem is that I don't want the output to appear on the screen. I have tried
 Application.ScreenUpdating = False

But I still get the output to show. So basically I want to run a multiple linear regression in VBA where only the residuals appear. As always, help is highly appreciated.

A: Try the next code, please. I used the columns as I mentioned in my comment. I firstly copied your first four rows values and copied them down up to 257 rows. Of course, you must adapt the code for the ranges you are using:
Sub testRegression()
 Dim sh As Worksheet, celRes As Range, lastRowR As Long, rngDel As Range
 Dim rngTarg As Range, rngDat As Range, rngRet As Range, arrRes

 Set sh = ActiveSheet
 Set rngTarg = sh.Range("A2:A257") 'the target range
 Set rngDat = sh.Range("B2:D257")  'values to be processed
 Set rngRet = sh.Range("G2")       'where to return (Regress function)

 Application.Run "ATPVBAEN.XLAM!Regress", rngTarg, rngDat, False, _
                False, , rngRet, True, False, False, False, , False

   Set rngDel = Selection  'the returned range area is selected and
                           'take advantage of this aspect
   'find the cell keeping the string "Residuals":
   Set celRes = rngDel.Find(What:="Residuals", After:=rngRet, _
                LookIn:=xlValues, Lookat:=xlWhole, MatchCase:=False)
   If Not celRes Is Nothing Then
       'determine the last row of the "Residuals" column:
       lastRowR = sh.cells(sh.rows.count, celRes.Column).End(xlUp).row
       'put "Residuals" values in an array (header included):
       arrRes = sh.Range(celRes, sh.cells(lastRowR, celRes.Column)).Value
       rngDel.Clear        'clear the initial returned range
     With rngRet.Offset(-1, -1)
        'drop the array values at once:
        .Resize(UBound(arrRes), UBound(arrRes, 2)).Value = arrRes
        .Select
     End With
   End If
End Sub

Please, send some feedback after testing it...

A: A slightly different approach: Excel provides a spreadsheet function for multiple linear regression, LINEST()
If you just want the residuals (and none of the regression statistics), you can wrap LINEST in a user-defined spreadsheet function:
Option Explicit

'Array spreadsheet function to perform Linear Regression and return residuals
Public Function LinestResiduals(rngY As Range, rngX As Range) As Variant
    Dim vX As Variant
    Dim vY As Variant
    Dim vLinest As Variant
    Dim vResidual As Variant

    Dim lValues As Long
    Dim lCoeffs As Long

    vX = rngX
    vY = rngY

    lValues = UBound(vX)
    lCoeffs = UBound(vX, 2)

    vLinest = Application.WorksheetFunction.LinEst(vY, vX, True)

    ReDim vResidual(1 To UBound(vY), 1 To 1) As Variant

    Dim lVal As Long
    Dim lCoeff As Long
    Dim d As Double
    For lVal = 1 To lValues
        d = 0
        'Oddly the LinEst function returns the coeffs in reverse order
        For lCoeff = 1 To lCoeffs
            d = d + vLinest(1 + lCoeffs - lCoeff) * vX(lVal, lCoeff)
        Next lCoeff

        'Find residual, including intercept
        vResidual(lVal, 1) = vY(lVal, 1) - d - vLinest(lCoeffs + 1)
    Next lVal

    LinestResiduals = vResidual
End Function

Here's an example in action:

NB: This only handles data that is organized in columns. Extra code is required if data might be organized in rows.


text:
Q: shell script that send email before exiting i am trying to write a shell script that will send me an email before exiting itself
or
as i am running this on an amazon ec2 DEBAIN spot request and it should send me an email before the instances is terminated
            #!/bin/bash
            sendEmailLog()
            {
            emailLog=true
               if [ $emailLog = "true" ];then
                    /usr/bin/mpack -s "emailed log" -a "/srv/log.html" "emailid@gmail.com";
               fi
               exit 0;
            }

            trap sendEmailLog INT TERM EXIT KILL QUIT

            aws ec2 terminate-instances instances ID

i tried the above code it doesnot send me an email before its terminated
i am using DEBAIN 7

A: I think you might have a couple issues.  I'm not super-familiar with mpack, but it looks like your syntax is correct (except the ";" at the end).  Make a couple changes, below, and see if it helps.
I would use quotes define your emailLog string, although it's not really clear why you're using a string for a boolean statement that, as far as I can tell, you want to ALWAYS run.  Unless you want to get an error code.
 emailLog="true"

To check for equality, use two ==:
if [ $emailLog == "true" ]; then

And as I said, the ';' is superfluous.
If I were to re-write it, I would write it like this:
sendEmailLog() {
    /usr/bin/mpack -s "emailed log" -a "/srv/log.html" "emailid@gmail.com" && exit 1
    exit 0
}

trap sendEmailLog SIGINT SIGTERM SIGKILL

aws ec2 terminate-instances instances ID


text:
Q: Logo programming language I want to setup the Logo programming language in Ubuntu 14.04. Can someone please suggest me the appropriate compiler which is available?

A: LibreOffice now provides a Logo implementation that is truer to vintage Logo than KTurtle.  Install as sudo apt install libreoffice-librelogo, and then access its controls by enabling the Logo toolbar under View|Toolbars|Logo within LibreOffice Writer.  There will also be a Logo entry in the LibreOffice Help system.
It's well documented and simple to use once you get the hang of it, and feels very much like Apple II logo, and TI-99/4A logo.

A: According to Wikipedia, UCBLogo, also known as Berkeley Logo, is closest to a 'de facto' standard Logo programming language and is available through the Debian command line package management tool Advanced Package Tool, APT. UCBLogo Language code is an interpreted computer language, and does not require an additional complier.
To install type: sudo apt-get install ucblogo

A: There's also the turtle module that ships with Python!
$ python
>>> from turtle import *
>>> forward(100)

A: You could try KTurtle:
To install it use sudo apt-get install kturtle or Ubuntu software center


text:
Q: How can I stop windows from always booting first? I tried to make a dual boot setup on my computer. Already had windows 7 installed on one hard drive, then tried to install ubuntu on part of another hard drive. When i turn my computer on windows7 always boots, there is no option to select which os to boot regardless of the order i put the hard drives to boot from in the bios this always happens. If I remove the hard drive with windows on it instead of booting ubuntu it just says there is an error - windows can't boot because something is missing. After installing ubuntu it said everything was fine. Something else which may help: originaly i had kubuntu installed before windows but when i insstalled windows 7 i could no longer get to it and just stopped uing it. How can I stop this from happening so that I can boot into Ubuntu?

A: What's happened is that Windows 7 has overridden Grub (the Linux boot loader) with its own bootloader. This is fixable, it just takes a little bit of work. Here's how to fix it.
You'll need an Ubuntu 10.10 live cd.
Boot into the live session
Open a terminal (Applications > Accessories > Terminal) and become root by running
sudo su -

Next you'll need to inspect your disk and look at the partitioning. Run
fdisk -l

You'll need to do a little bit of detective work, but you want to identify the Ubuntu root partition. you will get output that looks like this
   Device    Boot      Start         End      Blocks   Id  System
   /dev/sda1   *           1       18663   149903360   83  Linux
   /dev/sda2           18663       19458     6384641    5  Extended
   /dev/sda5           18663       19458     6384640   82  Linux swap / Solaris

With another for your windows setup. The /dev/sda1 line, and the numbers will probably be different, but you want to find the one that is listed as System: Linux.
Now you'll mount that, and install grub.
mount /dev/sda1 /mnt
grub-install --root-directory=/mnt/ /dev/sd1

replacing /dev/sda1 with what yours said.
That should be it, reboot and you should be able to boot Ubuntu and Windows.

A: You need to install grub on the correct hard drive (the drive that boots first). To find detailed info on how to do it: here

A: You haven't installed grub to your second hdd (Contains ubuntu). Just install grub to this hdd. if you feel difficult to do it, just  reinstall the ubuntu ( Be sure that you are opted to install grub). And make this hdd to boot first.

A: If you don't feel confident installing GRUB again using the install cd i recommend downloading and installing Easy BCD for Win7.
http://neosmart.net/blog/2010/welcome-to-easybcd-2/
It should be able to recognize all operating systems installed and allow you to easily decide the boot order


text:
Q: Implement Download listener for webView inside Fragments I'm using below code to populate my Fragments with webView. I would like to download any file from external browser whenever user clicks any download link inside webView.
I know for Mainactivity, Below Code Works Fine.

 webView.setDownloadListener(new DownloadListener()
                {
                    public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength)
                    {
                        //download file using web browser
                        Intent i = new Intent(Intent.ACTION_VIEW);
                        i.setData(Uri.parse(url));
                        Toast.makeText(getApplicationContext(), "Downloading File", //To notify the Client that the file is being downloaded
                                Toast.LENGTH_LONG).show();
                        startActivity(i);

                    }
                });

But I would like to implement for Fragments , How can I achieve this.
My Fragment  code is

package com.nepalpolice.cdp;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.LayoutInflater;

import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ProgressBar;

/**
 * Created by Sagar on 2017/09/23. yo chai menupage ko Fragments ko lagi
 */

public class webb extends Fragment {

    WebView myWebView;
    private LinearLayout container;
    private Button nextButton, closeButton;
    private EditText findBox;
    ProgressBar pbar;

    public webb() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View rootView = inflater.inflate(R.layout.fragment_webb, container,  false);

        String url1 = getArguments().getString("url1");

        myWebView=(WebView)rootView.findViewById(R.id.webview);
        pbar = (ProgressBar)rootView.findViewById(R.id.progressBar1);
        pbar.setVisibility(View.VISIBLE);

        myWebView.getSettings().setBuiltInZoomControls(true);

        myWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        myWebView.getSettings().setLoadsImagesAutomatically(true);
        myWebView.getSettings().setJavaScriptEnabled(true);

        myWebView.getSettings().setBuiltInZoomControls(true);

        myWebView.setInitialScale(1);
        myWebView.getSettings().setLoadWithOverviewMode(true);
        myWebView.getSettings().setUseWideViewPort(true);

        WebSettings webSettings = myWebView.getSettings();

        myWebView.setWebViewClient(new MyWebViewClient());
        myWebView.loadUrl(url1);

        return rootView;

    }

    public static String changedHeaderHtml(String htmlText) {

        String head = "<meta name=\"viewport\" content=\"width=device-width, user-scalable=yes\" />";

        String closedTag = "";
        String changeFontHtml = head + htmlText + closedTag;
        return changeFontHtml;

    }

    private class MyWebViewClient extends WebViewClient {

        @Override
        public void onPageFinished(WebView view, String url) {
            //remove your progressdialog here
            super.onPageFinished(view, url);
            pbar.setVisibility(View.GONE);

        }

    }

}

Thanks in advance.

A: you can get the url clicked inside the webview by overriding shouldOverrideUrlLoading method in your WebViewClient
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {

        // download your stuff here

        return false;
    }

be sure to read the documentation and to override correct  shouldOverrideUrlLoading method, depending on which SDK Api number you are targeting with your app!
cheers

A: You can use the Download listener,
            mWebView.setDownloadListener(new DownloadListener() {
        @Override
        public void onDownloadStart(String url, String userAgent, String contentDescription,
                                    String mimetype, long contentLength) {//code here}


text:
Q: Enum implementing interface, interface and method visibility I just came accross the following code, which surprised me a little bit, I converted it to a simple SSCEE here though:
custompackage.package1.MyEnum.java
public enum MyEnum implements MyInterface {
    CONSTANT_ONE() {
        @Override
        public void myMethod() {
            //do something very interesting
        }
    },
    CONSTANT_TWO() {
        @Override
        public void myMethod() {
            //do something very interesting
        }
    };
}

interface MyInterface {
    void myMethod();
}

Now from outside this package, I can do the following:
Consumer<MyEnum> myMethod = MyEnum::myMethod;

However I am not able to use MyInterface at all, which I understand as it is package-private to custompackage.package1.
I don't understand what exactly is going on though, it seems like MyEnum got the myMethod() method added, but it does not implement (from the outside) MyInterface.
How does this work?

A: Well you can't see MyInterface from outside the package, as you said - but MyEnum effectively has a public abstract myMethod() method, which you're able to use as a method reference.
Leaving aside fancy new Java 8 features, this is valid (even outside the package):
// Even MyEnum x = null; will compile, but obviously fail
MyEnum x = MyEnum.CONSTANT_ONE;
x.myMethod();

The method is inherited from the interface, even though the interface itself is not visible.
This isn't specific to interfaces and enums, either. For example:
// Foo.java
package foo;

class SuperFoo {
   public void publicMethod() {
   }
}

public class Foo extends SuperFoo {
}

// Bar.java
package bar;

import foo.Foo;

public class Bar {
    public void test() {
        Foo foo = new Foo();
        foo.publicMethod();
    }
}

This compiles fine, even though Foo doesn't even override publicMethod. As far as Bar is concerned, it's inherited from somewhere, but it doesn't know where!

A: In interfaces methods are public abstract by default. fields are public static final
the reason you can use the method is that the interface is package local.  Try making it public.

A:
However I am not able to use MyInterface at all, which I understand as it is package-private to custompackage.package1.

The interface is package-private, but all methods (and fields) are (implicitly or explicit) public.

it seems like MyEnum got the myMethod() method added, but it does not implement (from the outside) MyInterface.

MyEnum has a public method called myMethod(), regardless of whether it inherited the (public) abstract method from the interface or whether it declared the method itself.  Said another way, even if the outside cannot see the interface, the outside can certainly see MyEnum and see MyEnum.myMethod().


text:
Q: Magento 1.X Connect extension upload : "Version not found" I am in Magento Connect, and I am trying to upload a new version for my Magento 1.X extension. After filling the fields and providing the archive, I get the error "An error occurred during upload to channel MagentoConnect: Version not found.".
FYI I put "1.1.0" in the version field, my file is named "myappname-1.1.0.tgz"...
Any idea?
Thanks a lot

A: Check the 'Stability' value in you package.xml and what you select during the upload in Magento connect. Both should be same. You may be selecting 'Version Stability' as Stable while in your package it may be something else which would be causing the issue.

A: You should also make sure that the Magneto Extension Name* is same as the  Extension Key in magento commerce while creating the package.
Your zip should have the name as your extension key, ignore the version number appended to the zip.
For example :
Extension Key in magento commerce : TestingMagento
So while packaging enter name as : TestingMagento
Version Number : 1.0.0.0
This will create your package extension as TestingMagento-1.0.0.0.tgz,  which you want to upload.


text:
Q: How to fetch Open Weather Map Api My Open Weather Map API working fine on Postman but I'm getting errors while fetching it on the browser.
Postman ss
//fetching weather api
    async getWeather() {
        console.log("efsfs");
        const response = await fetch('api.openweathermap.org/data/2.5/weather?q=London&appid=3f071776be6f7ccd417bfb1da2910---');
        const responseData = await response.json();

        return responseData;
    }

//Using it
weather.getWeather()
    .then(results => {
        console.log(results)
    })
    .catch(err => console.error(err));

//Error
weather.js:11 GET http://127.0.0.1:5500/api.openweathermap.org/data/2.5/weather?q=London&appid=3f071776be6f7ccd417bfb1da2910859 404 (Not Found)


text:
Q: What is the best field definition to store a .NET decimal into MySQL? I need to store decimals into MySQL, which can have a varying precision. Therefore I would be interested to know which MySQL field type is absolutely equivalent to .NET's decimal structure, if any.
I plan to use Dapper as a lightweight ORM.

A: The .net decimal can be different datatypes under the hood.
.net formats                                  MySQL
----------------------------------------------------
Decimal(Double)                              Float
Decimal(Int32)                               DECIMAL
Decimal(Int32())                             DECIMAL
Decimal(Int64)                               DECIMAL
Decimal(Single)                              DECIMAL
Decimal(UInt32)                              DECIMAL
Decimal(UInt64)                              DECIMAL
Decimal(Int32, Int32, Int32, Boolean, Byte)  DECIMAL
//This is really a UINT96.

Warning
Note that according to Jon Skeet, decimal can be declared in lots of ways, but will always be a FLOAT under the hood, with all the rounding errors that brings, you have been warned.
See: SQL decimal equivalent in .NET
MySQL's DECIMAL takes up more space if you assign it a larger precision.
From the manual: http://dev.mysql.com/doc/refman/5.5/en/precision-math-decimal-changes.html

Values for DECIMAL columns in MySQL 5.5 are stored using a binary format that packs nine decimal digits into 4 bytes.

The largest number of digits is 65, divided by 9 = 8 bytes, an INT128.


text:
Q: pass the variable as class name in jquery I have the class name 'views-row5' in a variable 'classN'.I want to pass this to the jquery for find the class name 'views-row5' using variable 'classN' and add the class 'hello'.

jQuery(document).ready(function($) {
var classN="views-row5"
$('.carousel-inner li').each(function()
  {$(this).find(classN).addClass('hello');});
 });

1

2

1

2

A:

jQuery(document).ready(function($) {
  var classN = "views-row5"
  $('.carousel-inner li').each(function() {
    $(this).find("."+classN).addClass('hello');
  });
});
.hello {
  color: red
}

1

2

1

2

*

*Add . to find the class you are looking for

A: you are forget the . represent the class in selector

jQuery(document).ready(function($) {
var classN="views-row5"
$('.carousel-inner li').each(function()
  {$(this).find('.'+classN).addClass('hello');});
 });
.hello{
color:green;
font-size:20px;
}

1

2

1

2

A: In the variable assignment, you have to add the dot for the class. like var classN=".views-row5"

jQuery(document).ready(function($) {
var classN=".views-row5"
$('.carousel-inner li').each(function()
  {$(this).find(classN).addClass('hello');});
 });
.hello {
color: red;
}

1

2

1

2

A: Try this code:
jQuery(document).ready(function($) {
   var classN="views-row5"
   $('.' + classN).addClass('hello');
});


text: Q: VLC Media Player stops streaming I am trying to set up a security camera with a raspberry pi zero and raspberry pi camera, and I have gotten it to stream to VLC Media Player on my windows 10 laptop, but after about 1 minute of streaming, the stream will suddenly stop.  On a monitor directly connected to the raspberry pi, the video footage continues.  Does anyone know how to keep the VLC stream going?  Thank you!


text:
Q: use javascript inside php for example i want to send email use php and my message obtained from the compound php and JavaScript data...
<?php
    $str= "Data: " . date("Y-m-d H:i:s") . "\n\n";

    $str=$str . "system: " . $_SERVER['HTTP_USER_AGENT'] . "\n\n";
?>
<script>
    var txt = navigator.cookieEnabled
</script>
<?php
    //$str=$str . txt
    $str=$str . "cookie: " . $str2;

    mail($_GET["email"],"New IP",$str);
?>

how i can combine the txt JavaScript variable with str PHP variable???

A: 2 options:

*

*send a request via ajax to your PHP script

*set a cookie in JavaScript and read it in your PHP script

A: Since Javascript is executed on the client side and PHP is executed on the server site, there is no direct way to use the Javascript variable in PHP. In order to get the value of the Javascript variable, you would have to use some form of AJAX method to send the value of the Javascript variable to server so that the PHP can utilize it.

A: You can use Java Script tag as string in php,
<script>
    var txt = navigator.cookieEnabled
</script>
<?php
    $str=$str . '<script>document.write(txt);</script>'
    $str=$str . "cookie: " . $str2;

    mail($_GET["email"],"New IP",$str);
?>


text:
Q: Redis active-active replication I am using redis version 2.8.3. I want to build a redis cluster. But in this cluster there should be multiple master. This means I need multiple nodes that has write access and applying ability to all other nodes.
I could build a cluster with a master and multiple slaves. I just configured slaves redis.conf files and added that ;
slaveof myMasterIp myMasterPort

Thats all. Than I try to write something into db via master. It is replicated to all slaves and I really like it.
But when I try to write via a slave, it told me that slaves have no right to write. After that I just set read-only status of slave in redis.conf file to false. Hence, I could write something into db.
But I realize that, it is not replicated to my master replication so it is not replicated to all other slave neigther.
This means I could'not build an active-active cluster.
I tried to find something whether redis has active-active cluster capability. But I could not find exact answer about it.
Is it available to build active-active cluster with redis?
If it is, How can I do it ?
Thank you!

A: Redis v2.8.3 does not support multi-master setups. The real question, however, is why do you want to set one up? Put differently, what challenge/problem are you trying to solve?
It looks like the challenge you're trying to solve is how to reduce the network load (more on that below) by eliminating over-the-net reads. Since Redis isn't multi-master (yet), the only way to do it is by setting up each app server with a master and a slave (to the other master) - i.e. grand total of 4 Redis instances (and twice the RAM).
The simple scenario is when each app updates only a mutually-exclusive subset of the database's keys. In that scenario this kind of setup may actually be beneficial (at least in the short term). If, however, both apps can touch all keys or if even just one key is "shared" for writes between the apps, then you'll need to bake locking/conflict resolution/etc... logic into your apps to consolidate local master and slave differences (and that may be a bit of an overkill). In either case, however, you'll end up with too many (i.e. more than 1) Redises, which means more admin effort at the very least.
Also note that by colocating app and database on the same server you're setting yourself for near-certain scalability failure. What will happen when you need more compute resources for your apps or Redis? How will you add yet another app server to the mix?
Which brings me back to the actual problem you are trying to solve - network load. Why exactly is that an issue? Are your apps so throughput-heavy or is the network so thin that you are willing to go to such lengths? Or maybe latency is the issue that you want to resolve? Be the case as it may be, I recommended that you consider a time-proven design instead, namely separating Redis from the apps and putting it on its own resources. True, network will hit you in the face and you'll have to work around/with it (which is what everybody else does). On the other hand, you'll have more flexibility and control over your much simpler setup and that, in my book, is a huge gain.

A: Redis Enterprise has had this feature for quite a while, but if you are looking for an open source solution KeyDB is a fork with Active Active support (called Active Replica).
Setting it up is just a little more work than standard replication:

*

*Both servers must have "active-replica yes" in their respective configuration files

*On server B execute the command "replicaof [A address] [A port]"
Server B will drop its database and load server A's dataset

*On server A execute the command "replicaof [B address] [B port]"
Server A will drop its database and load server B's dataset (including the data it just transferred in the prior step)

*Both servers will now propagate writes to each other.  You can test this by writing to a key on Server A and ensuring it is visible on B and vice versa.

https://github.com/JohnSully/KeyDB/wiki/KeyDB-(Redis-Fork):-Active-Replica-Support


text:
Q: Terraform Cognito User Pool as an identity provider in the app client I am using terraform to create AWS Cognito User Pool.
As supported_identity_providers for the user pool client, I am able to add OIDC identity provider. But I also need to add Cognito User Pool as an additional identity provider.
How do i add both of them?
resource "aws_cognito_user_pool_client" "client" {
  name = "client"
  generate_secret     = true
  user_pool_id = aws_cognito_user_pool.pool.id
  supported_identity_providers = ["MySSO"] //how do I add Cognito User Pool as an identity provider here on top of "MySSO"??
  allowed_oauth_flows_user_pool_client = true
  allowed_oauth_flows = ["code"]
  allowed_oauth_scopes = ["email", "openid", "profile"]
  callback_urls = ["https://my_callback_url.com"]
  logout_urls = ["https://my_callback_url.com"]
}

A: The API reference says that you can use COGNITO in all uppercase, which worked for me:
supported_identity_providers = ["MySSO", "COGNITO"]


text: Q: GLMM estimation of unconditioned means I'm trying to get estimates of overall means, not conditioned on a factor, from my data in a multilevel model with negative binomial or Poisson distribution. In other words, taking into account my random variables, what is the best estimate of the average of my response variable overall, without factors. As I understand it, I can just use ~1 as my factor, but this does not perfectly match my pooled averages from estimated marginal means using Emmeans. I'm just looking for a sanity check.


text:
Q: json_encode and question marks I'm trying to get some data from MySQL database in utf-8, but i can't resolve a problem with encoding. I've googled about this problem and tried to fix it in different ways, but i still can't get normal text wit cyrillic symbols.
So here my code
<?php

$host="localhost";
$database="******";
$username="******";
$password="******";

$sql= "select dle_post.id,dle_post.title,dle_post.short_story,dle_post.full_story,dle_post.xfields,dle_post.category from dle_post order by dle_post.id limit 500, 550;";

$con =mysqli_connect($host,$username,$password,$database);

$result= mysqli_query($con,$sql);

$response= array();

while($row=mysqli_fetch_array($result))
{

    array_push($response,array("id"=>$row[0],"title"=>$row[1],"short_story"=>$row[2],"full_story"=>$row[3],"xfields"=>$row[4],"category"=>$row[5]));

}

$json = json_encode(array("server_response"=>$response), JSON_UNESCAPED_UNICODE);

echo $json;
mysqli_close($con);

?>

I've tried:

*

*JSON_UNESCAPED_UNICODE

*header('Content-type: text/html; charset=UTF-8') ;

*AddDefaultCharset utf8 in htaccess

and some other approaches from google and stackoverflow, BUT i always get this question marks. Example of output:
{
        "id": "10235",
        "title": "??????? ???????",
        "short_story": "???? ?????? ?? ????????. ??? ????, ??????????, ?????, ???????? ??????? ? ???????. ?? ?????????? ? ?????????? ???????? ????? ??????? ???????, ??? ????????? ?????????? ?? ???? ??????. ? ???? ???? ??????????, ?????? ??????? ? ???????? ???????? ????????? ??????????.",
        "full_story": "
????????: ??????? ???????
???: 2013
??????: ??????
????????: ??????? ???????
????: ?????????

? ?????: ????? ??????, ??????? ??????????, ???????? ????????, ????????? ??????

???????? (??): 19 ???????? 2015

???????? ???????????????? ????????? (??): 19 ??? 2015, ??

???????: ????????, ????????? 12 ???

????????: ???? ?????? ?? ????????. ??? ????, ??????????, ?????, ???????? ??????? ? ???????. ?? ?????????? ? ?????????? ???????? ????? ??????? ???????, ??? ????????? ?????????? ?? ???? ??????. ? ???? ???? ??????????, ?????? ??????? ? ???????? ???????? ????????? ??????????.",
        "category": "32"
    },

In similar cases people at least get something like \u0418\u0432\u0430\u043d\u043e\u0432
I don't know php, just learning Java, so this situation is quite confusing.


text:
Q: Calling a Spring controller from itself based on the response We have a requirement where...when we get a request to our controller we make a call to another api and based on the other api response we have to retrigger the request to controller with different parameter
@RequestMapping(value = "/search", method = RequestMethod.GET, produces = "application/json")
public Map<String, Account> searchEndpoint(@RequestParam(name = "query", required = true) String query) {

        RequestPayload req = new RequestPayload(query);
        SearchResponse searchResponse = http.executeSecurePost(this.searchUrl, req, SearchResponse.class);

        if(("particularModel").equalsIgnoreCase(searchResponse.getModel()))
        {
              String  differentQueryParameter = searchResponse.getName();
              searchEndpoint(differentQueryParameter);
        }
        else {
             //do something else
        }
        return json response;

}

when i do like this ...it's working fine where it's making the second call and getting the new response and returns ...but again a third query where this time is the original query get's fired. Not sure why the third query is fired. Any help will be appreciated.

A: calling your handler again and again it may result in a recursive function. you  could avoid this kind of programming .you put the logic for calling the api  in service method and do it .
@RequestMapping(value = "/search", method = RequestMethod.GET, produces = "application/json")public Map<String, Account> searchEndpoint(@RequestParam(name = "query", required = true) String query) {
  //put this logic in service
  RequestPayload req = new RequestPayload(query);
  SearchResponse searchResponse = http.executeSecurePost(this.searchUrl, req, SearchResponse.class);

    if(("particularModel").equalsIgnoreCase(searchResponse.getModel()))
    {
          String  differentQueryParameter = searchResponse.getName();
          //put this logic in service and just call it
          RequestPayload req = new RequestPayload(query);
          SearchResponse searchResponse = http.executeSecurePost(this.searchUrl, req, SearchResponse.class)
    }
    else {
         //do something else
    }
    return json response;

}


text:
Q: CSS and JS clashing for Layout View and Rendered View in ASP.NET MVC-4 ASP.NET MVC-4 (RAZOR) App Model
I am creating a web application in ASP.NET using MVC-4 Architecture. I have planned to deploy various modules within my app. I have fixed a LAYOUT in SHARED folder containing Bootstrap,CSS,JQuery,JS. The structure of my app is as follows:
` //Header Begins
Rendering Bootsrap, JQuery, styles & scripts for the main Layout of MyApp (UI), defined in Bundles File.
 // Header Ends
 // Body Begins
render view(); // The view being rendered has different Styles, Scripts but have common functions name. As a result of which the CSS and JS is clashing.
 // Body Ends
 // Footer Begins
` // Footer Ends
I want my DASHBOARD MODULE VIEW to be rendered within the body of my layout. After implementing it, the Styles, Scripts are clashing, the page being unresponsive. Someone even told me to use important! attribute, and another told me to rename the classes for Dashboard. Its a cumbersome process, I want to get rid of such tedious condition. Please Help!!


text:
Q: cclocation concerns and clarifying on the subject Is collocation usually mean the location of the device? I am a little hazy on this subject.Or does mean general location.

A: I assume you mean CLLocation?. This is a class which represents location data generated from a CLLocationManager object.
Please refer to the Location Awareness Programming Guide, in particular the section on getting the user's location.


text:
Q: Sqlite database on Mac How can i download and install sqlite database on Mac? Also does Mac OS X come with sqlite database preinstalled? If yes then how can i find it?

A: The easiest way to install a development copy (incl. headers) is something like Fink's sqlite-dev package.  However, you're correct that Mac OS comes with SQLite, in fact multiple copies.  One is part of Apple's Core Data framework.

A: Just get binaries from here http://www.sqlite.org/download.html
Or use macports or fink commander to install sqlite package.


text:
Q: Cumulative distinct count of multiple fields in the same table I have a property database and I am currently designing a query for additional characteristics of the properties. In this case the two tables in question are those:
This is the first Characteristics table which is basically where I store the meta for each characteristic.

This is the CharacteristicsPerProperty database where I store the relation and final value of the specific characteristic.

So basically what I want to do is count all the unique id_propiedad (property_id) so that I can show how many I have available with that specific characteristic. The query is the following
SELECT
    COUNT(DISTINCT(CaracteristicasPorPropiedad.id_propiedad)) AS disponibles
FROM
    CaracteristicasPorPropiedad
WHERE
    CaracteristicasPorPropiedad.id_caracteristica = 1
    AND
    CaracteristicasPorPropiedad.valor = 3

So basically the output is something like:
| disponibles |
|=============|
| 264         |

Everything works as expected up to here, but I can also include another parameter, let's say in the previous example I included Recámaras (Bedrooms), but I also want to include Baños (Bathrooms). I tried
SELECT
    COUNT(DISTINCT(CaracteristicasPorPropiedad.id_propiedad))
FROM
    CaracteristicasPorPropiedad
WHERE
    (CaracteristicasPorPropiedad.id_caracteristica = 1 AND CaracteristicasPorPropiedad.valor = 3)
    AND
    (CaracteristicasPorPropiedad.id_caracteristica = 2 AND CaracteristicasPorPropiedad.valor = 2.5)

The thing is that this query returns 0.
If I switch the AND to an OR it returns 282 results. I basically need the combination of both. I am a little stuck with this. What could be a query to mix multiple levels of this? It can be used with all 10 available dimensions for this characteristic.

A: You can get the id_propiedad using aggregation:
SELECT cpd.id_propiedad
FROM CaracteristicasPorPropiedad cpd
WHERE (cpd.id_caracteristica = 1 AND cpd.valor = 3) OR
      (cpd.id_caracteristica = 2 AND cpd.valor = 2.5)
GROUP BY cpd.id_propiedad
HAVING COUNT(DISTINCT cpd.id_caracteristica) = 2;

If you want the count, use a subquery:
SELECT COUNT(*)
FROM (SELECT cpd.id_propiedad
      FROM CaracteristicasPorPropiedad cpd
      WHERE (cpd.id_caracteristica = 1 AND cpd.valor = 3) OR
            (cpd.id_caracteristica = 2 AND cpd.valor = 2.5)
      GROUP BY cpd.id_propiedad
      HAVING COUNT(DISTINCT cpd.id_caracteristica) = 2
     ) p;


text:
Q: Log error in php I have some code that looks like this:
$log->error( 'addToWatch=['.$addToWatchPage.'] success=['.$success.']' );
if( ( $success == 1 ) and ( $addToWatchPage == true ) ) {
   $log->error( 'adding to watch page' );
} else {
   $log->error( 'NOT added to watch page' );
}

When I run it, I am always going into the if statement and never into the else statement even if $addToWatchPage is false. See my log output below:
Sat Jan 26, 2013 @ 6:02 addToWatch=[false] success=[1]
Sat Jan 26, 2013 @ 6:02 adding to watch page.

Can anyone explain why this is broken?

A: Probably $addToWatchPage is a string containing false, otherwise your resultant first log message would be:
Sat Jan 26, 2013 @ 6:02 addToWatch=[] success=[1]

This would result in $addToWatchPage == true being evaluated as true, since 'false' == true is a truthy expression (actually, any non-empty string other than '0' is true when casted to boolean).
Make sure $addToWatchPage is a boolean value instead of a string.
$addToWatchPage = false; // correct
$addToWatchPage = 'false'; // wrong

A: You would need to supply an identical operator '===' for the $addToWatchPage statement. Your current code with '==' is basically asking if $assToWatchPage contains anything. I would also remove the extra brackets but I'm not 100% sure if that makes a difference? I would also use && instead of and although someone might want to explain about operator Precedence.
Here:
    $log->error( 'addToWatch=['.$addToWatchPage.'] success=['.$success.']' );
if( $success == 1  &&  $addToWatchPage === true ) {
   $log->error( 'adding to watch page' );
} else {
   $log->error( 'NOT added to watch page' );
}

See This blog post on Triple Equals

A: My guess is it's a string problem:
if('false' == true)echo 'wtf';

Try casting:
$log->error("addToWatch=[$addToWatchPage] success=[$success]");
if((int)$success === 1 && (string)$addToWatchPage === 'true') {
  $log->error('adding to watch page');
}
else{
  $log->error('NOT added to watch page');
}

A: You should use === instead of == width the $addToWatch


text:
Q: How to skip alphabet strings and accept float/integer I have a set of string. I want to skip those which have all characters and consider only string which have characters in [0-9] or "." i.e. float.
How can I do this. I tried using if str[/[a-zA-Z]+/]  == str. But this gives me error in case of integers/float
if str[/[a-zA-Z]+/]  == str
    continue
else
    //do something

This gives error: can't convert Regexp into Integer
Thanks

A: Considering OP is looking for non numeric string to continue:-- and str is a String class object, for e.g. str = "abcd" or str = "1.95" etc.
regExp = /^[0-9]\d*(\.\d+)?$/

unless str[regExp].eql?(str)
    # continue
else
    # do something
end

A: if (str =~ /[a-zA-Z]+/).nil? #if there are no letters in str
  #continue with string
else
  #Regex test failed
end


text:
Q: Access-Control-Allow-Origin issues even on setting it up My nodejs/express includes:
app.use(function handleAppError(err, req, res, next) {
    const msg = 'ERROR: App error: ' + util.inspect(err);
     // Website you wish to allow to connect
    res.setHeader('Access-Control-Allow-Origin', '*');

    console.log(msg);
    if (res.headersSent) {
        next(err);
    } else {
        res.status(500).send(msg);
    }
});

…but on making a call, I still end up with an error in Chrome:

XMLHttpRequest cannot load http://:8080/management-api/v1/bots.
  Response to preflight request doesn't pass access control check: No
  'Access-Control-Allow-Origin' header is present on the requested
  resource. Origin 'http://localhost:8100' is therefore not allowed
  access.

A: You need to handle the OPTIONS method.
Try this
app.all("/*", function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
    res.header("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE");
    if (req.method === "OPTIONS")
        res.send(200);
    else
        next();
});


text:
Q: Laravel - nested relationships through Many to Many I have a setup with parents and their children. A child can have multiple parents and each child can be assigned multiple messages by the system. Each parent can also have multiple children.
I already have an instance of the user: $parent. Now I would like to receive all the posts that belong to this parent's children. Laravel's "has many through" does not work with many-to-many relationships.
At the moment I solved it with a custom method, but I'm looking for cleaner ways of resolving this issue.
This is my setup:
User (parents):
class User extends Eloquent
{
    public function children()
    {
        return $this->belongsToMany('Child', 'parents_children', 'user_id');
    }
}

Child:
class Child extends Eloquent
{
    public function parents()
    {
        return $this->belongsToMany('User', 'parents_children', 'child_id');
    }

    public function posts()
    {
        return $this->hasMany('Posts', 'ChildPost');
    }
}

Posts
class ChildPost extends Eloquent
{
    public function child()
    {
        return $this->belongsToMany('Child');
    }
}

A: There is no native relationship for this case.
I created a HasManyThrough relationship with support for BelongsToMany: Repository on GitHub
After the installation, you can use it like this:
class User extends Model {
    use \Staudenmeir\EloquentHasManyDeep\HasRelationships;

    public function childPosts() {
        return $this->hasManyDeep(ChildPost::class, ['parents_children', Child::class]);
    }
}


text:
Q: Projectile motion rearrangement So given basic knowledge about projectiles, the equation for a projectile's initial horizontal speed $V_x$ can be expressed as $V\cos\theta$, $V$ being the initial velocity. Then the horizontal distance can be written as $\delta x=V\cos\theta t$, then rearranged to be $t=\delta x/V\cos\theta$.
then subbing the equation for $t$ into the formula for vertical distance gives $y=V\sin\theta t-1/2gt^2$ which is an expression for vertical distance in terms of the horizontal distance, initial velocity and theta.
How can I rearrange this so that $V$ becomes the subject in terms of $\theta$, horizontal distance and vertical distance?

A: To relate velocity and $\theta $ to distance, there is a slightly better way to approach it.
First start with your y equation $$y = Vt \sin {\theta} - \frac {1}{2} g t^2$$  and realize that you can solve for total time if you set $y=0$ using the quadratic equation.  You will get 2 values.  One of them will be 0 or a negative value (if you started at $y >0$).  The 0 or negative value represents when you start on the ground.
You can then use that $t$ to solve for total horizontal distance.  You also know that the highest point will be right in between the two times when $y=0$ (for example if your two t values are $t=0$ and $t=6$ then $t_{ymax} = 3$).
You can substitute $t_{ymax} $ into the y equation to find the max height.

A: Substituting $t=\frac{\delta{x}}{V\cos\theta}$ into $y=V\sin\theta t-\frac12gt^2$, we get
$$y=V\sin\theta\frac{\delta{x}}{V\cos\theta}-\frac12g\frac{\delta{x}^2}{V^2\cos^2\theta}$$
$$y=\delta{x}\;\tan\theta-\frac12g\frac{\delta{x}^2}{V^2\cos^2\theta}$$
$$\frac12g\frac{\delta{x}^2}{V^2\cos^2\theta}=\delta{x}\;\tan\theta-y$$
$$\frac12g\frac{\delta{x}^2}{(\delta{x}\;\tan\theta-y)\cos^2\theta}=V^2$$
$$V=\sqrt{\frac12g\frac{\delta{x}^2}{(\delta{x}\;\tan\theta-y)\cos^2\theta}}$$

A: $$\begin{pmatrix} x \\ y \end{pmatrix} =
  \begin{pmatrix}
    ut\cos \theta \\
    ut\sin \theta-\dfrac{gt^2}{2}\
  \end{pmatrix}$$
Substitute $t=\dfrac{x}{u\cos \theta}$ into $y$,
\begin{align*}
  y &= x\tan \theta-\frac{gx^2}{2u^2\cos^2 \theta} \\
  u^2 &= \frac{gx^2}{2\cos^2 \theta(x\tan \theta-y)} \\
  u &= x\sqrt{\frac{g}{x\sin 2\theta-2y\cos^2 \theta}}
\end{align*}


text:
Q: Using jQuery and Ajax to Change an Element's Style for All Users I'd like to have a button that changes the display property of a certain element for all users of a site, not just the person who clicked the button. The button is used to show that a user is online by changing an element's display from "none" to "inline" and should be visible to all. So far I have an html file with the button that changes the display property with jQuery:

John

<button type="button" onclick="goOnline(john);"/>Go Online</button>

I've looked around and using jQuery's Ajax functionality seems to be a good solution but I'm not sure how to implement it properly. I'd really appreciate any help.
Thanks.

A: You need to make some changes on the server for that. And I'm not sure what would be the best approach for making all other clients update immediately. That could involve, for instance, polling
If you are planing on having similar functionality with other things too (i.e. other things one user can change for everyone), I would recommend you to use a database to store those values and check them on each render of a site. With this, the changes will not become immediately available to all users, but when there is a page refresh (or an ajax call), changes will be reflected.


text:
Q: CKEditor 3.6.1: Load editor on event I create a page with multiple tabs.
On one of my tabs I want to use CKeditor on a textarea, so when I display my table I call:
editor = CKEDITOR.replace('MyTextArea', MyOptions );

I have the UI of the editor but when I click on the text area nothing append, I can't edit it. The solution for access to the text area is to use "tab" for accessing this field.
I try to put a default value and I can edit if I click on the text but if I click elsewhere in the area I cannot edit.
I have this problem for IE10 and I need it works on it. It's working on Chrome and Firefox. I use CKEditor 3.6.1 and I cannot upgrade it.
Thanks

A: The problem was the z-index of the container of my textarea, I change it and it works.


text:
Q: Recurring Payments in Magento for Authorize.net Is anyone worked in Magento with Authorize.net for recurring payments. As default "Recurring Profile" is Magento's great feature to Recurring Payments/orders for products but  which has some limitation and designed for nominal items work with  PayPal' Recurring Payment Platform.
I know following things while research for PayPal :
1. Paypal Recurring payments it will create first Recurring profile at PayPal
2. Then it will return reference id to site
3. after that if we want change something then we need to make API call to PayPal like getRecurringProfileDetail etc.
I would like to implement Authorize.net Recurring Profiles feature for Magento Products.
I have confused from where to start or how to implement. I have following questions in mind:

*

*How the transactions are happens first time and consecutive transaction automatically ? Is it happen at Magento or at Authorize. net ?

2.How to create order automatically at Magento if transaction successful at authorize.net

*How can I reuse default "Recurring Profile" core code in my module ? Is it possible. ?

*Which API I have to use either  SOAP or RESTful ?
Please share your thoughts how to start with this and what are the points I need to keep in mind while working with Recurring Payments with Payment Gateway.
Thank you.