Posts

Showing posts from January, 2010

c - How to make two processes signalling each others continuously? -

i want simulate game server should continuously send , receive signals parent. scenario follows: parent sends signal game. game catches signal , sends signal parent. parent catches signal , sends again signal game. and on... the problem stops receiving or sending after first lap: static int game_s; void game() { printf("game\n"); signal(sigusr1,game); sleep(1); kill(getppid(),sigusr1); pause(); } void parent() { printf("parent\n"); signal(sigusr1,parent); sleep(1); kill(game_s,sigusr1); pause(); } void main() { game_s = fork(); if(game_s>0) { signal(sigusr1,parent); sleep(1); kill(game_s,sigusr1); pause(); } else { signal(sigusr1,game); pause(); } } the output following: game parent why stopped here? shouldn't game server catch parent's signal , print "game" again... by default reception of

java - Tomcat Data Source Losing Connection With DB -

i need solution tomcat datasource configuration. have 2 nginx front of tomcats.these feeding app, these webservice. tomcat machines , database in different ip blog going firewall in each request. when started tomcats everythigs well.but example after 10 hour our after 20 hour later everythings going bad.that tomcats can not set connection.all service down.i share datasource file , hope find solution or other suggestions other datasource file. http://www.springframework.org/schema/beans ---- http://www.springframework.org/schema/context/spring-context.xsd "> <property name="connectionproperties"> <props merge="default"> <prop key="v$session.program">ws_${server}</prop> </props> </property> <property name="connectioncacheproperties"> <props merge="default"> <prop key=&qu

How can i add multiple images using php powerpoint library? -

can u pls tell me how bind multiple images in powerpoint using php powerpoint library? in below code used foreach loop add multiple images in powerpoint 1 image adding pls me. <?php require_once("db_config.php"); set_include_path(get_include_path() . path_separator . 'classes/'); include 'phppowerpoint.php'; include 'phppowerpoint/iofactory.php'; ?> <html> <h3 align="center">welcome <?php echo $_session['user_name'];?> <br> <a href="logout.php">logout</a> </h3> <body> <?php echo "<div align='center'>"; echo "<form method='post' action=''>"; echo "<table align='center' border='1'> <tr> <th></th> <th>id</th> <th>firstname</th> <th>lastname</th> <th>username</th> </tr>"; $result = mysql_query("selec

laravel 5.2 - FatalErrorException in RouteServiceProvider.php -

i'm using laravel 5.2 , caffeinated modules , when try go somewhere error. fatalerrorexception in routeserviceprovider.php line 42: modules\users\providers\routeserviceprovider::modules\users\providers{closure}(): failed opening required 'modules/users/http/routes.php' (include_path='.;c:\php\pear') this routes.php in users module route::group(['middleware' => 'web'], function() { route::get('admin/', [ 'uses' => 'userscontroller@admin', 'as' => 'login' ]); }); i'm not sure other code need give solve this. i had same problem , fixed it. replace '\' in path '/'.

xml - getting all nodes of the same type -

i trying nodes of type erad long list of erad nodes found in xml here code first erad item how change erads each item. xml regular repeating pattern sub macro1() dim strurl string dim strxpathbase string dim objdoc object set objdoc = createobject("msxml2.domdocument") strurl = "https://....xml" objdoc.async = false objdoc.load strurl strxpathbase = "//response/responsebody/responselist/item/" debug.print "erad1: " & objdoc.selectsinglenode(strxpathbase & "erad1").text set objdoc = nothing end sub simply iterate off parent, <item> , print child nodes <erad1> . below uses binding of msxml objects: sub macro1() dim strurl string dim strxpathbase string ' add vba reference: microsoft xml, v6.0 ' dim objdoc new msxml2.domdocument60 dim itemnode msxml2.ixmldomnodelist dim variant strurl = "https://....xml" objdoc.async = false objdoc.lo

RFID reading using python via usb SyntaxError: invalid token -

i have 2 rfid card values 0004518403 , 000452738 after reading value in python terminal. want give them name 0004518403 "javed" , 000452738 "aquib". when next time when use card must not show me value must show me name i've defined them. import serial import time serial = serial.serial('/dev/ttyusb0', baudrate = 9600) while true: if serial.inwaiting() > 0: read_result =serial.read(15) print("sleeping 2 seconds") if(read_result==0004520738): print "aquib" elif(read_result==0004518403): print "javed" time.sleep(2) serial.flushinput() # ignore errors, no data i trying code show me error : syntaxerror: invalid token in first if condition. not getting problem. you should compare read results strings, not numbers, read_result=='0004520738' 0004520738 without quotes number. starts 0 sign, interpreted number of base 8. numbers of base 8 cannot contain dig

android - how to add dot indicator and circular way transition in image slider using ViewPager -

here make simple slider want know how apply simple dot indicator in code .and thing want apply how apply circular transition in image slider .. here code: imageslider.java import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.app.activity; import android.support.v4.view.pageradapter; import android.support.v4.view.viewpager; import android.view.menu; import android.view.view; import android.widget.adapterview; public class imageslider extends activity { viewpager viewpager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_imageslider); viewpager = (viewpager) findviewbyid(r.id.viewpager); pageradapter adapter = new sliderimage(imageslider.this); viewpager.setadapter(adapter); } @override public boolean oncreateoptions

