back soft

مطالب مرتبط با «python list of objects» در back soft | نویسنده: استخدام کار

Generate List of IP Addresses via Command Line?

Vote count: 0 I'm interested in using command line (possibly Perl) to generate a list of all possible IP addresses. I've done similar with PHP in the past by using the long2ip function and creating a list from 0 to the interger 4294967295. Is there a way to do this in Perl instead though? I'm basically just looking for the quickest way to generate a text file that has a list of all 4,294,967,296 possible IP addresses. asked 1 min agoExecute Hosting This entry passed through the Full-Text RSS ser...

ادامه مطلب

Pseudocode for brute-force algorithm to find largest product of two numbers in a list

Vote count: 0 I am trying to come up with a pseudocode brute-force algorithm that finds the largest product of two numbers in a list a[sub1] to a[subn], with n greater than or equal to 2. Right now, I have for ( i = 1 to n -1) a[subi] = a[subi-1] * a[subi+1] for (j = a[sub j+1] to n) a[sub j] = a[sub j-1] * a[sub j+1] end for end for retu a[sub i] retu a[sub j] However, this is not correct. I feel like there's something simple I'm missing here, but I can't figure it out. Any ideas? Thanks in adv...

ادامه مطلب

vb.net listviwe add tow array of strings to tow column

Vote count: 0 i geting tow string from htmlcode using html-agility-pack here is how i get the first string Dim links = htmlDoc1.DocumentNode.SelectNodes("//*[@id='listone']") and then get the Attributes Dim Attributes = links.Cast(Of HtmlNode).Select(Function(x) x.GetAttributeValue("href", "")) and Dim linklist1 As String = String.Join(Environment.NewLine, Attributes) Dim string1 As String() = linklist1.Split(New String() {Environment.NewLine}, StringSplitOptions.None) the same thing for the sec...

ادامه مطلب

How to pass `params` of a `Func` List with dynamic return?

Vote count: 0 I need to call a method that receive a list of Func, the problem is that the retu of the Func is not the same for all the items of the list. For example: //Having the following method: public void DoSomething(params Expression list) { //do something } //and the following object public class Foo { public long Id { get;set; } //LOOK: ITS A LONG PROPERTY public string Name { get; set; } // ITS A STRING PROPERTY } //I would like to pass these two expressions of DIFFERENT retuing types....

ادامه مطلب

Python string with dashes to be placed in list

بخوانید I have a string like this: Home-Garden-Flowers-Nature I need to parse this string and put each of those words into a list. This operation will happen many times in my program, so I need it to be efficient. One solution I have thought of is to search for the dashes to signify where the word stops. However, I think there is a more elegant and efficient way to do this in Python?...

ادامه مطلب

List of List, want to output variable, not value

Vote count: -3 I have a list of lists like so: a = [1, 2, 3] b = [2, 3, 4] c = [a, b] I currently am doing: for x in c: print(x) and it is outputing [1, 2, 3]. How would i get it to output 'a' instead? asked 2 mins agojgree157 This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers....

ادامه مطلب

R: Subset list of data frames by row content? lapply/sapply

Vote count: 0 I have a list of data frames: d1...

ادامه مطلب

Running TestNG's RetryAnalizer on a List of tests

Vote count: 0 I am using TestNG as the Test framework. I would like to achieve the following: Once the Test Suite completed, let's say 100 tests were run (where 80 passed, 15 were skipped and 5 failed). In the onExecutionFinish method i start to run the (5) failed tests. I can get list of failed tests, but how can I make them run once again? RetryAnalyzer can retry a test after it fails, but I need to retry a bulk of tests after the whole suite has finished. asked 2 mins agoMichael This entry pa...

ادامه مطلب

Getting the activities of followed objects

Vote count: 0 I'm using the acts_as_follower gem in addition to the polymorphic activity tracking I've setup between my user and artist models. I'm now trying to display all of the activities of followed artists in the user's show view. At first I thought I could simply create an instance variable of artists by using the gem's all_follows method: current_user.all_follows => # As you can see it retus the Follow object(s) vs. the Artist objects I'm looking to retrieve. I had an alteative idea by p...

ادامه مطلب

How to get list of URLs From Chrome Browser

Vote count: 0 I want to get All URLs from google chrome browser using C#. some methods are available for IExplore and firefox browser. but I want to grab chrome URLs. is it possible asked 1 min agoMubashir Qureshi This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at fivefilters.org/content-only/faq.php#publishers....

ادامه مطلب

Reliably convert comma/semi-colon separated list of "last, first, last, first," names

