• Breaking News

    Saturday, February 24, 2018

    Path Cost in AI Programming Ask Programming

    Path Cost in AI Programming Ask Programming


    Path Cost in AI Programming

    Posted: 24 Feb 2018 07:28 PM PST

    Hello,

    I'm taking an AI class. We've gone over various search strategies. My question is how does path cost come to be when it comes to implementing an AI Program? In lectures, it's straight forward as it is just the number on the edge connecting the two nodes.

    Say in a bejeweled like game (meet a score quota under a specified number swaps), we'd start off with the initial state. Then every resulting board from a valid swap will be the successor nodes to that initial state. It goes on and on etc. I am wondering how the path cost to these successor nodes are determined?

    submitted by /u/LetsSendHope
    [link] [comments]

    Is there a way to hint to the operating system defragmenter to keep files together sequentially?

    Posted: 24 Feb 2018 09:13 PM PST

    Let's say my program has 10 files 1gb each, and every time it access the files in order. Is there a way I can hint to the operating system to keep the files together in order to minimize seek time?

    submitted by /u/whyam-i-onreddit
    [link] [comments]

    [C#] Writing a big dataset to Excel

    Posted: 24 Feb 2018 09:00 PM PST

    I'm working on a program to load data from Facebook, throw it through some APIs and put the end results in an Excel sheet

    The index of pages with their albums, with their pictures and the ID, name and date of each picture is currently written to a JSON file (serialized from an object), and said JSON file is about 2MB. The total memory usage for my program at this point is about 25MB.

    What needs to happen now is processing this data, pulling the data it needs off Facebook and writing all the relevant picture info from Facebook to an Excel sheet so that it can later add the details the API returns to that same sheet. The end result is going to be one massive Excel sheet with the relevant data, ready for the selective processing that will be done on the data.

    Where I'm getting stuck now is that there is no way I can keep all the info in memory and save it to Excel all at once. Excel's format doesn't seem to like appending raw data to the end either.

    Is there an existing solution for this, or does anyone have any ideas about how best to approach this?

    submitted by /u/cS47f496tmQHavSR
    [link] [comments]

    Java not printing .00

    Posted: 24 Feb 2018 08:37 PM PST

    Hey just a quick question!

     x4 = keyboard.nextDouble(); DecimalFormat df = new DecimalFormat("#.00"); df.format( Math.round(x4 * 100.0)/100.00); x4 = Math.round(x4 * 100.0)/100.00; 

    When I print this out it just gives me 30.0 and I need it to be 30.00. How do I fix it?

    submitted by /u/unknownplayer44
    [link] [comments]

    If a website doesn't provide an API is it illegal to scrape data from it?

    Posted: 24 Feb 2018 04:13 PM PST

    Lets say I wanted to make an app that displays my University's dining plan account transaction history in a better, more mobile friendly manner.

    There is no public API for doing this (that I know of) so I am going to have to scrape the data from the website manually.

    The user will still be in control of their data, and whether they want to get their account info. From a legal perspective how is this any different from them just using a web browser themselves? Is it legally different then them using a web browser I created?

    submitted by /u/CalebKierum
    [link] [comments]

    Which "future proof" language to pick?

    Posted: 24 Feb 2018 11:55 AM PST

    I've been programming in Python for quite a while (about 3 years) and also started doing some projects in Javascript (webdev in nodejs). I'm mainly using Python for data crunching, analysis and I think Im going to head into that direction (Machine Learning, Stats etc.). However Im looking for a language that I can add to my skillset along with JS and Python, which can do better things that the other two lack. I was thinking of taking up some newer language, something that will be a big thing in the future. Anyone could recommend me something? I tried Java already but it didnt appeal to me. Same goes for R and since Python can do similar things as R and even more therefore Im not really interested in those two languages.

    submitted by /u/datapim
    [link] [comments]

    What is the difference between data scientist and statistician?

    Posted: 24 Feb 2018 08:14 AM PST

    Is this my uml class diagram?

    Posted: 24 Feb 2018 10:21 AM PST

    so I'm new to this and I made this really simple chat application and wanted to see a UML class diagram and used SimpleUMLCE plugin on Android Studio to do it. The result is basically all my classes but none of them are connected to eachother only one of my classes is connected with an aggregation arrow to an other class. Also if I add extended classes they are then all connected to AppCompatActivity class. Can that be my actual UML class diagram or should I try using an other plugin? https://i.stack.imgur.com/qSsx0.png

    submitted by /u/v13us0urce
    [link] [comments]

    What am I doing wrong?

    Posted: 24 Feb 2018 05:25 PM PST

    i made a simple batch script, just when I was bored, I made it so you type my favourite color, blue. If you type that it does pause then exits, any help? my code it here: https://gyazo.com/7644c283e3818f4d2f8b29c62585e01b thanks!

    submitted by /u/ALEXander113344
    [link] [comments]

    Help with multiple averages in SQL

    Posted: 24 Feb 2018 04:37 PM PST

    For the last part in one of my labs, I need to query a database that has a list of schools (identified with a specific number: sch_num) and average a specific school's student grades for five different courses and do this for the past 7 years. The table schema is as follows:

    sch_year, div_num, sch_num, race, gender, disabil, lep, disadva, subject, test_name, test_level, avg_score, pass_advn, pass_prof, pass_rate, fail_rate

    I realize I just need to somehow call AVG on avg_score for each year and WHERE subject = 'Whatever' but I can't seem to figure out how I can have a resulting table that has 7 rows. The first column is just the year, with the corresponding columns being the average test scores for that year. Pls help.

    UPDATE:

    I've written the following query

    SELECT DISTINCT sch_year, (CASE WHEN sch_num = 140 AND subject = 'ENGR' THEN ROUND(AVG(avg_score)) END) AS engr FROM sol_test_data GROUP BY sch_year, sch_num, subject ORDER BY sch_year;

    It works well (for the one subject I'm working on) but instead of having the 7 rows with the years and average test grades, it has 14 rows. 7 of them have the correct output, but I also get 7 rows that display the year and a null value in the ENGR column. I'm not sure why it would return that. I've tried to get rid of it by doing HAVING engr IS NOT NULL, but that doesn't get rid of the null rows

    submitted by /u/SwaggyC1
    [link] [comments]

    Help with Python homework

    Posted: 24 Feb 2018 04:10 PM PST

    I'm working on a question that requires the use of recursion on python. The code is supposed to take two binary numbers, such as 10010 and 11010 and return another binary number that is the result of ANDing the two values. For example, the two numbers I said before would return 10010. This is my current code:

    def bitwise_and(b1, b2): """ giving the ANDed output of two binary inputs b1 and b2 """ rest = bitwise_and(b1[:-1], b2[:-1] if (b1[-1]) or (b2[-1]) == '0': return rest + '0' else: return rest + '1' 

    But i keep getting an error when trying to run it. Can anyone help me out?

    submitted by /u/rooselboi
    [link] [comments]

    How do you backup your computer?

    Posted: 24 Feb 2018 03:12 PM PST

    I was using a WD Passport for a few years, but I've had issues on and off with the computer actually mounting the drive. Today I'm having that issue, but this time I can't get it to work. I've tried 3 other computers and same issue.

    I would use cloud storage, but I have sensitive information that I don't trust on the cloud. Can people offer me some recommendations?

    Thanks

    submitted by /u/FlandersFlannigan
    [link] [comments]

    [RAPTOR] Ranges Question

    Posted: 24 Feb 2018 03:04 PM PST

    Greetings!

    Read up on ranges in programming and was wondering if it is possible to have multiple variables in a single assignment in Raptor. I've looked at the textbook for programming and it seems that it wants me to assign values to a specific range and determine whether my current value is greater, less than or equal to that value to determine the bonus. I've created a raptor program here that sort of solves the problem but wanted to know if there was any other method. Tried googling and looking it up but to no avail. Thank you and have a great weekend!

    Problem Diana Lee, a supervisor in a manufacturing company, wants to know which employees have increased their production this year over last year so that she can issue them certificates of commendation and bonuses. Design a Raptor flowchart for following:

    A program that accepts each worker's first and last names, this year's number of units produced, and last year's number of units produced. Displays the name and a bonus amount. The bonuses will be distributed as follows:

    If this year's production is greater than last year's production and this year's production is:

    1,000 units or fewer, the bonus is $25 1,001 to 3,000 units, the bonus is $50 3,001 to 6,000 units, the bonus is $100 6,001 units and up, the bonus is $200

    submitted by /u/talktome122
    [link] [comments]

    Java: Summing a sequence of fractions to a limit n

    Posted: 24 Feb 2018 10:08 AM PST

    I'm in an intro Object Oriented Programming class, and was given the following assignment: Write a full Java program Prj_sequenceSum that prints terms of the following mathematical sequence: 1 + 1/2 + 1/3 + 1/4...

    The following is the output from the program execution when 2.0 is entered by the user (2.0); 1 + 1/2 + 1/3 + 1/4 = 2.083

    Your program should accept a real number from the user representing a limit, and should add and print terms of the sequence until the sum of terms meets or exceeds that limit. For example, if your user enters 2.0, print terms until the sum of those terms is at ≥ 2.0. You should round your answer to 3 digits past the decimal point. This is what I have for my code which I know is not right, as I'm not getting the desired output values, but I'd like some advice on how to head in the right direction. Remember I am only in a beginner course please be nice :)

     import java.text.DecimalFormat; import java.util.Scanner; public class Prj_sequenceSum { public static void main(String[] args) { // TODO Auto-generated method stub DecimalFormat decFor= new DecimalFormat("0.000"); Scanner console= new Scanner(System.in); System.out.println("Please enter value"); double value= console.nextDouble(); double n= 0.0; double x= 1.0; do {System.out.println(decFor.format(1/x)+(1/x++));} while (x==1); } } 
    submitted by /u/emaaha50
    [link] [comments]

    Wordpress REST API, Oauth1, and python requests not working

    Posted: 24 Feb 2018 08:53 AM PST

    I am having a very odd issue that I cannot seem to solve:

    I have set up the REST API and an Oauth1 server on my wordpress site.

    I had previously been able to use the python requests library to connect to the server and upload new posts, however, I revisted the code 2 months later and it now doesn't work. The error response says: b'{"code":"json_oauth1_signature_mismatch","message":"OAuth signature does not match","data":{"status":401}}'

    I can connect to the Oauth1 server and upload new posts to my site via the Postman HTTP request builder, so it seems that the site is not the problem.

    The code cannot be the problem either as I have not changed it in the past 2 months since it was last working well. Also I have tested it on a locally hosted wordpress installation and it works fine.

    A stripped down version of the code looks like this:

    import requests from requests_oauthlib import OAuth1 OAuth_credentials = { 'client_key': 'X', 'client_secret': 'X', 'resource_owner_key': 'X', 'resource_owner_secret': 'X' } auth = OAuth1(*OAuth_credentials.values()) headers = { 'Content-Type': 'application/json', 'Accept': 'application/json' } data = { 'title': 'title' } response = requests.request( 'POST', 'https://www.X.com/wp-json/WP/v2/posts/', headers=headers, auth=auth, json = data ) 

    It seems so strange to me that Postman is working but the python requests library isn't working. I can only think that I must have changed something on my site such as htaccess, but I have had no luck with that line of enquiry.

    My .htaccess looks like this:

    # BEGIN HTTPS Redirection Plugin <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP:Authorization} ^(.*) RewriteRule .* - [e=HTTP_AUTHORIZATION:%1] RewriteBase / RewriteRule ^index\.php$ - [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L] </IfModule> # END HTTPS Redirection Plugin # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress 

    Can anyone suggest what the problem might be?

    submitted by /u/SackOfTrout
    [link] [comments]

    Wanna try out an interesting contest by Pragyan?

    Posted: 24 Feb 2018 06:20 AM PST

    How can my code create a code and call it, in C?

    Posted: 24 Feb 2018 03:09 AM PST

    I am beginner in programming and in C. I want to create a "machine-learning" rubik's cube 2x2x2 solver. In first place, the solution of cube, will be accomplished, by random cube's rotaions. I want to save somehow these steps, of the first way to solution. How could I create a file that contains a part of code, outside the main code, that includes the commands of the first solution,so I can call it,in the second time, I ll run the program? Is that even possible?

    submitted by /u/n_trz
    [link] [comments]

    Generating Stack based bytecode from TAC?

    Posted: 24 Feb 2018 04:35 AM PST

    Hello!

    I want to use Three Adress Code (TAC) as an IR for my Interpreter, because it enables a lot of optimizations (and enables me to use SSA later on), however, my final goal is to generate stack based bytecode for a custom VM.

    How do I transform a TAC into a Stack based bytecode ? Is it simply a matter of transforming temporaries into local variables? Example :

    t1 = 3 + a a = t1 + 2 

    With this method, it translates to

    const 3 load a add store t1 load t1 const 2 add store a 

    But this is inefficient. I store t1 just to load it back at the next line. We can eliminate both of theses lines ! (But this is not a generality, because t1 might be used later and if it's value isn't updated it creates bugs) There must be a better way to do it, no?

    Another idea would be to stick to stack-based bytecode all along and perform optimizations on it, but I don't think I'll be able to use SSA then ? (Or will I? Could be an interesting challenge !) I think I should be able to perform most optimizations (Constant propagation/folding,..) on a stack based code if I keep it fairly high level (and separate it into basic blocks and use a CFG) before translating it to the final form. (For instance, don't bother with generating the method table and constants table before the final step).

    So, the final questions:

    • Should I use TAC ? If yes, how do I generate efficient stack based code from a TAC?
    • Should I use Stack based bytecode ? If yes, is it possible to perform the most important optimizations on said code, or even use SSA?

    I think both options will create interesting challenges, but TAC seems more problematic in my opinion, and might force me to generate inefficient bytecode.

    Thanks!

    submitted by /u/Kywim
    [link] [comments]

    Finding a person based on a photos

    Posted: 24 Feb 2018 07:00 AM PST

    is there a script that, based on the photos of a person in the X folder, searches for that person/similar in the Y-folder with other photos?

    submitted by /u/Ellaey
    [link] [comments]

    No comments:

    Post a Comment