StackOverflow.com

VN:F [1.9.22_1171]
Rating: 9.3/10 (9 votes cast)

Random snippets of all sorts of code, mixed with a selection of help and advice.

wampserver: can't play movie in webpage on the client

19 September 2020 @ 4:52 am

I have Wamp server and setup a Wordpress site that play movie in first page of it. Movies play normally on localhost, but can't play on clients. Please help me for this problem! Thanks!

How to override Django file input in forms.py?

19 September 2020 @ 4:52 am

I want to override the default input looking, I'm not looking to change an attribute, I'm searching for something more advance So here is a normal Django input file field with crispy_tag_forms <div id="div_id_image" class="form-group"> <label for="id_image">Image*</label> <div> Currently: <a href="/media/profile_images/DefaultUserImage.jpg">profile_images/DefaultUserImage.jpg</a><br> Change: <input type="file" name="image" accept="image/*" id="id_image"> </div </div> However this looks very ugly, so all of the time I completly hide it and write my own that looks something like this <div style="display:none"> ... <input type="file" id="id_image"> ... </div> <p class="btn btn-outline-success" onclick = "document.querySelecto

Calculate key for the cipher

19 September 2020 @ 4:51 am

Hi everyone i am working on a task where i have to find a key used to encrypt a text. def encrypt(plain_text, key): current = 0 encrypted = "" for x in plain_text: char = key[len(key) - key_pos - 1] new = chr((ord(x) + ord(char)) % 255) encrypted += new current = (current + 1) % len(key) return encrypted def decrypt(cipher_text, key): text_pos = 0 decrypted = "" for j in cipher_text: char = key[len(key) - key_pos - 1] new = chr((ord(x) - ord(char)) % 255) decrypted += new text_pos = (text_pos + 1) % len(key) return decrypted If i have to brute-force it from where should i start or if there is some other optimal solution. Thanks

Parse error due to incorrect indentation or mismatched brackets can't solve

19 September 2020 @ 4:51 am

So I am trying to create my own split function in Haskell and I keep getting a parse error but I can't figure out exactly why it is doing it split :: Eq a => a -> [a] -> [[a]] split _ [] = [] split x y = let test :: Eq a => a -> [a] -> [a] test x [] = [] test x (y:ys) | x == y = [] | otherwise = y : (test x ys)

Unity game code using GetInstance() there isn't any error in compiler but it is not working

19 September 2020 @ 4:51 am

using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ScoreKeeper : MonoBehaviour { public static ScoreKeeper instance; public static ScoreKeeper GetInstance() { if(instance == null) { instance = FindObjectOfType<ScoreKeeper>(); if(instance == null) { GameObject keeper = new GameObject("ScoreKeeper"); instance = keeper.AddComponent<ScoreKeeper>(); } } return instance; } public int cur_star; [SerializeField] Text star_text; void Start() { cur_star = 0; } void FixedUpdate() { UI_Update(); } void UI_Update() { star_text.text = "" + cur_star; } public void EarnStar(int star_amount) { cur_star += star_amount; } public void SubStar(int star_amount) { cur_s

Twitter share in iOS 13

19 September 2020 @ 4:50 am

I am searching for twitter share image and video in iOS 13. I tried this one but "SLServiceTypeTwitter" is deprecated in iOS 11. SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter]; [tweetSheet addImage:[UIImage imageNamed:@"twitter.png"]]; [tweetSheet setCompletionHandler:^(SLComposeViewControllerResult result) { }]; [self presentViewController:tweetSheet animated:YES completion:Nil]; Other way I find to share using API. https://developer.twitter.com/en/docs/twitter-api/v1/media/upload-media/api-reference/post-media-upload Which needs user authorization. Please suggest me which is the best way to share image and videos. or is there any way to just open twitter app with image and video share if app is insta

why my code gets "free(): double free detected in tcache 2"

19 September 2020 @ 4:49 am

this is my code, after running a test case https://ideone.com/42Ufwh if I erase this: delete nodes[i]; delete meu; delete ce; then the runtime disappears

Streaming Android Mic audio onto PC's Virtual MIC via Wifi LAN example : (WO MIC)

19 September 2020 @ 4:49 am

I want to create both Android app and a desktop application in which : I can send Realtime MIC data from android to PC app and then PC app can set that data into virtual mic so other apps can use it. I am having a problem how to build pc application that can do this kind of task, I have no experience with writing drivers for windows and what language can do this I don't know either. For demo i have built an android app that streams the audio data to java program from here Android AudioRecord to Server over UDP Playback Issues I want to build this while learning every detail of this process

Can TestCafe follow a sequence through multiple pages?

19 September 2020 @ 4:48 am

I am very new to TestCafe, (but excited by what I see) so this might be a dumb mistake. All the examples of TestCafe that I have found, depend on a single URL. However, I want to test a very familiar sequence: user makes some choices in page X and clicks submit, user is shown multiple matching records in page Y, and clicks something in one result, user sees a detail page Z, with full information for one record When I try this in TestCafe, my test terminates when control leaves X. It never sees Y. So, in the last lines of my test, after it submits page X await t .click(submitButton); .. if I look for values which should be in page Y, await t .expect(Selector('#back-to-home-page').innerText) .contains ('Back to Page X'); the Selector cannot find them. It only finds things still in page X. (I have testcafe v 6.14, but this is not version-specific). Tha

Mulitple group by and aggregation and combine output as one table

19 September 2020 @ 4:45 am

I have a table enter image description here I need output table with group by date and sum aggregation of volume flow with specified source and destination as columns as attached below. enter image description here