Sharath Zotis

Python

Room rules: sopython.com/chatroom Code formatting guide: tinyu...
Mar 7, 2019 02:14
Anyone have any ideas?
Mar 7, 2019 02:10
How can I go about doing this with BaseHTTPRequestHandler and HTTPServer
Mar 7, 2019 02:09
I want to write a web server with python where there is a text box and a user inputs something and I run a python function on it which gives me an output for the users input and render it on the same page, essentially like a chat with a computer
Mar 7, 2019 02:07
Hi
Feb 21, 2019 17:37
Yeah its NLP, I am not the best with python, and when it comes to generators etc. I am way out of my domain
Feb 21, 2019 17:35
return heapq.nlargest(2, candidates, key=score)
Feb 21, 2019 17:35
since I don't want to just change return statement to
Feb 21, 2019 17:29
Also since I am using segment recursively, is there a good way to handle this
Feb 21, 2019 17:27
oh I see, I will try it
Feb 21, 2019 17:25
is there a way to do with genexp?
Feb 21, 2019 17:25
list comp will probably work but will not save as much space as genexp
Feb 21, 2019 17:18
Anyone have any ideas?
Feb 21, 2019 17:16
I have this function that segments a string, and I am returning the top scoring segmentation which I have a helper function score. I am wondering how to return the top k segmentations
Feb 21, 2019 17:14
Thanks @Kevin
Feb 21, 2019 17:13
         def segment(text):
            # Return a list of words that is the best segmentation of text.
            if not text:
                return []
            candidates = ([first] + segment(rem) for first, rem in splits(text, max_length))
            return max(candidates, key=score)
Feb 21, 2019 17:12
Hi guys Im new to this chat; How to type in python code?
 

PHP

Support group for those afflicted with PHP. Don't ask to ask, ...
Aug 20, 2015 16:45
is that good for the index html file
Aug 20, 2015 16:44
<script>
	var url = sample url;
	var flag_to_set = value of the flag;
	//use $.get or $.post or $.ajax if you use jquery. For traditional javascript use  XMLHttpRequest. You will get code snippets for the same. I am using jquery $.post for the same as example.
	$.post(url,{flag: flag_to_set},function(data)
	{
	// callback for success.
	}
</script>
Aug 20, 2015 16:38
so I am requesting the php file???
Aug 20, 2015 16:38
how do i write ajax request??
Aug 20, 2015 16:37
ok
Aug 20, 2015 16:36
in index.html or php file??
Aug 20, 2015 16:36
where do i write ajax request
Aug 20, 2015 16:36
ok so thats my index.html
Aug 20, 2015 16:36
<script type="text/javascript">

	var x ="hi"

</script>
Aug 20, 2015 16:35
ok
Aug 20, 2015 16:34
I already have it set up that way
Aug 20, 2015 16:34
have that html and js in the index php
Aug 20, 2015 16:34
but is there anyway where i can have everything in one file
Aug 20, 2015 16:33
ok
Aug 20, 2015 16:33
ok
Aug 20, 2015 16:32
mysqli_query( Select user where id = x
Aug 20, 2015 16:32
where
Aug 20, 2015 16:32
then i send variable x to php
Aug 20, 2015 16:32
<script> var x = 10 </script>
Aug 20, 2015 16:32
no like
Aug 20, 2015 16:31
then execute a sql query with that variable
Aug 20, 2015 16:31
I want to send javascript variable to php
Aug 20, 2015 16:31
other way around
Aug 20, 2015 16:30
so do I just add the ajax code into my script??
Aug 20, 2015 16:30
and php is actually nested into script
Aug 20, 2015 16:30
because i need script and javascript in same page
Aug 20, 2015 16:29
@RonniSkansing will ajax keep the javascript on same page as php
Aug 20, 2015 16:29
@Ronni
Aug 20, 2015 16:29
@Ro
Aug 20, 2015 16:25
so how do I go about passing a javascript variable to php in the same .php file using ajax
Aug 20, 2015 16:24
does anybody know ajax
Aug 20, 2015 16:22
ok
Aug 20, 2015 16:21
I need to run a sql query in php with the content of a javascript variable
Aug 20, 2015 16:21
wait let me rephrase