text:
Q: Scrapy-splash No module named scrapy_splash. Broken pip I installed scrapy_splash using pip install
python3 -m pip freeze shows scrapy-splash==0.7.2
However, when I ran spider i get following error
ImportError: No module named scrapy_splash

I suspect that i have problem with some environmental paths.
which python
/usr/bin/python
echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/bin/python3

but somehow pip fails
pip --version
bash: /usr/local/bin/pip: /usr/local/bin/python3.7: bad interpreter
if not specified as python3.5 -m pip
I have only python2.7 and python3.5 installed, i removed python3.7 installed from source but it seems that some link is left somewhere which breaks pip, which puts splash in wrong directory. How can i fix it in least painful way?
pip and pip3 is located in /usr/local/bin

A: That's why people use virtual environments. You should not mix your system Python installation with your project-dependant stuff.
Starting with Python 3.3, you can create new virtual environment venv in current directory like this:
python3 -m venv venv

Then do
cd venv
source venv/bin/activate
pip install -U pip <project-dependencies>

and you should be good to go.

A: You can upgrade/reinstall pip, which should fix the link, with
python3 -m pip install -U --ignore-installed pip

This will (probably) make your global pip command run it on that Python 3 interpreter.


text:
Q: Error when creating object implements interface: The class doesn't have a constructor I just tried today to develop a new app in Kotlin about grabbing data from any website using Volley. I encounter a problem when creating an StringRequest instance and I don't know how to solve it.
I get this error when creating object Response.Listener<String> and Response.ErrorListener:

The class doesn't have a constructor

The code is below:
class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        Btn.setOnClickListener {
            val queue = Volley.newRequestQueue(this)
            val url = "http://www.google.com"
            val stringRequest = StringRequest(Request.Method.GET, url,
                    object:Response.Listener<String>() {
                        override  fun onResponse(response:String) {
                            // Display the first 500 characters of the response string.
                            textView.setText("Response is: " + response.substring(0, 500))
                        }
                    }, object:Response.ErrorListener() {
                        override fun onErrorResponse(error:VolleyError) {
                            textView.setText("That didn't work!")
                        }
                    })
            queue.add(stringRequest)
        }
    }
}

Thank you in advance.

A: When you create an object which implements an interface, curly braces () is not needed, since interface does not have a constructor. On the other hand, when you create an object which extends a class, curly braces is needed. For example:
interface MyListener {
    fun success()
}

abstract class MyAbstractClass {
    abstract fun fail()
}

//Create an object which extends MyAbstractClass and implements MyListener
val impl = object: MyAbstractClass(), MyListener {
    override fun success() { TODO() }
    override fun fail() { TODO() }
}

So, you need to remove the curly braces for Response.Listener and Response.ErrorListener:
val stringRequest = StringRequest(Request.Method.GET, url,
        object: Response.Listener<String> {
            override fun onResponse(response:String) {
                // Display the first 500 characters of the response string.
                textView.setText("Response is: " + response.substring(0, 500))
            }
        }, object: Response.ErrorListener {
            override fun onErrorResponse(error:VolleyError) {
                textView.setText("That didn't work!")
            }
        })

Since Response.Listener and Response.ErrorListener is SAM type defined in Java and Kotlin supports SAM conversions, you may simplify the code in this way:
val stringRequest = StringRequest(Request.Method.GET, url,
        Response.Listener<String> {
            response ->
                // Display the first 500 characters of the response string.
                textView.setText("Response is: " + response.substring(0, 500))
        }, Response.ErrorListener {
            error ->
                textView.setText("That didn't work!")
        })

//Or even
val stringRequest = StringRequest(Request.Method.GET, url,
        Response.Listener<String> {
            // Display the first 500 characters of the response string.
            textView.setText("Response is: " + it.substring(0, 500))
        }, Response.ErrorListener {
            textView.setText("That didn't work!")
        })

Notes: SAM conversion is not supported for interfaces defined in Kotlin at this moment.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Another way to pass a value across WebForms If I use a Server.Transfer command with a true value passed for the "PreserveForm" 2nd param's value:
Default.aspx:
  Server.Transfer("WebForm1.aspx", True)

...I can access the value of the textbox "TextBox1" control on the first page, Default.aspx, from "WebForm1.aspx" as follows:
 lblPassedValue.Text = Request.Form("ctl00$MainContent$TextBox1")

I know that I can control the way that IDs are generated in Visual Studio 2010, but how about controlling the NAME property?
I would like it to read:
 lblPassedValue.Text = Request.Form("TextBox1")

I'd also rather use ASP.NET Textbox controls rather than a native HTML textbox.

A: Server.Transfer("Page.aspx", True)
On Page.aspx:
<%@ PreviousPageType VirtualPath="~/SenderPage.aspx" %>

Dim Test = CType(Me.PreviousPage.FindControl("TextBox1"), TextBox).Text


text:
Q: WebRTC ScreenCapturerAndroid I'm trying to create a screen capturer app for android. I already have the webRTC portion setup with a video capturer using Camera2Enumerator library from here. How can I modify this to create a pre-recorded video capturer instead of camera capturer.
Thanks!

A: Just wanted to give an update that I have solved this. I'm unable to share the entire code but here's a process that might help:

*

*Acquire one frame of your pre-recorded file and store in a byte array(must be in YUV format)

*Replace the VideoCapturer() with the following:
fun onGetFrame(p0: ByteArray?) {

    var timestampNS = java.util.concurrent.TimeUnit.MILLISECONDS.toNanos(SystemClock.elapsedRealtime())

    var buffer:NV21Buffer = NV21Buffer(p0,288,352,null)

    var videoFrame:VideoFrame = VideoFrame(buffer,0,timestampNS)

    localVideoSource.capturerObserver.onFrameCaptured(videoFrame)

    videoFrame.release()

}

where p0 is the byte array with the frame

*Call this function in startLocalVideoCapture() using a timer (every few milliseconds...I used 10 nanoseconds) https://developer.android.com/reference/android/os/CountDownTimer

*remove this line in startLocalVideoCapture()--->
VideoCapturer.initialize(
            surfaceTextureHelper,
            localVideoOutput.context,
            localVideoSource.capturerObserver)


text:
Q: Create .exe manually in Visual Studio 2012 When we build solution, exe is created automatically in \bin\Release or \bin\Debug. Is there any way to create .exe manually(not publishing) in visual studio. I already posted this question
visual studio not creating .exe
Manually mean command line or some thing like..... other than using build

A: Your question is not so clear.
But if you meaning to commandline you can build with MSBuild, DEVENV and NMake (link)
you also can build with csc.exe (link)


text:
Q: I am trying to load image from server using asynctask in android but images don't get displayed.I don't know why? My code is :
public class MainActivity extends ActionBarActivity  {

    String URL1 = "http://cs619925.vk.me/v619925510/1b82b/0nTm-Pj0ABM.jpg";
    String URL2 = "http://8tracks.imgix.net/i/000/955/740/87318.original-8382.jpg?rect=128,0,768,768&q=65&sharp=15&vib=10&fm=jpg&fit=max&w=200&h=200";
    String URL3 = "http://a400.idata.over-blog.com/300x225/1/89/70/64/Autres-images/smiley-face-on-beach.jpg";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ImageView myFirstImage = (ImageView) findViewById(R.id.iv1);
        ImageView mySecondImage = (ImageView) findViewById(R.id.iv2);
        ImageView myThirdImage = (ImageView) findViewById(R.id.iv3);

        myFirstImage.setTag(URL1);
        mySecondImage.setTag(URL2);
        myThirdImage.setTag(URL3);

        new DownloadImagesTask().execute(myFirstImage);
        new DownloadImagesTask().execute(mySecondImage);
        new DownloadImagesTask().execute(myThirdImage);

    }

        public class DownloadImagesTask extends AsyncTask<ImageView, Void, Bitmap> {

            ImageView imageView = null;

            protected Bitmap doInBackground(ImageView... imageViews) {
                this.imageView = imageViews[0];
                return download_Image((String)imageView.getTag());
            }

            protected void onPostExecute(Bitmap result) {
                imageView.setImageBitmap(result);
            }

            private Bitmap download_Image(String url) {

                Bitmap bmp =null;
                try{
                    URL ulrn = new URL(url);
                    HttpURLConnection con = (HttpURLConnection)ulrn.openConnection();
                    InputStream is = con.getInputStream();
                    bmp = BitmapFactory.decodeStream(is);
                    if (null != bmp)
                        return bmp;

                    }catch(Exception e){}
                return bmp;
            }
        }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

On running it on the emulator, I don't get images displayed. Help me with this one.And I don't even know what the eroor is? if there is any.

A: if you want download file or if you want load image into imageview, then
 use picasso:
Picasso.with(context).load(URL1).into(myFirstImage);

public class MainActivity extends ActionBarActivity  {

String URL1 = "http://cs619925.vk.me/v619925510/1b82b/0nTm-Pj0ABM.jpg";
String URL2 = "http://8tracks.imgix.net/i/000/955/740/87318.original-8382.jpg?rect=128,0,768,768&q=65&sharp=15&vib=10&fm=jpg&fit=max&w=200&h=200";
String URL3 = "http://a400.idata.over-blog.com/300x225/1/89/70/64/Autres-images/smiley-face-on-beach.jpg";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ImageView myFirstImage = (ImageView) findViewById(R.id.iv1);
    ImageView mySecondImage = (ImageView) findViewById(R.id.iv2);
    ImageView myThirdImage = (ImageView) findViewById(R.id.iv3);

     Picasso.with(this).load(URL1).into(myFirstImage);
     Picasso.with(this).load(URL2).into(mySecondImage);
     Picasso.with(this).load(URL3).into(myThirdImage);

   }
 }

A: You can easily download image using Picasso and Glide library.


