Skip to main content

harry palmer

harry palmer's Public Library

    • Well I checked a youtube video, that shows a procedure, and it worked perfect for me!. Now firefox is way faster that before, and more than that, is faster than chromium!. The procedure is basically the following:

      • open a new tab in firefox and write "about:config". Enter.
      • Press in "I'll be carefull, I promise", in order to get into the settings page.
      • Once in the settings page, In the "filter" field write: network.http
      • Go to the list below and double click "network.http.pipelining" in order for it to change from "false" to "true"
      • do the same for "network.http.proxy.pipelining"
      • Now, in the "filter" field write: network.dns
      • Go to the list below and double click "network.dns.disableIPv6" in order for it to change from "false" to "true".

      That's all! now you have the Fastest browser you'll ever find!.


      Just for the record: Firefox version: 29.0 , Ubuntu version: 14.04

  • Research was recently published in PLoS ONE linking psychological disorders in parents with suicidal behaviors in offspring of various ages.

    The study, which examined 2,942 participants in Brazil, sought to distinguish between different types of suicidal behaviors and determine how they correlate with various disorders exhibited by the parents. The study was also aimed at targeting specific periods in the child’s life to understand when the impact risk was the greatest.

    <script src="//" async=""></script> <script>(adsbygoogle=window.adsbygoogle||[]).push({});</script>

    For the purposes of the study, suicidal behavior was placed into one of three categories: ideation (thoughts), plans, or attempts. Psychological disorders were categorized according to the DSM-IV, a diagnostic manual for psychology professionals.

Aug 28, 15

"You could use Series.str.replace:

import pandas as pd

df = pd.DataFrame(['$40,000*','$40000 conditions attached'], columns=['P'])
# P
# 0 $40,000*
# 1 $40000 conditions attached

df['P'] = df['P'].str.replace(r'\D+', '').astype('int')

