Posts

Showing posts from August, 2015

osx - Kamailio installation error on MAC 10.9, what is this error? -

i trying install kamailio 4.1 on mac os10.9 command: make cfg; make all; make install but see on terminal, through: mkdir -p /usr/local/etc/kamailio/ /bin/sh: -c: line 1: syntax error: unexpected end of file make: *** [install-cfg] error 2 what error? missing else? please guide me correct way achieve objective. not clear provided log messages, expect file system privileges. need run 'make install' via sudo (or privileged user can create directory /usr/local/etc/kamailio/). i use kamailio on mac os x few years now. apart of installing libraries via mac ports various modules, runs smooth.

parsing - How do you parse and process HTML/XML in PHP? -

how can 1 parse html/xml , extract information it? native xml extensions i prefer using 1 of native xml extensions since come bundled php, faster 3rd party libs , give me control need on markup. dom the dom extension allows operate on xml documents through dom api php 5. implementation of w3c's document object model core level 3, platform- , language-neutral interface allows programs , scripts dynamically access , update content, structure , style of documents. dom capable of parsing , modifying real world (broken) html , can xpath queries . based on libxml . it takes time productive dom, time worth imo. since dom language-agnostic interface, you'll find implementations in many languages, if need change programming language, chances know how use language's dom api then. a basic usage example can found in grabbing href attribute of element , general conceptual overview can found @ domdocument in php how use dom extension has been covered exte

php - SLIM Separating out route from function using TWIG -

