[Solved] Practice Linux Shell Scripting

Consider adding a counter, bump it up on every line, and print the counter with every line. Also note fixes to set log_file, update to read command. log_file=”/home/user/log.txt” line_no=0 while read -r line do line_no=$((line_no+1)) printf “%d. %s\n” $line_no “$line” done < “$log_file” One alternative to consider is to call the nl utility, which performs … Read more

[Solved] Upload an image from device to firebase

Well, I don’t know whats going on but, this works for me, Make sure your pods has at least these in there. PODFILE pod ‘Firebase/Storage’ pod ‘Firebase/Auth’ #Auth isn’t needed but, you should really use it. View controller import UIKit import FirebaseStorage class TestView: UIViewController { var imageView: UIImageView! override func viewDidLoad() { super.viewDidLoad() imageView … Read more

[Solved] Print the following 1 2 3 4 Bus 6 7 8 9 bUs 11 12 13 14 buS [closed]

Scanner sc=new Scanner(System.in); int n=sc.nextInt(); for(i=1; i<=n; i++) { if(i%3==2 && i%5==0) { System.out.println(“Bus”); } else if(i%3==1 && i%5==0) { System.out.println(“bUs”); } else if(i%3==0 && i%5==0) { System.out.println(“buS”); } else { System.out.println(i+” “); } } System.out.println does not mean it will not go through the next piece of code. You need either an else as … Read more

[Solved] GetObject(, “Word.Application”) Office 365

SOLVED ! Search in the registry for correct application name. On windows 7 you can find it in “HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\RegisteredApplicati‌​ons”. Then replace the new name in “Set wrd = GetObject(, “Word.Application”) Thanks to @pavanc It was called Word.Application.16 instead of Word.Application solved GetObject(, “Word.Application”) Office 365

[Solved] How to make if statement on product activation? [closed]

You can use the following code If(key is correct){ const messageBoxOptions = { type: “question”, title: “Enter valid key”, message: “License key is wrong” }; dialog.showMessageBox(messageBoxOptions) } else { const remote = require(‘electron’).remote; const BrowserWindow = remote.BrowserWindow; const win = new BrowserWindow({ height: 600, width: 800 }); win.loadURL(‘<url>’); } 1 solved How to make if … Read more

[Solved] multithreading in java

Update: Howard is right, my first example was wrong. I verified this works if you change your active() method: service = Executors.newScheduledThreadPool(50); new Thread() { public void run() { long nextTime = System.currentTimeMillis(); while (true) { service.submit(runnable); long waitTime = nextTime – System.currentTimeMillis(); Thread.sleep(Math.max(0, waitTime)); nextTime += 200; } } }.start(); 3 solved multithreading in … Read more

[Solved] How should IBuffer objects generated through Windows.Security.Cryptography be managed securely?

You can wipe out the buffer if you like after use, even with C#. Here is a handy helper: public static class BufferExtensions { public async static Task ClearContentsAsync(this IBuffer buff) { var writer = new DataWriter(buff.AsStream().AsOutputStream()); for (var i = 0; i < buff.Capacity; i++) writer.WriteByte(42); await writer.StoreAsync(); } } Use it like this: … Read more

[Solved] No exception in method call UIImage.LoadFromData(null) [closed]

You either have a global exception handler, or you are calling that from a background thread and not awaiting the call to the async method so your exception is being swallowed. Example, just doing this: public override void ViewDidLoad() { base.ViewDidLoad(); var x = UIImage.LoadFromData(null); } you will get a System.ArgumentNullException: Value cannot be null … Read more

[Solved] C Pointers to scan memory

That is not how modern operating systems work. You cannot simply read out the systems ram, because applications memory is virtualized and also the OS prohibits direct access due to security policies. The OS may offer some API to access other processes memory (assumed you have the rights to do). On Win32Api this is ReadProcessMemory. … Read more

[Solved] How can I get weather icon from Yahoo API JSON?

According the the Yahoo API over at https://developer.yahoo.com/weather/documentation.html#json-example, you don’t. You are supposed to use your own icons based on the text value inside forecasts. ex: { “forecasts”:[ { “day”:”Tue”, “date”:1546934400, “low”:52, “high”:61, “text”:”Rain”, // Take this value, and use your own image based on it. “code”:12 } ] } 4 solved How can I … Read more

[Solved] Remove “_100” or “_150” or “_num” alone from the end of string [duplicate]

Please check the following snippet: const s=”marks_old_100″; // remove any number console.log(s.replace(/_[0-9]+$/, ”)); // remove three digit number console.log(s.replace(/_[0-9]{3}$/, ”)); // remove _100, _150, _num console.log(s.replace(/_(100|150|num)$/, ”)); solved Remove “_100” or “_150” or “_num” alone from the end of string [duplicate]

[Solved] Query to sum from two different tables

i use this SELECT COALESCE(ORK2_RESULT.K1, ORK3_RESULT.K12) AS K1 , ORK2_RESULT.SUM_K11 AS SUM_K11 , ORK3_RESULT.SUM_K3 AS SUM_K3 FROM ( SELECT K1 AS K1, SUM(K11) AS SUM_K11 FROM ORK2 GROUP BY K1 ) AS ORK2_RESULT FULL OUTER JOIN ( SELECT K1 AS K12, SUM(K3) AS SUM_K3 FROM ORK3 GROUP BY K1 ) AS ORK3_RESULT ON ORK2_RESULT.K1 = … Read more