ios - Development Pod can't import module from dependency Pod if its a .framework -

i've created pod pod lib create asauthframework , add dependency in .podspec: s.dependency 'reactivecocoa' , updated example project pod (with asauthframework) , import reactivecocoa module: screenshot . added new dependency: s.dependency 'firebase/auth' , updated example project's pod , not import firebaseauth module development pod, in example project's viewcontroller: screenshot . ideas? i've created project problem: repo: github.com/anekk/dvpodauth.git run example's root: pod install open .xcworkspace

hadoop - Does hive create separate copy of data -

when create table in hive using csv file hdfs hive create separate copy of data? this cause unnecessary waste memory no, in hive whatever hdfs location have given @ time of table creation. data reside @ same location. there wont separate copy of data either csv or other file formats.

angularjs - Unable to download JSON from CROS Domain request -

i wanted download json below url http://www2.rsphinx.com/static/misc/cric_scores.json server allowed cross domain requests also. but every time getting error of cross domain request i have used below code var def = $q.defer(); $http({ method: 'get', url: scoreserviceurl }).success(function (data) { dummydata = data; def.resolve(data); }) .error(function (err, data, hf, g) { def.reject("failed score details"); }); return def.promise; i have tried method jsonp, returns me 404 error. have tried http://www2.rsphinx.com/static/misc/cric_scores.json?callback=json_callback url not working. can suggest me wrong doing here. thanks

kendo ui - Programatically show wait icon in ListView Aurelia KendoUI -

in 1 of solutions , said: $('<div class="k-loading-mask" style="width: 100%; height: 100%; top: 0px; left: 0px;"><span class="k-loading-text">loading...</span><div class="k-loading-image"></div><div class="k-loading-color"></div></div>') .appendto('#listview .k-grid-content'); it doesnt seem work, couldnt work. appreciated!

web services - Segmentation fault in SOAP after upgrade PHP from v5.4.45 to v5.6.21 -

i'm receiving segmentation fault after upgrade of php version v5.4.45 v5.6.21. i've read documentation upgrading php, , there's no mentioning of breaking changes in soap. i tested in test environment has same versions. however, in our production environment, fails. call failing talks soap service , uses soapclient in php. i'm not familiar debugging these kind of stack traces, understanding, looks it's in soap library somewhere fails. versions of software running on server (both test , production environment): php 5.6.21 mysql 5.5.49 mysql community server (gpl) remi centos: centos-release-6-6.el6.centos.12.2.x86_64 stack trace debug symbols: program terminated signal 11, segmentation fault. #0 master_to_zval_int (encode=0x2d9, data=0x7fb62db0aee0) @ /usr/src/debug/php-5.6.21/ext/soap/php_encoding.c:585 585 if (encode->to_zval) { #1 0x00007fb6167d04f2 in model_to_zval_object (ret=0x7fb62ebc4738, model=0x7fb62fba4ca8, data=0x7fb62

