prepis opakovania na test z poslednej prednášky (opravene na 250eur)
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Zobrazi prspevky MenuQuote from: markus on 13.03.2012, 23:41:10Quote from: deCode666 on 13.03.2012, 23:19:54Quote from: jan on 13.03.2012, 19:38:03
prepis opakovania na test z poslednej prednášky
Nemá komandista náhodou vklad vo výške 250€? ... a nie 550€
jj ma .. .v mojom docku to je vypracovane dobre... to vies niektore veci sa daju lahko prepocut ked to narychlo diktuje a 250 a 550 som mal aj ja problem v dajakom pripade rozlisit
Quote from: jan on 24.01.2012, 21:12:48
oh boze, posledna skuska studia a prva, ktoru som nespravil, 49FX. i love it
MACHINE Scalar( max_val )
CONSTRAINTS max_val:NAT & max_val>=0
ABSTRACT_VARIABLES val
INVARIANT val : 0 .. 10
INITIALISATION val := 0
OPERATIONS
retVal <-- getVal =
BEGIN
retVal := val
END ;
setVal ( amount ) =
PRE amount : NAT THEN
IF amount <= max_val & amount >= 0 THEN val := amount END
END ;
incVal ( amount ) =
PRE amount : NAT THEN
IF val < max_val THEN val := val + 1 END
END ;
decVal ( amount ) =
PRE amount : NAT THEN
IF val > 0 THEN val := val - 1 END
END ;
maximum <-- maxVal ( xx ) =
PRE xx : INT THEN
IF xx > val THEN maximum := xx ELSE maximum := val END
END ;
incORdecVal ( amount ) =
PRE amount : NAT THEN
CHOICE
IF val > 0 THEN val := val - 1 END
OR
IF val < max_val THEN val := val + 1 END
END
END
END
// Unique
if(object.get${generator.toUCIdent($property.name)}() != null) {
try {
Class.forName("org.apache.derby.jdbc.ClientDriver");
Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/magsa", "magsa", "magsa");
String sql = "SELECT $property.name FROM $item.name WHERE $property.name = ?";
PreparedStatement prest = con.prepareStatement(sql);
prest.$generator.psSetMethod($property.type)(1, object.get${generator.toUCIdent($property.name)}());
ResultSet rs1 = prest.executeQuery();
if (rs1.next()) {
throw new ValidatorException("Property '$property.name' has to be unique!");
}
} catch (SQLException ex) {
Logger.getLogger($item.name .class.getName()).log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex) {
Logger.getLogger($item.name .class.getName()).log(Level.SEVERE, null, ex);
}
}
Quote from: mishelka on 28.03.2011, 15:04:16Quote from: jan on 25.03.2011, 16:08:18Co je na tom ""? Ved bolo treba spravit cely nastroj na to, aby ti to tam zahlasilo ci mozes taku anotaciu pouzit na danom mieste alebo nie a ako ju mozes pouzit... A taky vyvoj urcite netrval tri dni Nie je to take jednoduche ako to vyzera na prve pouzitie Ale ak mas nejaky navrh, napis ako by sa to dalo zlepsit, mozno sa posnazime
Úloha: Použite anotáciu @References v konštruktore triedy Reference pre určenie automatického vytárania referencií.
Quote from: tuxik on 26.03.2011, 05:09:33
Vyskusaj súbor nbproject/project.properties zmenit takto: build.generated.sources.dir=${basedir}/src-framework ... mne to takto ide
package sk.tuke.magsa.tools.parserext
ap-source-output.sk.tuke.magsa.tools.parserext
Quote from: tuxik on 26.03.2011, 05:09:33
Vyskusaj súbor nbproject/project.properties zmenit takto: build.generated.sources.dir=${basedir}/src-framework ... mne to takto ide
QuotePokúste sa definovať a implementovať ďalšie typy obmedzení vlastností entít.
#include <dos.h>
#include <stdio.h>
#include <conio.h>
#define COMPORT 2 // COM 3
union REGS inr,outr;
int main(void)
{
inr.h.ah=0; /* Inicializacia portu */
inr.x.dx=COMPORT; /* Port COM1 */
inr.h.al=0xE3; /* 9600 Bd, bez parity, 1 stopbit, 8 bitov*/
int86(0x14,&inr,&outr);
inr.h.ah=2; /*Prijem znaku z vybraneho portu*/
inr.x.dx=COMPORT; /*COM1*/
do {
int86(0x14,&inr,&outr);
} while(outr.h.ah!=0); /*Cakaj, kym znak spravne nenacitas*/
printf("Stlac ENTER pre koniec...");
getch();
return 0;
}
#include <dos.h>
#include <stdio.h>
#include <conio.h>
#define COMPORT 1 // COM 2
union REGS inr,outr;
int main(void)
{
inr.h.ah=0; /* Inicializacia portu */
inr.x.dx=COMPORT; /* Port COM1 */
inr.h.al=0xE3; /* 9600 Bd, bez parity, 1 stopbit, 8 bitov*/
int86(0x14,&inr,&outr);
inr.h.ah=1;
inr.h.al='c';
inr.x.dx=COMPORT; // JANO com3 je 2, bolo tu 0
int86(0x14,&inr,&outr);
printf("Stlac ENTER pre koniec...");
getch();
return 0;
}
Quote from: MackoZlesa on 07.03.2011, 23:19:46
Ako ste riesili UPDATE v dao_impl.java.vm?String query = "UPDATE Oddelenie SET nazov=?, kod=?, poschodie=? WHERE ident=?";
Konkretne to ident ma zaujima
Quote from: thom on 07.03.2011, 17:36:28
neviete niekto kde nastavim v tom turbo c++ aby mi neotvaralo okno na celu obrazovku ale len v malom okne?? v akej zalozke to je myslim.
Quote from: stamperlik on 06.03.2011, 20:24:48
Navod ako som rozbehal priklad z cvika na jednom kompe
Have fun
Quote from: Faust on 02.03.2011, 17:20:12
ake je heslo do moodlu?
Quote from: Cheiftan on 25.02.2011, 16:24:59
ja som pouzil dva regularne vyrazy na identifikatory (na mena properties):
[_$a-zA-Z][0-9a-zA-Z_$]+
([_$a-zA-Z][0-9a-zA-Z_$]+)[\\s]:[\\s](INTEGER|REAL|STRING)+ -> ked sa definuje aj typ
opravte ma ak to mam zle
[\\s]* | - odfiltrovanie whitespaces [ \t\n\x0B\f\r] |
[_$a-zA-Z] | - 1. znak identifikatora |
[0-9a-zA-Z_$]* | - ostatne znaky identifikatora |
[\\s]* | - |
(:[\\s]*(Integer|Real|String)[\\s]*)? | - volitelna cast, typ moze a nemusi byt |
: | - podla zadania |
[\\s]* | - |
(Integer|Real|String) | - Integer alebo Real alebo String |
[\\s]* | - |
public Boolean hasProperLineSyntax(String line) {
Pattern pattern = Pattern.compile("[\\s]*[_$a-zA-Z][0-9a-zA-Z_$]*[\\s]*(:[\\s]*(Integer|Real|String)[\\s]*)?");
Matcher matcher = pattern.matcher(line);
return matcher.matches();
}
Quote from: piton on 26.02.2011, 04:03:25
ja to mam cez regular., ale jednoduchsi... myslim, ze kontrolovat ci to nie je jedno z tych 50 klucovych slov je ale trosku prehnane nie?
package JavaKeywords;
import java.util.Arrays;
import java.util.List;
public class JavaKeywords {
private static final String keywords[] = {
"abstract", "continue", "for", "new", "switch",
"assert", "default", "goto", "package", "synchronized",
"boolean", "do", "if", "private", "this",
"break", "double", "implements", "protected", "throw",
"byte", "else", "import", "public", "throws",
"case", "enum", "instanceof", "return", "transient",
"catch", "extends", "int", "short", "char",
"final", "try", "interface", "static", "void",
"class", "finally", "long", "strictfp", "volatile",
"const", "float", "native", "super", "while"};
private static final List l = Arrays.asList(keywords);
public Boolean isJavaKeyWord(String keyword) {
return l.contains(keyword);
}
// alebo lepsie
public Boolean isJavaKeyWord2(String keyword) {
for (int i = 0; i < keywords.length; i++) {
if (keyword.equals(keywords[i])) {
return true;
}
}
return false;
}
}