if want separate out route function best way still need use($app,$twig) $app->get('/app(/:date(/:time))', function ($date = null,$time = null) use ($app,$twig) { //do stuff using twig }); $app->run(); new route, function function app(... $app->get('/app(/:date(/:time))', 'app'); edit 1 - next try using class give `undefined variable: twig' $actions = new actions($app, $twig); $app->get('/app(/:date(/:time))', [$actions, 'app']); $app->run(); class actions { protected $app, $twig; public function __construct($app, $twig) { $this->app = $app; $this->twig = $twig; } public function app($date = null,$time = null) { // print_r($:date); // data using date time $template = $twig->loadtemplate('template.php'); echo $template->render(array( ........ )); } } $appfunc = funct

php - Cannot able to access class function in different file -

index.php <?php include 'foo.php'; ?> <div id="middle_containe_cr" style="background-color:#f0f0ff"> <form method="post" action="actionpage.php" enctype="multipart/form-data"> <table cellspacing="30px" style="padding-left:25%"> <tr> <td colspan="2" align="center" style="font:caption" > hi <form method="post" action="actionpage.php" enctype="multipart/form-data"> <table cellspacing="30px" style="padding-left:25%"> <tr> <td colspan="2" align="center" style="font:caption" > hi <?php $blobj=new foo(); $userdetails=$blobj->samplefunction($userid); echo $userdetails->name; ?> </td> </tr> <tr> <td width="299">userid</td> <td width="302"><?php echo $userid; ?></td&g

android - Unable to register in the Registration(Table not getting inserted) -

i have tried create registration , login page.but when trying register,the field values not getting inserted.this code mainactivity.java package com.example.login1; import android.support.v7.app.actionbaractivity; import android.support.v7.app.actionbar; import android.support.v4.app.fragment; import android.app.activity; import android.content.context; import android.content.intent; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.os.bundle; import android.view.layoutinflater; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.viewgroup; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.toast; import android.os.build; public class mainactivity extends activity implements onclicklistener { button mlogin; button mregister; edittext muname; edittext mpassword; dbhelper db = null;

android - Quickblox pricing confusion based on plans -

want build demo app in android p2p video chat; after looking @ quickblox plan pricing realized not explained @ all. my question if wanted have 1:1 live video chatting on app, free tier allow 20 seconds of video chatting before throttling or cutting off users? can customize api allow direct p2p video connection in conjunction using stun/turn servers?

accessing other php script resources/variables -

well, searching while , couldn't find solution or workaround accessing other php script. i have script running in cli , u guessed socket server, , of course have variables, objects, arrays, etc... i need debug file without need of printing/ echoing variables script itself, know can kinda messy , long run end increasing file size commented , unwanted line of codes, took time clean later on. , plus need make sort of command line interface server in future. so question there way read or debug script variables script running in cli instance? ( can included instance other values/variables) in addition, can run specific function outside of script? use reflections ? i tried _session cannot access while server running. in c# or java can. i don't know if it's possible, suggest other solution "inspecting" variables in running script. use db store logs current operation , it's variables. managed config written in db write logs or important ones, di

c++ - Effective search in specific intervals -

Image
suppose have double value( x ) , need find in interval below belongs , return corresponding value: i want know effective way this. need call function dosen of times. may keep these values in set , binary search, or check if/else statements? thanks in advance. you can use std::map this: std::map<double, double> valuemap; valuemap[1.0e-5] = 1.0; valuemap[1.0e-4] = 10.0; valuemap[1.0e-3] = 100.0; ... // value map, use lower_bound: double result = *valuemap.lower_bound(5.0e-4); //this return 1.0 double result2 = *valuemap.lower_bound(5.0e-3); //this return 10.0

how to use "where" in the List<int> like c# in android -

i need select multiple items. need numbers greater 50. not know how write code. sample c # code defines me need.is supported in android? list<int> _numbers=new arraylist<integer>(); _numbers.add(111); _numbers.add(54); _numbers.add(25); _numbers.add(552); _numbers.add(58); // c# code : _numbers.where(d=>d>=50); iterate though list , put values greater 50 list. can integers greater 50 if-clausel: list<int> xxxx = new arraylist<integer> for(int value : _numbers){ if(value > 50) xxxx.add(value ) }

Differences between cast arraylist and cast array in java -

this question has answer here: why arrays covariant generics invariant? 8 answers as jon's answer of post has said, if compiler allows cast (shown below), add other objects later can bad thing program. arraylist<string> temlist = new arraylist<string>(); arraylist<object> oblist = (arraylist<object>)temlist;//compile error //oblist.add(1); --bad but confuses me why in same situation, array has different behaviours. string[] strings = new string[10]; object[] temp = (object[])strings;//nothing happens so explain difference here , why java make such design ? thanks. edit: 1 similar question arrays not 100% objects, mundane objects. arraylist 100% object. if try assign integer temp array throw arraystoreexception . so casting arrays fine. but casting arraylist super object underlying arraylist

python - ImportError at / No module named response with django appengine -

i trying run django project appengine . running on localhost. when tried upload appspot.com giving me following error importerror @ / no module named response here traceback . views.py from django.http.response import httpresponse def home(request): return httpresponse("hello world") app.yaml application: demoapptotest version: 1 runtime: python27 api_version: 1 threadsafe: true handlers: - url: /.* script: main.application libraries: - name: django version: latest - name: pil version: latest env_variables: django_settings_module: 'app1.settings' you should from django.http import httpresponse .

java - Parse xml without tagname -

i have xml file <response> <statuscode>0</statuscode> <statusdetail>ok</statusdetail> <accountinfo> <element1>value</element1> <element2>value</element2> <element3>value</element2> <elementn>value</elementn> </accountinfo> </response> and want parse elements in accountinfo, dont know elements tag names. now im using , have code tests, in future recieve more elemenets in accountinfo , dont know how many or there names string name=""; string balance=""; node accountinfo = document.getelementsbytagname("accountinfo").item(0); if (accountinfo.getnodetype() == node.element_node){ element accountinfoelement = (element) accountinfo; name = accountinfoelement.getelementsbytagname("name").item(0).gettextcontent(); balance = accountinfoelement.getelementsbytagname("balance").

php - I can't understand this errors (Arduino) -

i'm trying connect "arduino" web client. i'm using wifi.h . i have theses errors : request member 'write' in 'server', of non-class type 'char [24]' request member 'println' in 'server', of non-class type 'char [24]'

javascript - Where is the difference between express.js and angular.js? -

i'm new javascript server developement. recognized "mean" stack. mongodb, express.js, angular.js , node.js. difference between express.js , anguar.js , need both @ same time? angular js client side framework, backbone.js, ember.js, batman.js, sammy.js. recommand @ sample of repository : https://github.com/tastejs/todomvc it's comparative of many javascript client side frameworks. express js web application framework node js, it's couch (frenglish means layer) that's permit host web server node.js.

How to Upload 4 images only using PHP -

how upload 4 images using php this code .. code correct , can upload 4 images but when upload 1 image .. error! error this: undefined offset: 1 in c:\wamp\www\resize\uploader.php on line 10 undefined offset: 1 in c:\wamp\www\resize\uploader.php on line 24 undefined offset: 1 in c:\wamp\www\resize\uploader.php on line 25 undefined offset: 1 in c:\wamp\www\resize\uploader.php on line 26 undefined offset: 1 in c:\wamp\www\resize\uploader.php on line 27 undefined offset: 1 in c:\wamp\www\resize\uploader.php on line 28 <?php if(isset($_post['submit']) , $_server['request_method'] == "post"){ //foreach ($_files['images']['name'] $loop => $name) { ( $loop = 0; $loop <= 1; $loop++ ) { $files_folder = 'p/'; // files folder $formats = array("jpg", "jpg", "png", "png", "jpeg", "jpeg"); // allowed formats $temp = explode(".", $_files["images

java - Is there a way to add a 'libs' folder to my project in Eclipse -

the way know adding additional libraries in java project (in eclipse) manually adding them project's build path. is there way in create folder, , inside (.jars, more precise) added classpath? can in eclipse? create new classpath variable ( preferences)which points directory , add build path. use in project ( build path - add variable) for ex: if want have c:\mydev\libs in build path eclipse-windows-preferences-java-buildpath-classpath variables- new create new entry calls mydevlibs pointing c:\mydev\libs in project-build path- configure build path - libraries (tab) - add variable this should do.

awt - How can I force a repaint() after every update() in a for loop in Java? -

i have written small, basic, kaleidoscope type program should gradually draw same pattern (over time) @ 6 different points , @ different orientations. to have created array store each pixel's colour (it's initial colour being black , represented number 0) , 6 starting points in array have colour changed green (represented number 1). these points should appear on screen , then, based on previous 6 points' positions further 6 points created. updated screen should displayed. repeat, repeat, repeat... my problem of updates, new pixels, being carried out before painting screen. have checked other posts , web tutorials etc, , gather awt kind enough avoid wasting time repainting minor changes. there seems called paintmanager involved in this. believe problem repainting within loop. finding frustrating as, in view, should simple thing do. there, indeed, simple way persuade java plot these minor changes in way desire? i have included code in entirety below: packa

oracle11g - Why calling Excel from Oracle Forms on the Citrix Receiver does not work? -

i have used webutil feature copy data excel oracle forms. works fine when run forms on local machine (from oracle forms builder), , when install on linux server. not able copy data excel when call forms citrix. program stops when control arrives application := client_ole2.create_obj('excel.application'); (it not if replace client_ole2 ole2) does have idea how can solve issue? to run on cirtix figured out related libraries i.e. d2kwut60.dll, jnisharedstubs.dll, , jacob.dll must copied on c:/program file/ java/ jre6. :-)

javascript - Infinite Scroll + Masonry -

trying infinite scroll work masonry. bare me, javascript not main skill. +function ($) { var $container = $('.masonry'); $container.imagesloaded(function(){ $container.masonry({ columnwidth: '.grid-sizer', gutter: '.gutter-sizer', itemselector: '.item' }) }); $container.infinitescroll({ navselector : '#page-nav', // selector paged navigation nextselector : '#page-nav a', // selector next link (to page 2) itemselector : '.item', // selector items you'll retrieve loading: { finishedmsg: 'no more pages load.', img: 'http://i.imgur.com/6rmhx.gif' } }, // trigger masonry callback function( newelements ) { // hide new items while loading var $newelems = $( newelements ).css({ opacity: 0 }); // ensure images load before adding masonry layout $newelems.imagesloaded(function(){

javascript - Access of function in jQuery scope -

i want build function outside jquery scope: (function($) { function myobject() { console.log('foo'); }; }(jquery)); var $my_object = new myobject(); but function myobject not accessible : referenceerror: myobject not defined however, if build function in scope, it's working: (function($) { function myobject() { console.log('foo'); }; var $my_object = new myobject(); }(jquery)); foo how access myobject outside scope ? i not recommend can want returning functions part of object , assigning iife variable this var library = (function ($) { var exports = {}; var private = 'see cant this'; var myobject = exports.myobject = function (_in) { console.log(_in); }; var another_func = exports.sum = function (a, b) { console.log(a + b); }; return exports; }(jquery)); library.myobject('foobar'); // "foobar" library.sum(3, 5); // 8 console.log(pri

Riak: Create index on key via Java/Scala -

i have bucket on riak in store simple timestamp -> string values in way: val riakclient = riakfactory.newclient(myhttpclusterconfig) val mybucket = riakclient.fetchbucket(name).execute mybucket.store(timestamp.tostring, value).withoutfetch().w(1).execute what need add index on keys. tried defining java pojo in way: public class mywrapper { @riakindex(name="timestamp_index") @riakkey public string timestamp; public string value; public mywrapper(string timestamp, string value) { this.timestamp = timestamp; this.value = value; } } and running mybucket.store(new mywrapper(timestamp.tostring, value)).withoutfetch().w(1).execute the problem of approach in riak actual value stored json object: {"value":"myvalue"} while need store myvalue string. there way achieve this? can't see index(name) method when executing store , , can't see annotations @riakkey values. you can create ria

java - android application with phonegap that run websocket in background service -

Image
i new android familiar web programming. using phonegap write app. my application receives news via websockets , displays them user. my problem when application closed user, cannot use webview receiving news. after searching while found plugin phonegap can run background services java: https://github.com/red-folder/bgs-core . but i'm new java , don't know how run websockets (autoban.ws android) in background service receive news , show in notification bar. i think should use different approach. trying not possible on android. can use google cloud messaging push data devices app installed. kinda works this: as long have server, example google app engine project, can push data apps , can target specific devices. apps use google cloud messaging efficient , battery friendly fast. without google cloud messaging or similar have poll server periodically , check updates. wakes device , drains battery - when need frequent updates. google cloud messaging solves

javascript - Why does my contact form isn't working? -

i'm trying add website contact form jquery , fancybox. all seems doing well, pop-up animation ok, mail seems sended i'm not receiving mail :( could me understand problem ? edit: - i've checked junk , spam folder -here website link: lacouleurdurendezvous.fr -someone talked server misconfiguration, ? edit: -it seems server malfunction... i'm trying conatct web hoster... here how call scripts: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js" type="text/javascript"></script> <script src="ressources/retour.js"></script> <script src="ressources/testhead.js"></script> <script type="text/javascript" src="fancybox/jquery.fancybox.js?v=2.0.6"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script type="text/j

I having trouble with EJB in netbeans -

the time practicing java web project on netbeans, ejb error while in process of running scheme, there no solution on fix, hope had similar problems guide me fix on, here image of error : ![e:\accptrading\nbproject\build-impl.xml:307: module has not been deployed. see server log details.][1] i tried reinstalling software jdk & sdk, still did not fix, refer various forums, these people lost, today i'm posting on forum because friend recommended. hope me. week not work because of error. thank all!

java - What is the recommended workflow using Liquibase and Git? -

recently started using liquibase. didn't occurred yet imagined happen if 2 developers commits changes in change log file shared git repository. how solve or avoid merge conflict? broaden question what: what recommended workflow using liquibase in combination git? example scenario: - michael changes column in table 'customer'. - jacob changes column in table 'account'. both developers added <changeset> same changelog file changelog.xml. edit : as commented scenario isn't exciting indeed. assume jacob last 1 push code. has pull first. gets warning there merge conflicts solve. solves conflict keeping both parts of code, of michael's , his. updating database liquibase gives no problems. advanced example scenario: -michael changes name of column 'name' of table 'customer' in 'first_name', commits , pushes. -jacob changes name of column 'name' of table 'customer' in 'last_name' , commits.

ios - Concurrent connections to Apple Push Notification Service -

from rumour around seems there should not more lets' 15 simultaneous connections apns. how connections counted? per single server or per servers? guess servers i'd more specific in doc somewhere. help. as large , dynamic system apns is, behooves apple ambiguous such number; gives them liberty change @ will. found similar vagueness here from this discussion appears rule of thumb 15 connections max one suggestion have open-ended pool new connections can created until start being refused

c# - Deserialise JSON and access content using Linq to JSon -

i have following json stored in cookie wish parse: {"package":[{"id":"5054","nodeid":"3286"},{"id":"8888","nodeid":"7777"}], "hotel":[{"id":"3421","nodeid":"1234"},{"id":"8748","nodeid":"2435"}], "activity":[{"id":"5054","nodeid":"3286"},{"id":"8888","nodeid":"7777"},{"id":"2131","nodeid":"2342"}]} i understand accepted answer on question deserializing json .net object using newtonsoft (or linq json maybe?) can use following code access individual objects within json notation: jtoken token = jobject.parse(stringfullofjson); int page = (int)token.selecttoken("page"); int totalpages = (int)token.selecttoken("total_pages"); i've therefore adapted

How to send attachment file in email using PHP -

here way sending email using php. wish attach file type .doc, .docx, .pdf. //send mail// $file_name = $_files['cv']['name']; $temp_name = "../abc/cv/" . $_files["cv"]["name"]; $file_type = $_files['cv']['type']; $message1 = "name : $name \n\n"; $message1.= "current designation : $designation \n\n"; $message1.= "current company : $current_company \n\n"; $message1.= "email : $email \n\n"; $message1.= "tel. : $tel \n\n"; $message1.= "preferred contact time : $contact_time \n\n"; $message1.= "apply position : $position \n\n"; $message1.= "earliest available date : $available_date \n\n"; $message1.= "expected salary : $salary \n\n"; //get extension of file

python - How can I improve the functionality of this code -

a1 = input("enter 8 bit binary number convert: ") a1 = list(a1) ok = false; if a1[0] == '0': ok = true if a1[0] == '1': ok = true if a1[1] == '0': ok = true if a1[1] == '1': ok = true if a1[2] == '0': ok = true if a1[2] == '1': ok = true if a1[3] == '0': ok = true if a1[3] == '1': ok = true if a1[4] == '0': ok = true if a1[4] == '1': ok = true if a1[5] == '0': ok = true if a1[5] == '1': ok = true if a1[6] == '0': ok = true if a1[6] == '1': ok = true if a1[7] == '0': ok = true if a1[7] == '1': ok = true if ok == true: print("number binary!") n1 = 0 if a1[7] == '1': n1 = 1 if a1[6] == '1': n1 = n1 + 2 if a1[5] == '1': n1 = n1 + 4 if a1[4] == '1': n1 = n1 + 8 if a1[3] == '1': n1 = n1 + 1

java - Exception when converting string into integer -

i'm starter in java. use netbeans. following snippet code make simple calculator add 2 numbers. not including self generated code buttons. problem when try convert string str integer num1 inside function plus_buttonactionperformed , equal_buttonactionperformed gives exception stating: exception in thread awt-eventqueue-0 java.lang.numberformatexception input string i made sure string not empty printing above conversion statement. code bit long. pardon. doing wrong here. public class calc extends javax.swing.jframe { /** * creates new form calc */ public string str = " "; public string action = " "; public int num1; public int num2; public int res; public calc() { initcomponents(); } private void button3actionperformed(java.awt.event.actionevent evt) { str=str.concat("3"); result.settext(str); } private void button6actionperformed(ja