• Breaking News

    Saturday, November 3, 2018

    What graphics interface/api came after mode13h? Ask Programming

    What graphics interface/api came after mode13h? Ask Programming


    What graphics interface/api came after mode13h?

    Posted: 03 Nov 2018 03:52 PM PDT

    So in the 80s and early 90s if you wanted to write a DOS GUI application you'd use 16 bit real mode and use int 10h with al set to 0x13. You'd have a 320x200 screen to draw on in pixel mode. What graphics technology succeeded this?

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

    Opening a YML file with Java

    Posted: 03 Nov 2018 07:30 PM PDT

    I have a YML file I'm opening with events that have characteristics, is there a better way to extract them rather than reading everything into into a List then dealing with each line?

    tasks: - id: 1 description: Thing 1 start: "08:30" duration: 30 compatibility: - 2 - 3 - id: 2 description: Thing 2 start: null duration: 20 compatibility: - 1 - id: 3 description: Thing 3 start: "08:40" duration: 15 compatibility: - 1 

    Edit: Currently using the following to parse the YML -

    try (Stream<String> stream = Files.lines(Paths.get(fileName))) { list = stream .filter(line -> !line.startsWith("tasks:")) .map(String::trim) .collect(Collectors.toList()); } catch (IOException e) { e.printStackTrace(); } 
    submitted by /u/corwin_of_amber_
    [link] [comments]

    Cold Pinky Fingers while programming

    Posted: 03 Nov 2018 10:03 PM PDT

    I totally understand if this gets removed because it isn't exactly programming. But just throwing this out there; does anyone else get cold pinky fingers while programming? I've been sat here at home programming for about 6 hours, and I've just noticed my pinkies are freezing cold. I wonder if my lack of using them causes them to go cold? My left pinky tends to do left shift only, but right doesn't really have a job. While the rest of my fingers and thumbs all have areas of the keyboard that they use.

    It's also 5am (as I say been programming since 11pm), so apologies if this is a bit of an odd post; I don't feel 100% with it!

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

    Is Git Bash as effective as using the Bash Shell on a Macbook?

    Posted: 03 Nov 2018 10:02 PM PDT

    I'm going to be attending a coding bootcamp very soon, and they heavily recommended me to use a Mac because most of the testing environment is going to be done via the Bash Shell. I have Git Bash installed into my Windows laptop, so I was wondering if that'll do the job.

    submitted by /u/k-hiroshi
    [link] [comments]

    [Prolog] How to compare two variables.

    Posted: 03 Nov 2018 10:02 PM PDT

    I'm writing a definition that compares the birth and death date of two individuals to see if they were alive at the same time.

    This is what I have so far

     contemporaryOf( Person, Contemp ):- lifespan( Person, BornA, DiedA ), lifespan( PersonB, BornB, DiedB ), 

    I'm not sure how to actually compare the Born, and Died variables inside of lifespan, would someone be willing to help me out? I don't need help with the logic, just syntax.

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

    Performing a unit test for a class ?

    Posted: 03 Nov 2018 09:50 PM PDT

    Hey guys, I am working on a project were I have been asked to perform a unit test for a class. I have written a simple GUI project in Visual Studio using C#. I have done some research on unit testing but am unable to figure out were to start with the code I have written. Any help or guidance in the right direction would be much appreciated. Thanks using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } public void btnOpen_Click(object sender, EventArgs e) // Created OpenFileDialog control using a Forms designer at design-time { openFileDialog1.ShowDialog(); //called the ShowDialog method to browse a selected file txtfilepath.Text = openFileDialog1.FileName; BindDataCSV(txtfilepath.Text); //set data into textfilepath } private void BindDataCSV(string filePath) { DataTable dt = new DataTable(); //opened an instance of Datatable string[] lines = System.IO.File.ReadAllLines(filePath); //ReadAllLines gets a string array from the file if (lines.Length > 0) { //first line to create header string firstline = lines[0]; //reads first line of string array at index 0 string[] headerLabels = firstline.Split(','); //splits the firstline using comma delimited string foreach (string headerWord in headerLabels) { dt.Columns.Add(new DataColumn(headerWord)); //added DataColumns for header } //for data for (int r = 1; r < lines.Length; r++) { string[] dataWords = lines[r].Split(','); //split strings into lines DataRow dr = dt.NewRow(); //inset a new row into a data table int columnIndex = 0; //start of column is 0 index foreach (string headerWord in headerLabels) { dr[headerWord] = dataWords[columnIndex++]; //increment the value by 1 in columnIndex } dt.Rows.Add(dr); //adds DataRow in the DataTable } } if (dt.Rows.Count > 0) { dataGridView1.DataSource = dt; } } private void btnSave_Click(object sender, EventArgs e) { // Displays a SaveFileDialog so the user can save the Image SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "|*.csv"; saveFileDialog1.Title = "Save CSV File"; saveFileDialog1.ShowDialog(); // If the file name is not an empty string open it for saving. if (saveFileDialog1.FileName != "") { using (StreamWriter sw = new StreamWriter(saveFileDialog1.FileName)) { WriteDataTable(dataGridView1.DataSource as DataTable, sw, true); } } } // Write data to csv public static void WriteDataTable(DataTable sourceTable, TextWriter writer, bool includeHeaders) { if (includeHeaders) { List<string> headerValues = new List<string>(); //opened an instance of List<T> for headerValues foreach (DataColumn column in sourceTable.Columns) { headerValues.Add(QuoteValue(column.ColumnName)); } writer.WriteLine(String.Join(",", headerValues.ToArray())); } string[] items = null; // if string array is null or empty foreach (DataRow row in sourceTable.Rows) { items = row.ItemArray.Select(o => QuoteValue(o.ToString())).ToArray(); writer.WriteLine(String.Join(",", items)); // adds rows to the array and joins comma delimited strings } writer.Flush(); } private static string QuoteValue(string value) { return String.Concat("\"", value.Replace("\"", "\"\""), "\""); } } } 
    submitted by /u/vecjar
    [link] [comments]

    HTTP Authorization trough C# for dropbox

    Posted: 03 Nov 2018 06:00 PM PDT

    I can't use the dropbox api or anything else. I'm using xamarin forms and the .net api doesn't work there. I've tried WebClient and HttpClient I am using this https://www.dropbox.com/developers/documentation/http/documentation#oauth2-token I can do upload and download but not the create token

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

    [Android] Is there any way to see what URL is requested by pressing a button?

    Posted: 03 Nov 2018 03:01 PM PDT

    Dumb question probably but is there any way when I'm in an app and I press a button to see what URL is requested by that button press? Is there any way to inspect that? If there isn't, theoretically we could still inspect the bytecode and based on that difficultly but get access to the URL that is requested or am I totally wrong?

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

    Send fax automatically with one click?

    Posted: 03 Nov 2018 08:48 PM PDT

    I occasionally need to use an incoming fax # (very low volume) and the only free solution I've found is an online service. The downside (in addition to low maximum incoming volume, which isn't much of a downside since I don't use it much) is it needs to receive one fax per week to remain open. Is there a way to send a fax to a number with one click of the mouse, perhaps using one of the numerous free fax sending services on the web (some of which don't even require an image to check for robots)?

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

    Python Image Tracer

    Posted: 03 Nov 2018 04:22 PM PDT

    I am trying to create an "auto rotoscoper" of sorts in Python and for that I need to trace each frame of a video to make an animation. I looked online on how to trace an image in Python but I didn't find answers that were very clear (at least to me). Does anyone know how I would go about tracing an image in Python. Thanks!

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

    Homework Help With Linked Lists

    Posted: 03 Nov 2018 07:05 PM PDT

    I'm trying to understand how to fix my code. I figured it out until I reached public class LinkedListEnumerator<T> : IEnumerator, where I've been stuck for most of the time.

    namespace MyIEnumerableClass

    {

    public class MyLinkedListNode<T>

    {

    public MyLinkedListNode<T> NodeLeft { get; set; }

    public MyLinkedListNode<T> NodeRight { get; set; }

    public T Element { get; set; }

    }

    public class LinkedListGeneric<T> : IEnumerable

    {

    private MyLinkedListNode<T> headNode = null;

    private MyLinkedListNode<T> tailNode = null;

    private int MyLinkedListCount = 0;

    public void AddTail(T element)

    {

    var thisNode = new MyLinkedListNode<T>

    {

    Element = element

    };

    if (headNode == null)

    {

    headNode = thisNode;

    tailNode = thisNode;

    }

    else

    {

    tailNode.NodeRight = thisNode;

    tailNode.NodeLeft = tailNode;

    tailNode = thisNode;

    }

    MyLinkedListCount++;

    }

    IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();

    public LinkedListEnumerator<T> GetEnumerator() =>

    new LinkedListEnumerator<T>(headNode, tailNode);

    }

    public class LinkedListEnumerator<T> : IEnumerator

    {

    private MyLinkedListNode<T> headNode = null;

    private MyLinkedListNode<T> tailNode = null;

    private int MyLinkedListCount = 0;

    // Enumerators are positioned before the first element

    // until the first MoveNext() call.

    private int position = -1;

    /// <summary>

    /// Constructor overload used to reference _employee into the EnumeratedArrayList _employee

    /// </summary>

    /// <param name="list"></param>

    public LinkedListEnumerator(LinkedList<T> headNode, tailNode) => headNode = null; tailNode = null;

    /// <summary>

    /// Moves the position up by one

    /// </summary>

    /// <returns></returns>

    public bool MoveNext() => (position++ < .Count);

    /// <summary>

    /// Resets position to -1

    /// </summary>

    /// <param name="list"></param>

    public void Reset() => position = -1;

    /// <summary>

    /// Returns current list

    /// </summary>

    object IEnumerator.Current => Current;

    public T Current

    {

    get

    {

    try

    {

    return (T)_genericArrayList[position];

    }

    catch (IndexOutOfRangeException)

    {

    throw new InvalidOperationException();

    }

    }

    }

    }

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

    Good way to learn just the basics of mysql?

    Posted: 03 Nov 2018 08:41 AM PDT

    I've got a job beginning in 2 weeks that's not a 100% programming related, but does use something Similar to mySQL for data manipulation that's built in house. I would really enjoy if someone could point me in the right direction.

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

    transfere to anazon s3

    Posted: 03 Nov 2018 06:12 PM PDT

    i have a web site witch sells videos and photos online so because they take to much space on the server i figured out to send them to amazon s3 and to be i have a script and cron task but the problem is that the script don't make the bins in s3 when i press test it makes a test bit in s3 but don't transfers the file it should make one preview bin and one regular bin for saving the media

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

    Failed to execute script error (help fast please)

    Posted: 03 Nov 2018 05:45 PM PDT

    So I have some program with an .exe file which I can run with no problems along with a few others. However, two guys have had an error pop up. One of them was able to run it with sandbox, the other one can't.

    What can be done about this? These guys have python installed, but maybe they are missing something. I would really appreciate help fast.

    BTW I'm not a programmer, so take that into account.

    The error just says '' failed to execute script toolcli''

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

    Floating Point Standards

    Posted: 03 Nov 2018 05:14 PM PDT

    Hi all,

    We've covered floating point binary as part of the computer science A-Level curriculum, and I went away today to look some stuff up to be greeted with information that, in-part, contradicts what we've learnt. We're taught as follows:

    First -> Nth bit = mantissa (-(20), 2-1, 2-2, 2-3) Nth -> last bit = exponent (-(2x), 2x-1, 2x-2 .. 2x-x)

    Both are signed as two's complement binary, and the mantissa can be normalized.

    Mantissa is then multiplied by 2 raised to the exponent

    However, looking online, people state the IEEE 754 is prominent, which has the first bit as a 'sign' (which also appears to contradict what we're taught of the use of two's complement being prominent and highly beneficial over sign-magnitude), the next N bits as exponent and then the final bits as mantissa.

    Have I mis-read the IEEE 754, or are there multiple 'standards' by which people run, or is this just a general misinformation? Are there significant advantages to one or the other? Looking around, people agree this is what's on the A-Level specification and not the IEEE 754 representation, so I'm certain it's not misinformation that'll drop me marks.

    Thanks

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

    "python: int object is not subscriptable" problem

    Posted: 03 Nov 2018 05:07 PM PDT

    firstName =[]

    lastName = []

    studentNum = []

    assnGrade = []

    mdtrmGrade = []

    exmGrade = []

    x = 0

    data = open("studentinfo0.txt").read().splitlines()

    print(data)

    length = int(len(data)/6)

    print(length)

    for data in range(0,length):

    firstName.append(data[x])

    x += 1

    lastName.append(data[x])

    x += 1

    studentNum.append(data[x])

    x += 1

    assnGrade.append(data[x])

    x += 1

    mdtrmGrade.append(data[x])

    x += 1

    exmGrade.append(data[x])

    x += 1

    print(firstName)

    I am given the error:

    "firstName.append(data[x])

    TypeError: 'int' object is not subscriptable"

    please help.

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

    [Java] Changing the value of multiple variables by changing only one field.

    Posted: 03 Nov 2018 09:32 AM PDT

    I have a large collection of doubles and in this collection there is a subcollection of special variables that are all initially set to the same value. After some time I want to change the value of all of these special variables, but for efficiency I also don't want to iterate over the entire collection and change them one by one. I've tried using the double wrapper class, but apparently it's immutable, so I cannot just reference one instance of Double and change that. I thought about making my own mutable double wrapper class, and this works, but ideally I want the code to be as compatible with the primitive type double as possible.

    Is there any way to do something akin to this following C code in Java?

    int a = 0; int* b = &a; 

    Here I only have to worry about the dereferencing.

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

    Getting out of a pair of quotes in Visual Studio 2017?

    Posted: 03 Nov 2018 10:17 AM PDT

    I'm just learning UWP, and I'm having to write a lot of " for the XAML.

    Now, Visual Studio 2017 automatically creates a closing ", but that means I have to reach away from the home keys to press the right cursor key to get out of that pair.

    Additionally, this method doesn't seem to work:

    https://stackoverflow.com/questions/13947886/how-do-you-move-the-cursor-past-the-closing-quotes-when-typing-property-values-i

    Anyone got an answer for this? Would really appreciate it.

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

    Program throws up error when moving mouse off of array of picture boxes (Visual Studio 2010)

    Posted: 03 Nov 2018 01:11 PM PDT

    [Python] Function to print dictionaries with an unspecified amount of dictionaries as parameter

    Posted: 03 Nov 2018 01:38 AM PDT

    Hey folks,

    I've kind of hit a wall here.

    What I'm trying to create is a function that will first print the title of a dictionary and then below that every key of that dictionary together with it's value.

    It should be able to do this for an unspecified amount of dictionaries, My current solution is to first give a list of names as a parameter and then use *args to input the dictionaries. As you can see here in my code:

    https://github.com/mauritscottyn/eigenOef/blob/master/oef3.py

    Now this works just fine but I find it is very prone to user errors as it fully relies on the user entering the names in the list in the same order he inputs the dictionary into the function.

    So what I'm looking for here is a way to integrate the dictionary names better into my function so that it won't be reliant anymore on the user entering everything in the right order.

    I hope I was able the phrase my question kind of clear, English is not my first language.

    Thanks!

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

    C scanf Question

    Posted: 03 Nov 2018 09:55 AM PDT

    Hello, I am new to C programming and I'm having problems with two of my scanf functions (the postal code and city) for my program. I also tried fgets but it still doesn't work. The screenshot of my code is here. Thanks

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

    Best way to store this data? SQL or Json?

    Posted: 03 Nov 2018 08:47 AM PDT

    Hey guys, I am working on a little project that will be a guide for a video game. Basically I want to show where every item in the game is located in a nice web ui. I don't do much SQL so was wondering if there was a better way to store this information.

    It basically looks like this right now. "Items - id, name", "Maps - id, name", "ItemLocations - itemId, mapId".

    The trouble is when I go to add a new item/map to the ItemLocations table, I have to scroll through hundreds of mapIds to find the correct one. There aren't nearly as many items, so that part is easier. Is there a more efficient way of doing this? Thanks in advance!

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

    In my Bash script, splitting strings is leading to odd results. What am I doing wrong?

    Posted: 03 Nov 2018 12:16 AM PDT

    Here is my script: https://paste.kde.org/phtyebw6h

    I have a file that has a list of packages in the order I wish to build, but I want selected packages to built in their default directory on the harddrive, so I don't have to recompile, say, 2200 files from scratch, but only recompile what changed. Otherwise, they build in tmpfs. If the line being read has :1, it gets compiled on the harddrive, otherwise if not, on tmpfs.

    Example file: https://paste.kde.org/pu8ebcozv

    The maddening thing is, if that :1 exists, then all lines that are next looped over are built in the harddrive directory, and not tmpfs. Even if I unset the variable or set it to empty, this still occurs.

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

    No comments:

    Post a Comment