id
stringlengths
5
27
question
stringlengths
19
69.9k
title
stringlengths
1
150
tags
stringlengths
1
118
accepted_answer
stringlengths
4
29.9k
_unix.179717
I have setup a small home server / NAS running Debian 7. The server is connected directly to the router with a static IP set in the router's control panel. There are no port forwarding rules set for the server machine.The server has been running fine for over two weeks, providing a samba share and a Plex service to the home network. Last week I wanted to use it to wake other devices in the house, so I installed the ethtool and ethwreake packages to do so. After those installs, when the server is attached to the router (or indirectly via a switch), it makes the internet connection drop randomly, for about 1-2 minutes. After this time, the connections returns and I can ping google.com for about 20-30 seconds, and that keeps repeating forever.I have absolutely no idea what could be causing this. How can a machine make the internet connection drop for the entire network? The only thing I could think of is some king of packet flooding, and the router can't keep up with the requests and reboots itself or something like that.This has happened before on another Debian install, and I had to reinstall the OS entirely since I couldn't find a solution.When I disconnect the server to the network, the connection returns after about 1 minute.Is there some kind of test I could do to find the cause, or do I have to clean install Debian again?
Debian server makes internet connection drop
networking;debian;router;ethernet;internet
It sounds like what happens when two devices on the same network have been given the same IP address. Check both devices and ensure that they have different IP addresses.
_computergraphics.5053
I am attempting to visualize the raw output from PBRT's half-vector sampling function, based on the trowbridge-reitz distribution. I'm isolating only the distribution and the associated functions necessary to sample it. The function is based on the standard GGX half vector sampling formula: $$\theta_s = arctan(\frac{\alpha_g\sqrt{\xi_1}}{\sqrt{1-\xi_1}})$$$$\phi_s = 2\pi\xi_2$$(from Walter GGX: http://www.cs.cornell.edu/~srm/publications/EGSR07-btdf.pdf)but the PBRT version has a lot more black magic related to importance sampling only directions that make significant contributions based on the incoming wo angle. That one detail is making it hard for me to find published papers which specify how to add this directional importance sampling to the standard GGX sampling function.Anyway, these angles come back from the sampling function as a vector 3 and spherical coordinates with $$Normalize([\theta_s,\phi_s, 1.0])$$ which should perturb the surface normal, creating the half vector to reflect around.At this point I am only trying to make sense of the output from the sample wh function. To visualize the results (raw wh output) I made a little graphics utility to output the results to a normal map. Here is the output:And a live webgl example here that continually runs new random numbers through the output (as if monte carlo sampling were running): http://rdtests.ml3ds-test.com/microfacettesting.htmlMy expectation of the output would be a somewhat smooth gradient blend of the wh orientations as the x and y slopes cross into each other. But what i'm seeing is an area between the 2 axes that doesn't want to blend well. The random noise is good/expected, but you can see that inside the x/y blend areas, even the noise becomes fairly non-random. Can anyone give me some tips on what the half vector sampling should graph like, or some pointers to papers/published work that I can use to locate test data, graphs, or other educational material that could help me figure this out?
Visualize the output of a Trowbridge-Reitz Half Vector Sampling Function
raytracing;pathtracing;sampling;distribution
null
_codereview.46883
I have this uniform cost search that I created to solve Project Euler Questions 18 and 67. It takes the numbers in the txt file, places them into a two dimensional list, and then traverses them in a uniform cost search (that I hoped was a kind of implementation of an a* search). It looks like this:f = open('triangle.txt', 'r')actualRows = [[n for n in p.split( )] for p in f.read().split('\n')]actualRows.pop()actualRows = [[int(n) for n in p] for p in actualRows]rows = [[100 - n for n in p] for p in actualRows]def astar(pq): m = min(pq,key=lambda w: w[3]) if len(m[2]) + 1 is len(actualRows): return m pq.remove(m) toAdd = list(m[2]) toAdd.append(m[0]) pq.append((actualRows[m[4]+1][m[5]], rows[m[4]+1][m[5]], toAdd, m[3] + m[1], m[4]+1, m[5])) pq.append((actualRows[m[4]+1][m[5]+1], rows[m[4]+1][m[5]+1], toAdd, m[3] + m[1], m[4]+1, m[5]+1)) return astar(pq)# Each tuple is: (actualScore, minScore, previous, totalScore, y, x)priorityQueue = [(actualRows[0][0], rows[0][0], [], 0, 0, 0)]a = astar(priorityQueue)print aprint str(sum(a[2]) + a[0])I'm not asking for you to tell me how to solve the Problem, I just want to optimize this search so that it doesn't crash going past the 17th row of numbers. How would I optimize this? Or how would I write a proper uniform cost search?
Recursive uniform cost search that needs to be optimized
python;optimization;recursion;programming challenge;pathfinding
You mentioned in the comments that the size of the triangle is hard-coded into the code. The very first thing you should do is make this a variable which you declare at the start of your code. (In many other languages, this would be a constant). You also use the number 100 in line 5. If this is supposed to be one more than the number of lines, it should be defined in terms of the same constant, so that the two can be changed in the same place. (Edit: I see from the problem that 99 and 100 are not related. If you had had two variables, NUM_ROWS and MAX_VALUE defined at the top, the meaning of each of the numbers would have been clear to me immediately.)A level of sophistication above, but still very easy, would be to give some reasonable error to a user like @JanneKarila who has used the wrong number of lines. This might be overkill for code that you and only you are ever going to run, but a one-line check with an error message might help you if you debug using the wrong file (it's easy to spend hours taking your program to pieces and forget to check which input you are using), and it makes life much easier for anyone else who wants to try it.Another stylistic thing which can be very important - for me the hardest part of your code to read is the lines that start pq.append. For each expression on these lines, I have to glance several times back to the definition of priorityQueue and the comment with it to find out exactly what each element of your tuple represents. If you defined a very simple class, then rather than m[3] + m[1] I would see m.totalScore + m.currentValue. Just doing this by itself would make the code easier to read (these two lines are going to be among the most important to debug). It might be the case that your class could also have methods or 'smart' constructors which could do some of the trickier work and make your inner loop more readable.Ultimately, I don't think it is realistic to 'optimize' this program to be able to solve a problem of the same size as Euler problem 67. If you try and store the lists inside your tuples more efficiently you might get to 18, 19 or 20 levels before crashing. However, the fundamental flaw of the algorithm is that you are going to store almost every path in your list in priorityQueue, with probably up to half of them present at any one time. This is unworkable from a memory perspective (the number of paths grows very rapidly as you increase the size of the triangle) and also from a run time perspective (if you try and measure the time taken for levels up to 17 you should be able to see this). Using the a* algo has made it a little bit less obvious to see that you are doing exactly what the Project Euler page recommends against - trying all paths. (EDIT: I didn't run the code. Turns out a stack overflow and not running out of memory is the reason for your crash. If you get rid of the recursion as suggested in @JanneKarila's answer, you will probably make it to quite a few more levels before running out of memory, but still nowhere near 100. The comments below still apply.)You need to go back to the drawing board and think of another way to solve the problem. A good starting point is to try and solve a few small triangles by hand, and see what methods you come across. Don't worry though - writing this program has given you a chance to learn both about an interesting algo and some things about programming, which I'm sure have made it worthwhile.
_codereview.30876
I am using VBA to manipulate the global address book in Outlook. My method takes a contact and returns a complete list of everyone who reports through that person based on the Outlook org structure.Unfortunately it takes quite some time to run, even for a single manager. I'm not really sure what is the best way to improve the performance here - it sees the getDirectReports method takes some time, but, I don't see an easy way to determine if a user has reports prior to calling it first.Public Sub printAllReports() Dim allReports As Collection Set allReports = New Collection Dim curLevelReports As Collection Set curLevelReports = New Collection Dim nextLevelReports As Collection Set nextLevelReports = New Collection Dim myTopLevelReport As ExchangeUser 'this method returns an exchange user from their outlook name Set myTopLevelReport = getExchangeUserFromString(outlook resolvable name here) 'add to both the next level of reports as well as all reports allReports.Add myTopLevelReport curLevelReports.Add myTopLevelReport Dim tempAddressEntries As AddressEntries Dim newExUser As ExchangeUser Dim i, j As Integer 'flag for when another sublevel is found Dim keepLooping As Boolean keepLooping = False Dim requireValidUser As Boolean requireValidUser = False 'this is where the fun begins Do 'get current reports for the current level For i = curLevelReports.Count To 1 Step -1 Set tempAddressEntries = curLevelReports.item(i).GetDirectReports 'add all reports (note .Count returns 0 on an empty collection) For j = 1 To tempAddressEntries.Count Set newExUser = tempAddressEntries.item(j).getExchangeUser 'isExchangeUserActualEmployee has some short boolean heuristics to make sure 'the user has at least a title and an email address If (isExchangeUserActualEmployee(newExUser) = True Or requireValidUser = False) Then allReports.Add newExUser nextLevelReports.Add newExUser keepLooping = True End If Next j Set tempAddressEntries = Nothing Next i 'reset for next iteration Set curLevelReports = nextLevelReports Set nextLevelReports = New Collection 'no more levels to keep going If keepLooping = False Then Exit Do End If 'reset flag for next iteration keepLooping = False Loop Dim oMail As Outlook.MailItem Set oMail = Application.CreateItem(olMailItem) 'do stuff with this information (currently just write to new email, could do other cool stuff) For i = 1 To allReports.Count oMail.Body = oMail.Body + allReports.item(i).name + ; + allReports.item(i).JobTitle Next i oMail.DisplayEnd Sub
Manipulating the global address book in Outlook
performance;vba;outlook
Your printAllReports method does almost everything that's possible to do with the Outlook API (ok maybe not), except printing anything. You basically have what we call a monolith, and that's bad because as your program changes, you are tempted to just keep adding and adding and adding, until the thing becomes an unmanageable, tangled mess. If you're going to call a method printAllReports, give it a signature like this: Sub printAllReports(allReports As Collection), so its intent is clear at first glance - and then make it do one thing; print all reports.Performance-wise, the major hit is going to be hitting the Exchange server, so your code needs to make sure it hits the server only when it's necessary. If that's already the case, chances are you've already got it as good as it gets.I think your multiple collections and 3-layer deep nested loop approach isn't the easiest way to make your code readable and maintainable, let alone to fine-tune its performance.HierarchicalUserThe beautiful thing about a language that allows you to define objects, is that doing so actually adds vocabulary to that language, so no matter how lame VBA/VB6 is, with your own objects you can add new nouns, and with your own methods you can add new verbs, and with enough of them you actually end up crafting a language (ok, an API) that's beautiful in its own way.You have the concept of an ExchangeUser, that can report to another ExchangeUser, and that can have ExchangeUser underlings. I call that a hierarchy, and I'd recommend you encapsulate that ExchangeUser into your very own HierarchicalUser class, something along those lines:private type tHierarchicalUser User As ExchangeUser Superior As HierarchicalUser Underlings As New Collectionend typeprivate this As tHierarchicalUserOption ExplicitPublic Property Get User() As ExchangeUser Set User = this.UserEnd PropertyPublic Property Set User(value As ExchangeUser) Set this.User = valueEnd PropertyPublic Property Get Superior() As HierarchicalUser Set Superior = this.SuperiorEnd PropertyPublic Property Set Superior(value As HierarchicalUser) Set this.Superior = valueEnd PropertyPublic Property Get Underlings As Collection 'DO NOT return a reference to the encapsulated collection, you'll regret it! Dim result As New Collection, underling As HierarchicalUser For Each underling In this.Underlings result.Add underling Next Set Underlings = resultEnd PropertyPublic Sub AddUnderling(underling As HierarchicalUser) Set underling.Superior = Me this.Underlings.Add underling 'you can use a key here to ensure uniquenessEnd Sub'almost forgot!Public Function FlattenHierarchy() As Collection Dim result As New Collection 'traverse whole hierarchy and add all items to a collection that you return Set FlattenHierarchy = resultEnd SubThen you'll need a way to create instances of this class, and populate them. Enter the HierarchicalUserFactory (well, I know I would put that in its own class, but that's just me) - instead of nesting code we're going to be nesting method calls, recursively:Public Function CreateHierarchicalUser(exUser As ExchangeUser) As HierarchicalUser Dim result As New HierarchicalUser Dim entry As AddressEntry Dim underling As ExchangeUser set result.User = exUser For Each entry In exUser.GetDirectReports() '<< For Each won't loop if there's nothing in the collection 'if possible, run the isExchangeUserActualEmployee logic off this 'entry' object, 'so you can only call the expensive GetExchangeUser method if needed: set underling = entry.GetExchangeUser result.AddUnderling CreateHierarchicalUser(underling) '<<< recursive call! Next Set CreateHierarchicalUser = resultEnd FunctionHaven't tested any of this, but I believe an approach along those lines could possibly help you reduce the amount of GetExchangeUser calls and thus increase performance... not to mention readability++ :)So your printAllReports method could possibly look like this now:Public Function getHierarchy(topLevelUserName As String) As HierarchicalUser Dim factory As New HierarchicalUserFactory Dim topLevelUser As ExchangeUser Set topLevelUser = getExchangeUserFromString(topLevelUserName) Set GetHierarchy = factory.CreateHierarchicalUser(topLevelUser)End SubPublic Sub printAllReports(hierarchy As HierarchicalUser) Dim reports As Collection Set reports = hierarchy.FlattenHierarchy() 'do all that cool stuff you wanted to do!End SubNitpicksWhen you declare an object variable and assign it to a New instance on the next line, consider combining the two statements into one: Dim X As New Y.When you declare a Boolean, it's automatically initialized to False so your post-declaration assignments are redundant.When you evaluate a Boolean expression in an If statement, you don't need to specify =True or =False - rather, just say If SomeBooleanExpression Then or If Not SomeBooleanExpression Then.When looping through objects in a collection, ALWAYS use a For Each construct. This will avoid weird stuff like For i = 1 To MyCollection.Count when .Count is 0, even someone that knows the VBA/VB6 collection base rules like the palm of their hand will go huh?. For...Next has been around since before objects even existed, that construct is for traversing arrays. Collections deserve a For Each.
_scicomp.10378
I have a numpy function f that takes arrays as arguments and a 3D array x[a,b,c]. I would like to evaluate the function f along a specific column. A long-winded way could be with comprehensions:y = [ [ f(x[a][b]) for a in range(len(x)) ] for b in range(len(x[0]))]y = np.array(y)Is there a numpy way of doing this with broadcasting?
evaluating a function along an axis in numpy
numpy
null
_unix.318274
The following is net-snmp output and as you see, diskIOLA is not availabe:SNMP table: UCD-DISKIO-MIB::diskIOTablediskIOIndex diskIODevice diskIONRead diskIONWritten diskIOReads diskIOWrites diskIOLA1 diskIOLA5 diskIOLA15 diskIONReadX diskIONWrittenX 25 sda 845276160 2882477056 576632 42597061 ? ? ? 5140243456 883350772736According to the definitions here http://www.net-snmp.org/docs/mibs/ucdDiskIOMIB.html:diskIOLAx means the x minute average load of disk (%).The other values in the table are:diskIONRead - The number of bytes read from this device since boot.diskIONWritten - The number of bytes written to this device since boot.diskIOReads - The number of read accesses from this device since boot.diskIOWrites - The number of write accesses to this device since bootSo, how does this load can be calculated manually, as it is not collected in the server?In the end, we want to show graphs to users where they can find if a disk IO is heavy or not. We can either display this using Read/write bytes/sec or Read/write requests/sec. If we display Read/write requests/sec alone, we can know that there is heavy I/O going on. But we won't be knowing if the disk R/W speed is effected by this. And displaying R/W speed alone can't tell us why the speed is effected - whether it is because of too many I/O operations or not enough buffer memory for asynchronous writes. Hence, we need to display both.But, what is the other value disk IOLoad means and how can we calculate it and why is it not being collected in snmp. Does it cause huge load if enable this? If it cause heavily load collecting this value, then we can calculate it manually. But, what's the formula?
How to calculate disk IO load percentage?
io;disk;snmp
null
_cogsci.13594
Could (TBI) Traumatic brain injuries be linked to Post Traumatic stress syndrome (PTSD)? I know there is a lot of concern with veterans and PTSD, but I am more interested in all the other situations/civilian cases of PTSD. From what I have read, there are overlapping symptoms between PTSD and TBI? Is it possible for someone to have PTSD from damage to the brain and not from a specific event?
Is there a link between brain injuries (TBI) and PTSD?
brain injury;ptsd
null
_webapps.41470
Is there a way to search a single web-domain using regular expressions? I've been mirroring sites with WinHTTrack and then using dtDesktopSearch but it's an incredibly inefficient process and I was wondering if anyone knew of a better way.
Search a single website using regular expressions?
search engine;regex
null
_webmaster.19061
Internal site has recently been redesigned, but IE8 does not seem to be loading the new css rules only when viewed via VPN. I really have no clue what to look for. I can't reproduce the problem, but it's apparently affecting client for the last month.I've suggested:Reloading IE8Checking InternetPermissionsFlushing the cacheI'm not really certain what direction to search for the answer. Is it likely to be a server permissions issue? a VPN connection issue? a rare ie8 CSS bug?
CSS not loading when site is viewed via Windows VPN
internet explorer 8
I finally got to the bottom of this issue. Here's what I did. If you can't reproduce an error, try to see what the client sees. I had the client email me rendered page output and noticed strange variables inserted all over in and around the JavaScript and other file addresses. A quick Google showed me those vars point to firewall issues.Check location is not just (Site Name) but actual (Site URL).I then asked her what the URL she was using, and the URL had the same strange variables in it too. Ok, so the URL was setting the variable in the first place, for the firewall to accept.I had her use the proper URL and the page seems to work correctly! I'll have to dig into the firewall to make sure the site filters correctly, but I'm 100% certain that is the issue, and now I can actually find the solution. It will likely end up being a combination of firewall settings and client education. The biggest issue was not knowing which direction to search. You helped me rule out some other possible scenarios. Thank you all for your views and ideas.
_unix.73339
Trying to set up a Centos 6 server configuration where we can automate the running of an application that uses Selenium. In this case, ideally, we should be able to:Create a graphical session (which should remain open for at least 30 minutes).Run an application that will continue running while the session is active.Have that application, using Selenium, run automated website tests.What sort of installation / configuration do I need to do this? I've already set up gdm and a vnc server to test it out. I am at a loss, however, on what to do next.
How to set up remote graphical sessions on CentOs?
linux;desktop;vnc;session;remote management
null
_codereview.29511
I'm working on an old PHP website, and NetBeans is complaining about an uninitialized variable. I'm seeing some code like this:$app->soapAPIVersion($apiVersion);$_SESSION['apiVersion'] = $apiVersion;The function looks something like this:function soapAPIVersion(&$apiVersion){ $apiVersion = ''; $result = false; $soapResult = $client->call('getAPIVersion', array('sessionKey' => $sessionKey), $url); if (is_string($soapResult)) { $apiVersion = $soapResult; $result = true; } return $result; }I believe it's using this line to initialize the $apiVersion variable:$app->soapAPIVersion($apiVersion);For better coding practice, should that really be this:$apiVersion = '';$app->soapAPIVersion($apiVersion);Or is it a valid trick?
Initializing a variable with a function reference (PHP)
php;php5
With all do respect, this code really did hurt. Netbeans is complaining, because the function soapAPIVersion expects a reference to a variable. You're passing an undeclared, and uninitialized variable to the function. Sort of like a void pointer/null-pointer thing.It's not really a big deal, but I cannot, for the life of me, get why this function uses a reference as an argument. I think it better to change it to:function soapAPIVersion(){ $soapResult = $client->call('getAPIVersion', array('sessionKey' => $sessionKey), $url); if (is_string($soapResult)) { return $soapResult; } //implicitly return null, or throw exception}And call it like so:$apiVersion = $app->soapAPIVersion();if ($apiVersion === null){ throw new RuntimeException('unable to get the API version');}$_SESSION['apiVersion'] = $apiVersion;Bottom line: only pass by reference if you need your function to do 2 things at the same time, and you can't split those two things over 2 functions. situations are Very rare. Since PHP5, I've only had to use a reference argument 5~10 times, I think, so avoid, if at all possible
_cs.75837
I'm trying to understand the definition of program analysis on Wikipedia:Program analysis is the process of automatically analyzing the behavior of computer programs regarding a property such as correctness, robustness, safety and liveness.What is the meaning of automatic here?Are parsers static analysis tools, since they will throw an error if they encounter syntactically invalid code?Is running a program an example of dynamic analysis, since it will provide me with an output (though I still have to interpret it myself)?What if I explicitly throw a this can't happen exception when the program reaches an invalid state?What about using a debugger to pause execution?
What counts as automatic program analysis?
static analysis
There is no sharp formal definition.Static denotes before running the program.Dynamic denotes while running the program.Automatic stands for without the intervention of the user. For instance, Hoare logic can be used to prove program properties, but (at least in its basic form) it requires user-provided invariants. Abstract interpretation, instead, often results in a totally automatic analysis. Type checking is usually regarded as automatic, since the type checker does not (usually) ask the user to provide hints about, e.g., why a given expression has the given type.Parsing is static, but it's such a preliminary stage that probably most people wouldn't consider as program analysis at all. If a text file does not respect the syntactic rules, it is not part of the programming language (a language being a set of strings, after all!), hence it is not even a program, hence parsing is not program analysis. I would not be very interested in the syntax errors reported by cc kitten.jpeg, for instance.Observing the program when it is being run is definitely a dynamic approach. Using a debugger, observing fired exceptions fall in this category.
_codereview.37806
I'm trying to make a program that calculates your k/d ratio (kill/death, which is used in FPS games to make people believe that it's skill), how many kills you need without dying once to reach a goalKD. It also has a part that calculates how many battles you need if you give the program your average battle kills and battle deaths.Is there a efficient way to program it? Currently, the way I'm doing it is getting me into programmer-efficiency hell.For i = 1 to 100000 { While GoalKD>KDratio { Kills = BattleKills + Kill Deaths = BattleDeaths + Death KDratio = Kills / Deaths i++ }}I'm programming this in SmallBasic because I'm most familiar with it, and I think it's easily readable. Also, if possible, don't give the answer right away; give me some hints for me to practice my mind. Add the answer in a spoiler box.
Calculating kills and deaths in a game
performance;homework;basic lang
For the kills needed part, you are trying to solve this equation:k{current} + n-------------- = r d{current}Where r is the target rate and n is the number you're looking for. Some basic algebra:n = rd - kFor the battles part, you need to solvek{current} + b * k{battle} // current kills + additional kills-------------------------- = rd{current} + b * d{battle} // current deaths + additional deathsk{current} + b * k{battle} = r * (d{current} + b * d{battle}) // multiply both sides by d{current} + b * d{battle}k{current} + b * k{battle} = r * d{current} + r * b * d{battle}) // just showing multiplication of rb * (k{battle} - r * d{battle}) = r * d{current} - k{current} // subtracting terms from each side r * d{current} - k{current}b = --------------------------- // dividing by k{battle} - r * d{battle} k{battle} - r * d{battle}In your code above, this becomesneed = Math.ceiling( GoalKD * Deaths - Kills )battles = Math.ceiling( ( GoalKD * Deaths - Kills ) / (BattleKills - GoalKD * BattleDeaths) )[I'm not a SmallBasic guy, so please forgive any syntax errors above.](Edited to fix math error re battles required and add comments to the math.)
_cs.48246
I have a graph with V vertices and E edges. Each edge is a road that takes fuel F to travel. I have a gas tank of capacity K, and want to find the fewest number of refills needed to go from any vertex to any other vertex. If I choose to refuel, I can fill the tank completely. My thought is to modify the Floyd - Warshall Algorithm to keep track of both number of refills, and amount of gas left. However, I am not sure how to proceed.Note: This is NOT a HW question. I was reading To Fill or not to Fill: The Gas Station Problem and began to wonder.
All Pairs Shortest Path Fewest Stops
algorithms;graphs;optimization;shortest path
null
_cs.71272
In a paper I see the following lemma about unlabeled binary trees:If $s_1$ and $s_2$ are both m-node binary trees, then the number of n-node binary trees containing $s_1$ as a subtree is the same as the number of n-node binary trees containing $s_2$.It goes on to use this to show that if you want to compute the number of n-node binary trees that have m-node as a subtree, it doesn't matter what m-node tree you use.I feel like I'm either misinterpreting this or missing something obvious. But isn't the following setup a contradiction to this lemma:Nodes 2a and 6a produce the same tree, so tree 1 is only the subtree of 5 4-node trees while tree 2 is a subtree of 6 4-node trees.
Number of n-node binary trees containing an m-node binary subtree
binary trees
You haven't defined what a subtree is, so let's assume that $S$ is a subtree of $T$ if there is a node $x \in T$ whose subtree is isomorphic to $S$ (the notion of isomorphism depends on the definition of subtree).Now suppose $S_1,S_2$ are two trees on $m$ of vertices. For any tree $T$, mark all the nodes whose subtrees contain $m$ vertices. Define $\pi(T)$ by replacing all such nodes whose subtree is isomorphic to $S_1$ by a subtree isomorphic to $S_2$, and vice versa. For any $n$, this is an involution on the set of trees on $n$ vertices which satisfies the following property: $T$ contains $S_1$ iff $\pi(T)$ contains $S_2$. This shows that the number of trees of size $n$ containing $S_1$ is the same as the number of trees of size $n$ containing $S_2$.
_computerscience.3990
I have two methods of calculating tangent and cotengent (needed for normalMap lighting calculation).The one is doing it from CPP code (with assimp library for example)The second is doing it directly in shader (in Vertex shader/in fragment shader)What is the best optimized method? (optimized for speed, with vsync activated)I use Opengl 3.3+
Where is the best place for Tangent-bitangent calculation, in shader or in C/CPP code?
opengl;shader;gpu
Doing it in the CPU side during initialization is what I'd go for, this is assuming you are initialising that data once and passing it to the GPU.On the GPU side, doing the calculations per fragment would be too costly and should be out of the question, unless it's really needed for a special effect then you shouldn't add unneeded ALU work to the fragment shader, this will only cause your application to slow down. On the vertex shader is more acceptable but again if you have highly tessellated geometry, it'll be expensive. Whenever there is data that you can compute just once, then go for that instead of doing it every frame. Even if you were planning on doing it just once on the GPU and using transform feedback or an FBO to store the data, I think this approach would be more costly. As always though, profile your application, careful tradeoffs are specific to architectures.
_reverseengineering.14779
I am in Linux, and I have seen this question a few times but never, nobody answered how to really make this work.I need to add a section to an already compiled binary. Lets say for a moment is an ELF file. I'm using objcopy so this should be generic for any format because objcopy uses libbfd that handles many formats.My process is as follows.I create the bytecode for a section I want to append to an already compiled ELF file. Let's name this file bytecode.binThen I do:objcopy --add-section .mysection=bytecode.bin \--set-section-flags .mysection=code,contents,alloc,load,readonly \myprogram myprogram_editedThen I adjust the VMA of the secition:objcopy --adjust-section-vma .mysection=$((16#XXXXX)) myprogram_edited myprogram_editedWhere XXXXXX is the new VMA address for the section.I get the warning:objcopy: stIbZt3t: warning: allocated section `.mysection' not in segmentWhen I do:objdump -d myprogram_editedI see:Disassembly of section .mysection:0000000000201011 <.mysection>:......So I see the section is created OK and the VMA adjusted. But the section is not mapped to segments, so it can't be loaded at runtime.How can I solve this?
How to SUCCESSFULLY add a code section to an executable file in Linux?
binary analysis;linux;elf;executable;binary format
null
_codereview.63552
I am very new to JS and am having a bit of a problem with making this happen.function updateDisplay23() { var statElem = document.getElementById(stat_ht); if (statElem) { statElem.innerHTML = stats[ht]; }}I load all the functions from the index at the startup then call the function with:updateDisplay23()This works fine and loads the info to the index page as desired. The problem is I have 30 or so functions, and may add many more. This is a lot of calls, I would like to combine them all into one function call. Someone hinted this may be possible.
Function help combining multiple vars
javascript;beginner
null
_unix.374004
History Search (Ctrl+r) sometimes only allows me to search for 2 charactersWhen this happens i need to close the tab and create a new one....I wish i knew what i was doing wrong to cause this to happen so i don't have to close and reopen tabs. Can anyone tell me?Ctrl+rEnter sudoBut it stops at the first 2 characters:(reverse-i-search)`su': sudo su username
History Search (Ctrl+r) sometimes only allows me to search for 2 characters
bash;command history
null
_unix.65328
I have a personal program, that has a server/client design.The server daemon part of it, should be run as its own limited user, and the program was not designed to drop its root privileges (if started as root) like some Linux programs do.So my question, in its startup script in /etc/init.d/, should I use sudo or su to run this daemon as another user? Does it make a difference? Will either of the two even work? Something else?The operating system is a custom GNU/Linux one, built using Linux From Scratch instructions, and does have both programs running correctly.
Should I use `sudo` or `su` in a startup script?
linux;sudo;su;sysvinit
If you can easily alter the program so that it drops its privileges, then this is the best approach. Switching user ID in the startup scripts is kludgey and rather inflexible, even if it does work.
_unix.158997
Alright, when I run certain commands the wrong way, (misspelled, etc.) The terminal outputs this: > instead of computername:workingfolder username$, and when I type enter it goes like this:>>>That would be if I pressed enter 3 times.
Why do I sometimes get repeatedly prompted with > in the terminal?
bash;shell;command line;prompt
> is the default continuation prompt.That is what you will see if what you entered before had unbalanced quote marks. As an example, type a single quote on the command line followed by a few enter keys:$ '> > > The continuation prompts will occur until you either (a) complete the command with a closing quote mark or(b) type Ctrl+D to finish input, at which point the shell will respond with an error message about the unbalanced quotes,or(c) type Ctrl+C which will abort the command that you were entering.How this is usefulSometime, you may want to enter a string which contains embedded new lines. You can do that as follows:$ paragraph='first line> second line> third line> end'Now, when we display that shell variable, you can see that the prompts have disappeared but the newlines are retained:$ echo $paragraphfirst linesecond linethird lineend
_codereview.7466
I have a navigation, with a sprite that changes based on the class. In my jQuery, I'm clearing out the classes so it will just have .nav and then addClass the right class based on the click. It works but feels very redundant. Does anyone have suggestions on optimizing this?HTML: <div class=grid_12 nav home> <ul class=tabs> <li class=home><a href=javascript:;>HOME</a></li> <li class=game-stats><a href=javascript:;>GAME STATS</a></li> <li class=game-talk><a href=javascript:;>GAME TALK</a></li> <li class=game-info><a href=javascript:;>GAME INFO</a></li> </ul> </div>JS:$('DIV.content DIV.nav ul li.home').click(function(){ $('DIV.content DIV.nav').attr('class', 'nav'); $('DIV.content DIV.nav').addClass('home');});$('DIV.content DIV.nav ul li.game-stats').click(function(){ $('DIV.content DIV.nav').attr('class', 'nav'); $('DIV.content DIV.nav').addClass('gamestats');});$('DIV.content DIV.nav ul li.game-talk').click(function(){ $('DIV.content DIV.nav').attr('class', 'nav'); $('DIV.content DIV.nav').addClass('gametalk');});$('DIV.content DIV.nav ul li.game-info').click(function(){ $('DIV.content DIV.nav').attr('class', 'nav'); $('DIV.content DIV.nav').addClass('gameinfo');});
Changing a sprite based on the class
javascript;jquery;html
When an li is clicked, it sets the closest .nav classes to nav and the class on the clicked li:$('.content .nav li').on('click', function(){ $(this).closest('.nav').attr('class', 'nav ' + $(this).attr('class'));});
_cstheory.12892
Suppose Alice has a distribution $\mu$ over a finite (but possibly very large) domain, such that the (Shannon) entropy of $\mu$ is upper bounded by an arbitrarily small constant $\varepsilon$. Alice draws a value $x$ from $\mu$, and then asks Bob (who knows $\mu$) to guess $x$.What is the success probability for Bob? If he is only allowed one guess, then one can lower bound this probability as follows: the entropy upper bounds the min-entropy, so there is an element that has probability of at least $2^{-\varepsilon}$. If Bob chooses this element as his guess, his success probability will be $2^{-\varepsilon}$.Now, suppose that Bob is allowed to make multiple guesses, say $t$ guesses, and Bob wins if one of his guesses is correct. Is there a guessing scheme that improves Bob's success probability? In particular, is it possible to show that Bob's failure probability decreases exponentially with $t$?
Guessing a low entropy value in multiple attempts
it.information theory;pr.probability
Bob's best bet is to guess the $t$ values with largest probability.If you're willing to use Rnyi entropy instead, Proposition 17 in Bozta' Entropies, Guessing and Cryptography states that the error probability after $t$ guesses is at most$$ 1 - 2^{-H_2(\mu)\left(1-\frac{\log t}{\log n}\right)} \approx \ln 2 \left(1-\frac{\log t}{\log n}\right) H_2(\mu), $$where $n$ is the size of the domain. Granted, the dependency on $t$ is pretty bad, and perhaps Bozta was focused on a different regime of the entropy.For the Shannon entropy, you can try to solve the dual optimization problem: given a fixed failure probability $\delta$, find the maximal entropy of such a distribution. Using the convexity of $-x\log x$, we know that the distribution $\mu$ has the form $a,b,\ldots,b;b,\ldots,b,c$, where $a\geq b\geq c$, $a+(t-1)b = 1-\delta$, and $c = \delta-\lfloor\frac{\delta}{b}\rfloor b$. We have $t-1+\lfloor\frac{\delta}{b}\rfloor$ values that get probability $b$. Conditioning on $s = \lfloor\frac{\delta}{b}\rfloor$, we can try to find $b$ which minimizes the entropy. For the correct value of $s$, this will be an internal point (at which the derivative vanishes). I'm not sure how to get asymptotic estimates using this approach.
_cs.28257
This is a graph theory and partial ordering problem. Consider a set of triples {(di,ai,ci)}i=1...N, which specify edges between two nodes A and B, d denotes a departure time, a an arrival time and c a cost. Technically there can be multiple incomparable costs, for example in $ and % chance that your goods arrive safely.An example of such a situation could be these 5 edges:(I did not draw the time axis on scale)There are five edges, I, II, III, IV and V. The costs are denoted at the edges, they are either 100, 10 or 1. Edge V is drawn red to easily discriminate it from the other edges, since it crosses through them. However, aside from that it is not different.Given such edges, a few things are important:An edge is only interesting if it departs after we arrive at A, for example in the image we can arrive at (a), then edge I is not an option anymore. The same goes for edges II and V if we arrive at (b), etc.Given an arrival and its set of interesting edges, and edge ei is dominated if there exists an edge ej with ej< ei. This is the case iff aj ≤ ai ^ cj ≤ ci ^ (aj < ai v cj < ci). In layman terms, cost and arrival need to be at least as small, but one must be strictly smaller. This is a partial ordering, some edges are incomparable.Given a arrival in A, I want to find all relevant, undominated (or Pareto) edges.We can enumerate all the edges:I: (0 , 1, 100)II: (0.5, 2, 10)III: (2 , 3, 100)IV: (2.5, 4, 10)V: (1.5, 5, 1)Putting them in a partial ordering, using a directed acyclic graph (dag), we get this:An arrow denotes the <-relation between edges. Note that an edge in this case is a node in the dag: confusing, I know. When I say edge, I mean a node in the dag above.I added an edge (-∞, -∞), which is always irrelevant, but creates a nice 'root' of the dag. This way we sort of have a tree, where leaves sometimes merge without creating cycles. I also only denote the arrival at B and cost, needed to create the dag, but technically there is also a departure are A for each of the edges.If we were to arrive at A at -1, we can simply return all the children of (-∞, -∞) as relevant and undominated, but for another arrival we may need to traverse the tree differently (in a more complicated fashion). I was thinking of this:marker := map from edge to bool # marks whether edge has been traversedfor all edges: marker(edge) := false # none have been traversedtraverse(root, arrival): if(marker(root)) return [] #already been at this node marker(root) := true; if(departure(root) > arrival) return [root]; # return singleton list, all children will be dominated by this edge. # this node is irrelevant, but possible some children are relevant. l = []; for each child of root: append traverse(child, arrival) to l return lTraverse returns a list of undominated, relevant edges. However, Is this an efficient way to tackle this problem? Is there a better solution to this problem? Is this problem known under a known name?
Search in a partial ordering defined by tuples of numbers
graph theory;graph traversal;partial order
I solved my OP as my intuition was. First I created a graph as described by the second picture of the OP. Then I traverse it like this:global: visited, frontfunction proceed(arrival) visited := array of bool for each node initialized to false for each x &isin; front proceed(arrival, x) return frontfunction proceed(arrival, node): if(visited[node]): return visited[node] := true if(node.departure > arrival): remove node from front for each node x: append x to the end of frontfunction calculate_outgoing: outgoing := array of lists for each arrival at A, each list contains feasible and relevant A->B connections for that arrival. front := [(-&infin;, -&infin;)] for each arrival at A in increasing order: outgoing[arrival] := proceed(arrival) return outgoingInitially only the root of the dag is in the is in the front. Then the front is moved towards the 'leaves' of the dag as the arrival times increase, that is, certain options 'fade away' and hence are replaced by other options.Notice that I have a tree-view on the dag. The key difference is that a node can have more parents, hence I mark which nodes are already visited, preventing one from visiting them twice via different parents.I find this solution more satisfying then @d-w's, since he did not address the problem of multiple costs, like stated in the OP: Technically there can be multiple incomparable costs, for example in $ and % chance that your goods arrive safely., nor did he comment on it. If you have only one cost, his solution is adequate.
_webmaster.87629
I have a book sharing website which is built with angular. The basic model is that someone creates a book entry on my site and that book gets displayed on the front page of the website, along with a discover page. On these pages one can then click on the cover of the showcased books which will directly take you the book's homepage (within my site) containing all of the book's information.Now the problem comes when trying to make my website SEO friendly, and it has boiled down to two options. I could have a headless browser pre-render my page or I could leave the bot on its own to interpret my page on its own. The caveat of the first option, is firstly that google has deprecated this method of doing things since it uses the _escaped_fragment= parameter, but most importantly is the fact that the front page of my site can contain up to 300+ book entries, and my discover page can contain even significantly more. So if I went with a headless browser to render the pages for the crawler I could potentially overload and crash the server if it tries to render the homepage for every entry at the time the crawler is requesting them.The second approach which is ideal but I have not gotten it to work would be to have the angular data binding work on its own. Where on the front page I could have the entries and within the entry embed a hidden <a> tag that binds to the entries homepage, however since the entries are loaded with AJAX the crawler requests the unmodified url, instead of the resolved one. This is also a problem within the book's homepage where the meta tags are interpolated to include the book's individual descriptions, but all the crawler sees are the unresolved versions.Therefore I am truly between a rock and a hard place when it comes to SEO, which my site would greatly benefit from since the book's would have a greater chance of being discovered if they were to appear whenever someone searched for keywords that don't necessarily pertain to my website's functionality but rather to the book's description. Any suggestions are appreciated.
SEO friendly book sharing website built with angular.js
seo;crawlable ajax
null
_reverseengineering.2079
I have a piece a malware I was share with. (I do this for fun, anyways)Is a DLL according to the IMAGE_FILE_HEADER->Characteristics. I was trying to do some dynamic analysis on it. I have done the following:Run it with rundll32.exe, by calling its exports. Nothing.Changed the binary's characteristics to an exe. Nothing. So I moved on to static analysis, Loaded on IDA and OllyDbg. Which brings me to my question. :)What is the main difference between DllMain and DllEntryPoint?When/How does one get call vs the other?[EDIT]So after reading MSDN and a couple of books on MS programming. I understand DllEntryPoint.DllEntryPoint is your DllMain when writing your code. Right?!So then why have DllMain. In other words, when opening the binary in IDA you have DllEntryPoint and DllMain. I know it is probably something easy but I am visual person, so obviously not seeing something here.
Difference between DllMain and DllEntryPoint
windows;malware;dll
Both, DllMain and DllEntryPoint are merely symbolic names of the same concept. They even share the same prototype. But they aren't the same:The function must be defined with the __stdcall calling convention. The parameters and return value must be defined as documented in the Win32 API for WinMain (for an .exe file) or DllEntryPoint (for a DLL). It is recommended that you let the linker set the entry point so that the C run-time library is initialized correctly, and C++ constructors for static objects are executed.(MSDN Library from Visual Studio 2005)The entry point in a DLL is the same as in an EXE technically, but with different semantics and prototype (EXE vs. DLL). Both are to be found at IMAGE_OPTIONAL_HEADER::AddressOfEntryPoint. However, in a DLL this entry point is optional (although usually supplied by the runtime library). The entry point isn't explicitly exported through the export directory (although IDA for example shows them under Exports). Most of the time there is no public name attached to this entry point, which is why the documentation refers to it as DllEntryPoint. If you find this name in the export directory of the PE file it's probably not the actual entry point from the PE optional header (this would have to be confirmed by looking at the exact sample, though). The last point, btw, holds for DllMain as well.DllMain is the name the runtime library (ATL, MFC ...) implementation expects you to supply. It's a name the linker will see referenced from the default implementation of DllEntryPoint which is named _DllMainCRTStartup in the runtime implementations. See the CRT source files crtdll.c and dllcrt0.c if you have Visual Studio.This means that DllEntryPoint calls DllMain - assuming default behavior. The runtime-implemented entry point function (_DllMainCRTStartup) does other initialization.You can override this name by using the /entry command line switch to the linker. Again, it's just a name and you can choose whatever you fancy. The limitations (not being able to load another DLL using LoadLibrary from within the entry point and so on) are independent of the name you give the function.Side-note: in an EXE the TLS callbacks run before the entry point code, which can be dangerous in malware research. I don't think this is relevant to DLLs, though, but if someone has more knowledge in that area I'm interested to see pointers to material.Peter Ferrie, a distinguished reverser and malware analyst, pointed out in a comment to this answer:TLS callbacks always run in statically-linked DLLs, and since Vista, they also run in dynamically-linked DLLs! For more information, see my TLS presentations, and of course my Ultimate Anti-Debugging ReferenceThanks Peter.
_codereview.60947
I have an a element for a button. The SVG snippet inside links to the containing SVG file at the top of the body. <a href=#menu class=head__toggle title=Toggle Menu> <svg viewBox=0 0 70.115 53.162 class=head__btn> <use xlink:href=#skmenu></use> </svg></a>When I checked with Codesniffer for WCAG2AA compliance it criticized: Anchor element found with a valid href attribute, but no link content has been supplied.So I've added text inside the <a> element and wrapped it with a span. <a href=#menu class=head__toggle title=Toggle Menu><span class=srtext>Menu Toggle</span> <svg viewBox=0 0 70.115 53.162 class=head__btn> <use xlink:href=#skmenu></use> </svg></a>And hid the text with the following CSS snippet. Without the span, both, the text as well as the SVG would have been hidden. .srtext { position: absolute; top: -9999px; left: -9999px;}Question is, is the solution ARIA as well as browser compliant? Or are there ways to improve the solution (maybe without span)?
Is the Button, an element with svg code and hidden link content inside, ARIA conform and well laid out?
css;html5;svg
null
_vi.5089
Texas Instruments has a custom assembly language for its programmable real-time unit subsystems (PRUSS). TI provides syntax files for Notepad++ and Textpad, but I cannot find any syntax files for Vim. I'd be a bit surprised if no one had made on yet, though.For now, I'm using ft=c, which is okay but not ideal.
Is there a syntax file for TI's PRUSS assembly language?
syntax highlighting
EDIT: There is now a plugin made by copying the syntax file below: https://github.com/BatmanAoD/pruss-vimHere's my own PRU vim syntax highlighter with instructions:mkdir ~/.vim/syntaxmkdir ~/.vim/ftdetectcd ~/.vim/ftdetectvi pruft.vimInsert and save the following:au BufRead,BufNewFile *.p set filetype=pruau BufRead,BufNewFile *.hp set filetype=pruReturn back to your terminal.cd ~/.vim/syntaxvi pru.vimInsert and save the following: Vim syntax file for PRU Created by Bryan Wilcuttif exists (b:current_syntax) finishendif Define keywords from PRUsyn keyword syntaxElementKeyword add adc sub suc rsb rsc lsl lsr and or xor not min max syn keyword syntaxElementKeyword clr set scan lmbd mov ldi mvib mviw mvid lbbo sbbo lbco sbcosyn keyword syntaxElementKeyword zero jmp jal call ret qbgt qbge qblt qble qbeq qbne qba syn keyword syntaxElementKeyword qbbs qbbc wbs wbc halt slp syn keyword syntaxElementKeyword ADD ADC SUB SUC RSB RSC LSL LSR AND OR XOR NOT MIN MAX syn keyword syntaxElementKeyword CLR SET SCAN LMBD MOV LDI MVIB MVIW MVID LBBO SBBO LBCO SBCOsyn keyword syntaxElementKeyword ZERO JMP JAL CALL RET QBGT QBGE QBLT QBLE QBEQ QBNE QBA syn keyword syntaxElementKeyword QBBS QBBC WBS WBC HALT SLP hi def link syntaxElementKeyword Statement Define registers from PRUsyn keyword registerKeyword r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 syn keyword registerKeyword r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27 r28 r29 r30 r31 syn keyword registerKeyword R0 R1 R2 R3 R4 R5 R6 R7 R8 R9 R10 R11 R12 R13 R14 R15 syn keyword registerKeyword R16 R17 R18 R19 R20 R21 R22 R23 R24 R25 R26 R27 R28 R29 R30 R31 syn match regPartBit '.t\d\+' contains=registerKeywordsyn match regPartWord '.w\d\+' contains=registerKeywordhi def link registerKeyword PreProchi def link regPartBit PreProchi def link regPartWord PreProc Preprocessor commandssyn keyword preprocWord setcallreg entrypoint origin assign enter leave using macro mparam endm struct endssyn keyword preprocType u32 u16 u8hi def link preprocWord PreProchi def link preprocType Type Define constant registers from PRUsyn keyword constantKeyword c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 syn keyword constantKeyword c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 syn keyword constantKeyword C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C15 syn keyword constantKeyword C16 C17 C18 C19 C20 C21 C22 C23 C24 C25 C26 C27 C28 C29 C30 C31 hi def link constantKeyword PreProc Define commentssyn match synComment //.*$hi def link synComment CommentRestart your vim session.The syntax highlighter isn't perfect but good enough for my own use while writing PRU assembler code.
_datascience.19993
What is intended / right way of initializing variables in TensorFlow in C++?For instance, how do I initialize a variable in the following two examples:initialize a variable with some random distribution (for example tensorflow::ops::RandomUniform)initialize a variable with some custom values (for example, I want a vector of weights to have exactly this value - [1., 2., 42., 7500.])
Initialize a variable in TensorFlow
tensorflow
null
_cs.74473
I want to understand how a turing machine that will accept only words of length bigger than 100 will look like. My idea: it will copy a word and move to the right 100 times. If non of the cells was empty it will accept. Furthermore if it is true I can also conclude that it is decidable .If there is no problem with my assertions so far, how will a turing machine that prints the number of letters in a word will look like? is it possible as well?
Can a turing machine calculate word's length?
computability;turing machines
null
_unix.60632
I have a dual boot Windows & Linux system. I removed the Linux partition, but after that I am not able to go in to Windows XP. It is not booting. It gives me a GRUB error.
After removing linux Grub error
windows;grub;linux kernel;dual boot
null
_unix.101119
I am having a problem executing a script that basically captures the disk space from the server and outputs the result to an HTML page.STORAGE=$(df -PTh | column -t | sort -n -k6n)The output in STDOUT is OK, it is well formatted. When I echo the variable to an HTML page, the output becomes one line, just like this one:/dev/vx/dsk/localdg/wm7x01 vxfs 30G 21G 9.3G 70% /apps/wm7x01 /dev/mapper/vg00-vrts ext3 6.9G 4.7G 2.3G 68% /vrts_install /dev/mapper/vg00-ora11g_cli ext3 7.7G 4.1G 3.3G 57% /usr/oracle11g_cli /dev/mapper/vg00-repackage ext3 1008M 423M 586M 42% /var/spool/repackage /dev/vx/dsk/cfs_dcgnts_dg/shared vxfs 220G 91G 130G 42% /apps/sharedI even tried using:quotations: echo $STORAGEan array: echo {STORAGE[@]}Unfortunately, all yields the same result.
Output the result of DF command to variable then print to an HTML page
bash;html
null
_codereview.38393
I wanted to write a simple Log class for PHP, I use ajax calls with AngularJS and often return the log in an arrayExample:$return['data'] = $returnedDataArray;$return['log'] = $logDataArray;$return['status'] = 'success';echo json_encode($return);I was hoping to implement a logging system in my other classes, like my DB wrapper, etc.Example:Log::put('sql', $sql, 'DB');Log::put('fields', $fieldsArray, 'DB');And than pass the log.Example:$return['log'] = Log::getLog();Here is my Log class:class Log { private static $_loggingOn = true, $_log = array(); public static function put ($key, $value, $className = null, $functionName = null) { if ($className) { if ($functionName) { self::$_log[$className][$functionName][$key] = $value; } else { self::$_log[$className][$key] = $value; } } else { self::$_log[$key] = $value; } } public static function getLog () { if (self::loggingOn()) { return self::$_log; } return array('Logging is turned off.'); } public static function loggingOn () { return self::$_loggingOn; }}I am wondering if using the static class would be a recommended approach?
Writing a static Log class for PHP
php;object oriented;static
No, using static methods is not a recommand approach. With static methods, your class always knows which class it calls. That means you can never switch to another logger class (e.g. one that writes the logs in a file).A class should be independent of other classes as much as possible. In this case, you should just create a LoggerInterface (or use the one from PSR-3) and base on that interface. Inject it in the classes that needs a logger and then use that object. This way, you can always change from loggers (as long as they implement the correct interface) and your class doesn't know which classes it uses.Example:interface LoggerInterface{ public function put($key, $value, $class = null, $function = null); public function getMessages();}class Logger{ protected $messages; public function put($key, $value, $class = null, $function = null) { // ... } public function getMessages() { // ... }}class DataBase{ protected $logger; public function __construct(LoggerInterface $logger) { $this->logger = $logger; } public function someDbFunction(...) { // ... do something $this->logger->put(...); // log something }}This approach is called Dependency Injection. To make live easier for you, you can sue a Dependency Injection Container (also called a Service Container) to manage which classes depends on which other classes and creating those objects. A simple example is PimpleThere are also more disadvantages of using static methods. You can for instance never have 2 different instances of the logger, as there are no instances. That means that all messages are put in the same instance. You may want to internally use a logger in the Database section of your lib and another logger in the Form section of your lib and then one logger for your complete lib.
_cs.63671
Let $\varphi:\mathbb{N}\to\mathbb{N}^*$ be an arbitrary recursive enumeration of finite strings and $\mathcal{I}^n_i(x_1,...,x_n) = x_i $be the $i$-th projection over $n$ variables.I would like to show from the point of view of recursion theory that the variable projection $$ (n,y) \mapsto \mathcal{I}_y^{\text{len}(\varphi(n))}(\varphi(n)) $$is recursive.Using TMs this is quite straightforward: just simulate the TM that computes $\varphi$ and print only the $y$-th term of that TM executed with input $n$. I am interested in a purely recursion-theoretical proof, i.e., I would like to know how that function can be written in terms of primitive recursion and/or $\mu$-recursion, which I'm finding tricky.
Prove that variable projection is recursive
computability;primitive recursion;recursion theory;mu recursion
null
_unix.56117
I have a laptop running Fedora 15, Gnome 3.0.1, and Mobile Intel GM45 Express Chipset. I have a VGA monitor connected to it, as well as a DisplayPort to DVI adapter to connect a second monitor. Both monitors are detected by the system and I can use them individually, but not both at the same time. Both monitors are the same.When I try to activate the second monitor using System Settings -> Display I've seen different behaviors. Either the images (from the 3 screens) get overlapped on the first 2screens, jumbled up. Or one of the screens (laptop or monitor) stays active butbecomes invisible. Meaning the screen is dark, but the mouse travels over there and there are windows over there.As well as this: xrandr --output VGA1 --mode 1680x1050 --rate 60xrandr: cannot find crtc for output VGA1Error which occurs with either of the inactive monitor.Here's the output of xrand:xrandr Screen 0: minimum 320 x 200, current 3120 x 1050, maximum 8192 x 8192LVDS1 connected 1440x900+1680+0 (normal left inverted right x axis y axis) 303mm x 190mm 1440x900 60.0*+ 40.0 1024x768 60.0 800x600 60.3 56.2 640x480 59.9 VGA1 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 433mm x 271mm 1680x1050 60.0*+ 1280x1024 75.0 60.0 1280x960 60.0 1152x864 75.0 1024x768 75.1 70.1 60.0 832x624 74.6 800x600 72.2 75.0 60.3 56.2 640x480 72.8 75.0 66.7 60.0 720x400 70.1 HDMI1 disconnected (normal left inverted right x axis y axis)DP1 connected (normal left inverted right x axis y axis) 1680x1050 60.0 + 1280x1024 75.0 60.0 1280x960 60.0 1152x864 75.0 1024x768 75.1 70.1 60.0 832x624 74.6 800x600 72.2 75.0 60.3 56.2 640x480 72.8 75.0 66.7 60.0 720x400 70.1 HDMI2 disconnected (normal left inverted right x axis y axis)DP2 disconnected (normal left inverted right x axis y axis)DP3 disconnected (normal left inverted right x axis y axis)What else should I try to have all 3 displays active at the same time? Is it possible?
Connecting 2 monitors to a laptop
fedora;gnome3;monitors;multi monitor
If you look at the chipset datasheet, there are only two display planes and display pipes (see pp. 7879). You can also take a look at the tables on pp. 8687. So, you've hit a hardware limitation.You may be able to get it working if two of the displays are displaying the same thing, with the exact same settings (same image, resolution, refresh rate, bit depth, etc.).
_webapps.98842
As per this support topic, one can click the refresh button to update a table of contents in a Google Doc, but is there any way to set the table of contents to update automatically (capture any changes made to the headings in the document as they are made)?
Is there a way to make a table of contents in a Google Document update automatically?
google documents
null
_codereview.87664
Recently I wrote a program that was required to handle year and month data and so I wrote this class to encapsulate that handling. What I needed was a way to initialize the Yearmonth object based on the current local time, and allow a simple method of calculating future Yearmonth values based on a duration in months. This sample code illustrates how I use it:ymtest.cpp#include <iostream>#include Yearmonth.hint main(){ YM::Yearmonth ym; // today std::cout << ym << '\n'; ym += 2; // 2 months from now std::cout << ym << '\n'; ym += 14; // test year increment std::cout << ym << '\n';}Yearmonth.h#ifndef YEARMONTH_H#define YEARMONTH_H#include <iostream>namespace YM {class Yearmonth{public: // construct with today's year and month Yearmonth(); // construct with year, month (1=Jan, 12=Dec) Yearmonth(unsigned ayear, unsigned amonth); // increment by given number of months Yearmonth &operator+=(const unsigned mon); // return year unsigned year() const; // return month (1=Jan, 12=Dec) unsigned month() const; // prints to ostream. E.g. 2014 Dec ==> 201412 friend std::ostream& operator<<(std::ostream &out, const Yearmonth &ym);private: unsigned myyear; unsigned mymonth;};}#endif //YEARMONTH_HYearmonth.cpp#include <ctime>#include Yearmonth.hnamespace YM {Yearmonth::Yearmonth(){ time_t tt; time(&tt); tm *t = localtime(&tt); myyear = t->tm_year + 1900; mymonth = t->tm_mon;}Yearmonth::Yearmonth(unsigned ayear, unsigned amonth) : myyear(ayear), mymonth(amonth-1){ myyear += mymonth/12; mymonth %= 12;}unsigned Yearmonth::year() const{ return myyear;}unsigned Yearmonth::month() const{ return mymonth+1;}Yearmonth &Yearmonth::operator+=(const unsigned mon){ mymonth += mon; myyear += mymonth/12; mymonth %= 12; return *this;}std::ostream& operator<<(std::ostream &out, const Yearmonth &ym){ return out << ym.myyear * 100 + ym.mymonth+1;}}The class seems sufficient for my needs and everything works. Have I missed anything important?
Implementing a Yearmonth class
c++;c++11;datetime;c++14
I only have a few small remarks to make:In your header file, don't include <iostream>: include <iosfwd> instead which contains the forward declarations for every type in <iostream>.Also, you only use std::ostream in your source file, so you could simply include <ostream> there.Several times, you compute mymonth / 12 and mymonth % 12. If your class is designed to be used intensively, you could consider using std::div(mymonth, 12) which will compute both values at once and may therefore be slightly faster (if you really need it).You may want to prefix time_t, time, tm and localtime with std::. Them coming from the C standard library doesn't prevent you to use std::.Using a const unsigned parameter seems pretty useless. I don't have strong opinions on the const on value parameters, but you could safely drop it since it adds little value.
_unix.89647
I'd like to merge the following multiple lines of output so that they form a single line:line 1:,,,1,,,,,,,,18,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,42,1,121,1,17,10,21,1,,IU,8,0,,0, ,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,1227,,,11,,0,,,,1,01,,,1,12769,,7707,0,,,,12769,,,12769,6,0,,,,10,,,1, 901,10800,14/04/13,,,4,,,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,A,,,,1001,,,,,,,,,,,01,,12769,0,,,,,,,,,,,,, ,,,,,,,,,,,,,,,,14/04/13,10800,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,964750001210,,1001,,1,,0,,,,,,,,,,,,17 ,,,,,,,,,31685125704,,,,1,,1,0,,,,,,,,,,,,,,,,,,19,0,.901,19,0,.901,,,901,1,,,8767318,13790084045,1, 1304150024556817,,,,33399399,,,,,,,,,,,,901,1,,,,,,0,,0,,,,,,GSMT11B**S,,,4,,,,,,10800,14/04/1 3,10800,14/04/13,443867992,,,,,,,,1,0,,0,,,,,,,61409,51,,,9647507763683,,1001,1,0,,60,0,5,,N,,0,1,I, 1,,,,,,47,,,,,54,1,4,19,,29,1,1,1,3,1112,2,,Usage,Usage,USG,,N,N,0,,1,,TRNT01I,90,,0GRI3,90,,,,,0,1, 1,1,1,1,34111,437956,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,19,,,,,,,,,,,,,,,H,,1,0,1,0...blank line...line 2:,,,1,,,,,,,,18,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,42,1,121,1,17,10,21,1,,IU,8,0,,0, ,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,399,,,11,,0,,,,1,01,,,1,61,,67,0,,,,61,,,61,6,0,,,,10,,,1,74,10800,14/ 04/13,,,4,,,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,A,,,,1001,,,,,,,,,,,01,,61,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,, 14/04/13,10800,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,964750001210,,1001,,1,,0,,,,,,,,,,,,17,,,,,,,,,9647703 026865,,,,1,,1,0,,,,,,,,,,,,,,,,,,19,0,.061667,19,0,.061667,,,74,1,,,8820807,13790084046,1,130415002 4556817,,,,33399399,,,,,,,,,,,,74,1,,,,,,0,,0,,,,,,GSMT11B**S,,,4,,,,,,10800,14/04/13,10800,14 /04/13,443867993,,,,,,,,1,0,,0,,,,,,,61409,51,,,9647503228592,,1001,1,0,,60,0,5,,N,,0,1,I,1,,,,,,20, ,,,,25,1,4,19,,19,1,1,1,3,980,2,,Usage,Usage,USG,,N,N,0,,1,,ASIA03I,90,,0GRI3,90,,,,,0,1,1,1,1,1,341 12,437956,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,19,,,,,,,,,,,,,,,H,,1,0,1,0...blank line...line 3:,,,1,,,,,,,,18,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,42,1,121,1,17,10,21,1,,IU,8,0,,0, ,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,327,,,11,,0,,,,1,01,,,1,12769,,7707,0,,,,12769,,,12769,6,0,,,,10,,,1,2 ,10800,14/04/13,,,4,,,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,A,,,,1001,,,,,,,,,,,01,,12769,0,,,,,,,,,,,,,,,, ,,,,,,,,,,,,,14/04/13,10800,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,964750001210,,1001,,1,,0,,,,,,,,,,,,17,,, ,,,,,,96171254836,,,,1,,1,0,,,,,,,,,,,,,,,,,,19,0,.002,19,0,.002,,,2,1,,,8825322,13790084047,1,13041 50024556817,,,,33399399,,,,,,,,,,,,2,1,,,,,,0,,0,,,,,,GSMT11B**S,,,4,,,,,,10800,14/04/13,10800 ,14/04/13,443867994,,,,,,,,1,0,,0,,,,,,,61409,51,,,9647501378572,,1001,1,0,,60,0,5,,N,,0,1,I,1,,,,,, 47,,,,,54,1,4,19,,29,1,1,1,3,1112,2,,Usage,Usage,USG,,N,N,0,,1,,TRNT01I,90,,0GRI3,90,,,,,0,1,1,1,1,1 ,34113,437956,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,19,,,,,,,,,,,,,,,H,,1,0,1,0...blank line...
How can I merge multiple lines with spaces (blank line) separating them?
text processing;scripting;merge
null
_softwareengineering.208623
Here's the gist of the problem: There are multiple service providers who each have their own schedules of availability. There are multiple customers who seek their services. Customers need to be able to book a reservation time for the service but they should only be able to book times in which some service provider is available (ie they don't really care which particular provider they get so long as they get a provider). Unfortunately, service providers may change schedules between when the customer registers and when the service is provided, meaning that even with the reservation safeguards in place there could still end up being too many reservations for a given time.I would like to know what work has already been done on this sort of problem, and additionally:Should providers actually be assigned to customers in a persistent way even though providers are interchangeable?Depending on the answer to the previous question, how might I determine the provider's next assignment based on the current time, other providers' schedules, and scheduled reservations?I've thought a lot about this problem but I am stumped and left with unsatisfying solutions. As someone with no CS background I would appreciate some insight and/or a better way to think about the problem.
What are some algorithms that can assist with reservation time scheduling?
algorithms;optimization;scheduling
null
_cs.67875
When solving an adversarial problem there are two basic approaches: one that takes into account the thinking process of both sides, and as opposed to that the non-psychological computations.For example, in poker a computer can be programmed to simply compute the best moves for both sides, or alternatively could try to infer what the opponent is doing based on psychological considerations. This perhaps could be called game theoretic calculation, but that term is usually associated with games that involve a cooperative element. Although poker does have a small cooperative aspect to it, mostly it is adversarial, so I guess the term game theoretic may or may not apply to poker, depending on how you define that term and characterize poker.In any case, what terminology can I use to discriminate between computational methodologies that involve human psychology versus those that do not?Currently, I am just saying game theoretic and non-game theoretic approaches, but I wonder if there is a better set of terminology?
Terminology for non-game theoretic techniques
terminology;game theory
null
_webmaster.100127
I prefer to use a cross domain canonical instead of 301:<link rel=canonical href=http://example.net/dirA />is it OK for SEO purposes?Is it better than meta refresh like this?<meta http-equiv=refresh content=0; url=http://example.net/dirA />
Can a cross domain canonical link or a meta refresh be used for SEO instead of a 301 redirect?
seo;redirects;301 redirect;rel canonical;meta refresh
Meta refresh is much slower and not recommended but it is your next best option if a server side redirect isn't possible. As Moz says:Meta refreshes do pass some link juice, but are not recommended as an SEO tactic due to poor usability and the loss of link juice passed. MozHere's a quote from Google Webmaster:This meta tag sends the user to a new URL after a certain amount of time, and is sometimes used as a simple form of redirection. However, it is not supported by all browsers and can be confusing to the user. The W3C recommends that this tag not be used. We recommend using a server-side 301 redirect instead. Google Webmaster
_unix.336369
I put under /tmp the rpm that I want to install and the other RPM that are required for dependencies , yum try to install the rpm : subscription-manager-1.11.3-14.el5_11.i386.rpmbut when need the other RPM that are located under /tmp the yum not know that they are under /tmpplease advice what the approach to install the local RPM with their RPM dependencies ls increaseRemoteHostPartition.sh python-dateutil-1.2-3.el5.noarch.rpm strace-4.5.18-5.el5_4.1.i386.rpm virt-what-1.11-2.el5.i386.rpm lost+found python-ethtool-0.6-5.el5.i386.rpm subscription-manager-1.11.3-14.el5_11.i386.rpm pygobject2-doc-2.12.1-5.el5.i386.rpm python-rhsm-1.8.17-1.el5.i386.rpm subscription-manager-1.11.3-14.el5_11.x86_64.rpm yum localinstall subscription-manager-1.11.3-14.el5_11.i386.rpm Loaded plugins: downloadonly, rhnplugin There was an error communicating with RHN. RHN channel support will be disabled. Connection refused Setting up Local Package Process Examining subscription-manager-1.11.3-14.el5_11.i386.rpm: subscription- manager-1.11.3-14.el5_11.i386 Marking subscription-manager-1.11.3-14.el5_11.i386.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package subscription-manager.i386 0:1.11.3-14.el5_11 set to be updated --> Processing Dependency: python-rhsm >= 1.11.3-5 for package: subscription-manager --> Processing Dependency: pygobject2 for package: subscription-manager --> Processing Dependency: python-dateutil for package: subscription-manager --> Processing Dependency: python-ethtool for package: subscription-manager --> Processing Dependency: virt-what for package: subscription-manager --> Finished Dependency Resolution subscription-manager-1.11.3-14.el5_11.i386 from /subscription-manager- 1.11.3-14.el5_11.i386 has depsolving problems --> Missing Dependency: python-dateutil is needed by package subscription- manager-1.11.3-14.el5_11.i386 (/subscription-manager-1.11.3-14.el5_11.i386) subscription-manager-1.11.3-14.el5_11.i386 from /subscription-manager- 1.11.3-14.el5_11.i386 has depsolving problems --> Missing Dependency: python-rhsm >= 1.11.3-5 is needed by package subscription-manager-1.11.3-14.el5_11.i386 (/subscription-manager-1.11.3- 14.el5_11.i386) subscription-manager-1.11.3-14.el5_11.i386 from /subscription-manager- 1.11.3-14.el5_11.i386 has depsolving problems --> Missing Dependency: pygobject2 is needed by package subscription- manager-1.11.3-14.el5_11.i386 (/subscription-manager-1.11.3-14.el5_11.i386) subscription-manager-1.11.3-14.el5_11.i386 from /subscription-manager- 1.11.3-14.el5_11.i386 has depsolving problems --> Missing Dependency: python-ethtool is needed by package subscription- manager-1.11.3-14.el5_11.i386 (/subscription-manager-1.11.3-14.el5_11.i386) subscription-manager-1.11.3-14.el5_11.i386 from /subscription-manager-1.11.3-14.el5_11.i386 has depsolving problems --> Missing Dependency: virt-what is needed by package subscription- manager-1.11.3-14.el5_11.i386 (/subscription-manager-1.11.3-14.el5_11.i386) Error: Missing Dependency: pygobject2 is needed by package subscription- manager-1.11.3-14.el5_11.i386 (/subscription-manager-1.11.3-14.el5_11.i386) Error: Missing Dependency: python-ethtool is needed by package subscription-manager-1.11.3-14.el5_11.i386 (/subscription-manager-1.11.3- 14.el5_11.i386) Error: Missing Dependency: virt-what is needed by package subscription- manager-1.11.3-14.el5_11.i386 (/subscription-manager-1.11.3-14.el5_11.i386) Error: Missing Dependency: python-dateutil is needed by package subscription-manager-1.11.3-14.el5_11.i386 (/subscription-manager-1.11.3-14.el5_11.i386) Error: Missing Dependency: python-rhsm >= 1.11.3-5 is needed by package subscription-manager-1.11.3-14.el5_11.i386 (/subscription-manager-1.11.3- 14.el5_11.i386) You could try using --skip-broken to work around the problem You could try running: package-cleanup --problems package-cleanup --dupes rpm -Va --nofiles --nodigest
yum localinstall + where to put the other RPM when need them in case of dependencies
linux;yum
null
_webapps.44603
Is there a way to set it so my camera does not come on by default immediately when I place a call? When I click a contact in the new Hangouts popup in Chrome or in Gmail, I have a button that says Video Call. I used to be able to just do a voice call.Ideas?
Disable camera by default in Google Hangouts
google hangouts
null
_unix.83106
Friends, my laptop is getting overheated. I have integrated graphics:$ lspci | grep vga(standard input): 3 :00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)(standard input): 16 :01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 540M] (rev a1)and the temperature is getting too high:$ sensorsacpitz-virtual-0Adapter: Virtual devicetemp1: +84.0C (crit = +100.0C)temp2: +84.0C (crit = +100.0C)nouveau-pci-0100Adapter: PCI adaptertemp1: +76.0C (high = +95.0C, hyst = +3.0C) (crit = +105.0C, hyst = +5.0C) (emerg = +135.0C, hyst = +5.0C)coretemp-isa-0000Adapter: ISA adapterPhysical id 0: +79.0C (high = +86.0C, crit = +100.0C)Core 0: +79.0C (high = +86.0C, crit = +100.0C)Core 1: +78.0C (high = +86.0C, crit = +100.0C)Core 2: +75.0C (high = +86.0C, crit = +100.0C)Core 3: +78.0C (high = +86.0C, crit = +100.0C)I tried to install xorg-x11-drv-nvidia as suggested in here, but then my X-system is not coming up. (I was basically bitten by this bug and updated my xorg's. If needed, I am posting my my xorgs:$ rpm -qa|/usr/bin/grep xorg-x11xorg-x11-drv-mga-1.6.2-7.fc19.x86_64xorg-x11-drv-modesetting-0.6.0-7.fc19.x86_64xorg-x11-server-utils-7.7-1.fc19.x86_64xorg-x11-drv-openchrome-0.3.3-1.fc19.x86_64xorg-x11-drv-nouveau-1.0.7-1.fc19.x86_64xorg-x11-font-utils-7.5-17.fc19.x86_64xorg-x11-server-Xorg-1.14.2-4.fc19.x86_64xorg-x11-drv-vmmouse-13.0.0-5.fc19.x86_64xorg-x11-drv-vmware-13.0.1-1.fc19.x86_64xorg-x11-glamor-0.5.0-5.20130401git81aadb8.fc19.x86_64xorg-x11-drv-synaptics-1.7.1-2.fc19.x86_64xorg-x11-xauth-1.0.7-3.fc19.x86_64xorg-x11-drv-fbdev-0.4.3-9.fc19.x86_64xorg-x11-proto-devel-7.7-4.fc19.noarchxorg-x11-xinit-1.3.2-8.fc19.x86_64xorg-x11-server-common-1.14.2-4.fc19.i686xorg-x11-fonts-Type1-7.5-8.fc19.noarchxorg-x11-drv-evdev-2.8.0-1.fc19.x86_64xorg-x11-drv-qxl-0.1.1-0.13.20130703git8b03ec16.fc19.x86_64xorg-x11-drv-ati-7.1.0-5.20130408git6e74aacc5.fc19.x86_64xorg-x11-drv-wacom-0.21.0-1.fc19.x86_64xorg-x11-drv-vesa-2.3.2-9.fc19.x86_64xorg-x11-fonts-ISO8859-1-75dpi-7.5-8.fc19.noarchxorg-x11-utils-7.5-9.fc19.x86_64xorg-x11-xkb-utils-7.7-7.fc19.x86_64xorg-x11-drv-intel-2.21.8-1.fc19.x86_64)Kindly help.I am using fedora 19 with gnome 3.8EDIT$ toptop - 17:13:42 up 21 min, 3 users, load average: 0.25, 0.34, 0.38Tasks: 194 total, 2 running, 192 sleeping, 0 stopped, 0 zombie%Cpu0 : 5.0 us, 2.3 sy, 0.0 ni, 91.1 id, 0.0 wa, 1.0 hi, 0.7 si, 0.0 st%Cpu1 : 2.3 us, 1.0 sy, 0.0 ni, 95.7 id, 0.0 wa, 1.0 hi, 0.0 si, 0.0 st%Cpu2 : 6.0 us, 3.3 sy, 0.0 ni, 90.0 id, 0.0 wa, 0.3 hi, 0.3 si, 0.0 st%Cpu3 : 3.0 us, 0.3 sy, 0.0 ni, 95.7 id, 0.0 wa, 1.0 hi, 0.0 si, 0.0 st%Cpu4 : 3.3 us, 1.0 sy, 0.0 ni, 95.0 id, 0.0 wa, 0.7 hi, 0.0 si, 0.0 st%Cpu5 : 3.0 us, 1.0 sy, 0.0 ni, 94.7 id, 0.0 wa, 1.0 hi, 0.3 si, 0.0 st%Cpu6 : 76.3 us, 22.4 sy, 0.0 ni, 0.3 id, 0.0 wa, 1.0 hi, 0.0 si, 0.0 st%Cpu7 : 0.0 us, 0.0 sy, 0.0 ni, 98.7 id, 0.0 wa, 1.3 hi, 0.0 si, 0.0 stKiB Mem: 3940864 total, 2037364 used, 1903500 free, 68784 buffersKiB Swap: 8388604 total, 0 used, 8388604 free, 1126564 cachedand $ sensorsacpitz-virtual-0Adapter: Virtual devicetemp1: +84.0C (crit = +100.0C)temp2: +84.0C (crit = +100.0C)These two commands were used back to back. So nothing is working really.
overheating fedora 19 gnome
fedora
null
_cogsci.15315
It is known that concepts with similar attributes (color, shape... Etc.) are represented in a similar manner in the brain. However, is there any evidence of abstract relations, such as the as causal relation between two events are also represented in similar manners?For a example, the relation between a switch and a light (wherein the tilting of the switch causes the light to turn on), should have the same representation as a knob and a light (wherein the turning of the knob causes the light to turn on). What experimental setup could be used to test this with fMRI?
How are abstract relations represented neurally?
cognitive psychology;cognitive neuroscience;fmri
null
_unix.228210
When i try to do yum install body_guard from my local repo, it shows the following package details,---> Package body_guard.x86_64 0:0.2-0313 will be updated---> Package body_guard.x86_64 0:0.2-0315 will be an update--> Finished Dependency ResolutionDependencies Resolved=============================================================================================================================================== Package Arch Version Repository Size===============================================================================================================================================Updating: body_guard x86_64 0.2-0315 my-sg 18 MWhen i try to install an older version (say 312) of the same yum package, it fails No package body_guard.x86_64-0.2-0312 availableI used hypen as the seperator between package name and version number (format is packageName.archName-versionNumber), and issued the command as,yum install body_guard.x86_64-0.2-0312On doing, yum --showduplicates, i can see there exists a package with version numbered - 0.2-312
Yum install, format - 'packageName.archName-versionNumber' says no package
yum
From yum man page: Specifying package names A package can be referred to for install,update,list,remove etc with any of the following: name name.arch name-ver name-ver-rel name-ver-rel.arch name-epoch:ver-rel.arch epoch:name-ver-rel.arch For example: yum remove kernel-2.4.1-10.i686I think you misplaced {arch} it should be at last, the correct syntax is:yum install <package_name>-<version>-<rel>.<arch> Try:yum install body_guard-0.2-0312.x86_64
_unix.292556
I have 6 gzipped text files, each of which is ~17G when compressed. I need to see the last few lines (decompressed) of each file to check whether a particular problem is there. The obvious approach is very slow:for i in *; do zcat $i | tail -n3; doneI was thinking I could do something clever like:for i in *; do tail -n 30 $i | gunzip | tail -n 4 ; doneOr for i in *; do tac $i | head -100 | gunzip | tac | tail -n3; doneBut both complain about:gzip: stdin: not in gzip formatI thought that was because I was missing the gzip header, but this also fails:$ aa=$(head -c 300 file.gz)$ bb=$(tail -c 300 file.gz)$ printf '%s%s' $aa $bb | gunzipgzip: stdin: unexpected end of fileWhat I am really looking for is a ztail or ztac but I don't think those exist. Can anyone come up with a clever trick that lets me decompress and print the last few lines of a compressed file without decompressing the entire thing?
How can I decompress and print the last few lines of a compressed text file?
shell;command line;compression
You can't, as it has been already said, if the files have been compressed with standard gzip. If you have control over the compression, you can use dictzip to compress the files, it compresses the files in separate blocks and you can decompress just the last block (typically 64KB). And it is backward compatible with gzip, meaning the dictzipped file is perfectly legal gzipped file as well.Other possibility would be if you get the gzipped file as a concatenation of several already gzipped files, you could search for the last gzip signature and decompress everything after that.
_softwareengineering.285787
I'm having some discussions with my new colleagues regarding commenting. We both like Clean Code, and I'm perfectly fine with the fact that inline code comments should be avoided and that class and methods names should be used to express what they do. However, I'm a big fan of adding small class summaries that tries to explain the purpose of the class and what is actually represents, primarily so that its easy to maintain the single responsibility principle pattern. I'm also used to adding one-line summaries to methods that explains what the method is supposed to do. A typical example is the simple method public Product GetById(int productId) {...}I'm adding the following method summary /// <summary>/// Retrieves a product by its id, returns null if no product was found./// </summaryI believe that the fact that the method returns null should be documented. A developer that wants to call a method should not have to open up my code in order to see if the method returns null or throws an exception. Sometimes it's part of an interface, so the developer doesn't even know which underlying code is running?However, my colleagues think that these kinds of comments are code smell and that comments are always failures (Robert C. Martin).Is there a way to express and communicate these types of knowledge without adding comments? Since I'm a big fan of Robert C. Martin, I'm getting a bit confused. Are summaries the same as comments and therefore always failures?This is not a question about in-line comments.
Clean Code comments vs class documentation
comments;clean code
As others have said, there's a difference between API-documenting comments and in-line comments. From my perspective, the main difference is that an in-line comment is read alongside the code, whereas a documentation comment is read alongside the signature of whatever you're commenting.Given this, we can apply the same DRY principle. Is the comment saying the same thing as the signature? Let's look at your example:Retrieves a product by its idThis part just repeats what we already see from the name GetById plus the return type Product. It also raises the question what the difference between getting and retrieving is, and what bearing code vs. comment has on that distinction. So it's needless and slightly confusing. If anything, it's getting in the way of the actually useful, second part of the comment:returns null if no product was found.Ah! That's something we definitely can't know for sure just from the signature, and provides useful information.Now take this a step further. When people talk about comments as code smells, the question isn't whether the code as it is needs a comment, but whether the comment indicates that the code could be written better, to express the information in the comment. That's what code smell means- it doesn't mean don't do this!, it means if you're doing this, it could be a sign there's a problem.So if your colleagues tell you this comment about null is a code smell, you should simply ask them: Okay, how should I express this then? If they have a feasible answer, you've learned something. If not, it'll probably kill their complaints dead.Regarding this specific case, generally the null issue is well known to be a difficult one. There's a reason code bases are littered with guard clauses, why null checks are a popular precondition for code contracts, why the existence of null has been called a billion-dollar mistake. There aren't that many viable options. One popular one, though, found in C# is the Try... convention:public bool TryGetById(int productId, out Product product);In other languages, it may be idiomatic to use a type (often called something like Optional or Maybe) to indicate a result that may or may not be there:public Optional<Product> GetById(int productId);So in a way, this anti-comment stance has gotten us somewhere: we've at least thought about whether this comment represents a smell, and what alternatives might exist for us.Whether we should actually prefer these over the original signature is a whole other debate, but we at least have options for expressing through code rather than comments what happens when no product is found. You should discuss with your colleagues which of these options they think is better and why, and hopefully help move on beyond blanket dogmatic statements about comments.
_unix.28739
While Installing the Red Hat Directory Server on the Red Hat Linux Server 5 (x86_64)i am getting the following errorbin/slapd/server/dsktune: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directoryI thought may be this is the dependency problem and I have installed the rpm compat-libstdc++ from the redhat CD of x66_64 and i queried using rpm -qa | grep compat-libst* i am able to find the rpm in the installed packages.What could be the resolution for this issue ?EDIT1: I have run the following command ldconfig -v | grep libstdc[root@redhot redhat-ds]# ldconfig -v | grep libstdc libstdc++.so.6 -> libstdc++.so.6.0.8 libstdc++.so.5 -> libstdc++.so.5.0.7 libstdc++.so.6 -> libstdc++.so.6.0.8EDIT2: [root@hadoopredhot server]# ldd -v dsktune linux-gate.so.1 => (0xffffe000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x00489000) libstdc++.so.5 => not found libm.so.6 => /lib/libm.so.6 (0x004f4000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00d85000) libc.so.6 => /lib/libc.so.6 (0x00347000) /lib/ld-linux.so.2 (0x0032a000) Version information: ./dsktune: libc.so.6 (GLIBC_2.3) => /lib/libc.so.6 libc.so.6 (GLIBC_2.2) => /lib/libc.so.6 libc.so.6 (GLIBC_2.1) => /lib/libc.so.6 libc.so.6 (GLIBC_2.0) => /lib/libc.so.6 /lib/libcrypt.so.1: libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6 libc.so.6 (GLIBC_2.0) => /lib/libc.so.6 /lib/libm.so.6: ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2 libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6 libc.so.6 (GLIBC_2.0) => /lib/libc.so.6 /lib/libgcc_s.so.1: libc.so.6 (GLIBC_2.1.3) => /lib/libc.so.6 libc.so.6 (GLIBC_2.2.4) => /lib/libc.so.6 libc.so.6 (GLIBC_2.4) => /lib/libc.so.6 libc.so.6 (GLIBC_2.0) => /lib/libc.so.6 /lib/libc.so.6: ld-linux.so.2 (GLIBC_PRIVATE) => /lib/ld-linux.so.2 ld-linux.so.2 (GLIBC_2.3) => /lib/ld-linux.so.2 ld-linux.so.2 (GLIBC_2.1) => /lib/ld-linux.so.2EDIT3:[root@hadoopredhot server]# ldconfig -v /usr/lib/vmware-tools/lib32/libvmGuestLib.so: libvmGuestLib.so -> libvmGuestLib.so/usr/lib/vmware-tools/lib64/libvmGuestLib.so: libvmGuestLib.so -> libvmGuestLib.so/usr/lib/vmware-tools/lib32/libvmGuestLibJava.so: libvmGuestLibJava.so -> libvmGuestLibJava.so/usr/lib/vmware-tools/lib64/libvmGuestLibJava.so: libvmGuestLibJava.so -> libvmGuestLibJava.so/usr/lib/vmware-tools/lib32/libDeployPkg.so: libDeployPkg.so -> libDeployPkg.so/usr/lib/vmware-tools/lib64/libDeployPkg.so: libDeployPkg.so -> libDeployPkg.so/lib: libSegFault.so -> libSegFault.so libc.so.6 -> libc-2.5.so libnss_nis.so.2 -> libnss_nis-2.5.so libsepol.so.1 -> libsepol.so.1 libuuid.so.1 -> libuuid.so.1.2 libe2p.so.2 -> libe2p.so.2.3 libcom_err.so.2 -> libcom_err.so.2.1 libdl.so.2 -> libdl-2.5.so libcidn.so.1 -> libcidn-2.5.so libnss_nisplus.so.2 -> libnss_nisplus-2.5.so libcrypt.so.1 -> libcrypt-2.5.so libnss_ldap.so.2 -> libnss_ldap-2.5.so libssl.so.6 -> libssl.so.0.9.8b libaudit.so.0 -> libaudit.so.0.0.0 libm.so.6 -> libm-2.5.so libext2fs.so.2 -> libext2fs.so.2.4 libselinux.so.1 -> libselinux.so.1 libBrokenLocale.so.1 -> libBrokenLocale-2.5.so libgmodule-2.0.so.0 -> libgmodule-2.0.so.0.1200.3 libgcc_s.so.1 -> libgcc_s-4.1.2-20070626.so.1 libpamc.so.0 -> libpamc.so.0.81.0 libnsl.so.1 -> libnsl-2.5.so libpam.so.0 -> libpam.so.0.81.5 libnss_db.so.2 -> libnss_db-2.2.so libnss_hesiod.so.2 -> libnss_hesiod-2.5.so libpthread.so.0 -> libpthread-2.5.so libgthread-2.0.so.0 -> libgthread-2.0.so.0.1200.3 libasound.so.2 -> libasound.so.2.0.0 libss.so.2 -> libss.so.2.0 libexpat.so.0 -> libexpat.so.0.5.0 libcrypto.so.6 -> libcrypto.so.0.9.8b libdevmapper-event.so.1.02 -> libdevmapper-event.so.1.02 libutil.so.1 -> libutil-2.5.so libcap.so.1 -> libcap.so.1.10 libresolv.so.2 -> libresolv-2.5.so libdevmapper.so.1.02 -> libdevmapper.so.1.02 libpam_misc.so.0 -> libpam_misc.so.0.81.2 libtermcap.so.2 -> libtermcap.so.2.0.8 libauparse.so.0 -> libauparse.so.0.0.0 libnss_dns.so.2 -> libnss_dns-2.5.so libiw.so.28 -> libiw.so.28 libkeyutils.so.1 -> libkeyutils-1.2.so libanl.so.1 -> libanl-2.5.so libglib-2.0.so.0 -> libglib-2.0.so.0.1200.3 libgobject-2.0.so.0 -> libgobject-2.0.so.0.1200.3 libnss_files.so.2 -> libnss_files-2.5.so libacl.so.1 -> libacl.so.1.1.0 libdbus-1.so.3 -> libdbus-1.so.3.2.0 libvolume_id.so.0 -> libvolume_id.so.0.66.0 libattr.so.1 -> libattr.so.1.1.0 libdb-4.3.so -> libdb-4.3.so ld-linux.so.2 -> ld-2.5.so librt.so.1 -> librt-2.5.so libblkid.so.1 -> libblkid.so.1.0 libthread_db.so.1 -> libthread_db-1.0.so libnss_compat.so.2 -> libnss_compat-2.5.so/lib64: libnss_winbind.so.2 -> libnss_winbind.so.2 libSegFault.so -> libSegFault.so libproc-3.2.7.so -> libproc-3.2.7.so libc.so.6 -> libc-2.5.so libnss_nis.so.2 -> libnss_nis-2.5.so libsepol.so.1 -> libsepol.so.1 libuuid.so.1 -> libuuid.so.1.2 libe2p.so.2 -> libe2p.so.2.3 libcom_err.so.2 -> libcom_err.so.2.1 libdl.so.2 -> libdl-2.5.so libcidn.so.1 -> libcidn-2.5.so libnss_nisplus.so.2 -> libnss_nisplus-2.5.so libcrypt.so.1 -> libcrypt-2.5.so libnss_ldap.so.2 -> libnss_ldap-2.5.so libssl.so.6 -> libssl.so.0.9.8b libaudit.so.0 -> libaudit.so.0.0.0 ld-linux-x86-64.so.2 -> ld-2.5.so libm.so.6 -> libm-2.5.so libext2fs.so.2 -> libext2fs.so.2.4 libselinux.so.1 -> libselinux.so.1 libnss_wins.so.2 -> libnss_wins.so.2 libBrokenLocale.so.1 -> libBrokenLocale-2.5.so libgmodule-2.0.so.0 -> libgmodule-2.0.so.0.1200.3 libgcc_s.so.1 -> libgcc_s-4.1.2-20070626.so.1 libpamc.so.0 -> libpamc.so.0.81.0 libnsl.so.1 -> libnsl-2.5.so libpam.so.0 -> libpam.so.0.81.5 libnss_db.so.2 -> libnss_db-2.2.so libsemanage.so.1 -> libsemanage.so.1 libnss_hesiod.so.2 -> libnss_hesiod-2.5.so libpthread.so.0 -> libpthread-2.5.so libgthread-2.0.so.0 -> libgthread-2.0.so.0.1200.3 libasound.so.2 -> libasound.so.2.0.0 libss.so.2 -> libss.so.2.0 libexpat.so.0 -> libexpat.so.0.5.0 libcrypto.so.6 -> libcrypto.so.0.9.8b libpcre.so.0 -> libpcre.so.0.0.1 libdevmapper-event.so.1.02 -> libdevmapper-event.so.1.02 libutil.so.1 -> libutil-2.5.so libcap.so.1 -> libcap.so.1.10 libresolv.so.2 -> libresolv-2.5.so libdevmapper.so.1.02 -> libdevmapper.so.1.02 libpam_misc.so.0 -> libpam_misc.so.0.81.2 libtermcap.so.2 -> libtermcap.so.2.0.8 libauparse.so.0 -> libauparse.so.0.0.0 libnss_dns.so.2 -> libnss_dns-2.5.so libiw.so.28 -> libiw.so.28 libdevmapper-event-lvm2mirror.so.2.02 -> libdevmapper-event-lvm2mirror.so.2.02 libkeyutils.so.1 -> libkeyutils-1.2.so libanl.so.1 -> libanl-2.5.so libglib-2.0.so.0 -> libglib-2.0.so.0.1200.3 libgobject-2.0.so.0 -> libgobject-2.0.so.0.1200.3 libnss_files.so.2 -> libnss_files-2.5.so libacl.so.1 -> libacl.so.1.1.0 libdbus-1.so.3 -> libdbus-1.so.3.2.0 libvolume_id.so.0 -> libvolume_id.so.0.66.0 libattr.so.1 -> libattr.so.1.1.0 libdb-4.3.so -> libdb-4.3.so librt.so.1 -> librt-2.5.so libblkid.so.1 -> libblkid.so.1.0 libthread_db.so.1 -> libthread_db-1.0.so libnss_compat.so.2 -> libnss_compat-2.5.so/usr/lib: libnssckbi.so -> libnssckbi.so libgailutil.so.18 -> libgailutil.so.18.0.1 libplc4.so -> libplc4.so libplds4.so -> libplds4.so libaudiofile.so.0 -> libaudiofile.so.0.0.2 libform.so.5 -> libform.so.5.5 libgpg-error.so.0 -> libgpg-error.so.0.3.0 libsmime3.so -> libsmime3.so libsoftokn3.so -> libsoftokn3.so libesddsp.so.0 -> libesddsp.so.0.2.36 libgnutls-extra.so.13 -> libgnutls-extra.so.13.0.6 libgnutls-openssl.so.13 -> libgnutls-openssl.so.13.0.6 libgnome-keyring.so.0 -> libgnome-keyring.so.0.0.1 libnspr4.so -> libnspr4.so libORBitCosNaming-2.so.0 -> libORBitCosNaming-2.so.0.1.0 libnss3.so -> libnss3.so libz.so.1 -> libz.so.1.2.3 libcupsimage.so.2 -> libcupsimage.so.2 libdbus-glib-1.so.2 -> libdbus-glib-1.so.2.0.0 libkadm5clnt.so.5 -> libkadm5clnt.so.5.1 libORBit-imodule-2.so.0 -> libORBit-imodule-2.so.0.0.0 libcryptsetup.so.0 -> libcryptsetup.so.0.0.0 libegroupwise-1.2.so.12 -> libegroupwise-1.2.so.12.0.0 libfontconfig.so.1 -> libfontconfig.so.1.1.0 libmetacity-private.so.0 -> libmetacity-private.so.0.0.0 libgdk_pixbuf_xlib-2.0.so.0 -> libgdk_pixbuf_xlib-2.0.so.0.1000.4 libusb-0.1.so.4 -> libusb-0.1.so.4.4.4 libhistory.so.5 -> libhistory.so.5.1 libpspell.so.15 -> libpspell.so.15.1.3 libkdb5.so.4 -> libkdb5.so.4.0 libebook-1.2.so.9 -> libebook-1.2.so.9.0.0 libbdevid.so.5.1.19.6 -> libbdevid.so.5.1.19.6 libgcrypt.so.11 -> libgcrypt.so.11.2.2 libavahi-core.so.4 -> libavahi-core.so.4.0.5 libcamel-1.2.so.0 -> libcamel-1.2.so.0.0.0 libgstbase-0.10.so.0 -> libgstbase-0.10.so.0.8.1 libgamin-1.so.0 -> libgamin-1.so.0.1.7 libXdmcp.so.6 -> libXdmcp.so.6.0.0 libncurses.so.5 -> libncurses.so.5.5 libecal-1.2.so.7 -> libecal-1.2.so.7.0.0 libcups.so.2 -> libcups.so.2 libXft.so.2 -> libXft.so.2.1.2 libgstcontroller-0.10.so.0 -> libgstcontroller-0.10.so.0.8.1 libspi.so.0 -> libspi.so.0.10.11 libwrap.so.0 -> libwrap.so.0.7.6 libatk-1.0.so.0 -> libatk-1.0.so.0.1212.0 libeel-2.so.2 -> libeel-2.so.2.16.1 libORBit-2.so.0 -> libORBit-2.so.0.1.0 libXinerama.so.1 -> libXinerama.so.1.0.0 libXau.so.6 -> libXau.so.6.0.0 libXRes.so.1 -> libXRes.so.1.0.0 libdrm.so.2 -> libdrm.so.2.0.0 libgtk-x11-2.0.so.0 -> libgtk-x11-2.0.so.0.1000.4 libgdk_pixbuf-2.0.so.0 -> libgdk_pixbuf-2.0.so.0.1000.4 libncursesw.so.5 -> libncursesw.so.5.5 libXtst.so.6 -> libXtst.so.6.1.0 libgnomeui-2.so.0 -> libgnomeui-2.so.0.1600.0 libkadm5srv.so.5 -> libkadm5srv.so.5.1 libGLU.so.1 -> libGLU.so.1.3.060501 libgstdataprotocol-0.10.so.0 -> libgstdataprotocol-0.10.so.0.8.1 libformw.so.5 -> libformw.so.5.5 libXext.so.6 -> libXext.so.6.4.0 libgnomecanvas-2.so.0 -> libgnomecanvas-2.so.0.1400.0 libavahi-glib.so.1 -> libavahi-glib.so.1.0.1 libgnomeprint-2-2.so.0 -> libgnomeprint-2-2.so.0.1.0 libaspell.so.15 -> libaspell.so.15.1.3 libkrb5.so.3 -> libkrb5.so.3.3 libsvrcore.so.0 -> libsvrcore.so.0.0.0 libpango-1.0.so.0 -> libpango-1.0.so.0.1400.9 libgnomeprintui-2-2.so.0 -> libgnomeprintui-2-2.so.0.1.0 libSM.so.6 -> libSM.so.6.0.0 libgssapi_krb5.so.2 -> libgssapi_krb5.so.2.2 libbz2.so.1 -> libbz2.so.1.0.3 libpanel-applet-2.so.0 -> libpanel-applet-2.so.0.2.11 libgtkhtml-3.8.so.15 -> libgtkhtml-3.8.so.15.3.9 libpangoft2-1.0.so.0 -> libpangoft2-1.0.so.0.1400.9 libparted-1.8.so.0 -> libparted-1.8.so.0.0.1 libgnome-2.so.0 -> libgnome-2.so.0.1600.0 libgstnet-0.10.so.0 -> libgstnet-0.10.so.0.8.1 libXss.so.1 -> libXss.so.1.0.0 libgnutls.so.13 -> libgnutls.so.13.0.6 libstdc++.so.6 -> libstdc++.so.6.0.8 libgnome-menu.so.2 -> libgnome-menu.so.2.1.3 libGL.so.1 -> libGL.so.1.2 libcrack.so.2 -> libcrack.so.2.8.0 libpanelw.so.5 -> libpanelw.so.5.5 libgnome-desktop-2.so.2 -> libgnome-desktop-2.so.2.2.21 libxkbfile.so.1 -> libxkbfile.so.1.0.2 libgdk-x11-2.0.so.0 -> libgdk-x11-2.0.so.0.1000.4 libutempter.so.0 -> libutempter.so.1.1.4 libavahi-common.so.3 -> libavahi-common.so.3.4.3 libXxf86vm.so.1 -> libXxf86vm.so.1.0.0 libXdamage.so.1 -> libXdamage.so.1.0.0 libXxf86misc.so.1 -> libXxf86misc.so.1.1.0 libxklavier.so.11 -> libxklavier.so.11.0.0 libglade-2.0.so.0 -> libglade-2.0.so.0.0.7 libusbpp-0.1.so.4 -> libusbpp-0.1.so.4.4.4 libk5crypto.so.3 -> libk5crypto.so.3.1 libhal.so.1 -> libhal.so.1.0.0 libpangocairo-1.0.so.0 -> libpangocairo-1.0.so.0.1400.9 libcairo.so.2 -> libcairo.so.2.9.2 libfreebl3.so -> libfreebl3.so libavahi-client.so.3 -> libavahi-client.so.3.2.1 libreadline.so.5 -> libreadline.so.5.1 libpopt.so.0 -> libpopt.so.0.0.0 libtiffxx.so.3 -> libtiffxx.so.3.8.2 libldap-2.3.so.0 -> libldap-2.3.so.0.2.15 libwnck-1.so.18 -> libwnck-1.so.18.2.3 libbonoboui-2.so.0 -> libbonoboui-2.so.0.0.0 libtiff.so.3 -> libtiff.so.3.8.2 libfam.so.0 -> libfam.so.0.0.0 libckyapplet.so.1 -> libckyapplet.so.1.0.0 libkrb4.so.2 -> libkrb4.so.2.0 libgdict-1.0.so.5 -> libgdict-1.0.so.5.0.5 libgnome-mag.so.2 -> libgnome-mag.so.2.1.1 libglut.so.3 -> libglut.so.3.8.0 libXi.so.6 -> libXi.so.6.0.0 libnuma.so.1 -> libnuma.so.1 libsasl2.so.2 -> libsasl2.so.2.0.22 libedataserverui-1.2.so.8 -> libedataserverui-1.2.so.8.0.0 libgnomevfs-2.so.0 -> libgnomevfs-2.so.0.1600.2 liblber-2.3.so.0 -> liblber-2.3.so.0.2.15 libhal-storage.so.1 -> libhal-storage.so.1.0.0 libgconf-2.so.4 -> libgconf-2.so.4.1.0 libdb_cxx-4.3.so -> libdb_cxx-4.3.so libnautilus-extension.so.1 -> libnautilus-extension.so.1.1.0 libbonobo-activation.so.4 -> libbonobo-activation.so.4.0.0 libcspi.so.0 -> libcspi.so.0.10.11 libnautilus-burn.so.4 -> libnautilus-burn.so.4.0.0 libjpeg.so.62 -> libjpeg.so.62.0.0 libXrandr.so.2 -> libXrandr.so.2.0.0 libdes425.so.3 -> libdes425.so.3.0 libIDL-2.so.0 -> libIDL-2.so.0.0.0 libedata-cal-1.2.so.6 -> libedata-cal-1.2.so.6.0.0 libpangox-1.0.so.0 -> libpangox-1.0.so.0.1400.9 libbonobo-2.so.0 -> libbonobo-2.so.0.0.0 libkrb5support.so.0 -> libkrb5support.so.0.1 libpangoxft-1.0.so.0 -> libpangoxft-1.0.so.0.1400.9 libmenu.so.5 -> libmenu.so.5.5 libXcursor.so.1 -> libXcursor.so.1.0.2 libXrender.so.1 -> libXrender.so.1.3.0 libedataserver-1.2.so.7 -> libedataserver-1.2.so.7.1.0 libstartup-notification-1.so.0 -> libstartup-notification-1.so.0.0.0 libloginhelper.so.0 -> libloginhelper.so.0.0.0 libssl3.so -> libssl3.so libICE.so.6 -> libICE.so.6.3.0 libgssrpc.so.4 -> libgssrpc.so.4.0 libcamel-provider-1.2.so.8 -> libcamel-provider-1.2.so.8.1.0 libexchange-storage-1.2.so.2 -> libexchange-storage-1.2.so.2.0.0 libgnome-window-settings.so.1 -> libgnome-window-settings.so.1.0.0 libedata-book-1.2.so.2 -> libedata-book-1.2.so.2.3.0 libpanel.so.5 -> libpanel.so.5.5 libldap_r-2.3.so.0 -> libldap_r-2.3.so.0.2.15 libpng.so.3 -> libpng.so.3.10.0 libgstreamer-0.10.so.0 -> libgstreamer-0.10.so.0.8.1 libXt.so.6 -> libXt.so.6.0.0 libxml2.so.2 -> libxml2.so.2.6.26 libaio.so.1.0.0 -> libaio.so.1.0.0 libXevie.so.1 -> libXevie.so.1.0.0 libsoup-2.2.so.8 -> libsoup-2.2.so.8.5.0 libesd.so.0 -> libesd.so.0.2.36 libart_lgpl_2.so.2 -> libart_lgpl_2.so.2.3.17 libaio.so.1 -> libaio.so.1.0.1 libgtop-2.0.so.7 -> libgtop-2.0.so.7.0.0 libmenuw.so.5 -> libmenuw.so.5.5 libdaemon.so.0 -> libdaemon.so.0.2.4 libgpm.so.1 -> libgpm.so.1.19.0 libX11.so.6 -> libX11.so.6.2.0 libpng12.so.0 -> libpng12.so.0.10.0 libXfixes.so.3 -> libXfixes.so.3.1.0 libfreetype.so.6 -> libfreetype.so.6.3.10 libgnomecups-1.0.so.1 -> libgnomecups-1.0.so.1.0.0/usr/lib64: liblwres.so.9 -> liblwres.so.9.1.3 libnssckbi.so -> libnssckbi.so libgailutil.so.18 -> libgailutil.so.18.0.1 libgsf-1.so.114 -> libgsf-1.so.114.0.1 libplc4.so -> libplc4.so libplds4.so -> libplds4.so libaudiofile.so.0 -> libaudiofile.so.0.0.2 libform.so.5 -> libform.so.5.5 librpmbuild-4.4.so -> librpmbuild-4.4.so libgpg-error.so.0 -> libgpg-error.so.0.3.0 libsmime3.so -> libsmime3.so libsoftokn3.so -> libsoftokn3.so libssldap60.so -> libssldap60.so libgettextsrc-0.14.6.so -> libgettextsrc-0.14.6.so libstunnel.so -> libstunnel.so libesddsp.so.0 -> libesddsp.so.0.2.36 libdmraid.so.1.0.0.rc13 -> libdmraid.so.1.0.0.rc13 libmagic.so.1 -> libmagic.so.1.0.0 libpoppler.so.1 -> libpoppler.so.1.0.0 libisccfg.so.1 -> libisccfg.so.1.0.6 libgnutls-extra.so.13 -> libgnutls-extra.so.13.0.6 libgnutls-openssl.so.13 -> libgnutls-openssl.so.13.0.6 libprldap60.so -> libprldap60.so libbluetooth.so.2 -> libbluetooth.so.2.4.1 libgnome-keyring.so.0 -> libgnome-keyring.so.0.0.1 libnspr4.so -> libnspr4.so libORBitCosNaming-2.so.0 -> libORBitCosNaming-2.so.0.1.0 libnss3.so -> libnss3.so librpmio-4.4.so -> librpmio-4.4.so libcdda_interface.so.0 -> libcdda_interface.so.0.9.8 libz.so.1 -> libz.so.1.2.3 libcddb-slave2.so.0 -> libcddb-slave2.so.0.0.0 libcupsimage.so.2 -> libcupsimage.so.2 libgucharmap.so.5 -> libgucharmap.so.5.0.1 libOggFLAC++.so.2 -> libOggFLAC++.so.2.0.0 libhesiod.so.0 -> libhesiod.so.0.0.0 libdbus-glib-1.so.2 -> libdbus-glib-1.so.2.0.0 libsefs.so.3 -> libsefs.so.3 libdmx.so.1 -> libdmx.so.1.0.0 libpcrecpp.so.0 -> libpcrecpp.so.0.0.0 libXpm.so.4 -> libXpm.so.4.11.0 libsysfs.so.2 -> libsysfs.so.2.0.0 libkadm5clnt.so.5 -> libkadm5clnt.so.5.1 libORBit-imodule-2.so.0 -> libORBit-imodule-2.so.0.0.0 libcryptsetup.so.0 -> libcryptsetup.so.0.0.0 libgstinterfaces-0.10.so.0 -> libgstinterfaces-0.10.so.0.6.0 libegroupwise-1.2.so.12 -> libegroupwise-1.2.so.12.0.0 libfontconfig.so.1 -> libfontconfig.so.1.1.0 libmetacity-private.so.0 -> libmetacity-private.so.0.0.0 libgdk_pixbuf_xlib-2.0.so.0 -> libgdk_pixbuf_xlib-2.0.so.0.1000.4 libusb-0.1.so.4 -> libusb-0.1.so.4.4.4 libhistory.so.5 -> libhistory.so.5.1 libelf.so.1 -> libelf-0.125.so libgsf-gnome-1.so.114 -> libgsf-gnome-1.so.114.0.1 libpspell.so.15 -> libpspell.so.15.1.3 libkdb5.so.4 -> libkdb5.so.4.0 libebook-1.2.so.9 -> libebook-1.2.so.9.0.0 libgs.so.8 -> libgs.so.8.15 libXfontcache.so.1 -> libXfontcache.so.1.0.0 libbdevid.so.5.1.19.6 -> libbdevid.so.5.1.19.6 libtheora.so.0 -> libtheora.so.0.2.0 libgcrypt.so.11 -> libgcrypt.so.11.2.2 libavahi-core.so.4 -> libavahi-core.so.4.0.5 libcamel-1.2.so.0 -> libcamel-1.2.so.0.0.0 libgstbase-0.10.so.0 -> libgstbase-0.10.so.0.8.1 libgamin-1.so.0 -> libgamin-1.so.0.1.7 libXdmcp.so.6 -> libXdmcp.so.6.0.0 libFLAC.so.7 -> libFLAC.so.7.0.0 libuser.so.1 -> libuser.so.1.1.6 libspeex.so.1 -> libspeex.so.1.3.0 libnm-util.so.0 -> libnm-util.so.0.0.0 libgweather.so.0 -> libgweather.so.0.0.0 libncurses.so.5 -> libncurses.so.5.5 libecal-1.2.so.7 -> libecal-1.2.so.7.0.0 libcups.so.2 -> libcups.so.2 libfontenc.so.1 -> libfontenc.so.1.0.0 libXft.so.2 -> libXft.so.2.1.2 liblvm2cmd.so.2.02 -> liblvm2cmd.so.2.02 libFS.so.6 -> libFS.so.6.0.0 libgstcdda-0.10.so.0 -> libgstcdda-0.10.so.0.6.0 libgstcontroller-0.10.so.0 -> libgstcontroller-0.10.so.0.8.1 libspi.so.0 -> libspi.so.0.10.11 libwrap.so.0 -> libwrap.so.0.7.6 libatk-1.0.so.0 -> libatk-1.0.so.0.1212.0 libXaw.so.6 -> libXaw6.so.6.0.1 libldap60.so -> libldap60.so librom1394.so.0 -> librom1394.so.0.3.0 libeel-2.so.2 -> libeel-2.so.2.16.1 libORBit-2.so.0 -> libORBit-2.so.0.1.0 libXinerama.so.1 -> libXinerama.so.1.0.0 libgdbm.so.2 -> libgdbm.so.2.0.0 libijs-0.35.so -> libijs.so libpcreposix.so.0 -> libpcreposix.so.0.0.0 libXau.so.6 -> libXau.so.6.0.0 libXRes.so.1 -> libXRes.so.1.0.0 libvte.so.9 -> libvte.so.9.1.5 libraw1394.so.8 -> libraw1394.so.8.1.1 libdrm.so.2 -> libdrm.so.2.0.0 libexslt.so.0 -> libexslt.so.0.8.13 libgtk-x11-2.0.so.0 -> libgtk-x11-2.0.so.0.1000.4 libgdk_pixbuf-2.0.so.0 -> libgdk_pixbuf-2.0.so.0.1000.4 libqpol.so.1 -> libqpol.so.1 libsqlite3.so.0 -> libsqlite3.so.0.8.6 libncursesw.so.5 -> libncursesw.so.5.5 libXtst.so.6 -> libXtst.so.6.1.0 libgnomeui-2.so.0 -> libgnomeui-2.so.0.1600.0 liblockdev.so.1 -> liblockdev.so.1.0.1 libkadm5srv.so.5 -> libkadm5srv.so.5.1 libXaw.so.7 -> libXaw7.so.7.0.0 libGLU.so.1 -> libGLU.so.1.3.060501 libgstdataprotocol-0.10.so.0 -> libgstdataprotocol-0.10.so.0.8.1 libopcodes-2.17.50.0.6-5.el5.so -> libopcodes-2.17.50.0.6-5.el5.so libgtksourceview-1.0.so.0 -> libgtksourceview-1.0.so.0.0.0 libformw.so.5 -> libformw.so.5.5 libOpenIPMIposix.so.0 -> libOpenIPMIposix.so.0.0.1 libXext.so.6 -> libXext.so.6.4.0 libgphoto2.so.2 -> libgphoto2.so.2.1.1 libdv.so.4 -> libdv.so.4.0.2 libgnomecanvas-2.so.0 -> libgnomecanvas-2.so.0.1400.0 libavahi-glib.so.1 -> libavahi-glib.so.1.0.1 libgnomeprint-2-2.so.0 -> libgnomeprint-2-2.so.0.1.0 libnetsnmp.so.10 -> libnetsnmp.so.10.0.1 libaspell.so.15 -> libaspell.so.15.1.3 libldif60.so -> libldif60.so librpmdb-4.4.so -> librpmdb-4.4.so libkrb5.so.3 -> libkrb5.so.3.3 libstdc++.so.5 -> libstdc++.so.5.0.7 libsvrcore.so.0 -> libsvrcore.so.0.0.0 librsvg-2.so.2 -> librsvg-2.so.2.16.1 libpango-1.0.so.0 -> libpango-1.0.so.0.1400.9 libgnomeprintui-2-2.so.0 -> libgnomeprintui-2-2.so.0.1.0 libSM.so.6 -> libSM.so.6.0.0 libgssapi_krb5.so.2 -> libgssapi_krb5.so.2.2 libOpenIPMIutils.so.0 -> libOpenIPMIutils.so.0.0.1 libbz2.so.1 -> libbz2.so.1.0.3 libOpenIPMIpthread.so.0 -> libOpenIPMIpthread.so.0.0.1 libpanel-applet-2.so.0 -> libpanel-applet-2.so.0.2.11 libbfd-2.17.50.0.6-5.el5.so -> libbfd-2.17.50.0.6-5.el5.so liblftp-jobs.so.0 -> liblftp-jobs.so.0.0.0 libslang.so.2 -> libslang.so.2.0.6 libgtkhtml-3.8.so.15 -> libgtkhtml-3.8.so.15.3.9 libpangoft2-1.0.so.0 -> libpangoft2-1.0.so.0.1400.9 libostyle.so.0 -> libostyle.so.0.0.1 libparted-1.8.so.0 -> libparted-1.8.so.0.0.1 libgnome-2.so.0 -> libgnome-2.so.0.1600.0 libscrollkeeper.so.0 -> libscrollkeeper.so.0.0.0 libI810XvMC.so.1 -> libI810XvMC.so.1.0.0 libnetsnmptrapd.so.10 -> libnetsnmptrapd.so.10.0.1 librpcsecgss.so.2 -> librpcsecgss.so.2.0.1 libgstnet-0.10.so.0 -> libgstnet-0.10.so.0.8.1 libXfont.so.1 -> libXfont.so.1.4.1 librpm-4.4.so -> librpm-4.4.so libXss.so.1 -> libXss.so.1.0.0 libgnutls.so.13 -> libgnutls.so.13.0.6 libOpenIPMI.so.0 -> libOpenIPMI.so.0.0.5 libstdc++.so.6 -> libstdc++.so.6.0.8 libisc.so.11 -> libisc.so.11.1.1 libFLAC++.so.5 -> libFLAC++.so.5.0.0 libgstaudio-0.10.so.0 -> libgstaudio-0.10.so.0.6.0 libgnome-menu.so.2 -> libgnome-menu.so.2.1.3 libGL.so.1 -> libGL.so.1.2 libvorbisfile.so.3 -> libvorbisfile.so.3.1.1 libcrack.so.2 -> libcrack.so.2.8.0 libbeecrypt.so.6 -> libbeecrypt.so.6.4.0 libpanelw.so.5 -> libpanelw.so.5.5 libnotify.so.1 -> libnotify.so.1.1.0 libdns.so.22 -> libdns.so.22.0.1 libbind9.so.0 -> libbind9.so.0.0.8 libgnome-desktop-2.so.2 -> libgnome-desktop-2.so.2.2.21 libxkbfile.so.1 -> libxkbfile.so.1.0.2 libgdk-x11-2.0.so.0 -> libgdk-x11-2.0.so.0.1000.4 libutempter.so.0 -> libutempter.so.1.1.4 libpython2.4.so.1.0 -> libpython2.4.so.1.0 libavahi-common.so.3 -> libavahi-common.so.3.4.3 libXxf86vm.so.1 -> libXxf86vm.so.1.0.0 libXv.so.1 -> libXv.so.1.0.0 libXdamage.so.1 -> libXdamage.so.1.0.0 libOpenIPMIui.so.1 -> libOpenIPMIui.so.1.0.1 libXxf86misc.so.1 -> libXxf86misc.so.1.1.0 libxklavier.so.11 -> libxklavier.so.11.0.0 libglade-2.0.so.0 -> libglade-2.0.so.0.0.7 libxslt.so.1 -> libxslt.so.1.1.17 libusbpp-0.1.so.4 -> libusbpp-0.1.so.4.4.4 libk5crypto.so.3 -> libk5crypto.so.3.1 libtcl8.4.so -> libtcl8.4.so libhal.so.1 -> libhal.so.1.0.0 libpangocairo-1.0.so.0 -> libpangocairo-1.0.so.0.1400.9 libpoldiff.so.1 -> libpoldiff.so.1 libcairo.so.2 -> libcairo.so.2.9.2 liblftp-tasks.so.0 -> liblftp-tasks.so.0.0.0 libogg.so.0 -> libogg.so.0.5.3 libgssapi.so.2 -> libgssapi.so.2.0.0 libXmuu.so.1 -> libXmuu.so.1.0.0 libfreebl3.so -> libfreebl3.so libsnmp.so.10 -> libsnmp.so.10.0.1 libavahi-client.so.3 -> libavahi-client.so.3.2.1 libreadline.so.5 -> libreadline.so.5.1 libpopt.so.0 -> libpopt.so.0.0.0 libtiffxx.so.3 -> libtiffxx.so.3.8.2 libldap-2.3.so.0 -> libldap-2.3.so.0.2.15 libXxf86dga.so.1 -> libXxf86dga.so.1.0.0 libwnck-1.so.18 -> libwnck-1.so.18.2.3 libbonoboui-2.so.0 -> libbonoboui-2.so.0.0.0 libospgrove.so.0 -> libospgrove.so.0.0.1 libtiff.so.3 -> libtiff.so.3.8.2 libbrlapi.so.0.4 -> libbrlapi.so.0.4.1 libviaXvMCPro.so.1 -> libviaXvMCPro.so.1.0.0 libfam.so.0 -> libfam.so.0.0.0 libgnomespeech.so.7 -> libgnomespeech.so.7.0.1 libckyapplet.so.1 -> libckyapplet.so.1.0.0 libwacomcfg.so.0 -> libwacomcfg.so.0.0.1 libIPMIlanserv.so.0 -> libIPMIlanserv.so.0.0.1 libkrb4.so.2 -> libkrb4.so.2.0 libgdict-1.0.so.5 -> libgdict-1.0.so.5.0.5 libgsttag-0.10.so.0 -> libgsttag-0.10.so.0.6.0 libOggFLAC.so.3 -> libOggFLAC.so.3.0.0 libidn.so.11 -> libidn.so.11.5.19 libgnome-mag.so.2 -> libgnome-mag.so.2.1.1 libnewt.so.0.52 -> libnewt.so.0.52.1 libglut.so.3 -> libglut.so.3.8.0 libXi.so.6 -> libXi.so.6.0.0 libnuma.so.1 -> libnuma.so.1 libsasl2.so.2 -> libsasl2.so.2.0.22 libsmbclient.so.0 -> libsmbclient.so libedataserverui-1.2.so.8 -> libedataserverui-1.2.so.8.0.0 libgnomevfs-2.so.0 -> libgnomevfs-2.so.0.1600.2 libogrove.so.0 -> libogrove.so.0.0.1 liblber-2.3.so.0 -> liblber-2.3.so.0.2.15 libhal-storage.so.1 -> libhal-storage.so.1.0.0 libgstnetbuffer-0.10.so.0 -> libgstnetbuffer-0.10.so.0.6.0 libgnome-media-profiles.so.0 -> libgnome-media-profiles.so.0.0.0 libgconf-2.so.4 -> libgconf-2.so.4.1.0 libgstvideo-0.10.so.0 -> libgstvideo-0.10.so.0.6.0 libvorbisenc.so.2 -> libvorbisenc.so.2.0.2 libdb_cxx-4.3.so -> libdb_cxx-4.3.so libnautilus-extension.so.1 -> libnautilus-extension.so.1.1.0 libhugetlbfs.so -> libhugetlbfs.so libiec61883.so.0 -> libiec61883.so.0.0.0 libnm_glib.so.0 -> libnm_glib.so.0.0.0 libbonobo-activation.so.4 -> libbonobo-activation.so.4.0.0 libcspi.so.0 -> libcspi.so.0.10.11 libevent-1.1a.so.1 -> libevent-1.1a.so.1.0.2 libnautilus-burn.so.4 -> libnautilus-burn.so.4.0.0 libbind.so.4 -> libbind.so.4.0.5 libjpeg.so.62 -> libjpeg.so.62.0.0 libavc1394.so.0 -> libavc1394.so.0.3.0 libXrandr.so.2 -> libXrandr.so.2.0.0 libcdda_paranoia.so.0 -> libcdda_paranoia.so.0.9.8 libpoppler-glib.so.1 -> libpoppler-glib.so.1.0.0 libisccc.so.0 -> libisccc.so.0.2.2 libdes425.so.3 -> libdes425.so.3.0 libIDL-2.so.0 -> libIDL-2.so.0.0.0 libedata-cal-1.2.so.6 -> libedata-cal-1.2.so.6.0.0 libpangox-1.0.so.0 -> libpangox-1.0.so.0.1400.9 libcroco-0.6.so.3 -> libcroco-0.6.so.3.0.1 libbonobo-2.so.0 -> libbonobo-2.so.0.0.0 libpcap.so.0.9.4 -> libpcap.so.0.9.4 libkrb5support.so.0 -> libkrb5support.so.0.1 libapol.so.3 -> libapol.so.3 libpangoxft-1.0.so.0 -> libpangoxft-1.0.so.0.1400.9 libgphoto2_port.so.0 -> libgphoto2_port.so.0.6.1 libnetsnmpagent.so.10 -> libnetsnmpagent.so.10.0.1 libcurl.so.3 -> libcurl.so.3.0.0 libmenu.so.5 -> libmenu.so.5.5 libXcursor.so.1 -> libXcursor.so.1.0.2 libXrender.so.1 -> libXrender.so.1.3.0 libgettextlib-0.14.6.so -> libgettextlib-0.14.6.so libedataserver-1.2.so.7 -> libedataserver-1.2.so.7.1.0 libstartup-notification-1.so.0 -> libstartup-notification-1.so.0.0.0 libloginhelper.so.0 -> libloginhelper.so.0.0.0 libssl3.so -> libssl3.so libICE.so.6 -> libICE.so.6.3.0 libgssrpc.so.4 -> libgssrpc.so.4.0 libcamel-provider-1.2.so.8 -> libcamel-provider-1.2.so.8.1.0 libexchange-storage-1.2.so.2 -> libexchange-storage-1.2.so.2.0.0 libXmu.so.6 -> libXmu.so.6.2.0 libgnome-window-settings.so.1 -> libgnome-window-settings.so.1.0.0 libnetsnmpmibs.so.10 -> libnetsnmpmibs.so.10.0.1 libedata-book-1.2.so.2 -> libedata-book-1.2.so.2.3.0 libpanel.so.5 -> libpanel.so.5.5 libOpenIPMIcmdlang.so.0 -> libOpenIPMIcmdlang.so.0.0.5 libldap_r-2.3.so.0 -> libldap_r-2.3.so.0.2.15 libnfsidmap.so.0 -> libnfsidmap.so.0.2.0 libviaXvMC.so.1 -> libviaXvMC.so.1.0.0 libpng.so.3 -> libpng.so.3.10.0 libgstreamer-0.10.so.0 -> libgstreamer-0.10.so.0.8.1 libvorbis.so.0 -> libvorbis.so.0.3.1 libosp.so.5 -> libosp.so.5.0.0 libXt.so.6 -> libXt.so.6.0.0 libpcsclite.so.1 -> libpcsclite.so.1.0.0 libxml2.so.2 -> libxml2.so.2.6.26 libaio.so.1.0.0 -> libaio.so.1.0.0 libXevie.so.1 -> libXevie.so.1.0.0 libsoup-2.2.so.8 -> libsoup-2.2.so.8.5.0 libexif.so.12 -> libexif.so.12.0.1 libesd.so.0 -> libesd.so.0.2.36 libgstriff-0.10.so.0 -> libgstriff-0.10.so.0.6.0 libart_lgpl_2.so.2 -> libart_lgpl_2.so.2.3.17 libaio.so.1 -> libaio.so.1.0.1 libgstrtp-0.10.so.0 -> libgstrtp-0.10.so.0.6.0 libgtop-2.0.so.7 -> libgtop-2.0.so.7.0.0 libmenuw.so.5 -> libmenuw.so.5.5 libOpenIPMIglib.so.0 -> libOpenIPMIglib.so.0.0.1 libdaemon.so.0 -> libdaemon.so.0.2.4 liboil-0.3.so.0 -> liboil-0.3.so.0.1.0 libgpm.so.1 -> libgpm.so.1.19.0 libX11.so.6 -> libX11.so.6.2.0 libpng12.so.0 -> libpng12.so.0.10.0 libXfixes.so.3 -> libXfixes.so.3.1.0 libfreetype.so.6 -> libfreetype.so.6.3.10 libXTrap.so.6 -> libXTrap.so.6.4.0 libnl.so.1 -> libnl.so.1.0-pre5 libnetsnmphelpers.so.10 -> libnetsnmphelpers.so.10.0.1 libgnomecups-1.0.so.1 -> libgnomecups-1.0.so.1.0.0/lib/i686: (hwcap: 0x0008000000000000)/lib64/tls: (hwcap: 0x8000000000000000)/usr/lib64/sse2: (hwcap: 0x0000000004000000)/usr/lib64/tls: (hwcap: 0x8000000000000000)[root@hadoopredhot server]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.1 (Tikanga)Where i can download this shared library ?
Error Loading Shared Libraries when Installing Redhat Directory Server
rhel;libraries;dynamic linking
Is dsktune a 32-bit or 64-bit executable? Whichever it is, you need a matching libstdc++.so.5. You seem to have two libraries for version 6 but only one for version 5; presumably you have version 6 for both architectures but version 5 only for the other architecture. Install compat-libstdc++ for the architecture that dsktune is for.
_webmaster.54658
My Drupal 6 site has been running smoothly for years but recently has experienced intermittent periods of extreme slowness (10-60 sec page loads). Several hours of slowness followed by hours of normal (4-6 sec) page loads. The page always loads with no error, just sometimes takes forever.------Edit-----Updated Question:How can I troubleshoot this problem? I've used:webpagetest.orgwindows task managernetstatapache and windows logsFirewall packet capture------End edit-----------My setup:Windows Server 2003Apache/2.2.15 (Win32) Jrun/4.0 PHP 5 MySql 5.1 Drupal 6Cold fusion 9Vmware virtual environmentDMZ behind a corporate firewallTraffic: 1-3 hits/sec avgTroubleshootingNo applicable errors in apache error logNo errors in drupal event logDrupal devel module shows 242 queries in 366.23 milliseconds,pageexecution time 2069.62 ms. (So it looks like queries and php scriptsare not the problem)NO unusually high CPU, memory, or disk IOCold fusion apps, and other static pages outside of drupal also loadslowwebpagetest.org test shows very high time-to-first-byteThe problem seems to be with Apache responding to requests, but previously I've only seen this behavior under 100% cpu load. Judging solely by resource monitoring, it looks as though very little is going on.Here is the kicker - roughly half of the site's access comes from our LAN, but if I disable the firewall rule and block access from outside of our network, internal (LAN) access (1000+ devices) is speedy. But as soon as outside access is restored the site is crippled.Apache config? Crawlers/bots? Attackers? I'm at the end of my rope, where should I be looking to determine where the problem lies?------Edit:-----Attached a waterfall chart from webpagetest.org showing a 15 second load time, I've seen times as high as several minutes. And again, the server runs fine much of the time. The green areas indicate that the browser has sent a request and is waiting to recieve the first byte of data back from the server. This is certainly a back-end delay, but it is puzzling that the CPU is barely used during this slowness.
Apache VERY high page load time
php;apache;mysql;drupal
After much research, I may have found the solution. If I'm correct, it was an apache config problem. Specifically, the ThreadsPerChild directive. See... http://httpd.apache.org/docs/2.2/platform/windows.htmlBecause Apache for Windows is multithreaded, it does not use a separate process for each request, as Apache can on Unix. Instead there are usually only two Apache processes running: a parent process, and a child which handles the requests. Within the child process each request is handled by a separate thread.ThreadsPerChild: This directive is new. It tells the server how many threads it should use. This is the maximum number of connections the server can handle at once, so be sure to set this number high enough for your site if you get a lot of hits. The recommended default is ThreadsPerChild 150, but this must be adjusted to reflect the greatest anticipated number of simultaneous connections to accept.Turns out, this directive was not set at all in my config and thus defaulted to 64. I confirmed this by viewing the number of threads for the second httpd.exe process in task manager. When the server was hitting more than 64 connections, the excess requests were simply having to wait for a thread to open up. I added ThreadsPerChild 150 in my httpd.conf.Additionally, I enabled the apache status modulehttp://httpd.apache.org/docs/2.2/mod/mod_status.html...which, among other things, allows one to see the total number of active request on the server at any given moment. Right away, I could see spikes of up to 80 active request. Time will tell, but I'm confident that this will resolve my issue. So far, 30 hours without a hiccup.
_unix.310307
How large is the Linux Mint OS download?I am considering downloading it. When I know how much volume it has I can figure out how long it take to download. Any current version of Mint is OK.
What is the capacity of Linux Mint OS?
linux mint
null
_unix.230457
Linux Pocket Guide has a nice example on how to go over all the arguments in a scriptfor arg in $@do echo I found the argument $argdoneI am writing a script in which all the arguments will be text files, and I will concatenate all those text files and print them to stdout, however I should exclude the contents of the first argument. My first approach would be something like thisfor arg in $@do cat $argdoneHowever, that will include the first argument, and as I mentioned, I want to print all except the first one.
How to skip the first argument in a script
shell;shell script
You can use shift command like this: shiftfor arg in $@do cat $argdone
_cs.53456
I understand that the following nested for-loop:for(i=0; i<n/2; i++) for(j=0; j<n/2; j++) print(j)has the runtime complexity of which has a simplifed complexity of but what is the resulting complexity of making j bound to i/2 in the inner loop? For instance:for(i=0; i<n/2; i++) for(j=0; j<i/2; j++) print(j)Would this be ?
Running-time cost of Tweaked Nested Loop
algorithm analysis;runtime analysis;loops
The complexity would be$$\sum_{i = 0}^{n/2-1} \sum_{j = 0}^{i/2-1} 1\,,$$ which is $O(n^2)$.
_unix.46487
Possible Duplicate:How to clean up file extensions? I'm using CentOS. There are >10M images in one of my folders, which are furthur grouped into subdirectories.The issue is that some of my images are named as abc.jpg and others are named as xyz.JPG. So, when i try to access xyz.jpg, it says File not found as the extension is case-sensitive.Is there any way to rename all JPG to jpg, or a httpd config which works around this issue.
File extension case sensitivity on CentOS
centos;rename;filenames
Try this (this will rename all .JPG files to .jpg recursively, in all the subdirectories of the directory where you run this):find . -name '*.JPG' -exec sh -c 'mv $0 ${0%.JPG}.jpg' {} \;The find searches for all files named *.JPG in the current directory and its subdirectories, passes the list to the mv command which renames them
_codereview.93228
I am making a 2D Java game at school, and at the movement I use a switch. The code works, however, my teacher won't sign my code until I have removed code duplication.Short info: My Keyactionlistener sends a String of direction that is used in the switch to move. Inside that very same switch I also check the object in the next field to see if it can be picked up or can move through. However, the code is really long this way and I need to shorten it down somehow.public void checkAndMove(String direction) { switch (direction) { case up: if (!field.checkIfBlocked(getfieldX(), getfieldY() - 1)) { if (field.checkIfItem(getfieldX(), getfieldY() - 1).equals(friend)) { showEndMessage = true; } if (field.checkIfItem(getfieldX(), getfieldY() - 1).equals(bazooka)) { plusAmmo(); levelmaker.removeBazooka(); } if (field.checkIfItem(getfieldX(), getfieldY() - 1).equals(helper)) { showShortestRoute(); } move(0, -1); if(showEndMessage == true){ endMessage(); } levelmaker.scorePlusPlus(); changeImage(imgUp); break; } else { break; } case down: if (!field.checkIfBlocked(getfieldX(), getfieldY() + 1)) { if (veld.checkIfItem(getfieldX(), getfieldY() + 1).equals(friend)) { endMessage(); } if (field.checkIfItem(getfieldX(), getfieldY() + 1).equals(bazooka)) { plusAmmo(); LevelMaker.removeBazooka(); } if (field.checkIfItem(getfieldX(), getfieldY() + 1).equals(helper)) { showShortestRoute(); } move(0, 1); levelmaker.scorePlusPlus(); changeImage(imgDown); break; } else { break; } case left: if (!field.checkIfBlocked(getfieldX() - 1, getfieldY())) { if (field.checkIfItem(getfieldX() - 1, getfieldY()).equals(friend)) { endMessage(); } if (field.checkIfItem(getfieldX() - 1, getfieldY()).equals(bazooka)) { plusAmmo(); LevelMaker.removeBazooka(); } if (field.checkIfItem(getfieldX() - 1, getfieldY()).equals(helper)) { showShortestRoute(); } move(-1, 0); levelmaker.scorePlusPlus(); changeImage(imgLeft); break; } else { break; } case right: if (!field.checkIfBlocked(getfieldX() + 1, getfieldY())) { if (field.checkIfItem(getfieldX() + 1, getfieldY()).equals(friend)) { endMessage(); } if (veld.checkIfItem(getfieldX() + 1, getfieldY()).equals(bazooka)) { plusAmmo(); LevelMaker.removeBazooka(); } if (field.checkIfItem(getfieldX() + 1, getfieldY()).equals(helper)) { showShortestRoute(); } move(1, 0); levelmaker.scorePlusPlus(); changeImage(imgRight); break; } else { break; } }
Checking directional moves for a game
java
null
_webmaster.11729
I was toying with the idea of switching to html5. It seems there are 2 major scripts for dealing with supporting html5 on older browsers.Modernizr and Html5ShivI was wondering if they do the same thing. Which one to choose and why?Any ideas?
What's the difference between Modernizr and Html5Shiv?
html5
Modernizr is used to check the availability of HTML5 features in different rendering engines. It includes a script like Html5Shiv, which (only) enables HTML5 tags on Microsoft Internet Explorer (prior to version 9, which knew HTML5). See also How to get HTML5 working in IE and Firefox 2.If you just want to enable HTML5 for IE < 9, then Html5Shiv would be sufficient. I'm using the Html5Shiv version by Remy Sharp within a MS conditional comment:<!--[if lte IE 8]> <script src=templates/js/html5.js></script><![endif]-->If you also want to check (via CSS or JS), if the clients browser is capable of e.g. HTML5-form-elements (like Operas date input), CSS3 columns or gradients, then use Modernizr.
_cs.79824
What is the difference between constant folding and constant propogation? They both seem to do the same thing, instead of saving constants into stack or evaluating a full arithmetic expression, they simply replace it with the result which can be obtained at compile time. What is the difference between two?
Constant folding vs. Constant propogation
compilers;program optimization
null
_softwareengineering.318261
My application is growing in complexity.Currently, I have a collection of classes that make up a Backend, this contains a DataInterface that talks to a database and returns POCO classes, a ModelProvider that wraps them up in models, and a ViewModelProvider that creates views, all dependent on each other.These instances are created on application start-up, and then wrapped up in a single Backend class. There's only one instance of this for the application. I'm finding many, many classes need to carry around this Backend instance to function.I also have a class AppController which controls the high level navigation, and things like showing dialogues.As a result, these two classes are passed around in constructors for nearly every ViewModel that's going to be doing anything complected.This just doesn't seem sensible for me, but it must be a very common problem having a couple of single-instance classes that need to be accessed all over the application.I was thinking one solution would be to make a single, static, class (say the already existing backend class) that could keep track of this, so all I need to do is:StaticBackend.ViewModelProvider.GetSomeViewModelsForMe();Is this good practice, or is there a more established way of doing it?Dependency injection:I'm trying to get my head around dependency injection. It looks like I'm not far off if I start creating interfaces for the ModelProvider, ViewModelProvider etc.This seems like I would be in a similar place, except things might be formally more sensible, I'd still have to 'inject' IModelProvider, and IViewModelProvider classes all the way through from constructor to constructor.So this is how things are at like at the moment (but encapsulating some of the back-end into interfaces):interface INavagationManager{ void NavagateTo(Page page);}interface IViewModelProvider{ void CreateSomeViewModelsToDisplay();}class HomePage : Page{ INavagationManager NavagationManager; IViewModelProvider ViewModelProvider; //this contains no dependencies on the IViewModelProvider, but it does with INavagationManager public HomePage(INavagationManager navagationManager, IViewModelProvider viewModelProvider) { this.NavagationManager = navagationManager; //this is injected but it's not really a dependency of HomePage, as it never wants to get ViewModels, but the pages it creates do this.ViewModelProvider = viewModelProvider; } public void UserWantsToNavagateSomewhere() { //all ViewModelProvider exists for is to be passed on down the 'chain' NavagationManager.NavagateTo(new SubPage(ViewModelProvider)); }}class SubPage : Page{ IViewModelProvider ViewModelProvider; List<MyViewModel> MyViewModels; public SubPage(IViewModelProvider viewModelProvider) { ViewModelProvider = viewModelProvider; //actually use this dependency for something MyViewModels = ViewModelProvider.CreateSomeViewModelsToDisplay(); }}Using interfaces makes it easier to do UnitTesting in future, because I can feed it mock INavagationManager etc to test behavior. But I'm still in much the same position I was in before, I'm still a little confused at how IoC containers fit.It seems, I'd create a Container, which deals with injecting dependencies like the IViewModelProvider and INavagationManager in the above example, and I'd instead pass the Container between all the objects? Like this:interface INavagationManager{ void NavagateTo(Page page);}interface IViewModelProvider{ void CreateSomeViewModelsToDisplay();}class HomePage : Page{ Container Container; INavagationManager NavagationManager; //this contains no IViewModelProvider, but in instance of Container public HomePage(Container container, IViewModelProvider viewModelProvider) { this.NavagationManager = navagationManager; this.Container= container; } public void UserWantsToNavagateSomewhere() { //all ViewModelProvider exists for is to be passed on down the 'chain' NavagationManager.NavagateTo(Container.GetInstance<SubPage>()); }}class SubPage : Page{ IViewModelProvider ViewModelProvider; List<MyViewModel> MyViewModels; public SubPage(IViewModelProvider viewModelProvider) { ViewModelProvider = viewModelProvider; //actually use this dependency for something MyViewModels = ViewModelProvider.CreateSomeViewModelsToDisplay(); }}
Better way of providing access to a single backend class to the whole application
design
That singleton will be a headache to manage, particularly with respect to testing.What you really want to do is inject this dependency into your components (as noted above - this is called dependency injection or inversion-of-control, aka IoC). You can manage which components receive it and substitute it in your testing environment. If you don't do this, then your components will instantiate the real one themselves, and you may not want that during a testing cycle (much better in many cases to provide a mock which contains sample data etc.)You've noted that you will have to inject this in lots of places. That may well be the case, if it's a key dependency for your components. It doesn't necessarily indicate a problem in itself. You may be able to make life easier for yourself by investigating some IoC containers e.g. Unity
_datascience.13694
I'm doing my master thesis on Big Data Analytics. I'm trying to develop a algorithm to identify associations between some products in a supermakert. Imagine that I've this dataset:Purchase_ID Product_ID Purchase_Value 1 2 4.5 1 3 1.2 2 3 1.4 2 1 3.5 2 2 7.3 3 2 0.5 3 3 1.0What I want to conclude is that:Every people that by Product_ID 2 also buy 3Anyone knows If exists any code algorithm available to use in Spark Mllib? I already search on internet but I didn't found anything...Anyone can help me?Many thanks!
Spark algorithm to make a link analysis
apache spark;apache hadoop;association rules
null
_unix.217686
I am trying to find some hex diftool which allows me to compare to documents in the view but also the internal differences like in bless so two bless windows side-by-side but with diff capability between the windows, at least for selection. I find the bless - A full featured hexadecimal editor could be the best choice here for the integration. Is there any difftool for hex-ascii view in any Linux distro?
blessdiff for the full featured hexadecimal editor?
diff;ascii;hex
null
_softwareengineering.216810
Conventionally, which of the above documents is deemed to hold the most weight when it comes to system acceptance?I recently had a conversation along these lines:It was argued that the initial requirements / tender documentation should be used to determine system acceptance. It was said that the solution design only serves to describe the way in which the system will solve the problem, not the problem it will solve. Furthermore, it was argued that if requirements are missed during solution design, the requirements should be referenced during system acceptance and that if any requirements were missed then the original tender should be referenced.Conversely, I suggested that - while requirements may be based on the original tender - they supersede it once agreed with the stakeholders. Furthermore, during solution design, analysis is performed to address and refine these initial requirements, translating them into a system capable of meeting the actual requirements. Once signed off by the relevant users, this solution design should absolutely represent the requirements (by virtue of the fact that it's designed upon them) but actually supersedes them as the basis for system acceptance.Is one of the above arguments more valid than the other?EDIT: Apologies for the ambiguous terms. In this situation, tender is the document the customer took to market when shopping for a provider - it includes details of all the high-level features they're looking for. Solution design is not a technical document, it's the functional specification.
Tender vs. Requirements vs. Solution Design
documentation;requirements;acceptance testing;systems analysis
Passing acceptance testing is an indication that the system meets the users' requirements acceptably. As such, the requirements document is generally considered the source of truth for acceptance criteria.There will almost always be further elaboration of requirements during design. If these are truly an expansion of scope, the requirements document should be updated to reflect this. Depending on how formal your process is, this may involve change requests, blah blah blah.
_unix.101969
I want to forward a local port to a remote port (8041) to a port (8042) on a remote machine (10.0.0.42). I can do this viassh -L 10.0.0.41:8041:10.0.0.42:8042 user@localhostwhere 10.0.0.41 is bound to eth0.Now I want to do this without all the userland and encryption overhead.My guess would beiptables -t nat -A PREROUTING -i eth0 -p tcp -d 10.0.0.41 --dport 8041 -j DNAT --to 10.0.0.42:8042and enable ip-forward - but it does not work.
Port forwarding using iptables on Linux
networking;iptables
null
_computergraphics.1794
I'm new to computer graphics. These days I've been trying to understand how ray tracing using an acceleration data structure works. I came across the term early ray termination several times, I looked it over the internet several times too, but I haven't been able to find a satisfactory explanation of it.What does it mean to terminate a ray early, and why do we have to do it?Besides, I noticed that the term front-to-back traversal is mentioned almost every time there's a mention of early ray termination.Concretely how does front-to-back traversal work (in the case of a kd-tree for example) ?
The meaning of early ray termination and front-to-back traversal in ray tracing
raytracing;c++;optimisation;data structure
null
_unix.194965
After configuring hibernation to swapfile with this instruction https://wiki.debian.org/Hibernation/Hibernate_Without_Swap_Partitioncommands s2disk & pm-hibernate are work fine. However hibernation doesn't work with XFCE's button Hibernation from logout menu with error: [ 2922.693779] PM: Cannot find swap device, try swapon -a. [ 2922.694793] PM: Cannot get swap writer. Where are to set proper commands for hibernation in XFCE?
Connect XFCE's hibernation option with proper command
debian;xfce;hibernate
null
_webmaster.5192
What are the advantages of web server log file analysis over web services like google analytics?What are the advantages of google analytics like tools over web server log file analysis?
What are the pros & cons of web server log analysis over web based analytics like google analytics
analytics
null
_unix.245788
Would it be possible to show only the summary section of htop output?desired look:I have looked into the manpages but couldn't find any options to do so.The closest thing i have found is this: http://www.softprayog.in/tutorials/htop-command-in-linux, but hat would make changes permanent, which I don't want.
Show only graph in htop output
output;htop
null
_unix.373663
I have android6.0.1. I want to enable wps after tethering.What are the importance things i want carry.?Can anyone give some suggestion.?If you have any reference link also welcome.Thanks,VinothS,
how to configure android.config for enable hostapd and wps?
linux;command line;wifi;android;wifi hotspot
null
_softwareengineering.140536
I've been running StyleCop over my code and one of the recommendations SA1122 is to use string.Empty rather than when assigning an empty string to a value.My question is why is this considered best practice. Or, is this considered best practice? I assume there is no compiler difference between the two statements so I can only think that it's a readability thing?UPDATE:Thanks for the answers but it's been kindly pointed out this question has been asked many times already on SO, which in hind-sight I should have considered and searched first before asking here. Some of these especially forward links makes for interesting reading.SO question and answerJon Skeet answer to question
Why use string.Empty over when assigning to a string object
c#
One valid reason is that it makes it clear this is not a typo or placeholder, that you really meant to use the empty string here. I don't know if it's considered best practice.
_webmaster.20312
I started using a VPS with HostGator not long ago,they have 9 levels of VPS and I started out with level 3.I'm testing a page on the website and it doesn't take too long to load,something like 2 second in my browser.But I feel that the webpage is very small, so it should load faster.So I tried downloading a 5 MB file from my VPS to my PC,I also tested the file on HostTracker.com, which let's you test download speedsfor different places around the globe.The average speed was 88 KB/Sec (both my PC and HostTracker)According to the HostGator FAQ:We provide a Gigabit uplink with a guaranteed 20mbit connection.We traffic shape each container to 20mbit. We do not foresee a situation when we would not meet the 20mbit guarantee without the stability of the entire server being affected.If the server does have an outage, not including regular maintenance, we will offer a prorated credit for the amount of downtime.From my calculation 20Mbit means 2.5 MB (divided by 8),if it's supposed to download at 2.5MB/s than it means there's a huge difference here?The questions are:Is my calculation correct, is the file really supposed to download at 2.5 MB/s?I realize not all PCs have a 2.5MB/s connection, but today most do, and I know I do.Is this some kind of error? should I contact the hosting company?When they write 20mbit connection it means 20mbit/sec right? can they mean something else?Thank you a lot in advance!fiftyeight
Question about web hosting speed
web hosting;page speed;performance
Although I'm not an expert about networking hardware I think what Hostgator is referring to is a 20mbps connection per server which is shared across the hundreds/thousands of customer websites provided you're on a shared plan.With a VPS however I think the 20mbps is being split across the customers on your server (typically a VPS only means guaranteed processing power & RAM) but if you were on a high end host, you probably could get a dedicated bandwidth pipe (similar to a dedicated plan) however that would be a huge premium over a traditional VPS.Although they say each container has a 20mbps adapter, that is likely a peak figure which they'd only max out for maybe a minute or two before bringing your site offline. In the fine print I'm sure Hostgator has a less glamorous figure which is for actual usage. Typically hosts will publicize the peak capacity just to look better than others.I'm actually a HostGator customer myself so I know the issue, and I think also your ISP might be severely crippling your upload speeds, which is common to keep customers from running servers and also to prevent P2P piracy. The issue probably could be resolved by upgrading to a Small Biz ISP plan, but going back to the other issue, it probably can't hurt to ask HostGator if they can improve your pipe
_unix.84747
I have a Broadcom wireless chip which I've managed to wrestle into working with Debian GNU/Linux (I'm on Sid, if it matters). The interface is definitely there:612 ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:002: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT qlen 1000 link/ether 3c:07:54:06:e0:86 brd ff:ff:ff:ff:ff:ff3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DORMANT qlen 1000 link/ether e4:ce:8f:40:ec:c4 brd ff:ff:ff:ff:ff:ffalex-debian ~:(14h55m|git@master)613 I have GNOME, and hence NetworkManager, up and running. When I look at GNOME Control Center in the Network pane, the Wireless tab gives information but doesn't list any wireless networks. I've tried connecting to a hidden network, just in case, but this didn't work. I know my network isn't hidden.Edit: per this wiki page, I've added myself to the netdev group, and relogged into my session, with no result.How can I start diagnosing the source of this problem?
NetworkManager controls my wireless card, but it can't find any networks?
networking;networkmanager
The wireless network was using WEP, which as stated by the wiki page in the question, is unsupported. I assumed that this meant will work but have weird problems, but in fact, upgrading the firmware, then using the new options to switch to WPA2 solved my problem.
_codereview.8504
I need some second or third eyes to look over this, since right now, the necessary actions to make this work sound just bad and I suppose I am missing something due to a lack of C# experience.I am currently working on a winforms c# application. More specifically, I am reworking a highly convoluted control flow between a custom winforms widget and the corresponding controller.To nail down some terms, the widget is called a DrawingPanel. On the drawing panel, the user can place certain components, which can be considered orange squares for now. He can select single components by clicking on them with the left button, he can select multiple components by dragging a box around them. Once he has components selected, he can right click and select operations like cut, paste, copy and so on with the obvious semantics. For usability reasons, he can also use these operations on a single component without selecting it.In the old state, the control flow between the DrawingPanel and the so-called EventManager mostly looks like two angry cats wrestling in mud, as it goes back and forth about 4 - 6 times in order to deduce the set of selected components. Somewhere in there, they are highlighted, but after an hour, I gave up deducing that for now, especially because there are about 2 dead highlighting functions in there. Since I have to add quite a bit of funcionality here, I guess it is up to me to redo this.In order to redo this, I figured a good way to straighten this out would be the following:I add one event per user command to the DrawingPanel. The Controller of the DrawingPanel subscribes to these events and modifies the model accordingly in the event handler. For example, if a set of components is selected and the user clicks on Copy in the context menu, a CopyRequest-Event is raised which has this set of arguments as an argument. If a user clicks on Paste in the component menu, a PasteRequest-Event is raised, which is parametrized by the position of the paste request.This should encapsulate the user interface, as the interface is reduced to a black box which is parametrized by the data model and raises events from the user. The EventManager could handle all user interfaces, which provide the appropiate events. Furthermore, the control flow would be greatly simplified, as it would become unidirectional: UI goes to Controller goes to Model.Now, onto my problem. I have some very heavy code duplication in my event handlers in the DrawingPanel. A ton of event handlers subscribe to the Click-Event of a context menu, wrap the currently selected components into an ComponentSetArgument-object and fire the request-event with this new argument (if its not null). I am failing to remove this duplication.So far, I have tried to implement a higher order event handler generator (which would take a component set event and generate an evenhandler to subscribe at the click-event) and a mapping function on events (which would handle the click-event, apply a function and signal the outgoing event). Both of these fail because the multiway delegates are immutable. Thus, correct functionality would depend on creating the mapping or calling the wrap+call-higher order function after all subscribers are subscribed to the event. This yells recipe for disaster for me.So, is there anything I can do beyond either tolerating this massive duplication or rolling my own subscription management there? Or, do I take the totally wrong way there and there is a massively better architecture here?Edit 1:I have been asked for sample code. I will try my best to condense the code without removing essential information. I will use the current state of code, which has event-based, improved control flow, but a heavy smell due to duplication. These are the significant portions of the DrawingPanel. // IComponent is something of the model. This class moves them around as black boxespublic class ComponentSetEventArguments { public ISet<IComponent> Components; } public delegate void ComponentSetHandler(object sender, ComponentSetEventArguments args);public partial class DrawingPanel { // These events signal an action of the user to the controller. // In order to maintain brevity and demonstrate the problem, I // include just these 2. There are about 6 ComponentSetHandlers // and various other handlers, for example the mentioned PasteRequest // with a PositionEventArgument. // These events closely mimic the events found in actual WinForms-classes, // like ToolStripMenuItem.Click or IPanel.MouseDown. public event ComponentSetHandler CopyRequest; public event ComponentSetHandler CutRequest; // this contains components which were selected by the user. This happens // by clicking on a single component or dragging a box around these // components. This component and the following as well as selecing the // correct context menu to display are done in mouseDown/mouseUp-Handlers, // which are mostly big if-else-chains, so I won't show them. ISet<IComponent>() selectedComponents; // this contains the last component hovered, so you can use the context menu on // a component by just right-clicking on top of it if no other components are // selected IComponent lastHoveredComponent; public DrawingControl() { ... // Let us look at the names first. These are toolstrips in // the componentSetContextMenu. This context menu pops up if the user // right-clicks while more than one component is selected. I have to // differntiate between 1 component selected and more than 1 component // selected, because certain operations are only possible for multiple // components. Second, the cutIn... means it is the toolstrip item // with the text cut on it. this.copyInComponentSetContextMenu.Click += copyComponentSetHandler; this.cutInComponentSetContextMenu.Click += cutComponentSetHandler; // note the difference, this is just in the component context menu, // not the component set context menu. this.cutInComponentContextMenu.Click += cutComponentHandler; ... } // SMELL: Duplication (I.I) // these two somethingComponentSetHandlers just wrap the selected components // into event arguments and fire the corresponding user request. void copyComponentSetHandler(object sender, EventArgs e) { if (CopyRequest == null) return; // im just omitting safety copies here. ComponentSetArguments a = new ComponentSetArguments(selectedComponents); CopyRequest(this, a); } // SMELL: Duplication (I.II) void cutComponentSetHandler(object sender, EventArgs e) { if (CutRequest == null) return; ComponentSetArgument a = new ComponentSetARguments(selectedComponents); CutRequest(this, a); } // This handler is mostly included as a demonstration why I think this is // a decent approach. It encapsulates the difference of handling a single // component in a convenient way in the UI itself. Further objects do not // need to consider this minor detail. void cutComponentHandler(object sender, EventArgs e) { if (CopyRequest == null) return; ISet<IComponent> components; // if the user selected a single component, cut that component. // if the user selected no components, cut the component he pointed at. if (selectedComponents.Count == 0) { components = new HashSet<IComponent>(); components.Add(lastHoveredComponent); } else { components = selectedComponents; } CutRequest(this, components); }}I am pleasently surprised that it looks like the EventManager is not relevant for this problem. For completeness, the EventManager has a method that subscribes to the CutRequest event. When the CutRequest is fired, the EventManager copies the components from the event argument into a separate collection and removes the cut components from the model itself. Given all that, the smell I am annoyed by becomes apparent, I have marked them as smell I.I and I.II. These methods differ in exactly one thing. The event to signal, CutRequest and CopyRequest and this continues through a number of more methods. My current fixes generally fail because of the immutability of multiway delegates in C#. I cannot create a closure which contains for example CutRequest, because the subscription of new Handlers in CutRequest create a new Multiway delegate and replace the old value of CutRequest with this new delegate. If I need to elaborate more on this, let me know.
How to refactor these C#-events or fix this architecture?
c#;user interface
null
_unix.227466
This is my script I am trying to rename the files in folder.rename1.sh----------#!/bin/bashcd /home/lanein1/WestonIN7pm/$(date +%Y-%m-%d) && rename s/WestonIN/WestonIN7pm/ *.jpgcd /home/lanein1/WestonOUT7pm/$(date +%Y-%m-%d) && rename s/WestonOUT/WestonOUT7pm/ *.jpgThis is the error I get :can't cd to /home/lanein1/scripts/rename1.shI don't understand why am I getting this errorCRON ENTRY :29 12 * * * cd /home/lanein1/scripts/rename1.sh >> /home/lanein1/scripts/rename2.log 2>&1
error while changing directory using crontab
bash;ubuntu;cron
You're asking to change directory to the script:cd /home/lanein1/scripts/rename1.sh >> /home/lanein1/scripts/rename2.log 2>&1Perhaps you meant to run it:/home/lanein1/scripts/rename1.sh >> /home/lanein1/scripts/rename2.log 2>&1
_unix.382312
Was trying to enable log for chroot usersMay have done sth. wrong ,find ls -l in /var/log most log files size stay 0.Try to fix it followed this answer # systemctl restart systemd-journald.socket# systemctl start rsyslogdFailed to start rsyslogd.service: Unit rsyslogd.service not found.and this answer # logger -s hellowlogger: socket /dev/log: No such file or directory# sudo rsyslogd -N6 | head -10sudo: unable to resolve host iZ26v45oj3yjtmZrsyslogd: version 8.16.0, config validation run (level 6), master config /etc/rsyslog.confrsyslogd: command 'KLogPermitNonKernelFacility' is currently not permitted - did you already set it via a RainerScript command (v6+ config)? [v8.16.0 try http://www.rsyslog.com/e/2222 ]# ls /dev/logls: cannot access '/dev/log': No such file or directoryAnd checked syslogd is running#lsof -f -p 5379syslogd 5379 root 16w REG 253,1 0 1844521 /var/log/news/news.errsyslogd 5379 root 17w REG 253,1 0 1844536 /var/log/news/news.noticesyslogd 5379 root 18w REG 253,1 3282 1580873 /var/log/debug.1 (deleted)syslogd 5379 root 19w REG 253,1 110492 1580898 /var/log/messages.1 (deleted)syslogd 5379 root 20u FIFO 0,6 0t0 423 /dev/xconsolesyslogd 5379 root 21u unix 0xffff880138be9400 0t0 212524 /dev/log type=DGRAMThe /etc/rsyslog.conf file##################### MODULES #####################module(load=imuxsock) # provides support for local system loggingmodule(load=imklog) # provides kernel logging support#module(load=immark) # provides --MARK-- message capability# provides UDP syslog reception#module(load=imudp)#input(type=imudp port=514)# provides TCP syslog reception#module(load=imtcp)#input(type=imtcp port=514)# Enable non-kernel facility klog messages$KLogPermitNonKernelFacility on############################### GLOBAL DIRECTIVES ################################# Use traditional timestamp format.# To enable high precision timestamps, comment out the following line.#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat# Filter duplicated messages$RepeatedMsgReduction on## Set the default permissions for all log files.#$FileOwner syslog$FileGroup adm$FileCreateMode 0640$DirCreateMode 0755$Umask 0022$PrivDropToUser syslog$PrivDropToGroup syslog## Where to place spool and state files#$WorkDirectory /var/spool/rsyslog## Include all config files in /etc/rsyslog.d/#$IncludeConfig /etc/rsyslog.d/*.confThe /etc/syslog.conf file# /etc/syslog.conf Configuration file for inetutils-syslogd.## For more information see syslog.conf(5) manpage.## First some standard logfiles. Log by facility.#auth,authpriv.* /var/log/auth.log*.*;auth,authpriv.none -/var/log/syslog#cron.* /var/log/cron.logdaemon.* -/var/log/daemon.logkern.* -/var/log/kern.loglpr.* -/var/log/lpr.logmail.* -/var/log/mail.loguser.* -/var/log/user.loguucp.* /var/log/uucp.log## Logging for the mail system. Split it up so that# it is easy to write scripts to parse these files.#mail.info -/var/log/mail.infomail.warn -/var/log/mail.warnmail.err /var/log/mail.err# Logging for INN news system#news.crit /var/log/news/news.critnews.err /var/log/news/news.errnews.notice -/var/log/news/news.notice## Some `catch-all' logfiles.#*.=debug;\ auth,authpriv.none;\ news.none;mail.none -/var/log/debug*.=info;*.=notice;*.=warn;\ auth,authpriv.none;\ cron,daemon.none;\ mail,news.none -/var/log/messages## Emergencies are sent to everybody logged in.#*.emerg *## I like to have messages displayed on the console, but only on a virtual# console I usually leave idle.##daemon,mail.*;\# news.=crit;news.=err;news.=notice;\# *.=debug;*.=info;\# *.=notice;*.=warn /dev/tty8# The named pipe /dev/xconsole is for the `xconsole' utility. To use it,# you must invoke `xconsole' with the `-file' option:## $ xconsole -file /dev/xconsole [...]## NOTE: adjust the list below, or you'll go crazy if you have a reasonably# busy site..#daemon.*;mail.*;\ news.crit;news.err;news.notice;\ *.=debug;*.=info;\ *.=notice;*.=warn |/dev/xconsoleProblems here are: 1.Failed to start rsyslogd.service2.ls: cannot access '/dev/log': No such file or directoryls -l /var/log most log file's size is 0
system log stop logging
syslog;rsyslog
null
_unix.176451
When I type xrandr on my Lenovo Laptop with Ubuntu 14.04 I get the following output: xrandr: Failed to get size of gamma for output defaultScreen 0: minimum 1600 x 900, current 1600 x 900, maximum 1600 x 900default connected primary 1600x900+0+0 0mm x 0mm 1600x900 77.0* How to fix the error Failed to get size of gamma for output default? Is this an error in the first place? Should I worry about it at all?
How to fix error xrandr: Failed to get size of gamma for output default on Ubuntu 14.04?
ubuntu
null
_codereview.154409
I have a need to search for ansible inventory in the current play by group type and grabbing an arbitrary number of them.I mostly want advice on if the _first_run variable is the best way to handle this inspection. I put it there so that a key error doesn't occur during the iterable creation.Also, I'm unfamiliar with iterator speed in the real world. Is there any speed gain by putting the generator outside of the main function?If you are unfamiliar with ansible's hostvars it is a dictionary of all the inventory. Each piece of inventory has the full list of groups so I can grab any arbitrary one.I realize with strict inputs I could make this much simpler. I just wanted review on a situation where I had to support either input.# This is what the top level input can be. In retrospect I could just# force users to send me the full hostvars dictionary and simplify this# and not accept arbitrary hosts (in this case 'a host'/'b host'.# {'hostvars': {'a host': 'groups': {<the keys in here are what I want>}# 'b host': 'groups': {<identical keys to the above>}# }def hosts_in_group(hostvars, active_hosts, group): Return an iterable of all the hosts in a group. Example use case: Want a single host in group linux from the hosts in the current play ('ansible_play_hosts') Example usage: {{ hostvars|hosts_in_group(ansible_play_hosts, 'linux')|first }} :param hostvars: The full hostvars dictionary :param active_hosts: List of hosts to search. ex. ansible_play_hosts :param group: Group name to search ex. 'linux' :return: iterable of matching hosts for hostname in hostvars.keys(): hostvar = hostvars[hostname] break else: raise RuntimeError(No inventory found. Was hostvars the argument? Do you have inventory defined?) for host in active_hosts: if host in hostvar['groups'][group]: yield hostdef _hosts_group_iterable(vars, active_hosts, group): Iterable for hosts_in_group for host in active_hosts: if host in vars['groups'][group]: yield hostclass FilterModule(object): def filters(self): return { 'hosts_in_group': hosts_in_group, }
Python jinja2 filter to find hosts matching a group in ansible
python;performance;algorithm
null
_codereview.153828
I am learning Go and want to do things the go-way, please have a look this code suggest how to make it better Go.This is a simulation to determine how items of a particular type of clothing you need. Rules are as follows:Simulation starts with all the clothes in the clean pileEvery morning you take one item from the clean pile and add it to the dirty pile (assuming an item of clothing becomes dirty the moment you put it on)On wash days - before you put on a new item - all the items in the dirty pile go into washing pileEvery morning all items in the washing pile are put into the clean pileAssuming there is a washing day every Monday, how many items of clothing do you need to never run out of clean ones?There are some extra rules (I have made them flags):Every second Thursday is also a washing dayThere is an extra step in the washing process - drying. After an item is washed, the next day it is put into the drying pile, and only after drying does it go into the clean pile.Code in the go-playground at: https://play.golang.org/p/3jawv55Y3ppackage mainimport ( flag fmt time)func even(number int) bool { return number%2 == 0}func isWashingDay(today time.Time, thursday bool) bool { if today.Format(Mon) == Mon { fmt.Println(Monday!) return true } else if thursday && today.Format(Mon) == Thu { _, week := today.ISOWeek() if even(week) { fmt.Println(Thursday!) return true } } return false}func main() { numberOftshirtsPtr := flag.Int(shirts, 9, a int number of tshirts) thursdayPtr := flag.Bool(thursday, true, a bool use Thursday) dryingPtr := flag.Bool(drying, true, a bool use drying) flag.Parse() var clean, minClean = *numberOftshirtsPtr, *numberOftshirtsPtr var dirty, washing, drying int today, _ := time.Parse(time.RFC3339, 2017-02-06T00:00:00+00:00) fmt.Println(Date | C | D | W | Y ) testDays := 365 for i := 0; i < testDays; i++ { if *dryingPtr { clean += drying drying = 0 drying = washing washing = 0 } else { clean += washing washing = 0 } if clean == 0 { fmt.Println(Run out of clean shirts!) break } if isWashingDay(today, *thursdayPtr) { washing = dirty dirty = 0 } // take a clean tshirt and wear it - it immediately becomes dirty clean-- dirty++ if clean < minClean { minClean = clean } fmt.Printf(%s | %d | %d | %d | %d \n, today.Format(2006-01-02), clean, dirty, washing, drying) today = today.AddDate(0, 0, 1) } fmt.Println(Total days:, testDays) fmt.Println(Minimum clean shirts:, minClean)}
How many of a particular item of clothing do I need?
go
For a beginner to go your program is good. You have obviously read up on flag handling, and you've got a grasp on the pointers. I have come to like the flag processing in go (though having previously learned/understood getopt and written my own library in Java, I feel like go should allow more powerful commandline handling).FlagsSo, having said you have a good grasp on those concepts, I am going to recommend that you change the flag handling (and as a consequence, you remove the pointers).In addition, you should be putting in the number of days to simulate, and perhaps the starting date, as flags too.So, flag functions include both ...Ptr and ...Var variants. I recommend using the ...Var variants where you can. Your code:numberOftshirtsPtr := flag.Int(shirts, 9, a int number of tshirts)thursdayPtr := flag.Bool(thursday, true, a bool use Thursday)dryingPtr := flag.Bool(drying, true, a bool use drying)flag.Parse()I would write like:numberOftshirts := 9doThursdays := truedoDrying := trueflag.IntVar(&numberOftshirts, shirts, numberOftshirts, the number of tshirts)flag.BoolVar(&doThursdays, thursday, doThursdays, use Thursday)flag.BoolVar(&doDrying, drying, doDrying, use drying)flag.Parse()By taking the address of the var and giving it to flag, we can then use the variables as-is later without having to keep the pointer handling at all, so code like:var clean, minClean = *numberOftshirtsPtr, *numberOftshirtsPtrbecomes:var clean, minClean = numberOftshirts, numberOftshirtsNote that, by convention, using hungarian notation in go is not good code-style. You should not suffix pointer variables with Ptr. A pointer to an int containing the number of T-Shirts is still numberOftshirts and not numberOftshirtsPtrOK, so the above code changes the flag handling to be Var-based, and it reads easier, and removes all pointer references later.I would also add flags for the starting date, and number of days to simulate.Washing DayYour washingday function is a good idea, but you are doing string processing in places where the time library has better options to offer. Note that time has constantes for the days-of-week, and those constants are declared as a Weekday type, and that type has a String() function available: https://golang.org/pkg/time/#Weekday - what this means is that you can avoid the string-conversions in the function. I personally would probably use the String() option too to print the days. Actually, I would remove the println from the function because it is making the function do too much - (computation and presentation). I would have your function as:func isWashingDay(today time.Time, doThursday bool) bool { if today.Weekday() == time.Monday { //fmt.Printf(%v!\n, time.Monday) return true } if doThursday && today.Weekday() == time.Thursday { _, week := today.ISOWeek() if even(week) { //fmt.Printf(%v!\n, time.Thursday) return true } } return false}Note that I no longer have any raw text in there (it's all time variables, etc), and also note that I no longer have if ... else ... statements. When the if part of a condition always has a return in it, there's no need for the else at all.MainYour program is essentially contained inside the main-method. This makes the main method bulky, and the code is not reusable. Even in example progams and learning exercises, you should try to break your code in to functions that can be run, and tested independently. Go has a strong toolset related to unit-tests and benchmarks, and you should get in the habit of creating small, independent functions that are easy to process in the testing systems too.One way to improve the bulkiness of the main method is to declare a struct to contain the state of a given day. You can get clever with some function processing too. I would create a state struct, and use it for a bunch of the logic....type ClothesState struct { day time.Time clean int dirty int washing int drying int}In addition, to separate out your printing of the state, I would create a bit of a string helper function... I'll explain it later, but show you here, now:func format(day, clean, dirty, washing, drying interface{}) string { return fmt.Sprintf(%-11v| %-2v| %-2v| %-2v| %2-v, day, clean, dirty, washing, drying)}With this function, we can add a String() method to our state too that uses it:func (cs ClothesState) String() string { return format(cs.day.Format(2006-01-02), cs.clean, cs.dirty, cs.washing, cs.drying)}Now we can use the %v (or %s) style fmt to print the state:fmt.Printf(%v\n, state)Further, I would take the state-tansition logic and make it a method on the struct too:func (cs ClothesState) Advance(doDrying, doThursdays bool) ClothesState { tomorrow := cs.day.AddDate(0, 0, 1) clean := cs.clean clean += cs.drying drying := cs.washing if !doDrying { // take all the drying directly in to clean clean += drying drying = 0 } washing := 0 dirty := cs.dirty if isWashingDay(tomorrow, doThursdays) { washing = dirty dirty = 0 } clean-- dirty++ return ClothesState{ day: tomorrow, clean: clean, dirty: dirty, washing: washing, drying: drying, }}Now you have an immutable state struct that you can then advance through the daily logic. Each advance returns a new state.ConclusionYou've made a great start in to Go. I encourage the use of structs to localize logic, the use of smaller, single-purpose functions, and separating the presentation code (printlns) from the calculation code.I have taken your code and re-worked it in a way I would consider an improvement, and I have tweaked the starting state to match your logic (and also kept the println statements in the isWashingDay so that it matches the output of your program.Have a look, and see how the logic is separated, how the flags are used, and so on: https://play.golang.org/p/B62HmIoxNcpackage mainimport ( flag fmt time)func even(number int) bool { return number%2 == 0}func isWashingDay(today time.Time, doThursday bool) bool { if today.Weekday() == time.Monday { fmt.Printf(%v!\n, time.Monday) return true } if doThursday && today.Weekday() == time.Thursday { _, week := today.ISOWeek() if even(week) { fmt.Printf(%v!\n, time.Thursday) return true } } return false}func format(day, clean, dirty, washing, drying interface{}) string { return fmt.Sprintf(%-11v| %-2v| %-2v| %-2v| %-2v, day, clean, dirty, washing, drying)}type ClothesState struct { day time.Time clean int dirty int washing int drying int}func (cs ClothesState) String() string { return format(cs.day.Format(2006-01-02), cs.clean, cs.dirty, cs.washing, cs.drying)}func (cs ClothesState) Advance(doDrying, doThursdays bool) ClothesState { tomorrow := cs.day.AddDate(0, 0, 1) clean := cs.clean clean += cs.drying drying := cs.washing if !doDrying { // take all the drying directly in to clean clean += drying drying = 0 } washing := 0 dirty := cs.dirty if isWashingDay(tomorrow, doThursdays) { washing = dirty dirty = 0 } clean-- dirty++ return ClothesState{ day: tomorrow, clean: clean, dirty: dirty, washing: washing, drying: drying, }}func main() { numberOftshirts := 9 doThursdays := true doDrying := true flag.IntVar(&numberOftshirts, shirts, numberOftshirts, the number of tshirts) flag.BoolVar(&doThursdays, thursday, doThursdays, use Thursday) flag.BoolVar(&doDrying, drying, doDrying, use drying) flag.Parse() today, _ := time.Parse(time.RFC3339, 2017-02-06T00:00:00+00:00) // Set the state with 1 dirty shirt to match OP logic state := ClothesState{ day: today, clean: numberOftshirts - 1, dirty: 1, } minClean := state.clean fmt.Println(format(Date, C, D, W, Y)) fmt.Printf(%v\n, state) testDays := 365 for i := 0; i < testDays; i++ { state = state.Advance(doDrying, doThursdays) fmt.Printf(%v\n, state) if state.clean < minClean { minClean = state.clean } } fmt.Println(Total days:, testDays) fmt.Println(Minimum clean shirts:, minClean)}
_unix.325723
I successfully migrated from Thunderbird to Evolution, including all my contacts. However, the Contact lists or Mailing lists I created in Thunderbird have not migrated. By Contact lists or Mailing lists, I mean that out of the thousands of contacts I successfully migrated, I had created groups of them in Thunderbird. For instance, I could simply type 'family' in the to: field and all the members of my family would expand.I doubt that the migrating Contact lists feature exists, but I ask, in case I missed something.
Migrate Contact lists from Thunderbird to Evolution
thunderbird;migration;evolution
null
_cs.64424
Which of the choices displayed is not a possible order in which Depth-First search could mark the vertices of the graph displayed as visited ?
Which of the choices displayed is not a possible order in which Depth-First search could mark the vertices of the graph displayed as visited?
algorithms;algorithm analysis
null
_softwareengineering.279850
I have a hard time understanding #3 and #8 of Lehman's Laws of Software Evolution. The laws are:(1974) Self Regulation E-type system evolution processes are self-regulating with the distribution of product and process measures close to normaland (1996) Feedback System (first stated 1974, formalised as law 1996) E-type evolution processes constitute multi-level, multi-loop, multi-agent feedback systems and must be treated as such to achieve significant improvement over any reasonable baseThe rest of the laws are clear to me. Could someone explain these two laws?
Explanation of two of Lehman's Laws of Software Evolution
maintenance;software evaluation
After talking to a professor at my university, and using the information provided by Ilyas Mohamed and Boris Eetgerink (I will +rep as soon as I recieve 15 rep myself), this is what I have concluded:Law 3 specifies that the growth of the system will follow the normal distribution curve. This means that the growth will be slower in the beginning and end of the life cycle compared to in the middle. Law 8 states that software evolution is a complex process where feedback shall be collected from multiple sources (users, managers, runtime environment, application domain, etc.) to achieve significant improvement during the evolution process. The following link is a pdf which contains alternate explanations for each of the eight laws: http://www.engr.uvic.ca/~seng371/lectures/L12-371-S13-bw.pdf
_unix.94439
The problem concerns a driver support regression for the RTL8192CUS WLAN chip under antiX 13.1, a Debian Wheezy (stable) based distribution.The chip actually resides in a Edimax EW-7811Un 802.11n wireless adapter.First, here is some general system information.$ inxi -FSystem: Host: 4000cdt Kernel: 3.7.10-antix.3-486-smp i686 (32 bit) Desktop: IceWM 1.3.7 Distro: antiX-13.1_386-full Luddite 19 June 2013Machine: No /sys/class/dmi, using dmidecode: you must be root to run dmidecodeCPU: Single core Pentium II (Deschutes) (-UP-) cache: 512 KB flags: (pae) clocked at 233.275 MHz Graphics: Card: Chips and F65555 HiQVPro X.Org: 1.12.4 drivers: chips (unloaded: fbdev,vesa) Resolution: [email protected] GLX Renderer: Gallium 0.4 on softpipe GLX Version: 2.1 Mesa 8.0.5Network: Card: Edimax EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS] IF: N/A state: N/A mac: N/ADrives: HDD Total Size: 40.0GB (8.7% used) 1: id: /dev/sda model: TOSHIBA_MK4032GA size: 40.0GB Partition: ID: / size: 9.9G used: 3.0G (32%) fs: ext4 ID: /home size: 25G used: 284M (2%) fs: ext4 ID: swap-1 size: 2.15GB used: 0.00GB (0%) fs: swap Sensors: System Temperatures: cpu: 71.0C mobo: N/A Fan Speeds (in rpm): cpu: N/A Info: Processes: 88 Uptime: 2:57 Memory: 72.4/151.4MB Client: Shell (bash) inxi: 1.9.9 During booting, the following errors appear on the screen, caused while executing the /etc/network/if-pre-up.d/linux-wlan-ng-pre-up script:FATAL: Module p80211 not found./etc/network/if-pre-up.d/linux-wlan-ng-pre-upFailed to load p80211.ko.Listening on LPF/wlan0/00:1f:1f:bf:45:7aSending on LPF/wlan0/00:1f:1f:bf:45:7aSending on Socket/fallbackDHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 14DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 17DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13No DHCPOFFERS received.No working leases in persistent database - sleeping.The error messages can be reproduced by issuing respectively the sudo modprobe p80211 and sudo dhclient -v wlan0 commands.The following modules are loaded:$ lsmodModule Size Used bymperf 870 0 cpufreq_stats 2600 0 cpufreq_powersave 575 0 cpufreq_conservative 3562 0 ppdev 4124 0 lp 6127 0 uinput 5093 1 nfsd 156046 2 auth_rpcgss 19755 1 nfsdnfs_acl 1576 1 nfsdnfs 88586 0 lockd 42731 2 nfs,nfsdfscache 21695 1 nfssunrpc 122417 6 nfs,nfsd,auth_rpcgss,lockd,nfs_aclaf_packet 19031 6 dm_crypt 10846 0 arc4 1400 2 rtl8192cu 45534 0 rtlwifi 43564 1 rtl8192curtl8192c_common 23999 1 rtl8192cumac80211 192647 3 rtlwifi,rtl8192c_common,rtl8192cucfg80211 123731 2 mac80211,rtlwifimicrocode 8484 0 evdev 6815 10 mac_hid 2214 0 psmouse 52159 0 pcspkr 1273 0 serio_raw 3177 0 i2c_piix4 6769 0 toshiba_acpi 10065 0 sparse_keymap 1937 1 toshiba_acpiparport_pc 23969 1 rfkill 10599 3 cfg80211,toshiba_acpiparport 21942 3 lp,ppdev,parport_pcwmi 6240 1 toshiba_acpipcmcia 24870 0 battery 5391 0 yenta_socket 15802 0 ac 1753 0 pcmcia_rsrc 5995 1 yenta_socketpcmcia_core 8446 3 pcmcia,pcmcia_rsrc,yenta_socketprocessor 23837 1 button 3513 0 btrfs 555574 0 zlib_deflate 15207 1 btrfsdm_mod 51354 1 dm_cryptfloppy 41663 0 fan 1818 0 thermal 6606 0 thermal_sys 10423 3 fan,thermal,processorProof that this is not an authentication issue:$ sudo cat /var/log/dmesg |grep wlan0[ 36.321107] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready[ 38.921480] wlan0: authenticate with 00:xx:xx:xx:xx:xx[ 38.971473] wlan0: send auth to 00:xx:xx:xx:xx:xx (try 1/3)[ 38.996892] wlan0: authenticated[ 39.000218] wlan0: associate with 00:xx:xx:xx:xx:xx (try 1/3)[ 39.055578] wlan0: RX AssocResp from 00:xx:xx:xx:xx:xx (capab=0x411 status=0 aid=2)[ 39.056549] wlan0: associated[ 39.056781] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready[ 49.062856] wlan0: disassociating from 00:xx:xx:xx:xx:xx by local choice (reason=3)[ 49.086100] wlan0: deauthenticating from 00:xx:xx:xx:xx:xx by local choice (reason=3)[ 50.431396] wlan0: authenticate with 00:xx:xx:xx:xx:xx[ 50.481575] wlan0: send auth to 00:xx:xx:xx:xx:xx (try 1/3)[ 50.684150] wlan0: send auth to 00:xx:xx:xx:xx:xx (try 2/3)[ 50.888146] wlan0: send auth to 00:xx:xx:xx:xx:xx (try 3/3)[ 51.092212] wlan0: authentication with 00:xx:xx:xx:xx:xx timed out$ sudo iwconfigwlan0 IEEE 802.11bgn ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm Retry long limit:7 RTS thr=2347 B Fragment thr:off Encryption key:off Power Management:offlo no wireless extensions.I already tried:Installing the Linux driver from the Realtek site whilst uninstalling the linux-wlan-ng package and blacklisting the kernel's rtl8192cu module (what worked before with antiX 12M), andGiving ipv6.disable=1 as a grub boot parameter to the kernel.QuestionsWhy can the p80211 module not be found in a distribution that is supposed to be based on Debian Wheezy stable?How do I get DHCP working for this wireless adapter?
FATAL: Module p80211 not found. RTL8192CUS WLAN regression under antiX 13.1 (Debian Wheezy)
drivers;kernel modules;wifi;dhcp;wlan
FATAL: Module p80211 not found. is usually an indication that the provided driver is outdated for the used kernel.Moreover, current version 3.4.4_4749.20121105 of Realtek's driver will not compile with the latest Linux kernels. The solution consist in installing a downgraded kernel, compiling Realtek's driver on it and blacklisting the driver provided by the downgraded kernel.Press Ctrl+Alt+F1 to obtain a command line outside the display manager.Execute the smxi.sh script that comes packed with Antix.sudo smxiFor other GNU/Linux distributions, download the script from smxi.org. Follow the instructions. A dist-upgrade is not always necessary.Choose: 6) kernel-options > 1) alternate-kernel-installKernel 3.6.0-11.dmz.1-liquorix-686 or lower work, kernel 3.7.0-10.dmz.1-liquorix-686 and higher do not. The latest stable kernel with long-term support that does work is 3.4.0-35.dmz.1-liquorix-686.Be sure to reboot into the new kernel before proceeding.This kernel can be made to boot by default; simply edit...sudo nano /boot/grub/menu.lstDownload the RTL8192CUS Linux driver from Realtek's web site.Extract the driver. Then, save below bash script as setup.sh in the same directory as install.sh. (I got this script from Schoelje of SolydXK-distro fame.)#!/bin/bashif [ $UID -ne 0 ]; then echo Please, type the root password... su -c $0 $@ exitfiapt-get install linux-headers-`uname -r`apt-get install build-essentialrmmod rtl8192cuchmod +x install.sh./install.shecho blacklist rtl8192cu > /etc/modprobe.d/blacklist-rtl8192cu.confecho 8192cu >> /etc/modulesMake the script executable and execute it.chmod +x setup.sh./setup.shAfter succesfull completion of the script, issuesudo service network restartYour RTL8192CUS wireless adapter should now function properly.Use the Wicd application to connect to a wireless network.If always the same WLAN is used, one can also hardcode the security credentials in as follows:sudo chmod 600 /etc/network/interfacessudo nano /etc/network/interfaces# interfaces(5) file used by ifup(8) and ifdown(8)auto loiface lo inet loopbackallow-hotplug eth0iface eth0 inet dhcpauto wlan0iface wlan0 inet dhcp wpa-ssid xxxxxxxxxxx wpa-psk xxxxxxxxxxxx
_webmaster.84551
My Search Console (Webmaster Tools) account shows 343 web pages submitted but only 132 indexed. The actual number of posts on my blog are 138. What should I do?I am also getting 179 not found errors; what should I do about those errors?Any help regarding these issues would be appreciated a lot. Thanks!
Search Console shows 343 web pages submitted but only 132 indexed
google search console;indexing
null
_cs.55754
Find the language generated by the following grammar over the input alphabet = {a,b}.S > aSa | bSb | a | b The language generated by the above grammar over the alphabet {a,b} is the set of(A) All palindromes(B) All odd length palindromes.(C) Strings that begin and end with the same symbol(D) All even length palindromesthe ans is b. i want to know the language for the grammar
odd length palindrome's f=language
formal languages;context free;formal grammars
null
_webmaster.11835
I added a Google Custom Search to my website several weeks ago, and it has been unable to find anything other than the home page of my site.I have manually submitted a sitemap to the custom search, and to the webmaster tools (which for some the custom search can't find, but it says I should add one).I understand there are not a lot of details here, but I don't have much to go on. I've double checked my robots.txt, there's nothing there that's preventing the indexing of my pages.EDIT: Actually, does the google custom search work any differently than a regular google search? I assumed that it indexed separate from the regular google search, but I guess it's possible that both a google custom search and the normal google search draw from the same pool of pages. In that case the only way to get custom search to find my pages is to get Google to crawl them...which pretty much makes the custom search useless if it can't find the most recent things I've posted.
Google Custom Search can't find anything other than the main page
google custom search
null
_unix.12038
Is it possible to highlight (set a background colour) for the whole line of the prompt in zsh? In my emacs config I have the line on which the cursor sits a slightly different colour to the window background, which is a great visual aid. I'm wondering whether it's possible to do the same in my terminal/zsh prompt, so that it effectivly draws a line under everthing that's been run.I've tried setting PROMPT='%{$bg[grey]%}# ' in my .zshrc but the highlight only extends as far as I type, not to the edge of the terminal.Is what I'm trying to achieve possible?
Can I highlight the current prompt line in zsh?
zsh;prompt;colors
null
_opensource.666
Many FOSS projects start out without a Contributor License Agreement (CLA). Many, if they become large and successful, will want to transition to system based on CLAs. But what about if they can't track down all of the old contributors? I can think of three possibilities:They can continue without the contributors signing the CLA and proceed to change the license etc with the hope that the contributors will be found in the futureThey can rewrite all code contributed by themThey can keep the existing license until all contributors have signed their CLAsIs the first option possible or do such projects need to choose between the second and third?
What can you do if you can't track down all old contributors to sign a CLA?
project management;contributor agreements
null
_unix.364801
I have a large GTF file, like below: # ./stringtie -p 4 -G /home/humangenome_hg19/homo_gtf_file.gtf -o strAD1_as/transcripts.gtf -l strAD1 /home/software/star-2.5.2b/bin/Linux_x86_64/mapA1Aligned.sortedByCoord.out.bam # StringTie version 1.3.2d 1 StringTie transcript 30267 31109 1000 + . gene_id strAD1.1; transcript_id strAD1.1.1; reference_id ENST00000469289; ref_gene_id ENSG00000243485; ref_gene_name MIR1302-10; cov 0.028725; FPKM 0.053510; TPM 0.109957;1 StringTie exon 30267 30667 1000 + . gene_id strAD1.1; transcript_id strAD1.1.1; exon_number 1; reference_id ENST00000469289; ref_gene_id ENSG00000243485; ref_gene_name MIR1302-10; cov 0.014218;1 StringTie exon 30976 31109 1000 + . gene_id strAD1.1; transcript_id strAD1.1.1; exon_number 2; reference_id ENST00000469289; ref_gene_id ENSG00000243485; ref_gene_name MIR1302-10; cov 0.072139;I want to have the 9th column with just gene_id, transcript_id, reference_id and ref_gene_id. They are in the 9th column and separated by space (the columns themselves are TAB-separated). Could you please help me out how I can such a column with a simple command in Linux? I don't want to use Excel for it.
Extracting quoted and labelled data from a given column
text processing;bioinformatics;table
Ideally, since the data is in GTF format, one should use a GTF parser to parse it. I currently have no such parser or parsing library installed so my solution is based solely on the data that you have provided in the question.To extract the 9th column:$ cut -f 9 data.gtfgene_id strAD1.1; transcript_id strAD1.1.1; reference_id ENST00000469289; ref_gene_id ENSG00000243485; ref_gene_name MIR1302-10; cov 0.028725; FPKM 0.053510; TPM 0.109957;gene_id strAD1.1; transcript_id strAD1.1.1; exon_number 1; reference_id ENST00000469289; ref_gene_id ENSG00000243485; ref_gene_name MIR1302-10; cov 0.014218;gene_id strAD1.1; transcript_id strAD1.1.1; exon_number 2; reference_id ENST00000469289; ref_gene_id ENSG00000243485; ref_gene_name MIR1302-10; cov 0.072139;To get the data that we want from this, we need to treat transcripts and exons separately as their attributes have different order in the data. We do this with awk and output different fields in the input data depending on whether the current line contains the string exon_number or not:$ cut -f 9 data.gtf | awk '/exon_number/ { print $2, $4, $8, $10; next } { print $2, $4, $6, $8 }'strAD1.1; strAD1.1.1; ENST00000469289; ENSG00000243485;strAD1.1; strAD1.1.1; ENST00000469289; ENSG00000243485;strAD1.1; strAD1.1.1; ENST00000469289; ENSG00000243485;Then we remove the double quotes and semicolons from this:$ cut -f 9 data.gtf | awk '/exon_number/ { print $2, $4, $8, $10; next } { print $2, $4, $6, $8 }' | tr -d ';'strAD1.1 strAD1.1.1 ENST00000469289 ENSG00000243485strAD1.1 strAD1.1.1 ENST00000469289 ENSG00000243485strAD1.1 strAD1.1.1 ENST00000469289 ENSG00000243485
_unix.366231
How to debug this? This issue has suddently appeared within the last couple of days.. All backups of a website are corruptedIf the backup is just left as tar there are no problems, but as soon the tar is compressed as gz or xz I can't uncompress themThere is alot of free diskLocal disk space 2.68 TB total / 2.26 TB free / 432.46 GB usederrortar: Skipping to next header[===============================> ] 39% ETA 0:01:14tar: A lone zero block at 2291466===============================> ] 44% ETA 0:01:13tar: Exiting with failure status due to previous errors 878MiB 0:00:58 [15.1MiB/s] [===================================> ] 44%And why does it say Skipping to next header? It has never done that before.. Something is terribly wrong the some of the filesThere are about 15k pdf, jpg or png files in the directoriescommandpv $backup_file | tar -izxf - -C $import_dirThere must be some data that corrupts the compressionHave also tried to check the HDD health by doing this# getting the driveslsblk -dpno namesmartctl -H /dev/sdasmartctl -H /dev/sdbOn both drives I get this=== START OF READ SMART DATA SECTION ===SMART overall-health self-assessment test result: PASSEDHow can I find out which files that are corrupting the tar.gz? I just want to delete themupdateHave now copied all files to another server and I have the exact same issue.. I can tar everything and extract it without problems, but as soon I want to compress the files I can't uncompress them (gz/xz).
How to debug: tar: A lone zero block
debian;tar;corruption
Your file is either truncated or corrupted, so xz can't get to the end of the data. tar complains because the archive stops in the middle, which is logical since xz didn't manage to read the whole data.Run the following commands to check where the problem is:cat /var/www/bak/db/2017-05-20-1200_mysql.tar.xz >/dev/nullxzcat /var/www/bak/db/2017-05-20-1200_mysql.tar.xz >/dev/nullIf cat complains then the file is corrupted on the disk and the operating system detected the corruption. Check the kernel logs for more information; usually the disk needs to be replaced at this point. If only xz complains then the OS didn't detect any corruption but the file is nevertheless not valid (either corrupted or truncated). Either way, you aren't going to be able to recover this file. You'll need to get it back from your offline backups.
_unix.111416
I did a fresh installation of Fedora 20 in the free space of my hard drive after failing to upgrade from the older version. Everything seems to be working fine until I deleted the partition containing the older version to free up some space. Upon restarting the computer, I got the following message after waiting for a long time:Warning: Could not bootWarning: /dev/fedora_old/swap does not existStarting Dracut Emergency ShellI am still able to boot if I type exit on dracut prompt. But, that does not solve the root of the problem. There are a few suggestions on the web proposing:dracut --force --regenerate-allI am not sure what it does exactly and it doesn't seem to resolve the problem. What is the proper way to sort out the swap partition? It seems that the swap for the older OS was being used when the new OS is being installed despite it having its own swap partition.And how could I avoid such a problem in the future?This is what I have for /etc/fstab:/dev/mapper/fedora_new-root00 / ext4 defaults 1 1UUID=somehexdec /boot ext4 defaults 1 2UUID=someotherhexdec /boot/efi vfat umask=0077,shortname=winnt 0 0/dev/mapper/fedora_new-home00 /home ext4 defaults 1 2/dev/mapper/fedora_new-swap swap swap defaults 0 0
How to recover from a boot hang after deleting old swap?
fedora;boot;partition;swap;lvm
It seems that manually editing out the parameter containing rd.lvm.lv=fedora_old/swap in the grub configuration file does the trick. There is no need to run dracut or reinstall grub at all.# vi /boot/efi/EFI/fedora/grub.cfgSearch for the following line under the menu entry which you will be booting from:linuxefi /vmlinuz-3.12.x-xxx.fc20.x86_64 root=/dev/mapper/fedora_new-root00 ro rd.lvm.lv=fedora_old/swap rd.lvm.lv=fedora_new/swap vconsole.font=....To make sure the above changes stick, do the same for /etc/default/grub:GRUB_CMDLINE_LINUX=rd.lvm.lv=fedora_old/swap rd.lvm.lv=fedora_new/swap vconsole.font=...Please provide an answer or leave a comment if this method is wrong.
_softwareengineering.164903
I have noticed that Play! Framework encompasses persistence strategy (like JPA etc...)Why would a web framework care about persistence ?!Indeed, this would be the job of the server-sides components (like EJB etc...), wouldn't this?Otherwise, client would be too coupled with server's business logic.UPDATE: One answer would be : it's more likely used for simple application including itself the whole business logics. However, for large applications with well-designed layers(services, domain, DAO's etc..), persistence is not recommended within web client layer since there would be several different web(or not) clients.
Web Frameworks caring about persistence?
java;web applications;web framework;playframework
If the framework is used as part of an application that involves a database back-end, then it may be useful to have persistence of the data in a form that doesn't require the physical database.For example, I can remember a previous workplace that used Fluent nHibernate as the ORM tool that would be used translate database tables to objects. This would be one example.Given that Play! is built in Java, it would appear to be a server-side component thus making that 3rd line add little value to the question, IMO.To elaborate a bit more, I see a few pieces together and this is where persistence plays a role:The system has a Web UI component that makes web pages for the user.The system has a database component where stuff is stored where various CRUD operations are performed.There is the desire to test components independently of each other.Thus, to test the Web UI component without having the database requires one to construct something to mimic being the database which is what the persistence piece usually is.
_webapps.9531
There's been some news recently that Google Apps accounts, having previously been not quite as full-featured as regular Google accounts, are being upgraded to included additional services (e.g. Reader) that were only available to regular accounts.Aside from the change in the service offerings, are there any other noticeable changes?Edit: more specifically, if I have my own Google Apps account, is there anything on a regular Google account not offered with an Apps account?
How does a Google Apps account differ from a Google account?
google apps;google account
Google Apps for your domain is basically the same, but for a custom domain. You buy your domain, point the MX records for your domain to the google servers and you can send and receive email through gmail etc (as an example)It used to be just gmail, docs, calendar, gtalk and a couple of other apps that you could access through your google apps account, but now they've released a whole lot more.See http://googleenterprise.blogspot.com/2010/11/ten-times-more-applications-for-google.html for more details
_codereview.83437
I am trying to find the longest repeated string in text with python, both quickly and space efficiently. I created an implementation of a suffix tree in order to make the processing fast, but the code fails on large files due to memory problems.I am purposely not using any advanced libraries for this particular code. import stringimport sysclass SuffixTree(object): class Node(object): The suffix tree is made of Node objects, which contain a position of where that substring it represents is in the larger text, a suffix which is all of the un-matched characters of a substring, and a out which contains links to the other nodes def __init__(self, position, suffix): self.position = position self.suffix = suffix self.out = {} def __init__(self, text): the constructor for the SuffixTree takes in the text self.text = text self.max_repeat = 2 # setting this to 2 initially because repeats of length 1 are not interesting self.repeats = {} # dictionary to hold the repeats as we find them self.root = self.Node(None, '') # initialize a root node L = len(self.text) # calculate the length of the text Loop through the range of the text test = {} for i in xrange(L, 0, -1): try: self.branch(self.root, self.text[i-1:] + $, i-1, 0) except MemoryError: print Memory Error at the + str(i) + th iteration! return def printRepeats(self): printRepeats simply finds the maximum repeat of the repeats we collected while building the tree and then prints out the information. It should be noted that currently if there are more than one repeated sequence which are both of the same maximum length, this function is only going to print out one of them Also I am going in and changing the positions to be the biological positions by adding one max_repeat = max(self.repeats.iterkeys(), key=len) print Max repeat is, len(max_repeat), :, max_repeat, at locations:, for position in self.repeats[max_repeat]: print position+1, print def branch(self, currNode, substring, pos, repeat): branch function takes a particular substring, and starts at the current node (the root node) it checks to see if the current node contains a link to another node with the value of the substring's first letter. If it does, it sets current node equal to THAT node and repeats the process recursively. If a node has a suffix (leftovers that weren't needed to be matched) then it will create a new node based on the first letter in that suffix and attempt to see if it now has a branch it can follow. When eventually it finds a location where it can get no deeper, it saves the current leftover letters as that node's suffix and returns recursively back to the main execution point (our constructor function). Additionally while it is creating this branch, we are simultaneously creating the repeat information which we want to gather. To do this, when it finds that it can no longer traverse down the node tree it will have maintained a count (variable called repeat) of how deep it has gone it will then save the position of where it stared as well as the positions of all of the adjacent level nodes into the repeat dictionary. It will only do this however if the length of the repeat is longer than or equal to the maximum recorded repeat. So for instance if we had found a repeat of length 3, it isn't going to bother saving any information about a repeat of position 2. # check if the current node has leftover letters (called a suffix) if so, create a new branch if currNode.suffix != '': currNode.out[currNode.suffix[0]] = self.Node(currNode.position, currNode.suffix[1:]) currNode.suffix = '' currNode.position = None # if there is no more paths that we can follow while substring[repeat] in currNode.out: currNode = currNode.out[substring[repeat]] # check if the current node has leftover letters (called a suffix) if so, create a new branch if currNode.suffix != '': currNode.out[currNode.suffix[0]] = self.Node(currNode.position, currNode.suffix[1:]) currNode.suffix = '' currNode.position = None repeat += 1 #substring = substring[1:] else: # create a new node with its first letter, position, and put the rest of the letters in the suffix currNode.out[substring[repeat]] = self.Node(pos, buffer(substring,repeat+1)) # check to see if the length of this repeat is >= the biggest ones we've found so far if repeat >= self.max_repeat: # go through each node at this branch and save its info to the repeat dictionary for node in currNode.out: self.repeats.setdefault(self.text[pos:pos+repeat], []).append(currNode.out[node].position) # set the new maximum repeat size to this repeat size self.max_repeat = repeat text = readFile(ecoli.fasta) tree = SuffixTree(text) tree.printRepeats()The file 'ecoli.fasta' is simply a text file that is 4.5MB large filled with A,G,T,C characters (it's a DNA sequence). The main for loop dies with a Memory Error after the 4,577,890th iteration. At this point there are approximately 63,762 Nodes. Any suggestions?
Python Longest Repeat
python;algorithm;strings;tree;bioinformatics
null
_cs.51950
I've recently been working on creating a neural network to classify handwritten digits. I implemented 1-of-N encoding such that there are the same number of output nodes as possible digits (The expected output is 0 for all digits' nodes except for the digit that was inputted, which would be 1).Because this is a classification problem, I opted for Cross Entropy Error. I followed this model shown here: https://visualstudiomagazine.com/articles/2014/04/01/neural-network-cross-entropy-error.aspxand also shown here:http://www.mathworks.com/help/nnet/ref/crossentropy.htmlThe error function is:$$-\frac1n\sum y\ln(\hat y)$$Where $y$ is the expected output and $\hat y$ is the predicted output.However, after I implemented my network I noticed a problem. Because this formula for cross entropy error does not account at all for the error of the predicted output for the nodes that have an expected output 0 (since the CE function multiplies all of those costs by the expected 0), the network tunes the weights/biases to always output nodes close to 1. Therefore, I end up getting a list of 1s. According to the CE cost function this is good because one of the outputs is spot on, but it doesn't even look at the other nodes' error (which is huge), so it is impossible to decide on one output.Maybe I'm missing something? I see the alternate CE function is $$-\frac1n\sum y\ln(\hat y) + (1-y)\ln(1-\hat y)$$but according to the MathWorks link above, it shouldn't be used for 1-of-N encoding where there are more than $N=1$ output nodes (Not sure why this is the case).So my question would be:Why is the first Cross Entropy Error equation viable for classification if it does not account for the error of the nodes where 0 is expected, as it always tends all the nodes to 1?
Flaw with Cross Entropy Error in Neural Networks
artificial intelligence;neural networks;functional programming
null
_opensource.184
Many software developing companies use open source tools or open source libraries. Sometimes they even tweak this software for their needs. So, one might argue that this tweaks should be given back to the OSS-project. That means, contributions of that company will become public.But what are the advantages for a company doing so? Are there any at all? Are there disadvantages?
What are the upsides for a company to contribute to an open-source software they use?
contributor
AdvantagesReduced maintenance. If a company uses custom patches, every time upstream changes, the company has to re-apply those patches when they update their custom version. This gets worse when upstream undergoes major refactors or changes in interfaces.Publicity. By having its name included in the project's contributor list, other users become aware of the company. This could mean potential hires who are interested in the project, but through the project apply for employment. There's also a lot of goodwill associated with open source software; Microsoft for example earned lots of kudos when it began contributing significant code to prominent open source software like Linux.Employee perks. Most software developers at companies are work-for-hire; every line of code they write is owned by the company. This means that when they go elsewhere, they cannot easily show the work they've done. But open source contributions are open for all, so they can point to specific projects and commits, improving their hireability and their market value. Also, some employees simply like contributing to open source projects for its own sake.Competition against a market leader. A major reason why lots of companies work on open source software is they can pool resources on an open project that is in competition with a dominant, closed rival. Open source allows them to share the workload. For example, OpenStack is a collaboration by hundreds of companies to compete against market leaders like Amazon.DisadvantagesCompetitive advantage. If a certain type of software is a company's competitive advantage, it is exceedingly unlikely that they'll share it, because obviously, their competitors can then take advantage of it. For this reason, most if not all corporate open source contributions are in software that is not part of their core business. Google for example does a lot of open source work with Android and WebKit, but that's because free and better mobile platforms and browsers helps point people to their bread-and-butter: viewing ads. There is almost no way that Google will open their search engine or ad serving software, without a major change in business models.Risk of losing intellectual property. Even if a piece of software isn't a company's competitive advantage, critical pieces of code could accidentally sneak into the open. A careless developer could accidentally contribute an advanced algorithm, for example. Because of this, most companies run their open contributions through their legal department first. Most don't bother with this because it's more trouble than it's worth.Risk of legal trouble. Not all code a company uses is fully owned by the company; there could be third party licensed code or code under NDAs and so forth. Accidentally opening these opens the company to legal problems. Again, most companies run through legal, and again most don't bother with the trouble.
_unix.186827
Have a situation that SCP and SFTP wouldn't work for. I've RTFM for SSH, but can't find what I'm looking for. The scenario is that in order to transfer files to the server, I first SCP them into a user directory, then log in with SSH using a limited user account, SU to root, and then move the files where they need to be. Because the server does not allow root login, is there a way to login with SSH, SU to root, and transfer files from the local machine?Really I'm just looking for a more efficient practice then the going back-and-forth like I've been doing.As a addition, I'd appreciate any links in the comments to GUI clients that would allow this on a Mac so I could drag & drop files from the local machine into the appropriate remote directory. An SFTP GUI client seems the logical choice, but the required elevated user permissions prevents it from doing what I need.
File transfers with SSH and switch-user
linux;ssh;scp;sftp
On your local system, create a skeleton of what you want. For example, if you want to copy file foo to remote location /etc/foo, then you need to create an etc directory and then put foo into it. Then tar the skeleton. Now you can do this via cron as suggested by @Anthon in the comments to the question above.Step by step:On the remote host, create script like this:#!/bin/shDROP=/home/YOURUSERNAME/drop.tgzif [ ! -s $DROP ]; then exit 0; ficd /tar -pzxf $DROP && rm $DROPOn the remote host, add that script to a cron job that runs as root.On your local host, create the skeleton and populate the files you want copied:mkdir -p etcmkdir -p var/wwwcp -a foo etc/cp -a bar var/www/tar -pzcf drop.tgz etc varscp drop.tgz REMOTEHOST:rm -rf drop.tgz etc varThe drop.tgz will be extracted when the root's cron next runs. Note, this will overwrite all kinds of things that you might not like.A safer option, assuming there are only a few files you need to modify, would be to make your user account have write access to them (chown or both chgrp and chmod g+w), then you can scp them directly.
_codereview.60362
My requirement is to add two binary numbers, say 1001 and 0101 as binary1 and binary2.Partial Class Default2 Inherits System.Web.UI.Page Dim carry As Boolean = False ' Boolean variable to hold the carry if occured Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click Dim binary1 As String = TextBox1.Text 'First binary number Dim binary2 As String = TextBox2.Text 'Second binary number Dim result As String = 'to store the result For i As Integer = Len(binary1 ) - 1 To 0 Step -1 result = bin_add(getbyte(binary1 , i), getbyte(binary1, i)) & result ' calling function Next If carry = True Then result = 1 & result 'if a carry remains add it to the MSB End If MsgBox(rslt) 'Display the result End Sub Public Function bin_add(b1 As Boolean, b2 As Boolean) As String'Function which performs the addition of each single bits form the two inputs which is passed from the calling function Dim result As Boolean If b1 AndAlso b2 = True Then 'both values are 1/true If carry = True Then result = True carry = True Else result = False carry = True End If ElseIf b1 = False And b2 = False Then 'Both are 0/false If carry = True Then result = carry carry = False Else result = False carry = False End If Else If carry = True Then result = False carry = True Else result = True carry = False End If End If If result = True Then Return 1 'return 1 for Boolean true Else Return 0 'return 0 for Boolean false End If End Function Private Function getbyte(s As String, ByVal place As Integer) As String'Function for getting each individual letters from the input string. i got it from net. If place < Len(s) Then place = place + 1 getbyte = Mid(s, place, 1) Else getbyte = End If End FunctionEnd ClassNotes:It gives good results for me only if the no. of digits in both numbers are the same.Question:How can I improve the code? Especially, how can I reduce the length of code?
Adding string binary numbers
strings;vb.net
For now, let's ignore the fact that there are easier ways to add binary numbers. There are other issues with this code. Inherits System.Web.UI.PageWhy is code that adds binary numbers inheriting from a UI class? There's no need for this. Separate the concerns and create a module for this code instead. carry is scoped to the class level. This is a symptom of problems in this code. Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click Dim binary1 As String = TextBox1.Text 'First binary number Dim binary2 As String = TextBox2.Text 'Second binary number Dim result As String = 'to store the result For i As Integer = Len(binary1 ) - 1 To 0 Step -1 result = bin_add(getbyte(binary1 , i), getbyte(binary1, i)) & result ' calling function Next If carry = True Then result = 1 & result 'if a carry remains add it to the MSB End If MsgBox(rslt) 'Display the resultEnd SubGetting the values from the UI makes sense, but then you loop over bin_add, which obviously doesn't actually add anything, or you wouldn't need to loop or have a class variable. All of this logic should happen inside of bin_add.bin_add should take in two strings, handle all of the logic, and return a single string representing the output. While I'm at it, methods should have PascalCased verb-noun names. This method should be called AddBinary and I will refer to it as such for the rest of the review. As I said earlier, I wouldn't expect a Function that adds binary numbers to take in Boolean values. I would rather it actually take in a byte and overload the method to handle string representation, but I'm lazy and you don't seem to need all that.Putting it all together, the signature line Public Function bin_add(b1 As Boolean, b2 As Boolean) As StringShould look like this. Public Function AddBinary(value1 as String, value2 as String) As StringImplementing this change will be left as an exercise for the reader.
_unix.168737
I have a command in a bash script which I want to capture the output of and then send it to the background. How do I get this done?The following doesn't seem to work (it keeps blocking and outputs nothing)result=`node /var/www/animekyun/node/node_modules/peerflix/app.js $torrent -r -q &`This doesn't seem to work. The output is 2 lines btw which I want to store in a variable as an array. This way I can use the output in the rest of my script.
Store stdout in variable and send command to background
bash;shell;background process;command substitution
Untested, but this might work with a FIFO:filename=/tmp/my.fifomkfifo $filenamenode /var/.../app.js $torrent -r -q >$filename &{ read first_line; read second_line; } <$filename# do something with $first_line and $second_line
_softwareengineering.184290
I want to start a little project, where I want to connect several of my devices. Some are Android mobile devices, others are desktop devices like a PC or laptop. Furthermore I want keep the project as generic as possible. Means I want to share it, so other people can use it.By connecting I mean send messages between them. My problem is, that I'am not sure what technology or architecture to use, and hope to get some advice from you. (I think this question is more about software architecture then gorilla vs. shark)I have considered several approaches already. I looked at Google's Cloud Messaging, but that seems not to fit my requirements, where several users can register to send independent messages. It looks more like, sending from one master to several devices.The next thing I thought about was something lile VLC did with its Android remote app, where the desktop application hosts something like a server to which the mobile app must connect. This seems to be limited to LAN and only fits to about 80% of my use cases.Is there another approach which does not require something like a server who is aware of all clients, which has to seperate the user's devices and route the messages?
How to connect several (mobile) devices
architecture;mobile
null
_unix.167697
I am accessing a Unix system using Putty and need to copy the content of one of the Unix files into my local Windows. How can I do this?
Copying content of a remote file into the local clipboard over PuTTY
putty;clipboard
null
_unix.67281
I'm working on booting a headless server (Fedora 16), entering the passphrase to decrypt the root disk (LUKS) over SSH using dropbear. I've got dropbear all working: I can SSH to the server while it's sitting and waiting for the password. But I can't figure out how to actually pass the password to use.The crypt script that asks for the password and decrypts the volume uses the plymouth ask-for-password command; is there a way to pass the password into this command from the command line? I've tried writing to the process's stdin, but that didn't work. Is there some other way I can do it?
Provide passphrase to plymouth ask-for-password from command line
ssh;boot;luks
I ended up creating a kind of hacky work around, but it is working for me, and I've been using it for several months now. It basically just replaces the cryptroot-ask shell script with a custom one that waits for you to SSH in, unlock the disk yourself, and then delete a file to indicate that it's gone. Replacement of the cryptroot-ask script is done based on a option passed to the kernel, so you can easily disable it from your GRUB, or your bootloader of choice.It's all available from: https://bitbucket.org/bmearns/dracut-crypt-wait
_webmaster.108763
Something strange happened to a website that I manage. I can access all pages (including ACP) except the front page.For example I can access this page: http://www.icisequynhon.com/conferences/2016/mechanobiology/news-deadline/but the front page http://www.icisequynhon.com/conferences/2016/mechanobiology/ will direct to http://rencontresduvietnam.org/conferences/2016/mechanobiology/ (where I hosted the website previously). I have checked in Settings and the URLs there are correct.Could you please help?Thank you very much in advance!
Wordpress: cannot access the front page
wordpress
null