text:
Q: How to support UIStackView in versions below iOS9 UIStackView is new feature in iOS9. If my app also support iOS8 or below version. Then how i can work  with UIStackview?

A: You can use https://github.com/tomvanzummeren/TZStackView
It has the same API as UIStackView, so will be easy to move over to UIStackView once you're ready to drop pre-iOS 9 devices.


text:
Q: exterior powers of representations which are irreducible/not irreducible For the symmetric group $S_n$, let $V$ denotes the $n-1$ dimensional standard representation.
Then an exercise in Fulton-Harris says that for $k=0,1,\cdots,n-1$, the $k$-th exterior powers of $V$ are still irreducible representations of $S_n$.
My question is related, and it is not about this specific group. Instead, I was looking for an example of a group $G$ different from $S_n$.
Q. Is there example of a finite group $G$, different from $S_n$, with an irreducible representation $V$ of dimension $>1$, such that
(1) For some $k\geq 2$, the $k$-th exterior power of $V$ is irreducible.
(2) For some $r\geq 2$, the $r$-th exterior power of $V$ is not irreducible.
Further, I will appreciate if I could find the required example of group of small orders, and also the powers are easy to compute by hand (instead of verifying it by computer programs such as GAP).


text:
Q: Can multiple email clients use the same POP3 account? I have a webmail account with POP3 enabled.  I use Microsoft Outlook 2007 with this account, and it works well.
However, I'm curious as to what happens when I set up the same POP3 account elsewhere (say a Windows Phone 7), how does that work?  Will the mail in Outlook and the Windows Phone sync or will I have issues or what?  Can only one be set up at a time?

A: When a POP3 mailbox is accessed and emptied on a certain device, another device won't be able to receive the received mail as well. However, most mail clients offer an option to "Leave message copy on the server". This will allow other devices to access the same mail also.
For sync purposes however, you might want to check if your provider offers IMAP as a service.


text:
Q: How to set up system path for Ruby? I am doing prep work for app academy. The final stage before I am done with my prep work is to complete a ruby intro course called "Test First Ruby".
The first line after you install Rspec is to enter the course directory. In the terminal it is "cd learn_ruby", simple enough, except it returns back a message that says "the system cannot find the path specified". I have been noticing this message on certain commands for all of my ruby learning thus far and I am just wondering what does this mean? And how can I fix this?
Any help would be great.

A: cd means 'change directory'. The error you are getting is that the directory is not existant in the location your command line is in.
This looks like a reasonable intro to UNIX filesystem: http://www.doc.ic.ac.uk/~wjk/UnixIntro/Lecture2.html
UNIX reference: http://sunsite.utk.edu/UNIX-help/quickref.html

A: Create the directory before you cd into it:
mkdir learn_ruby
cd learn_ruby
Do check out AJcodez's links to familiarize yourself with Unix filesystem commands.


text:
Q: What's the ideal setup for a quick turnaround in Java EE development? I'm currently struggling with the project setup while implementing a Java EE 6 application with Eclipse Indigo and JBoss 6. The application server and the IDE is pretty much set in the project. Maven 3 is used and was the base for the setup by using the WELD archetype and creating a WAR.
Now, the problem is, that I'm very disappointed about the development turnaround. I don't have a working automatic redeploying within eclipse and often need to restart JBoss since it gets confused with the new publishing and then is not able to redeploy correctly. This is very frustrating and time consuming. (Plus I feel the smirks behind me from the guys preferring script languages.)
From earlier projects we were using Seam 2 and the project created by seam-gen came with a somewhat decent republishing, although I still had to do a manual application restart whenever I changed Java classes. Then, from playing around with Netbeans 7 and the integrated GlassFish 3.1 I found that automatic redeployment was working ok. And since Java EE 6 is very wide spread, I assume, there must be a better setup than I have now.
So with this post I hope to get some more insight in having a good project setup for fluent development of Java EE 6 based WAR projects on JBoss and eclipse - who can share some best practices?
Thanks a lot!

A: You should use JBoss Tools plugins for Eclipse. JBoss Tools 3.3M2 is compatible with Indigo and JBoss AS 7 (which is 10 times faster than JBoss 6 for redeploy).
Regarding an equivalent to Seam Gen with CDI, you should really take a look to Seam Forge which is included in JBoss Tools 3.3 now.
Finally I'm using Jrebel to reload class and configuration without restarting the server. But for now it doesn't work yet with JBoss AS 7, so if you stick with JBoss AS 6 it's a goof combination.

A: This might not be the answer to your question, but if you want Java and fast turnaround look at http://www.playframework.org/ your script colleagues will be astounded.

A: For Eclipse to work well, use Eclipse Java EE edition and then add the JBoss server adapter.
The usual WTP-tooling then works for automatic deployments etc.


text:
Q: Cucumber vs Junit I'd like to ask what's the practical difference between Cucumber and JUnit. I haven't worked with Cucumber at all; found some documentation but I'd greatly appreciate some feedback from someone who has worked with both (interested in a high lvl overview).
To break it down - what i'm interested in (I'll be using Selenium and not Protractor) :

*

*Are there any things that Cucumber can't do vs Junit.

*What's easier to use (coding, how fast you can write the tests) ?

*Both work with Page Objects?

Some things that i need to get done

*

*Test css styling

*Test page responsiveness

*Standard operation on WebElements (clicking, getting data etc)

*Asserts.

Anything in addition to this is more than welcomed. Greatly appreciate your answer on this, thank you!

A: Simply spoken, those two work on completely different levels of abstraction.
JUnit is mainly an automation framework; giving you the ability to rapidly write down test cases using the Java programming language. It provides annotations that make to easily declare: "this method over here is a JUnit test". It was intended as framework for unit tests; but many people also use it to drive full scale "integration" or "function" tests.
Cucumber on the other hand works on a much higher level of abstraction. You start by writing "test descriptions" in pure text. Leading to probably the key difference: you don't need a to know Java to write a cucumber test (you just need a java programmer to provide the "glue code" that allows Cucumber to turn your text input into some executable piece of code).
In that sense, you are somehow asking us to compare apples and turnips here; as one would be using these two toolsets for a different set of "problem solution". But as lined out; you can also use JUnit to drive "bigger" tests; so the main differentiation between these two tools is the level of abstraction that you are dealing with.
EDIT: your comment is correct; as those tools are for different "settings", you shouldn't expect that a non-technical person alone will be able to use cucumber to write good tests covering everything. Cucumber is a nice way to enable non-technical participation for creating tests; but in the end, you are solving technical (java related) problems; thus you need Java programming expertise at some point. Either "within the same person"; or at least within different people in your team.

A: Cucumber seems to make something more user friendly but I don't think business analysts really care what it is. Ultimately developers have to write unit tests, integration tests , cucumber tests (so Cucumber makes no sense for developer who has already written unit tests & integration tests & Business analyst don't care because they have already provided what they want).

A: JUnit and Cucumber are aiming at different goals. They are rather complement to each other than replace each other.

Are there any things that Cucumber can't do vs Junit.

There isn't anything you can do with JUnit that you can't do with Cucumber. And the other way around.
The difference is that while JUnit aims at tests, Cucumber aims at collaboration with non technical people. Non technical people will not understand what a unit test does. They will, however, be able to understand and validate an example written in Gherkin.

What's easier to use (coding, how fast you can write the tests) ?

There is more overhead when you use Cucumber. You will have to implement each step as a method and not just one test method as you would do if you used JUnit. The readability you gain from expressing examples using plain text is sometimes worth the extra work.

Both work with Page Objects?

Page Objects are an abstraction for the web page you are verifying. It is a class you write as developer/tester. The Page Objects can be used by both JUnit and Cucumber. In fact, there is no difference between the tools from that perspective.
The choice to use JUnit or Cucumber is a matter of granularity and audience.
A work flow that works well is to mix the tools. Define examples of how the application should work using BDD, (Cucumber, Gherkin). Implement these scenarios using Cucumber. Then, use JUnit to work out details that may be important but not necessary important for the business stakeholders at a high level. Think of corner cases that are important but are too much details for your stakeholders.
An image that describes this mix is available here: https://cucumber.io/images/home/bdd-cycle.png
I wrote blog post a while back where I talk about the right tool for the job: http://www.thinkcode.se/blog/2016/07/25/the-right-tool-for-the-job
The right tool may be Cucumber. It can also be JUnit. It all depends on your audience.


text:
Q: Composer require custom package caching problem I created a package and at first I had it on an online repository @Gitlab.To use to repository I used composer.json file and added:
"repositories": [
    {
        "type": "vcs",
        "url": "https://remote-repo-url-path-to-package.git"
    }
]

That worked locally, but the moment I tried publishing it, it couldn't access it, connection time out.
I tried publishing my package on packagist, so I removed that "repositories" from my composer.json and executed composer clearcache and did a composer install. All packages are being installed correctly, but the package that's now on packagist is still trying to fetch it from my git remote repo. Weird!
So I have two issues:

*

*When using Gitlab public/private repo I can't connect to fetch the composer package

*When I than removed that link, I keeps fetching it from the repository instead of packagist.

Any ideas? :) Thanks!


text:
Q: microsevice apigateway pattern I'm working on a user web on a new project where I need to maintain good response time for each request. I'm wondering what are the microservice patterns I should be using.
I have been reading up on "api-gateway" pattern where the gateway is the service orchestrator. As I understand API should call the services synchronously in order to grantee the logical flow of the business. That really reduces some of the advantages reactive gives.
Other way is to make the api gateway asynchronous, then state needs to be maintained for each request so when service replies are received, it can be mapped to correct request and continue the flow.
I have been searching on this topic but could not find too many useful articles. Can you please share your thought or point me to some articles which discuss this topic.
Thank you !