Can I have an implicit conversion method in a Scala case class? -

is possible have method in class implicit conversions. in case want able instantly unpack object represents pair of things 2-tuple. case class foo(a:string, b:string) { implicit def astuple:(string, string) = (a,b) } val foo0 = new foo("hello", "world") // not work! val (a:string, b:string) = foo0 the example above broken. here's 2nd attempt - broken: class foo(a:string, b:string) { val _a:string = val _b:string = b } implicit def astuple(x:foo):(string, string) = (x._a, x._b) val foo0 = new foo("hello", "world") // not work! val (a:string, b:string) = foo0 given i've managed make implicit type conversions 1 class 'just work', expect what's going wrong here more definition of tuple return type. can me out? your first example doesn't work because have define implicit in companion object or in other scope you've done second example. second example doesn't seem work because scala isn&#

Java Dependency issue, not working for hibernate -

hello trying follow tutorial :: http://www.tutorialspoint.com/hibernate/hibernate_annotations.htm my code in caseyou want have dig here: https://github.com/arthurgibbs/centaurus- im using restx framework. i trying use hibernate access local database. when try compile code dependency error: src/main/java/centaurus/service/userdao.java:7: error: package org.hibernate not exist import org.hibernate.hibernateexception; but have included in pom dont understand why getting error. this class there error points package centaurus.service; import centaurus.entity.gameuser; import restx.factory.component; import org.hibernate.hibernateexception; import org.hibernate.session; import org.hibernate.transaction; import org.hibernate.cfg.annotationconfiguration; import org.hibernate.sessionfactory; @component public class userdao { private static sessionfactory factory; public static void main(string[] args) { try{ factory = new annotationconfigur

iphone - Codec mismatch between asterisk server and my android app? -

i'm new voip application development. made iphone voip app , android voip app, , can talk friends via voip app. have own asterisk server set on linux operating system. in making phone voip app, used whichever codec native sip library integrated (in case, linphone sip library). i'm interested in figuring out codec being used. after debugging, android app says i'm using pcmu codec. unusual because in asterisk server sip.conf file, allow ulaw , gsm codecs. so question is, how come voip app works when there's mismatch in codecs between phone app (using pcmu) , asterisk server (allowing ulaw , gsm)? i'd expect app break because of codec mis-match. please check answer in other question. note, pcmu=ulaw=g711u. different names

angularjs - How to access helpers in controller and why is my find() empty? -

i'm pretty new new meteor 1.3.1. i've never worked helpers before. this helper: this.helpers({ questions() { return questions.find({categoryid: this.categoryid}); } }); first question: how access helper ( questions ) within it's own controller? tried $scope.questions , this.questions , this.play.questions ( play alias of controller). undefined . in view iterate ng-repeat='question in play.questions' , works fine. then thought maybe helpers can't accessed in controller. tried this: this.questions = questions.find({categoryid: this.categoryid}); but here problem empty cursor. idea why is? i assume in controller function , have used $reactive(this).attach($scope) before this.questions = questions.find({category: this.categoryid}); ? 1 reason cursor empty when not using helper might subscription not ready time set this.questions . therefore should make assignment reactive wrapping inside this.autorun . doing cursor

Auto fill-in data (input field) from MySQL Database in PHP (PDO) -