0 40000
1 40000"

  • You could use Series.str.replace:

    import pandas as pd  df = pd.DataFrame(['$40,000*','$40000 conditions attached'], columns=['P']) print(df) #                             P # 0                    $40,000* # 1  $40000 conditions attached  df['P'] = df['P'].str.replace(r'\D+', '').astype('int') print(df)


    0  40000 1  40000

    • Type “about:config” in your browser bar and adjust the following preferences (by double clicking on them) to free up some additional memory:
      • browser.cache.memory.capacity (set to 0)
      • browser.cache.memory.enable (set to false)
      • browser.sessionhistory.max_total_viewers (set to 0)
      • browser.tabs.animate (disable)
      • browser.sessionstore.max_concurrent_tabs (set to 0)
    • Here some more advanced settings to speed up page loading:
      • (set to true)
      • javascript.options.jit.content (set to true)
      • content.notify.backoffcount (set to 5)
      • network.dns.disableIPv6 (set to true)
      • network.http.pipelining (set to true)
      • network.http.proxy.pipelining (set to true)
      • network.http.pipelining.maxrequests (set to 8 )
      • plugin.expose_full_path (set to true)
      • ui.submenuDelay (set to 0)

    • A lot of people such as myself waste time getting mongo data into numpy or pandas data structures.


      You could do it using pymongo. The general process would be to initialize the pymongo driver and make a query, wait for pymongo to convert stuff into lists of son (bson) objects (aka dictionaries), parse the data into arrays, and then copy it into some numpy array. But work's been done for you already, so why do it again?


      Thanks to djcbeach, we have a nifty little module that utilizes mongo's C driver, the bson C library and python's ctypes module to load data directly into numpy arrays. Its fast and easy! From there, we can pass this into Wes McKinney's pandas dataframe and be very, very happy.


      Lets look into this, shall we?

      1. Assuming you have numpy already and a mongo server, install Monary. Dont use pip, because the module isn't even in the cheeseshop.

    • Introduction


      In the python world, there are multiple options for visualizing your data. Because of this variety, it can be really challenging to figure out which one to use when. This article contains a sample of some of the more popular ones and illustrates how to use them to create a simple bar chart. I will create examples of plotting data with:


      In the examples, I will use pandas to manipulate the data and use it to drive the visualization. In most cases these tools can be used without pandas but I think the combination of pandas + visualization tools is so common, it is the best place to start.

  • We all know amazing libraries Jinja and WTForms which simplify our life in rendering web pages for user. By default, they don’t provide any advanced formatting or styling. One of the ways to solve this is to use Bootstrap library. This post will show how to integrate this three libraries all together using forms as example.


    NOTE: Code for this post is embed at the end of the post or you can jump directly to gist in the new tab (recommended):



    HTML Forms is the main mechanism of user interaction with website. Even now, on modern websites people fill forms – changed only the way how forms are submitted. Lifecycle of form is straightforward: form rendered by web server, user fills form and submits it to server, server validates the form and do action that it supposes to do if form is correct. It is a good idea to consolidate code of rendering, processing and validation into some common component and this is what actually WTForms library is doing. It is very well designed and easy extendable library (which we will see on the bootstrap example below) and you should definitely consider using it in your projects. Here is how basic form looks:

  • Crash Course


    So you’ve cracked your knuckles and started working on that awesome python webapp you want to write. You get through writing a few pages and finally you need to tackle that loathsome task: form input handling and validation. Enter WTForms.


    But why do I need yet another framework? Well, some webapp frameworks take the approach of associating database models with form handling. While this can be handy for very basic create/update views, chances are not every form you need can map directly to a database model. Or maybe you already use a generic form handling framework but you want to customize the HTML generation of those form fields, and define your own validation.


    With WTForms, your form field HTML can be generated for you, but we let you customize it in your templates. This allows you to maintain separation of code and presentation, and keep those messy parameters out of your python code. Because we strive for loose coupling, you should be able to do that in any templating engine you like, as well.

  • A lot of work has gone into cultivating the ignorance displayed by EndangeredSpecies and a lot of other posters on here or we wouldn't be in the mess we are in.


    Henry Ford once remarked that if people really understood how the banking and money system worked, their would be a revolution before tomorrow morning and he wasn't kidding.


    The truth is coming out gradually because the internet is providing a way to circumvent the bullshit and even the Bank of England was forced to admit recently that what most people believe and what is taught in many university courses is pure fantasy.


    Take the statement from above by Robert Skidelsky, "A national investment bank could draw out these “idle savings” by issuing bonds for infrastructure development."


    Banks NEVER lend out savings but instead CREATE NEW MONEY.


    They are forbidden by their Charter from doing so because savings are recorded on their books as a liability and not an asset (they are liable to repay them at any time).


    The Bank of England released a new working paper on Friday (May 29, 2015) - Working Paper No. 529:


    “Banks are not intermediaries of loanable funds - and why this matters” by Zoltan Jakab and Michael Kumhof


    The paper reveals that the information that students glean from monetary economics courses with respect to the operations of banks and their role in the economy is not knowledge at all but fantasy.


    They emphatically state that the real world doesn’t operate in the way the textbooks construe it to operate and, that as a consequence, economists have been ill-prepared to make meaningful contributions to the debates about economic policy.


    That is perhaps why John Kenneth Galbraith (Harvard Economist) once said "The only function of economic forecasting is to make astrology look respectable."

  • Skidelsky has got it wrong in the way he explains Corbyn's People's QE. Of course all state fiat money depends upon taxation reflux to establish its demand but not all of the amount it creates needs to be refluxed depending on the state of the economy. Indeed if the current account including foreign trade is in the red the private sector in aggregate cannot save unless government runs a "deficit" (private sector savings "injection"). This is elementary Sectoral Balances Accounting 101. An understanding that completely eludes Blue and Red Tories!


    The money for the original Bank of England 375 billion pounds QE programme was not raised from taxes it was created from nothing electronically on a Bank of England computer. This is what a sovereign government can do. Adam Smith understood this over 240 years ago:-


    "A prince, who should enact that a certain proportion of his taxes should be paid in a paper money of a certain kind, might thereby give a certain value to this paper money; even though the term of its final discharge and redemption should depend altogether upon the will of the prince."


    ( Adam Smith. “The Wealth of Nations” Book II, Chapter II. 1776 )


    Corbyn's People's QE proposal is to do exactly the same. A limited liability company will be set up called the National Investment Bank. It will issue bonds and these will be cancelled periodically in the same way by the BoE creating money from nothing electronically.


    Alternatively it could be decided by a Corbyn administration to stop pissing about and for the government through its central bank to create the money directly for its spending in the same manner it used to through the issue of tally sticks before monarchs became corrupt and bought gilts on the side and stock in quasi British Imperialist "military colonising machines" like the East India Company. Now you know why the rich and its media representatives are slinging so much mad at Corbyn. They stand to lose "free income" from the government because the government can create money from nothing for its spending programme and gilts are just a savings account to help the Bank of England hit a particular base rate. A Corbyn government could, of course, simply choose to make the bank rate the same as it pays on reserves although I believe it would be wiser to offer a form of government savings scheme maybe by retaining gilts that would ensure a "positive" interest rate and thereby encourage a feeling of monetary stability which would encourage investment.



    And for the hyper-inflation hysterians:-


  • While this is debatable, what is clear is that QE has funnelled billions (£375bn in the UK) into the financial markets, whilst hoping that that money would eventually ‘trickle down’ to the real economy. This money creation helped spur a bubble in financial markets: by the Bank of England’s own estimates, QE in the UK pushed up share and bond prices by around 20%. But because around 40% of stock market wealth is held by the wealthiest 5% of households, QE has made that wealthiest 5% better off by around £128,000 per household. The evidence is that it has done very little to create jobs and increase economic growth.


    There is a far more powerful way of creating jobs and boosting economic growth. The European Central Bank could create the €1.1 trillion that it intends to create, but transfer it to national governments (allocated proportionately to the population) to spend directly into the real economy. This “sovereign money” approach, as advocated by Positive Money, would mean that the ECB and EU could make the recovery much more sustainable, without the negative effects (on inequality and financial market bubbles) that QE has. Newly created sovereign money could directly fund government spending (i.e. infrastructure or renewable projects), tax reductions, or even direct payments to all citizens (of approximately €3,000 per Eurozone citizen!).

    • I'm not a big React developer, so maybe some of you can prove me wrong. Let me also state I'm not trying to start a religious debate here, React itself seems pretty damn slick. However, from what I've seen of it, there seems to be several major hurdles for producing realistically complex isomorphic applications in React:

      • asynchronous data - the React render flow requests async data in componentDidMount and then re-renders the component after the state is updated. Server side, this requires a pre-pass over the required components to fetch the data. This gets messy fast with nested components (how do you know what components to request data for if you don't render them?).

      • routing - Along the same lines, async data also completely breaks the flow of routing solutions like react-router, as that uses nested components. So do you end up writing routes both in express and the react-router, keeping them in sync manually?

      • client side "restart" - Server-rendered components won't have any event handlers attached, components won't be mounted for state changes, etc... so as I see it, basically the whole app has to re-start itself on the client side anyway. I haven't gotten this far with testing, any isomorphic apps in the wild who have found ways to deal with this? Problems that arise from it?

      • handling non-react component SEO - stuff like titles, meta fields, can't be updated by React components. These (at least titles anyway) are still fairly important to SEO. Most of the time they will need to be set based on some of that async data from above (blog post title, for example)- what's the isomorphic best practice here? Whatever templating language someone might use to render the document the React components will be put inside won't be useable for this client-side?


      All in all, despite the fact that React can be run isomorphically, I haven't seen enough evidence to suggest that it should. Every example app and blog post I've seen on isomorphic React seems to shrug and hand-wave over the difficulties, showing drastically oversimplified code snippets that leave out the meat of the code that has to juggle all these issues. It feels like trying to shove a square peg in a round hole.


      Am I missing something? Is anyone successfully running an isomorphic React app of reasonable complexity?

  • The problem with webapps that do this is that the code is downloaded from the server each time, so the JavaScript could be occasionally changed to pass the decryption key along to the server with the client likely being none the wiser. That same problem applies to native apps that have auto-updaters, albeit more weakly, but there really doesn't seem to be any real way to do this with webapps.

    • Unfortunately, Flask-Admin does not expose any AJAX endpoints, so it is not possible to create new models in Select2 fields.

      However, there's way to make it work:

      1. Exclude tags field from the admin form
      3. Contribute new Select2TagsField to the form with different name (so there's no name collision)
      5. Before displaying new/edit view, serialize list of tags as string array and contribute to the Select2TagsField
      7. Before submitting model (on_model_change) go over the list, do database lookups to find existing tags and create models for missing tags
      9. Contribute list of tag models to the model

      I can make gist if it is necessary.

  • up vote  2  down vote     accepted  

    I figured it out! Here is my solution. Hopefully this writeup will help out the next guy.


    The solution is to let extension do the work for you! Here is a working example the WT Forms sqlalchemy extension using Flask, WTForm, SQLAlchemy, and Jinja2. In short, you don't need to worry about the child id because the extension takes care of it automagically. that means when your dealing with SQLAlchemy Parent and Child models in a one to many relationship you ONLY have to deal with the PARENT.




    First, make sure your model and relationships are correct. Notice in my example how the relationships are defined and that the model's init only has CATEGORY... NOT CATEGORY_ID. My mistake was thinking I would have the populate my model's CATEGORY_ID field. Nope. The extension does it for you. In fact, if you try to do it manually like I did it won't work at all....

  • This is a very poor article. It starts with an outdated analysis of the decline of the Liberal Party. The theories of Dangerfield's book (published in 1935!) have been effectively challenged by modern historical research, most notably by Peter Clarke, Lancashire and the New Liberalism, first published in the early 1970s. Clarke showed that Liberalism had not died by 1914 but in late Victorian England had gone through a renaissance, abandoning the old laissez faire ideas and adopting a positive state progress approach, which helped bring about the landslide on 1906. Electoral pacts with Labour in the North west helped both parties. It was indeed the stresses of the First World War, the tensions between the pacifist wing and those who wanted the war prosecuted vigorously and the disastrous split between Asquithean and Lloyd George Liberals that resulted in the Liberal Party's demise. I suggest that Martin should read, The Strange Survival of Liberal England: Political Leaders, Moral Values and the Reception of Economic Debate,edited by: Duncan Tanner, Ewen Henry Harvey Green, published in 2006 before he makes ignorant comparisons of Edwardian politics with the modern Labour party.


    The analogy he tries to draw is so weak to be meaningless. He admits as much with his argument about women's suffrage, but even when he talks about the Labour movement he is writing over-simplified rubbish. While it is true that the old industrial working class has declined - the mines, the steel works, the mills, the shipyards etc., what people fail to recognise is that there is a new working class in retailing, in hospitality, in adult and child care and in call centres that is crying out for effective representation in parliament and in desperate need of effective Trade Unionism. The is the sector to which Jeremy Corbyn is appealing. The main cause of low pay and inequality is the weakening of Trade Unions and of course it is no accident. To call for the restoration of Trade Union rights and free collective bargaining is not looking to the past, it is the hope for the future for those who are stuck on low pay and in insecure jobs.

  • The Master suppression techniques is a framework articulated in 1945 by the Norwegian psychologist and philosopher Ingjald Nissen.[1] These techniques identified by Nissen are ways to indirectly suppress and humiliate opponents. In the late 1970s the framework was popularized by Norwegian social psychologist Berit Ås,[2] who reduced Nissen's original nine means to five, and claimed this was a technique mostly used in the workplace by men against women.[citation needed] Master suppression techniques are defined as strategies of social manipulation by which a dominant group maintains such a position in a (established or unexposed) hierarchy. They are very prominent in Scandinavian scholarly and public debate, where the expression is also used to refer to types of social manipulation not part of Ås's framework.[3] Master suppression techniques are sometimes called domination techniques.[4]

  • How not to confuse your users


    A useful pattern when dealing with exceptions is the bare raise.  Normally, raise is paired with an exception to be raised. However, if  it's used in exception handling code, raise has a slightly  different (but immensely useful) meaning.

    def calculate_value(self, foo, bar, baz):     try:         result = self._do_calculation(foo, bar, baz)     except:         self.user_screwups += 1          raise     return result 

    Here, we have a member function doing some calculation.  We want to keep some statistics on how often the function is misused and throws an exception, but we have no intention of actually handling the  exception. Ideally, we want to an exception raised in _do_calculation  to be flow back to the user code as normal. If we simply raised a new exception  from our except clause, the traceback point to our except clause and mask the real issue (not to mention confusing the user).  raise on its own, however, lets the exception propagate normally with its original traceback. In this way, we record the information we want and the user is able to see what actually caused the exception.

1 - 20 of 8561 Next › Last »
20 items/page

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo