Posts

Showing posts from September, 2012

postgresql - Set initdb and pg_ctl -

i installed postgresql source. i tried running commands: which initdb pg_ctl but blank response. i know these executables reside in directory. how might set initdb , pg_ctl ? thanks help. you have received blank output command 'which', these binaries not known linux machine. , hence need run these binaries using './' (like ./pg_ctl) can add path of postgres bin directory $path. eg. export path=$path:/postgres/installation/path/bin/ you can set permanently adding above path value in .bash_profile file in home of directory of postgres user.

javascript - Posting data in form html to server using AngularJS Http Post -

i ask posting problem, have form below, in form, have using ng-submit , ng-click function didn't work, can me? <form method="post" class="sky-form" name="form"> <div class="row"> <div class="col col-12"><img src="public/images/icon_namapasien.png" alt=""/> nama pasien</div> </div> <div class="row"> <div class="col col-10"> <div ng-repeat="profile in profil"> <label class="input disabled"> <input type="text" ng-model="profile.name"> </label> </div> </div> <div class="col col-2"> <a class="btnstatus">&nbsp;</a> </div> </div><!-- /row --> <div class="row...

python - Get the first url from list that contains 'posts' in it -

i have list: ['http://exampleurl.com/index.php', 'http://exampleurl2.com/in_dex1.php', 'http://exampleurl.com/posts/images', 'http://exampleurl2.com/posts/tags/etc'] how first url contains 'posts' ? your approach correct needs few changes. can loop through list this: x = ['http://exampleurl.com/index.php', 'http://exampleurl2.com/in_dex1.php', 'http://exampleurl.com/posts/images', 'http://exampleurl2.com/posts/tags/etc'] in x: if 'posts' in i: print break

WCF Activation for MSMQ where the service (.svc) is on the root -

vs 2012/.net4.5, windows 8/iis8 , 64 bit using wcf service application, documentation i've seen far in naming msmq queue match service name assume fact using application or virtual directory underneath iis website. this quoted msdn http://msdn.microsoft.com/en-us/library/ms789042.aspx the application being activated must match (longest match) prefix of queue name. for example, queue name is: msmqwebhost/orderprocessing/service.svc. if application 1 has virtual directory /msmqwebhost/orderprocessing service.svc under it, , application 2 has virtual directory /msmqwebhost orderprocessing.svc under it, application 1 activated. if application 1 deleted, application 2 activated. also, http://blogs.msdn.com/b/tomholl/archive/2008/07/12/msmq-wcf-and-iis-getting-them-to-play-nice-part-1.aspx however when hosting msmq-enabled service in iis 7 was, queue name must match uri of service's .svc file. in example we'll hosting service in applicat...

javascript - How to define modules or classes in ExpressJS -

i need define modules/class have list of methods. each of methods have instance of kind of service, loggers, promises... etc. how can clean code? in code have next logger definition, cannot add more methods because it's not large pile of it. logger/ticket.js var log4js = require('log4js'); module.exports = function(){ var _getticketlogger = function(){ var logger = null; log4js.loadappender('file'); log4js.addappender(log4js.appenders.file(__dirname + '/../log/ticket.log'), 'ticket-log'); logger = log4js.getlogger('ticket-log'); logger.setlevel('debug'); return logger; } return { getticketlogger: _getticketlogger }; }; you can use exports , module.exports can either export method or function. const test = exports = module.exports = {} and add many methods like test.method1 = function () { ... } test.method2 = function () { ... }

java - How to make a word triangle with spaces where next characters will appear -

i'm having trouble creating spaces before string. want this na ana nana anana banana here code now public static void main(string[] args){ string str = "banana"; for(int y = str.length() - 1; y >= 0 ; y--) { system.out.println(str.substring(y)); } } na ana nana anana banana i need characters shifted right many characters string. system.out.format("%"+str.length()+"s%n", str.substring(y)); definitely better if store length first, suggested in comment string str = "banana"; string formatstring = "%"+str.length()+"s%n"; for(int y = str.length() - 1; y >= 0 ; y--) { system.out.format(formatstring , str.substring(y)); }

