Quantcast
Channel: User luke - Stack Overflow
Browsing latest articles
Browse All 31 View Live
↧

Comment by luke on How can I optimise this C++?

When compiling under g++ -O3 this actually seems to be slower when running time ./reverse < in > /dev/null as it takes about 4.5 seconds.

View Article


Comment by luke on how to redirect with apache

does this work RedirectMatch /issues/([0-9]+) /dashboard/issues/$1

View Article

Comment by luke on How can I optimise this C++?

When attempting to compile your code I get: ` error: ‘ss’ was not declared in this scope.

View Article

Comment by luke on Python reading unicode file names

This seems to work fine in python for me. However i am running linux. This may be platform dependant (e.g. only affect windows). So i apologize as i can not help with this. However I would recommend...

View Article

Comment by luke on How can I optimise this C++?

WOW! 1.2 seconds. That's fast! I was unaware of std::strtok, but it certainly performs well for this. Thanks. Also, I thought my C++ and Python code did the same thing how exactly do they differ?

View Article


Comment by luke on Use php to post blogpost

Have you already written any PHP for the blog or is this totally from scratch (except for the static content) ?

View Article

Comment by luke on How to access remote Object

TestAgentData eded = new TestAgentData().getTad();

View Article

Comment by luke on Dump All Python Interpreter Errors into a Log?

Sorry, I thought as they were two different solutions they should be two different answers.

View Article


Comment by luke on Retrieving a string using REGEX in Python 2.7.2

@Floris yes this regex accepts all links, even ones with URL encoded queries, given their protocol is either http or https.

View Article


Comment by luke on Reading space delimited file in Python/Pandas with missing...

You say there is uneven spacing between columns but is there not always more space between values when one is missing then when one is not.

View Article

Comment by luke on "Free heap block modified after it was freed" when...

I know this is late but I would just like to add in case of any future viewers that snprintf is c99 and sprintf is specified in c90. Due to portability I was required to use c89 and hence did not use...

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

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 How to emulate a do-while loop?

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

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


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

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


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

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

This may work

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

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 Dump All Python Interpreter Errors into a Log?

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

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

"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

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


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

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 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 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



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

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
Browsing latest articles
Browse All 31 View Live




<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>