A: The first optimization you should make should always be the most effective one. Look at your most expensive operation. For me, and I believe this will prove true for most developers, it's communicating between services. Whether it's from your API Gateway to data services, from data services to their databases, the goal should be to minimize that. So yes, the first thing you should do is make your API-Gateway requests happen in parallel as it talks to this service. Otherwise instead of doing (essentially) 1 call to a service (since they happen at the same time) you would be doing N calls, where N is the number of services. Big time loss there.

A: making a call synchronous does not mean that it cant be reactive, reactive represents the way your app server will deal with request either using a thread pool (which is a limited resource) vs using a reactive approach you dispatch response as you have then. the second approach can still give you synchronous responses to your clients (web or mobile apps)


text:
Q: Easy selection of APKs in appium when testing same application but different APK files for different environments First an introduction to the problem.
We have been testing 5 websites that has 3 instances of testing environments (testing environment, pre-production environment and production environment), so, 3 different URLs, but exact same website.
The workaround with selenium-webdriver and ruby that we use is to set an environment variable, and in the webdriver test cases, we add a "case" in the "before" section of the tests, so is easier to set which instance we need to run our tests.
Now, problem is, that we are starting to use appium to test our APKs, and we are facing the same situation, we have some APKs, that also has 3 instances of testing environments.
Now the question is, if it's possible to implement this with appium, we have the appium.txt but maybe there's another method in which we can have the capabilities and apk in the same ruby file, so we can use a "case" as we do with the websites, because we can't use a case in the appium.txt file.
Here's the appium.txt file:
[caps]
platformName = "Android"
deviceName = "Android"
app = "./application.apk"
appPackage = "com.application.android.player"
appActivity = ".Main"

And here's my spec_helper.rb file:
# encoding: UTF-8
require 'rubygems'
require 'appium_lib'

def setup_driver
  return if $driver
  @caps = Appium.load_appium_txt file: File.join(Dir.pwd, 'appium.txt')
  if using_sauce
    upload_app
  end
  $driver=Appium::Driver.new(@caps)
end

RSpec.configure do |config|

  config.before(:each) do
    $driver.start_driver
    set_wait(10) #Implicit Wait
    wait = Selenium::WebDriver::Wait.new(:timeout => 30)
    wait.until { find_element(:name,'TÉRMINOS Y CONDICIONES') }
    find_element(:id, 'com.application.android.player:id/acceptButton').click
  end

  config.after(:each) do
    $driver.driver_quit
  end

end


text:
Q: Editing/Updating one of the results in a search query I'm creating a page that searches for an item and then be able to edit/update it. I was able to do it when it returns just one result but when it gives me multiple results I could only edit the very last item. Below is my code:
.......
$dj =$_POST[djnum];
$sql= "SELECT * From dj WHERE datajack LIKE '$dj%'";
$result = mysql_query($sql);
    //more code in here//

while ($info =mysql_fetch_array($result)) {

    // display the result
echo "<form action=\"dj_update.php\" method=\"POST\"><input type=\"hidden\" name=\"djnumber\" value=\"".$info['datajack']."\">";
echo "
DJ ".$info['datajack']."	";
echo "".$info['building']." 	";
echo "Rm ".$info['room']." 	";
echo "".$info['switch']." 	";
echo "".$info['port']." 	";
echo "".$info['notes']." 	";
echo "<input type=\"Submit\" value=\"Edit\" >
";
}

// more code here //

Then this is the screen shot of the result:

The idea is the user should be able to click on "Edit" and be able to edit/update that particular item. But when I click any of the Edit button I could only edit the last item. What am I missing here? Is there an easier way to do this?
Thanks guys and Happy new year!

A: There's no form closing tag - it should be added after each "Edit" button.
Now, since forms are not closed, there are several hidden inputs with the same "djnumber" in each form, and I suppose, browser sends only one value - which is specified in your last row.
So, adding the following at the end of your loop:
echo "</form>";

should help.

A: What are the values for datajack?
If the values are datajack1, datajack2 etc then a LIKE will return the first one every time, you need to make your query more specific.
$sql = "SELECT * From dj WHERE datajack id ' " . mysql_escape_string($id) . "' LIMIT 1";

I have changed the query to match one row and also use an id field, using LIKE in this situation is bad, you want to edit a specific row, not a row that is potentially LIKE the row you thought you were editing.
Note the use of mysql_escape_string() too to stop MySQL Injection techniques.
Hope that helps.


text:
Q: Bulbs: g.vertices.index.lookup(dpi=dpid_str) not working as expected I am using TitanGraphDB + Cassandra.I am starting Titan as follows
cd titan-cassandra-0.3.1
bin/titan.sh config/titan-server-rexster.xml config/titan-server-cassandra.properties

I have a Rexster shell that I can use to communicate to Titan+Cassandra above.
cd rexster-console-2.3.0
bin/rexster-console.sh

I want to program the Titan Graph DB from my python program.I am using bulbs package for that.
I create 3 types of vertices from python using bulbs as given below.
The 3 types of vertices are
- switch
- port
- device

from bulbs.titan import Graph
 vswitch = self.g.vertices.get_or_create('dpid',dpid_str,{'state':'active','dpid':dpid_str,'type':'switch'})
 vport   = self.g.vertices.get_or_create('port_id',port_id,{'desc':desc,'port_id':port_id,'state':state,'port_state':port_state,'number':number,'type':'port'})

If I try to print out the variables vswitch,vport and vdevice I get the following results.
vswitch     <Vertex: http://localhost:8182/graphs/graph/vertices/4>
vport       <Vertex: http://localhost:8182/graphs/graph/vertices/28>

However If I try to retrieve the above vertices using a key as follows.
vswitch = self.g.vertices.index.lookup(dpid=dpid_str)
vport   = self.g.vertices.index.lookup(port_id=port_id_str)

And try to print-out vswitch and vport variables I get the following values
<generator object <genexpr> at 0x26d6370>)
<generator object <genexpr> at 0x26d63c0>

Am I doing something WRONG in trying to retrieve vertices as above using g.vertices.index.lookup(dpid=dpid_str)

A: The Bulbs g.vertices.index.lookup() method returns a Python generator (which is a type of iterator).
Use next() to get the next value in the generator:
>>> # lookup() returns an generator (can return more than 1 value)

>>> switches = self.g.vertices.index.lookup(dpid=dpid_str)
>>> switch = switches.next()

>>> ports   = self.g.vertices.index.lookup(port_id=port_id_str)
>>> port = ports.next()

Or you can use list() to turn the generator into a Python list:
>>> switches = self.g.vertices.index.lookup(dpid=dpid_str)
>>> list(switches)

>>> ports   = self.g.vertices.index.lookup(port_id=port_id_str)
>>> list(ports)

However, if the indexed item is unique, you can use the get_unique() method to return one value or None:
# returns 1 vertex or None (errors if more than 1)
>>> vertex = g.vertices.index.get_unique( "dpid", dpid_str)

See...
Rexter index documentation:

*

*http://bulbflow.com/docs/api/bulbs/rexster/indices/
index.lookup()
https://github.com/espeed/bulbs/blob/afa28ccbacd2fb92e0039800090b8aa8bf2c6813/bulbs/titan/index.py#L251
index.get_unique()
https://github.com/espeed/bulbs/blob/afa28ccbacd2fb92e0039800090b8aa8bf2c6813/bulbs/titan/index.py#L274

NOTE: Iterators and generators are Python programming basics -- they're used everywhere and are not specific to Bulbs -- if you're new
  to Python programming, see my answer to How Can I Learn to Program in
  Python? for a list of good online resources for learning to program in Python.


text:
Q: Amazon S3 get size for particular object and files and folders in it I am storing each my users data in a bucket with his username object inside a bucket. like my bucket is "my.bucket/bob1" "my.bucket/bob2" and so on. I can get the size of the bucket by using the Amazon S3. $s3->get_bucket_filesize($bucket,true);
 But i need to calculate the size of the "my.bucket/bob1" I tried to use
$s3->get_object_filesize($bucket, "bob1");

But this returns only the size of that object and which is 0 as on my client side i am treating it like a folder.
But i need to get the size of the users folder level in an efficient way for cost and time.
EDIT:
Used Below code But this is very slow, i have thousands of files from 1KB to 1GB+ and this code is taking too much time.
    function get_size($bucket,$path,$s3){
    $size = 0;

    $response = $s3->list_objects($bucket,array(
    'prefix' => $path.'/'

));
        foreach ($response->body as $object)
        {
            //print_r($object);
             $object->Key.'('.$object->Size.')</br>';
            $size  = $size+$object->Size;

        }
       // $size = number_format($size / 1024 / 1024, 2);

        return $size;
    }

A: You can use the following code to get your folder size. This will return 0 if there is no files in it, otherwise this will sum size of all files in the folder and return you the size in GB, MB, or KB.
public function FolderSize($folder) {
    $s3 = S3Client::factory(array(
                'key' => "your key",
                'secret' => "your secret key",
    ));

    $size = 0;
    $bucket = "your bucket name";
    $objects = $s3->getIterator('ListObjects', array(
        "Bucket" => $bucket, // or env('AWS_BUCKET')
        "Prefix" => $folder
    ));
    foreach ($objects as $object) {
        $size = $size+$object['Size'];
    }

    return $this->formatSizeUnits($size);

}
public function formatSizeUnits($bytes) {
    if ($bytes >= 1073741824) {
        $bytes = number_format($bytes / 1073741824, 2) . ' GB';
    } elseif ($bytes >= 1048576) {
        $bytes = number_format($bytes / 1048576, 2) . ' MB';
    } elseif ($bytes >= 1024) {
        $bytes = number_format($bytes / 1024, 2) . ' KB';
    } elseif ($bytes > 1) {
        $bytes = $bytes . ' bytes';
    } elseif ($bytes == 1) {
        $bytes = $bytes . ' byte';
    } else {
        $bytes = '0 bytes';
    }
    return $bytes;
}

A: Use following two functions:
First to retrieve all objects:
$objs = $awsobject->fetchObjs('folderpath/','bucket_name');

Second to get the size of the retrieved objects
$used = $awsobject->folderSizeRawPrettyFromSource($objs);

It would return size in MBs.

A: Please try the below code using getObjectInfo.
$objInfo = $s3->getObjectInfo($bucket, "bob1");
echo $objInfo['size'];


text:
Q: Prepend region lines with given string Emacs has a function called indent-region and some similar functions, which insert some predefined string at the beginning of the lines within the selected region.
Instead, I want an interactive function that inserts a string given by user input at the beginning of the lines within the selected region. What emacs-lisp code can do this?

A: Easiest way to do this is to make use of a rectangle.
It's kind of difficult to present, but basically you can use C-x r t to insert a text on each line of a rectangle. You make a rectangle by starting with the pointer at, say, line 1, C-Space, move cursor down the amount of lines you want, and hit C-x r t following by entering the text.
Here's the documentation.


text:
Q: Hyperlinks with(out) protocol What are the pros and cons of having protocols in your hyperlinks versus not having them in "a", "base" etc elements? When I store a significant amount of URIs in an XML file, a database or just in HTML documents I always feel inclined to leave out the http: and https: part of the URI because browsers, at least modern ones, will know what to do and usually, perhaps always, the webserver will be able to deal with the wrong protocol and refer to the correct one (between HTTP/HTTPS).

A: You seem to know about the pros of protocol-relative URIs.
Cons might be:

*

*The links probably won't work in a non-HTTP or non-HTTPS context (e.g., if your content is part of an email, or if your HTML page is opened locally)

*Some older browsers don't support protocol-relative URIs (e.g., Internet Explorer 6)

*Some older browsers fetch protocol-relative linked resources twice, via HTTP and HTTPS (e.g., Internet Explorer 7+8)

Of course some resource should always be delivered via HTTPS, so don't use protocol-relative URIs for these, enforce HTTPS instead.
And you should probably not use protocol-relative URIs for things like rel-canonical.


text:
Q: how to use Angularjs to generate a list of sequential number in the inner loop I have 2 ng-repeat nested one in another.

   x.name

{{ how to write the expression here ?}}

So I want to have it look like:
Food
  1
  2
  3
Water
  4
  5
Vegy
  6
  7
etc...

Can anybody figure it out?
Thank you.

A: You can achieve this just using CSS, irrespective of what items belongs to:
CSS:
body {
  counter-reset: items;
}
.item:before {
  counter-increment: items;
  content: counter(items) ".\00A0\00A0";
}

HTML:

Edit: Plunker.


text:
Q: What is the difference between Kernel density estimation and Parzen window estimation? I was reading about non-parametric density estimation when I found out about Kernel Density Estimation (KDE) and Parzen window estimation. Although the text book states both are the same, the equation form seems to be different:
For Kernel density estimation (KDE) 3D data

For Parzen-window estimation in 3D data

Can any one help with this?


text:
Q: Отображение файлов с форматом .gif из базы mysql Файлы с форматом .gif сохраняются также, как и обычные статичные картинки? Обычные картинки отображаются на сайте с помощью ссылки из базы данных mysql, например: 'background: url("http://localhost:8080/files/836982cc-a40b-4037-b7e3-344f2aa9aecf")'. Но с гифками так не работает, примерно такое же реализовано на сайте https://tenor.com/, я посмотрел через консоль и там что-то похожее, как я хочу сделать.
Код для сохранения файл с помощью Spring в базу данных mysql взял с этого сайта https://www.bezkoder.com/spring-boot-file-upload/, в интернете про гифки ничего не нашёл.
Фронт - angular 13, бэк - Spring


text:
Q: SQL Selecting and filtering by multiply values Could you help me solve my problem?
I have table:
id     | party_id |  tag_id
_______|__________|__________
 1     |     5    |    1
 2     |     5    |    2
 3     |     5    |    3
 4     |     7    |    1
 5     |     7    |    6
 6     |     7    |    8
 7     |     7    |    9
 8     |     9    |    7
 9     |     9    |    6

I need to get a table in which the values are the same parties_id's that are strictly passed tags (like filtering):
example:
tag_id = 1 and 3
I should get:
party_id = 5
The problem is i couldn't use WHERE IN because is OR operator, but I need AND
What one query do you recommend for this SELECT?

A: I recommend using group by with a having clause.  This is a so-called "set-within-sets" query.  Here is an example:
select party_id
from table t
group by party_id
having sum(tag_id = 1) > 0 and sum(tag_id = 3) > 0;

Each condition in the having clause counts the number of tags of a certain type for a given party_id.  The > 0 ensures that at least one is present.

A: You're right that the IN operator can't require a match of all of the things in the right side list, but you can AND multiple IN expressions.
SELECT DISTINCT party_id
FROM testtable
WHERE
  party_id IN (SELECT party_id FROM testtable WHERE tag_id = 1)
  AND party_id IN (SELECT party_id FROM testtable WHERE tag_id = 3);

SQLFiddle: http://sqlfiddle.com/#!2/8b4a15/1/0


text:
Q: Find my iPhone useless in case of stole?
Possible Duplicate:
Lost iPhone, what action to take?

Consider this scenario:

*

*A thief stole my iPhone.

*I disable my iphone on www.icloud.com

*The thief in the meanwhile reinstall iOS

Does Find my iPhone is useful in this scenario?

A: If you wipe the phone, no.
If they wipe the phone, no.
I'm going to close this, but feel free to flag or edit it if you feel there is something missing from these answers.


text:
Q: Downloading excel sheet, if there is any errors while uploading it I am using Apache POI for generating Excel file. And I am using struts framework and jsp as frontend. I am doing uploading and downloading both using a single action class...
HSSFWorkbook workbook =Excel.createSummary();

---- This function returns HSSFWorkbook, which i want to download
I am using the below code to download the excelsheet
HttpServletResponse response = ServletActionContext.getResponse();
              response.setHeader("Content-Disposition", "attachment;filename='"
              + fileName + "'");
              ServletOutputStream out = response.getOutputStream();

              workbook.write(out);

            out.flush();
          out.close();

The above code is downloading excel sheet fine but still its showing the following error in console like
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: getOutputStream() has already been called for this response
    at org.apache.catalina.connector.Response.getWriter(Response.java:578)
    at org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:212)
    at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:109)
    at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:115)
    at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:108)
    at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:175)
    at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:120)
    at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
    at org.apache.jsp.index_jsp._jspService(index_jsp.java:644)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:431)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:721)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:584)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:523)
    at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:156)
    at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
    at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
    at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)
    at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:306)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
    at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
    at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)

Sep 24, 2015 5:47:53 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [default] in context with path [] threw exception
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed
    at org.apache.catalina.connector.ResponseFacade.sendError(ResponseFacade.java:462)
    at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:770)
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:505)
    at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
    at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)

I have tried so many things regarding this error but I didn't get proper answer.. Any suggestions will be appreciated and if you can, please explain why this error is comming

A: You need to

*

*return a STREAM result, with the appropriate ContentType for an Excel file, or

*writing directly to the response like you are doing, but returning Action.NONE that is the default Struts2 result to prevent writing twice to the response.

The first way is preferred, because is the default one provided by the framework.
For real life examples and more info, check:

*

*How to open an Excel sheet in browser using Java+Struts2?

*Dynamic file download without saving file in the server

*duplicate headers recieved from server


text:
Q: PHPUnit + Selenium 2.35 = BadMethodCallException My English is not so good. Sorry.
I have:
PHPUnit 3.7.24
Selenium 2.35.0

I am starting selenium server:
java -jar /usr/local/bin/selenium-server-standalone-2.35.0.jar

Output:
04.09.2013 13:51:15 org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
13:51:25.373 INFO - Java: Sun Microsystems Inc. 20.45-b01
13:51:25.374 INFO - OS: Linux 3.8.0-29-generic i386
13:51:25.388 INFO - v2.35.0, with Core v2.35.0. Built from revision c916b9d
13:51:25.542 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
13:51:25.543 INFO - Version Jetty/5.1.x
13:51:25.544 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
13:51:25.545 INFO - Started HttpContext[/selenium-server,/selenium-server]
13:51:25.546 INFO - Started HttpContext[/,/]
13:51:25.567 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@dda25b
13:51:25.567 INFO - Started HttpContext[/wd,/wd]
13:51:25.571 INFO - Started SocketListener on 0.0.0.0:4444
13:51:25.577 INFO - Started org.openqa.jetty.jetty.Server@b61fd1

My simple test:
public function testTitle()
{
    $this->url('/');
    $this->assertEquals('My title.', $this->title());
}

Next, run phpunit test with command:
phpunit --debug functional/MainPageTest.php

Output:
PHPUnit 3.7.24 by Sebastian Bergmann.

Configuration read from /home/demyan112rv/www/boo/protected/tests/phpunit.xml
Starting test 'MainPageTest::testTitle'.
E

Time: 17.59 seconds, Memory: 2.75Mb
There was 1 error:

1) MainPageTest::testTitle
PHP Warning:  include(PHPUnit_Extensions_Story_TestCase.php): failed to open stream: No such file or directory in /home/demyan112rv/www/yii/YiiBase.php on line 421
PHP Warning:  include(): Failed opening 'PHPUnit_Extensions_Story_TestCase.php' for inclusion (include_path='.:/home/demyan112rv/www/boo/protected/helpers:/home/demyan112rv/www/boo/protected/widgets:/home/demyan112rv/www/boo/protected/extensions/mail:/home/demyan112rv/www/boo/protected/services:/home/demyan112rv/www/boo/protected/components:/home/demyan112rv/www/boo/protected/models:/usr/share/php:/usr/share/pear') in /home/demyan112rv/www/yii/YiiBase.php on line 421
BadMethodCallException: The command http://localhost:4444/wd/hub/session/url is not recognized by the server.

