text:
Q: 4.0/WCF: Best approach for bi-idirectional message bus? Just a technology update, now that .NET 4.0 is out.
I write an application that communicates to the server through what is basically a message bus (instead of method calls). This is based on the internal architecture of the application (which is multi threaded, passing the messages around).
There are a limited number of messages to go from the client to the server, quite a lot more from the server to the client. Most of those can be handled via a separate specialized mechanism, but at the end we talk of possibly 10-100 small messages per second going from the server to the client.
The client is supposed to operate under "internet conditions". THis means possibly home end users behind standard NAT devices (i.e. typical DSL routers) - a firewalled secure and thus "open" network can not be assumed.
I want to have as little latency and as little overhad for the communication as possible.
What is the technologally best way to handle the message bus callback? I Have no problem regularly calling to the server for message delivery if something needs to be sent...
...but what are my options to handle the messagtes from the server to the client?

*

*WsDualHttp does work how? Especially under a NAT scenario?

Just as a note: polling is most likely out - the main problem here is that I would have a significant overhead OR a significant delay, both aren ot really wanted. Technically I would love some sort of streaming appraoch, where the server can write messags to a stream while he generates them and they get sent to the client as they come. Not esure this is doable with WCF, though (if not, I may acutally decide to handle the whole message part outside of WCF and just do control / login / setup /  destruction via WCF).

A: For bidirectional communications, your best bet is NetTcpBinding, rather than the http bindings, if they're available.
This has the advantage of only requiring that the client can initiate a connection with the server.

A: I would go with Windows Azure Service Bus. See my answer in the following question:
WCF, 4.0, Bidirectional

A: Take a look at Windows AppFabric, good place to start is Here. It fundamentally wraps up WCF and WF into an application server, with WCF activation supported through WAS. Its where I would host this type of app. It offerd full duplex connection orientated, p2p or sessions between client and server.  Don't confuse the Windows appfabric with Azure appfabric, (formely called Azure Service Bus).
As regards bindings above, both NetTcpBinding and WsDualHttp offer callbacks, but the ws binding you get a lot for your cash, especially if it's a mixed programming environment and you have to flatten the wsdl to make interop work. I also think that WsDual is easier on routers traversal, although I understand talking to friends, that Windows AppFabric mitigates this, with new Relay Services, (which i've not seen, and I think have now been renamed).
Hope that helps.


text:
Q: Snowflake: Fail COPY INTO incase of error limit while loading? Is it possible to set the error limit while loading the data into a snowflake table. I am using COPY INTO option. I know there are options like RETURN_FAILED_ONLY and VALIDATION_MODE, but this does not support if the error limit is reached then fail COPY INTO else continue loading it by ignoring the failed records.

A: I believe what you are looking for is the SKIP_FILE_num or SKIP_FILE_num%. This will skip the file when a certain number of records or certain % of records fail.  When a file is skipped it will be listed with a status of FAILED.
https://docs.snowflake.com/en/sql-reference/sql/copy-into-table.html
Snowflake does not currently have the equivalent that you are looking for across all files of a load. Depending on how you are scripting/executing your COPY INTO commands, however, you could wrap the COPY INTO command with a transaction, check the output of the COPY INTO, determine whether it is inside or outside of your threshold and then either commit or rollback the transaction. This would accomplish what you are looking for, but takes a bit of custom coding to accomplish.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Android app doesn't work on Android 4 I created an Android project on 2.3.3 and tried it on mobile 2.3.3, everything works OK. It didn't work on mobile 4, so I re-built for Android 4, but I have the same problem.
This is the code:
public void FTP_Download(){
  String server = "192.168.1.135";
  int port = 21;
  String user = "pc1";
  String pass = "1551";
  FTPClient ftpClient = new FTPClient();
  try {
    ftpClient.connect(server, port);
    ftpClient.login(user, pass);
    ftpClient.enterLocalPassiveMode();
    ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
    Toast.makeText(getBaseContext(), "download starting.",Toast.LENGTH_LONG).show();
    // APPROACH #1: using retrieveFile(String, OutputStream)
    String remoteFile1 = "i.xml";
    File downloadFile1 = new File("sdcard/i.xml");
    OutputStream outputStream1 = new BufferedOutputStream(new FileOutputStream(downloadFile1));
    boolean success = ftpClient.retrieveFile(remoteFile1, outputStream1);
    outputStream1.close();
    if (success) {
      Toast.makeText(getBaseContext(), "File #1 has been downloaded successfully.",Toast.LENGTH_LONG).show();
    }
  } catch (IOException ex) {
    System.out.println("Error: " + ex.getMessage());
    ex.printStackTrace();
  } finally {
    try {
      if (ftpClient.isConnected()) {
        ftpClient.logout();
        ftpClient.disconnect();
      }
    } catch (IOException ex) {
      ex.printStackTrace();
    }
  }
}

Note:
I use commons-net-3.1 to connect.

A: In android version 2.3 above you can not start internet connection from main UI thread. Instead you should use AsyncTask. I assumed you are not using AsyncTask. If you are, then post the code and log cat also. Some examples of other operations that ICS and HoneyComb won't allow you to perform on the UI thread are:( from link posted in comment below ) -

*

*Opening a Socket connection (i.e. new Socket()).

*HTTP requests (i.e. HTTPClient and HTTPUrlConnection).

*Attempting to connect to a remote MySQL database.

*Downloading a file (i.e. Downloader.downloadFile()).

A: You should not use the main UI Thread to start a network connection or read/write data from it as @phazorRise explained it. But I strongly disagree with using an AsyncTask to perform your download. AsyncTask have been designed for short living operations and downloading a file doesn't belong to that category.
The most relevant way to achieve your goal, if your files are big (and I assume it depends on users, so we can say they are big) is to use a service to download the files.
I invite you to have a look at RoboSpice, it will give your app robustness for networking and it's really the most interesting library for network requests on Android.
Here is an inforgraphics to get familiarized with alternatives and understand why using a service is better than any other technology.

A: When I use "internet conections" programming for andoid 4, I do an Async Task as follows:
You can put this Class code into the same file as principal file to intercatue with global variables or functions.
public class MyAsyncTask extends AsyncTask<String, Void, String> {

  @Override
  protected String doInBackground(String... urls) {
    String url = urls[0]
    try {
      //Connection request code, in your case ftp
    } catch (Exception e) {
      //Catch code
    }
  }

  @Override
  protected void onPostExecute(String result) {
    //Code to de After the connection is done
  }
}

Then, in the Activity I call the Asyn Task
String url = "http://...";
new MyAsyncTask().execute(url);

Edit
Here it's explained how to use Async Task, with an example
http://developer.android.com/reference/android/os/AsyncTask.html

A: I added this code, and all thing OK
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();

StrictMode.setThreadPolicy(policy);

Note: I taked the code from @user1169115 comment in another post.
This isn't the best soluation, but I don't know why asynctask isn't work, so I don't have another choice.


text:
Q: Write function from encoding/csv pkg stops writting in csv file I'm trying to extract the names of .txt files in a folder.
But I encounter an issue where the write function from encoding/csv stop writing in the csv file I initialize.
The code is as follow.
import (
        "encoding/csv"
        "io/ioutil"
        "log"
        "os"
        "strings"
)

func Extract() error {

    //read folder
    AllFiles, err := ioutil.ReadDir("./folder")
    if err != nil {
        return err
    }

    //create csv file
    SupportCsv, err := os.Create("csvfile.csv")
    if err != nil {
        return err
    }

    WriterSupport := csv.NewWriter(SupportCsv)

    for _, file := range AllFiles {

        res := []string{"test", file.Name()}

        log.Println(res)

        //write in csv file
        err = WriterSupport.Write(res)
        if err != nil {
            return err
        }
    }
return nil
}

I have ~300 .txt file in my folder.
The log.Println prints everything so the issue must be with the Write function.
In return the csv file as less file name and the last name is not written entirely.
Moreover, when i change the number of letter on "test" string in res, the csv file as in return more or less file name in it.
Write returns no error.

A: Looks like you have missed WriterSupport.Flush() after the write. All you need to do is to defer the Flush() to make sure that it is executed. Better after creating WriterSupport := csv.NewWriter(SupportCsv)
WriterSupport := csv.NewWriter(SupportCsv)
defer WriterSupport.Flush()


text:
Q: jquery.min has very long TTFB I have noticed recently some plugins like Jetpack, Yoast and Wordfence in my WordPress admin take a long time to load. I investigated the issue in Chrome console and noticed the TTFB to load jquery.min is very long.

An example of a URL it is loading is https://c0.wp.com/c/5.7/wp-includes/js/jquery/jquery.min.js - what is causing the long delay?


text:
Q: How to create menu in phonegap I am creating a phonegap project and i am new to this area.
I am trying to develop a menu for eg in samsung mobiles there is a menu button, so when I press the menu button a menu option will pop up. But how to have this same in nexus 5 where there is no menu button. How can i achieve it. I don't know how to search for it.
Can anyone give guide me.
hope you understand the question
Thanks in advance

A: There is a framework is very useful to develop a beautiful ui: ionic
http://ionicframework.com/


text:
Q: Some pages in SharePoint not accessible with FQDN My customer's network is designed to enforce business users to only access web applications with FQDN. Business users can only access SharePoint site with FQDN example: http://abc-intranet.abc.local
abc-intranet as the computer name and 'abc.local' as full domain name.
The issue here is business users can access all pages of SharePoint and Project Server but they can't access SSRS Reports and one BI chart (created using REST/HTML5/JavaScript). SSRS is configured in SharePoint-Integrated mode. But when same business users access the SharePoint server remotely and open the SharePoint site in the browser then they face no issues accessing SSRS and the HTML report, all works perfect.
On SharePoint server, we can't access any SharePoint site using FQDN. Pages and everything can be accessed with only server name example, http://abc-intranet
From all business users laptop, they can ping both abc-intranet and abc-intranet.abc.local. I have never faced this type of issues before and stuck in between, cannot find a right direction to move ahead. Your any help is highly appreciated.


text:
Q: How to pass ObservableInt between Activities? I have an ObservableInt in Activity1, and want to pass it through intent to Activity2. But no matter how I pass the it, the OnPropertyChangedCallbacks bound to the ObservableInt are lost. How to prevent the lost?
// Activity1
private ObservableInt var = new ObservableInt(0);
var.addOnPropertyChangedCallback(callback1);
public void goToActivity2(View view) {
    var.set(1); // fires callback1
    Intent intent = new Intent(getContext(), Activity2.class);
    // first way to pass ObservableInt
    intent.putExtra("VAR", (Parcelable) var);
    // second way to pass ObservableInt
    Bundle bundle = new Bundle();
    bundle.putParcelable("VAR", var);
    intent.putExtras(bundle);
    startActivity(intent);
}
// Activity2
protected void onCreate(Bundle savedInstanceState) {
    ObservableInt a = getIntent().getParcelableExtra("VAR");
    Bundle bundle = getIntent().getExtras();
    ObservableInt b = bundle.getParcelable("VAR");
    a.set(2); // cannot fire callback1
    b.set(3); // cannot fire callback1
}

//Activity1
private ObservableInt var = new Observable(0);
protected void onCreate(Bundle savedInstanceState) {
    var.addOnPropertyChangedCallback(callback1);
    var.set(1); // fires callback1
    Fragment1 frag = Fragment1.newInstance(var); // instantiates Fragment1
    // inflate some layout with frag
}

public void goToActivity2 (View view) {
    Intent intent = new Intent(this, goToActivity2.class);
    intent.putExtra("VAR", var);
    startActivity(intent);
}

// Fragment1
public static Fragment1 newInstance(ObservableInt var) {
    Bundle args = new Bundle();
    args.putSerializable("VAR", var);
    Fragment1 fragment = new Fragment1();
    fragment.setArguments(args);
    return fragment;
}

public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    ObservableInt var = (ObservableInt) getArguments().getSerializable("VAR");
    var.addOnPropertyChangedCallback(callback2);
    var.set(2); // fires callback1 and callback2
}

//Activity2
protected void onCreate(Bundle savedInstanceState) {
    ObservableInt var= (ObservableInt) getIntent().getSerializableExtra("VAR");
    var.addOnPropertyChangedCallback(callback3);
    var.set(3); // only fires callback3 :(
}

A: When you pass a Parcelable, the object that comes out the other side is not the same instance.
Per the docs:

This class is parcelable and serializable but callbacks are ignored when the object is parcelled / serialized.

A: Instead of passing the Observable via Intent, use Event bus style with RxJava:
public class RxEventBus {

    private static RxEventBus instance;

    private PublishSubject<Observable> observable_bus = PublishSubject.create();

    public static RxEventBus getInstance() {
        if (instance == null) {
            instance = new RxEventBus();
        }
        return instance;
    }

    public void sendBusObservable(Observable observable_bus) {
        observable_bus.onNext(observable_bus);
    }

    public Observable<Observable> getBusObject() {
        return observable_bus;
    }
  }

To pass an Observable From Activity1,
private ObservableInt var = new ObservableInt(0);
var.addOnPropertyChangedCallback(callback1);

RxEventBus.getInstance().sendBusObservable(var);

From Activity2 Subscribe for the data changes,
 RxEventBus rxEventBus = RxEventBus.getInstance();
        rxEventBus.getBusObject()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(a -> {
                    if (a instanceof Observable) {
                        Observable observable = (Observable) a;
                        // do the rest with received observable
                    }
                });


text:
Q: Absolute Values in SSRS Report I am new in SSRS reports and want to develop report in below mention format.
I want to get absolute values and then add.
i use the following query in dataset.
(Select S.Zone,S.City,H.EmpID,H.EmpName,H.Department,H.Designation,H.EmpDOL,H.JobLoc,Count(H.EmpID) as TotalStrength,0 as AvaStregth from HRData H
Left Join StoreTable S on H.JobLoc=S.StoreName
Group by S.ZOne,S.City,H.EmpID,H.EmpName,H.Department,H.Designation,H.EmpDOL,H.JobLoc
UNION ALL
Select S.Zone,S.City,NULL as City,NULL as EmpID,NULL as EmpName,T.Designation,NULL as EmpDOL,T.[Store Name],0,T.Value From HRTotalStrength T
Left Join StoreTable S on T.[Store Name]=S.StoreName)
Fomat in Excel


text:
Q: Can I use this power supply DC output terminals to create a dual power supply? I have this power supply.
And here is the photo:

I named the DC outputs as A, B, C, D in red color to ask my question.
I saw in some bench power supplies they create dual supply.
Can I make a +24V -24V dual power supply by tying B and C together and making this joint as GND. So lets say I tied B and C and this is called BC. Im expecting A to BC voltage will be +24 and B to BC will be -24V.
1-) Can I do that in this case safely? Or tying B to C short the supply and damage it?
2-) If I can do that, do you recommend this way of powering a dual opamp for a good performance or do you recommend another IC solution to obtain dual power supply for opamps?

A: Can I make a +24V -24V dual power supply by tying B and C together and making this joint as GND
No, that is NOT possible.
This is a 1 x 24 DC supply. If it was 2 x 24 V then the connectors would be placed more separate to emphasize that they're independent. It would be indicated on the device as well as: 2 x 24 V
I think terminals A and B are shorted already and so are C and D.
Get your multimeter out, switch off this supply, disconnect it from mains and put the multimeter in continuity mode or resistance mode. Now measure it. I give you 99.99% change that A=B and C=D.

A:
Can I make a +24V -24V dual power supply by tying B and C together and
  making this joint as GND. So lets say I tied B and C and this is
  called BC. Im expecting A to BC voltage will be +24 and B to BC will
  be -24V.

No you can't. It is a single voltage power supply with two screw contacts per electrical connection. Read the data sheet - they are available as single outputs from 5 volts to 48 volts.


text:
Q: Django Rest API VIEWSET custom validation on post request I'm new to django rest framework.
Here is model.py
PRICE_CHOICES = (
    ('high','High'),
    ('medium', 'Medium'),
    ('low','Low'),
)
class Book(models.Model):
    price = models.CharField(max_length=255)
    status = models.CharField(max_length=255,choices=PRICE_CHOICES)

My api views.py:
class BookViewSet(viewsets.ModelViewSet):
    queryset = Book.objects.all()
    serializer_class = BookSerializer

and serializer.py:
class BookSerializer(serializers.ModelSerializer):
    class Meta:
        model = Book
        fields = ('id', 'price', 'status')

want to override price field.

A: You can throw an error when price exceeds a limit like this.
 class BookSerializer(serializers.ModelSerializer):
        class Meta:
            model = Book
            fields = ('id', 'price', 'status')

        def validate_price(self, data):
             if data > threshold:
                 raise ValidationError(message='...')
             return data

If you want to alert a user and based on his response you want to make a decision then you need other logic. You need to introduce a new check variable/param in post input.
To set one book for user per day override validate method in serializer
class BookSerializer(serializers.ModelSerializer):
        class Meta:
            model = Book
            fields = ('id', 'price', 'status')

        def validate_price(self, data):
             if data > threshold:
                 raise ValidationError(message='...')
             return data
        def validate(self, data):
             # your logic, et user detail and date and check it with db. if found raise exception as shown above.


text:
Q: What are methods of form validation from inside a shadowbox? Ok I have a form inside a shadowbox, this thing will just not validate... I have tried it a million different ways.  It also lives inside a Wordpress Theme which I don't think is breaking it.  Jquery is loaded in the header.
the form is pasted into a gist: http://gist.github.com/578270
Any ideas?  Thanks so much, feel like I am banging my head into a wall.

A: The trick is to use the onFinish callback function to trigger the validation for the form that is inside the Shadowbox. If you use an ID for your form like I did, shadowbox will actually create a duplicate copy of the form so you need to target the form within the shadowbox itself. I used #sb-player to do this.
HTML Shadowbox Link
Newsletter Sign-up

JavaScript/jQuery
$('a.newsletter-signup').click(function(){
    Shadowbox.open({
        width: 562,
        height: 395,
        player: 'inline',
        content: this.href,
        options: {
            onFinish: function(){
                $('#sb-player #newsletter-signup-form').validate();
            }
        }
    });
    return false;
});

HTML Form (hidden in footer)

        <form action="" id="newsletter-signup-form" target="_parent" method="POST">

                        First Name *

                            <input class="medium required" id="first_name" maxlength="40" name="first_name" size="20" type="text" />

                        Last Name *

                            <input class="medium required" id="last_name" maxlength="80" name="last_name" size="20" type="text" />

                        Email *

                            <input class="medium required" id="email" maxlength="80" name="email" size="20" type="text" />

                        Company *

                            <input class="medium required" id="company" maxlength="40" name="company" size="20" type="text" />

                <input class="button" type="submit" name="submit" value="Sign-up!">

        </form>

I hope this helps, I'm happy to explain in more detail if needed.


text:
Q: Error: Compiled formula is too big to execute Currently I have a formula consisting of various fields where each of the field itself is a formula. This results in a formula is too big to compile error. I am wondering if there are any ways optimize the formula to avoid such error.
The current formula takes the score of all my various components and divides it by the count of the number of components used if they are not blank.
This is my overall score formula:

This is my communication score formula:


text:
Q: How to store values of select query in variables in the webservice? I am new to webservice development. I have made webservice in asp.net using c# and mysql.
I want to store values of select query in variable which then i want to insert in table.
I have used following code :
//for inserting new game details in the tbl_Game by FB
    [WebMethod]
    public string InsertNewGameDetailsForFB(string gametype, string player1, string player2, string player3, string player4, string player5)
    {
        string success = "Error in Insertion";

        string selectID = "Select UserID from tbl_userinfo where Facebook_ID IN ('" + player1 + "','" + player2 + "','" + player3 + "')";
        con = new MySqlConnection(conString);
        con.Open();
        MySqlCommand cmd = new MySqlCommand(selectID, con);
        MySqlDataReader ids = cmd.ExecuteReader();
        string id1="", id2="", id3="";
        while (ids.Read())
        {
           id1 = ids.GetString(0);
           id2 = ids.GetString(1);
           id3 = ids.GetString(2);

        }

        string insertNewGame = "Insert into tbl_game(Type,Player1,Player2,Player3,Player4,Player5) values";
        insertNewGame += "( '" + gametype + "' , '" + id1 + "', '" + id2 + "','" + id3 + "', '" + player3 + "','" + player4 + "', '" + player5 + "' )";
        con = new MySqlConnection(conString);
        con.Open();
        MySqlCommand cmd1 = new MySqlCommand(insertNewGame, con);
        int success1 = cmd1.ExecuteNonQuery();
        con.Close();

        string gameID = "Select MAX(GameID) from tbl_game";
        con = new MySqlConnection(conString);
        con.Open();
        MySqlCommand cmd2 = new MySqlCommand(gameID, con);
        string gameid = cmd2.ExecuteScalar().ToString();

        if (success1 > 0)
        {
           success="Inserted Successfully, GameID is - " + gameid;
        }
        return success;
    }

how can i do this ?
Thanks.

