Quantcast
Channel: User luke - Stack Overflow
Browsing index pages (31 articles)
↧

MacOS `subprocess` raising: FileNotFoundError: /usr/sbin/sysctl [duplicate]

I've suddenly started getting an error on all versions of Python on MacOS reporting the following when using subprocess:FileNotFoundError: [Errno 2] No such file or directory: '/usr/sbin/sysctl -n...

View Article


React Component Style Encapsulation

I am trying to encapsulate styles for an embedded component. The component must prevent sites from easily overriding the styling without a script. The Shadow Dom was chosen to be used similar to Web...

View Article


Answer by luke for Java - Find shortest path between 2 points in a distance...

Like SplinterReality said: There's no reason not to use Dijkstra's algorithm here.The code below I nicked from here and modified it to solve the example in the question.import...

View Article

How can I optimise this C++?

I am trying to practice C++ by doing some old Google Code Jam problems. A relatively simple one I found is to reverse the words in a string. It can be found here...

View Article

Answer by luke for Python cross platform hidden file

You could do something like this:import osimport ctypesFILE_ATTRIBUTE_HIDDEN = 0x02def write_hidden(file_name, data):""" Cross platform hidden file writer.""" # For *nix add a '.' prefix. prefix = '.'...

View Article


How can I load a Python flask app into a gtk webview (Webkit)

I am currently working on an application that requires math expressions to be rendered (from latex) and needs to have some sort of native gui (even if it just uses gtk, then renders html in webkit).I...

View Article

Image may be NSFW.
Clik here to view.

Answer by luke for How can I load a Python flask app into a gtk webview (Webkit)

I've ended up finding a solution to this myself (but open to better ones).The first thing, loading a page, was pretty easy. Flask provides a way to test apps which mainly just sets up all the things...

View Article

"Free heap block modified after it was freed" when modifying string after malloc

I am currently working on a project that includes some file I/O.Due to it being cross platform I needed to account for different path separators and hence decided to create the following function to...

View Article


Answer by luke for Pipe an input to C++ cin from Bash

g++ main.cpp compiles it, the compiled program is then called 'a.out' (g++'s default output name). But why are you getting the output of the compiler?I think what you want to do is something like...

View Article


Answer by luke for Dump All Python Interpreter Errors into a Log?

Just redirect stderr.python script.py 2> /var/log/python.log

View Article

Is this login system secure

Is this login system secure ? if ($_POST[$submit]){$user = $_POST[$user];$pass = $_POST[$pass];if ($user && $pass){ //if user and pass is enterered require("vars.php"); //require MySQL...

View Article

Answer by luke for Why doesn't stopping animations and then starting a new...

I had this problem earlier today but with fadeTo not fadeIn. I just used this code$(news_controls).hover(function(){ $(this).stop().fadeTo("fast", 1);},function(){ $(this).stop().fadeTo("slow",...

View Article

Answer by luke for How can I add the facebook like button inside my...

This may work

View Article


Answer by luke for Should we be using (HTML5) rel attributes within site...

Good Question ! To be honest i'm no expert with the rel attribute (so someone correct me if i'm wrong) but from what i can find Google can verify an identity on a web page via the attribute. Such...

View Article

include unused full function or many includes

I am in the process of creating a PHP authorization framework which aims to be simple yet fast. My problem is being simple I hope to only have one include needed to use it , however when only having...

View Article


stop php adding new line

i am trying to add the posts from my word press blog to a javascript array however it keeps adding a new line and causing errors in the javascript. here is the code<?php $num = 0 ;...

View Article

php function returning 0?

ok, so i am creating a php login system and wanted a simple way to get the link to the logout page by calling a function but it keeps returning 0. He's my function:function logout_link()...

View Article


Comment by luke on How to emulate a do-while loop?

A better solution would be: do = True; while do: ; something(); if (do := condition()): complain();

View Article

Comment by luke on Haskell abbreviating multiple parameters to a single variable

That's what I was thinking. I didn't make the design decision for f but have to work with it. Was just hoping there was a way to select all the arguments like in other languages or formulate a function...

View Article

Comment by luke on Launching flask server from __main__.py

But if I add the parent dir to sys.path in __main__.py it works. Surely meaning it's not a circular import issue

View Article
Browsing index pages (31 articles)


Latest Images