/home/demyan112rv/www/yii/test/CWeb2TestCase.php:60
/home/demyan112rv/www/boo/protected/tests/functional/MainPageTest.php:11
/home/demyan112rv/www/boo/protected/tests/functional/MainPageTest.php:11

FAILURES!
Tests: 1, Assertions: 0, Errors: 1.

And in this time in selenium server a have next output:
13:55:39.438 INFO - Executing: [new session: {browserName=firefox}] at URL: /session)
13:55:39.452 INFO - Creating a new session for Capabilities [{browserName=firefox}]
13:55:56.642 INFO - Done: /session

I have error "BadMethodCallException: The command http:/ /localhost:4444/wd/hub/session/url is not recognized by the server.". This bug fixed for 2.35 in this link , but i have 2.35 and i have this error.
How to fix this problem?
Solution (i don't may answer on my question, because my rating is less than 10.
$ whereis phpunit
phpunit: /usr/bin/phpunit /usr/bin/X11/phpunit /usr/local/bin/phpunit

I have 3 path to phphunit. I don't know, it's normal or no.
When i changed command from:
phpunit --debug functional/MainPageTest.php

to
/usr/bin/phpunit --debug functional/MainPageTest.php

it's working!!!

A: if you have setUp your browser launch method i.e

    function setUp()
      {
        $this->setBrowser("*firefox");
        $this->setBrowserUrl("http://www.google.com/");
      }

your function should look like this

    public function testTitle()
    {
        $this->open('/');
        $this->assertEquals('My title.', $this->title());
    }

I've changed $this -> url('/'); to $this -> open('/');
please try now.


text:
Q: Return value in a quite nested for-loop I want nested loops to test whether all elements match the condition and then to return True. Example:
There's a given text file: file.txt, which includes lines of this pattern:

aaa:bb3:3
fff:cc3:4

Letters, colon, alphanumeric, colon, integer, newline.
Generally, I want to test whether all lines matches this pattern. However, in this function I would like to check whether the first column includes only letters.
def opener(file):
    #Opens a file and creates a list of lines
    fi=open(file).read().splitlines()
    import string
    res = True
    for i in fi:
        #Checks whether any characters in the first column is not a letter
        if any(j not in string.ascii_letters for j in i.split(':')[0]):
             res = False
        else:
            continue
    return res

However, the function returns False even if all characters in the first column are letters. I would like to ask you for the explanation, too.

A: Your code evaluates the empty line after your code - hence False :
Your file contains a newline after its last line, hence your code checks the line after your last data which does not fullfill your test- that is why you get False no matter the input:

aaa:bb3:3
fff:cc3:4
                    empty line that does not start with only letters

You can fix it if you "spezial treat" empty lines if they occur at the end. If you have an empty line in between filled ones you return False as well:
with open("t.txt","w") as f:
    f.write("""aaa:bb3:3
fff:cc3:4
""")

import string
def opener(file):
    letters = string.ascii_letters
    # Opens a file and creates a list of lines
    with open(file) as fi:
        res = True
        empty_line_found = False
        for i in fi:
            if i.strip(): # only check line if not empty
                if empty_line_found:  # we had an empty line and now a filled line: error
                    return False
            #Checks whether any characters in the first column is not a letter
                if any(j not in letters for j in i.strip().split(':')[0]):
                    return False   # immediately exit - no need to test the rest of the file
            else:
                empty_line_found = True

    return res # or True

print (opener("t.txt"))

Output:
True

If you use
# example with a file that contains an empty line between data lines - NOT ok
with open("t.txt","w") as f:
    f.write("""aaa:bb3:3

fff:cc3:4
""")

or
# example for file that contains empty line after data - which is ok
with open("t.txt","w") as f:
    f.write("""aaa:bb3:3
ff2f:cc3:4

""")

you get:  False

A: Colonoscopy

*

*ASCII, and UNICODE, both define character 0x3A as COLON. This character looks like two dots, one over the other: :

*ASCII, and UNICODE, both define character 0x3B as SEMICOLON. This character looks like a dot over a comma: ;
You were consistent in your use of the colon in your example: fff:cc3:4 and you were consistent in your use of the word semicolon in your descriptive text: Letters, semicolon, alphanumeric, semicolon, integer, newline.
I'm going to assume you meant colon (':') since that is the character you typed. If not, you should change it to a semicolon (';') everywhere necessary.
Your Code
Here is your code, for reference:
def opener(file):
    #Opens a file and creates a list of lines
    fi=open(file).read().splitlines()
    import string
    res = True
    for i in fi:
        #Checks whether any characters in the first column is not a letter
        if any(j not in string.ascii_letters for j in i.split(':')[0]):
             res = False
        else:
            continue
    return res

Your Problem
The problem you asked about was the function always returning false. The example you gave included a blank line between the first example and the second. I would caution you to watch out for spaces or tabs in those blank lines. You can fix this by explicitly catching blank lines and skipping over them:
for i in fi:
    if i.isspace():
        # skip blank lines
        continue

Some Other Problems
Now here are some other things you might not have noticed:

*

*You provided a nice comment in your function. That should have been a docstring:
def opener(file):
    """ Opens a file and creates a list of lines.
    """

*You import string in the middle of your function. Don't do that. Move the import
up to the top of the module:
import string # at top of file

def opener(file):   # Not at top of file

*You opened the file with open() and never closed it. This is exactly why the with keyword was added to python:
with open(file) as infile:
    fi = infile.read().splitlines()

*You opened the file, read its entire contents into memory, then split it into lines
discarding the newlines at the end. All so that you could split it by colons and ignore
everything but the first field.
It would have been simpler to just call readlines() on the file:
with open(file) as infile:
    fi = infile.readlines()

    res = True

    for i in fi:

It would have been even easier and even simpler to just iterate on the file directly:
with open(file) as infile:
    res = True
    for i in infile:

*It seems like you are building up towards checking the entire format you gave at the beginning. I suspect a regular expression would be (1) easier to write and maintain; (2) easier to understand later; and (3) faster to execute. Both now, for this simple case, and later when you have more rules in place:
import logging
import re

bad_lines = 0
for line in infile:
    if line.isspace():
        continue
    if re.match(valid_line, line):
        continue
    logging.warn(f"Bad line: {line}")
    bad_lines += 1
return bad_lines == 0

*Your names are bad. Your function includes the names file, fi, i, j, and res. The only one that barely makes sense is file.
Considering that you are asking people to read your code and help you find a problem, please, please use better names. If you just replaced those names with file (same), infile, line, ch, and result the code gets more readable. If you restructured the code using standard Python best practices, like with, it gets even more readable. (And has fewer bugs!)


text:
Q: Adding elements to a binary Search tree without an order I am learning about Binary Search Trees and had a question asking me to add things to a tree and draw what it would look like.
All the ones before this question specified something like "Assume the tree uses Alphabetical ordering to compare words" but this time it doesn't say that.
Is there a default sorting order to sort strings or int's when adding them to a tree?
For context, it asks me to:
    Draw a picture below of the binary search
    tree that would result from inserting the following words into an empty
    binary search tree in the following order: Legolas, Frodo, Sam, Merry,
    Pippin, Aragorn, Gimli, Boromir.

A: Since the question specifically says "Binary search trees", you can compare node using the Lexicographical order (Alphabetical Order) while inserting nodes in the tree.
for your example the tree would look like :
                                     Legolas

            Frodo                                                 Sam

  Aaragon              Gimili                             Merry

        Boromir                                               Pippin


text:
Q: English words that are both nouns and "connectors"? I am trying to solve a word puzzle that contains several sentences, two of which are presented below, and I have to figure out the missing words represented by the variables W1–W3:

There is a W1 in the W2 W3 is near where the road bends which contains very important items.
  For instance, the top of the W3 is on the counter.

What's stumping me is W3. The only words I can think of that would syntactically fit for the first sentence are which and that:

*

*There is a W1 in the W2 which is near where the road bends which contains very important items.

*There is a W1 in the W2 that is near where the road bends which contains very important items.

But neither of those is syntactically correct for the second sentence:

For instance, the top of the which is on the counter.
  For instance, the top of the that is on the counter.

It seems as though W3 is both a noun and a "connector word" (not sure what the proper term is). It seems to be a noun because it apparently has a top side ("...the top of the W3..."). And it seems to be a "connector" because it can be used in a similar context of which/that (which out of ignorance I am referring to when I say "connector word").
So my question is:
Are there words in the English language that fit the bill of being both nouns and "connectors"? If so, what are they called and what are some examples of them?

A: There is no word (at least not one that's common, non-archaic and that I know) that functions as a noun where you can use "the", and also functions as a subordinating conjunction — which is the term for your "connector."
Going by this web page, absolutely none of these words work for W3 in both instances.
I think your puzzle is incorrect or unsolvable.

A: This puzzle has the air of a literary bar bet, where, if I were offering this challenge, I would also tell my marks that expletives are allowed, just to throw them further astray.
You can't overlook the fact that some words can be elided, and the conjunction that is one that is often omitted without any loss in meaning. This is referred to as the expletive that, which is described in the Guide to Grammar and Writing:

Omitting That
The word that is used as a conjunction to connect a subordinate clause to a preceding verb. In this construction that is sometimes called the "expletive that." Indeed, the word is often omitted to good effect, but the very fact of easy omission causes some editors to take out the red pen and strike out the conjunction that wherever it appears.

So, now you can forget about a connector or conjunction and begin to look for something else.
What self-respecting bar bet would expect to follow unstated rules, and why not mislead further, by allowing any of your missing words to be both a common word (including nouns) and a proper name?
Thus the first usage of W3 does not need an accompanying article like the or a, IF IT IS A PROPER NAME THAT IS ALSO A NOUN.
So, just taking a wild stab at some words (I'm not claiming this is an ideal answer), your solution might look like this, or something similar:

There is a COLLECTION in the HOUSE (that) CANE is near where the road bends which contains very important items.
For Instance, the top of the CANE is on the counter.

If you've read this far and are stammering "But, but, but..." or some such, then you may want to avoid bar bets for the time being.


text:
Q: Is it grammatically correct to place the object of preposition before the preposition? In conversation, it's normal to say:

What time do you have to be at the train station by?

Note: What time do you have to be at the train station vs What time do you have to be at the train station by, mean 2 completely different things, right?
1) The question in the title
2) Whether by is a preposition or not.
Winston Churchill once said

"That is the sort of thing up with which I will not put!

A: In informal registers, when a wh-interrogative pronoun is the object of a preposition, it is common for the preposition to shift to clause-final position:

What book are you interested in?
Who are you baking a cake for?
What school do her children go to?
Who did he come to the dance with?

If a "heavier" sentence element like a prepositional phrase intervenes, one can also hear:

Who did he come with to the spring dance?

In more formal registers, stranded prepositions such as these might be considered out of place, but simply slapping the preposition in front of the interrogative can yield an awkward sentence:

In what book are you interested? Better:What book interests you? What book are you interested in reading?
To what school do her children go? Better: What school do her children attend? Where do her children go to school?

Beginning a question with with or for whom will not, in formal registers, cause odd stares.
According to the source cited above:

With which card did you pay?

is just as acceptable in formal registers as informal.
Grammar is not absolute, but contextual. In informal settings, no one but the most dessicated pedant would insist the stranded preposition in these questions is a grammatical error.

The difference in meaning between your example sentences is minimal. By has the air of the future perfect about it: "By what time will you need to have arrived at the station to catch your train?" Just asking what time you need to get to the station asks only for a single point of arrival. In any case, the answer is going to be the same.
By, by the way, is a preposition whose object is the what-phrase.

The supposed Churchill quote ridiculing a narrow hyperprescriptivism is purported to have originally read:

This is the sort of bloody nonsense up with which I will not put.

This sounds a lot more like Churchill, but, alas, the chances of the statesman ever having actually uttered the sentence seem rather slim.


text:
Q: Google App Script - getCommenter I'm brand new to Google Apps Script, and I'm trying to create a simple spreadsheet that will allow me to share files by user email through a single spreadsheet.
I have written the following script, which will allow me to add editors and viewers, but not commenters.
I keep getting an error that states that the function addCommenter cannot be found in object spreadsheet.
function shareSheet () {

    var ss = SpreadsheetApp.getActiveSpreadsheet();
    ss.toast('Updating access level...');
    var sheet = ss.getSheets()[0];
    var lastRow = sheet.getLastRow();
    var range1 = sheet.getRange (3,1, lastRow,9);
    var data = range1.getValues();

    for (var i= 0; i < data.length; i++) {
        var row = data [i];
        var accessLevel = row [5];
        var values = row [8];
        var ss2 = SpreadsheetApp.openById(values);
        var values2 = row [4];

        // Add new editor
        if (accessLevel == 'Edit') {
           var addEditors = ss2.addEditor(values2);
        }

        // Add new viewer
        if (accessLevel == 'View'){
            var addViewers = ss2.addViewer(values2);
        }

        // Add new commenter
        if (accessLevel == 'Comment') {
            var addCommenters = ss2.addCommenter(values2);
        }
    }
}

A: The Spreadsheet object does not support the addCommentor() method. You should use DriveApp service instead.
DriveApp.getFileById(id).addCommenter(emailAddress)


text:
Q: Mathematics for Space-Piracy I have been developing a science fiction novel, and something akin to the following mathematics problem has arisen: (Assume Newtonian mechanics for the moment.)
Alice is a medium-distance space-hauler, and has to move her cargo in a straight line from point $A$ to point $B$, a distance of $9\times 10^{12}$ meters. Because high accelerations are uncomfortable for humans over long intervals, Alice will be accelerating towards point B for the first half of her journey at $+10 \ m/s^2$, and switching to $-10 \ m/s^2$ to slow down halfway through.
Blorb, a freaky alien space pirate, has plans to plunder Alice's booty, and due to his alien physiology can tolerate accelerations up to $\pm 25 \ m/s^2$. If he must leave $24$ hours after Alice to avoid making his intentions obvious, what is the soonest he can intercept Alice, assuming he must match not only her position, but also her velocity to properly board her ship?

A: The only flight plans that matter are: accelerate towards $B$ for time $t_1$, then accelerate towards $A$ for the rest of time (say until $t_2$). Doing anything else wastes time.
Proof: suppose for time $t_a$ through $t_b$ you didn't accelerate (or did so less than the maximum). Now consider accelerating towards $B$ for some small period of time, then decelerate for some period of time such that your start and end speed are unchanged. You then have a faster average speed so you use less time to cover that same distance.
We simply give the total distance and ending velocity of such a flight plan, and you can get simultaneous equations for Alice and Blorb matching at true-clock time $t$.
From a standing start, accelerating continuously gives you
$$\begin{align*}v(t)&=a(t-t_0)\\x(t)&=\frac{1}{2}a(t-t_0)^2\end{align*}$$
by directly integrating $v(t)$. Therefore at the turnover point, your current physical coordinates are
$v_1=v(t_1)=a(t_1-t_0), x_1=x(t_1)=\frac{1}{2}(t_1-t_0)^2$.
Next, consider the retrograde acceleration phase which gives you
$$\begin{align*}v(t)&=v_1-a(t-t_1)\\x(t)&=x_1+v_1(t-t_1)-\frac{1}{2}a(t-t_1)^2\end{align*}$$
again by direct integration $\int_{t_1}^tv(t)\,\mathrm{d}t$.
Let Alice's head start be $s$, to match velocities at unknown intercept time $t$ and Blorb turnaround time $t_1$, $0\leq t_1\leq t$ we have
$$a_Bt_1-a_B(t-t_1)=a_A(t+s)\quad\Rightarrow\quad t_1=\frac{1}{2}\left((1+a)t+as\right)$$
where we're going to nondimensionalize by letting $a=\frac{a_A}{a_B}$.
Plug that into the constraint matching positions at time $t$:
$$\begin{align*}
\frac{1}{2}t_1^2+t_1(t-t_1)-\frac{1}{2}(t-t_1)^2&=\frac{1}{2}a(t+s)^2\\
-t_1^2+2t_1t-\frac{1}{2}t^2&=\frac{1}{2}a(t+s)^2\\
(1-a^2)t^2-2as(1+a)t-as^2(2+a)&=0\\
t&=\frac{s}{1-a}\left(a+\sqrt{\frac{2a}{1+a}}\right)
\end{align*}$$
Tedious but straightforward.
With the actual numbers in the question, the results are
$$\begin{align*}
t&=46\!:\!14\!:\!13.7\text{ (+1 day head start)}\\
t_1&=37\!:\!09\!:\!57.6\\
d&=3.1968\times10^{11}\text{m}
\end{align*}$$
so Alice gets caught just under 3 days out, about 3.5% of the way there.

A: The intercept happens well before Alice reaches halfway, simplifying calculations. The optimal solution is a bang-bang control.
Alice's velocity at time $t$ seconds after Blorb departs will be $v_A(t)=10(t+D)$ m/s (where $D=86400$s), and their position will be
$$ x_A(t) = 5(t+D)^2\text{ m}. $$
(Integrate $v(t')$ from $t'=-D$ to $t'=t$)
So Alice reaches the halfway point roughly 14.5 ($=\frac{\sqrt{9/5\times10^{12}}-D}{D}$) days after Blorb departs. This is plenty of time for Blorb to catch up.
Blorb's strategy is to accelerate at 25m/s for as long as possible, and just at the right moment start to decelerate at 25m/s until the positions and velocities are equal. We have two unknowns, $t_1$, the time at which Blorb starts decelerating, and $t_2$ the time at which the ships meet. We require $x_A(t_2)=x_B(t_2)$ and $v_A(t_2)=v_B(t_2)$ where the A subscript refers to Alice's ship and the B subscript to Blorb's.
For Blorb's ship, the acceleration is $a_B(t)=25$ if $t<t_1$ and $-25$ is $t>t_1$. The velocity therefore is
$$v_B(t) = \begin{cases} 25t &\text{if $t<t_1$} \\ 25t_1-25(t-t_1) & \text{if $t>t_1$} \end{cases}=\begin{cases} 25t &\text{if $t<t_1$} \\ 50t_1-25t & \text{if $t>t_1$} \end{cases} $$
To get the position we integrate again,
$$x_B(t) =\begin{cases} 12.5t^2 &\text{if $t<t_1$} \\ 12.5t_1^2+50t_1(t-t_1)-12.5(t^2-t_1^2) & \text{if $t>t_1$} \end{cases} $$
Now solve the equations matching velocities and positions to find deceleration time $t_1$ and intercept time $t_2$. The velocities give
$$50t_1-25t_2=10(t_2+D)$$
and positions give
$$12.5t_1^2+50t_1(t_2-t_1)-12.5(t_2^2-t_1^2)=5(t_2+D)^2. $$
The first equation gives
$$t_1=\frac{35t_2+10D}{50}=\frac{7t_2+2D}{10}$$
and then the second gives a complicated quadratic for $t_2$,
$$12.5\left(\frac{7t_2+2D}{10}\right)^2+50\frac{7t_2+2D}{10}\left(t_2-\frac{7t_2+2D}{10}\right)-12.5\left(t_2^2-\left(\frac{7t_2+2D}{10}\right)^2\right)=5(t_2+D)^2$$
with solution $$t_2=\frac{14+10\sqrt{7}}{21}D,$$ so
$$ t_1 = \frac{2+\sqrt{7}}{3}D. $$
This gives the deceleration time as approximately 133798s or 1 day 13 hours and 9 minutes, and the intercept time as approximately 166454s or 1 day 22 hours and 14 minutes (these times are after Blorb departs, not Alice). Add 24 hours for the times for Alice (she gets caught in just under 3 days).


text:
Q: sql query count number of record in a join I have to extract the list of POS(point of service) from pos table, based on location name:
POS
+----------+--------------+------+-----+---------+----------------+
| Field    | Type         | Null | Key | Default | Extra          |
+----------+--------------+------+-----+---------+----------------+
| id       | int(11)      | NO   | PRI | NULL    | auto_increment |
| name     | varchar(100) | NO   |     | NULL    |                |
| address  | varchar(200) | YES  |     | NULL    |                |
| country  | varchar(45)  | YES  |     | NULL    |                |
| location | varchar(100) | YES  |     | NULL    |                |
+----------+--------------+------+-----+---------+----------------+

so, it would be something like :
select *
from pos
where location = 'new york';

Now , from the table mission i have to count the number of POS (pos_name), and if this number is greater than a number coming from a subquery, pos register should not be shown.
mission
| id                      | int(11)       | NO   | PRI | NULL              | auto_increment              |
| team_name               | varchar(45)   | YES  |     | NULL              |                             |
| team_photo              | varchar(255)  | YES  |     | NULL              |                             |
| pos_name                | varchar(45)   | YES  |     | NULL              |                             |
| pos_id                  | int(11)       | YES  |     | NULL              |                             |
| product_category        | varchar(45)   | YES  |     | NULL              |                             |
| product_platform        | varchar(45)   | YES  |     | NULL              |                             |
| created_by              | int(11)       | YES  |     | NULL              |                             |
| judged_by               | int(11)       | YES  |     | NULL              |                             |
| selfie_photo            | varchar(255)  | YES  |     | NULL              |                             |
| like_score              | int(11)       | YES  |     | NULL              |                             |
| star_score              | float         | YES  |     | NULL              |                             |
| feedback_recommendation | varchar(2000) | YES  |     | NULL              |                             |
| created_at              | timestamp     | YES  |     | CURRENT_TIMESTAMP |                             |
| updated_at              | timestamp     | YES  |     | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| sent_date               | timestamp     | YES  |     | NULL              |                             |
| locked                  | tinyint(1)    | YES  |     | 0                 |                             |
+-------------------------+---------------+------+-----+-------------------+-----------------------------+

so until now i developed following sql query :
SELECT p.id,p.name
FROM missions m join pos p
on m.pos_id = p.id
where p.location = 'new york'
having count(m.pos_name) < (select count(*)
                          from product_category);

but this part of code
having count(m.pos_name)

should be something like that :
select count(*)
from missions
group by pos_name;

because without group by statement i will recieve a sum of all pos, but i need to check it for a group, not for all of them.
Any suggestion ?

A: I thing you need the data with group by with condition then try this
SELECT p.id,p.name
FROM missions m join pos p
on m.pos_id = p.id
where p.location = 'new york'
group by m.pos_name
having count(m.pos_name) < (select count(*)
                      from product_category);

Just add group by m.pos_name it will work.
You can check Here


text:
Q: Upload throttling in IIS 7 I've got a situation where multiple concurrent file uploads are being executed in a web application. These uploads are of massive files, among several users, and it's choking the system into terrible latency issues.
What is the best way for me to solve this problem? Preliminary searches suggest Bandwidth/Bit throttling. Do you agree this is the best solution? And, if so, what's the best way to do this?

A: Bandwidth throttling definitely sounds like the way to go. I would look into whatever firewall is residing in front of your web application to see if it has some kind of QoS functionality built in.


text:
Q: Cocoapods - framework not found FirebaseCoreDiagnostics I recently updated to the most recent version of firebase so that I could integrate apple sign in for my ios app (obj-c) and I can't for the life of me work out why I'm getting this error:
ld: framework not found FirebaseCoreDiagnostics
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here's my podfile:
    platform :ios, '13.7'

    pod 'Firebase/Database'
    pod 'Firebase/Auth'
    pod 'Firebase/AdMob'
    pod 'Firebase/Messaging'
    pod 'Firebase/Analytics'
    pod 'Google-Mobile-Ads-SDK'
    pod 'SDWebImage', '~> 5.0'
    pod 'FBSDKCoreKit', '~> 5.2'
    pod 'FBSDKLoginKit', '~> 5.2'
    pod 'FBSDKPlacesKit', '~> 5.2'
    pod 'FBSDKShareKit', '~> 5.2'
    pod 'FBSDKMarketingKit'

    target 'WriteAnythingPrototype' do

    end

I've checked my Pods and can see that FirebaseCoreAnalytics is there. Also if I try and manually add the framework into the frameworks folder, I get the error that the framework is duplicated.
I've also tried deleting my derived data and deleting my pod folder and then reinstalling the pods.
I'm at my wits end and can't seem to find this problem online, can anyone please explain why this is happening?

A: I had same issue with a couple of firebase dependencise I tried pod deintegrate and then pod install a couple of times nothing worked. But what worked is removing the references from the .xcodeproj from the project.pbxproj file.
Check screen shot below.

A: I had to remove the framework in "Other linked flags" in target's build settings : look for OTHER_LDFLAGS in build settings search bar and remove FirebaseCoreDiagnostics from the list.

A: Something about the Xcode project is corrupt. Try the following:

*

*pod deintegrate

*Examine the resulting xcproject source and remove any FirebaseCoreDiagnostic references.

*Rerun pod install

A: Put the pods inside the target, so that they get linked to your target.
platform :ios, '13.7'

target 'WriteAnythingPrototype' do
   pod 'Firebase/Database'
   pod 'Firebase/Auth'
   pod 'Firebase/AdMob'
   pod 'Firebase/Messaging'
   pod 'Firebase/Analytics'
   pod 'Google-Mobile-Ads-SDK'
   pod 'SDWebImage', '~> 5.0'
   pod 'FBSDKCoreKit', '~> 5.2'
   pod 'FBSDKLoginKit', '~> 5.2'
   pod 'FBSDKPlacesKit', '~> 5.2'
   pod 'FBSDKShareKit', '~> 5.2'
   pod 'FBSDKMarketingKit'
end

You can find the CocoaPods documentation here.


text:
Q: The script lists the names of relational tables created in your account how to write the  script to  lists the names of relational tables created in your account and the total number of columns in each table. The names of relational tables must be listed in the descending order of the total number of columns.
For oracle server

A: Be specified to question: which server you are using, what language you're using.
On general, with python in mysql server, If you want to show all the database on your server (localhost or other) use the script below and for tables you can use cursor.execute("show tables") command.
import mysql.connector
database=mysql.connector.connect(host="<hostname>",user="<username>",passwd="<password>", port="<port no of database>")
cursor=database.cursor()
cursor.execute("show databases")
for db in cursor:
   print(db)


text:
Q: Builing forms in js instead of HTML I'm thinking about builing forms in js not in html.
I found one solution alpaca.js - http://www.alpacajs.org/
Are there other solutions? Which is best? Do You recommend builing forms with js?

A: We can dynamically add form elements in javascript.
Shown below is a simple one for your reference:
Try with this adding in your body of HTML
 <script type="text/javascript">
        var f = document.createElement("form");
        f.setAttribute('method',"post");
        f.setAttribute('action',"submit.php");

        var i = document.createElement("input");
        i.setAttribute('type',"text");
        i.setAttribute('name',"username");

        var j = document.createElement("input");
        j.setAttribute('type',"password");
        j.setAttribute('name',"username");

        var s = document.createElement("input");

        s.setAttribute('type',"submit");
        s.setAttribute('value',"Submit");

        f.appendChild(i);
        f.appendChild(j);
        f.appendChild(s);

        document.getElementsByTagName('body')[0].appendChild(f);
   </script>


text:
Q: List of available **kwargs In the python help documents I often see a Signature line with function name and named parameters, then you will see **kwarg (keyword arguments).
list?

Which prints to the help docstring:
Init signature: list(self, /, *args, **kwargs)
Docstring:
list() -> new empty list
list(iterable) -> new list initialized from iterable's items
Type:           type

Is there a way to list the available keywords and/or args that can be passed?

A: Nope - *args and **kwargs are catch-all arguments where the former one will capture every extra unnamed argument in a list, and the latter will capture every named argument in a dict.
People who write functions/methods utilizing one or both of these special capture arguments decide what to do with them so, unless you look through their code, if they haven't provided documentation for their functions/methods you cannot know what is their intention or what they expect to get.

A: There is inspect module, which can help you:
>>> inspect.getargspec(aMethod)
(['arg1', 'arg2'], None, None, None)

For builtin methods you can use __doc__ argument:
>>> list.__doc__
"list() -> new empty list\nlist(iterable) -> new list initialized from iterable's items"


text:
Q: Windows Phone 7 panorama item with no header I would like to create a PanoramaItem that has no header at all. I would like to place some controls in this PanoramaItem and I want them to occupy the whole space. Of course I was able to delete the header text and change the font to smaller, but still there are some margins left. This might be easy, but I am new to WP7 development...
Is it possible to achieve and how?
Thanks in advance!

A: Negative top margin may be the quickest way to get rid the stubborn header padding.
   <controls:Panorama Margin="0,-25,0,0">
   </controls:Panorama>

A: You need to modify Styles of Panorama. There is was a question recently for Pivot here: Creating Pivot Footers on Windows phone 7 application, but you can do the same with a Panorama

A: <phone:Panorama.HeaderTemplate>
    <DataTemplate>
        <TextBlock FontSize="1"/>
     </DataTemplate>
</phone:Panorama.HeaderTemplate>

it's a very funny method but for WP 8.1 Silverlight Apps this works fine.


text:
Q: App crashing on Android Emulator but working on Genymotion emulator I have an app which is working fine on Genymotion emulators. When I try to use it on an Android emulator, it keeps on crashing. The configuration of both emulators is same in terms of memory, heap size and API level.
How to make the app work on Android emulators?


text:
Q: Rails Dynamic Timestamp I want to put Dynamic Timestamp in my Rails application where, when the page is updated, it shows that last time it was updated in different pages.
Currently, I am able to put a timestamp using Javascript, but it gives the same date on every page, when the site is updated.

A: You can put this in your view:
<%= File.ctime __FILE__ %>

That should give you the last time the file (where you placed this code) was modified.


text:
Q: Multiple Left OUTER OUTER joins in LINQ to Entities Using Linq To Entities how would I reproduce the following SQL Query?
SELECT  m.MaterialId, m.MaterialName, m.MaterialTitle, vv.NearestTXDate, c.ChannelName
FROM GB_Material m
LEFT OUTER JOIN WF_VideoVersion vv on vv.MaterialID = m.MaterialID
LEFT OUTER JOIN SP_ScheduleEvent se on se.MaterialName = m.MaterialName
INNER JOIN SP_Schedule s on s.ScheduleID = se.ScheduleID
INNER JOIN GB_Channel c on c.ChannelID = s.ChannelID
WHERE LOWER(m.MaterialName) like '%foo%' OR LOWER(m.MaterialTitle) like '%foo%'

EDIT: I've excepted an answer to this as the answer produces the exact results that this SQL Query does, but be aware that the original SQL query produces an unwanted Cross Join, which i didn't realise when i wrote it.

A: (from m in context.GB_Material
join vv in context.WF_VideoVersion  on new {m.MaterialID }
                                               equals new { vv.MaterialID } into vv_join
                                             from vv in vv_join.DefaultIfEmpty()
join se in context.SP_ScheduleEvent  on new {m.MaterialName }
                                               equals new { se.MaterialName } into se_join
                                             from se in se_join.DefaultIfEmpty()
 join s in context.SP_Schedule on new {se.ScheduleID } equals new { s.ScheduleID}
join c in context.GB_Channel on new { s.ChannelID } equals new { c.ChannelID }

                                             where
                                              m.MaterialName.ToLower().Contains("foo") || m.MaterialTitle.ToLower() .Contains("foo")

                                             select new
                                             {
                                                 m.MaterialId, m.MaterialName, m.MaterialTitle, vv.NearestTXDate, c.ChannelName

                                             })

A: Try this query
var objlist =(from m in Contex.GB_Material
from vv in Contex.WF_VideoVersion.Where(x=>x.MaterialID =m.MaterialID ).DefaultIfEmpty()
from se in Contex.SP_ScheduleEvent.Where(x=>x.MaterialName =m.MaterialName ).DefaultIfEmpty()
from s in Contex.SP_Schedule .Where(x=>x.ScheduleID =se.ScheduleID)
from c in Contex.GB_Channel .Where(x=>x.ChannelID =s.ChannelID )
WHERE m.MaterialName.ToLower().Contains("foo") || m.MaterialTitle.ToLower() .Contains("foo")
select new{  m.MaterialId, m.MaterialName, m.MaterialTitle, vv.NearestTXDate, c.ChannelName}).ToList();


text:
Q: Changing ArcGIS map service language? I'm using this ArcGIS map service as the basis for an application I'm developing.
However, this base map is in English, and for my application, it's necessary that the labels be displayed in Brazilian Portuguese.
Is it possible to change the language of this base map?
If this is not possible, is there an alternative to the ArcGIS map service where you can change the language?

A: You can't change that basemap, but there are localized alternatives. See this blog for a list of localized basemaps.
You'll notice in the blog, Brazilian Portuguese is available, with the Light Grey basemap. Note, these are VectorTile basemaps, not a "map service" like you reference. If you're working strictly in ArcGIS Online and webmaps there, it wont be a problem. If you're writing JavaScript to create a custom application, you'll need to ensure you use the right code to call VectorTiles.

A: You cannot change the language, what you are seeing is essentially an image.
The answer is to find Portuguese basemaps that meet your need such as:
https://www.arcgis.com/home/item.html?id=9ed4b2a4d4dc4325bf5432d93957a37b
https://www.arcgis.com/home/item.html?id=18b12639bc284be78d8d36a2ba48d1e9
or even better, compile your own.


text:
Q: Restricting one site under Wordpress as Private in AWS ALB I have configured multiple sites on WordPress and it is connected with internet-faced ALB under AWS.
Is it possible to restrict one site as private on ALB?
Remaining sites needs an public access.
Thanks in Advance.


text:
Q: MVC - Layout keeps displaying menus after logging out I'm currently working on a website that follows a guide on plural-sight.
I'm having two main issues with the web application:

*

*After logging out, items that are under the following if statement are still showing up:
                    @if (User.Identity.IsAuthenticated)
                {

                           @User.Identity.Name

                             Account
                             Settings

                             Logout

                }

*The second problem is hiding menus from users who are logged in:
                    @if (!User.Identity.IsAuthenticated)
                {

                        Contact

                        About

                }

If User.Identity.IsAuthenticated returns a Boolean I'm not sure why this wouldn't work.
Picture of my NavBar displaying menus after login out
I'll provide more details if needed. Thank you in advance!

A: When you're using SignOut(), the user is logged off on the next (http)request.
So

*

*Do a redirect

*Or  Force log out. The seems only be possible in non-core ASP.Net: To log off immediately, clear the User property with a default value:
FormsAuthentication.SignOut();

 //log off immediately
 HttpContext.Current.User = new GenericPrincipal(new GenericIdentity(string.Empty), null);


text:
Q: Intersection points between a long list of segments I'm writing a Matlab program that has to do the following thing I'm stuck with.
I have a file containing the names of two points on every line (the points have its respective coordinates in the space). Let's say the segments are airways and the points are airports.
I have plotted all the airways, and obviously some of them intersect at some point. I would like to draw a cross 'X' at those points of intersection. How can I do this? Is there any already-implemented Matlab function that allows me to find the intersection points of segments?
And another question related to this, provided the file (with about 100 lines, where in every line a segment is defined by two points) should I do a loop that checks all the intersecting points of the first segment with the other 99 segments, and then the second segment with the other 98 segments? Or there is a more efficient way in order to do that? Thank you!!!


text:
Q: How can I optimize the following JavaScript function I'm trying to optimize my code or see if there's a better way to do it. Given values for acctData and balances below, I need to return an array of accounts filtered by the user name. my code works

const acctData = [{
    acctNum: "AAA - 1234",
    user: "Alice"
  },
  {
    acctNum: "AAA - 5231",
    user: "Bob"
  },
  {
    acctNum: "AAA - 9921",
    user: "Alice"
  },
  {
    acctNum: "AAA - 8191",
    user: "Alice"
  }
];

const balance = {
  "AAA - 1234": 4593.22,
  "AAA - 9921": 0,
  "AAA - 5231": 232142.5,
  "AAA - 8191": 4344
};

const combinedAccBalance = JSON.parse(JSON.stringify(acctData));

const getAccountNumbers = (filterByUser) => {
  return combinedAccBalance
    .filter(acc => {
      acc.balance = balance[acc.acctNum];
      return acc.user === filterByUser;
    })
    .sort((a, b) => {
      return a.balance - b.balance;
    })
    .map(fa => {
      return fa.acctNum;
    });
};

console.log(getAccountNumbers("Alice"));
//Returns ["AAA - 9921", "AAA - 8191", "AAA - 1234"]

A: you can just skip the deep clone part and do something like this:

const acctData = [{
    acctNum: "AAA - 1234",
    user: "Alice"
  },
  {
    acctNum: "AAA - 5231",
    user: "Bob"
  },
  {
    acctNum: "AAA - 9921",
    user: "Alice"
  },
  {
    acctNum: "AAA - 8191",
    user: "Alice"
  }
];

const balance = {
  "AAA - 1234": 4593.22,
  "AAA - 9921": 0,
  "AAA - 5231": 232142.5,
  "AAA - 8191": 4344
};

let getAccountNumbers = (filterByUser) => {
  return acctData
    .filter(acc => acc.user === filterByUser)
    .sort((a, b) => {
      return balance[a.acctNum] - balance[b.acctNum];
    })
    .map(fa => {
      return fa.acctNum;
    });
};

console.log(getAccountNumbers("Alice"));
//Returns ["AAA - 9921", "AAA - 8191", "AAA - 1234"]


text:
Q: memory leak while using pvpython script I wrote a script for pvpython to convert a batch of vtk-Files to binary vtu-Files.
import sys
from paraview.simple import *

print 'Number of files to be converted:', len(sys.argv) - 1
for x in range(1, len(sys.argv)):
    inputFile = str(sys.argv[x])
    outputFile = inputFile[:-1] + 'u'
    print x,': Converting ', inputFile, '  ->  ', outputFile
    r = LegacyVTKReader( FileNames= inputFile )
    w = XMLUnstructuredGridWriter()
    w.FileName = outputFile
    w.UpdatePipeline()

I run it like this inside a folder with around 2000 vtk-Files:
  pvpython conversion.py *.vtk

After some time, my systems runs out of memory.
Where does this leak come from?
I'm still new to python. Do I have to to delete the variables manually at the end of each loop?

A: Try using a Delete call. e.g.
...
w.UpdatePipeline()
Delete(w)
Delete(r)