sql - Extra column on table vs size on disc -

simple question ya'll. i want add float column data table has 1 million rows. how more storage on server drive chew 1 column? thanks in advance. the default size of float, according documentation 8 bytes, gives million rows x 8 bytes added, 8mb + space used indexes, if need that.

html - Why won't my nav be 100% in width relative to the browser -

if test out code , resized browser window, last list-item "sign up" when hovered (is way tell) doesn't stretch 100%. i've tried many different ways. if can test out , find solution; please explain how fixed way can learn. please. html, body { margin: 0; padding: 0; height: 100%; width: 100%; background-color: rgba(182, 182, 182, 1); } div.main_container { position: fixed; height: 100%; width: 100%; background-image: url("../images/img_0060.jpg"); background-repeat: no-repeat; background-size: cover; background-attachment: fixed; } div.nav_container { position: fixed; z-index: 1; height: 50px; width: 100%; min-width: 700px; background-color: rgba(34, 34, 34, .75); } ul.nav { margin: 0; padding: 0; list-style: none; list-style-type: none; height: 100%; width: 100%; } ul.nav li { background-color: transparent; display: table; float: left; height: 50px; widt...

java - Using VLCJ for DVB-T tuner -

in our country there dvb frequency of 570000000 3 channels/programs; 16,17,18 this mrl using change channel vlc via batch file replacing :program value. "c:\program files (x86)\videolan\vlc\vlc.exe" dvb-t://frequency=570000000:bandwidth=8 :dvb-adapter=0 :live-caching=1000 :program=16 but when use same mrl via vlcj seems :program not have effect , randomly show channel without changing code. import uk.co.caprica.vlcj.discovery.nativediscovery; import uk.co.caprica.vlcj.player.mediaplayer; import uk.co.caprica.vlcj.player.mediaplayerfactory; public class vlcjtest { public static void main(string[] args) throws exception { new nativediscovery().discover(); final mediaplayerfactory factory = new mediaplayerfactory(); final mediaplayer mediaplayer = factory.newheadlessmediaplayer(); string str = "dvb-t://frequency=570000000 :bandwidth=8 :dvb-adapter=0 :live-caching=1000 :program=16"; mediaplayer.playmedia(st...

javascript - How to add date and sender name to chat bubble -

Image
hey have created kind of simple chat bubbles, want add sender date , sender name. sender name need above each bubble , sender date need beneath each bubble, have try many times , failed. happy suggestions. final result should $('#build').bind('click', function() { var inputtext = $('#buildinput').val(); var regmessage = /^#(\d):\s([^#.]*)/gm; var messages = inputtext.split(regmessage); $('#chat').empty(); (var i=1; i<messages.length; i=i+3) { addmsg(messages[i], messages[i+1]); } return false; }) $('#send').bind('submit', function() { var msgtext = $('#msginput').val(); $('#msginput').val(''); if (msgtext != '') addmsg(1, msgtext); $('#chat').animate({ scrolltop: $('#chat').height() }, 600); return false; }) function addmsg(people, msg) { console.log('addmsg'); var side = 'right'; var $_phone = ...

java - What is wrong with my TicTacToe code and how do you check already taken spots? -

i have edited question. feel close reason output of code prints 'x' or 'o' above board. can't pinpoint why doing , how check if spot taken , not allow spot overridden. have tried putting if(board[i][j]!= ' ') {s.o.p("not valid") }but not function correctly. maybe i'm not writing in wrong spot? the last thing when want restart game winner declared. how game reset board? i have been @ hours , appreciate help. import java.util.scanner; public class tictactoe { public static char[][] board = new char[3][3]; public static char player; public static void newgame() { system.out.println("new game: x goes first."); player = 'x'; } public static void writeboard() { //drawing game board string line = "______"; system.out.println(""); //making seperate columns , rows for(int i= 0;i<3; i++) { for(int j=0;j<3;j++) system.out.print(board[i][j]+"|...

php - Reverse log like tail -

i reverse system log. my system log looks this: [ 2016-03-17t15:52:00+08:00 ] 0.0.0.0 /pwebshell/index.php/log/getlog info: [ route_check ] --start-- info: checkroute behavior ::run [ runtime:0.001000s ] info: [ route_check ] --end-- [ runtime:0.001000s ] info: [ app_begin ] --start-- info: readhtmlcache behavior ::run [ runtime:0.001000s ] info: [ app_begin ] --end-- [ runtime:0.001000s ] [ 2016-03-17t15:52:16+08:00 ] 0.0.0.0 /pwebshell/index.php/log/getlog info: [ route_check ] --start-- info: checkroute behavior ::run [ runtime:0.000000s ] info: [ route_check ] --end-- [ runtime:0.001000s ] info: [ app_begin ] --start-- info: readhtmlcache behavior ::run [ runtime:0.000000s ] info: [ app_begin ] --end-- [ runtime:0.000000s ] i print this: [ 2016-03-17t15:52:16+08:00 ] 0.0.0.0 /pwebshell/index.php/log/getlog info: [ route_check ] --start-- info: checkroute behavior ::run [ runtime:0.000000s ] info: [ route_check ] --end-- [ runtime:0.001000s ] info: [ app_begin ] --start...

Fullcalendar minTime ajax -

i'm trying change mintime in fullcalendar according database schedule through ajax request on viewrender, goes loop. part of calendaroptions: var calendaroptions = { header: { left: ' today', center: 'prev,title,next', right: 'agendaweek,resourceday' }, defaultview: 'resourceday', the viewrender: viewrender: function(view, element){ var curdate = ($('#calendar').fullcalendar('getdate')).format('d-dd-mm').split('-'); var curweekday = curdate[0]; var curmonthday = curdate[1]; var curmonth = curdate[2]; $.ajax({ url: 'calendar/getbusinesshours', type: 'get', data: { 'day': curweekday, "_token": $('body').find( 'input[name=_token]' ).val() }, success: function (response) { $('...

Incremental migration from VSS 2005 to Git -

i have relatively big vss 2005 database want migrate git. it's not definitive migration yet. i need perform tests on migration see if there. meanwhile, coworkers still keep using vss 2005. nothing fancy on vss use, no branches or merges. checkouts , checkins. maybe new files added. is possible migrate on condition? have idea on best way this?

php - Sharing google docs with write permission -

please me! i'm new google apis i have front end page users request access edit google doc. i'm using php server side scripting. i want dynamically add edit access user upon request. explored , found it's possible google drive sdk. i'm not getting how it. i tried php example @ php sample i want add single user each time , not in batch. should include code? google drive apps can manage permission , sharing settings of files. permission collection provides apps ability read, update , delete permission users, google groups, google apps domains, , public. visit page information on manipulating permission.

install - How to fix this error in R while installing packages? -

this did: install.packages("tsa",lib="d:/r/packages") library(tsa,lib.loc="d:/r/packages") install.packages("leaps",lib="d:/r/packages") still getting error: library(tsa,lib.loc="d:/r/packages") #error: package ‘leaps’ required ‘tsa’ not found there package tsa cran. if want install it: install.packages("tsa") if have .tar.gz files. suggest using hadley wickham's devtools package . allows loading package given directory: library(devtools) # load package w/o installing load_all('d:/r/packages') # or invoke 'r cmd install' install('d:/r/packages')

java - Is it possible to ask server side to execute a method without using RMI? -

i couldn't try out since don't have java web server. idea sent number server via sockets. number sent dependent on user's response or requirement. for example: consider tic-tac-toe game. let's imagine user lost match , want user enter yes replay or no exit. if user enters yes , program write number (eg. 1) outputstream of socket. now, server receives number using inputstream , stores in integer variable. if finds number entered 1 , game begins again. there methods handle these numbers received. is possible communicate server , invoke remote method in manner? if yes, why rmi designed when can done coding (pretty easily)? is possible communicate server yes. and invoke remote method no. server invoking method locally. you're sending number telling do. no remote method invocation here. why rmi designed when can done coding (pretty easily)? rmi provides syntax calling remote method directly, without having worry about: ...

php - Send email to single user in loop -

Image
i trying send bulk email php yii . , using yii extension smtpmail. problem when selecting more 1 recipient. sending email . mean adding in "to". if using simple mail function working . , email going individuals. here code $sent=$this->sendbulkemail($inv->to_email,usermodule::t("invitation {site_name}",array('{site_name}'=>yii::app()->name)),usermodule::t($template,array('{msg}'=>$msg,'{link}'=>$link))); and email function public function sendbulkemail($email,$subject,$message) { $adminemail = yii::app()->params['adminemail']; $message = wordwrap($message, 70); $message = str_replace("\n.", "\n..", $message); // $mail2 = new phpmailer(); // create new object $mail=yii::app()->smtpmail; $mail->setfrom($adminemail, 'goal surf'); $mail->subject = '=?utf-8?b?'.base64_encode($subject).'?='; ...

menuitem - Click event or item selection on dynamically loaded menu and submenu in android -

i trying implement click/item selection on dynamically loaded menu item , submenu item server in android. how should find out or define item id has been loaded server? i adding new menu , submenu server way ... private class httpasynctaskcheckasset extends asynctask<string, void, string> { @override protected string doinbackground(string... urls) { return get(urls[0]); } @override protected void onpostexecute(string result) { navigationview navigationview = (navigationview) findviewbyid(r.id.nav_view); menu m = navigationview.getmenu(); submenu topchannelmenu = m.addsubmenu("assets"); try { jsonarray jarray = new jsonarray(result); (int = 0; < jarray.length(); i++) { jsonobject jsonobject = jarray.getjsonobject(i); jsonarray jsonassets = jsonobject.getjsonarray("assets"); ...

html - outerHTML behavior in a <template> -

given <template> : <template id="my-template"> <h1 id="h">hello!</h1> </template> and js: var t = document.queryselector("#my-template"); var h = t.content.queryselector("h1"); h.outerhtml = "<h3>aaaaaaaaaaaaaa</h3>"; it's interesting works in firefox , edge in chrome outerhtml requires parent element, otherwise throws error in console ( https://chromium.googlesource.com/chromium/blink/+/master/source/core/dom/element.cpp#2528 ): <template id="my-template"> <div> <h1 id="h">hello!</h1> </div> </template> see https://jsfiddle.net/q5fmn186/11/ my question is, chrome behavior correct one? should setting outerhtml not work in <template> on direct children? why aren't other web-browser treat error? the other web browsers won't treat error because following dom parsing , serial...

how to login with facebook using facebook csharp sdk in asp.net mvc? -

i want implement facebook login system in webpage, didn't succeed below put code have written: private uri redirecturi { { var uribuilder = new uribuilder(request.url); uribuilder.query = null; uribuilder.fragment = null; uribuilder.path = url.action("facebookcallback"); return uribuilder.uri; } } [allowanonymous] public actionresult facebook() { var fb = new facebookclient(); var loginurl = fb.getloginurl(new { client_id = "appid", client_secret = "appsecret", redirect_uri = redirecturi.absoluteuri, response_type = "code", scope = "email" }); return redirect(loginurl.absoluteuri); } public actionresult facebookcallback(string code) { var fb = new facebookclient(); dynamic resul...

Python: sort list based on value present in dictionary -

consider list x = [obj1,obj2,obj3,obj4,obj5] grouped in manner obj1.freq = obj2.freq = frequency1 , obj3.freq = obj4.freq = obj5.freq = frequency2 and have dict y = {obj1 : 40, obj2 :50, obj3:60, obj4:10, obj5:70, obj6:30, obj7:20} i have sort list x considering obj of same frequency , sort based on values of obj present in dict , final result should x = [obj2,obj1, obj5,obj3,obj4] 1st consider obj1 , obj2 because belong same frequency , sort looking values in dict y . obj2 value 50 , obj1 value 40 . so list x sorted such 1st element obj2 followed obj1 and have same next set of objects belonging same frequency , sort based on value present in dict y how do ? this code uses tuple (frequency, value-in-y) sort key; list sorted in reverse order, highest frequency comes first (was not specified in question, if wrong, can use -i.freq there); objects having frequencies sorted second item in tuple (the value dictionary y , if any, or 0: class obj: ...

Setting up Fuseki 2 in Openshift -

i trying set fuseki 2 instance in openshift. have tried using diy cartridge , running fuseki 2 standalone server bound 8080 port, required openshift. this command employed lauch server: ./fuseki-server --port=8080 unfortunately, there problem port binding , not work: [2016-03-17 05:16:16] server info fuseki 2.3.1 2015-12-08t09:24:07+0000 [2016-03-17 05:16:16] config info fuseki_home=/var/lib/openshift/56e9715489f5cfd91e00001a/app-root/runtime/repo/fuseki-2.3.1 [2016-03-17 05:16:16] config info fuseki_base=/var/lib/openshift/56e9715489f5cfd91e00001a/app-root/runtime/repo/fuseki-2.3.1/run [2016-03-17 05:16:16] servlet info initializing shiro environment [2016-03-17 05:16:16] config info shiro file: file:///var/lib/openshift/56e9715489f5cfd91e00001a/app-root/runtime/repo/fuseki-2.3.1/run/shiro.ini [2016-03-17 05:16:17] server error sparqlserver: failed start server: permiso denegado java.net.socketexception: permiso denegado @ sun.nio.ch.net.bin...

javascript - How to change width of a div by using jQuery in terms of percentage? for ex- to double the div's size upon mouse click -

i've come across methods change div size px, em , points. couldn't find way same percentage. in jquery possible set dimensions div based following $("#whatever").css("width/height", "x%"); ref http://api.jquery.com/css/#css-propertyname-value or can use dom document.getelementbyid('whatever').style.width = 'x%';

class - Beginner C++ pointer -

i reading code snippet , saw file * infile = fopen("input.wav","rb"); i want ask 2 questions here. what file here. class, object or else. what infile pointing to. have seen pointers int, char etc. pointing to. file a structure containing information file in stdio.h infile points object returned fopen , type file

css - Ionic 2: Remove gigantic padding from form elements -

Image
q) have following page grid structure , want remove padding around it's not huge. there nice way doesn't ruin ionic styling out of box? here's structure: <ion-content> <ion-row baseline> <ion-col width-90> <ion-item> <ion-label stacked>email</ion-label> <ion-input type="text"></ion-input> </ion-item> </ion-col> <ion-col width-10> <ion-icon name='more'></ion-icon> </ion-col> </ion-row> <ion-row baseline> <ion-col width-90> <ion-item> <ion-label stacked>floor</ion-label> <ion-select item-right> <ion-option value="nes">nes</ion-option> <ion-option value="n64">nintendo64</ion-option> <ion-option value="ps">playstation</ion-option> <ion-optio...

How google Analytics will calculate page views when 10 computers connected in same network -

i want know following informations 1.how google analytic s calculate page views 2.sessions. 3.users all things being equal data collected per client, not per network. i.e. tracking code generates clientid per browser (or client program) stored in cookie per browser, , used aggregate pageviews sessions , users. geo information (and ip filtering) of course same users share external ip, other there no effect on reports.

unix - Check if a file exists or not in shell in a particular directory -

this question might seem silly, stumped, not sure wrong. anyways, have piece of code checks if particular file exists in directory or not. code works fine normal files, normal files mean.. of sort "abc.xlsx or xaga1.xlsx". problem when pass file spaces, seems fail, mean.. check fails. i'll go straight code: if [ ! -e "$file" ] echo_time "error: $file not exist - aborting" >> $filechangedlog exit 1 fi if check in log file output being redirected, can see following line: [03/17/16 11:07:09] error: "/opt/just4share/tellabs/tellabs_nodes 2.xlsx" not exist - aborting but if ls error path following output: [netcool@hjkpnlin03 scripts]$ ls -lrt "/opt/just4share/tellabs/tellabs_nodes 2.xlsx" -rw-rw-r--+ 1 netcool ncoadmin 17412 mar 17 10:43 /opt/just4share/tellabs/tellabs_nodes 2.xlsx this confirms file exists however, code fails find it. doing wrong here? :| edit: have tried -f switch in place of -e switc...

extjs - How to attach an On Click event for Icon In Ext.js -

i have ext.js container header , header contains text title , icon . used refresh tab . how can icon click event container header ? ive used icon: '@url.content("~/images/icon-supp.png")', getting icon next text. here code: 'tabchange' activates when tab changed , not while clicked on icon. more information : have center container . im adding ext.tab.panel , has items: [ { xtype: 'container', title: 'footext', id: 'foopanel', icon: '@url.content("~/images/icon-refresh.png")', tools: [{ type: 'help', handler: function(){ //doesnt hit on click of tab } }, { itemid: 'refresh', type: ...

python 3.x - Kivy Scrollable Label and text file, label wont update -

hy, problem current code, @ point preety nothing text editor, when ever try make scrollable label in kv language , call on main screen @ push of button, no error, theres nothing there. should mention text taken stored file, , version works regular label. code, know bit long preety easy understand stay me. sort of input apreciated , thank taking time. #kivy.require("1.8.0") kivy.app import app kivy.lang import builder kivy.uix.screenmanager import screenmanager, screen, fadetransition kivy.uix.widget import widget kivy.uix.scatter import scatter kivy.uix.label import label kivy.uix.scrollview import scrollview kivy.uix.floatlayout import floatlayout kivy.uix.textinput import textinput kivy.properties import stringproperty kivy.uix.boxlayout import boxlayout kivy.graphics import line kivy.uix.gridlayout import gridlayout kv = ''' #: import fadetransition kivy.uix.screenmanager.fadetransition screenmanager: transition: fadetransition() mainscreen: ...

php - Paypal IPN sends invalid response after successful payment completion -

first thing first, language: php framework: code igniter this first time i'm implementing paypal payment in website users can pay paypal accounts owner. obviously. tutorial followed implementing paypal payment here . , implementing ipn listener, used this code. wrote ipn listener in core php , it's standalone file (no relation codeigniter framework or website). cron job makes file run 24x7. thought that's necessary not quite sure. ipn listener listens every time , whenever paypal sends ipn, takes data post , checks verification. if verified, write post data database , log file accordingly. this whole things mess , think made worse. my ipn listener is: <?php require_once 'query.php'; define("debug", 1); define("use_sandbox", 1); define("log_file", "./ipn.log"); $raw_post_data = str_replace('=utf-8', '=utf-8', file_get_contents('php://input')); $raw_post_array = explode('&',...

html - Find Bootstrap div with 100% width correct behavior -

i'm trying overflow table in bootstrap loader div has 100% width. i've made fiddle here: https://jsfiddle.net/dtchh/18316/ here's code: html: <div class="container"> <div class="row"> <div class="col-md-12"> <div id="loadertable"></div> <table class="table-bordered table-striped table-condensed" width="100%"> <thead> <th>data inizio</th> <th>ora inizio</th> <th>data fine</th> <th>ora fine</th> <th>attività</th> <th>struttura</th> <th>dettagli</th> <th>salva evento</th> <th>stato</th> </thead> <tbody> <tr> ...