Posts

Showing posts from August, 2010

plsql - How to write a program to print the wishes based on the sys time? -

in pl/sql block, print 'good morning','good noon','good eve' based on system time have given input. if time 6 12 pm has print morning else if lies between 12 pm 2 pm has print noon else if has print eve. can give me idea? advance gives me guidance. i think, know how anonymous block looks (reminder below): declare -- variables' / constants' / types' / etc. declarations begin -- logic end; / you can create date variables or constants follows: l_in_date <constant> date := to_date(<date>,<date_mask>); then can use if..then statement , print out result according conditions ( http://www.techonthenet.com/oracle/loops/if_then.php ): if <condition> -- logic elsif <condition> -- logic else -- logic end if; i believe, should able create anonymous block using information above.

php - .htaccess not working with GoDaddy -

this .htaccess rewrite: options +indexes errordocument 400 /notfound.php errordocument 401 /notfound.php errordocument 403 /notfound.php errordocument 404 /notfound.php errordocument 500 /notfound.php rewriteengine on rewriterule (.*)\.xml(.*) $1.php$2 [nocase] i haven't had trouble using on server other godaddy. sites use custom cms file called "pages" (not "pages.php") links page alias (e.g. http://www.domain.com/pages/page-alias ) , works everywhere. the home page fine. when going page alias, pages file doesn't work. i need use "pages.php" file make work (linking http://www.domain.com/pages.php/page-alias ). is issue .htaccess file on godaddy server? is there i'm missing? with godaddy, need turn off multiviews: options -multiviews [ source ]

solving binary linear equation in matlab -

consider binary linear equation of form x*a = b . want solve x , efficiency way avoiding using x = b*inv(a) , instead using x= b/a .but command results not in binary form. tried command x = mod(b/a ,2) but still result not in binary. how fix this? example ` x = 1 0 1 1 0 0 0 1 1 0` and matrix `0 1 0 1 0 0 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 0 1 0 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 0 0 0 1 1 1 0 1 1 0 1 0 0 0 1 1 0 0 0 1 0 0 1 1 1 1 0 1 0 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0 0 0 1 1 0 0` full rank. then >> b = mod (x*a,2) b = 1 0 1 1 1 0

java - Void methods can't return the value of a void method? -

i don't mind if don't understand, want know why happens: void something(string a) { return hi(); } void hi() { return; } the odd thing here, hi() has return type of void . syntax error in ide: void methods cannot return value furthermore, code doesn't compile: exception in thread "main" java.lang.error: unresolved compilation problem: void methods cannot return value @ resources.setsystemproperties(resources.java:33) @ resources.main(resources.java:49) i expect happening: hi() -> return nothing return [nothing] -> hi() nothing so in end, returns nothing, void method should. why behaviour happen? , why doesn't code compile, when return result of void method? this defined in jls 14.17 : a return statement expression must contained in 1 of following, or compile-time error occurs: a method declared return value a lambda expression a void method not declared return value, return s

CSV Encoding Issue on PHP upload -

i receive csv file looks straightforward. i run on , tells me ascii. echo mb_detect_encoding($fhandle , "auto"); however when run import code: doesnt work correctly. $sql= "load data local infile '". $fhandle ."' table sys6_impbet fields terminated ',' optionally enclosed '\"' lines terminated '\n' ignore 1 lines ( accno_1, mtgdate, code, venue, location, pool, eventno, gross_sales, refunds, turnover, dividends, profit_loss);" ; it brings in correct number of records puts null or 0 in every field / record. reading file sees records won't values. heres small sample: accno_1,mtgdate,code,venue,location,pool,eventno,gross_sales,refunds,turnover,dividends,profit_loss 66096159,12/07/2015,gallops,penola,sa,treble,0,279.00,0.00,279.00,"1,955.70","1,676.70" 66096159,12/07/2015,gallops,warrnambool,vic,treble,0,"

appending one object to another in javascript -

i have created 2 objects shown in below script. i'm able append them onto page using 'document.body'. now, wanted append 'appitem' header in 'mainwrapper'. how can this. function mainwrapper() { var wrapper; var header; function create() { wrapper = document.createelement('div'); header = document.createelement('div'); wrapper.appendchild(header); } function style() { wrapper.classname = "wrapper"; header.classname = "header"; } function init() { create(); style(); } init(); this.render = function (k) { k.appendchild(wrapper); } } function appitem() { var appitemicon; appitemicon = document.createelement('img'); appitemicon.src = 'icons/list.png'; this.appitemrender = function (k) { k.appendchild(appitemicon); } } window.addeventlistener('load', onload);

javascript - AngularJS--Cannot get timer to count down -

i working on time management app, , having trouble getting timer work. primary issue having passing timerduration value through each function timerdisplay automatically updated timer counts down. after several days researching this, more confused. have read javascript docs, angularjs docs, mozilla's angularjs docs, numerous related stackoverflow questions , angular/javascript blogs. there number of approaches have tried: using $scope in factory, doesn't work (angular has docs on this), putting timer logic in controller (not angular), , tried building custom directive, did not work. methinks misunderstanding something, cannot seem figure out is. putting timer logic in factory service, hope gain practical understanding of how build services work. here's code: controller app.controller('timerctrl', ['$scope', '$interval', 'countdownclock', function($scope, $interval, countdownclock){ $scope.tasktimer = function() {

c++ - How to use a slash in Spirit Lex patterns? -

code below compiles fine with clang++ -std=c++11 test.cpp -o test but when running exception thrown terminate called after throwing instance of 'boost::lexer::runtime_error' what(): lookahead ('/') not supported yet. the problem the slash (/) in input and/or regex (line 12 , 39) can't find solution how escape right. hints? #include <string> #include <cstring> #include <boost/spirit/include/lex.hpp> #include <boost/spirit/include/lex_lexertl.hpp> #include <boost/spirit/include/qi.hpp> #include <boost/spirit/include/phoenix.hpp> namespace lex = boost::spirit::lex; namespace qi = boost::spirit::qi; namespace phoenix = boost::phoenix; std::string regex("foo/bar"); template <typename type> struct lexer : boost::spirit::lex::lexer<type> { lexer() : foobar_(regex) { this->self.add(foobar_); } boost::spirit::lex::token_def<std::string> f

javascript - How are object properties implemented in Node.js -

i had array large amount of values iterating on find specific value this: function havevalue(value) { for(var index in arr) { var prop = arr[index]; if(prop === value) { return true; } } return false; } but occurred me possibly perform lookup more using object: function havevalue(value) { return typeof obj[value] !== 'undefined'; } however, have not seen of improvement in performance after doing this. i'm wondering, how object properties stored in javascript/node.js? iterated on in order find, same array? thought might implemented using hash table or something. you've asked iliterating through array , if using object give better performance, using for in loop array, , perfromance might better increased using for loop or es6 includes method. if arr array , want check if contains value, use es6 includes() method ( docs here ) function havevalue(value) { return (arr.includes(value)); } n.b. you'll need check if

oracle - pipe.stdout.read() returning NULL (Calling Perl Script from Python) -

i have perl script 'db.pl' connects oracle db , fetches row table. use dbi; use lib " c:\strawberry\perl\site\lib"; $dbh = dbi->connect("<schema>", "<username>", '<password>', { raiseerror => 1 }); $sth = $dbh->prepare('select * <tablename>',{ raiseerror => 1 }); $sth->execute; @row = $sth->fetchrow_array; print "@row\n" now when running through command prompt, returning 1 row want. >perl db.pl now, want same result in python , using following code: >>> pipe = subprocess.popen(["perl", "<path>/db.pl"], stdout=subprocess.pipe) >>> print pipe.stdout.read() this returns null. can tell going wrong?

PHP ereg_replace deprecated -

i have script throws me errors because run php 5.3.1 have use in example? $row[$j] = ereg_replace("\n", "\\n", $row[$j]); deprecated: function ereg_replace() deprecated in.. use preg_replace instead, add delimiters . $row[$j] = preg_replace("#\n#", "\\n", $row[$j]);

javascript - how can i export the geolocation output to log file? -

i have code displays geolocation (longitude: xx latitude: xx accuracy: xxx) ..how can output results log file log.txt when body visit url <!-- <xml version="1.0" encoding="utf-8"> --> <!doctype html public "-//wapforum//dtd xhtml mobile 1.0//en" "http://www.wapforum.org/dtd/xhtml-mobile10.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>geolocation api demo</title> <meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport"/> <script> function successhandler(location) { var message = document.getelementbyid("message"), html = []; html.push("<img width='512' height='512' src='http://maps.google.com/maps/api/staticmap?center=", location.coords.latitude, ",", location.coords.longitude, "&markers=size:small|color:blue|", lo

html - Scroll bar pages conflicting with banner elements positioning -

i wondering how stop these elements moving when navigate page scroll bar. i've noticed elements move if select page scroll bar. here mean. thinking of somehow forcing scroll bar appear on pages i'm not sure how , i'd rather see if there different solution first. if me i'd appreciate it. if there's more code need let me know , can add question. thanks, grant here css banner/header , nav bar /*top banner section*/ #banner { height: 100px; position: relative;} #logo {position:relative; top: -90px; left:700px;} #ip_box { width:210px; height:43px; background:#212121; color: white; font-size: 15px; bottom: 10px; left: 77px; position: absolute;} #ip_text {bottom: 11px; left: 64px; color: white; position:absolute;} #teamspeak_box {width:159px; height:43px; background:#212121; bottom

Trouble creating table in MySQL -

i trying create table using command in mysql: create table tutorial_info( tutorial_id int not_null auto_increment primary key, tutorial_title varchar(100) not_null, tutorial_author varchar(100) not_null, submission_date timestamp ); i cut , paste code terminal getting error: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'not_null auto_increment primary key, tutorial_title varchar(100) not_null, ' @ line 1 not sure going on here. give me pointer might doing wrong here? thanks change not_null not null as: create table tutorial_info( tutorial_id int not null auto_increment primary key, tutorial_title varchar(100) not null, tutorial_author varchar(100) not null, submission_date timestamp );

java - Hibernate or JPA or JDBC or? -

i developing java desktop application have confusions in choosing technology persistence layer. till now, have been using jdbc db operations. now, learnt hibernate , jpa still novice on these technologies. now question use java desktop application following? jpa hibernate jdbc dao any other suggestion you... i know there no best choice them , totally depends on complexity , requeirements of project below requirements of project it's not complex application. contains 5 tables (and 5 entities) i wan't make code flexible can change database later easily the size of application should remain small possible have distribute clients through internet. it must free use in commercial development , distribution. ==================================== edited ======================================= on basis of below answers, go jpa prevent myself writing vendor-specific sql code. but have problems in jpa mentioned @ java persistence api here's t

java - JProgresbar doesn't work with Files.copy -

i writing program creates folder each file in specific folder. after file copied in the, created, folder. works, except jprogressbar want add program. added jtextarea after file copied want change progress bar, , add text jtextarea. while program runs nothing appears when whole task completed of text want in jtextarea shown , progress bar 100%. don't know did wrong. after examples madprogrammer gave me. figured out how worked. need update progresbar in swingworker , methodes want call, need call them in swingworkermethod.

swift - Cannot set iOS Status Bar Colour for View -

Image
i developing app ios8 , using swift 1.2 . however, having issue colour of status bar (the 1 time, battery indicator etc). in info.plist file, have uiviewcontrollerbasedstatusbarappearance set yes status bar style set uistatusbarstylelightcontent , in view controllers in storyboard, have status bar set "light content". this works of navigationviewcontrollers , views embedded within navigationviewcontrollers , have 1 normal tableviewcontroller not embedded in navigationcontroller , , when push view modally, status bar changes black!??? even when @ view in storyboard editor shows white status bar (note faint white battery indicator @ right of below screenshot): but when build , run on iphone, status bar shows black... why this? how can fix this? don't know incorrect. please make sure add view controller-based status bar appearance (uiviewcontrollerbasedstatusbarappearance) value no info.plist

android - Unable to load listview in asynctask from database -

i trying load items in listview queried db. ui blank 2 seconds , listviewis shown items. unable figure out wrong part in code. below code protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_list_view); // listview object xml listview = (listview) findviewbyid(r.id.list); dbhandler = new memodbhandler(this, null, null, 1); listfetchasynctask asynclist = new listfetchasynctask(); asynclist.execute(); } now asynctask load items class listfetchasynctask extends asynctask<string, integer, list<memoinfo>> { @override protected void onpreexecute() { listview.setfastscrollalwaysvisible(true); } protected list<memoinfo> doinbackground(string... params) { cursor cursor = dbhandler.getfulllistcursor(); if (cursor != null) { if(memolist != null) { if(!memolist.isempty())

delphi - What design pattern should I choose for different classes with common ancestor and common descendants? -

Image
i'm refactoring of code @ moment. got 2 - redundant - units, 1 each product. both contain baseclass inherits few subclasses. these inherit more subclasses, well. now want merge both units, redundant code won't redundant anymore , differing parts implemented separately in 2 different units. i first thought of hierarchie following: baseclass / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ product<a>baseclass product<b>baseclass \ / \ / \ / \ / \ /

javascript - Why does my meteoric only randomly show the ionic html boilerplate? -

Image
i working on meteor app smartphones ionic. unfortunately boilerplate code of ionic shows background-color , button shown on of sites, , on not. it appears random me maybe not. how can ionic theme shown of templates? a description of project details , tried far going follow now...... here list of packages: aldeed:collection2 2.3.1* automatic validation of insert , update operations on client , server. anti:i18n 0.4.3 internalization: simplest package fourseven:scss 2.0.1_5* style attitude. sass , scss support meteor.js (with autoprefixer , sourcem... iron:router 1.0.9 routing designed meteor mdg:reload-on-resume 1.0.4 on cordova, allow app reload when app resumed. meteor-platform 1.2.2 include standard set of meteor packages in app meteoric:autoform-ionic 0.1.5 ionic theme autoform meteoric:ionic 0.1.17 ionic components meteor. no angular! meteoric:ionic-sass 0.1.9 ionic's css framework i

Android: API Level and Kernel Version -

just started working on embedded android. , got confused within how figure out kernel version uses api level? how figure out info? or can find relation between api level used in kernel version? i mean, lets try android 5.1, api level 22 used, in kernel version provides support that? please correct me if i'm missing something, i'm new embedded android, though have worked on embedded linux. thank in advance...!!!

javascript - Cannot find module 'node-static' -

Image
i trying run samples regarding webrtc. went https://bitbucket.org/webrtc/codelab/src/50a47bb092483fd7ca27998a365dff434919bf89?at=master at step 5 needed run server.js. opened windows command prompt , entered: c:\program files\nodejs>node d:\gitprojects\codelab\complete\step5\server.js but got error: module.js:338 throw err; ^ error: cannot find module 'node-static' @ function.module._resolvefilename (module.js:336:15) @ function.module._load (module.js:278:25) @ module.require (module.js:365:17) @ require (module.js:384:17) @ object.<anonymous> (d:\gitprojects\codelab\complete\step5\server.js:1:76) @ module._compile (module.js:460:26) @ object.module._extensions..js (module.js:478:10) @ module.load (module.js:355:32) @ function.module._load (module.js:310:12) @ function.module.runmain (module.js:501:10) i have installed node-static module , present @ "c:\program files\nodejs\node_modules\node

visual c++ - LINK2019 still keeps going -

i'm trying resolve unresolved external (link2019 error).there posts on issue , try them, still not figure out. the error caused createftdcmdapi function ( right?) understanding "resolved". // testtraderapi.cpp : 定义控制台应用程序的入口点。 // #include "mdspi.h" #include <iostream> // userapi对象 cthostftdcmdapi* puserapi = null; // 配置参数 char front_addr[] = "tcp://asp-sim2-md1.financial-trading-platform.com:26213"; // 前置地址 tthostftdcbrokeridtype broker_id = "***"; // 经纪公司代码 tthostftdcinvestoridtype investor_id = "0***"; // 投资者代码 tthostftdcpasswordtype password = "*****"; // 用户密码 char *ppinstrumentid[] = { "***", "***" }; // 行情订阅列表 int iinstrumentid = 2; // 行情订阅数量 // 请求编号 int irequestid = 0; void main(void) { // 初始化userapi char file = 'f'; puserapi = cthostftdcmdapi::creat

php - Register and Login Multiple Users With the Same Firstname and Lastname -

i'm working on register-login system, i'm facing following problem: - can have 2 (or more) employees same firstname , same lastname, , possibly same password, each located either in same location, or different. when i'm trying register them, obviously, there aren't problems, when want login them, problems arise. users table: id int (11) a_i p_k, firstname varchar (50), lastname varchar(50), password varchar(150) register.php <?php $db = new pdo('mysql:host=127.0.0.1;dbname=xxx', 'root', ''); $fname = isset($_post['fname]) ? $_post['fname'] : ''; $lname = isset($_post['lname']) ? $_post['lname'] : ''; $pass = isset($_post['pass']) ? password_hash($_post['pass'], password_default) : ''; $stmt = $db->prepare('insert users set fname=?,lname=?,pass=?'); $stmt->execute([$fname,$lname,$pass]); ?> <form method="post"> <input type

cleartool - How to get list of activities included in new ClearCase baseline from commandline? -

when making baseline manually, shows "make baseline" dialog list of activities include in new baseline. how list commandline (from cleartool or other tool, in windows , linux)? the closest described in technote " activities delivered since last baseline " when working in ucm project, useful determine activities delivered integration stream since last baseline applied. cleartool diffbl command can accomplish this. however, cleartool diffbl must run against each modifiable component project uses. the command syntax is: cleartool diffbl -activities baseline:<baseline> stream:<integration_stream> that means must determine latest recent baseline of component on given stream first. as mentioned op in comments , diffbl works most recent baseline : either 1 listed first lsbl or foundation baseline if more recent. cleartool lsbl -stream integration_stream -component user1_comp@/vobstore/pvob then make diffbl in ord

fortran - Error declaring types with kind parameter -

with following program experience errors. program com !input !no of atoms !no of iterations !respective positions. !as of homogeneous clusters. implicit none real, parameter :: r8b=selected_real_kind(10) real, parameter :: r4b=selected_real_kind(4) integer, parameter :: i1b=selected_int_kind(2) integer, parameter :: i2b=selected_int_kind(4) integer, parameter :: i4b=selected_int_kind(9) integer, parameter :: i8b=selected_int_kind(18) real (r8b), dimension (:,:), allocatable :: posx, posy, posz real (r8b), dimension (:), allocatable :: posx_n, posy_n, posz_n real (r8b), dimension (:), allocatable :: dist_com, avj_dist_com integer (i4b), dimension (:), allocatable :: bin_array real (r8b) :: comx, comy, comz integer (i8b) :: niter, natom, dist integer (i8b) :: i,j,ii,k integer (i1b) :: xyz_format, flagr, flagm, flag_com integer (i8b) :: bin integer (r8b) :: max_dist character (50) pos_file, com_file,bin_file character (2) jj read (*,*) pos_file

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null .

winforms - C# updating textbox text from another textbox -

i trying make program where, there blank text in textbox 2, type text textbox 1 updates , goes textbox 2 so basically, textbox 1 empty, whatever typed in textbox1 updates , goes textbox 2 view images below understand mean. http://i.stack.imgur.com/2djk6.png http://i.stack.imgur.com/5kpax.png you don't need ((textbox)sender).text; . try this: private void textbox1_textchanged(object sender, eventargs e) { textbox2.text = this.textbox1.text; } update : responding newest comment, here's how can replace field values on enter. if want string.replace when user hits enter, go textbox events, keyup , , add code: private void textbox1_keyup(object sender, keyeventargs e) { if (e.keycode == keys.enter) { this.textbox2.text = this.textbox1.text.replace("whatever", "something else"); } }

java - Pass -XX:-OmitStackTraceInFastThrow to jvm in jnlp file -

i'm missing stack trace in log file , believe due stack trace being optimized away jvm (see nullpointerexception in java no stacktrace ) i have tried pass in -xx:-omitstacktraceinfastthrow via jnlp file this: ...java-vm-args="-xx:-omitstacktraceinfastthrow"... but has no effect. , looks setting -xx:-omitstacktraceinfastthrow (see jnlp file syntax ) via java-vm-args not supported. is there way of stopping jvm omitting stack traces? --- edit: i added -xx:-omitstacktraceinfastthrow via control panel > java > java (tab) > view (button) > runtime parameters (field) as (described here ) worked fine.

android - Adjusting height of a Custom layout in a dialog -

Image
i have dialog custom layout, working fine, except there big empty spaces @ bottom cannot remove. any suggestion how can remove empty space. here code: public dialog oncreatedialog() { final alertdialog.builder builder = new alertdialog.builder( this); // layout inflater layoutinflater inflater = getlayoutinflater(); // inflate , set layout dialog // pass null parent view because going in dialog layout builder.setview(inflater.inflate(r.layout.dialogue_cover_staying, null)) // add action buttons .setpositivebutton("done", new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int id) { //action } }) .setnegativebutton("cancel", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int id) { finish(); }

yii2 - Click a button twice to POST -

this view file signin page <?php $form = activeform::begin(); ?> <?= $form->field( $model, 'email' )->textinput( [ 'maxlength' => 200 ], [ 'id' => 'email' ] ) ?> <?= $form->field( $model, 'password' )->passwordinput( [ 'maxlength' => 200 ] ) ?> <div class="form-group"> <div class="col-lg-offset-1 col-lg-14"> <?= html::submitbutton( 'login', [ 'class' => 'btn btn-danger btn-block btn-lg', 'name' => 'login-button' ] ) ?> </div> </div> <input type='sub' name='submit' value='reset password' class="btn btn-link btn-default" '> <?php activeform::end(); ?> it works have click on login button twice. there no other problem in signing in. don't have clue why have click login button t

php - If I do not update any information in my update form and click "Save" button,the valu of my database auto increase -

i in learning stage in php.please me update form.advanced thanks. have form update user information button "save" , "reset" button.i update information version number increase.but problem when not update information , click on "save" button version number increases.it should not increase.i giving controller , form code.... public function actioncreate() { $model=new cvupload; $model2=new cvupload; $usertype=new usertype; $cvhistory=new cvhistory; $this->performajaxvalidation($model); if(!empty($_post)) { $id = $_post['cvupload']['user_id']; $cv_type = $_post['cvupload']['cv_type']; $criteria = new cdbcriteria(); $criteria->condition = "user_id = $id , is_current='yes' , cv_type='$cv_type'"; $cvuploadmodel = cvupload::model()->find($criteria); if(!empty($cvuploadmodel)) { $cvuploadmo