Image
this post contains: 3 php pages mysql table picture picture of form as title says, need extract information from database . so far have following: index page <-- need login here personal code. (this 'session username' works @ contact page) config page <-- used database access , all contact page <-- in here auto fill-in users data. database table consists of: username; email; realname (and other stuff don't need here) so in contact page see following: card number = username (this works) auto fill-in: realname , email according username. maybe possible extract info when logging in , storing these in post variable already? how? database: table need use: 'members' the info given user himself/herself = username the info need auto fill-in = realname , email picture of form. the email should in session statement, can send confirmation email person, , realname should entered database. these

c# - a field initializer cannot reference the nonstatic field -

i have no idea why isn't working public partial class form1 : form { public form1() { initializecomponent(); } private button[,] button = new button[3, 3]{ {button1, button2, button3 }, {button4, button5, button6 }, {button7, button8, button9 } }; private void button_click(object sender, eventargs e) { } } i error a field initializer cannot reference nonstatic field on 9 buttons a field initializer (as error states) can not reference nonstatic fields or values. button1 button9 not static. achieve same result, move array initialization in constructor of form: private button[,] button; public form1() { initializecomponent(); button = new button[3, 3]{ {button1, button2, button3 }, {button4, button5, button6 }, {button7, button8, button9 } }; }

ios - JSQMessagesViewController with SupplementaryView fixed on top -

have overridden collectionview:viewforsupplementaryelementofkind:atindexpath: show header view jsqmessagesviewcontroller subclass in swift. works well, header view scrolls chat, , have fixed on top. apple introduced in ios 9 sectionheaderspintovisiblebounds property, , should have fixed header view, reason doesn't work in jsqmessagesviewcontroller subclass. have added self.collectionview.collectionviewlayout.sectionheaderspintovisiblebounds = true viewdidload() another solution tried (from post how make supplementary view float in uicollectionview section headers in uitableview plain style ), subclass jsqmessagescollectionviewflowlayout, , worked. when swiping up, header view stays fixed on top, , chat messages pushed under header view. try swipe down, receive following error in console when app crashes: *** assertion failure in -[uicollectionviewdata validatelayoutinrect:], /buildroot/library/caches/com.apple.xbs/sources/uikit/uikit-3512.60.12/uicollectionviewdata

php - Subsequently uploaded button does't work -

i wanna make system system suggest books user jquery , user it. first, @ index.php has 2 suggested book. , there no problem. user can click button. , new book uploaded insted of liked book. user can not click button. page can not connect functions.js page. my codes is: at index.php <!-- suggest book --> <div class="book-box" id="<?php echo $book_id;?>" style="background: #fff;box-shadow: 0 0 1px 1px rgba(0,0,0,.2); min-height: 60px;margin-bottom: 10px!important;bg-444;" data-target="<?php echo $book_id;?>"> <img src="img/<?php echo $ki_image;?>" style="width:100%; height: 150px;padding:0;" alt=""> <div class="container-fluid" style=""> <div class="row" style=""> <div class="caption mt5 p5" style="">

prolog - Is there any way to combine artificial intelligence/expert system with vb.net programs? -

i have learnt swi-prolog, expert system/artificial intelligence designer uses declarative programming. wish combine existing vb.net 2010 console , windows forms programs make basic user friendly expert system. how go linking 2 of them functionality? or there way logic processing in vb.net? thanks in advance, vishwas

python - Finding all repeated substrings in a string and how often they appear -

problem: i need sequences of characters meet following: sequence of characters must present more once ((le, 1) invalid). sequence of characters must longer 1 character ((m, 2) invalid). sequence of characters must not part of longer existing sequence present same number of times ((li, 2) invalid if (lio, 2) present). so, if input string was: kakamneneneliolelionem$ output be: (ka, 2) (ne, 4) (lio, 2) it needs fast, should able solve 1000 character long string in reasonable amount of time. what have tried: getting amount of branches suffix tree: editing this suffix tree -creating librabry(python-suffix-tree), made program gives erroneus results. i added function suffixtree class in suffix_tree.py: def get_repeated_substrings(self): curr_index = self.n values = self.edges.values() values = sorted(values, key=lambda x: x.dest_node_index) data = [] # index = edge.dest_node_index - 1 edge in values: if edge.source_node_index == -1:

python - Make Django not lazy-load module, for development convenience -

i notice django lazy-loads modules used in project. when first run server in debug on local machine, , load page site, debugger tells me django imported more hundred modules. i'd django import modules when it's launched, , not wait first request. make development more convenient, since won't have wait more time on each first request. is possible? it looks library: https://github.com/ojii/django-load , simple, has function load module within django. if combine technique django entry point hook (like http://eldarion.com/blog/2013/02/14/entry-point-hook-django-projects/ ), should able explicitly load modules @ startup. (i did not try myself, looks feasible.)

ms access - Force user login after x min of inactivity -

i have application has 1 login form, 1 main dashboard form, 7/8 sub dashboard forms , many other non-main/dashboard forms. i implement sort of system, whereby if user has been inactive x minutes, asked login again. is there way have global function run continuously check every 60 seconds if login required? obvious way using on timer event. many forms have add call each form etc. is there easier way? i don't think there easy way this. first off, have define " user has been inactive x minutes " means. there options: the access application not focused window x minutes. (drawback: user idling access application on front, never triggering focus loss) a form not focused x minutes. (drawback: you'd have implement check routine each , every form in application, logging gotfocus and/or lostfocus events verify @ least x minutes form focused. but: user legitimately working x minutes same form never needing change focus nevertheless trigger logout.

Start Selenium Server with Firefox Portable -

i want use selenium server on windows 7 firefoxportable browser, starting selenium-server-standalon jar file. first attempt without profile, this: java -jar selenium-server-standalone-2.33.0.jar -htmlsuite "*firefox c:\users\rplantik\portables\selenium\firefoxportable\firefoxportable.exe" "http://127.0.0.1" "c:\users\rplantik\portables\selenium\rest\testsuite.html" "testresults.html" the jetty server started, crushed after having issued info message preparing firefox profile... i found out there portable app, called firefoxportable2ndprofile, allows start firefoxportable built-in profile. therefore downloaded application, too, , modified command follows, include path different profile: java -jar selenium-server-standalone-2.33.0.jar -firefoxprofiletemplate c:\users\rplantik\portables\selenium\firefoxportable2ndprofile\data\profile -htmlsuite "*firefox c:\users\rplantik\portables\selenium

c# - Get pointer value via reflection -

i have instance of type object , know pointer (can verified myobject.gettype().ispointer ). possible obtain pointer's value via reflection? code far: object obj = .... ; // type , value unknown @ compile time type t = obj.gettype(); if (t.ispointer) { void* ptr = pointer.unbox(obj); // can obtain (the object's) bytes with: byte[] buffer = new byte[marshal.sizeof(t)]; marshal.copy((intptr)ptr, buffer, 0, buffer.length); // how can value represented byte array 'buffer'? // or how can value of *ptr? // following line doesn't work: object val = (object)*ptr; // error cs0242 (obviously) } addendum №1: object in question value type -not reference type- , cannot use gchandle::fromintptr(intptr) followed gchandle::target obtain object's value... i suppose need ptrtostructure. this: if (t.ispointer) { var ptr = pointer.unbox(obj); // following line edited op ;) var underlyingtype = t.getelementtype(

