Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
59,123,830
How can i scrape member emails from a private group on facebook without being added to the group
I want to scrape emails of the members of a particular group on facebook but I can't see them (the group is private) because I am not a member of the group and I would not accepted anytime soon.
<facebook><web><web-scraping>
2019-12-01 08:26:27
LQ_EDIT
59,124,470
how to write comlpete dictionary in existing csv file in loop using python
I want to write the dictionary in existing CSV in the new column within the loop. My sample code : `for loop: keys = [] values = [] dictionary = {}` for loop: dictionary = dict(zip(keys,values) ####**write code for inserting dictionary in csv file in first loop.** My dictionary data is {'string':value, 'string':value} My desired CSV data should be : Count {'string':value, 'string':value}
<python><pandas><csv><dictionary>
2019-12-01 10:02:29
LQ_EDIT
59,124,611
Unwrap a list of list
<p>I have this list:</p> <pre><code>fxrate = [[['9.6587'], ['9.9742'], ['9.9203'], ['10.1165'], ['10.1087']], [['10.7391'], ['10.8951'], ['11.1355'], ['11.561'], ['11.7873']], [['8.61'], ['8.9648'], ['9.0155'], ['9.153'], ['9.1475']]] </code></pre> <p>I would like to make a list like this by using Python:</p> <pre><code>[[9.6587, 9.9742, 9.9203, 10.1165, 10.1087], [10.7391, 10.8951, 11.1355, 11.561, 11.7873], [8.61, 8.9648, 9.0155, 9.153, 9.1475]] </code></pre> <p>Needless to say I'm fairly new to Python and programming in general. However all I end up with is either one list of values but not at three sets of lists</p>
<python><parsing><list-comprehension>
2019-12-01 10:22:59
LQ_CLOSE
59,125,594
Am working on a site using django framework and i got this AttributeError telling me 'str' object has no attribute 'get'
<p>`AttributeError at /polls/ </p> <p>'str' object has no attribute 'get' </p> <p>Request Method: GET</p> <p>Request URL: <a href="http://127.0.0.1:8000/polls/" rel="nofollow noreferrer">http://127.0.0.1:8000/polls/</a></p> <p>Django Version: 2.0.2</p> <p>Exception Type: AttributeError</p> <p>Exception Value: 'str' object has no attribute 'get'</p> <p>Exception Location: C:\Python34\lib\site-packages\django-2.0.2-py3.4.egg\django\middleware\clickjacking.py in process_response, line 26</p> <p>Python Executable: C:\Python34\python.exe</p> <p>Python Version: 3.4.1</p> <p>Python Path: ['C:\Users\WUESE PHILIP\Desktop\vibezt',</p> <p>'C:\Python34\python34.zip',</p> <p>'C:\Python34\DLLs',</p> <p>'C:\Python34\lib',</p> <p>'C:\Python34',</p> <p>'C:\Python34\lib\site-packages',</p> <p>'C:\Python34\lib\site-packages\setuptools-33.1.1-py3.4.egg',</p> <p>'C:\Python34\lib\site-packages\django-2.0.2-py3.4.egg',</p> <p>'C:\Python34\lib\site-packages\pytz-2019.3-py3.4.egg']`</p> <p><code>polls urls.py</code></p> <p><code>from django.urls import path</code></p> <p><code>from . import views</code></p> <p>`urlpatterns = [</p> <p>path('', views.index, name='index'),</p> <p>]`</p> <p><code>views.py</code></p> <p><code>from django.shortcuts import render</code></p> <p>`from django.http import HttpResponse</p> <p>def index(request):</p> <pre><code>return("&lt;h2&gt;Welcome to my First Python Django Project&lt;/h2&gt;")` </code></pre> <p><code>vibezt urls.py</code></p> <p>`from django.contrib import admin</p> <p>from django.urls import include, path`</p> <p>`urlpatterns = [</p> <p>path('polls/', include('polls.urls')),</p> <p>path('admin/', admin.site.urls),</p> <p>]`</p>
<python><django>
2019-12-01 12:41:34
LQ_CLOSE
59,125,782
When I define a function of reverse. It not only reverses the digits but it prints it thrice. How can I get only one reversed answered?
''' def reverse_int(): num=(input("Enter a 3-digit number: ")) for number in num: print (num[::-1]) reverse_int() '''
<python><function><loops><for-loop><user-input>
2019-12-01 13:04:19
LQ_EDIT
59,126,043
Flask-SQLAlchemy import error. "Imported but unused"
<p>I used sqlacodegen to extract the a .py file containing classes of my db tables. I am using pythonanywhere. However for all the imports it is showing that "imported but unused".</p> <p>You can see though column has been used, it shows the sqlalchemy.Column imported but unused.</p> <p>Am I doing anything wrong here?<a href="https://i.stack.imgur.com/ow4H0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ow4H0.png" alt="Imported but unused"></a></p>
<sqlalchemy><flask-sqlalchemy><python-import><pythonanywhere><sqlacodegen>
2019-12-01 13:37:13
LQ_CLOSE
59,128,625
Create own widget in C# and add to Table
<p>I learning to create android app in C# (VisualStudio) and I need create table with my own widget. I upload data for my server SQL. Any idea how can I do this?</p> <p><a href="https://i.stack.imgur.com/3290t.png" rel="nofollow noreferrer">Presentation</a></p>
<c#><android><xamarin>
2019-12-01 18:28:01
LQ_CLOSE
59,128,749
How would I go about having a chat update after loading?
<p>I've tried searching on here for a bit to try and find someone with a similar question. I haven't quite yet gotten into implementing the actual retrieval and insertion into the database for the chat messages but I would like to know ahead of time what I'll need to do. You see, on several websites there is updates done to the page after its already been loaded, such as with chat rooms where you're actively given new messages after the page has already loaded. I'm really just posting this as a quick question to see whether this is done through forcing all clients to reload when a new message is posted or what. I would also like to know, if this is done a different way, what language relates to it so I can learn it ahead of time. Thank you.</p>
<javascript><php><html>
2019-12-01 18:44:27
LQ_CLOSE
59,129,200
python core programming concepts for beginers
alphabet = 'abcdefghijklmnopqrstuvwxyz' orig_list = [ "bat", "act", "cat", "rat", "abs" ] for i in alphabet: for j in orig_list: for l in j: print(l) I very new to programming and am currently struggling with this concept. So in this example, I am using a for loop and having j iterate through the org_list and then in the next line I am having l iterate through j so I get the alphabets but my output on the shell prints out all the alphabets in j but it repeats itself. I am providing the output below. Kindly let me know what I am doing wrong. Cheers! b a t a c t c a t r a t a b s b a t a c t c a t r a t a b s ..... and continues for many more lines
<python>
2019-12-01 19:34:22
LQ_EDIT
59,132,278
Please help insertion sort java
int size, i, j, temp; int arr[] = new int[50]; Scanner scan1 = new Scanner(System.in); System.out.print("Enter Array Size : "); size = scan1.nextInt(); System.out.print("Enter Array Elements : "); for(i=0; i<size; i++) { arr[i] = scan1.nextInt(); } System.out.print("Sorting Array using Insertion Sort Technique..\n"); for(i=1; i<size; i++) { temp = arr[i]; j = i - 1; while((temp < arr[j]) && (j >= 0)) { arr[j+1] = arr[j]; j = j - 1; } arr[j+1] = temp; } System.out.print("Array after Sorting is : \n"); for(i=0; i<size; i++) { System.out.print(arr[i] + " "); } } **When i run this an error is displayed Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 50 at ProgramFinals.main(ProgramFinals.java:72)** please help
<java>
2019-12-02 03:25:18
LQ_EDIT
59,133,517
When i want to install the MySQL i faced this issue "root account password" i forgot it
[This is when installation of MySQL and its request the root password but i forgot the password][1] [1]: https://i.stack.imgur.com/GQl2E.png
<mysql>
2019-12-02 06:14:30
LQ_EDIT
59,135,068
two and digit output not working in even/odd filter in python
{ def even_odd_filter(oe): odd_list = [] even_list = [] total = [] for i in oe: i = int(i) if i % 2 == 0: even_list.extend(str(i)) else: odd_list.extend(str(i)) total.append(even_list) total.append(odd_list) total = [even_list, odd_list] print("Even list : ", even_list) print("Odd list : ", odd_list) return total userinput = input("Enter number by comma : ").split(",") print(even_odd_filter(userinput)) }
<python>
2019-12-02 08:29:18
LQ_EDIT
59,135,718
Portfolio gallery without "all" filter
<p>I'm currently working on a portfolio gallery, I found one on w3schools: <br><br><a href="https://www.w3schools.com/howto/howto_js_portfolio_filter.asp" rel="nofollow noreferrer">https://www.w3schools.com/howto/howto_js_portfolio_filter.asp</a></p> <p>My only question is, is it possible to remove the "show all" filter and just have it selected on another filter by default?</p>
<javascript><html><css>
2019-12-02 09:15:06
LQ_CLOSE
59,137,740
Font-Awesome 5 - CSS Pseudo-elements, how to mirror/rotate icon
<p>I am using css pseudo elements to render icons (<a href="http://jsfiddle.net/4Rakx/4633/" rel="nofollow noreferrer">jsfiddle</a>)</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>body { font-family: Arial; font-size: 13px; } a { text-decoration: none; color: #515151; } a:before { font-family: "Font Awesome 5 Free"; content: "\f07a"; display: inline-block; padding-right: 3px; vertical-align: middle; font-weight:900; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;link href="https://use.fontawesome.com/releases/v5.4.1/css/all.css" rel="stylesheet"/&gt; &lt;a href="#"&gt;This is a link&lt;/a&gt;</code></pre> </div> </div> </p> <p>Is there a way to rotate or mirror a icon?</p>
<css><font-awesome><font-awesome-5>
2019-12-02 11:12:47
LQ_CLOSE
59,139,456
Why am I needing to replace List.of() with Arrays.asList()?
<p>I've read <a href="https://stackoverflow.com/questions/46579074/what-is-the-difference-between-list-of-and-arrays-aslist">What is the difference between List.of and Arrays.asList?</a></p> <p>What I'm not getting is why, after some dependency upgrades in my Maven pom.xml, suddenly all my</p> <pre><code>List.of(FLIGHT1_SPEND_AGG, FLIGHT1_IMPRESSIONS_AGG) </code></pre> <p>no longer compile. When I type <code>List.</code> in IntelliJ, autocomplete only comes up with the <code>class</code> member. I thought maybe I'm not importing <code>java.util.List</code>? So explicitly specified it, but still:</p> <p><a href="https://i.stack.imgur.com/OLN0w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OLN0w.png" alt="enter image description here"></a></p> <p>I'm using Java 11, and I see the method exists here: <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html" rel="nofollow noreferrer">https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html</a>.</p> <p>Why can't I seem to use it? I must be doing something stupid...</p>
<java><arrays><dependencies><package><java-11>
2019-12-02 13:01:01
LQ_CLOSE
59,141,102
How do I make a user input of a picture with javascript?
<p>I have been working on my website and cant for the love of god find a way to actualy do this. I tried with but i cant get the picture to upload to my site. I dont know how to acess the information thats in the input. Is it even possible?</p>
<javascript>
2019-12-02 14:34:27
LQ_CLOSE
59,141,416
Why using the symbol "$" in Angular
<p><a href="https://i.stack.imgur.com/p7705.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p7705.png" alt="enter image description here"></a></p> <p>Based on the picture with the white selection.</p> <p>I don't understand why you need to use the symbol "$". (<a href="https://www.twilio.com/blog/prevent-memory-leaks-angular-observable-ngondestroy" rel="nofollow noreferrer">https://www.twilio.com/blog/prevent-memory-leaks-angular-observable-ngondestroy</a>)</p> <p>What is the purpose to use a symbol "$"? What benefit is it to use it?</p> <p>Thank you!</p>
<angular><visual-studio-code>
2019-12-02 14:53:56
LQ_CLOSE
59,141,771
How to add multi users feature to a Delphi app?
<p>Am currently developing a Delphi app for desktop (Data Base: Access) that needs the multi users feature (each user will have his Permissions, history of transactions). </p> <p><strong>How can i do that ?</strong> </p> <p>I found <a href="http://sforsuresh.in/implemention-of-user-permission-with-php-mysql-bitwise-operators/" rel="nofollow noreferrer">this article</a>, they used MySQL and am not familiar with it, explaining the same method in Access will be appreciated. </p>
<database><delphi><ms-access><multi-user>
2019-12-02 15:13:20
LQ_CLOSE
59,146,450
get codebar from image in python
I need to get the information in this barcode with the python pyzbar library, but it does not recognize it, should I make any improvement before using pyzbar? [BarCode][1] [1]: https://i.stack.imgur.com/D8Jk7.jpg
<python><image><opencv><noise-reduction>
2019-12-02 20:49:16
LQ_EDIT
59,146,473
Error on dump or dd laravel adding a character before result
<p>All request and dumps in laravel add a ^before a result, that's only do that in dd or dump</p> <p><a href="https://i.stack.imgur.com/Apq0X.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Apq0X.png" alt="exemple of error"></a></p> <p><a href="https://i.stack.imgur.com/1f26t.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1f26t.png" alt="exemple dd Request:all()"></a></p> <p>This effect generate a lot of errors on my code, someone past some like that?</p>
<php><laravel><laravel-5>
2019-12-02 20:50:46
HQ
59,146,491
Emergency - I just reset --hard to my initial commit, is there a way to get my previous commits back, or is the whole project lost?
<p>I haven't pushed to a remote repo yet. I am just so used to being able to pull from one that I didn't even think that there may not be a way to go back.</p>
<git>
2019-12-02 20:52:36
LQ_CLOSE
59,146,517
How can omit a column that comparing two columns attributes of two different csv files?
Hej stack overflow coders I am looking for a solution for this case: expecting a solution from coders of python, Mysql and MongoDB. Case :To extend a column (col_F) in file2 values comparing file 1 and file, by line to line and column to column !! - We have one relationship between two files(file1 and file2), which is col_A Final results_ extended **file2** with **col_F** col_A col_B col_C col_D **col_F** A1 B C D **F1** A2 B C D **F2** A5 B C D **F5** AZ B C D **FZ** AX B C D **FX** A# B C D **F#** A2 B C D **F2** **File1** col_A **col_F** A1 **F1** A2 **F2** A5 **F5** AZ **FZ** AX **FX** A# **F#** A2 **F2** **File2** before extension col_A col_B col_C col_D A1 B C D A2 B C D A5 B C D AZ B C D AX B C D A# B C D A2 B C D
<mysql><python-3.x><better-sqlite3>
2019-12-02 20:55:12
LQ_EDIT
59,146,632
Why can't I open a tab with a html-button while being on the chrome web store?
<p>I have got a page in my frontend with different buttons, all buttons, on their own, work perfectly, but if I click the button that opens an extension in the chrome web store and click on another button afterwards, the page doesn't open.</p> <p>Here is an exmaple of what I am talking about. If you click the buttons without closing the tabs that are opening, the button you click after the chrome web store opens won't have an effect. Does anybody know why that is and how to work around that?</p> <p><a href="https://html-ichr7r.stackblitz.io" rel="noreferrer">https://html-ichr7r.stackblitz.io</a></p> <p>Here is the code for it.</p> <pre><code>&lt;button id="button1" onclick="window.open('https://www.facebook.com/','popup','width=700,height=300');"&gt;&lt;strong&gt;CONTINUAR&lt;/strong&gt;&lt;/button&gt;&lt;br&gt; &lt;button id="button2" onclick="window.open('https://www.google.com/','popup','width=700,height=300');"&gt;&lt;strong&gt;CONTINUAR&lt;/strong&gt;&lt;/button&gt; &lt;button id="button3" onclick="window.open('https://chrome.google.com/webstore/detail/dark-mode/dmghijelimhndkbmpgbldicpogfkceaj?hl=de','popup','width=700,height=300');"&gt;&lt;strong&gt;CONTINUAR&lt;/strong&gt;&lt;/button&gt;&lt;br&gt; &lt;button id="button4" onclick="window.open('https://www.9gag.com/','popup','width=700,height=300');"&gt;&lt;strong&gt;CONTINUAR&lt;/strong&gt;&lt;/button&gt; </code></pre> <p>Any help is appreciated!</p> <p><strong>EDIT</strong>: I just figured out that it works in firefox, still don't know why it doesn't work in Chrome though.</p>
<javascript><html><google-chrome>
2019-12-02 21:02:58
HQ
59,146,790
Java Unable to add a new list item
<p>I am generating a list from the Registery using the code below.</p> <pre><code> List&lt;String&gt; options = Arrays.asList(Advapi32Util.registryGetStringArray(HKEY_LOCAL_MACHINE, key, value) </code></pre> <p>Later on in the code I want to add to this list However the add method is not working.</p> <p>The following code below give me an java.lang.unsupportedOperationException.</p> <pre><code> options.add("Test"); Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException at java.util.AbstractList.add(AbstractList.java:148) at java.util.AbstractList.add(AbstractList.java:108) </code></pre> <p>Any ideas.</p>
<java><list>
2019-12-02 21:17:18
LQ_CLOSE
59,146,854
React: Parsing error in my functional component
<p>I installed babel-eslint and added <code>"parser": "babel-eslint"</code> but I'm still getting parsing error.</p> <p>My package.json is:</p> <pre><code>{ "name": "listassign", "version": "0.1.0", "private": true, "dependencies": { "bootstrap": "^4.4.1", "react": "^16.12.0", "react-dom": "^16.12.0", "react-scripts": "3.2.0" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "parser": "babel-eslint", "extends": "react-app" }, "browserslist": { "production": [ "&gt;0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "devDependencies": { "babel-eslint": "^10.0.3" }, "extends": [ "standard", "standard-react" ] } </code></pre> <p>I'm getting error in file:</p> <pre class="lang-js prettyprint-override"><code>function CharComponent(props){ let displayList = []; function delete(e){ let index = e.target.id; displayList.slice(index,1); } </code></pre> <p>Error is:<code>Parsing error: Unexpected keyword 'delete'</code></p> <p>I did <a href="https://stackoverflow.com/a/44626825/10390678">this</a> but no help.</p>
<javascript><reactjs>
2019-12-02 21:22:02
LQ_CLOSE
59,147,032
Why does my while loop never end in my number guess game in C++?
<p>I am very new to programming and i am just messing around to try getting this guess a number game working, why once you guess the correct number or run of of lives does it continue? Thanks!</p> <pre><code> int rand_number{5}; int guess_number{}; int try_number{}; int player_lifes{5}; bool game_over{ false }; cout &lt;&lt; "Enter a number between 1-10" &lt;&lt; endl; while (player_lifes &gt; 0 || game_over == true) { cout &lt;&lt; "You have " &lt;&lt; player_lifes &lt;&lt; ((player_lifes == 1)? " live left." : " lifes left.") &lt;&lt; endl; cout &lt;&lt; "Your guess is: "; cin &gt;&gt; guess_number; cout &lt;&lt; endl; if (guess_number == rand_number) { int final_lifes = (5 - player_lifes) + 1; cout &lt;&lt; "well done you solved it in " &lt;&lt; final_lifes &lt;&lt; (( final_lifes == 1)? " try." : " tries.") &lt;&lt; endl &lt;&lt; endl; game_over = true; } else { player_lifes--; cout &lt;&lt; "wrong try again" &lt;&lt; endl; } } cout &lt;&lt; "Finished"; </code></pre>
<c++><game-development>
2019-12-02 21:38:17
LQ_CLOSE
59,148,320
Non-invocable member 'Http SessionState.Timeout' cannot be used like a method
<pre><code> protected void Button1_Click(object sender, EventArgs e) { Session["Email"] = "sssaundatti@gmail.com"; Session.Timeout("200"); </code></pre> <blockquote> <p>Non-invocable member 'Http SessionState.Timeout' cannot be used like a method</p> </blockquote> <pre><code> } </code></pre> <blockquote> <p>How to solve this problem?</p> </blockquote> <pre><code> protected void Button2_Click(object sender, EventArgs e) { if (Session["Email"] !=null) { Email.Text = Session["Email"].ToString; } else { Email.Text = "Please Set Session"; } } </code></pre>
<c#>
2019-12-02 23:49:24
LQ_CLOSE
59,148,730
JAVA - Create object from generic class
I want to create objects from different classes extending the same class. Can you explain how it will work. Examples would be nice. Thank you. class MainClass{ private <T extends DataPoint> void someMethod(Class<T> clazz) { new clazz();//<-- create object of class (did not work) } private void anotherClass(){ someMethod(GreenDataPoint.class); someMethod(BlueDataPoint.class); } } class DataPoint {...} class BlueDataPoint extends DataPoint {...} class GreenDataPoint extends DataPoint {...}
<java><class>
2019-12-03 00:51:40
LQ_EDIT
59,149,866
How can I update a dataclass in place?
<p>Given two instances of the same dataclass, how can I update the first one in-place with values from the second one?</p> <p>i.e.</p> <pre class="lang-py prettyprint-override"><code>@dataclass class Foo: a: str b: int f1 = Foo("foo", 1) f2 = Foo("bar", 2) # Update in place, so that f1.a == f2.a, f1.b == f2.b and so on </code></pre> <p>Note: I do not want to simply set <code>f1 = f2</code>; I want to update <code>f1</code> in place.</p>
<python><python-dataclasses>
2019-12-03 03:40:03
LQ_CLOSE
59,149,877
Visual Studio Code PHP Intelephense Keep Showing Not Necessary Error
<p>After the latest update of PHP Intelephense that I get today, the intelephense keep showing an error for an undefined symbol for my route (and other class too), there is no error like this before and it's bothering me.</p> <p>Here is the error screenshot :</p> <p><a href="https://i.stack.imgur.com/DQ8AW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DQ8AW.png" alt="enter image description here"></a></p> <p>And this is my code :</p> <pre><code>Route::group(['prefix' =&gt; 'user', 'namespace' =&gt; 'Membership', 'name' =&gt; 'user.'], function () { Route::get('profile', 'ProfileController@show')-&gt;name('profile.show'); Route::patch('profile', 'ProfileController@update')-&gt;name('profile.update'); Route::patch('change-password', 'ChangePasswordController@change')-&gt;name('change-password'); Route::get('role', 'ProfileController@getRole')-&gt;name('profile.role'); Route::get('summary', 'SummaryController@show')-&gt;name('summary'); Route::get('reserved', 'AuctionController@reservedAuction')-&gt;name('reserved'); }); </code></pre> <p>Actually there's no error in this code but the intelephense keeps showing an error so is there a way to fix this?</p>
<php><laravel><visual-studio-code>
2019-12-03 03:42:02
HQ
59,150,967
Sorted() in lambda's not working as intended - Java 8
<p>While learning lambda's, I found sorted method is not working as intended.</p> <p>The following program is giving <code>[1, 33, 2, 4, 5, 11]</code> as an output, however I am expecting a sorted output.</p> <p>Strange thing is when I replace the <code>[33, 2, 1, 4, 5, 11]</code> with <code>[ 3, 1,2, 4, 5]</code> every thing works fine and I got the sorted output as expected.</p> <pre><code>public class Test { public static void main(String[] args) { List&lt;Integer&gt; list = Arrays.asList(33, 2, 1, 4, 5, 11); Set&lt;Integer&gt; set = list.stream().sorted().collect(Collectors.toSet()); System.out.println(set); } } </code></pre> <p>Please help me understand this behavior.</p>
<java><sorting><lambda><java-8>
2019-12-03 05:56:30
LQ_CLOSE
59,151,771
Importing pb.go file in a golang project?
How can i import my generated `pb.go` file so I can call the methods in them? I visited all the examples for go and they all seem to import with `github.com/...` **Example.go** ``` import ( "github.com/go-chi/chi" chiMiddleware "github.com/go-chi/chi/middleware" "google.golang.org/grpc" "net/http" "github.com/easyCZ/grpc-web-hacker-news/server/hackernews" hackernews_pb "github.com/easyCZ/grpc-web-hacker-news/server/proto" // Proto directory. "google.golang.org/grpc/grpclog" "github.com/improbable-eng/grpc-web/go/grpcweb" "github.com/go-chi/cors" "github.com/easyCZ/grpc-web-hacker-news/server/proxy" "github.com/easyCZ/grpc-web-hacker-news/server/middleware" ) func main() { grpcServer := grpc.NewServer() hackernewsService := hackernews.NewHackerNewsService(nil) hackernews_pb.RegisterHackerNewsServiceServer(grpcServer, hackernewsService) ... ``` **Directory Structure** ``` 📦athena-server ┣ 📂proto ┃ ┣ 📜athena.pb.go ┃ ┗ 📜athena.proto ┣ 📂server ┃ ┗ 📜server.go ┣ 📜.DS_Store ┣ 📜docker-compose.yml ┣ 📜generated.go ┣ 📜go.mod ┣ 📜go.sum ┣ 📜google_service.json ┣ 📜gqlgen.yml ┣ 📜models_gen.go ┣ 📜resolver.go ┣ 📜schema.graphql ┗ 📜todo.go ``` **Main.go** ``` import ( "bytes" "flag" "fmt" "log" "net/http" "os" "google.golang.org/grpc" "google.golang.org/grpc/grpclog" "github.com/improbable-eng/grpc-web/go/grpcweb" auth "../proto" // Proto directory but doesn't work. ) ... ``` **Error** ``` cannot find module for path _/Users/xxx/go/src/athena-server/proto ``` I tried all sort both absolute and relative path as well as shifting files around but nothing seems to work.
<go><protocol-buffers>
2019-12-03 07:05:43
LQ_EDIT
59,152,169
integer expected got float(how to fix this issue )
i am facing this problem in the code below. i couldn't understand how to fix it please give me a solution as am a beginner and don't know how to fix it i can just analyze where it arises w = curses.newwin(sh, sw, 0, 0) w.keypad(1) w.timeout(100) snk_x = sw/4 snk_y = sh/2 snake = [ [snk_y,snk_x], [snk_y,snk_x-1], [snk_y,snk_x-2] ] food = [sh/2,sw/2] w.addch(food[0], food[1],curses.ACS_PI)#here in this line i get error
<python><typeerror>
2019-12-03 07:35:08
LQ_EDIT
59,152,224
Sub-string splitting with php
<p>I have a string 33#math#indonesia#Primary 2, and want to be separated into like this 33,math,indonesia,primary 2 into four parts <a href="https://i.stack.imgur.com/p3WrU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p3WrU.png" alt="enter image description here"></a></p>
<php><string><split>
2019-12-03 07:39:14
LQ_CLOSE
59,152,384
Java scripts working locally but not on webserver. (Uncaught ReferenceError: jQuery is not defined)
I have a problem for which I have been searching the net for hours, but I can't find the solution. I wrote a webpage with JQuery included. It runs file locally (as a file), but on the webserver, it keeps giving me an error: 'Uncaught ReferenceError: jQuery is not defined'. When I debug the html when loaded in chrome locally I can see the content of the referenced .js files. However when I debug the same files when the page runs on the webserver I can see the .js files in the debugger, but they appear all empty, ergo no content. The paths to the files is correct as the debugger gives no errors on the files not found. Please, help??? Here is my code: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <?xml version="1.0" encoding="UTF-8"?> <html><head> <link rel="stylesheet" type="text/css" href="web.css"/> <link rel="stylesheet" type="text/css" href="jquery/jquery.treetable.css"/> <link rel="stylesheet" type="text/css" href="jquery/jquery.treetable.theme.default.css"/> <link rel="stylesheet" type="text/css" href="jquery/jquery-ui.css"/> </head> <body> <Template>HEADER</Template> <table id="statustable"><tr><th><div><span>Type</span></div></th><th><div><span>Nummer</span></div></th><th><div><span>Beschrijving</span></div></th><th><div><span>Status</span></div></th><th><div><span>SubStatus</span></div></th><th><div><span>Prod. soort</span></div></th><th><div><span>Plaat Best.</span></div></th><th><div><span>Rail spuiter</span></div></th><th><div><span>Hout</span></div></th><th><div><span>Aluminium</span></div></th><th><div><span>Staal</span></div></th><th><div><span>Rubberen</span></div></th><th><div><span>Assemblage</span></div></th><th><div><span>Werknemer</span></div></th></tr><tr data-tt-id="1"><td style="background-color:lightblue;">Project</td><td>BV19073</td><td>Engel</td><td>Order</td><td>Gereed</td></tr><tr data-tt-id="1.1" data-tt-parent-id="1"><td style="background-color:lightblue;">Order</td><td>1900198</td><td>Engel</td><td>Order</td><td>Productie_gereed</td><td style="background-color:green;">PRODUCTIE</td><td style="background-color:green;">Gereed</td><td style="background-color:Red;">Geen</td></tr><tr data-tt-id="1.1.1" data-tt-parent-id="1.1"><td style="background-color:lightblue;">Samenstelling</td><td>01.</td><td>Wand A P90 46/47 dB</td><td>Gereed</td></tr><tr data-tt-id="1.1.1.1" data-tt-parent-id="1.1.1"><td style="background-color:lightblue;">Onderdeel</td><td>01.01.</td><td>Wall Stanchion Telescopic (WST)</td><td>Gereed</td></tr><tr data-tt-id="1.1.1.2" data-tt-parent-id="1.1.1"><td style="background-color:lightblue;">Onderdeel</td><td>01.02.</td><td>Wall Stanchion Standard (WSS)</td><td>Gereed</td></tr><tr data-tt-id="1.1.1.3" data-tt-parent-id="1.1.1"><td style="background-color:lightblue;">Onderdeel</td><td>01.03.</td><td>Standard Panel (SP)</td><td>Gereed</td></tr><tr data-tt-id="1.1.1.4" data-tt-parent-id="1.1.1"><td style="background-color:lightblue;">Onderdeel</td><td>01.04.</td><td>Telescopic Panel (TP)</td><td>Gereed</td></tr><tr data-tt-id="1.1.1.5" data-tt-parent-id="1.1.1"><td style="background-color:lightblue;">Onderdeel</td><td>01.05.</td><td>extra platen ivm min. best.</td><td>Gereed</td></tr><tr data-tt-id="1.1.1.6" data-tt-parent-id="1.1.1"><td style="background-color:lightblue;">Onderdeel</td><td>01.06.</td><td>Uren per wand.</td><td>Gereed</td></tr></table><table id="formtable"><tr><td><button type="button" onclick="window.location.href='##BASEURL##/list/orderpost'">Vernieuwen</button></td></tr></table><Template>FOOTER</Template> <script src="jquery/external/jquery/jquery.js"></script> <script src="jquery/jquery-ui.js"></script> <script src="jquery/jquery.treetable.js"></script> <script src="jquery/test.js"></script> <script>(function($){$("#statustable").treetable({ expandable: true })})(jQuery);</script> </body> </html> <!-- end snippet -->
<javascript><jquery>
2019-12-03 07:50:20
LQ_EDIT
59,153,979
Social Media Icons disappeared on my Online Website while they appeared on my offline website
<p>Social Media Icons disappeared on my Online Website while they appeared on my offline website:</p> <p><a href="https://i.stack.imgur.com/PU3l7.png" rel="nofollow noreferrer">Icons appear in yellow circles in my Offline Website</a></p> <p><a href="https://i.stack.imgur.com/SbSRk.png" rel="nofollow noreferrer">Icons disappear in yellow circles in my Online Website</a></p>
<css><font-awesome><offline-browsing>
2019-12-03 09:32:51
LQ_CLOSE
59,155,518
How do you hide deprecated warnings in vscode for c++?
<p>I'm using commands such as printf() and scanf() a lot, and its really annoynig to declare in each new program that i want to make.</p> <p>Is there an easy way to just go into the settings, like in the linter or something, and tell vscode to just eat my shorts instead of bugging me with these warnings?</p>
<c++><visual-studio-code><printf><warnings><deprecated>
2019-12-03 10:57:30
LQ_CLOSE
59,156,203
How to handle and get values from dynamic tags from xml file in VBA macro
I have an xml file with 3 levels. Some of the tags are dynamic.*(Please check below xml file)* I have to validate whether the tag "price" is present in all nodes or not and also need to get value of "price tag". I also need to fetch a value of every node present in xml file. **My final outcome should be like below excel file :** [Excel sheet output][1] **Test XML file attached below:** [XML File with dynamic tags][2] Please assist me here. [1]: https://i.stack.imgur.com/ZtCUc.png [2]: https://i.stack.imgur.com/2mCr6.png
<excel><xml><vba>
2019-12-03 11:35:45
LQ_EDIT
59,156,546
How do you create an Android View Pager with dot Indicator with Number?
Probably many of you Also Me have problem with creating ViewPager with bottom dots With Number, like this: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/832wV.png How do you create such an Android ViewPager With Dot and Number?
<android><android-viewpager><viewpagerindicator>
2019-12-03 11:55:08
LQ_EDIT
59,158,700
How to Move Button Text?
<p>Button text by default is centered horizontally and centered vertically. How do you vertically align the button text to the top? </p> <p>I've inspected the element and it has 0 padding. </p> <p>vertical-align: text-top; does not work.</p>
<html><css>
2019-12-03 13:54:30
LQ_CLOSE
59,159,063
Unable to insert a row into my Bug_Project table
<p>I am writing a database in oracle and am i little stuck with the following error code:</p> <pre><code>Error starting at line : 95 in command - INSERT INTO Bug_Project(Bug_ID, Project_ID) VALUES (00, 00) Error at Command Line : 95 Column : 33 Error report - SQL Error: ORA-00904: "PROJECT_ID": invalid identifier 00904. 00000 - "%s: invalid identifier" *Cause: *Action: </code></pre> <p>I am new to oracle and sql and not sure which identifier is invalid.</p> <p>I have looked at the dates between the bug and project and they all correlate so i am not sure what could be the problem.</p> <p>It's probably a small fix but confuses the hell out of me.</p> <p>My code is displayed below and any help would be greatly appreciated:</p> <pre><code>--CREATE SCRIPTS /*put your create scripts here – your script should not commented out*/ CREATE TABLE Project ( Proj_ID integer, Proj_Name varchar(10), Proj_Start_Date date, primary key (Proj_ID) ); CREATE TABLE Bug ( Bug_ID integer, Bug_Type varchar(100), Bug_Desc varchar(100), Bug_Time date, primary key(Bug_ID) ); CREATE TABLE Engineer ( Engineer_ID integer, Engineer_Name varchar(10), Engineer_Type varchar(20), primary key (Engineer_ID) ); CREATE TABLE Bug_Project ( Bug_ID integer, Proj_ID integer, primary key(Bug_ID, Proj_ID), foreign key(Bug_ID) references Bug (Bug_ID), foreign key(Proj_ID) references Project (Proj_ID) ); CREATE TABLE Fix_Allocation ( Engineer_ID integer, Bug_ID integer, primary key(Engineer_ID, Bug_ID), foreign key(Engineer_ID) references Engineer (Engineer_ID), foreign key(Bug_ID) references Bug (Bug_ID) ); CREATE TABLE Test_Allocation ( Engineer_ID integer, Bug_ID integer, primary key(Engineer_ID, Bug_ID), foreign key(Engineer_ID) references Engineer (Engineer_ID), foreign key(Bug_ID) references Bug (Bug_ID) ); CREATE TABLE Note ( Engineer_ID integer, Bug_ID integer, Note_author varchar(10), Note_contents varchar(20), primary key(Engineer_ID, Bug_ID), foreign key(Engineer_ID) references Engineer (Engineer_ID), foreign key(Bug_ID) references Bug (Bug_ID) ); COMMIT; --INSERT SCRIPTS /*put your insert scripts here – your script should not commented out */ INSERT INTO Project(Proj_ID, Proj_Name, Proj_Start_Date) VALUES (00, 'Project 1', DATE '1980-02-14'); INSERT INTO Project(Proj_ID, Proj_Name, Proj_Start_Date) VALUES (01, 'Project 2', DATE '1985-12-11'); INSERT INTO Project(Proj_ID, Proj_Name, Proj_Start_Date) VALUES (02, 'Project 3', DATE '1992-06-03'); INSERT INTO Project(Proj_ID, Proj_Name, Proj_Start_Date) VALUES (03, 'Project 4', DATE '2000-07-22'); INSERT INTO Project(Proj_ID, Proj_Name, Proj_Start_Date) VALUES (04, 'Project 5', DATE '2012-03-19'); INSERT INTO Project(Proj_ID, Proj_Name, Proj_Start_Date) VALUES (05, 'Project 6', DATE '2015-10-21'); INSERT INTO Bug(Bug_ID, Bug_Type, Bug_Desc, Bug_Time) VALUES (00, 'Crash', 'Software stopped functioning properly and exited', timestamp '1980-03-20 09:26:50'); INSERT INTO Bug(Bug_ID, Bug_Type, Bug_Desc, Bug_Time) VALUES (01, 'Run Time Error', 'Wrong output due to a logical error', timestamp '1982-06-12 11:36:32'); INSERT INTO Bug(Bug_ID, Bug_Type, Bug_Desc, Bug_Time) VALUES (02, 'Compilation Error', 'Problems with the compiler, failed complication of source code', timestamp '1987-07-12 14:11:15'); INSERT INTO Bug(Bug_ID, Bug_Type, Bug_Desc, Bug_Time) VALUES (03, 'Crash', 'Software stopped functioning properly and exited', timestamp '1993-01-31 03:21:17'); INSERT INTO Bug(Bug_ID, Bug_Type, Bug_Desc, Bug_Time) VALUES (04, 'Logical Error', 'Unexpected behavior due to problem in source code', timestamp '1997-04-01 10:46:18'); INSERT INTO Bug(Bug_ID, Bug_Type, Bug_Desc, Bug_Time) VALUES (05, 'Run Time Error', 'Wrong output due to a logical error', timestamp '2001-12-24 12:12:37'); INSERT INTO Bug(Bug_ID, Bug_Type, Bug_Desc, Bug_Time) VALUES (06, 'GUI Error', 'Glitchy interface ', timestamp '2013-09-02 17:11:55'); INSERT INTO Bug(Bug_ID, Bug_Type, Bug_Desc, Bug_Time) VALUES (07, 'Run Time Error', 'Wrong output due to a logical error', timestamp '2016-02-03 11:11:21'); INSERT INTO Engineer(Engineer_ID, Engineer_Name, Engineer_Type) VALUES (00, 'Ava', 'Tester'); INSERT INTO Engineer(Engineer_ID, Engineer_Name, Engineer_Type) VALUES (01, 'Alexander', 'Fixer'); INSERT INTO Engineer(Engineer_ID, Engineer_Name, Engineer_Type) VALUES (02, 'Aiden', 'Fixer'); INSERT INTO Engineer(Engineer_ID, Engineer_Name, Engineer_Type) VALUES (03, 'Anthony', 'Tester'); INSERT INTO Engineer(Engineer_ID, Engineer_Name, Engineer_Type) VALUES (04, 'Adam', 'Fixer'); INSERT INTO Engineer(Engineer_ID, Engineer_Name, Engineer_Type) VALUES (05, 'Alex', 'Tester'); INSERT INTO Engineer(Engineer_ID, Engineer_Name, Engineer_Type) VALUES (06, 'John', 'Fixer'); INSERT INTO Bug_Project(Bug_ID, Project_ID) VALUES (00, 00); INSERT INTO Bug_Project(Bug_ID, Project_ID) VALUES (01, 00); INSERT INTO Bug_Project(Bug_ID, Project_ID) VALUES (02, 01); INSERT INTO Bug_Project(Bug_ID, Project_ID) VALUES (03, 02); INSERT INTO Bug_Project(Bug_ID, Project_ID) VALUES (04, 02); INSERT INTO Bug_Project(Bug_ID, Project_ID) VALUES (05, 03); INSERT INTO Bug_Project(Bug_ID, Project_ID) VALUES (06, 04); INSERT INTO Bug_Project(Bug_ID, Project_ID) VALUES (07, 05); INSERT INTO Fix_Allocation(Engineer_ID, Bug_ID) VALUES (01, 01); INSERT INTO Fix_Allocation(Engineer_ID, Bug_ID) VALUES (02, 02); INSERT INTO Fix_Allocation(Engineer_ID, Bug_ID) VALUES (04, 04); INSERT INTO Fix_Allocation(Engineer_ID, Bug_ID) VALUES (06, 05); INSERT INTO Fix_Allocation(Engineer_ID, Bug_ID) VALUES (06, 07); INSERT INTO Test_Allocation VALUES (); INSERT INTO Test_Allocation VALUES (); INSERT INTO Test_Allocation VALUES (); INSERT INTO Note VALUES (); INSERT INTO Note VALUES (); INSERT INTO Note VALUES (); COMMIT; --SELECT SCRIPT /*put your select scripts here (with indication of which query is answered) – your script should not commented out -- Query 1: List of all the bugs, and their details. SELECT * FROM Bug; -- Query 2: List of all bugs, and their notes. -- Query 3: List of all bugs, with their notes, and the engineers who have written them; sorted by name of engineer. -- Query 4: List the bugs and how much cumulative time (in hours) they have taken; ordered by time taken. -- Query 5: The bug that has taken most time to fix, and the projects it is connected to. COMMIT; --DROP SCRIPT /*put your drop scripts here (in the correct order)– your script should not commented out DROP TABLE Note; DROP TABLE Test_Allocation; DROP TABLE Fix_Allocation; DROP TABLE Engineer; DROP TABLE Bug_Project; DROP TABLE Bug; DROP TABLE Project; COMMIT; </code></pre>
<sql><oracle>
2019-12-03 14:13:35
LQ_CLOSE
59,162,999
How to reverse an array without a loop or creating new array
<pre><code>class ReverseArrayElements1 { public static void main ( String[] args ) { int[] values = {10, 20, 30, 40}; int temp; System.out.println( "Original Array: " + values[0] + "\n" + values[1] + "\n" + values[2] + "\n" + values[3] ); // reverse the order of the numbers in the array System.out.println( "Reversed Array: " + values[0] + "\n" + values[1] + "\n" + values[2] + "\n" + values[3] ); } } </code></pre> <p>Task I need to complete the program so that the numbers in the array appear in reversed order. This does not mean that I can just need to display the elements in reverse order; I will actually move the last element in the array into the the first element of the array, and so on. I can't use a loop or create a new array. </p> <p>The output should be </p> <pre><code>Original Array: 10 20 30 40 Reversed Array: 40 30 20 10 </code></pre>
<java><arrays><reverse>
2019-12-03 18:07:53
LQ_CLOSE
59,163,141
Raycast in Three.js with only a projection matrix
<p>I'm rendering some custom layers using Three.js in a Mapbox GL JS page following <a href="https://docs.mapbox.com/mapbox-gl-js/example/add-3d-model/" rel="noreferrer">this example</a>. I'd like to add raycasting to determine which object a user has clicked on.</p> <p>The issue is that I only get a projection matrix from Mapbox, which I use to render the scene:</p> <pre class="lang-js prettyprint-override"><code>class CustomLayer { type = 'custom'; renderingMode = '3d'; onAdd(map, gl) { this.map = map; this.camera = new THREE.Camera(); this.renderer = new THREE.WebGLRenderer({ canvas: map.getCanvas(), context: gl, antialias: true, }); this.scene = new THREE.Scene(); // ... } render(gl, matrix) { this.camera.projectionMatrix = new THREE.Matrix4() .fromArray(matrix) .multiply(this.cameraTransform); this.renderer.state.reset(); this.renderer.render(this.scene, this.camera); } } </code></pre> <p>This renders just great, and tracks changes in view when I pan/rotate/zoom the map.</p> <p><a href="https://i.stack.imgur.com/iQXGc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iQXGc.png" alt="A cube on Liberty Island"></a></p> <p>Unfortunately, when I try to add raycasting I get an error:</p> <pre class="lang-js prettyprint-override"><code> raycast(point) { var mouse = new THREE.Vector2(); mouse.x = ( point.x / this.map.transform.width ) * 2 - 1; mouse.y = 1 - ( point.y / this.map.transform.height ) * 2; const raycaster = new THREE.Raycaster(); raycaster.setFromCamera(mouse, this.camera); console.log(raycaster.intersectObjects(this.scene.children, true)); } </code></pre> <p>This gives me an exception:</p> <pre><code>THREE.Raycaster: Unsupported camera type. </code></pre> <p>I can change from a generic <code>THREE.Camera</code> to a <code>THREE.PerspectiveCamera</code> without affecting the rendering of the scene:</p> <pre class="lang-js prettyprint-override"><code>this.camera = new THREE.PerspectiveCamera(28, window.innerWidth / window.innerHeight, 0.1, 1e6); </code></pre> <p>This fixes the exception but also doesn't result in any objects being logged. Digging a bit reveals that the camera's <code>projectionMatrixInverse</code> is all <code>NaN</code>s, which we can fix by calculating it:</p> <pre class="lang-js prettyprint-override"><code> raycast(point) { var mouse = new THREE.Vector2(); mouse.x = ( point.x / this.map.transform.width ) * 2 - 1; mouse.y = 1 - ( point.y / this.map.transform.height ) * 2; this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix); // &lt;-- const raycaster = new THREE.Raycaster(); raycaster.setFromCamera(mouse, this.camera); console.log(raycaster.intersectObjects(this.scene.children, true)); } </code></pre> <p>Now I get two intersections wherever I click, with two faces of the cube. Their distances are 0:</p> <pre><code>[ { distance: 0, faceIndex: 10, point: Vector3 { x: 0, y: 0, z: 0 }, uv: Vector2 {x: 0.5, y: 0.5}, ... }, { distance: 0, faceIndex: 11, point: Vector3 { x: 0, y: 0, z: 0 }, uv: Vector2 {x: 0.5, y: 0.5}, ... }, ] </code></pre> <p>So clearly something isn't working here. Looking at the <a href="https://github.com/mrdoob/three.js/blob/441fefadc017ebafd2d10089b6d48e1cd28795c2/src/core/Raycaster.js#L81-L83" rel="noreferrer">code for <code>setCamera</code></a>, it involves both <code>projectionMatrix</code> and <code>matrixWorld</code>. Is there a way I can set <code>matrixWorld</code>, or construct the raycaster's ray directly using only the projection matrix? It seems that I only need the projection matrix to render the scene, so I'd hope that it would also be all I need to cast a ray.</p> <p>Full example <a href="https://codepen.io/danvk/pen/GRggjmg?editors=0010" rel="noreferrer">in this codepen</a>.</p>
<three.js><mapbox-gl-js><raycasting>
2019-12-03 18:19:36
HQ
59,163,722
printing sum of integer and a char*
<p>Consider the c snippet:</p> <pre><code>#include&lt;stdlib.h&gt; int main() { printf(2+"Roomy"); return 0; } </code></pre> <p>Output given is skipping 1st 2 characters of the string.i.e.,omy </p> <p>So can anyone explain what is going on with the addition?</p>
<c>
2019-12-03 19:01:26
LQ_CLOSE
59,163,854
Can someone help me solve this syntax error?
<p>Hi I am trying the code below on a php page. I keep getting syntax error due to the single quotes around the parameter 'London' of the function openCity() shown below.</p> <pre><code>echo '&lt;button class="tablinks" onclick="openCity(event, 'London')"&gt;London&lt;/button&gt;'; </code></pre> <p>If I remove the single quotes covering 'London' and add double quotes there, the function doesn't work as expected. What am I not seeing? Is there a way to fix this?</p> <p>The openCity() javacript function is shown below.</p> <pre><code>function openCity(evt, cityName) { var i, tabcontent, tablinks; tabcontent = document.getElementsByClassName("tabcontent"); for (i = 0; i &lt; tabcontent.length; i++) { tabcontent[i].style.display = "none"; } tablinks = document.getElementsByClassName("tablinks"); for (i = 0; i &lt; tablinks.length; i++) { tablinks[i].className = tablinks[i].className.replace(" active", ""); } document.getElementById(cityName).style.display = "block"; evt.currentTarget.className += " active"; ''' What I am trying to do is when a user clicks the button, it shows a block of elements (Like a tabs). </code></pre>
<javascript><php><syntax>
2019-12-03 19:11:09
LQ_CLOSE
59,164,552
how to fox an object not to move out of frame in java
Fix this code in such way that rectangle does not move out of frame bounds frame size is (400,400) public void moveRectangle(int dx, int dy) { rect.translate(dx * RECT_WIDTH, dy * RECT_HEIGHT); repaint(); }
<java>
2019-12-03 20:05:53
LQ_EDIT
59,164,818
angular application not updating in realtime when article deleted or created
Angular application doesn't update in real time when I delete deleteArticle(id){ this.articleService.deleteArticle(id).subscribe((article: Article)=>{ console.log("Article deleted, ", article); }); } The article gets deleted but I then need to refresh the browser to see the result?!
<angular><typescript>
2019-12-03 20:26:24
LQ_EDIT
59,166,894
Boolean not inheriting
<p>I created a boolean method in a super class, but when I call on that method to use it in the sub class, it is giving me a type mismatch error saying it can't convert a boolean to A. I'm probably missing something minor, but is there another way to use the method in an inherited class? </p> <pre><code>public class A{ public boolean Proper(String expression){ //body of method that determines if an expression is proper return true; } } public class B extends A { static BalancedExpressions Proper = new BalancedExpressions(); public static void main(String[] args) { try { Scanner scanner = new Scanner(new File("src/Expressions.txt")); FileWriter output = new FileWriter(new File("Output.txt")); while (scanner.hasNextLine()) { String nextLine = scanner.nextLine(); output.write(nextLine + "\t"); //following line is giving the error if(Proper = true) { output.write("proper" + "\n"); } else { output.write("improper" + "\n"); } scanner.close(); output.close(); } } catch (FileNotFoundException e) { e.printStackTrace(); } }//end main } </code></pre>
<java><inheritance><methods>
2019-12-03 23:27:27
LQ_CLOSE
59,168,380
How To Secure My Api Used For Customer Login Without Making It Vulnerable To Others
<p>I am very new to development with angularjs. I am creating a user login system using angularjs. I created a user login system using angularjs using json data. But using my api link in controllers is vulnerable to anyone who is inside the source code to my login page.</p> <p>I want to secure my api to be unvulnerable to anyone. Using the source code can help anyone to see all the users to my platform. Also if I am hashing the password then also some techy might decode the password.</p> <p>Please help me with angular or json to secure my login platform.</p>
<php><json><angularjs><security><authentication>
2019-12-04 03:07:23
LQ_CLOSE
59,168,503
how to get string most appears in text file c
<p>how do I get the string that appears most frequently in a text file in c?</p> <p>I need to create an algorithm that gets a string that has been cited more often in a text file and then writes it, but I have no idea where to start</p>
<c>
2019-12-04 03:23:18
LQ_CLOSE
59,169,766
Is there a shortcut way to create a new object if an object is null?
<p>I have some simple code:</p> <pre><code> public static void InitializeScreenTimeStopwatch() { if (ScreenTimeStopwatch == null) ScreenTimeStopwatch = new Stopwatch(); } </code></pre> <p>Is there a simple way that this code can be refactored using the ? operator that's now with the latest version of C#</p>
<c#>
2019-12-04 05:59:00
LQ_CLOSE
59,169,945
what is the best way to save json in app in iOS?
<p>I am using a json that is very big. it takes lot of time to fetch it as api response. I want to fetch it once and save it locally, so that I can use it in my app. I want to save it in a file but the question is where should I store this file. </p>
<swift>
2019-12-04 06:15:52
LQ_CLOSE
59,171,638
how can I use console.log for number division
<p>I try multiple times, but it keeps saying error. Please help</p> <p>Prompt the user for a number. Use console.log to display either</p> <p>This number is divisible by 3 </p> <p>or </p> <p>This number isn't divisible by 3 </p> <p>whichever is correct. </p>
<javascript>
2019-12-04 08:18:55
LQ_CLOSE
59,172,813
how to get month from date in javascript?
<p>I'm trying to get month from my date variable.</p> <pre><code>date=Date.now(); console.log(date); &gt;&gt;2019-12-04T08:55:48.972Z </code></pre> <p>I want to get the month from this date but when I'm using getMonth(), I'm getting error.</p> <pre><code>console.log(date.getMonth()); error:- getMonth is not a function </code></pre>
<javascript>
2019-12-04 09:35:06
LQ_CLOSE
59,173,339
angularjs directive to angular6 component/directive
<p>I have one angularjs directive as part of old application, I would like to convert that into angular6, As I dont know angularJS and currently working with angular6 version, could anybody please help me with pointer ? below is angularjs code.</p> <pre><code>define(function (require, exports, module) { 'use strict'; var base = require('base'); var utils = base.utils; configCompile.$inject = ['$compileProvider']; module.exports = configCompile; function configCompile($compileProvider) { $compileProvider.directive('projCompile', projCompile); function projCompile($compile) { return { scope: { compile: "=", scope: "=?", }, link: link, } function link(scope, element, attrs) { var scope_child = scope.$new(); scope.$watch('compile', function () { element.empty().append(scope.compile); $compile(element.contents())(scope_child); } ); scope.$watch('scope', function () { scope.scope = scope.scope || {}; scope_child = scope.$new(); for (var idx in scope.scope) { scope_child[idx] = scope.scope[idx]; } scope_child.$this = scope.scope; element.empty().append(scope.compile); $compile(element.contents())(scope_child); } ); }; }; } }) </code></pre>
<angularjs><angular>
2019-12-04 10:01:14
LQ_CLOSE
59,173,471
How to convert String to Date with a specific format in java
<p>I have a requirement to convert String to Date (in dd-MM-yyyy format). But dateformat.parse gives the format with seconds. I need to convert the String date to Date in the same format as mentioned above.</p>
<java><date>
2019-12-04 10:07:26
LQ_CLOSE
59,173,944
How do I send data from fragment to another activity
<p>In my app, i have an activity that have recyclerview inside a fragment and the recycleview retrieve data from cloud store Firebase. I want to open new activity that will retrieve the data according to the link(that display on the recycler view) user has clicked. How do i get the data and display it in new activity?</p> <p>From ForumTitle.java > Show ReviewFragment.java > User click a value > Show ForumInterface.java</p> <p>ForumTitle.java</p> <pre><code>public class ForumTitle extends AppCompatActivity { private FirebaseFirestore db = FirebaseFirestore.getInstance(); ImageButton IVReview,IVTechnical,IVHardware; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_forum_title); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View v) { Fragment selectedFragment = null; if (v == findViewById(R.id.iBReview)){ selectedFragment = new ReviewFragment(); } else if (v == findViewById(R.id.iBTech)){ selectedFragment = new TechnicalSupportFragment(); } else if (v == findViewById(R.id.iBHardware)){ selectedFragment = new HardwareFragment(); } FragmentManager manager = getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.replace(R.id.fragment_container,selectedFragment); transaction.commit(); } }; IVReview = (ImageButton)findViewById(R.id.iBReview); IVTechnical = (ImageButton)findViewById(R.id.iBTech); IVHardware = (ImageButton)findViewById(R.id.iBHardware); IVReview.setOnClickListener(listener); IVTechnical.setOnClickListener(listener); IVHardware.setOnClickListener(listener); } } </code></pre> <p>ReviewFragment.java</p> <pre><code>public class ReviewFragment extends Fragment { private FirebaseFirestore db = FirebaseFirestore.getInstance(); private CollectionReference userRef = db.collection("Review"); private ForumAdapter adapter; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_review,container,false); return view; } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { Query query = userRef.orderBy("DatePosted",Query.Direction.DESCENDING); FirestoreRecyclerOptions&lt;Forum&gt; options = new FirestoreRecyclerOptions.Builder&lt;Forum&gt;() .setQuery(query,Forum.class) .build(); adapter = new ForumAdapter(options); RecyclerView recyclerView = (RecyclerView)view.findViewById(R.id.rvReview); recyclerView.setHasFixedSize(true); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this.getActivity()); recyclerView.setLayoutManager(layoutManager); recyclerView.setAdapter(adapter); adapter.setOnItemClickListener(new ForumAdapter.OnItemClickListener() { @Override public void onItemClick(DocumentSnapshot documentSnapshot, int position) { Forum forum = documentSnapshot.toObject(Forum.class); String title = forum.getTitle(); String id = documentSnapshot.getId(); Intent intent = new Intent(getActivity(), ForumInterface.class); Bundle extras = intent.getExtras(); extras.putString("FORUM_TYPE","Review"); extras.putString("FORUM_ID",id); extras.putString("TITLE",title); startActivity(intent); } }); } @Override public void onStart() { super.onStart(); adapter.startListening(); } @Override public void onStop() { super.onStop(); adapter.stopListening(); } </code></pre> <p>ForumInterface.java</p> <pre><code>public class ForumInterface extends AppCompatActivity { private FirebaseFirestore db = FirebaseFirestore.getInstance(); Intent intent = getIntent(); Bundle extras = intent.getExtras(); String forum_title = extras.getString("TITLE"); String forum_type = extras.getString("FORUM_TYPE"); String forum_id = extras.getString("FORUM_ID"); private CollectionReference userRef = db.collection(forum_type).document(forum_id).collection(forum_title); private ForumAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_forum_interface); TextView test = (TextView)findViewById(R.id.tvForumTitle); test.setText(forum_title); } } </code></pre> <p>ForumAdapter.java</p> <pre><code>public class ForumAdapter extends FirestoreRecyclerAdapter&lt;Forum,ForumAdapter.ForumHolder&gt; { private OnItemClickListener listener; public ForumAdapter(FirestoreRecyclerOptions&lt;Forum&gt; options) { super(options); } @Override public void onBindViewHolder(ForumHolder forumHolder, int i, Forum forum) { forumHolder.textViewTitle.setText(forum.getTitle()); forumHolder.textViewDescription.setText(forum.getDescription()); forumHolder.timeStamp.setText(forum.getDatePosted().toString()); } @NonNull @Override public ForumHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { android.view.View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.cardviewforumtitle,parent,false); return new ForumHolder(v); } class ForumHolder extends RecyclerView.ViewHolder{ TextView textViewTitle; TextView textViewDescription; TextView timeStamp; public ForumHolder(View itemView) { super(itemView); textViewTitle = itemView.findViewById(R.id.title); textViewDescription = itemView.findViewById(R.id.description); timeStamp = itemView.findViewById(R.id.timestamp); textViewTitle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int position = getAdapterPosition(); // NO_POSITION to prevent app crash when click -1 index if(position != RecyclerView.NO_POSITION &amp;&amp; listener !=null ){ listener.onItemClick(getSnapshots().getSnapshot(position),position); } } }); } } public interface OnItemClickListener{ void onItemClick(DocumentSnapshot documentSnapshot, int position); } public void setOnItemClickListener(OnItemClickListener listener){ this.listener = listener; } @Override public int getItemCount() { return super.getItemCount(); } } </code></pre> <p>With the code above i run it, i got an error</p> <pre><code>java.lang.NullPointerException: Attempt to invoke virtual method 'void android.os.Bundle.putString(java.lang.String, java.lang.String)' on a null object reference at my.edu.fsktm.um.finalproject.Fragment.ReviewFragment$1.onItemClick(ReviewFragment.java:61) at my.edu.fsktm.um.finalproject.ForumTitle.ForumAdapter$ForumHolder$1.onClick(ForumAdapter.java:56) </code></pre> <p>The picture of my app <a href="https://i.stack.imgur.com/9iw2z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9iw2z.png" alt="ForumTitle"></a></p> <p><a href="https://i.stack.imgur.com/DItsr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DItsr.png" alt="ReviewFragment"></a></p> <p>When I clicked the title "GTX 1660 Ti Gaming X" <a href="https://i.stack.imgur.com/ovTDv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ovTDv.png" alt="Error message"></a></p>
<java><android><android-fragments><google-cloud-firestore>
2019-12-04 10:33:29
LQ_CLOSE
59,174,342
Parse error: syntax error, unexpected 'endwhile' (T_ENDWHILE), expecting end of file in C:\xampp\htdocs\demology\errors.php on line 11
<p>//I get the above error when I try to run my registeration page</p> <pre><code>&lt;div&gt; &lt;?php foreach ($errors as $error): ?&gt; &lt;p&gt; &lt;?php echo $error; ?&gt;&lt;/p&gt; &lt;?php endforeach; ?&gt; &lt;/div&gt; </code></pre>
<php>
2019-12-04 10:54:57
LQ_CLOSE
59,175,128
Using PHP to split url
<p>I'm trying to split my url and have them in two variables.</p> <p>For Example:</p> <p>url = <a href="https://example.com/page@01" rel="nofollow noreferrer">https://example.com/page@01</a></p> <p>I want to be able split this url into two and create two variable.</p> <pre><code>$part_1 = example.com; $part_2 = page@01 </code></pre> <p>Thank you.</p>
<php><split>
2019-12-04 11:36:10
LQ_CLOSE
59,178,070
why multiple condition in python while loop are not working?
<p>I can't seem to find the problem in code...<br></p> <pre><code>user_decision = "" while not user_decision == "yes" or not user_decision == "no": user_decision = input("You want to Join?: Please answer (yes/no): ") else: if user_decision == "yes": print("test") else: print("test") </code></pre> <p>Thanks....</p>
<python><while-loop><multiple-conditions>
2019-12-04 14:15:38
LQ_CLOSE
59,178,329
How to check if input string is a hash of algorhitms from list: ["md5", "sha1", "sha256"]
<p>I have to write method like this:</p> <pre><code>boolean isHash(String str){ ... } </code></pre> <p>Method should return true if input string is <code>md5</code> hash or <code>sha1</code> hash or <code>sha256</code> hash.</p> <p>Is it possible to implement such method ?</p>
<java><cryptography><md5><sha1><sha256>
2019-12-04 14:29:15
LQ_CLOSE
59,178,966
Two arrays into one Dictinary C#
<p>I would like to create a</p> <p><code>Dictionary&lt;string, int[]&gt; dict</code></p> <p>out of two arrays(different length):</p> <pre><code>string[] keys = { "A", "B", "A", "D", "C","E" }; string[] values = { green, blue, yellow}; </code></pre> <p>The results:</p> <pre><code>["A"] = {green} ["B"] = {blue} ["D"] = {yellow} ["C"] = {green} ["E"] = {blue} </code></pre>
<c#><arrays><dictionary>
2019-12-04 15:04:03
LQ_CLOSE
59,179,041
How to resolve undefined Input Angular?
<p>There is input data in component:</p> <pre><code> @Input() pupil: Pupil; </code></pre> <p>Before rendering this data in template I need to map it:</p> <pre><code> ngOnChanges() { this.pupil.photo = Helper.getPhoto(this.pupil); } </code></pre> <p>But I get error cause <code>this.pupil</code> in undefined, but after I can see filled object.</p> <p>How to await result from Input?</p> <p>In template I have <code>*ngIf="pupil"</code></p>
<angular><angular6><angular7><angular8>
2019-12-04 15:08:19
LQ_CLOSE
59,179,901
Changing the value of a copy also changes the value of the original
<p>Changing the value of a variable b, which is a copy of a, also changes the value of a.</p> <pre><code>a = [[0]] b = a.copy() print("a before", a) b[0][0] = 1 print("a after ", a) </code></pre> <p>prints:</p> <pre><code>a before [[0]] a after [[1]] </code></pre> <p>Although this works:</p> <pre><code>a = [0] b = a.copy() print("a before", a) b[0] = 1 print("a after ", a) </code></pre> <p>prints:</p> <pre><code>a before [[0]] a after [[0]] </code></pre>
<python><list><variables><copy>
2019-12-04 15:52:48
LQ_CLOSE
59,180,598
constraint satisfaction problem missing one constraint
<p>I'm a lab practises tutor at the university, based on last year student comments, we wanted, my boss and I, to address them. My boss chose to go with writing a C script and I pick python (python-constraint) to try to resolve our problem. </p> <h2>Informations</h2> <ul> <li>There are 6 sessions</li> <li>There are 4 roles</li> <li>There are 6 practices</li> <li>There are 32 students</li> <li>There are 4 students per team</li> </ul> <h2>Problem :</h2> <p>Assign each student to 4 roles, in 4 practices in 4 different sessions. </p> <h2>Constraints :</h2> <ol> <li>Students should do a role once </li> <li>Students should do 4 different practices out of 6</li> <li>Students should do only one practice per session</li> <li><strong>Student should meet the same mate only once</strong></li> </ol> <h2>Templates :</h2> <p>Here is the template that I feel with students, where each team is composed of 4 students, positions [0, 1, 2 or 3] are roles assigned to them. Each available position is numbering from 1 to 128</p> <pre class="lang-py prettyprint-override"><code>[# Semester [ # Session [ # Practice/Team 1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16], [17, 18, 19, 20], [21, 22, 23, 24]], [[25, 26, 27, 28], [29, 30, 31, 32], [33, 34, 35, 36], [37, 38, 39, 40], [41, 42, 43, 44], [45, 46, 47, 48]], [[49, 50, 51, 52], [53, 54, 55, 56], [57, 58, 59, 60], [61, 62, 63, 64], [65, 66, 67, 68], [69, 70, 71, 72]], [[73, 74, 75, 76], [77, 78, 79, 80], [81, 82, 83, 84], [85, 86, 87, 88], [89, 90, 91, 92], [93, 94, 95, 96]], [[97, 98, 99, 100], [101, 102, 103, 104], [105, 106, 107, 108], [109, 110, 111, 112]], [[113, 114, 115, 116], [117, 118, 119, 120], [121, 122, 123, 124], [125, 126, 127, 128]]] </code></pre> <p>In other words : </p> <p>This is a session : </p> <pre class="lang-py prettyprint-override"><code> [[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [13, 14, 15, 16], [17, 18, 19, 20], [21, 22, 23, 24]], </code></pre> <p>Those team do the same practice: </p> <pre class="lang-py prettyprint-override"><code>[ [1, 2, 3, 4], [25, 26, 27, 28], [49, 50, 51, 52], [73, 74, 75, 76], [97, 98, 99, 100], [113, 114, 115, 116] ] </code></pre> <p>Those position do the same role : </p> <pre class="lang-py prettyprint-override"><code>[ 1, 5, 9, 13, 17, 21, 25, ... ] </code></pre> <h2>What I have so far :</h2> <p>Using <a href="http://labix.org/doc/constraint/" rel="noreferrer">python-constraint</a> I was able to validate the first three constraints : </p> <pre class="lang-py prettyprint-override"><code>Valid solution : False - sessions : [True, True, True, True, True, True] - practices : [True, True, True, True, True, True] - roles : [True, True, True, True] - teams : [False, False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, True, False, False, False, False, False] </code></pre> <h3>For those that may interesting I simply do like this :</h3> <p>For each condition I use <a href="http://labix.org/doc/constraint/" rel="noreferrer">AllDifferentConstraint</a>. For example, for one session I do: </p> <pre class="lang-py prettyprint-override"><code>problem.addConstraint(AllDifferentConstraint(), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]) </code></pre> <p>I'm not able to find a way to constraint team, my last attempt on the entire <code>semester</code> was this : </p> <pre class="lang-py prettyprint-override"><code> def team_constraint(self, *semester): students = defaultdict(list) # get back each teams based on the format [# Semester [ #Session [# Practice/Team ... teams = [list(semester[i:i+4]) for i in range(0, len(semester), 4)] # Update Students dict with all mate they work with for team in teams: for student in team: students[student] += [s for s in team if s != student] # Compute for each student if they meet someone more than once dupli = [] for student, mate in students.items(): dupli.append(len(mate) - len(set(mate))) # Loosly constraint, if a student meet somone 0 or one time it's find if max(dupli) &gt;= 2: print("Mate encounter more than one time", dupli, min(dupli) ,max(dupli)) return False pprint(students) return True </code></pre> <h1>Questions :</h1> <ol> <li>Is it possible to do what I want for the team conditions ? What I mean is I have no idea if it is possible to assign 12 mates to each student and each of them meet the same mate only once.</li> <li>For the team constraint, did I miss a more performant algorithm ? </li> <li>Any pist that I can follow ? </li> </ol>
<python><algorithm><python-constraint>
2019-12-04 16:30:08
HQ
59,180,696
'KeyPressEventArgs' does not contain defintion for KeyCode' error in visual studio
Im trying to make a key press event in visual studio windows forms but getting this error. Any ideas? ``` private void Form1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyCode = Keys.E) { // The Code when key 'E' is pressed } } ``` but I keep getting the error CS1061
<c#>
2019-12-04 16:34:58
LQ_EDIT
59,180,794
Im getting "division by zero" error in python and I dont have a clue why
I dont know why but, python says that ```( (x1[0]*(len(x1)-1)) + (x2[0]*(len(x2)-1)) + (x3[0]*(len(x3)-1)))``` equals 0, which shouldnt in my opinion. I've tested that code, separately, without it being a divisor, and it didnt output 0 value. ``` def av(x): c = 0 alist = x alist.pop(0) for a in alist: c += a*x[0] return c average = lambda x1,x2,x3: (av(x1) + av(x2) + av(x3))/( (x1[0]*(len(x1)-1)) + (x2[0]*(len(x2)-1)) + (x3[0]*(len(x3)-1))) print(average([0,0],[1,4],[1,5]))```
<python-3.x>
2019-12-04 16:40:02
LQ_EDIT
59,181,332
App is rendering larger than viewport when I try to apply dynamic css sizing attributes
<p>I have tried applying 100vh to the divs root/body/application (these are my top 3 level divs) and my app continues to render larger than the viewport or browser window. I am using display: flex on the child divs.</p> <p>I am trying to just get the app to fit the window.</p>
<javascript><css><window><viewport><sizing>
2019-12-04 17:06:59
LQ_CLOSE
59,181,485
Why i don`t have attribute textinput?
I have python 3.7 and it just doesn`t shows me textinput and numinput as an attribute. It works great with turtle.onclick() or ondrag but attributes textinput and numinput just disappeared How can I fix this?
<python><turtle-graphics>
2019-12-04 17:16:13
LQ_EDIT
59,181,865
How to loop python script over at end
<p>So I have the following test script I am playing with.</p> <pre><code>import time year = time.strftime('%Y') name = input('What is your name? ') dob = input('What is your DOB ') age = int(year) - int(dob) print(f'{name}, You are {age} years old.') </code></pre> <p>How do I start this script over after it prints out the last statement? Sorry for such a silly question, I have been looking everywhere but cannot find anything. Thanks in advance.</p>
<python><python-3.x>
2019-12-04 17:38:01
LQ_CLOSE
59,183,612
How to convert all String's to lower case in a collection of type HashSet <String>?
<p>I am not sure of best way to convert all Strings in a collection to lowercase. Any thoughts?</p> <pre><code> private Set&lt;String&gt; email; if(userEmail instanceof Collection) { this.email = new HashSet&lt;String&gt;((Collection&lt;String&gt;) userEmail); model.put("userEmail", this.email); //need to convert this to lower case } </code></pre> <p>Thanks in advance :-)</p>
<java><string><collections><hashset><lowercase>
2019-12-04 19:44:54
LQ_CLOSE
59,183,754
Creating a hyperlink from a file name read from input file to write to a output text file
<p>I would like to convert the text name of each of the several files listed on the input text file (compatible with NotePad) to a hyperlink and would like to use the file name as the text display associated with each hyperlink and write the result with the hyperlinks to an output text file (also compatible with NotePAd).</p> <p>I would lilke to use either VB Script or VB.Net as the programming language. I cannot find instructions for creating the hyperlink from a character string using either VB Script or VB.Net. Can someone point me to some relevant documentation?</p>
<vb.net><vbscript><hyperlink>
2019-12-04 19:54:33
LQ_CLOSE
59,184,688
CSV module - how to open a file that everyday has a different name due to date change?
this is my very first post here and I am on the beggining of my adventure with Python, sorry for any mistakes I have made. I am working on an automation of reporting to my collaborators. I am pulling the report though API with the following code : ***code*** import requests from datetime import date, timedelta today = date.today() yesterday = today - timedelta(days = 1) app_id = 'myappid' report_type = 'daily_report' params = { 'api_token': 'api_token', 'from': yesterday, 'to': yesterday } request_url = 'https://domainxyz.com/export/{}/{}/v5'.format(app_id, report_type) res = requests.request('GET', request_url, params=params) if res.status_code != 200: if res.status_code == 404: print('There is a problem with the request URL. Make sure that it is correct') else: print('There was a problem retrieving data: ', res.text) else: f = open('{}-{}-{}-to-{}.csv'.format(app_id, report_type, params['from'], params['to']), 'w', newline='', encoding="utf-8") f.write(res.text) f.close() and the code saves the file as 'myappid-daily_report-yesterdayDate-to-yesterdayDate.csv and this is working just great. Once I do have the data for yesterday, I would like to open the csv file and do some modifications with Pandas but before this, I need to open the CSV file which has kind of a dynamic name on daily basis. I would open the file with the following import csv from datetime import date, timedelta today = date.today() yesterday = today - timedelta(days = 1) app_id = 'myappid' report_type = 'daily_report' params = { 'from': yesterday, 'to': yesterday } csv_file = ('{}-{}-{}-to-{}'.format(app_id, report_type, params['from'], params['to'])) print (csv_file) with open('csv_file' +'.csv', 'r') as csvfile: ***code*** print function returns proper name but I am getting an error which says : Traceback (most recent call last): File "C:/Users/Iwan/PycharmProjects/Learning/csv_mods.py", line 20, in <module> with open('csv_file' +'.csv', 'r') as csvfile: FileNotFoundError: [Errno 2] No such file or directory: 'csv_file.csv' So I wonder how can I inject the *.csv on daily basis instead of manualy typing csv file name. If I have made any mistake in this post or question please point it out and I will do my best to avoid this in the future. Cheers, Iwan
<python><csv>
2019-12-04 21:06:25
LQ_EDIT
59,184,816
I wanted to ask about how to prevent audio, video and image files from appearing on other websites and running it only on my own site
<p>I will simply explain I don't want audio, video, and images to work only on my site Whoever has this experience I hope to benefit us</p>
<javascript><php><file><security>
2019-12-04 21:19:21
LQ_CLOSE
59,185,892
to replace the space with a comma
<p>I have a some txt file like this:</p> <pre><code>a,b,c,d: 1 2 3 4 process: 1 2 3 4 5 6 7 8 9 </code></pre> <p><strong>Do I fill in any spaces with a comma with python-pandas or python-file function?</strong></p>
<python><pandas><file>
2019-12-04 23:09:07
LQ_CLOSE
59,186,077
how to convert an object into Int64?
I am trying to merge two dataframes. because they are not the same type of data, I try to convert it into one. But I get the following error, can someone help me with this?[enter image description here][1] [1]: https://i.stack.imgur.com/W1JkV.png
<python><dataframe>
2019-12-04 23:29:12
LQ_EDIT
59,186,408
Why install symfony version 4?
<p>I want to install version 4 symfony , but when I use the compose composer-project symfony / website-skeleton demo, it is version 5 downloaded by default ?</p>
<symfony4>
2019-12-05 00:13:13
LQ_CLOSE
59,188,650
Which argument in a function is called first?
<p>I cannot figure out the reason why I am getting this result. I am not the order in which the function calls it's arguments. I would assume that it would start at the first argument and go until the last. Here's the code...</p> <pre><code>#include &lt;stdio.h&gt; int addmeup(int a, int b, int c){ printf("a:%d\n", a); printf("b:%d\n", b); printf("c:%d\n", c); return a + 2 * b + 3 * c; } int main(){ int x = 1; int y = addmeup(x++,x++,x++); printf("x:%d\n", x); printf("y:%d\n", y); return 0; } </code></pre> <p>I don't know why the result I am getting is...</p> <pre><code>a:3 b:2 c:1 x:4 y:10 </code></pre> <p>For the function <code>addmeup()</code> why wouldn't the a be 1 instead of 3? Then b would be 2 and c would be 3. But it is the opposite. Can't seem to wrap my head around this.</p>
<c>
2019-12-05 05:15:06
LQ_CLOSE
59,189,023
What is the best The IMDB REST API? Wher e can I get it from?
<p>I want access to IMDB REST API. How can I get it?</p>
<amazon><netflix><imdb>
2019-12-05 05:50:36
LQ_CLOSE
59,189,480
What do these characters in Swift mean <>. If I wrapped a keyword In them, what would that mean exactly
<p>For example if I have:</p> <pre><code>var hostingController: UIHostingController&lt;Content&gt;! = nil </code></pre> <p>What does it example mean when I put content inside the greater than and less than signs?</p>
<swift><swiftui>
2019-12-05 06:30:48
LQ_CLOSE
59,190,408
Table View Data Source in MVVM-C
<p>where should I put UITableView Data Sources (I am using RxDataSources) when using MVVM-C architecture?</p>
<swift><mvvm><rx-swift><rxdatasources>
2019-12-05 07:45:11
LQ_CLOSE
59,193,055
list comprehension even list elements instead of loop and how to refer only to the index
<p>I want to use list comp' instead of a loop. Let's sat I have a list of lists and I want only the even index elements. Eg: [[a,a], [b,b], [c,c],[g,g]] to..... [[a,a], [c,c]]</p> <p>This doesn't work</p> <pre><code> a = [i for i in the_list if i % 2 == 0)] </code></pre>
<python><python-requests>
2019-12-05 10:26:18
LQ_CLOSE
59,193,529
How to create a denormalized dataframe with the value and type coming from a set of other variables in R
<p>So I have the following dataframe:</p> <pre><code>&gt; data.frame(id=c(1,2),a=c(10,11),b=c(20,21)) id a b 1 10 20 2 11 21 </code></pre> <p>I want to create a denormalized dataframe that takes the values of two or more columns and creates two columns, one for the column that the value comes from, and other with the value itself, so the final dataframe has more rows than columns.</p> <p>The result should look like this:</p> <pre><code>&gt; data.frame(id=c(1,1,2,2),x=c(10,20,11,21),type=c("a","b","a","b")) id x type 1 10 a 1 20 b 2 11 a 2 21 b </code></pre> <p>Where the order of the values does not matter, of course.</p> <p>Thanks everyone!</p>
<r><dataframe>
2019-12-05 10:50:41
LQ_CLOSE
59,195,271
MSSQL Linux Server Issue: SQL Server only supports SAFE assemblies
<p>We recently came across an issue when trying to register some custom SQL CLR assemblies we have created on SQL Server 2017 v14.0.3238.1.</p> <p>First of all, these assemblies require that they have External Access Permission, as they call external APIs. It seems that this issue is only appearing when trying to run them on an MSSQL Server that is hosted on a Linux Environment.</p> <p>In addition, we have tried creating asymmetric keys (both with SN.exe tool from Microsoft SDKs and through VS 2017) and also signing these CLR assemblies, without any luck. (Followed instructions as found on: <a href="https://techcommunity.microsoft.com/t5/SQL-Server-Support/Deploying-SQL-CLR-assembly-using-Asymmetric-key/ba-p/316727" rel="nofollow noreferrer">https://techcommunity.microsoft.com/t5/SQL-Server-Support/Deploying-SQL-CLR-assembly-using-Asymmetric-key/ba-p/316727</a>)</p> <p>When trying to register the assemblies, we are receiving the error: "Assembly 'Sample_CLR' cannot be loaded because this edition of SQL Server only supports SAFE assemblies."</p> <p>Has anyone stumbled across a similar issue before?</p>
<c#><sql-server><linux><clr>
2019-12-05 12:32:16
LQ_CLOSE
59,195,483
Multiplocation 2 two numbers
I have an assignment to build a function that multiplies 2 numbers ( int and double ) and without using * or '-' Can only use '+' '/' and '%'. I noticed alot of people are using shifting methos but i cant use without because we didnt learn it yet. And as much as i can do it without 1 while loop easily the trick is its supposed to be in nlogn or logn runtime efficiency... No list no arrays either though i dont see any way of using them anyway. Is there any possible way of doing it ??? Thanks Bar
<c><multiplication>
2019-12-05 12:44:07
LQ_EDIT
59,197,257
How to sum a value per day and then GROUP BY YEARWEEK
If i have a database with 2 columns, date and piece and i want to first count piece per day and then group by week. How wrong is my code and how to do it? SELECT date, piece, (SELECT date, COUNT(piece) FROM t1 WHERE piece > 10 GROUP BY date ) AS sum FROM t1 GROUP BY YEARWEEK(date)
<mysql><date><count><sum>
2019-12-05 14:24:28
LQ_EDIT
59,201,827
Trying to create a view in SQL server 2014 to read the table data in a different format
I am using SQL Server 2014. Table 'X' consists of a column 'Desc2' in which data is in the format 'VT000379_001: Low Low Alarm Limit 5' 'VT000379_001_001: Low Low Alarm Limit 5' . I am trying to create a view to remove the '_001' , so the result should be as follows. 'VT000379: Low Low Alarm Limit 5' 'VT000379_001: Low Low Alarm Limit 5' The logic i have been trying is Instr =: = 12 x= left(12) = VT000379_001 if x have 1 undrscore inst = "_" position 1 =VT000379 if x have 2 undrscore inst ="_" position 2 =VT000379_001 Can someone help me out on this ? thanks sidhu
<sql><sql-server><tsql>
2019-12-05 19:08:25
LQ_EDIT
59,205,875
Error when trying to publish an azure function from Visual Studio
<p>I get the following error message when I try to publish my function using Visual Studio, any idea how to fix this?</p> <blockquote> <p>System.AggregateException: One or more errors occurred. ---> System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at Microsoft.Publish.Framework.Model.DefaultPublishSteps.&lt;>c__DisplayClass26_0.b__2() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Publish.Framework.Model.DefaultPublishSteps.d__23.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Publish.Framework.ViewModel.ProfileSelectorViewModel.d__213.MoveNext() ---> (Inner Exception #0) System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. &lt;---</p> <p>System.Exception: Publish has encountered an error. We were unable to determine the cause of the error. Check the output log for more details. </p> <p>===================</p> </blockquote>
<visual-studio><azure><azure-functions>
2019-12-06 02:10:28
HQ
59,206,364
Rewritre URL htaccsess using GET method
I have a page name ***detail.php*** which handle variable from ```GET``` method and the URL displayed will be like ```domain.com/detail.php?v=tEDdwXC2dkq```, but I want change it into ```domain.com/detail?v=tEDdwXC2dkq```. ***.htaccess*** ``` RewriteEngine On RewriteRule ^domain.com/detail.php?v=(.+)$ domain.com/detail?v=$1 ``` But it didnt work. Is there anything I missed?
<php><.htaccess><mod-rewrite><url-rewriting>
2019-12-06 03:17:16
LQ_EDIT
59,207,009
changed project from xampp folder to another folder and deleted previous xampp version
changed a working project folder to another folder and I have given permission too but now it wont work also it shows following error when I login file_put_contents(D:\Videos\htdocs\salesapp\storage\framework\views/34f87b7f19f81a3c49159deded5ed0b821a7e81d.php): failed to open stream: No such file or directory how can I solve this
<php><laravel>
2019-12-06 04:44:14
LQ_EDIT
59,207,965
Is there visibility issue in golang?
<p>For example, if I update a global variable in one goroutine, then read the variable in another goroutine, can I get the newest value?</p> <p>Another question is, can "atomic.Load*" and "atomic.Store*" ensure visibility?</p>
<go>
2019-12-06 06:26:48
LQ_CLOSE
59,210,197
problem in understanding axises in clustering
what is these two axis (Dim1(30.3%) & Dim2(19.7%)) mean? [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/vJvnX.png
<cluster-analysis>
2019-12-06 09:22:40
LQ_EDIT
59,210,250
How to concatenate this array
<p>How do i concatenate these two arrays to get the expected output?</p> <pre class="lang-js prettyprint-override"><code>let bidder= [ [1,2,3,4], [5,6,7,8] ] let arr1 = [9,10,11,12] </code></pre> <p>expected result</p> <pre class="lang-js prettyprint-override"><code>[ (4) [...], (4) [...], (4) [...], ] </code></pre>
<javascript><ecmascript-6>
2019-12-06 09:25:42
LQ_CLOSE
59,211,416
How to number values in string array with int
<p>I have some strings in string array. Now I wanna to give before first string prefix 1: string..etc</p> <p>Example:</p> <pre><code>Test Test Test </code></pre> <p>Expected result:</p> <pre><code>1. Test 2. Test 3. Test </code></pre> <p>Is that even possible? Thanks!</p>
<c#>
2019-12-06 10:33:22
LQ_CLOSE
59,211,750
iteration in javascript, nodejs
<p>I have data like : - </p> <pre><code>[ {"title": "A Hug Is Warm","id": "69","level": "4","act_title": "Alphabet","act_id": "69_1d"}, {"title": "A Hug Is Warm","id": "69","level": "4","act_title": "Recording","act_id": "69_rec"}, {"title": "A Hug Is Warm","level": "4","id": "69","act_title": "Print","act_id": "69_pr_1"}, ......... ]; </code></pre> <p>and want to return back : ......</p> <pre><code>[{ "title": "A Hug Is Warm", "id": "69", "level": "4", "activities": [{"act_title": "Alphabet",act_id": "69_1d"}, {"act_title": "Recording","act_id": "69_rec"}, {"act_title": "Print","act_id": "69_pr_1"} ] }, .......... ] </code></pre> <p>In php it is very easy to achieve using a multidimensional array.</p>
<javascript><node.js><multidimensional-array>
2019-12-06 10:54:24
LQ_CLOSE
59,212,935
how to save a Dataset[row] as text file in spark?
<p>I would like to save a Dataset[Row] as text file with a specific name in specific location. Can anybody help me?</p> <p>I have tried this, but this produce me a folder (LOCAL_FOLDER_TEMP/filename) with a parquet file inside of it: Dataset.write.save(LOCAL_FOLDER_TEMP+filename)</p> <p>Thanks</p>
<scala><apache-spark>
2019-12-06 12:11:52
LQ_CLOSE
59,213,014
Count by ID if value is lower than and set the value 1
<p>I have a problem. My table is <strong>tableXYZ</strong> I have a row <strong>a</strong> where i set the year. I have a row <strong>b</strong> where i need to set value 1 if the year from row <strong>a</strong> is lower than 2019 and 0 if is > 2019.</p> <p>After all i need to make a count from row <strong>b</strong> only the 1 values as total.</p> <p>How can i do that, because i tried a lot of examples but doesn't work.</p>
<sql>
2019-12-06 12:17:46
LQ_CLOSE
59,213,519
opposite of if condition
<p>I am trying to rewrite my if else statement so I skip the //do nothing part but I can't get my around to find the opposite of the if statement.</p> <p>someone please help?!</p> <pre><code>if (decision.equals("repay")){ String riskClass = null; if (doc.hasItem("riskclass")){ riskClass = doc.getItemValueString("riskclass"); } if ( (null == riskClass) || (riskClass.equals("")) || (riskClass.equals("repay")) ){ //do nothing } else{ //do something } } </code></pre>
<java><if-statement>
2019-12-06 12:49:48
LQ_CLOSE
59,213,848
Why these parameters applied?
<p>Applying class="container" to div causes a problem with width of div. The index takes properties from _grid.cscc. </p> <p>It should be 100% width.</p> <p><a href="https://i.stack.imgur.com/KGgXA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KGgXA.jpg" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/6tSgW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6tSgW.png" alt="enter image description here"></a></p> <p>And it's applied on every container I make</p>
<html><css><bootstrap-4>
2019-12-06 13:09:18
LQ_CLOSE
59,213,960
How to create parameters with arrays?
<p>I'm trying to set a parameter as an array, but I get "unexpected token..." at {name[2]}.</p> <pre><code>// javascript const name = ['Jin', 'Kazuya', 'Heiachi'] function Intro(name, profession, city) { document.write("My name is " + name + ", I'm a" + profession + " from" + city); } Intro({name[2]}, ' salesman', ' Chicago'); </code></pre>
<javascript>
2019-12-06 13:16:26
LQ_CLOSE