Posts

Showing posts from August, 2011

javascript - Passing model data to partial view after updating model again -

Image
i having main view , few partial views. the main view displays list of registered users : the main view code : @model webapplication9.models.user @{ layout = null; } <!doctype html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>index</title> <link ref="~/styles/usermanagement.css" rel="stylesheet" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> </head> <body> <p> <button type="submit" name="btndefinetraj" onclick="

php - How to echo only one parameter with union all -

i have database tables. want print union names both tables , if there more 1 name appears print once , make red example. php: <?php include 'verification/verify_form_details.php'; $result5 = getusers(); if (!$result5) { die('invalid query: ' . mysqli_error()); } while($row5 = mysqli_fetch_array($result5)) { $username = $row5['username'] ; echo '<ul>'; echo"<li>". $username ."</li>"; echo '</ul>'; } ?> and query: function getusers() { global $con; $sql = "select username `user_project` union select username `user`"; return mysqli_query($con,$sql); } how can achieve this? modify query group user name $sql = "select username ( select username `user_project` union select username `

python - Creating a Web Interface for Raspberry Pi Display -

i have raspberry pi running web server , i'd able create web interface change colors , images on rgb display. i control rgb display navigating directory , executing python file , lights up, ends looking pi@raspberrypi: sudo python test.py cool, works! how can execute on pi webserver, don't know begin. sort of framework can use accomplish goal here? you use example flask or bottle . flask, use on webserver. way raspberry pi. think framework have developer server, haven‘t set ‚real‘ webserver. maybe use jupyter notebook too, didn‘t try on pi.

How to Disable button using javascript or jquery inside PHP code -