oracle - Java double data type should never be used for precise values, such as currency? -

this question has answer here: double vs. bigdecimal? 6 answers when review official oracle java tutorial variables datatypes http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html i surprised when read that java double data type should never used precise values, such currency ! can 1 why? , best practice used precise values, such currency? best data type amount fields bigdecimal. joshua bloch explains in article in effective java why should used accurate precision.

Unable to see server location while installing apache in eclipse -

i trying install apache tomcat in eclipse. when doing new-> server, getting following window enter image description here after clicking on next, not asking tomcat installation directory , not able run it. please help probably installed tomcat , have deleted manually. have 2 options: delete or change workspace address in eclipse , try install tomcat again. work. delete tomcat configuration files workspace folder following: close eclipse got {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings delete these files org.eclipse.wst.server.core.prefs org.eclipse.jst.server.tomcat.core.prefs start eclipse again install tomcat again enter image description here

backtracking - NQueens Slver in python -

i making nqueen problem solver every time run program launch error: "tuple" has no attribute "row" i want know if function place structure because 1 throw error import sys #use of argv #create object queen row , column class queen: def __init__(self, row, col): self.row = row self.col = col def __repr__(self): return "row: "+ str(self.row) + " column: " + str(self.col) #validate if can place queen in space, return false or true def place(board,row,col): in range(0,len(board)-1): #attack conditions: cant place in same column, row , diagonal if (board[i].row == row) or (board[i].col == col) or (abs(board[i].row - row) == abs(board[i].col - col)): return false return true #recursive function append queen board if can place def nqueens(board,n,row): in range(1,n): #if row > n fuction return list if (row > n): return board

php - multiple entries from variable date range -

i have form on page1 has 4 inputs (name, startdate, enddate, reason). i want add entry mysql every day date range (startdate, enddate) i know how add mysql dont know how process of getting different dates , inserting them. this needs automated date ranges change every time. so 04/07/2018 - 09/07/2018 or 01/02/2017 - 02/02/2017 depending on users selection on page1. kinda follows $name = $_post['name']; $startdate = $_post['startdate']; $enddate = $_post['enddate']; $reason = $_post['reason']; insert taken (`name`, `date`, `reason`) values ('$name', '$date', '$reason') where startdate 01/01/2016 , enddate 05/01/2016 want add 5 times example insert taken (`name`, `date`, `reason`) values ('joe bloggs', '01/01/2016', 'holiday') insert taken (`name`, `date`, `reason`) values ('joe bloggs', '02/01/2016', 'holiday') insert taken (`name`, `date`, `reason`) values

android - How to fix "your api request count has exceeded?" for tmdb.org? -

my code working fine initially, of sudden i'm not able display posters on app. i'm getting particular error. i've removed while(true) loops. please help. you making many api requests. from tmdb.org faq : we rate limit requests 30 requests every 10 seconds. you should make sure app never uses more that. how implement you, keep track of request counter that: decrements every time make request resets 30 or every ten seconds only allows requests continue if positive in general, should try query api little possible: cache results in app as can.

gpio - Controlling a relay with a momentary button in Python -

i able control relay momentary button code below: #!/usr/bin/env python import rpi.gpio gpio import time gpio.setmode(gpio.bcm) gpio.setup(17, gpio.in, gpio.pud_up) gpio.setup(4, gpio.out) gpio.output(4, gpio.high) def callback_func(pin): if gpio.input(17): gpio.output(4, gpio.high) else: gpio.output(4, gpio.low) gpio.add_event_detect(17, gpio.both, callback=callback_func, bouncetime=200) def main(): while true: print "not blocking! you're free other stuff here" time.sleep(5) if __name__ == "__main__": main() this, seems once. once release botton , try again, regardless how time in between won't work. there specific reason run once? preferably want able keep using button without having stop python script , restarting one-time button relay action. thanks! removing bouncetime completly fixed issue. so: gpio.add_event_detect(17, gpio.both, callback=callback_func, bouncetime=200) to

ios - Day of the week multi-select UI -

i creating events app , need allow user select day of week, ie. mon, tues, weds,..etc if want create repeating event. is there library/enums or functionality allows selection pre-built? ( in same way datepicker ui built?) picker views add in interface builder, connect delegate , data source , , add following code uiviewcontroller . let pickerdata = nscalendar.currentcalendar().shortweekdaysymbols func numberofcomponentsinpickerview(pickerview: uipickerview) -> int { return 1 } func pickerview(pickerview: uipickerview, numberofrowsincomponent component: int) -> int { return pickerdata.count } func pickerview(pickerview: uipickerview, titleforrow row: int, forcomponent component: int) -> string? { return pickerdata[row] } func pickerview(pickerview: uipickerview, didselectrow row: int, incomponent component: int) { // code here. }