A: Your first issue is how you're attempting to read in UserID from your first query.  This query will not return three columns but three rows.  So you need to do something like this:
int index = 0;
while (ids.Read())
{
    switch (index)
    {
        case 0:
            id1 = ids.GetString(0);
            break;
        case 1:
            id2 = ids.GetString(0);
            break;
        case 2:
            id3 = ids.GetString(0);
            break;
    }
    index += 1;
}

That should store them properly.  My second suggestion is since this is a web service, you should avoid SQL Injection attacks and use parameterized queries rather than dynamic SQL.  There are plenty of examples on the web you can use.
My final suggestion is to use the using statement religiously for objects which implement IDisposable (i.e. the connection object, the command, the reader, etc...).  This ensures proper cleanup of objects.


text:
Q: Vertiical Scrollview not working in xamarin forms.? I'm trying to scroll the xfxCardview in Xamarin Forms. But it is not scrolling. This is my code
            <ScrollView  Orientation = "Vertical" VerticalOptions="FillAndExpand">
                <StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand">
            <xfx:XfxCardView
                    BackgroundColor="White"
                    CornerRadius="30"
                Elevation="20"
             HeightRequest="160" IsClippedToBounds="True" VerticalOptions="FillAndExpand">
                <StackLayout Orientation="Horizontal">

                    <Grid VerticalOptions="CenterAndExpand"
             Padding="0"
             HorizontalOptions="FillAndExpand"
             BackgroundColor="Transparent">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="25" />
                            <RowDefinition Height="25" />
                            <RowDefinition Height="25" />
                            <RowDefinition Height="35" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Frame Margin="10,5,5,-20"  CornerRadius="10" Grid.RowSpan="3"  BackgroundColor="LightBlue"  IsClippedToBounds="True">
                            <Image Margin="-70,-70,-70,-70"  Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="restaurantimage1.jpg" />
                        </Frame>

                        <Image Grid.Row="0" Grid.Column="5" Margin="0,10,0,0"  Source="whitehearticon3"/>

                        <Image Grid.Row="3" Grid.Column="1"   Source="whitestaricon1"/>

                        <Image Grid.Row="3" Grid.Column="3" Margin="-10,0,0,0"   Source="rupeeicon1"/>

                        <Image Grid.Row="3" Grid.Column="5" Margin="-20,0,0,0"  Source="handicon1"/>

                    </Grid>
                </StackLayout>
            </xfx:XfxCardView>

                <xfx:XfxCardView
                    BackgroundColor="White"
                    CornerRadius="30"
                Elevation="20"
             HeightRequest="160" IsClippedToBounds="True" VerticalOptions="FillAndExpand">
                <StackLayout Orientation="Horizontal">

                    <Grid VerticalOptions="CenterAndExpand"
             Padding="0"
             HorizontalOptions="FillAndExpand"
             BackgroundColor="Transparent">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="35" />
                            <RowDefinition Height="25" />
                            <RowDefinition Height="25" />
                            <RowDefinition Height="35" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Frame Margin="10,5,5,-20"  CornerRadius="10" Grid.RowSpan="3"  BackgroundColor="LightBlue"  IsClippedToBounds="True">
                            <Image Margin="-70,-70,-70,-70"  Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="restaurantimage2.jpg" />
                        </Frame>

                        <Image Grid.Row="0" Grid.Column="5" Margin="0,10,0,0"   Source="whitehearticon3"/>

                        <Image Grid.Row="3" Grid.Column="1"   Source="whitestaricon1"/>

                    </Grid>
                </StackLayout>
            </xfx:XfxCardView>

                    <xfx:XfxCardView
                    BackgroundColor="White"
                    CornerRadius="30"
                Elevation="20"
             HeightRequest="160" IsClippedToBounds="True" VerticalOptions="FillAndExpand">
                        <StackLayout Orientation="Horizontal">

                            <Grid VerticalOptions="CenterAndExpand"
             Padding="0"
             HorizontalOptions="FillAndExpand"
             BackgroundColor="Transparent">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="25" />
                                    <RowDefinition Height="25" />
                                    <RowDefinition Height="25" />
                                    <RowDefinition Height="35" />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="100"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Frame Margin="10,5,5,-20"  CornerRadius="10" Grid.RowSpan="3"  BackgroundColor="LightBlue"  IsClippedToBounds="True">
                                    <Image Margin="-70,-70,-70,-70"  Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="restaurantimage3.jpg" />
                                </Frame>

                                <Image Grid.Row="0" Grid.Column="5" Margin="0,10,0,0"  Source="whitehearticon3"/>

                                <Image Grid.Row="3" Grid.Column="1"   Source="whitestaricon1"/>

                                <Image Grid.Row="3" Grid.Column="3" Margin="-10,0,0,0"   Source="rupeeicon1"/>

                                <Image Grid.Row="3" Grid.Column="5" Margin="-20,0,0,0"  Source="handicon1"/>

                            </Grid>
                        </StackLayout>
                    </xfx:XfxCardView>

                </StackLayout>
            </ScrollView>

I don't know what is wrong with my code I'm setting orientation as vertical also I'm setting VerticalOptions as fill and expand. Will the scroll view work or should I put the XfxCardview inside a Listview. This is the how my current UI looks like

and the UI doesn't scroll to the bottom.

A: Your xaml looks ok, try check few things:

*

*that you don't have a forgotten custom renderer for scrollview with disabled scroll included in android project

*check that it scrolls without elevations set, might be a bug

*another "bug" i can imagine: looks at the last card: it is possible that it just didn't take its 160 height but just filled the parent with VerticalOptions="FillAndExpand" so there's nothing to scroll. And card's content was clipped with IsClippedToBounds="True" so it didn't Expand the card.

A: In Android, the issue is due to the card height. Three cardviews are aligned perfectly with the screen. That's the reason, you are not seeing scrollview in Android. Scrollview functionality will be available only if the the content inside scrollview is greater than scrollview height. To solve this, try the below solution. Add add more cardviews, you will see the scrollview. Another solution is,  I've added height as 300 to the scrollview. You can test and modify based on your requirement.
  <ScrollView HeightRequest="300"  Orientation = "Vertical" VerticalOptions="FillAndExpand">
            <StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand">
        <xfx:XfxCardView
                BackgroundColor="White"
                CornerRadius="30"
            Elevation="20"
         HeightRequest="260" IsClippedToBounds="True" VerticalOptions="FillAndExpand">
            <StackLayout Orientation="Horizontal">

                <Grid VerticalOptions="CenterAndExpand"
         Padding="0"
         HorizontalOptions="FillAndExpand"
         BackgroundColor="Transparent">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="25" />
                        <RowDefinition Height="25" />
                        <RowDefinition Height="25" />
                        <RowDefinition Height="35" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Frame Margin="10,5,5,-20"  CornerRadius="10" Grid.RowSpan="3"  BackgroundColor="LightBlue"  IsClippedToBounds="True">
                        <Image Margin="-70,-70,-70,-70"  Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="restaurantimage1.jpg" />
                    </Frame>

                    <Image Grid.Row="0" Grid.Column="5" Margin="0,10,0,0"  Source="whitehearticon3"/>

                    <Image Grid.Row="3" Grid.Column="1"   Source="whitestaricon1"/>

                    <Image Grid.Row="3" Grid.Column="3" Margin="-10,0,0,0"   Source="rupeeicon1"/>

                    <Image Grid.Row="3" Grid.Column="5" Margin="-20,0,0,0"  Source="handicon1"/>

                </Grid>
            </StackLayout>
        </xfx:XfxCardView>

            <xfx:XfxCardView
                BackgroundColor="White"
                CornerRadius="30"
            Elevation="20"
         HeightRequest="260" IsClippedToBounds="True" VerticalOptions="FillAndExpand">
            <StackLayout Orientation="Horizontal">

                <Grid VerticalOptions="CenterAndExpand"
         Padding="0"
         HorizontalOptions="FillAndExpand"
         BackgroundColor="Transparent">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="25" />
                        <RowDefinition Height="25" />
                        <RowDefinition Height="25" />
                        <RowDefinition Height="35" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="100"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Frame Margin="10,5,5,-20"  CornerRadius="10" Grid.RowSpan="3"  BackgroundColor="LightBlue"  IsClippedToBounds="True">
                        <Image Margin="-70,-70,-70,-70"  Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="restaurantimage2.jpg" />
                    </Frame>

                    <Image Grid.Row="0" Grid.Column="5" Margin="0,10,0,0"   Source="whitehearticon3"/>

                    <Image Grid.Row="3" Grid.Column="1"   Source="whitestaricon1"/>

                </Grid>
            </StackLayout>
        </xfx:XfxCardView>

                <xfx:XfxCardView
                BackgroundColor="White"
                CornerRadius="30"
            Elevation="20"
         HeightRequest="260" IsClippedToBounds="True" VerticalOptions="FillAndExpand">
                    <StackLayout Orientation="Horizontal">

                        <Grid VerticalOptions="CenterAndExpand"
         Padding="0"
         HorizontalOptions="FillAndExpand"
         BackgroundColor="Transparent">
                            <Grid.RowDefinitions>
                              <RowDefinition Height="25" />
                        <RowDefinition Height="25" />
                        <RowDefinition Height="25" />
                        <RowDefinition Height="35" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="100"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Frame Margin="10,5,5,-20"  CornerRadius="10" Grid.RowSpan="3"  BackgroundColor="LightBlue"  IsClippedToBounds="True">
                                <Image Margin="-70,-70,-70,-70"  Grid.Row="0" Grid.Column="0" Grid.RowSpan="4" Source="restaurantimage3.jpg" />
                            </Frame>

                            <Image Grid.Row="0" Grid.Column="5" Margin="0,10,0,0"  Source="whitehearticon3"/>

                            <Image Grid.Row="3" Grid.Column="1"   Source="whitestaricon1"/>

                            <Image Grid.Row="3" Grid.Column="3" Margin="-10,0,0,0"   Source="rupeeicon1"/>

                            <Image Grid.Row="3" Grid.Column="5" Margin="-20,0,0,0"  Source="handicon1"/>

                        </Grid>
                    </StackLayout>
                </xfx:XfxCardView>
            </StackLayout>
        </ScrollView>


text:
Q: Configuring Eclipse CDT for Apache Mesos How do I configure Eclipse CDT Luna to work with Apache Mesos directly?
The steps for building Apache Mesos on a Linux machine are known and provided here:
http://mesos.apache.org/gettingstarted/

A: (This works on a Mac with Eclipse "Kepler". I hope it is similar on other platform variants.)

*

*Install Eclipse with CDT