i need invisible buttons when table column selection value not none . how disable button using javascript or jquery inside php code. suggestions welcome task using php code inside javascript or jquery.i have buttons list follows. <?php include("db_conection.php");$sql = "select selection users"; $result = $dbcon->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $value = $row['selection']; if($value !='none'){ //need add jquery or javascript here //$('button').attr("disabled", "disabled"); //$('button').text('disabled'); } } }?> <script type="text/javascript" > // $('button').attr("disabled", "disabled"); // $('button').text('disabled'); < /script> <tr> <td> <button type="button" class="btn btn-primary" id="q1-

spring boot - When i am using it with db2 for pagination, my next page is giving error -

i using spring data jpa db2. first set of record coming. when next, giving me error. guess may because of db2. when use index 0 working fine. when use index 1 giving data access exception. on second page getting below error pageable object pageable pageable = new pagerequest(2, 10, direction.asc, "messageid"), because of 2(as mentioning index should 0), throwing below error com.ibm.db2.jcc.am.sqlsyntaxerrorexception: db2 sql error: sqlcode=-199, sqlstate=42601, sqlerrmc=of;??( [ desc asc nulls range concat || / microseconds microsecond, driver=3.69.24 actually org.hibernate.dialect.db2dialect class generates invalid query why failing have correct query overiding method. replace over( order order of inner2_) over()

voip - Can a SIP call's media address changed mid-call? -

Image
i referring c value of sdp header. is possible media stream address changes during call? , scenarios? it may changed re-invite or update. example scenarios: pabx system consisting of multiple machines decides route media through media endpoint because of e.g. high server load or other problem machine after receiving fax cng, ced and/or modem preamble pabx passes call fax server call passed specialized music-on-hold or ivr server also, addresses advertised in sip headers or in sdp quite not matching real addresses used communication because of nat or misconfiguration - best results b2buas may ignore them.

node.js - when trying to connect ibm db2 using nodejs i am getting Database name not found error -

installed nodejs installed ibm_db downloaded nodedb2test.js file changed database details per db2 database ran file. got error [ibm][cli driver] sql30061n database alias or database name "xyz " not found @ remot e node. sqlstate=08004

How to refer UICollectionView from UICollectionViewCell? -

can refer uicollectionview uicollectionviewcell? want refer viewcontroller uicollectionviewcell. following codes in customcollectionviewcell class. want archive tweet support in class. @ibaction func tweetbtntapped(_ sender: any) { let cvc = slcomposeviewcontroller(forservicetype: slservicetypetwitter) if let c = cvc { c.setinitialtext("test tweet ios app") ### how can refer viewcontroller?? viewcontroller = ??????? if let vc = viewcontroller { vc.present(c, animated: true, completion: nil) } } } please provide code sample or trying achieve. understand want action in view controller when perform action on cell. correct? so per comments, custom collection view cell : class customecell: uicollectionviewcell { @ibaction func tweetbuttonpressed() { let cvc = slcomposeviewcontroller(forservicetype:slservicetypetwitter) if let c = cvc { c.setinitialtext("test tweet ios ap

java - Spring Security: how to retrieve username to accessDeniedPage? -

i'm using spring security, html , thymeleaf , retrieve user has failed login. login has 2 step: first step checks if user , password correct ldap, second checks if user has role database. if both passed user authenticated. have registration page user has failed login (a precompiled input field). registration page accessdeniedpage. authentication: public authentication authenticate(authentication authentication) throws authenticationexception { set<grantedauthority> authorities = new hashset<grantedauthority>(); string name = authentication.getname(); string password = authentication.getcredentials().tostring(); if (name == null || name.isempty() || password == null || password.isempty()) return null; boolean isfind = ldapservices.ldapsearch(name, password); if (isfind){ com.domain.user user = userservices.getbyusersenabled(name);

php - How can iterate every 5 results in a table? -

i have foreach need distributed every 5 result per row on table. this current foreach: <?php $i = 0; echo "<tr>"; foreach($klasifikasi $result){ $i++; if($i % 5 == 0){ echo "<td width='20%' align='center'>".$result['klasifikasi']."</td>"; echo "<td width='20%' align='center'>".$result['klasifikasi']."png</td>"; } }; echo "</tr>"; ?> it doesn't stop every 5 result , doesn't create new row. this i'm looking for: --------------------------------------------------- a1 | a2 | a3 | a4 | a5 --------------------------------------------------- a1.png | a2.png | a3.png | a4.png | a5.png --------------------------------------------------- /*this row should empty spacing*/ --------------------------------------------------- .../*skipp

tfs - TFS2015 NuGet Packager: [error] 'System.Collections' already has a dependency defined for 'Microsoft.NETCore.Platforms' -

this question nuget: 'x' has dependency defined 'y' has answer when nuget has issue in visual studio, how update nuget in tfs 2015? i using nuget packager build task , giving me error [error] 'system.collections' has dependency defined 'microsoft.netcore.platforms'. if not bug doing wrong. project .net 4.5.2 can't see why have 'microsoft.netcore.platforms'. it should noted build server has 15 or nuget packager builds working fine - broken one. packages.config <packages> <package id="antlr" version="3.5.0.2" targetframework="net452" /> <package id="autofac" version="4.2.0" targetframework="net452" /> <package id="autofac.configuration" version="4.0.1" targetframework="net452" /> <package id="autofac.extras.commonservicelocator" version="4.0.0" targetframework="net452"

python - Configure Odoo 9 development environment on PTVS on Visual Studio Community 2015 -

i want setup odoo 9 development environment ptvs on visual studio . want know "is practical approach"?. approx people prefer eclipse odoo-development . but, visual studio ptvs gives more ide environment python base development so, should go ptvs or continue using eclipse . any kind of suggestions & guidelines welcome. in advance.

oracle11g - How to add Data Connection for Oracle 11g in Visual Studio Enterprise 2015 -

Image
i have oracle 11g database need connect in visual studio 2015 (enterprise update 3). i have install oracle client 11 on machine reference following directories i believe there both oracle client 32-bit , 64-bit not sure when try add connection using .net framework data provider oledb or .net framework data provider oracle , following error on c:\window\system32 have found odbcad32; reference following screen shot; i not missing picture. need many in advance i reinstall both oracle client 32-bit , 64-bit in following location , worked; c:\app\kz\product\11.2.0\client_32 c:\app\kz\product\11.2.0\client_64 to check version of client instance running on local machine a simple way find out in windows run sqlplus oracle homes's bin directory , check task manager. if 32-bit version of sqlplus, you'll see process on processes tab looks this: sqlplus.exe *32 if 64-bit, process this: sqlplus.exe

Android: AudioManager for audio, is there a equivalent for Video -

for android, i've researched controlling audio using audiomanager. there 1 video can control video player play/stop/pause. the purpose of audiomanager isn't control audio playback, control such properties volume, audio mode, , on. if there media player in background, doesn't mean control it, can send requests audiomanager cause system either take actions regarding audio, or send events, audio player may respond to. don't have direct control on other application. likewise, there no system service make video pause. best equivalent of audiomanager have controls shown on screen windowmanager , think it's obvious can't used make video player pause. your best bet controlling external video player intents, may have ways control playback outside. this, of course, application specific.

javascript - i have some validation on an email input with an ajax call the validation runs but not the call can any give some help as to why this is happening? -

this email input: <div class="input-group emailinput" style="min-width:300px;max-width:637px;"> <input type="email" class="form-control input1" id="emailaddress" placeholder="email address"> <span class="input-group-btn"> <button class="btn btn-secondary input2" type="button" onclick="validate()" style="padding:0px;border:0px;"><div style="padding:7px; background-color:#ff2b68;color:white;">></div></button> </span> </div> the script: function validateemail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-za-z\-0-9]+\.)+[a-za-z]{2,}))$/; return re.test(email); } function validate() { $("#result").text("");

Robotframework: How to read a random row in csv file? -

i made code in python read row in csv file: import csv class csvlibrary(object): robot_library_scope = 'global' def __init__(self): print 'read cell value in csv file' def read_cell_value_by_row(self,filename,rownumber): #read existing csv file userdata=[] user={} open(filename,'rb') csvfile: #read csv file dictionary object reader=csv.dictreader(csvfile) #read , store list of dictionary items userdata=list(reader) #get specific list item dictionary object user=userdata[rownumber-1] #return dictionary object return user then in robotframework script: ${row_number}= convert integer 1 ${user_info}= read_cell_value_by_row userinfo.csv ${row_number} ${username} dictionary ${user_info} username log ${username} ${password} dictionary ${user_info} password

texture mapping - Divide an image into triangles (with specific coordinate) then transform it through those triangles -

i divided image triangles sepcific coordinates picture below: an image divided triangles i need change coordinates of each vertex whole image transform new 1 picture below or new styles. tranformation how can calculate new coordinates? thanks

c++ - typename, type members and non-type members: is it valid code? -

consider following code: struct s { struct type {}; type type; }; int main() { typename s::type t; (void) t; } apart fact far being idea, experimenting after having read question here on so. found snippet above compiled no errors gcc , rejected clang 3.9 following error: error: typename specifier refers non-type member 'type' in 's' i suspect clang right in case , gcc wrong (actually, i'm opening issue latter). right conclusion or valid use of typename ? note: i'm not asking how solve it, know how that. i'm asking if code valid or not. [temp.res]/4 : the usual qualified name lookup used find qualified-id in presence of typename . that is, unlike case elaborated-type-specifier s, name lookup in case not ignore non-type names. [temp.res]/3 : if qualified-id in typename-specifier not denote type or class template, program ill-formed. so program in question ill-formed. [temp.res]/4 has ex

php - Sum the value in if/else mysql select statement -

not sure how max date inside if/else statement of mysql query. here select statement: select month(max(a.planned_date)) month, a.planned_date date, year(max(a.planned_date)) year, sum(if(month(a.planned_date) = 1, b.value, 0)) jan, sum(if(month(a.planned_date) = 2, b.value, 0)) feb, sum(b.value) total b inner join on b.id = a.id inner join c on b.reg_id = c.reg_id year(a.planned_date) < date(now()) group c.reg_id all trying have cross table of jan dec, return max date bring value. however, way have done value doubling value. please advise appreciated. thank you

java - Using Hibernate, proper connections to DBMS and how make safe query methods -

i created hibernate classes, , several functions access dbms in order take information. typical code each method: public void f(){ sessionfactory factory = new configuration().configure().buildsessionfactory(); session session=factory.getcurrentsession(); session.begintransaction(); query<allnew> query=session.createquery("select m "+allnew.class.getname()+" m"); list<allnew> list = query.getresultlist(); for(allnew i:list){ .... } session.gettransaction().commit(); system.out.println("done"); } i believe essential code has problem inside. dbms reaches high number of open connections have reason believe that: when method ends, not inside obj closed.

javascript - Selecting multiple data attributes using jquery click() function -

<script> jquery(document).ready(function ($){ function togglechevron(e) { $(e.target) .prev('.panel-heading') .find("i") .toggleclass('fa-plus fa-minus'); } $('#accordion').on('hidden.bs.collapse', togglechevron); $('#accordion').on('shown.bs.collapse', togglechevron); }); </script> <div class="col-md-8 hidden-xs"> <div id="carousel"> <a href="#"><img src="<?php echo images. '/home-1.jpg' ?>" id="item-1" /></a> <a href="#"><img src="<?php echo images. '/home-2.jpg' ?>" id="item-2" /></a> <a href="#"><img src="<?php echo images. '/home-3.jpg' ?>" id="item-3" /></a> </div>

asp.net mvc - Exception Handling in webapi MVC.net -

i got api controller , service, when invoking 1 of action in controller must apply validation, validation need check data in db validate correct. as far can see there 2 ways of handling this 1- validate before calling "update" prevent error public iactionresult updatecustomer(customerdto customer) { if (!customerservice.validate(customer)) { return send400badrequest(); } customerservice.update(customer); return send200ok(); } 2- call update validate inside , throw exception. public iactionresult updatecustomer(customerdto customer) { customerservice.update(customer); return send200ok(); } in customer service public void update(customerdto customer) { if (!validate(customer) throws new customvalidationexception("customer not valid"); //apply update } we have actionfilter handle customvalidationexception return badrequest. 1) pros +don't use exception use running flow cons -con

Sending JSON body through POST request in OKhttp in Android -

i have setting okhttpclient , sending request server. , able sending post request server empty body tag. now, i'm trying send following json object server. { "title": "mr.", "first_name":"nifras", "last_name": "", "email": "nfil@gmail.com", "contact_number": "75832366", "billing_address": "", "connected_via":"application" } for have trying adding okhttpclient library class requestbody fail sending json object body of http post request. following way have try build body , process post request. okhttpclient client = new okhttpclient(); requestbody body = new requestbody() { @override public mediatype contenttype() { return applicationcontants.json; } @override public void writeto(bufferedsink sink) throws ioexception { // place add json thought. how }

Is there any way from which i can get all the deployed urls of rest web service -

i want display deployed urls of rest web service , want know how jersey rest web service loads @path annotation , saves mapping , class method. check out swagger.io , excellent framework apis and link swagger core jersey 2.x project setup example setup jersey you have final result here: editor.swagger.io

java - How can I upload a files using WebView in Android Lollipop? -

i new android, have developed app of webview, have file-chooser button , it's not working in lollipop.i installed apk in mi5 marshmallow nothing response came this code , me need include file upload enable options on webview activity_main.xml: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="0dp" android:paddingleft="0dp" android:paddingright="0dp" android:paddingtop="0dp" tools:context="com.example.tamil.stagingsite.mainactivity"> <progressbar android:id="@+id/progressbar" style="@android:style/widget.material.light.progressbar.lar

qt - How to capture a specific portion of a screen in QML? -

how capture specific portion of screen in qml ? having grid view grid item contains 2 images , text. have capture grid item when click on it. have tried qpixmap p = qpixmap::grabwidget(widget); qwidget p = qwidget::grab(widget); but not working. there method ? it doesn't work because not widget, not unless use qquickwidget . you should use grabtoimage() instead.

api - Slack OAuth 2.0 without human (Add to Slack button) -

before able token, slack wants user give permissions request described here: slack oauth 2.0 is possible token without human? i make program posting modifications of program special slack channel. if user has give permissions everytime, post modification slack himself , slack api not useful anymore. no, not how works. have run through oauth process once (per slack team) receive access token. received access token remains valid , should stored future use. if want use slack app , features enables (e.g. interactive buttons, events api), have run oauth process. however, if want call few api methods there alternative. can called "test token" slack team work , can here . however, token meant testing , development , not supposed used in production level apps.

visual studio 2015 - Intrinsic c++ vs2015 -

during playing around intrinsics , after switching x64 build, compiler showed error message: c3861 '_mm_hadds_pi16': identifier not found so i've checked inside file tmminitrin.h #if defined(_m_ix86) extern __m64 _mm_hadd_pi16 (__m64, __m64); extern __m64 _mm_hadd_pi32 (__m64, __m64); extern __m64 _mm_hadds_pi16 (__m64, __m64); #endif _m_ix86 not defined in x64 build i'm confused because in msdn in requirements section says architecture x86,x64. why in x64 build i'm prevented using intrinsics takes __m64 parameters , return __m64 ? second question: _mm_hadds_pi16() faster or slower _mm_hadds_epi16() or processor specific?

github - Ruby Octokit 2fa list -

im new ruby , github. i have way of displaying admins dont have 2fa seperate displaying other information admins i.e username / email / full name. i want able combine outputs part of list , have 2fa column in output. existing script : lists user attributes seperatesly i.e username / email. output_row = "|#{counter}|#{m.login}|#{@client.user(m.login).email}|#{@client.user(m.login).name}|" puts output_row end lists user without 2fa invalid_members = client.organization_members('******',{:role => "admin", :filter => "2fa_disabled"}) counter = 0 invalid_members.each |m| counter = counter+1 #output_row = "|%3i | %20s | %35s |\n" % [counter,m.login,@client.user(m.login).email] output_row = "|#{counter}|#{m.login}|#{@client.user(m.login).email}|#{@client.user(m.login).name}|" puts output_row end solution im looking addition first codeblock contains similar to |#{@client.user(m.login).2faattribute}|

javascript - Angular 2 proper way to template a [routerLink] in a child component -

i trying find way template [routerlink] in child component. in app.component have have <router-outlet></router-outlet> . now, inside othermodule.component trying apply <a [routerlink]="['home']">home</a> . app.module: import { browsermodule } '@angular/platform-browser'; import { ngmodule } '@angular/core'; import { httpmodule } '@angular/http'; import { appcomponent } './app.component'; import {homemodule} "../home/home.module"; import {othermodule} "../othermodule/othermodule.module"; import {routermodule} "@angular/router"; import {routes} "./routes"; @ngmodule({ declarations: [ appcomponent ], imports: [ browsermodule, homemodule, httpmodule, othermodule, routermodule.forroot(routes) ], providers: [], bootstrap: [appcomponent] }) export class appmodule { } routes: import {homecomponent} "../login/login.componen

How to use username for logging in instead of email in Laravel 5.3? -

how can set login system in laravel 5.3 instead of email? i tried add in logincontroller.php public function username(){ return 'username'; } so far doing right. authenticate other email field have override username() method did. think didn't changed login view. have change name of text field. talking views/auth/login.blade.php , chunk of code: <div class="form-group {{ $errors->first('email', 'has-error') }}"> {!! form::label('email', trans('account/form.email'), ['class' => 'col-sm-2 control-label']) !!} <div class="col-sm-4"> {!! form::text('email', old('email'), ['class' => 'form-control']) !!} </div> <div class="col-sm-4"> {!! $errors->first('email', '<span class="help-block">:message</span>&#

How can I update a list in mailchimp api version 3 using php in codeigniter? -

i have existing list in mailchimp. have cron in helpers generating array list of users every 6 hours. want send new email id's array old list new email ids' information added it. how can this. have added mcapi.php in libraries folder. , getting array named user[]. how should call api , listupdate method ? mailchimp version 3.0 , using codeigniter framework.

ios - Libraries required to resolve firebase-crash linker issues when added manually -

Image
have added libs mentioned in linking error on firebase 3.7.0 ios application still below linker errors adding firebase crash. "_firlogerror", referenced from: -[fcrbreakpadcontroller enabledebugger] in firebasecrash(fcrbreakpadcontroller_bc3acad0fa3a54a5c7c331f54af621b0.o) -[fcrbreakpadcontroller startwithconfiguration:] in firebasecrash(fcrbreakpadcontroller_bc3acad0fa3a54a5c7c331f54af621b0.o) -[fcrbreakpadcontroller createdirectory:] in firebasecrash(fcrbreakpadcontroller_bc3acad0fa3a54a5c7c331f54af621b0.o) +[fcranalytics messagedictionaryfrommessage:] in firebasecrash(fcranalytics_281d4dbe093b1d2a74ef0873d1ac6263.o) -[fcrclient startwithconfiguration:error:] in firebasecrash(fcrclient_482ceec6b5943edbfb1d1dff6beb18f6.o) -[fcrcrashdump crashinfofromsystemmetadata:] in firebasecrash(fcrcrashdump_ee5f791af340383d1b426338c1150e39.o) -[fcruploadqueue initwithdirectory:maxsize:] in firebasecrash(fcruploadqueue_2ce

Calling function from another javascript inside jquery -

i have javascript file named loader.js contains function called initialize() . want call function via jquery. html file: <!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="loader.js" ></script> <script type="text/javascript"> jquery(document).ready(function() { jquery(document).on("click", ".link", function(e) { e.preventdefault(); var a= $(this).text(); window.initialize= function{ }; initialize(a); }); }); </script> </head> <body > <h1>welcome website </h1> <a href="#" class="link"> link1 </a> <a href="#" class="link">

c++ - How to read my socket messages -

i reading variable bytes messages sockets in c. there problem when byte in message \0. split in 2 parts , first half sent. there receiving problem on client side well. please suggest format, can use. one solution, have sent size of message first , send rest of message. solve problem processing becomes complex. i looking other cleaner solutions ? /** send data connected host */ bool send_data(const char* data) { //send data if (sendto(sock, data, strlen(data), 0, (const struct sockaddr *) &server, length) < 0) { perror("send failed "); return false; } std::cout << "data sent: length=" << strlen(data) << " \n"; char str[inet_addrstrlen]; inet_ntop(af_inet, &(server.sin_addr), str, inet_addrstrlen); std::cerr << "server.sin_addr=" << str << std::endl; return true; } /** receive data connected host */ void receive(char

use single erb template for different files in a single puppet manifest -

i use single erb template create different files. here erb. # managed puppet # changes overwritten # <% if (@tanuki_ssl != nil) -%> # config include # ssl section trust , key stores # <% unless @tanuki_ssl['truststore_path'].nil? -%> wrapper.java.additional.940=-djavax.net.ssl.truststore=<%= @tanuki_ssl['truststore_path'] %> <% end -%> <% unless @tanuki_ssl['truststore_pass'].nil? -%> wrapper.java.additional.941=-djavax.net.ssl.truststorepassword=<%= @tanuki_ssl['truststore_pass'] %> <% end -%> <% end -%> <% if (@tanuki_proxy != nil) -%> # config include # proxy section # wrapper.java.additional.951=-dhttp.proxyset=true wrapper.java.additional.952=-dhttp.proxyhost=<%= @tanuki_proxy['host'] %> wrapper.java.additional.953=-dhttp.proxyport=<%= @tanuki_proxy['port'] %> wrapper.java.additional.954=-dhttp.nonproxyhosts=<%= @tanuki_proxy['exceptions'].join('|&

powerbi - Get city values from Google Analytics to Power BI -

i want data google analytics create report in power bi. report want create number of users city visit site. in power bi have field country can't find sub field city. in google analytics can create report no problem. i using power bi web interface. how can have city information google analytics in powerbi?

c++11 - thread pool in constructor of C++ class is getting killed -

i have following code creating thread pool in constructor of class. threads got created , exited immediately. please help. class threadpool { public: boost::asio::io_service io_service; boost::thread_group threads; threadpool(); void call(); void calling(); }; threadpool::threadpool() { /* create thread-pool */ size_t numthreads = boost::thread::hardware_concurrency(); boost::asio::io_service::work work(io_service); for(size_t t = 0; t < numthreads; t++) { threads.create_thread(boost::bind(&boost::asio::io_service::run, &io_service)); } } void threadpool::call() { std::cout << "hi i'm thread no " << boost::this_thread::get_id() << std::endl; }; void threadpool::calling() { sleep(1); io_service.post(boost::bind(&threadpool::call, this)); } int main(int argc, char **argv) { threadpool pool; (int = 0; < 5; i++) { pool.calling(); } pool.threads.join_all(

java - org.h2.jdbc.JdbcSQLException: Database may be already in use: null. Possible solutions: close all other connection(s); use the server mode [90020-193] -

i want use h2 database in embedded mode , not on server mode. after 1 transaction getting error file locked. have tried appending db_close_on_exit=true;file_lock=no after url not working. is there solution this? <property name="connection.driver_class">org.h2.driver</property> <!-- <property name="connection.url">jdbc:h2:./test;auto_server=true</property> --> <property name="connection.url">jdbc:h2:./test;db_close_on_exit=true;file_lock=no</property> <property name="connection.username">sa</property> <property name="connection.password">sa</property> here code saves user object. sessionfactory factory = new configuration().configure("/resources/hibernate.cfg.xml").buildsessionfactory(); session session = factory.opensession(); session.begintransaction(); uservo user = new uservo(); user.setuserid(&

sql server - query to remove first value from " For XML PATH " -

i have query : select ','''+ aa.kodeverifikasi +'''' tverifikasipofakturheader aa (nolock) inner join tverifikasipofakturdetail bb (nolock) on aa.kodeverifikasi=bb.kodeverifikasi aa.kodepo='ts/01/15/00183' group aa.kodeverifikasi order aa.kodeverifikasi xml path ('') and return : ,'val6','val4','val5','val9' but want remove first character "," , want return : 'val6','val4','val5','val9' when using substring : substring(','''+ aa.kodeverifikasi +'''', 2, 8000) return : 'val6''val4''val5''val9' please me,,, , thanks... here 1 way using left function. append , @ end , remove using left function. select left(result, len(result) - 1) (select '''' + aa.kodeverifikasi + ''',' tverifikasipof

twitter bootstrap - How to make accordion's content to be opened even by clicking outside the link's text? -

i created accordion : <div class="box-group" id="accordion"> <c:foreach items="${groupe_menus}" var="groupe_menu"> <div class="panel box box-primary"> <div class="box-header with-border"> <h4 class="box-title"> <a data-toggle="collapse" data-parent="#accordion" href="#content_${groupe_menu.gmnu_code}" aria-expanded="false" class="collapsed"> ${groupe_menu.gmnu_lib} </a> </h4> </div> <div id="content_${groupe_menu.gmnu_code}" class="panel-collapse collapse" aria-expanded="false" style="height: 0px;"> ... // accordion's content </div> </div> </c:foreach> <

ios - how to pass json data other view controller -

hi getting data server i.e: { error = 0; "error_msg" = "successfully login"; success = 1; user = { driverid = 35; drivername = "home nath"; "com_id" = 2; }; } now need pass data of drivername other view controller in label box.how one?? create variable of type string in destination view controller. destinationviewcontroller.swift class destinationviewcontroller: uiviewcontroller { var drivername: string? override func viewdidload() { super.viewdidload() print(drivername) } } currentviewcontroller.swift in currentviewcontroller override prepareforsegue:sender: method. class currentviewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() } override func prepare(for segue: uistoryboardsegue, sender: any?) { let destnationvc = segue.destination as! destinationviewcontroller destnationvc.drivername = &

Java REST call using angularjs with param value -

i trying make rest call in java using angularjs- java code:- @get @path("/getdata/{id}") @produces(mediatype.text_plain) public static string getdata(@pathparam("id") string id) { //operation } angularjs rest call- var response = $http.get('/projname/rest/get/getdata', {params: {id: id}}); but it's giving me exception- org.jboss.resteasy.spi.notfoundexception: not find resource full path: the error caused fact, you're trying access different endpoint. endpoint listens requests like: projname/rest/get/getdata/{id} //e.g. projname/rest/get/getdata/1 but you're calling: projname/rest/get/getdata?id={id} projname/rest/get/getdata?id=1 your code should be: var response = $http.get('/projname/rest/get/getdata/' + id); @get @path("/getdata/{id}") @produces(mediatype.text_plain) public static string getdata(@pathparam("id") string id) { //operation }

php - Difference between Include, Extends, Use, Macro, Embed in Twig -

what difference between use , include in twig? documentation : include the include statement includes template , returns rendered content of template current one: {% include 'header.html' %} body here... {% include 'footer.html' %} use the use statement tells twig import blocks defined in blocks.html current template (it's macros, blocks): blocks.html {% block sidebar %}{% endblock %} main.html {% extends "base.html" %} {% use "blocks.html" %} {% block title %}{% endblock %} {% block content %}{% endblock %} possible answer: i think this should explain difference: include code external file , import actual file @ right location of call. use different parses linked file find particular section of code , overwrites blocks same name, in current file, 1 found in external file. include " go find file , render page here ". use " parse othe