Posts

apache - Running a open source php project after modifications -

i looking open source php website code , found 1 @ http://projects.students3k.com/online-exam-website-php-source-code.html , downloaded it. doesnt have read me suppose involves common sense people use php. subsequently, installed apache2, placed whole stuff in var/www/ , connected database. what i'm unable find users login user or admin interface. did find file users in csv format doesn't work the instructions have make changes file lib/db.php adding local parameters. this not sort of homework , wanna explore functionality of website. p.s. - file size 80 mb before i'm scolded posting such links. p.p.s - reallllly me , have smashed head trying. db.php file after modifications : define('db_server', 'localhost'); define('db_user', 'root'); define('db_passwd', 'password'); define('db_name', 'test'); define('admin_url', 'localhost/admin/'); define('url', 'localhost/...

c++ - Alphanumeric generator with restrictions -

i want create generator use these characters: b c d f g h j k m p q r t v w x y z 2 3 4 6 7 8 9 i want select 18 random letters list , 7 random numbers list , shuffle them (total of 25). there can repeats. python or c++. please help! python code attempt: import string import random letters = [random.choice('bcdfghjkmpqrtvwxyz') x in range(18)] numbers = [random.choice('2346789') x in range(7)] random.shuffle(letters + numbers) you had right: >>> import random >>> letters = [random.choice('bcdfghjkmpqrtvwxyz') x in range(18)] >>> numbers = [random.choice('2346789') x in range(7)] >>> s = letters + numbers >>> random.shuffle(s) >>> s ['j', 'p', 'f', 'm', '3', 'q', 'k', 'p', '2', 'k', '7', 'j', 'b', 'p', 'x', 'g', 'm', 'b', 'k'...

apache - First cgi script in perl and don't know what it does -

i new perl , looking cgi programs. tried following perl monks , works. have no idea does. 1) end_here ? followed html ? : print <<end_here; <html> <head> <title>my first cgi script</title> </head> <body bgcolor="#ffffcc"> <h1>this pretty lame web page</h1> <p>who ovid guy, anyway?</p> </body> </html> end_here 2) modified sample script adding: my $query = new cgi; $p= $query->param('myparam'); i.e. new script is: #!c:\perl\bin\perl.exe -wt use strict; use cgi; $query = new cgi; print $query->header( "text/html" ); $time = $query->param('fromdate'); print <<end_here; <html> <head> <title>my first cgi script $time</title> </head> <body bgcolor="#ffffcc"> <h1>this pretty lame web page</h1> ...

angularjs - Angular (directive newbie): How to add date time-picker to ngModel so that it can be validated? -

i new angular , have specific use case in mind have form has 2 fields - name , datetime. the name ng-model datetime not since not part of angular , jquery component what want do? here plunker = http://plnkr.co/edit/wgrvxafmpgoyswh9gfxh?p=preview a.) want associate date ngmodel ngmodel="transaction.date" b.) validate required using angular way something (much angular) <input type="text" name="transactiondate" ng-model="transaction.date" data-date-format="yyyy-mm-dd hh:ii" required> why? a.) to things angular way b.) makes model more consistent test, validate i asked question on stackoverflow , recommended use custom directive, can give me direction example how it? please guide me further since not able validate currently thank much based on ketan's answer, had write new directive , associate value form jquery ng-model, validated form. directive looks like app.directive('datetime...

model view controller - How does business logic class calls methods inside a managed bean? -

i have business logic code renders facesmessages on facelet based on output, made method in facelet managed bean method: public void renderfacesmessages(string summary, string detail) { facesmessage message = new facesmessage(summary, detail); facescontext.getcurrentinstance().addmessage(null, message); } and business logic class pass arguments method according message that's needed, question right approach business logic call method on managed bean? it layering concept... i presume have managedbean has method delegate business logic seperate business class/module. if case,i tell ,never have faces methods on business side... instead have business results wrapped in class , return managed bean.this result class encompass results,meta information result like,errors,exceptions.so managed bean can use renderfacesmessage method even if had not followed above presumption:my suggestion never have jsf faces logic inside business components.it bad idea. ...

java - Validate Bean inside a Bean -

i have following beans public class mymodel { @notnull @notempty private string name; @notnull @notempty private int age; //how validate this? private mysubmodel submodel; } public class mysubmodel{ private string subname; } then use @valid annotation validate controller side. thank you you can define own custom validation bean validation (jsr-303), example here simple custom zip code validation, annotating custom annotation can validate: @documented @constraint(validatedby = zipcodevalidator.class) @target(elementtype.field) @retention(retentionpolicy.runtime) public @interface zipcode { string message() default "zip code must 5 numeric characters"; class<?>[] groups() default {}; class<?>[] payload() default {}; } and custom validation class, instead of , can use custom beans <yourannotationclassname,typewhichisbeingvalidated> public class zipcodevalidator implements constraintvalidator<zipco...

javascript - Hyphens are causing a blank result -

i'm having issues hyphens in slugs tutorial i'm trying go through... http://wp.tutsplus.com/tutorials/theme-development/create-a-quicksand-portfolio-with-wordpress/ , i'm having problem when client uses hyphens in category. category blank when client puts in hyphen reason. otherwise else working perfectly! has else ran problem? i'm thinking js problem uncertain not receiving console errors @ all. i'm not sure how debug. why not use term_id desired prefix: $term->term_id . in case have unique identifier , less possibility breake something. final version be: $term_list .= '<li><a href="javascript:;" class="sort_by_term_'. $term->term_id .'">' . $term->name . '</a></li>'; will produce this: <li><a href="javascript:;" class="sort_by_term_1234568">some long name more words</a></li> info: http://codex.wordpress.org/functio...