*"git clone" a Mesos git repository into a local directory as described in the "Getting started" guide you referenced.

*Open eclipse. Select "File->Import…->Git->Projects from Git".

*Select "Existing local repository".

*Click on "Add…" and add your local Mesos git directory. It will show up in the list in the selector box from step 4.

*Select the entry for your directory and click on "Next".

*Select "Import as general project" and click on "Next"..

*Give your project a name and click on "Finish". Now you have a project.

*Make sure you are in the C++ perspective. Select/highlight your project in the Project Explorer. Then select "File->New…->Convert to a C/C++ Autotools project".

*Edit your project's properties (Select project, Cmd-I). On the pane "C/C++ Build", add "/build" to the value of "Build directory". It should look like this: ${workspace_loc:/myProjectName}/build

*Optional: In pane "Autotools" go to "Configure Settings->Advanced". Under "Additional command line options" you can put "--disable-python --disable-java" if you don't want to build Python and Java-related stuff every time.
—
As a prerequisite, I am using these values in my eclipse.ini (https://wiki.eclipse.org/Eclipse.ini):
-XX:MaxPermSize=512m
-Xms1024m
-Xmx6144m


text:
Q: Powershell Invoke-Command with Variable for Script Name I need to execute a Powershell script on a remote machine from a local script. Problem is, I don't know the path or filename of the remote script until runitime.
I've tried the following line in my local script:
Invoke-Command -ComputerName $TargetServer -ScriptBlock { & ($TargetMSI) '$MSI' 'C:\Program Files (x86)\Vasanta.Int.MIS' 'Dev' }

Problem is this returns the error: The expression after '&' in a pipeline element produced an invalid object.
If replace the $TargetMSI with a hard-coded string literal then it works fine.
Can anyone please tell me what I need to change?

A: When you Invoke-Command in v2 there is no direct way to pass variables to scriptblock. You need to use -ArgumentList + param () in scriptblock combo:
Invoke-Command -ScriptBlock { param ($TargetMSI, $MSI) & $TargetMSI '$MSI' } -ArgumentList $TargetMSI, $MSI

this is fixed/ improved in v3 with $using:localvariable syntax.


text:
Q: Number of linearly independent solutions for a first order non-linear ODE I observed that in a first order non-linear IVP, $$y'=f(t,y), ~y(t_0)=y_0,\tag{$*$}$$ solution might be unique (as in Lipschitz functions like $f(t,y)=\sin(y)$ w.r.t $y$) or infinitely many (as in $y'=\sqrt y$) linearly independent solutions.
My doubt: Can we ensure, if there are two linearly independent solutions $y_1$ and $y_2$ for $(*)$, then exist a third solution $y_3$ which is linearly independent to the first two? If so, how to establish the linear independence?


text:
Q: When is a pooled T-test ever a good idea? Say I had two distributions and I wanted to determine whether the mechanism behind these two distributions was statistically different.
We know that Student's T-test is pooled, meaning BOTH the distributions must have the same variance. Welch's T-Test is unpooled, meaning these two distributions do not have to be the same.
It seems that Welch's test would be more applicable in the real-world. In almost all cases I can think of, the variance would be different! When does it ever make sense to apply a pooled t-test like Student's t-test?
Should we always check if the variance of the two normal distributions is the same?

A: Here's one: the pooled test is fine if the sample sizes are equal.
(You should generally not test the assumption of equal variances (numerous posts on site discuss this issue.) If you're not prepared to assume it (and in some situations there's reason to think it should hold), simple don't assume it.

A: A day-to-day routine:
First of all, how would you know whether in a particular case you may use Student's T test instead of Welch's T test - you simply run a test for the equality of variances, e.g. Levene's test. But this test assumes as null hypothesis the equality of variances and it's rather well known it has a quite weak power, so how you find out if variances are really different? So, it's safer to use Welch's T test as described in article The unequal variance t-test is an underused alternative to Student's t-test and the Mann–Whitney U test by G.D. Ruxton.
The counterexamples:
If you don't have much time, have a glance on this post by Daniel Lakens.
Go through all comments and you'll find several entries by Joost de Winter where he points out some strange cases when Student's T test has greater power over Welch's T test, but those examples cover very small sample size.
Maybe you would manage to find examples for bigger samples, but he found out that for $n1 = 100$, $n2= 10$, $sd1 = sd2 = 1$ Student's T test has a considerable power advantage of 85% against 78% for Welch's T test.
(I believe him, but I haven't verified by myself the validity of his finds).

A: The more fundamental question is "When is any t-test is a good idea?" since it depends (critically) on having iid normally-distributed samples.
The obvious answer to your question is that it makes sense to apply an unpooled t-test when: the above assumptions are met; you have good reason (such as a scientific model) to believe that the population variances are the same; and the number of samples is very small so that there would be a noteworthy difference between the tests.
I would be surprised if even 1% of t-tests performed in reality, are conducted under these conditions.

A: When teaching statistics, there are some advantages of the classic t-test over Welch's modification.

*

*The classic t-test can be computed more easily by paper and pen.

*p values from the classic t-test equal the t-test and F-tests from a simple linear regression with a binary covariable. So you can highlight the close relation between the two techniques.
In practice, I don't see any advantage.


text:
Q: Puppet configuring iSCSI with multipath I'm setting up some iSCSI storage (Lenovo) along with 3 physical servers running RHEL7.
Each server has 2 NICs for the main network (bonded) and 2 NICs for the iSCSI network. The Lenovo storage has 4 ports connected to 2 physical switches.  The iSCSI NICs in each server go to 1 port in each of the switches."
I'm using puppet to configure the iSCSI NICs and was wondering if I should create a bond for the connection to the storage?
Currently they're 2 separate NICs and the storage only reports seeing a single "host port" per server (I was maybe expecting to see two host ports per server?).  The storage describes the host port with the iscsi initiator name (as found in /etc/iscsi/initiatorname.iscsi)
Alternatively is there a way you can get the iscsi service to go out on the 2nd NIC, so it registers a second host port with the storage?  Or am I worrying unnecessarily?
Thanks,
Rob.


text:
Q: Android BroadcastReceiver, auto run service after reboot of device Hello i am writing an application, which is when the phone reboot, the service will auto start instead of click on the application.
Here is my code for
BootCompleteReceiver.java
package com.example.newbootservice;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class BootCompleteReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {

        Intent service = new Intent(context, MsgPushService.class);
        context.startService(service);

    }

}

MsgPushService.java
package com.example.newbootservice;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.widget.Toast;

public class MsgPushService extends Service {

    @Override
    public void onCreate() {
        super.onCreate();
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {

        Toast.makeText(this, "Service Started", Toast.LENGTH_LONG).show();
        return Service.START_STICKY;
    }

    @Override
    public void onDestroy() {

        super.onDestroy();
        Toast.makeText(this, "Service Destroy", Toast.LENGTH_LONG).show();
    }

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

MainActivity.java   (not sure whether i need this)
package com.example.newbootservice;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        startService(new Intent(getBaseContext(), MsgPushService.class));
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}

Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.newbootservice"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <service android:name=".MsgPushService"/>

        <receiver android:name=".BootCompleteReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </receiver>

        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

I want the service to be started automatically after reboot instead of starting it manually.

A: Though all the above answers were correct, however from Android Oreo they put some limitation on Background Services.
Check Background Execution Limits to know more about background limits in Android O.
You can't start a Service directly from BroadCastReceiver when the application is in the background.
However, you can start a foreground service from the receiver by calling startForegroundService() or use JobIntentService as there is no such limitation with JobIntentService.

A: Use this code on your Broadcast Receiver class:
if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
   Intent service = new Intent(context, MsgPushService.class);
    context.startService(service);
  }

A: You forgot about the permissions
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

A: also try these permissions,it may help you .ifyou are using htc phones then these permissions are required
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.QUICKBOOT_POWERON"/>


text:
Q: append anchor to a parent that contains anchor with same href attribute I'm new to SO and a jQuery newbie. I have links being dynamically created from a database into 3 different unordered lists. I'm trying to append list items from each of the two lists on the bottom to the the top list inside a new ul tag which will be a sibling to the anchor of each list item in the top list. I need to do this by matching the href attributes. I began playing around with the script below to see if I could exclude the last part of the the urls so it would be easier to match the href attributes. Any help would be greatly appreciated.

My Site

Google

Yahoo

CNN

ESPN

TSYS

My Site

To Index Page

My Site Too

Yahoo Redux

A: Something like this fiddle
HTML

My Site

Google

Yahoo

CNN

ESPN

TSYS

My Site

To Index Page

My Site Too

Yahoo Redux