Vote count: 0 I have a large list of thousands of names, with the entries that contain multiple names being separated by either comma or semi-colon, or even occasionally not. For instance: Last, First, Last, First A., Last, First, Ph.D, Last, First, M.D., Last, A. B, Last, First Middle plus other names, Last, First, Jr., Last, First Sr. Last, First; Last, First A.; Last, First Middle, … First Last, Jr. I'm trying to create a function that would reliably retu a list with everything properly order...

ادامه مطلب

Binning variable length lists in python

Vote count: 0 I have a dictionary d with 100 keys where the values are variable length lists, e.g. In[165]: d.values()[0] Out[165]: [0.0432, 0.0336, 0.0345, 0.044, 0.0394, 0.0555] In[166]: d.values()[1] Out[166]: [0.0236, 0.0333, 0.0571] Here's what I'd like to do: for every list in d.values(), I'd like to organize the values into 10 bins (where a value gets tossed into a bin if it satisfies the criteria, e.g. is between 0.03 and 0.04). What'd I'd like to end up with is something that looks exac...

ادامه مطلب

C# Sort list of class properties based on another List strings

Vote count: 1 I loop through the list of properties using reflection and assign the table cell that value. My header titles for the columns are in the wrong position at the moment though. How do I sort the dataList properties based on the header list? I would rather do it this way than sort header list based on properties. dataList type will always be a class with properties. public void SetTableStrong(List dataList, List header) { // Define our columns Column c = null; foreach (var item in head...

ادامه مطلب

List comprehension with some kind of loop interdependence?

Vote count: 0 I'm sure plenty of questions have been asked about list comprehensions but I have one about a very particular case involving nested loops with co-reference that I can't find answered elsewhere. Say you have a dictionary that satisfies two constraints: (1) every value in the dictionary is a list of some arbitrary length and (2) there exists some list outside the dictionary whose elements are a subset of the keys in the dictionary (this is necessary for reasons beyond the scope of th...

ادامه مطلب

Strange behavior of ListView when using android emulator

Vote count: 0 I'm getting a problem. I can't update ListView when using android emulator, but on real device it works fine. Here is a code of my ListActivity subclass. public class FileTree extends ListActivity { private File m_lst[] = null; private String m_path = "/"; private ArrayAdapter m_adapter = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_file_tree); m_adapter = new ArrayAdapter(this, android.R.l...

ادامه مطلب

Rotating objects around the center of a OpenGL viewport

Vote count: 0 I'm working in iOS and using GLKit to try to perform some simple matrix manipulations. In a nutshell: I'm looking to rotate a number of objects around the centre of the viewport by a certain number of degrees (the objects are not positioned at the centre of the viewport, I'm simply looking for the rotation to pivot around the centre). From reading, it appears I can achieve this by: Translating the object so that it lies at the world coordinate origin Performing the rotation Transla...

ادامه مطلب

Listen dbus-monitor messages in Python 2.4

Vote count: 0 I'm working on an old Linux with only Python 2.4. When I launch the following command dbus-monitor --system and when I press a pushbutton, a daemon triggers this message: signal sender=:1.1 -> dest=(null destination) serial=10 path=/com/mindscape/karotz/Button; interface=com.mindscape.karotz.KarotzInterface; member=click I would catch these messages in my script, do you have any idea? asked 1 min agouser3032743 This entry passed through the Full-Text RSS service - if this is your c...

ادامه مطلب

Opening of fragments from listfragment

Vote count: 0 I am new to android programming. I have created a listview fragment that work perfectly. I want on the the click of an item in the list to open the selected fragment. I havve the following errors. Can anybody please help. I have an error on showFragment(position); "can't resolve symbol 'position' and on getSupportFragmentManager().beginTransaction().replace(R.id.content.f).commit(); viewActionsContentView.showContent(); "can't resolve symbol on "getSupportFragmentManager and viewAc...

ادامه مطلب

Get git status boolean without slow list of diff

Vote count: 0 I have a bash PS1 to get a red color if my git dir is changed or green if not is changed. if [ $? -eq 0 ]; then echo "$(echo `git status` | grep "nothing to commit" > /dev/null 2>&1; if [ "$?" -eq "0" ]; then # @4 - Clean repository - nothing to commit echo "n'$Green'"$(__git_ps1 "(%s)"'$Color_Off'); else # @5 - Changes to working tree echo "n'$IRed'"$(__git_ps1 "(%s)"'$Color_Off'); fi)$ "; fi)' This work fine! But the problem is that in some work dir is very slow because exists ma...

ادامه مطلب