Posts

c - How compare number with numbers inside myfile -

i'm developing software , need insert students , check if same students registered in system. int setnumaluno() //definir num de aluno { int num; printf("\n"); printf("numero de aluno: \n"); scanf("%d", &num); printf("a verificar se existe o aluno\n"); checkstudent(num); return num; } void checkstudent(int num)//metodo responsavel por verrificar no ficheiro se o mesmo existe { int numerofile=0; int r = 0; while (numerofile != eof) { numerofile = fscanf(fp, "%d", &r); if (num == numerofile) printf("numero existe"); else if (num != numerofile) setnomealuno(); } } i've tryed implement while cycle can't check if number exists in file. file called when fscanf() instruction can't check if have member number. how can perform, code, verify if student exists or not? do way: use fopen ...

input - read.table line 15 does not contain 23 elements - R -

here code used: d = read.table("movies.txt", sep="\t", col.names=c( "id", "name", "date", "link", "c1", "c2", "c3","c4", "c5", "c6","c7", "c8", "c9","c10", "c11", "c12","c13", "c14", "c15","c16", "c17", "c18", "c19"), fill=false, strip.white=true) and here text file: 1 toy story (1995) 01-jan-95 http://us.imdb.com/m/title-exact?toy%20story%20(1995) 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 2 goldeneye (1995) 01-jan-95 http://us.imdb.com/m/title-exact?goldeneye%20(1995) 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 3 4 rooms (1995) 01-jan-95 http://us.imdb.com/m/title-exact?four%20rooms%20(1995) 0 0 ...

c# - Drawing into a shared graphics buffer out of different threads? -

i'm trying write class drawing operation directy draw onto screen. idea have constant loop, rendering graphics buffer , several functions, write graphics buffer (lines, rectangles, etc). there problem threads. can't write graphics buffer, when used in loop in different thread. need different thread keep constant performance/framerate. tried kind of create "shared" buffer in form of bitmap, performance sucks. has got idead, how solve this? current error message is: system.invalidoperationexception @ mygraphics.clear(color.black); class drawingonscreen { intptr desktop; //a pointer desktop graphics g; //the graphics object bufferedgraphicscontext currentcontext; bufferedgraphics mybuffer; //graphics buffer thread renderthread; //the thread [dllimport("user32.dll")] static extern intptr getdc(intptr hwnd); public void drawline(vector2d point1, vector2d point2, float width, color color) //vector2d point2d { ...

JavaScript RegEx format string containing American Express card number -

i'm trying format string containing american express credit card number using regular expression. here's i'm using visa, mastercard , discover number formatting, doesn't work american express: var formatvisamastercarddiscover = function ( number) { return number.split(/(?=(?:\d{4})+($))/).filter(function ( n) { return (n != ""); }).join("-"); }; so, i'm curious regular expression amex number be. format should {4}-{6}-{5} . i'd appreciate because couldn't find while searching except how validate not want. want format it. you can use: var ccnum = '341256789012345'; var ccfmt = ccnum.replace(/\b(\d{4})(\d{6})(\d{5})\b/, '$1-$2-$3'); //=> 3412-567890-12345 regex demo

java - How is it possible that an interface is being instantiated in this sample code? -

this question has answer here: can instantiate interface in java [duplicate] 5 answers a manual i'm reading includes example, scheduledexecutorservice being created. however, api shows scheduledexecutorservice interface, not class. how possible being instantiated? here's sample code shown: import java.util.concurrent.scheduledexecutorservice; import java.util.concurrent.executors; import java.util.concurrent.scheduledfuture; import static java.util.concurrent.timeunit.*; class beepercontrol { private final scheduledexecutorservice scheduler = executors.newscheduledthreadpool(1); public void beepforaminute() { final runnable beeper = new runnable() { public void run() { system.out.println("beep"); } }; final scheduledfuture<?> future = scheduler.sch...

proof - Why Coq doesn't allow inversion, destruct, etc. when the goal is a Type? -

when refine ing program, tried end proof inversion on false hypothesis when the goal type . here reduced version of proof tried do. lemma strange1: forall t:type, 0>0 -> t. intros t h. inversion h. (* coq refuses inversion on 'h : 0 > 0' *) coq complained error: inversion require case analysis on sort type not allowed inductive definition le however, since nothing t , shouldn't matter, ... or ? i got rid of t this, , proof went through: lemma ex_falso: forall t:type, false -> t. inversion 1. qed. lemma strange2: forall t:type, 0>0 -> t. intros t h. apply ex_falso. (* changes goal 'false' *) inversion h. qed. what reason coq complained? deficiency in inversion , destruct , etc. ? i had never seen issue before, makes sense, although 1 argue bug in inversion . this problem due fact inversion implemented case analysis. in coq's logic, 1 cannot in general perform case analysis on logical hypothesi...

c# - You must add a ref to System.Runtime... when deployed to Azure Websites -

site runs fine locally, throws windows azure websites hosting environment. cs0012: type 'system.object' defined in assembly not referenced. must add reference assembly 'system.runtime, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' so infamous message , has known fix; <compilation ... > <assemblies> <add assembly="system.runtime, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a" /> </assemblies> </compilation> i understand asp.net pages/views compiled @ different time controllers , other logic, (that vnext going address this), , above adding reference page compilation side of things. but question is: why work on development machine needs config on waws environment, you'd think setup? i know what's different, what's missing on target environment such referencing portable library (portable, meaning should 'just work' in variety of environments) br...