Javascript
$('ul.combination li').each(function() {
    var element = $('.list li a[href="' + $(this).find('a').attr('href') + '"]');

    if (element.siblings('ul').length  == 0) {
        element.after('
');
    }

    element.next('ul').append($(this));
})


text:
Q: command line php uses values from apache2 php.ini file; why? I am running PHP 7.4 from command line on Ubuntu 20.04 LTS.
It appears to use some config values from the "cli/php.ini" file as well as some values from "apache2/php.ini" file.
see expose_php and memory_limit values shown by "php -i" below:
admin@my-ubuntu-host:/$ lsb_release -a 2>/dev/null
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal
admin@my-ubuntu-host:/$
admin@my-ubuntu-host:/$ sdiff -s ./etc/php/7.4/apache2/php.ini ./etc/php/7.4/cli/php.ini
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcnt | disable_functions =
expose_php = Off                                              | expose_php = On
memory_limit = 256M                                           | memory_limit = -1
admin@my-ubuntu-host:/$
admin@my-ubuntu-host:/$ /usr/bin/php -i | egrep -i '(php version|expose_php|memory_limit|php.ini)'
PHP Version => 7.4.3
Configuration File (php.ini) Path => /etc/php/7.4/cli
Loaded Configuration File => /etc/php/7.4/cli/php.ini
PHP Version => 7.4.3
expose_php => On => On
memory_limit => 256M => 256M
admin@my-ubuntu-host:/$
admin@my-ubuntu-host:/$

How comes?

A: Thanks to Mark for teaching me that .ini files in conf.d directory will overwrite the value set in php.ini.


text:
Q: How can you tell if a PL/SQL Package, Procedure, or Function is being used? How can you tell if a PL/SQL Package, Procedure, or Function is being used? Is there an Oracle table or view that contains statistics on PL/SQL Package, Procedure, or Function usage?

A: Not by default. But you can use the audit functionality of your Oracle database. At Ask Tom is a long thread about the auditing of procedure calls!

A: If you're on Oracle 11 (R2?), I'd give PL/Scope a chance.
The docu states: PL/Scope is a compiler-driven tool that collects data about identifiers in PL/SQL source code at program-unit compilation time and makes it available in static data dictionary views. The collected data includes information about identifier types, usages (declaration, definition, reference, call, assignment) and the location of each usage in the source code.
PL/Scope enables the development of powerful and effective PL/Scope source code browsers that increase PL/SQL
developer productivity by minimizing time spent browsing and understanding source code.
You can find more about it at http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_plscope.htm#g1010526

A: You can also try querying USER/ALL_source:
SELECT * FROM all_source
where UPPER(TEXT) like UPPER('%procedure_name%')

or
SELECT * FROM all_source
where UPPER(TEXT) like UPPER('%package.function_name%')

You'll have to ignore self references, but that should be easy to spot.
You'll also need to check "view" source from user/all_views.  See the other question about querying view source though.
you can also check if a package or top level function/procedure is used with
select * from all_dependencies
where referenced_name like '%PACKAGE_NAME%';

NB: switch user_ with all_/dba_ as needed
if you are specifically looking for uncalled functions then another option is to compiler your code with WARNINGS turned on and then look for PLW-06002 and LPW-06006
exec DBMS_WARNING.add_warning_setting_cat('ALL','ENABLE','SESSION')
create or replace function x return number
as
procedure y is begin null; end;
begin
return 0;
return 1;
end;

show errors

Errors for FUNCTION X:

LINE/COL ERROR
-------- -----------------------------------------------------------------
1/1      PLW-05018: unit X omitted optional AUTHID clause; default value DEFINER used
3/1      PLW-06006: uncalled procedure "Y" is removed.
6/1      PLW-06002: Unreachable code

A: You can see if an object has any dependencies by querying the DBA_DEPENDENCIES table.
SELECT OWNER,
       NAME,
       TYPE
  FROM SYS.DBA_DEPENDENCIES
 WHERE REFERENCED_OWNER = '<your object owner>'
   AND REFERENCED_NAME = '<your object name>'
   AND REFERENCED_TYPE IN ('PACKAGE', 'PROCEDURE', 'FUNCTION');

This query will return any dependencies in code stored inside the Oracle instance itself.
It will not reveal whether or not any object is called outside of the instance.

A: You can use Editors like Toad. They will directly list both the objects on which your procedure is dependent and objects which reference your procedure.

A: You might also find the pl/sql instrumentation package ILO useful for what you're trying to do.


text:
Q: How does an inner product $V \times V \to F$ induce a vector norm $V \to \mathbb{R}?$ Let $\mathbb{F}=\left(F,+_F,\cdot_F\right)$ be a field and $\mathbb{V}=\left(V,\mathbb{F},+,\cdot\right)$ be a vector space. Let $\langle\cdot,\cdot\rangle : V \times V \to F$ be an inner product. If $F \neq \mathbb{R},$ then how can we say that the $\left\Vert x \right\Vert = \sqrt{\langle x,x \rangle}$ is a valid vector norm$?$ Because a vector norm is a map $\left\Vert\cdot\right\Vert : V \to \mathbb{R}$.
Should we modify the definition of the induced norm to be $\left\Vert x \right\Vert = \sqrt{\left|\langle x,x \rangle\right|},$ where
$\left|\cdot\right| : F \to \mathbb{R}$ is a pre-fixed norm$?$

A: For those who say that "an inner product induces a norm" define the term "inner product" to apply specifically to the case in which $\Bbb F \in \{\Bbb R,\Bbb C\}$.  In those cases, the definition $\|x\| = \sqrt{\langle x, x \rangle}$ is perfectly fine.
With this convention, a bilinear map $V \times V \to \Bbb F$ would be called a "scalar product" or a "bilinear form" as opposed to an "inner product".

A: This is a quote from Wikipedia

There are various technical reasons why it is necessary to restrict the basefield to R and C in the definition. Briefly, the basefield has to contain an ordered subfield in order for non-negativity to make sense,[4] and therefore has to have characteristic equal to 0 (since any ordered field has to have such characteristic). This immediately excludes finite fields. The basefield has to have additional structure, such as a distinguished automorphism. More generally any quadratically closed subfield of R or C will suffice for this purpose, e.g., the algebraic numbers or the constructible numbers. However in these cases when it is a proper subfield (i.e., neither R nor C) even finite-dimensional inner product spaces will fail to be metrically complete. In contrast all finite-dimensional inner product spaces over R or C, such as those used in quantum computation, are automatically metrically complete and hence Hilbert spaces.


text:
Q: How to setup Microsoft Remote Desktop? I'm trying to establish a connection between this app and my Win 8.1 Pro PC, but every guide I've found so far skip steps such as what to put under PC name or under Gateway. Also, should the User name be my email or something else?
I've also no idea how to find or add a user in the step 6 of this guide because the only location listed is my PC and I don't even know what am I supposed to search for. I'm not even sure whether I have to add a user or this is an step I can skip.
A comprehensive guide for people without experience in networking would be highly appreciated.
Both my android tablet and PC are connected to the internet through a home router, in case this matters.

A: PC Name can either be your hostname or IP Address (local)
Gateway should be picked up straight away by the wifi if your are connected in the same network.
Username would be your computer name "\" user name.. e.g: MYCOMP\Administrator
Password: your password
Note, you also need to make sure you PC is set up for allowing remote connections to it, in your windows 8 system, hit the start button, type: "remote" click on the settings (underneath search) and choose the "Allow remote access to your computer".
Check the Allow remote connections to this computer, then click the select users button. If your username isn't already added put yours in. Hit apply then you are all ready to use the RDC onto your computer.


text:
Q: django_cities_light no data being imported I'm trying to work with django_cities_light and have followed the docs to a T and also referenced some other SO questions but no data is being imported.
When I open a python shell and do
from cities_light.models import City
c1 = City.objects.get(id=100)

c1 returns
cities_light.models.City.DoesNotExist

I've ran
./manage.py migrate
./manage.py cities_light

But there is still no data.
settings.py
CITIES_LIGHT_TRANSLATION_LANGUAGES = ['en']
CITIES_LIGHT_INCLUDE_COUNTRIES = ['FR']
CITIES_LIGHT_INCLUDE_CITY_TYPES = ['PPL', 'PPLA', 'PPLA2', 'PPLA3', 'PPLA4', 'PPLC', 'PPLF', 'PPLG', 'PPLL', 'PPLR', 'PPLS', 'STLMT',

Does anyone have an idea of how I can fix this?

A: think i the way:
1.rollback all migration for the app
./manage.py migrate cities_light zero

next aplpy it again
./manage.py migrate

and try to do force import
./manage.py cities_light --force-import-all

may be the last command can be enough


text:
Q: How to start a minimal ruby app using Puma or Unicorn? I have a very basic ruby example running on Thin, but I would like to know how to translate this example to use Unicorn or Puma as the HTTP server instead. Here is the code I have now:
require 'rack'

class HelloWorld
  def talk()
    return "Hello World!"
  end
end

class SomeServer
  def start(server_object, port)
    app = proc do |env|
      [ 200, {"Content-Type" => "text/html"}, [server_object.talk()] ]
    end

    Rack::Handler::Thin::run(app, :Port => port)
  end
end

SomeServer.new.start(HelloWorld.new, 3000)

This runs fine and well, but I cannot figure out how to make it run using Puma or Unicorn instead. Most online documentation I find for the two is for Rails apps. How can I utilize the multi-threading capabilities of these servers with this simple program?

A: use sinatra.
So to take it step by step first install sinatra and puma gems
gem install sinatra

gem install puma

then create a file myapp.rb
require 'sinatra'
configure { set :server, :puma }

get '/' do
  "Hello World!"
end

then run the file
ruby myapp.rb

by default sinatra listens on 4567 so go to localhost:4567
you can configure puma to listen on a specific port or do a lot of other things using a config file read the documentation

A: A minimal example that doesn't require additional gems looks like this.
Using a single file
Create a puma config file config.rb with the following content:
app do |env|
  body = 'Hello, World!'
  [200, { 'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s }, [body]]
end

bind 'tcp://127.0.0.1:3000'

and run puma with
puma -C /path/to/config.rb

That's it.
Using a configuration and a rackup file
In the example above, the config file contains the application itself. It makes sense to move the application to a rackup file: Create a rackup file app.ru with the following content:
class HelloWorld
  def call(env)
    body = 'Hello, World!'
   [200, { 'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s }, [body]]
  end
end

run HelloWorld.new

Then update your config.rb, removing the app and linking the rackup file instead:
rackup '/path/to/app.ru'

bind 'tcp://127.0.0.1:3000'

and run puma as before with
puma -C /path/to/config.rb

The example configuration file for puma is helpful. (Update: This example configuration file is no longer maintained. The authors refer to dsl.rb instead.)

A: Instead of starting your app with Rack::Handler::Thin, you should be able to use the Puma Rack handler instead, like this:
Rack::Handler::Puma.run(app, :Port =>port)

You'd need to also require 'rack/handler/puma' after installing the Puma gem.


text:
Q: How to prove that this point is undefined? For the function $$f(x)=\lim_{n\to \infty}\;\large \frac {1} { \frac 1 {x^n} +1},$$ how do I show that the point $f(-1)$ does not exist?

A: A function being defined or not defined is not the same thing as a limit not existing.
That is, $f(x) \neq \dfrac 1 {\dfrac 1 {(x)^n} +1} = 1 - \dfrac{1}{(x)^n + 1}$. Clearly the function to the right is not defined at $-1$.
Some functions are undefined at certain values but nonetheless, limits exist.
In this case, the function in question is defined as a limit: That is, the function in question is not the expression $\dfrac 1 {\dfrac 1 {(x)^n} +1} = 1 - \dfrac{1}{(x)^n + 1}$, but rather the limit as $n\to \infty$ of that expression at the value $x$: $$f(x) =\quad\lim\limits_{n\to \infty}\dfrac 1 {\dfrac 1 {(x)^n} +1} = \lim_{n\to \infty} 1 - \dfrac{1}{(x)^n + 1}$$ which is a limit that exists for some values $x$, but not for $-1$: That is, $f(-1)$, the limit when $x = -1$, does not exist.
(1) $\lim\limits_{n\to \infty}\dfrac 1 {\dfrac 1 {(-1)^n} +1} \;=\; \lim_{n\to \infty} 1 - \dfrac{1}{(-1)^n + 1}\quad$ does not exist.
You need only explain why the limit does not exist: as $n \to \infty$, for odd $n$, the limit diverges to infinity, for even $n$,  it approaches $1$, oscillating, hence failing to exist.
Since $f(x)$ by is defined $\quad\lim\limits_{n\to \infty}\dfrac 1 {\dfrac 1 {(x)^n} +1} = \lim_{n\to \infty}\quad 1 - \dfrac{1}{(x)^n + 1}$,
it must therefore follow from (1) that $f(-1)=\lim\limits_{n\to \infty}\dfrac 1 {\dfrac 1 {-1^n} +1},\;$ fails to exist.

A: For n odd $(-1)^n=-1$  and $\dfrac 1 {\dfrac 1 {x^n} +1}$ is not well defined or you can think
$\dfrac 1 {\dfrac 1 {(-1)^n} +1}=\infty$ for n odd. So $\dfrac 1 {\dfrac 1 {x^n} +1}$ is oscillating between $\infty$ and $\frac{1}{2} $

A: Note that $$\cfrac1{\cfrac1{x^n}+1}$$ fails to be defined at $x=-1$ for all odd $n$. There are infinitely many such $n$, so there cannot be a limit. (Use $\delta$-$\epsilon$ definition of sequence convergence. Pay special attention to the quantifiers.)


text:
Q: Can I install redhat rpm on centos? Can I install the Red Hat 6 version of the Openssl.rpm on the Centos6?
I am trying to backup and install an old version that can no longer be found in current repository.
I found the centos package file,
but I can't verify that it is not tampered with.
I have a redhat package file,
can I install it in centos?

A: Redhat, Centos and Fedora can interchangeably use the same RPM packages, matching the same version of course.

A: *

*You can use rpm -qip [rpm-file] to check the signature and integrity.

*There are still CentOS6 repositories available via http://vault.centos.org local mirror (e.g. https://mirror.chpc.utah.edu/pub/vault.centos.org/ ) which house original packages and have all signatures published.


text:
Q: How to turn on or off mobile LED Flashlight in Adobe Air Android? is there anyway to control mobile LED Flashlight in Adobe Air Android.
using adobe air 14 on flash CC

A: You can use a flashlight ANE or create your own. Here is one that I found: https://github.com/sewonist/FlashLight
With that ANE, you'll be able to control the LED flashlight like so:
if( Flashlight.getInstance().isSupported )
{
Flashlight.getInstance().on(); // turn on
Flashlight.getInstance().off(); // turn off
var mode:Boolean = Flashlight.getInstance().mode; // get torch mode
}


text:
Q: Assigning numbers in the list a color based on position So here I needed an array to be filled with numbers ranging between 1 to 100.
 Then they also needed to be randomized.
Now I'm trying to assign each of the items in the list a Color, Red, Yellow, and White. This is based on position within the array with 1=Red, 2=Yellow, 3=White and needs to repeat throughout the entire array(4=Red, 5=Yellow, etc.)
I'm having trouble trying to find a way to do this.
I looked into multidimensional arrays but I'm not quite sure that would work the way I need it to. I also thought maybe a for loop could achieve this.
Or do I need to use a different enumerable to assign other values to numbers in an array.
class Program
{
    static void Main(string[] args)
    {
        int[] x = new int[101];
        Random r = new Random();

        int i;
        for (i = 0; i < x.Length; i++)
        {
            var next = 0;
            while (true)
            {
                next = r.Next(101);
                if (!Contains(x, next)) break;
            }

            x[i] = next;
            Console.WriteLine("x[{0}] = {1}", i, x[i]);
        }

        Console.ReadLine();
    }

    static bool Contains(int[] array, int value)
    {
        for (int i = 0; i < array.Length; i++)
        {
            if (array[i] == value) return true;
        }
        return false;
        }
    }
}

A: You dont need randomized number generation - simply generate the numbers 1 to 100 and shuffle them. That is much faster then generating hundreds of random numbers and throwing many away (especially towards the end you "draw" lots of already existent ones by random change and do not use them).
I use poor mans shuffling by generating 100 Guids, taking theire HashCode and order the generated
numnbers by them - thats semi random enough me thinks.
The mapping to colors I solved by generating a dictionary that maps each generated number (in order)
to a color represented as an enum value. The current enum value is shifted with an static extension method I call after each assignment.
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;

public enum Col { Red, Yellow, White }

public static class ColExtension
{
    // Poor mans wrap around iterator for this enum: Red -> Yellow -> White -> Red ...
    public static Col Next(this Col col)
    {
        if (col == Col.Red)
            return Col.Yellow;
        if (col == Col.Yellow)
            return Col.White;
        return Col.Red;
    }
}

internal class Program
{
    public static void Main(string[] args)
    {
        // create numbers ranging from 1 to 100. Pseudo-randomize order by ordering
        // after randomized generated value
        var numbers = Enumerable
          .Range(1, 100).OrderBy(n => Guid.NewGuid().GetHashCode())
          .ToArray();

        // start-color for the first one
        var aktCol = Col.Red;
        var mapping = new Dictionary<int, Col>();
        foreach (var number in numbers)
        {
            // assign first color
            mapping[number] = aktCol;
            // advance color
            aktCol = aktCol.Next();
        }

        foreach (var num in numbers)
            Console.WriteLine($"{num}, {mapping[num]}");

        Console.ReadLine();
    }
}

Output:
66, Red
24, Yellow
36, White
17, Red
86, Yellow
58, White
44, Red
27, Yellow
47, White
91, Red
15, Yellow
31, White
18, Red
25, Yellow
3, White
64, Red
32, Yellow
41, White
67, Red
11, Yellow
72, White
43, Red
9, Yellow
42, White
84, Red
23, Yellow
95, White
14, Red
59, Yellow
22, White
2, Red
76, Yellow
81, White
57, Red
19, Yellow
49, White
80, Red
55, Yellow
13, White
98, Red
1, Yellow
51, White
12, Red
90, Yellow
37, White
65, Red
26, Yellow
83, White
82, Red
61, Yellow
56, White
99, Red
78, Yellow
38, White
71, Red
40, Yellow
29, White
34, Red
93, Yellow
85, White
96, Red
39, Yellow
100, White
33, Red
74, Yellow
87, White
75, Red
92, Yellow
5, White
79, Red
60, Yellow
30, White
77, Red
4, Yellow
70, White
50, Red
16, Yellow
97, White
94, Red
63, Yellow
10, White
7, Red
73, Yellow
46, White
28, Red
45, Yellow
88, White
69, Red
62, Yellow
53, White
54, Red
89, Yellow
8, White
68, Red
20, Yellow
6, White
21, Red
48, Yellow
35, White
52, Red

Essentially you have a fast look-up dictionary for the colors depending on the number and an array for your numbers. I would switch to a List - but thats preference - you probably have a reason to use an array.

If you want to avoid storing the color values explicitly you can also convert the position "on the fly" by leveraging linq and Select using the overloads that provides the value and its index alongside:
    // local converter function - %3 gets the rest of div by 3 so 0=red, 1=yellow,...
    // the %3 makes it wrap around and the enum parse converts it to the enum
    Col ByIndexPos(int pos) => (Col)Enum.Parse(typeof(Col), $"{pos % 3}");

    // On the fly color creation from index position:
    foreach (var anon in numbers.Select( (v, pos) =>
        new { Color = ByIndexPos(pos), Value = v })
    )
        Console.WriteLine($"{anon.Value}, {anon.Color}");

This second approach will shift colors if you modify the base-arrays though - so if you need them to stay attached you could use the Dictionary approach.

Edit after reading some of the questions comments:
If ypu need to postprocess your data you should create a POCO (Struct/Classs) to hold: Number, Position, Color and any other attribute you need for later sorting/manipulations and the methods to operate on this data - OOP to the rescue :)


text:
Q: How to do the next step for login I am learning MySQL and PHP and I trying to build a simple login webpage and connect with MySQL.
I have built the page with HTML and CSS, also I downloaded PHP and installed MySQL, I am getting confused about how to combine those things and when I input my password and username it will go to successful page.
I am not seeking an answer but need some suggestions for the next step.

A: PLEASE NOTE - the way my SQL queries are written here are open to SQL injection (see here to get the changes you would need to make)
So to start. You want to create a database table to store your users, a form to create users, and some code to query the data into the database.
i would start with a form like this:
<form method="post" class="mt-3">
<input type="hidden" name="do" value="create" />

                    First Name
                    <input type="text" class="form-control" name="firstName">

                    Last Name
                    <input type="text" class="form-control" name="lastName">

                    Username
                    <input type="text" class="form-control" name="userName">

                    Password
                    <input type="password" class="form-control" name="passWord">

                Submit
            </form>

then you want some code that will take the values you have in that form and turn them into a query to add that info into your table.
if(isset($_POST['do'])) && $_POST['do'] == 'create'
{
    $firstName = $_POST['firstName'];
    $lastName = $_POST['lastName'];
    $username = $_POST['userName'];
    $password = password_hash($_POST['passWord'], PASSWORD_BCRYPT);

        $sql = "INSERT INTO members (first_name, last_name, username, password) VALUES ('".$firstName."', '".$lastName."', '".$username."', '".$password."')";
        mysqli_query($conn, $sql); //$conn is set in my header file and included into every page.
}

That is pretty much the process for creating a user and adding it to your table, obviously you'll have to break it down and change values to what you have in your table etc.

Next it's the case of verifying a login.

first, a login form:
<form method="post">
        <input type="hidden" name="do" value="login" />

            Username
            <input type="text" class="form-control" id="username" name="username">

            Password
            <input type="password" class="form-control" id="password" name="password">

        <button type="submit" class="btn btn-primary">Login</button>
    </form>

and then an authentication query to follow, this will take the info in the login page, hash the password you entered and then compare it with the one in your database.
if (isset($_POST['do']) && $_POST['do'] == 'login')
{
        $username = $_POST['username'];
        $password = $_POST['password'];

        $sql = "SELECT id, first_name, last_name, password FROM members WHERE username= '$username'";
        $query = mysqli_query($conn, $sql) or die(mysqli_error($conn));

        if($query->num_rows == 0)
        {
            echo "Username or password incorrect";
        }else{
            $data = mysqli_fetch_array($query);
            if(!password_verify($password, $data['password']))
            {
                echo "Username or password incorrect";
            }else{
            session_regenerate_id();
            $_SESSION['loggedin'] = true;
            $_SESSION['username'] = $_POST['username'];
            $_SESSION['member_id'] = $data['id'];
            $_SESSION['first_name'] = $data['first_name'];
            $_SESSION['last_name'] = $data['last_name'];

            }
        }
    }
}
?>

don't be scared about the $_SESSION variables at the bottom, i just set all user data as that so it's easier to access it on other pages, then i just follow with a header to my index.php page. In my header i also check to see that $_SESSION['loggedin'] is set to true and if not it redirects them to the login page (also be care to take into account the user might be on the login page, you dont want a redirect error)
This is my first detailed answer on this site so i hope it helps you :)


text:
Q: Oracle update multiple spaces in a column with a single space I'm trying to update a column that could possibly have a single space or multiple spaces into just one single space using a plain sql statement not pl sql
I could do it through  update table set column_name='' where column_name like '% %'
However, there could be some data such as abc  def in that column. I do not want to disturb the pattern of that data meaning if want to do it only when the column is filled with white space and not touch columns that have any data.

A: With regular expression:
update table set column=regexp_replace(column, ' +', ' ')

A: I would recommend using a regular expression to do this, both to do the replacement and to do the matching:
UPDATE mytable
   SET mycolumn = REGEXP_REPLACE(mycolumn, '\s{2,}', ' ')
 WHERE REGEXP_LIKE(mycolumn, '\s{2,}')

This will replace two or more consecutive whitespace characters (spaces, tabs, etc.) with a single space. If you just want to replace spaces and not tabs, carriage returns, or newlines, use the following:
UPDATE mytable
   SET mycolumn = REGEXP_REPLACE(mycolumn, ' {2,}', ' ')
 WHERE REGEXP_LIKE(mycolumn, ' {2,}')

The reason for using {2,} is so that we don't bother replacing spaces where it need not be done.

A: Try:
update mytable
set col = ' '
where replace (col, ' ', null) is null;

A: I have used regexp_like to solve this
update table set column= ' '
where column in (select column from table where regexp_like('column','^\s+$')
Thanks

A: Try this:
  update product set name = replace(name, '  ', ' ') where name like '%  %';

where the second parameter of replace expression and like ('%  %') contains two blank spaces.
In my case, the result was:
TENIS  NIKE  AIR => TENIS NIKE AIR
TENIS  NIKE  MAN => TENIS NIKE MAN


text:
Q: Scale Down Large Image With AspectRatio android Canvas I want to Scale Down Large Images to Bitmap and Fit it into canvas. I found a solution that works well, But there is a problem it gives black background with the Bitmap. I want just the Image with transparent background.. ! Here is the Code..
Bitmap scaleDownLargeImageWithAspectRatio(Bitmap image)
{
    int imaheVerticalAspectRatio,imageHorizontalAspectRatio;
    float bestFitScalingFactor=0;
    float percesionValue=(float) 0.2;

    //getAspect Ratio of Image
    int imageHeight=(int) (Math.ceil((double) image.getHeight()/100)*100);
    int imageWidth=(int) (Math.ceil((double) image.getWidth()/100)*100);
    int GCD=BigInteger.valueOf(imageHeight).gcd(BigInteger.valueOf(imageWidth)).intValue();
    imaheVerticalAspectRatio=imageHeight/GCD;
    imageHorizontalAspectRatio=imageWidth/GCD;
    Log.i("scaleDownLargeImageWIthAspectRatio","Image Dimensions(W:H): "+imageWidth+":"+imageHeight);
    Log.i("scaleDownLargeImageWIthAspectRatio","Image AspectRatio(W:H): "+imageHorizontalAspectRatio+":"+imaheVerticalAspectRatio);

    //getContainer Dimensions
    int displayWidth = getWindowManager().getDefaultDisplay().getWidth();
    int displayHeight = getWindowManager().getDefaultDisplay().getHeight();
   //I wanted to show the image to fit the entire device, as a best case. So my ccontainer dimensions were displayWidth & displayHeight. For your case, you will need to fetch container dimensions at run time or you can pass static values to these two parameters

    int leftMargin = 0;
    int rightMargin = 0;
    int topMargin = 0;
    int bottomMargin = 0;
    int containerWidth = displayWidth - (leftMargin + rightMargin);
    int containerHeight = displayHeight - (topMargin + bottomMargin);
    Log.i("scaleDownLargeImageWIthAspectRatio","Container dimensions(W:H): "+containerWidth+":"+containerHeight);

    //iterate to get bestFitScaleFactor per constraints
    while((imageHorizontalAspectRatio*bestFitScalingFactor <= containerWidth) &&
            (imaheVerticalAspectRatio*bestFitScalingFactor<= containerHeight))
    {
        bestFitScalingFactor+=percesionValue;
    }

    //return bestFit bitmap
    int bestFitHeight=(int) (imaheVerticalAspectRatio*bestFitScalingFactor);
    int bestFitWidth=(int) (imageHorizontalAspectRatio*bestFitScalingFactor);
    Log.i("scaleDownLargeImageWIthAspectRatio","bestFitScalingFactor: "+bestFitScalingFactor);
    Log.i("scaleDownLargeImageWIthAspectRatio","bestFitOutPutDimesions(W:H): "+bestFitWidth+":"+bestFitHeight);
    image=Bitmap.createScaledBitmap(image, bestFitWidth,bestFitHeight, true);
    int leftPadding=(containerWidth-image.getWidth())/2;
    int topPadding=(containerHeight-image.getHeight())/4;
    Bitmap backDrop=Bitmap.createBitmap(containerWidth, containerHeight, Bitmap.Config.RGB_565);
    Canvas can = new Canvas(backDrop);
    can.drawBitmap(image, leftPadding, topPadding, null);
    return backDrop;
}

A: ok. just remove
int leftPadding=(containerWidth-image.getWidth())/2;

int topPadding=(containerHeight-image.getHeight())/4;

these two lines and check.


text:
Q: Where clause for only one table in a left join I have two tables, the first is 'actions' which has columns 'id' and 'actionname', the second is 'completedactions' which has 'userid' and 'actionid'. They look as follows:
Table: actions

 id | actionname
 ==============
  1 | An action
  2 | Another
  3 | ect
  4 | ect

actions is a table of actions a user can make

-
Table: completedactions

 userid | actionid
 ==============
   1    |  1
   1    |  2
   1    |  3
   2    |  3
   3    |  2
   3    |  4

completedactions holds the userid and action id for each action made

I want to join the tables to give a list of all actions and which of those actions have been made by a given user, specified somewhere in the query. So from this example I'd like to see something like:
 id | actionname | Complete by userid=1?
 =======================================
  1 | An action  | 1
  2 | Another    | 1
  3 | ect        | 1
  4 | ect        | Null

I've tried a left join and have managed to get a list of all actions but there are duplicate entries when multiple users have taken an action, one for each user to have made the action. I then added a where clause at the end compledtedactions.userid="1" but I then lose all actions that haven't been made by that user.
I can't seem to have a where clause for only one table in the left join so how else should I be going about this?

A: Try using your WHERE condition in your ON() clause instead, i.e., ON (c.actionid = a.id AND c.user_id = 1).
The WHERE filter will apply on the whole resultset, while an additional condition in the join will join the matched results and give null for non-matched results.
SELECT a.*,c.user_id FROM
actions a
LEFT JOIN completedactions c
ON (c.actionid = a.id AND c.user_id = 1)

A: select
  actions.id,
  actions.actionname,
  count(completedactions.actionid)
from actions
left join completedactions
  on completedactions.actionid = actions.id and completedactions.userid = 1
group by 1,2

A: select * from actions
left outer join completedactions on ( completedactions.actionid = actions.id and completedactions.userid=1 )

A: its will be help full if any body have need to use it.
select `m`.`id` AS `id`,
`m`.`CategoryParentId` AS `CategoryParentId`,
`m`.`CategoryChildId` AS `CategoryChildId`,
`p`.`CategoryName` AS `ParentCategory`,
`c`.`CategoryName` AS `ChildCategory`,
count(c_p.category_id) AS `prodcuts`,
`img`.`image` AS `CategoryImage`,
`img2`.`image` AS `thumbImage`
from (((((`tblcategoryparentchildassociations` `m`
    left join `tblmastercategories` `c` on((`c`.`id` =  `m`.`CategoryChildId`)))
    left join `tblmastercategories` `p` on((`p`.`id` = `m`.`CategoryParentId`)))
    left join `vwimagetypeassociations` `img` on((`c`.`id` = `img`.`domainid` AND `img`.`imagetypeid` = 2 AND `img`.`status` = 1 )))
    left join `vwimagetypeassociations` `img2` on((`c`.`id`= `img`.`domainid`AND `img2`.`imagetypeid` = 3 AND `img`.`status` = 1)))
    left join `tblproductcategoriesassociations` `c_p` on((`m`.`CategoryChildId` = `c_p`.`category_id`)))
group by m.id


text:
Q: Add Xaml hyperlink to rectangle I am trying to add a hyperlink to a xaml rectangle and it's not working. I tried adding hyperlink with a button and it works. How can I add hyperlink to a group of rectangle for the code below.
How to give Hyperlink for below Code
<Rectangle Fill="Red" HorizontalAlignment="Left" Height="38" Margin="1038,74,0,0" Stroke="Black" VerticalAlignment="Top" Width="426"/>
            <TextBlock HorizontalAlignment="Left" Margin="1173,82,0,0" TextWrapping="Wrap" Text="Pending Sites " VerticalAlignment="Top" Height="24" Width="142" Foreground="#FFF7F6F1" FontSize="20" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto">
                <TextBlock.RenderTransform>
                    <CompositeTransform Rotation="-0.098"/>
                </TextBlock.RenderTransform>
            </TextBlock>

Code I tried with Button which is working fine
<Button Content="Click to go to desc page" Click="Button_Click_1" Margin="62,376,0,357"/>
 private void Button_Click_1(object sender, RoutedEventArgs e)
        {
           this.Frame.Navigate(typeof(dPlanner2x.MyPageDetails));
        }

A: Rather than trying to turn a Rectangle into a click-able object, you are much better off if you apply a Style to a Button.
An example of a Style to change the look of a Button is given below:
<Style x:Key="btnCommand" TargetType="{x:Type Button}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}">
                <Border Name="rct"
                        TextBlock.Foreground="White"
                        Background="DarkGray"
                        BorderBrush="DarkGray"
                        BorderThickness="1"
                        Cursor="Hand"
                        UseLayoutRounding="True"
                        SnapsToDevicePixels="True"
                        Margin="10"
                        Height="24"
                        MinWidth="75">
                    <ContentPresenter TextBlock.FontStyle="Segoe UI Semibold"
                                      TextBlock.FontSize="14"/>
                </Border>

                <ControlTemplate.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter TargetName="rct"
                                Property="TextBlock.Foreground"
                                Value="DarkGray" />
                        <Setter TargetName="rct"
                                Property="Background"
                                Value="LightGray" />
                        <Setter TargetName="rct"
                                Property="BorderBrush"
                                Value="DarkGray" />
                    </Trigger>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter TargetName="rct"
                                Property="TextBlock.Foreground"
                                Value="DarkGray" />
                        <Setter TargetName="rct"
                                Property="Background"
                                Value="White" />
                        <Setter TargetName="rct"
                                Property="BorderBrush"
                                Value="LightGray" />
                    </Trigger>

                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Obviously, you will want something that looks completely different, but the Style template above can be easily modified to fit your needs.


text:
Q: How to handle the website pop up using Java in Selenium Web driver in Mozilla? I have to enter the user id and password for the pop up appears as part of my website authentication and proceed further . I have referred few threads which is 5 years old and not working
How to handle login pop up window using Selenium WebDriver?
Any one have solution recently for this . I need to enter user name and password and click ok and proceed further
enter image description here


text:
Q: C# 2D to 3D coordinates OpenGL I am trying to write an algorithm to convert my mouse click to 3D coordinates (to insert an object at this point).
I have "ground" level where Y = 0 and I want to calculate X and Z based on my mouse click. My function currently looks like that:
Point p = this.control.PointToClient(new Point(System.Windows.Forms.Cursor.Position.X, System.Windows.Forms.Cursor.Position.Y));

Vector3 pos = GeometryHelper.Unproject(new Vector3(p.X, 0f, p.Y), viewport.X, viewport.Y, viewport.Width, viewport.Height, projectionPlane.Near, projectionPlane.Far, Matrix4.Invert(mProjectionMatrix * camera.GetViewMatrix()));
active.applyGeometry(pos);

function applyGeometry simply sets the position of an object. I believe passed arguments are self-explanatory.
My Unproject function looks this way:
public static Vector3 Unproject(Vector3 vector, float x, float y, float width, float height, float minZ, float maxZ, Matrix4 inverseWorldViewProjection)
        {
            Vector4 result;

            result.X = ((((vector.X - x) / width) * 2.0f) - 1.0f);
            result.Y = ((((vector.Y - y) / height) * 2.0f) - 1.0f);
            result.Z = (((vector.Z / (maxZ - minZ)) * 2.0f) - 1.0f);

            result.X =
                result.X * inverseWorldViewProjection.M11 +
                result.Y * inverseWorldViewProjection.M21 +
                result.Z * inverseWorldViewProjection.M31 +
                inverseWorldViewProjection.M41;

            result.Y =
                result.X * inverseWorldViewProjection.M12 +
                result.Y * inverseWorldViewProjection.M22 +
                result.Z * inverseWorldViewProjection.M32 +
                inverseWorldViewProjection.M42;

            result.Z =
                result.X * inverseWorldViewProjection.M13 +
                result.Y * inverseWorldViewProjection.M23 +
                result.Z * inverseWorldViewProjection.M33 +
                inverseWorldViewProjection.M43;

            result.W =
                result.X * inverseWorldViewProjection.M14 +
                result.Y * inverseWorldViewProjection.M24 +
                result.Z * inverseWorldViewProjection.M34 +
                inverseWorldViewProjection.M44;

            result /= result.W;

            return new Vector3(result.X, result.Y, result.Z);
        }

The problem is that Unproject function returns result close to 0,0,0 and that makes my object appear around 0,0,0. Any idea how to modify it to work properly?
Update
I believe I have given enough details on this case, but in case you'd need something else to help me out just do not hesitate to tell me ; )


text:
Q: Decode Stream to CSV in Python by Byte (Translate from C# code) I am trying to consume a streamed response in Python from a soap API, and output a CSV file. The response outputs a string coded in base 64, which I do not know what to do with. Also the api documentation says that the response must be read to a destination buffer-by-buffer.
Here is the C# code was provided by the api's documentation:
byte[] buffer = new byte[4000];
bool endOfStream = false;
int bytesRead = 0;
using (FileStream localFileStream = new FileStream(destinationPath, FileMode.Create, FileAccess.Write))
{
   using (Stream remoteStream = client.DownloadFile(jobId))
   {
     while (!endOfStream)
     {
         bytesRead = remoteStream.Read(buffer, 0, buffer.Length);
         if (bytesRead > 0)
         {
              localFileStream.Write(buffer, 0, bytesRead);
              totalBytes += bytesRead;
         }
         else
         {
              endOfStream = true;
         }
      }
   }
}

I have tried many different things to get this stream to a readable csv file, but non have worked.
with open('test.csv', 'w') as f: f.write(FileString)

Returns a csv with the base64 string spread over multiple lines
Here is my latest attempt:
with open('csvfile13.csv', 'wb') as csvfile:
          FileString = client.service.DownloadFile(yyy.JobId, False)
          stream = io.BytesIO(str(FileString))
          with open(stream,"rt",4000) as readstream:
             csvfile.write(readstream)

This produces the error:

TypeError: coercing to Unicode: need string or buffer, _io.BytesIO

Any help would be greatly appreciated, even if it is just to point me in the right direction. I will be ensure to award the points to whoever is the most helpful, even if I do not completely solve the issue!
I have asked several questions similar to this one, but I have yet to find an answer that works completely:
 What is the Python equivalent to FileStream in C#?
Write Streamed Response(file-like object) to CSV file Byte by Byte in Python
How to replicate C# 'byte' and 'Write' in Python
Let me know if you need further clarification!
Update:
I have tried  print(base64.b64decode(str(FileString)))
This gives me a page full of webdings like

]�P�O�J��Y��KW �

I have also tried
for data in client.service.DownloadFile(yyy.JobId, False):
    print data

But this just loops through the output character by characater like any other string.
I have also managed to get a long string of bytes like \xbc\x97_D\xfb(not actual bytes, just similar format) by decoding the entire string, but I do not know how to make this readable.
Edit: Corrected the output of the sample python, added more example code, formatting

A: It sounds like you need to use the base64 module to decode the downloaded data.
It might be as simple as:
with open(destinationPath, 'w') as localFile:
    remoteFile = client.service.DownloadFile(yyy.JobId, False)
    remoteData = str(remoteFile).decode('base64')
    localFile.write(remoteData)

I suggest you break the problem down and determine what data you have at each stage. For example what exactly are you getting back from client.service.DownloadFile?
Decoding your sample downloaded data (given in the comments):
'UEsYAItH7brgsgPutAG\AoAYYAYa='.decode('base64')

gives
'PK\x18\x00\x8bG\xed\xba\xe0\xb2\x03\xee\xb4\x01\x80\xa0\x06\x18\x01\x86'

This looks suspiciously like a ZIP file header. I suggest you rename the file .zip and open it as such to investigate.
If remoteData is a ZIP something like the following should extract and write your CSV.
import io
import zipfile

remoteFile = client.service.DownloadFile(yyy.JobId, False)
remoteData = str(remoteFile).decode('base64')

zipStream = io.BytesIO(remoteData)
z = zipfile.ZipFile(zipStream, 'r')
csvData = z.read(z.infolist()[0])

with open(destinationPath, 'w') as localFile:
    localFile.write(csvData)

Note: BASE64 can have some variations regarding padding and alternate character mapping but once you can see the data it should be reasonably clear what you need. Of course carefully read the documentation on your SOAP interface.

A: Are you sure FileString is a Base64 string?  Based on the source code here, suds.sax.text.Text is a subclass of Unicode.  You can write this to a file as you would a normal string but whatever you use to read the data from the file may corrupt it unless it's UTF-8-encoded.
You can try writing your Text object to a UTF-8-encoded file using io.open:
import io
with io.open('/path/to/my/file.txt', 'w', encoding='utf_8') as f:
    f.write(FileString)

Bear in mind, your console or text editor may have trouble displaying non-ASCII characters but that doesn't mean they're not encoded properly.  Another way to inspect them is to open the file back up in the Python interactive shell:
import io
with io.open('/path/to/my/file.txt', 'r', encoding='utf_8') as f:
    next(f) # displays the representation of the first line of the file as a Unicode object

In Python 3, you can even use the built-in csv to parse the file, however in Python 2, you'll need to pip install backports.csv because the built-in module doesn't work with Unicode objects:
from backports import csv
import io
with io.open('/path/to/my/file.txt', 'r', encoding='utf_8') as f:
    r = csv.reader(f)
    next(r) # displays the representation of the first line of the file as a list of Unicode objects (each value separated)


text:
Q: When will I need to use binary search instead of linear search? How many binary searches need be performed in an n-element table to buy back the preprocessing time required to sort the table?

A: It's a tricky question, because it depends on algorithm you use for sorting, binary search implementation details and so on.
Without knowledge of specific implementations, we can start analysis only in terms of Big-O notation (but it's not accurate, as complexity for algorithm O(2n) equal to O(n), but take roughly two times more)
Analysis
Binary search = O(logn)
Sorting       = O(nlogn)
Linear search = O(n)

You need to perform K searches. So for the raw unsorted array a[n] for different searches you need
Binary Search

*

*Sort

*Search k times
TOTAL(BS) = O(logn) + k * O(logn)
Linear Search

*

*Just search k times
TOTAL(LS) = k * O(n)
Now, try to solve the equation, by comparing k and n
nlogn + klogn < kn
log(n^n) + log(n^k) < kn
log(n^(n+k)) < kn
n^(n+k) < 2^kn
2^kn - n^(n+k) > 0

(I am not mathematician, this is as simplest as I can get)
Now when you have input for your algorithms N and K, just evaluate last expression, to find minimum K to win with binary search.
Example
Assume n = 1000
2^(1000k) - 1000^(1000+k) > 0
This expression holds true when k > 10,
For n = 10000, expression holds true when k > 9
Conclusion
If you array is greather then 1000 elements, you need perform at least 10 binary searches to return sort investment

A: Binary search is used when you have data in sorted order. Binary search will give you performance of O(logn). If you have more searches rather than insertions then binary search will give improved performance.  where as linear search is O(n). Linear search can be used when data is not order.


text:
Q: Pointer Subtraction in C with an array If I have the following lines of code, why is b-a = 2?
int a[] = {1,2,3,4,5};
int *b = &(a[2]);

A: To elaborate slightly on Eugene's answer, a is a pointer to the beginning of the array, and a[2] is the same as *(a+2).
So you could say that the & "cancels" the * as you dereference the pointer and then look at the address of the element that it points to. So *b = &(a[2]) = &(*(a+2)) = a+2.
Therefore b-a=2


text: Q: Unable to connect with internet on Kali Linux using dualboot I am trying to connect my laptop to mobile data using usb cable. It shows that it is connected , but when I am unable to run various sites on browser. When I am trying to ping google.com it's shows name or service not known