• Breaking News

    Thursday, April 26, 2018

    For those of you who got into programming as a career without going to a university or college, how did you work your way up to where you are today? Do you think more people would be better off attending an actual college to gain more in-depth knowledge? Ask Programming

    For those of you who got into programming as a career without going to a university or college, how did you work your way up to where you are today? Do you think more people would be better off attending an actual college to gain more in-depth knowledge? Ask Programming


    For those of you who got into programming as a career without going to a university or college, how did you work your way up to where you are today? Do you think more people would be better off attending an actual college to gain more in-depth knowledge?

    Posted: 26 Apr 2018 09:10 AM PDT

    Looking for Java implementation of TripleDES

    Posted: 26 Apr 2018 06:26 PM PDT

    I am looking for an implementation of the TripleDES/DESede algorithm in Java that does not use the built-in Java packages for my undergraduate research project. Googling turned up pretty little, even in terms of good implementation using those packages. I need to test an implementation of the algorithm that does not rely on these packages so I can isolate the process. If anyone has one they'd be willing to share or can point me to a site where I might find one (other than GitHub of course), I would very much appreciate it!

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

    How can I learn about programming?

    Posted: 26 Apr 2018 06:21 PM PDT

    I understand that there are great resources for free to learn basic programming.

    What are some that would be highly recommended?

    I'd need to start at the basic and would like to know what to learn and how to build upon it.

    Thanks for any help, link/ referrals etc.

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

    C: Resizing an image stored as a 'strided' array: can I make this bilinear interpolation faster?

    Posted: 26 Apr 2018 02:26 PM PDT

    I have a piece of C code that is part of a public repository (Darknet) which is supposed to resize an image using bilinear interpolation. Because of the way the rest of the code deals with images, the image is stored as a one-dimensional array where the pixel values from the original 3 channel image are read in strides. The value corresponding to pixel (x, y, k) (x: column, y: row, k: channel) is thus stored in the location x + w.h + w.h.c in the 1D array.

    The resize function that is actually part of Darknet is taking a considerable amount of time in the pre-processing stage, possibly because of its nested for loops that iterate over the rows and columns and attempt to access corresponding values, as well as possibly the type conversions: hence I am trying to create a more optimized version of it. The original code for resizing is as follows. im is the original image, thus im.w and im.h are the original width and height. w and h are the target width and height.

    image resize_image(image im, int w, int h) { image resized = make_image(w, h, im.c); image part = make_image(w, im.h, im.c); int r, c, k; float w_scale = (float)(im.w - 1) / (w - 1); float h_scale = (float)(im.h - 1) / (h - 1); for(k = 0; k < im.c; ++k){ for(r = 0; r < im.h; ++r){ for(c = 0; c < w; ++c){ float val = 0; if(c == w-1 || im.w == 1){ val = get_pixel(im, im.w-1, r, k); } else { float sx = c*w_scale; int ix = (int) sx; float dx = sx - ix; val = (1 - dx) * get_pixel(im, ix, r, k) + dx * get_pixel(im, ix+1, r, k); } set_pixel(part, c, r, k, val); } } } for(k = 0; k < im.c; ++k){ for(r = 0; r < h; ++r){ float sy = r*h_scale; int iy = (int) sy; float dy = sy - iy; for(c = 0; c < w; ++c){ float val = (1-dy) * get_pixel(part, c, iy, k); set_pixel(resized, c, r, k, val); } if(r == h-1 || im.h == 1) continue; for(c = 0; c < w; ++c){ float val = dy * get_pixel(part, c, iy+1, k); add_pixel(resized, c, r, k, val); } } } free_image(part); return resized; } 

    Is there a way to make this function faster: for instance, by creating a more optimized way to access the pixels instead of this strided read? Also, I note here that in my case:

    1. The dimensions of the source and resized images will be fixed, so my 'custom' resize function does not have to be size-independent. I am going from 640x360 to the dimensions 626x352.

    2. The target platform is an NVIDIA Jetson with an ARM CPU, so instructions like AVX2 are not applicable in my case. But I do have access to CUDA.

    Any suggestions in improving this routine would be very helpful.

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

    [Visual Basic 2017] I've synced my access database up with my project but I cant seem to get it to save any changes I make to the records

    Posted: 26 Apr 2018 09:26 PM PDT

    If I edit any data that's already in the database through my system, I will click save and then when I restart the program, the data is the same as before I changed anything, Heres the sub for the save button https://pastebin.com/WpiL5rDG I used this youtube video to make this bit of code https://youtu.be/IShHHzwaNz8?t=10m15s Please excuse any typos, its 5:25am

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

    Building a simple Portal to Manage Performance Test Data

    Posted: 26 Apr 2018 09:00 PM PDT

    Hi All, Performance Tester here!

    I tend to work with a lot of systems that require tracking data across users and workflows

    To do this I'm currently using a MySQL Database and with SQL Queries directly in the Performance Test Script (Loadrunner / c) which isn't ideal. (Slow, convoluted, etc). I'm hoping to build something on the latest tech which would be lightweight, Easy to deploy and configure. Ideally this would use a web front end or REST/SOAP calls. I've been researching all the new tools such as Node.JS, React, Angular, etc however I'm not sure what is ideal.

    In aid of my research, I'm hoping to get some advice from programmers who have worked with these new tech trends to help my decision making process.

    Many Thanks!

    submitted by /u/89jase
    [link] [comments]

    Trying to find info on an obscure file type .tid

    Posted: 26 Apr 2018 08:49 PM PDT

    I'm trying to find information about an obscure file type called .tid. Has any1 ever heard of this file type before and know how to extract it or read it?

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

    Data structure problem

    Posted: 26 Apr 2018 08:37 PM PDT

    Hey guys I wonder if someone can help me, I need to save in an m-ary three in a sublist, the given spanning three and I need too ask for the root This is the code for the adyacency list

    include<stdio.h>

    include<stdlib.h>

    int i,j,k,a,b,u,v,n,ne=1; int min,mincost=0,cost[9][9],parent[9];

    int find(int); int uni(int,int); int main() {

    printf("\n\tImplementation of Kruskal's algorithm\n"); printf("\nEnter the no. of vertices:"); scanf("%d",&n); int matriz[n][n]; printf("\nEnter the cost adjacency matrix:\n"); /*for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { scanf("%d",&cost[i][j]); if(cost[i][j]==0) cost[i][j]=999; } }*/ cost[1][1]=999; cost[1][2]=10; cost[1][3]=999; cost[1][4]=30; cost[1][5]=100; cost[2][1]=999; cost[2][2]=999; cost[2][3]=50; cost[2][4]=999; cost[2][5]=999; cost[3][1]=999; cost[3][2]=999; cost[3][3]=999; cost[3][4]=999; cost[3][5]=10; cost[4][1]=999; cost[4][2]=999; cost[4][3]=20; cost[4][4]=999; cost[4][5]=60; cost[5][1]=999; cost[5][2]=999; cost[5][3]=999; cost[5][4]=999; cost[5][5]=999; printf("Los vertices del arbol de expansion minima son: \n"); for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ matriz[i][j]=0; } } while(ne < n) { for(i=1,min=999;i<=n;i++) { for(j=1;j <= n;j++) { if(cost[i][j] < min) { min=cost[i][j]; a=u=i; b=v=j; matriz[a][b]=min; } } } u=find(u); v=find(v); if(uni(u,v)) { printf("%d edge (%d,%d) =%d\n",ne++,a,b,min); printf("\nCosto: %d\n",matriz[a][b]); mincost +=min; } cost[a][b]=cost[b][a]=999; } printf("\n\tCosto minimo = %d\n",mincost); for(a=1;a<=n;a++){ for(b=1;b<=n;b++){ if(matriz[a][b]!=0){ printf("\nDe %d, a %d: ",a,b); printf("%d",matriz[a][b]); } } } //getch(); printf("\nIngrese el nodo raiz: "); int raiz; scanf("%d", &raiz); 

    } int find(int i) { while(parent[i]) i=parent[i]; return i; } int uni(int i,int j) { if(i!=j) { parent[j]=i; return 1; } return 0; }

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

    SQLite help

    Posted: 26 Apr 2018 04:50 PM PDT

    Hello everyone. I'm taking a online courses for android app developing and, I need a little help. I'm trying to set up a simple table

    @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);

     try { // opens data bace if it all ready exist or creates a new one SQLiteDatabase myDatabase = this.openOrCreateDatabase("Users", MODE_PRIVATE, null); // makes your table in sql myDatabase.execSQL("CREATE TABLE IF NOT EXISTS users (name VARCHAR, age INT(3))"); // inserts data into the table 

    line 30>> myDatabase.execSQL("INSERT INTO users (users, age) VALUES ('Sam', 24)");

     myDatabase.execSQL("INSERT INTO users (users, age) VALUES ('Samantha', 26)"); // getting date out of the data base Cursor c = myDatabase.rawQuery("SELECT * FROM users", null); //gets the column indexs for varsabiles int nameIndex = c.getColumnIndex("name"); int ageIndex = c.getColumnIndex("age"); // moves the cursor to desired place c.moveToFirst(); // keep looping untill c is not null while (c != null) { Log.i("name", c.getString(nameIndex)); Log.i("age", Integer.toString(c.getInt(ageIndex))); c.moveToNext(); } } catch (Exception e ) { e.printStackTrace(); } } 

    }

    My log cat say there is a error with line 30 with the fallowing error. 04-26 18:35:28.439 21913-21913/com.example.sean.libsqllite W/System.err: android.database.sqlite.SQLiteException: table users has no column named users (code 1): , while compiling: INSERT INTO users (users, age) VALUES ('Sam', 24)

    My code matches that of the instructor so I'm a little confused. Any thoughts?? thanks .

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

    Creating a trading card game database

    Posted: 26 Apr 2018 08:28 PM PDT

    Ok so I have been using other programs to help catalog my mtg cards but I want to make/find one that is faster and free. One that can work online and off and can also use photos. I want to make it easy to use and easy to catalog trading card games.

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

    How do random number generators actually choose the random number?

    Posted: 26 Apr 2018 02:18 PM PDT

    So I'm thinking of finally teaching myself the basics of HTML, CSS and JS/JQuery over the summer. Any idea how long it would take me to become at least proficient enough for an entry level web development position?

    Posted: 26 Apr 2018 01:40 PM PDT

    I've already ordered some books through Amazon as I just like book learning more than online. I'll also be graduating university next Spring in a major that's not CS. I like what I'm in but I just switched too late is the problem. I've had my mind set on web development for a while now and really want to get into it, but I know I probably have to build some sort of portfolio to at least be appealing to employers, as I'm sure the CS majors have probably got those positions locked down with how much they learn.

    I know everyone learns at different paces and all. And I'm willing to put in as much time is necessary every week until I can do this stuff on my own. Any advice would be valuable

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

    Java noob trying to return "this" as a result, but cant figure out how to make it recognize this as an object

    Posted: 26 Apr 2018 07:13 PM PDT

    Im trying to make a compare method to return the oldest date. Right now

    public DateClass compareTo (DateClass d) { if(this.sortString().compareTo(d.sortString())>0) return this; } 

    Dateclass is just the name of the date object (year,month,date) and sortString just creates a string year+month+day to compare them lexicographically.

    Returning d is really easy, just return d; but the compiler won't recognize "this" as an object of type DateClass, which makes sense because it doesnt yet know I'm going to use object.compareTo(object). I cant figure out how I'm going to compare using day1.compareTo(day2)

    I know this might be a dumb question but I'm really struggling and I need to use a method like this pretty much any assignment when I have to sort out arrays and such

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

    Help serializing large repeated groups of objects from a JSON string to a C# class structure

    Posted: 26 Apr 2018 07:00 PM PDT

    Hello all!

    Thanks for taking the time to look at my post. I am not sure if I worded the title appropiately, but basically I am sending a GET request to an external API. That API is returning me JSON similar to this:

    { "StudentA-0x1232" : { "Course Enrolled": 215481, "First Name": "Foo", "Last Name": "Bar" }, "StudentA-0xAY6V" : { "Course Enrolled": 985354, "First Name": "Bar", "Last Name": "Foo" }, "StudentA-AC35A3" : { "Course Enrolled": 788785, "First Name": "Foo Foo", "Last Name": "Bar Bar" }, repeated 400x, no unique entries 

    }

    Basically it looks like this, repeated 400x+:

    { "randomName" : { "First Name": "Foo Foo", "Last Name": "Bar Bar" }, "randomName" : { "First Name": "Foo Foo", "Last Name": "Bar Bar" }, "randomName" : { "First Name": "Foo Foo", "Last Name": "Bar Bar" }, "randomName" : { "First Name": "Foo Foo", "Last Name": "Bar Bar" }, "randomName" : { "First Name": "Foo Foo", "Last Name": "Bar Bar" }, "randomName" : { "First Name": "Foo Foo", "Last Name": "Bar Bar" }, .... , .... , .... , } 

    I am writing my API in C# and am trying to come up with a way to create an object model structure to cast the JSON from the received API response, and cast it to a C# object.

    I see two dilemmas to cast the object:

    • The rootParent of each node has a unique name so its difficult to use Serialization classes
    • There are more that 400+ objects within another object. They are not programmed as an array, and I cannot statically hardcode 400+ object names into my object model.

    What is the best way (and object model structure) to cast the JSON Web response to so that it can be utilized in a C# application?


    Currently this is what I have:

    var myObject = _get(_externalApiUrl); var myNewObject = JsonConvert.DeserializeObject(myObject); var myNameCastedObject = (StudentInformationWrapper)myNewObject; private string _get(string uri) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) using (Stream stream = response.GetResponseStream()) using (StreamReader reader = new StreamReader(stream)) { return reader.ReadToEnd(); } } 

    I have an error that occurs here that says the casting failed:

    var myNameCastedObject = (StudentInformationWrapper)myNewObject; 

    These are the C# Objects I have created:

    [DataContract] public class StudentInformationWrapper { [DataMember] public List<StudentCourseInformation> StudentCourseInfo{ get; set; } } [DataContract] public class StudentCourseInformation { [DataMember] public string StudentId{ get; set; } [DataMember] public StudentCourseInformationDetails StudentDetails{ get; set; } } [DataContract] public class StudentCourseInformationDetails { [DataMember] public string FirstName{ get; set; } [DataMember] public string LastName { get; set; } } 
    submitted by /u/cs_legend_93
    [link] [comments]

    What is the work like in these programming fields?

    Posted: 26 Apr 2018 01:28 PM PDT

    I'm contemplating a career change into programming. Plan on signing up for programming boot camps as well as studying on my down time. The specializations listed below are the ones I'm interested in. Would love to hear personal stories, know if the work is fulfilling and overall opinion of the job.

    -App development

    -Front End developer

    -Web developer

    -Data Scientist

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

    Simple 2048 ai

    Posted: 26 Apr 2018 03:04 PM PDT

    I'm doing a side project for some extra credit and class and as the title says, it's a 2048 'ai.' I get to use two built in functions(get(x,y) and can_move_up/down/left/right()).

    This is what I've come to and it goes to roughly 1000 about 60% of the time. https://trinket.io/library/trinkets/c9e9113099 If you want it to run faster and just do pure score printing remove the comment on line 7 of the game file.

    If there is any general theory or anyone could help with techniques that'd be great!

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

    Why is C# stopwatch dropping elapsed.Milliseconds?

    Posted: 26 Apr 2018 11:17 AM PDT

    So I am trying to time how fast my code is, but the stopwatch I am using will, for no reason I can see, drop from 0.01 ms to like 0.000023 ms. Which I know isn't right. Here is my code:

    https://pastebin.com/Hpy2HS9b

    This code is inside a while (true) loop. So I thought that might be the reason, but after running a different test in a different while (true) loop:

    https://pastebin.com/Tx4gPykm

    The stopwatch works fine. What on earth is wrong here?? (note: I have a prompt asking the user if they want to run the program again. If they type n and press enter, then the code goes to a break; statement).

    submitted by /u/Code-cube
    [link] [comments]

    Really basic but if I make a button in VB and I use it on multiple forms, can I make a sort of global Sub that I can just call in each form?

    Posted: 26 Apr 2018 02:47 PM PDT

    Basically, I have a project with about 5 forms. Every time one opens, the previous one closes and buttons are used to navigate between them. Each form has an exit program button. I want to know if its possible to make a sub with the code to close the program and just call it every time you click the button. The only reason I want to do this is because the project is for school and I can talk about it being more efficient in the documentation, thanks

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

    I need help on how to code this and a n00b at coding anything really.

    Posted: 26 Apr 2018 01:16 PM PDT

    So, our software at the place I work has the ability to send emails via they system. There is a code template I was given to track the sending of emails. The issue with this code template is that it will only work (write the entries to the correct page so user can see email sent with information) is if there is an attachment with the message. If no attachment then this will not get placed on the page with the email history. The code is below. The area that is causing the issue is the 2nd row 6th column. How can i write this so if the user does not include attachment, the record will still get written to the page it needs to for the sent history. Thank you very much!

    |~

    SELECT '<table width=100% border=1 cellpadding=2 cellspacing=0><tr> </tr>

    <tr>

    <td align=center><b>Date Sent</b></td> <td align=center><b>User</b></td> <td align=center><b>Email Sent To</b></td> <td align=center><b>Subject</b></td> <td align=center><b>Message</b></td> <td align=center><b>Attachment </b></td> 

    </tr>' as FieldData union all Select '

    <tr> <td>' + CONVERT(varchar(20),EmailSentDate, 101) + '</td>

    <td>'+ CONVERT(varchar(20),FirstName + ' ' + LastName) + '</td> <td>' + CONVERT(varchar(50),EmailSentTo,101) +'</td> <td>' + CONVERT(varchar(100),EmailSubject) + '</td> <td>' + CONVERT(varchar(8000),EmailText) + '</td> <td>' + CASE WHEN AttachmentName LIKE '%Z:\location%' THEN ISNULL((SELECT '<a href="file://svr/z$/location/' + REPLACE(ImageLocation,'\\','/') + '"target="_blank">' FROM tblDocumentDetail WHERE REPLACE(AttachmentName,'Z:\location\\','') = ImageLocation),'') + CONVERT(varchar(50), ISNULL((SELECT TOP 1 Description FROM tblDocumentDetail WHERE REPLACE(AttachmentName,'Z:\location\\','') = ImageLocation),'none')) WHEN AttachmentName LIKE '%\\svr%' THEN ISNULL((SELECT '<a href="file://svr/z$/location/' + REPLACE(ImageLocation,'\\','/') + '"target="_blank">' FROM tblDocumentDetail WHERE REPLACE(AttachmentName,'\\svr\z$\location\','') = ImageLocation),'') + CONVERT(varchar(20),ISNULL((SELECT TOP 1 Description FROM tblDocumentDetail WHERE REPLACE(AttachmentName,'\\svr\z$\location\','') = ImageLocation),'none')) END + '</td> 

    </tr>' as FieldData

    From tblEmailSentHistory INNER JOIN tblUserTable ON LEFT(EmailSentUserID, LEN(EmailSentUserID)-1) = tblUserTable.UserCodeID Where EmailSentFromCaseID = {CaseID} UNION ALL Select '<tr></table>' as FieldData

    ~|\

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

    C Programming lecture slides seem really bizarre - extern int F where F is #defined previously in the file??

    Posted: 26 Apr 2018 12:33 PM PDT

    Hey!

    So I have some experience in C, but i'm reading through these lecture slides and it just seems straight wrong, I can't think of a compiler that would compile this, no matter how old:

     #define F 21 int main(int argc, char** argv) { extern int F; int C = ((F - 32) * 5) / 9; /* C = * - * 6 */ } 

    Please confirm this snippet makes no sense? Have I just misunderstood the extern keyword?

    Cannot get this to compile, errors with:

    main.c:1:11: error: expected identifier or '(' before numeric constant #define F 21 ^ main.c:3:13: note: in expansion of macro 'F' extern int F; 

    Is this just some archaic shit that used to be in some oooold compiler, where extern + #define would be interpreted differently?

    Thanks!

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

    [Visual Basic 2017] What are some good resources/tutorials to make a system that allows me to edit, add and delete data from an access 2016 file?

    Posted: 26 Apr 2018 12:18 PM PDT

    I have been trying to do this but most of the tutorials I have tried have errors that I dont know how to fix or just dont work. If you have any good tips or guides then please send them my way

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

    What do I need to know in order to create a Windows driver that interprets data sent by a Teensy microcontroller?

    Posted: 26 Apr 2018 12:17 PM PDT

    For my high school engineering class project, I am developing a keyboard that should be able to type symbols (mathematical, greek, etc.) but through my digging have found that I need to learn windows driver development for it to work. What are the best resources for me to use in order to make it work? I already have C++ programming knowledge.

    I am using Teensyduino to write the code and will likely just be sending data over serial.

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

    SQL Phone number format

    Posted: 26 Apr 2018 11:17 AM PDT

    I have a task to do on SQL to set the clients' phone numbers start with either 00041 or 00042 or 00043 and then have 7 non-static digits. For example: 000417777777 or 000421234567. I am using this code but it gives me "SQL COMMAND NOT PROPERLY ENDED ERROR" on line 2 at the first OR statement

    UPDATE JB_CELULAR SET NR = '00041' OR '00042' OR '00043''+ SUBSTRING(NR, 6, 12); 

    Do you have any ideas?

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

    I have a bunch of RGB values. Is there an easy way to turn these into colored shapes, or display them in some way?

    Posted: 26 Apr 2018 10:59 AM PDT

    Like if I could make a square for each RGB value, or a bar that gradually changes to the next RGB value. Then put those shapes into power point, it would be quite useful

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

    Looking for a tool to use code to create an outline

    Posted: 26 Apr 2018 10:51 AM PDT

    Title is a bit unclear. I was wondering if there are any tools where you can input a file of code and specify the language and then the tool outputs an overview of the (The variables, whether they're initialized, the functions, function return types, etc...)

    Recently my work has involved having to go through fairly long code files quickly and try to understand how they work and I think this would be a really helpful tool because right now I have to assemble this outline manually each time. Thanks!

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

    No comments:

    Post a Comment