Posts

Showing posts from September, 2014

Web2py: stop guest users from changing password -

i'm setting demo web2py site show few people. i'm going set 'guest' account simple password. how can stop logged in 'guest' changing password, while allowing other (non-guest) users change password if want to. right after defining auth object, can following: auth = auth(db) if auth.user , auth.user.username == 'guest': auth.settings.actions_disabled = ['reset_password', 'request_reset_password', 'change_password', 'profile'] if login via email address rather username, second condition above instead auth.user.email == guest_email_address (fill in actual email address of guest account).

vb.net - select as field in Linq -

i new linq , trying convert following sql query linq; select c.clientid , c.clientname , isnull((select 1 clientcontactaccess cca cca.clientid = c.clientid , clientcontactid = 2141 ), 0) 'clientaccess' clients c c.groupid = 1 i have tried far don't know include clause; dim query = (from c in db.client select new _ {key .clientid = c.clientid, _ key .clientname = c.clientname, _ key .clientaccess = (from cca in db.clientcontactaccess cca.clientid = c.clientid , cca.clientcontactid = _contactid)}) updated: i have managed come far clientaccess field returns no value. need return either 1 or 0. dim query = (from c in db.client c.groupid = 1 select new _ {key .clientid = c.clientid, _ key .clientname = c.clientname, _ key .clientaccess = (from cca in db.clientcontactaccess cca.clientid = c.clientid , cca.clientcontactid = _contactid)}) ...

Getting Class Cast exception with custom impersonation in websphere 8.5 -

i writing custom impersonation in websphere 8.5. getting class cast exception at: context ctx = new initialcontext(); portletservicehome pshimpersonate = (portletservicehome) ctx.lookup(impersonationservice.jndi_name); the error is: java.lang.classcastexception: com.ibm.wps.services.portletserviceregistry.home.portletservicehomeimpl incompatible com.ibm.portal.portlet.service.portletservicehome please suggest how fix error. checked online not getting proper help.

php - How can I display items from a database based on a variable? -

i want display text using php database (an issue) , user click button , integers added users statistics. here's problem (in short): i have variable ( $count ) (e.g: if $count = 1 ) display text (issue) id database. however, when user clicks 1 of buttons - want count increased one, user can go off site - , when user returns still display recent issue ( not $count = 1 , $count = 2 ) here's have tried: i feel able selecting database, when used $count = 0; @ start of page - , once user clicked button led $count = 1; - however, when user refreshed page go $count = 0; (obviously) -- instead of $count = 1;

c# - Unit test to verify that a base class method is called -

i have base class: public abstract class mybaseclass { protected virtual void method1() { } } and derived class: public class myderivedclass : mybaseclass { public void method2() { base.method1(); } } i want write unit test method2 verify calls method1 on base class. i'm using moq mocking library. possible? i came across related link: mocking base class method call moq in 2nd answer suggests can achieved setting callbase property true on mock object. it's not clear how enable call base class method ( method1 in above example) verified. appreciate assistance this. unit tests should verify behavior , not implementation . there several reasons this: the results goal, not how get results testing results allows improve implementation without re-writing tests implementations harder mock you might able put in hooks or create mocks verify base method called, care how answer achieved, or care answer right ...

python - How to calculate percent and add it to the amount -

one question. code is: preis = input("preis: ") preis1 = preis / 100 preis2 = preis1 * 1.9 preis3 = preis + preis2 lets preis input user makes 100 , should 100 / 100 = 1 (result price1 1). final output should 101.9. not right because not working :) for one, input() returns string, you'll need convert int. preis = int(input("preis: ")) apart that, code should work, might want read style guide; don't need declare new variable every step.

visual studio 2015 - Copy dialog "formatting selection" is freezing, causing the GUI to hang, how to turn it off? -

Image
i updated visual studio 2015 professional update 2 , when copying or highlighting in code anoying popup comes cancel button , takes 1-5 seconds , makes whole thing freeze. comes selecting/copying 1 word or many lines of code. how turn off until microsoft fixes whatever is... i had same issue, , installed update 3 , seems have corrected it.

android - How to apply threading while streaming a URL.? -

i have code play online radio on shoutcast server. when app launched, streams file , plays it. problem if have no network connection or improper network connection, status of app remains in "streaming" mode forever. want add thread streaming thing should wait 20 seconds, , if not able connect server, should throw event exit app stating "improper network connection". or if there other idea that, appreciated well.. code play media is, public void playfm() { uri myuri = uri.parse("http://108.166.161.206:8826/;stream.mp3"); try { if (mp == null) { this.mp = new mediaplayer(); } else { mp.stop(); mp.reset(); } mp.setdatasource(this, myuri); // go initialized state mp.setaudiostreamtype(audiomanager.stream_music); streaming=true; progress.setvisibility(view.visible); stream.setvisibility(view.visible); stop.setenabled(false); mp.s...

Adding files to zip java using memory while avoiding reserved file name problems -

i want add, remove or modify files in zip using effective way possible. yes, may should unzip/zip files file system, if there file special name ' aux ' or ' con ' , doesn't work in windows dos device names, , there might filename encoding issues prevents process working proberly. reason don't unzip file system , re-zip is more slower , takes more disk space using ram. in image : http://i.stack.imgur.com/ypuyg.png you use memory bases stream, bytearrayoutputstream read/write contents of file. the issue amount of available memory, because ram limited, you're going need store output on larger, disk eventually. in order try , optimism process, set preferred threshold read/write/process operation. basically run process , calculate how long took, based on preferred threshold, adjust buffer size next loop. i allow number of loops , average time not trying fine control on buffer might slow down

ios - How can I display a popup message in Swift that disappears after 3 seconds or can be cancelled by user immediatelly? -

in swift app have uiviewcontroller single button. this button invokes function calls popup disappears after 3 seconds. also, after time prints message console. code of function follows: func showalertmsg(title: string, message: string){ let alertcontroller = uialertcontroller(title: title, message: message, preferredstyle: .alert) self.presentviewcontroller(alertcontroller, animated: true, completion: nil) let delay = 3.0 * double(nsec_per_sec) let time = dispatch_time(dispatch_time_now, int64(delay)) dispatch_after(time, dispatch_get_main_queue(), { alertcontroller.dismissviewcontrolleranimated(true, completion: nil) print("popup disappeared") }) } that works fine, wanted introduce improvement. wanted add there button cancel popup , avoid displaying message in console. there way of displaying such popup user? - there way of showing in popup message counter number of seconds running out shows how time left until popup disappear...

Send an HTTP POST request with C# -

i'm try send data using webrequest post problem no data has streamed server. string user = textbox1.text; string password = textbox2.text; asciiencoding encoding = new asciiencoding(); string postdata = "username" + user + "&password" + password; byte[] data = encoding.getbytes(postdata); webrequest request = webrequest.create("http://localhost/s/test3.php"); request.method = "post"; request.contenttype = "application/x-www-form-urlencoded"; request.contentlength = data.length; stream stream = request.getrequeststream(); stream.write(data, 0, data.length); stream.close(); webresponse response = request.getresponse(); stream = response.getresponsestream(); streamreader sr99 = new streamreader(stream); messagebox.show(sr99.readtoend()); sr99.close(); stream.close(); here result it's because need assign posted parameters = equal sign: byte[] data = encoding.ascii.getbytes( $"username={user}...

c# - login and logout doesn't work properly -

i have asp.net web site whit folder structure , -mainfolder -account -login.aspx -register.aspx -script -styles -usercontrols -about.aspx -home.aspx -site.master -web.config my problem , when go login.aspx page , log in , it's redirect default.aspx . (what want , if log in about.aspx , after login successful , want redirect about.aspx ) and when log out , it's redirect http://localhost:-----/mainfolder/ (directory listing -- /mainfolder/) . ( want , if log out about.aspx , after log out successful , want redirect about.aspx ) . how can fix ? it looks using of default set asp.net web application project. try setting "destinationpageurl" property of asp:login control that's on login.aspx page: markup (notice added onloggedin="loginuser_loggedin" end): <asp:login id="loginuser" runat="server" enableviewstate="false" renderoutertable="false...

angularjs - Passing parameter to isolated scope inside directive -

i trying pass 2 different parameter isolated scope inside directive.when log out values in console collapse getting true infocard getting false value.my question why getting false value infocard in advance.here directive. <display-info user="user" collapse="true" infocard="true"></display- info> in controller receiving parameter, angular.module('myapp').directive('displayinfo', function() { return { templateurl: "displayinfo.html", restrict: "ea", scope: { user: '=', initialcollapse:'@collapse', showinfo:'@infocard' }, controller: function($scope) { $scope.collapse = ($scope.initialcollapse === 'true'); $scope.infocard = ($scope.showinfo === 'true'); console.log("collapse---->",$scope.collapse); console.log("displyinfo---->",$scope.infocard); } } }); here plunker link https://plnkr.co/edit/gng7e4rr...

hibernate - Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -

i'm developing spring mvc security hibernate example taking reference http://www.mkyong.com/spring-security/spring-security-hibernate-annotation-example/ . in example, updated maven dependencies latest versions <properties> <jdk.version>1.8</jdk.version> <spring.version>4.2.4.release</spring.version> <spring.security.version>3.2.9.release</spring.security.version> <jstl.version>1.2</jstl.version> <mysql.connector.version>5.1.38</mysql.connector.version> <logback.version>1.1.2</logback.version> <slf4j.version>1.7.6</slf4j.version> <hibernate.version>4.2.11.final</hibernate.version> <dbcp.version>1.4</dbcp.version> </properties> the compilation error reference: [error] failed execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project spring-security-hi...

Creating a todo list in javascript only -

i have problem here.i need create todo list following specifications: should have list,form , local storage components described below. list component's responsibilities to: attach list element in html. maintain active todo list in running web app. draw list of todos. redraw list when new item added or removed. interact storage service retrieve list of todo items browser's local storage on launch , save list of todos browser's local storage whenever changes. the form component's responsibilities to: attach list-form element in html. draw form, input, , submit button. add new item todo list when form submited interacting list component. clearing input after new todo item has been added allowing new item entered. the local storage component's responsibilities to: provide methods store , retrieve list of todos in browser's local storage. have tired following code: function get_todos() { var...

c# - Web API v2 Filter checking different types for same field -

i have code below in api filter. samplerequester object information form. has property called captcha. works great have other forms have captcha property. , work samplerequester objects. how check object captcha property? public class validatecaptcha : actionfilterattribute { public override void onactionexecuting(httpactioncontext actioncontext) { var cookiepayload = actioncontext.request.getcookie("mycaptcha"); samplerequester requester = (samplerequester)actioncontext.actionarguments["requester"]; if(cookiepayload !== requester.captcha) { actioncontext.response = actioncontext.request.createresponse(httpstatuscode.forbidden); } } } if know possible types in advance, can use as operator: public class validatecaptcha : actionfilterattribute { public override void onactionexecuting(httpactioncontext actioncontext) { var cookiepayload = actioncontext.request.get...

javascript - input text isn't updating angular model in one case that is identical to another in the same form -

i have simple form (reduced actual form demonstrate problem): <pre>name: {{currentchild.name}}</pre> <pre>annual college expense: {{currentchild.annualcollegeexpense}}</pre> <form name="childform" novalidate> <div class="form-inline"> <div class="form-group"> <label>name:</label> <input type="text" name="name" class="form-control" ng-minlength="1" ng-model="currentchild.name" ng-required="true"> <div class="help-block" ng-messages="childform.name.$error" ng-show="childform.$submitted || childform.name.$dirty || (childform.name.$invalid && childform.name.$touched)"> <p ng-message="required" ng-hide="childform.name.$valid">your name required.</p> ...

angularjs - asp.net mvc4 and angulars, two page shares value -

i have rest web services designed mvc4 , angular js. controller angularjs controller able invoke webservice(extends apicontroller). have 2 pages, 1 page login page, controller logincontroller. next page customer page, controller customercontroller. in logincontroller, when user click login, controller able read user's information example user's permission. after login, customer page display stuff according user's permission. dont know how pass permission logincontroller customercontroller. now, approach tried save user's permission in httpcontext.current.session["permission"], seemed angular js not able read data httpcontext.current.session["permission"]. unless, angular js able have method pass value 1 controller another. make factory , add permission factory object , inject customercontroller app.customercontroller('factory',function(factory)){ } something this....

ios - Login with Alamofire post method -

i trying login code: let loginrequest = [ "username" : self.txtusername.text! string, "password" : self.txtpassword.text! string ] let serverurl = serverpath.path + "/test/login" alamofire.request(.post, serverurl, parameters: loginrequest,encoding: .json).responsejson { response in switch response.result { case .success(let data): ... ... case .failure(let error): print("request failed error: \(error)") } always getting error request failed error: error domain=nscocoaerrordomain code=3840 "invalid value around character 0." userinfo={nsdebugdescription=invalid value around character 0.} but i'm trying static operation completed success let loginrequest = [ "username" : "test", "password" : "123" ] running code works fine....

ruby - Error "no implicit conversion of Symbol into Integer" with gem savon rails -

i using gem savon read xml, brought results correctly. when show in view fields of xml shows correctly, when want show 1 of these fields of error. "" put down code. class code < activerecord::base attr_accessor :strdatainicial, :strdatafinal def initialize(strdatainicial) @strdatainicial = strdatainicial end def data if response.success? return document(response) else raise "error message" end end private def document(response) data = response.to_hash[:ocupacao_por_segmento_response][:ocupacao_por_segmento_result][:ocupacao_por_segmento] if data data else nil end end def response client.call( :ocupacao_por_segmento, message: { strdatainicial: @strdatainicial, strdatafinal: "03/25/2015", ...

MSSQL Server 2012 and extended stored procedure from a C++ dll -

i assigned new task @ work. need update old c++ project. last time project modified way in 2006. now, c++ project compiles dll used extended stored procedure. dll installed on sql server , used stored procedure. our sql server upgraded 2012 version , dll needs updated 64-bit. is still supported mssql server 2012? still support calling extended stored procedure c++ dll? thanks, charles-antoine caron support extended stored procedure still there in sql2012 , sql2016, following caveat: this feature removed in future version of microsoft sql server. not use feature in new development work, , modify applications use feature possible. use clr integration instead. see documentation @ https://msdn.microsoft.com/en-us/library/ms164653(v=sql.110).aspx if porting clr complicated, facade c++ dll using pinvoke in c#.

c++ - Is it slower to access a field from several structures vs accessing elements of an array / vector? -

i noticed other students use lot of arrays elements of should fields of object. is because faster access element array vs field structure? for example, have clock cycles stored object as... 1) array of 5 ints 2) field in 5 structures and need access these elements find min / max. i idea of keeping properties of object opposed having multiple arrays have fit naturally field. i'm not sure if i'm writing considered bad programming habits handling field in structure. maybe not 5 elements - thousands of elements, there might difference. the universal principle of caching locality of reference - it's better store stuff together. if know program access 1 (or few) field of structures, it's better relocate field dedicated array. if program accesses (or most) fields of structures, it's better hold structures in array. however, related performance, real behavior surprising, , have measure 1 way of implementation, other, , choose best. if appli...

How to use git to track changes in another directory? -

i'm working on project have access code can't add version control source directory itself. (the main developer has own source control, it's not accessible/comprehensible/etc. reasons not relevant here.) to keep sanity, track changes other developer makes, i'd have kind of version control system set up. (git version control system i've used since dark days of vss, that's i'll use.) my current plan mirror existing codebase , initialize git locally. i'll need able compare local copy actual source when other developer makes changes. my questions: is reasonable strategy? if so, should set git init --bare or git init ? how should compare local copy actual source? diff -qnr source/ local-source/ ? git diff --no-index source/ local-source/ ? else? first, bit of background. in git, these concepts cleanly separated: the git repository: contains git's data the work tree: directory tree in filesystem work when create local git ...

php - Variable Not Being Sent In Email -

i'm bit stumped on since i'm using same setup in 1 of scripts , works. i'm setting link in e-mail system users unsubscribe. unsubscribe script same 1 i've used on , on know works, when e-mails sent out e-mail not in link. link should appear in email http://example.com/unsubscribe.php?id=encoded-email appearing http://example.com/unsubscribe.php?id= . if through code of variables filled out , have values i'm stumped why it's not showing in e-mail. the variable should working $encodedto . ideas? require($_server['document_root']."/settings/functions.php"); require($_server['document_root'].'/php/class.phpmailer.php'); require($_server['document_root'].'/php/class.pop3.php'); require($_server['document_root'].'/php/class.smtp.php'); if(isset($_post['submit'])) { $conn = getconnected("oversizeboard"); if(empty($_post['company'])) { echo "company name require...

Sorting dicom images in Matlab -

i working lung data sets in matlab, need sort slices correctly , show them. i knew can done using "instance number" parameter in dicom header, did not manage run correct code. how can that? here piece of code: dicom_directory = uigetdir(); sdir = strcat(dicom_directory,'\*.dcm'); files = dir(sdir); = strcat(dicom_directory, '\',files(i).name); x = repmat(double(0), [512 512 1 ]); x(:,:,1) = double(dicomread(i)); axes(handles.axes1); imshow(x,[]); first of all, dicom header, need use dicominfo return struct containing each of fields. if want use instancenumber field sort by, can in such way. %// of files directory = uigetdir(); files = dir(fullfile(directory, '*.dcm')); filenames = cellfun(@(x)fullfile(directory, x), {files.name}, 'uni', 0); %// ensure dicom files , remove ones aren't notdicom = ~cellfun(@isdicom, filenames); files(notdicom) = []; %// load dicom headers array of structs infos = cellfun(@dicominfo,...

java - Main Activity get data from 2 fragments -

i have read through posts on here regarding activity-fragment communication problem unique; try state clear possible understand. in app there mainactivity , 2 fragments(we call these fragment1 , fragment2) in sliding tab layout. main activity contains navigation drawer, , fragment1 contains textview , other fragment2 contains edittext. heres problem now, there option on drawer called share:- when clicked, want access string value in textview of fragment1 or value in edittext of fragment2; depends on fragment active in tablayout. want pass string value text message argument of intent in order shared whatever client user chooses. @override public boolean onnavigationitemselected(menuitem item) { // handle navigation view item clicks here. int id = item.getitemid(); if (id == r.id.nav_share) { //inside onnavigationitemselected string value = " "; fragment currentfragment= getactivefragment(); if(currentfragment instanceof speecht...

Heroku go-getting-started not running localy -

does know why i'm unable run go-getting-started application localy? go github.com/heroku/go-getting-started/cmd/... cd $env:gopath/src/github.com/heroku/go-getting-started ps c:\users\xxxx\gocode\src\github.com\heroku\go-getting-started> heroku local [okay] loaded env .env file key=value format [okay] trimming display output 107 columns 11:28:05 pm web.1 | 'go-getting-started' not recognized internal or external command, 11:28:05 pm web.1 | operable program or batch file. [done] killing processes signal null 11:28:05 pm web.1 exited abnormally ps c:\users\xxxx\gocode\src\github.com\heroku\go-getting-started> code . according heroku dev center : if see error unrecognized command or “command not found”, $gopath/bin not in $path or trailing ... missing go github.com/heroku/go-getting-started/.... command used during “prepare app”. make sure $gopath/bin (in case, c:\users\xxxx\gocode\bin ) in $path variable. server binary, go-getting-started ...

ios - MoPub swift integration not working correcty -

i'm trying use mopub cocoapods on swift project. set cocoapods set use_frameworks , bridging header set in project's target pointing mopub's own briding header: #import <mopub_ios_sdk/mopub-bridging-header.h> but xcode still complaining when try use objects frin framework: use of undeclared type 'mpadview' it worked when used fabric.

eclipse - Symfony2 - retrieve old Entity after doctrine:mapping:import -

i generated entities existing database in symfony2. problem 1 of entities modified erased 1 db table , retrieve modifications. here did: php app/console doctrine:mapping:convert xml ./src/acme/blogbundle/resources/config/doctrine/metadata/orm --from-database --force php app/console doctrine:mapping:import acmeblogbundle annotation php app/console doctrine:generate:entities acmeblogbundle i tried in local history files generated when did commands, there not in history.

r - How can I plot the residuals of lm() with ggplot? -

i have nice plot residuals got lm() model. use plot(model$residuals) , want have nicer. if try plot ggplot, error message: ggplot2 doesn't know how deal data of class numeric fortify no longer recommended , might deprecated according hadley. you can use broom package similar (better): library(broom) y <-rnorm(10) x <-1:10 mod <- lm(y ~ x) df <- augment(mod) ggplot(df, aes(x = .fitted, y = .resid)) + geom_point()

How to use the libspotify api? -

this version of libspotify have download:libspotify-12.1.51-win32-release.there example named "spshell". when test track playing , sp_session_player_play(g_session, 1) called,i can not heard voice. another question,what's relationship between notify_main_thread , sp_session_process_events.when sp_session_process_events (sp_session *session, int *next_timeout) called has been done , what's effect of second parameter. i don't believe spshell demo streams music @ all. sp_session_player_play instructs libspotify start providing audio data. not play you. must provide spotify music_delivery callback receive audio data, , must arrange play yourself. @ jukebox example. notify_main_thread called when libspotify needs sp_session_process_events invoked on main thread. callback should perform whatever notification necessary wake main thread , return without waiting it. must not call sp_session_process_events callback, or deadlock program. when sp_sessio...

java - the type must implement the inherited abstract method -

i working on program intermediate java , feel have logic right, error in class introduction: the type questionset must implement inherited abstract method iquestionset.add(iquestion) i have method have question object parameter instead of iquestion(the interface question) questionset: package com.jsoftware.test; import java.io.serializable; import java.util.arraylist; public class questionset implements serializable, iquestionset{ arraylist<question> test = new arraylist<question>(); public questionset emptytestset(){ questionset set = new questionset(); return set; } public questionset randomsample(int size){ questionset set = new questionset(); if(size>test.size()-1){ for(int =1; i<test.size(); i++){ int num = (int)(math.random()*test.size()); set.add(test.get(num)); } }else{ for(int =1; i<size; i++){ in...

cmake - How do I install shared data on Windows with CPack? -

i'm trying install data shared between few different programs make. signs seem point c:\programdata\${companyname}, fine, of course cpack objects absolute paths. in case, i'm targeting wix installer. i can't seem find documentation says ought using. install (files ../config/netstat_protocol.xml destination ${install_ocu_dir} ) if want install_ocu_dir resolve c:\programdata\mycompanyname\ocu, what's right way? here lines last tried: set(install_ocu_dir "%programdata%/cyphy/ocu") install(directory destination ${install_ocu_dir} directory_permissions world_read world_write world_execute) install (files ../config/netstat_protocol.xml destination ${install_ocu_dir} ) this results in error: executing op: settargetfolder(folder=c:\program files\cyocu 2.0.0\%programdata%\cyphy\ocu\)

git - Trying to set up remote repo and push to it, getting confused -

i have local repo set on laptop's hard drive, @ c:\somefolder\.git . want set remote repo on windows server @ x:\someotherfolder backup. here steps have taken far: in x:\someotherfolder , opened git bash session , entered git clone "c:\somefolder" . got message cloning 'somefolder'...done. in c:\somefolder , opened git bash session , entered git remote add origin "x:\someotherfolder" . statement executed without response. made changes in local project files , committed them local repo git commit -am . from c:\somefolder git bash, entered git push origin master . response is: -- remote: error: refusing update checked out branch: refs/heads/master remote: error: default, updating current branch in non-bare repository remote: error: denied, because make index , work tree inconsistent remote: error: pushed, , require 'git reset --hard' match remote: error: work tree head. etc. i feel set remote incorrectly. should instead?...

android - Using OpenCV4Android, how to create an ROI (Region-Of-Interest or a submat) from a contour? -

given image mat , , contour (which matofpoint ) in it, how can create roi (region of interest)/submat? i can see 3 interesting methods on docs of mat , mat submat(int rowstart, int rowend, int colstart, int colend) extracts rectangular submatrix. mat submat(range rowrange, range colrange) extracts rectangular submatrix. mat submat(rect roi) extracts rectangular submatrix. is there way find out rowstart , rowend , colstart , colend contour? or is there way rowrange , colrange contour? or can make rect contour? use imgproc.boundingrect(matofpoint contour) method. way can use third of submat() methods have listed: rect roirect = imgproc.boundingrect(contour); mat roisubmat = originalmat.submat(roirect); roisubmat region of interest (stored in mat).

c - invalid conversion from 'int' to 'GKeyFileFlags' -

i have following config file config.cfg [dd] user=** password=*** database=**** ipservidor=**** port=3306 [machine] machine1=8 temp=5=1001 hum=7=1002 link=8=1003 volt=9=1004 with usage of glib gkeyfile parser in this tutorial read number of machine1 8. so copy-paste part in main int main() { gkeyfile *keyfile; gkeyfileflags flags; gerror *error = null; gsize length; /* create new gkeyfile object , bitwise list of flags. */ keyfile = g_key_file_new (); flags = g_key_file_keep_comments | g_key_file_keep_translations; /* load gkeyfile keyfile.conf or return. */ if (!g_key_file_load_from_file (keyfile, "config.conf", flags, &error)) { g_error (error->message); return -1; } } but have error invalid conversion 'int' 'gkeyfileflags' where error here? so problem apparently trying compile c code c++, isn't, compiler complains. modify settings c source files compiled c compiler, , c++ source files c++ compiler. ...

javascript - How to redirect to a new page using auto form and iron router? -

so have built auto form using autoform. want redirect new page displaying new templates after form has been submitted. how can ?? here html code: ultimatum game <body> <div class="container"> <div class="navbar"><h1>the ultimatum game</h1></div> {{> player}} </div> </body> <template name="player"> {{> quickform collection="playerslist" id="insertlist" type="insert" }} </template> how redirect new q/a page after user submits it. make redirect in event handler: template.player.events({ 'submit form': function(e, t) { router.go('newpath'); }, });

dialog - Android: Using data from TimePickerDialog in PreferenceActivity -

i trying create setting sets time. want time used in fragment. don't know (and can't find) how data timepickerdialog , use in fragment/activity. know need use sharedpreferences confused (especially after reading this: http://developer.android.com/guide/topics/ui/settings.html !!). i followed timepicker in preferencescreen create dialog the time stored long easier use calendar. dialog works fine - time set , restored properly. code: settings.java public class settings extends preferenceactivity implements onsharedpreferencechangelistener { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // load preferences xml resource addpreferencesfromresource(r.xml.preferences); } @override public void onsharedpreferencechanged(sharedpreferences arg0, string arg1) { // todo auto-generated method stub } this custom dialog allows placed in prefe...

MongoDB Java Async Driver replaceOne doesn't seem to work -

i trying update document mongodb async java driver , code below, // jsonstring string of "{_id=5715e426ed3522391f106e68, name=alex} final document document = document.parse(jsonstring); document newdocument = document.append("status", "processing"); mongodbcollection.replaceone(document, newdocument, (updateresult, throwable) -> { if (updateresult != null) { log.info("updated doc ::::::>>> " + newdocument.tojson()); log.info("updated result ::::>> "+updateresult.tostring()); } else { throwable.printstacktrace(); log.error(throwable.getmessage()); } }); as per logging, see updated document below, info: updated doc ::::::>>> { "_id" : { "$oid" : "5715e426ed3522391f106e68" }, "status":"processing"} info: updated result ::::>> acknowledgedupd...

OpenGL UI library for C# with OpenTK -

i'm writing game engine in c# using opentk, , i'm trying add support ui engine. writing scratch seems big headache , if else made library instead, lot faster. although question poorly worded exists gwen.net . project direct port of c++ gui library of same name. in fact if in renderers & sample there demos of how integrate opentk. should of way there.

mod proxy - Use mod_proxy to change port to url apache2 -

i'm running nodebb forum runs on port 4567 , need redirected https , have port removed on end. i've looked around nothing has worked. i've tried: loadmodule proxy_module modules/mod_proxy.so loadmodule proxy_http_module modules/mod_proxy_http.so <directory /> allowoverride none require denied </directory> proxypass / https://forum.website.net:4567 proxypassreverse / https://forum.website.net:4567 i want end url this: https://forum.website.net . in advance. i had slight error. loadmodule proxy_module modules/mod_proxy.so loadmodule proxy_http_module modules/mod_proxy_http.so <directory /> allowoverride none require denied </directory> proxypass / https://forum.website.net:4567 proxypassreverse / https://forum.website.net:4567

java - JOOQ Retrieving a Map from selectCount -

i trying map map , has booktype , count information jooq. have tried following , different combinations keep getting errors. appreciated: map<string, result<record1<integer>>> countmap = ctx.selectcount().from(booktable) .groupby(booktable.type) .fetchmap(booktable.type); you cannot use selectcount() in case, because produce select count(*) query, when want select type, count(*) query. here several ways how that, depending on type you're trying out of query: // assuming static import: import static org.jooq.impl.dsl.*; map<string, integer> map1 = ctx.select(booktable.type, count()) .from(booktable) .groupby(booktable.type) .fetchmap(booktable.type, count()); or: map<string, record2<string, integer>> map2 = ctx.select(booktable.type, count()) .from(booktable) .groupby(booktable.type) .fetchmap(booktable.type); or: map<string, list<integer>> map3 = ctx.select(bookt...

javascript - What does .equals() do? -

i saw use of .equals() method in stackoverflow posting: any way make jquery.inarray() case insensitive? var matchstring = "matchme"; var rslt = null; $.each(['foo', 'bar', 'matchme'], function(index, value) { if (rslt == null && value.tolowercase().equals(matchstring.tolowercase())) { rslt = index; return false; } }); yet cannot find documentation on method. references help. the code you've seen in other answer not standard js code. it must have been lifted page includes other code adds .equals() method string class (e.g. "processing.js" library) code such as: string.prototype.equals = function(that) { return === that; } i've corrected original answer no longer has dependency.

javascript - How to find next textarea using jQuery? -

how find next text area in following html use case? fiddle: https://jsfiddle.net/hthaava8/ jquery: code: $("textarea").keyup(function (e) { var txtarea = $(this).next().find('textarea').eq(0); alert(txtarea.attr('id')); $(txtarea).focus(); $(txtarea).val("nicetried"); }); html code: <div class="pure-u-1 pure-u-md-1-8"> <div class="pure-g"> <div class="pure-u-1-2 "> <p class="boldtext">2.1 </p> </div> <div class="pure-u-1-2"> </div> </div> </div> <div class="pure-u-1 pure-u-md-2-5"> <p class="boldtext">focus next textarea?</p> </div> <div class="pure-u-1 pure-u-md-1-5"> <textarea class="" id="commenty" style="height: 89px; overflow-y: hidden;"></textarea...

excel - How to increment duplicate values from 1 to n by criteria? -

let's have list of duplicate values in column such as:aaabbaacabc. ...aac. want excel rank respectively first a1,the first b b1 second a2 , second b b2 , forth until a(nth) , b(nth). , additional should automatically rank a(nth+1). same thing b c etc. note should able enter new value such x automatically rank x(nth+1) or x1 if did not exist in table before. hoping made myself understood. waiting me. vba or array formulas have no preference once can realise want. note found way sorting them in accending order can't match additional value @ end of data base. thanks. i assuming data in column "a". enter formula in column "b" , copy formula till row want. =a1 & if(a1="","",countif($a$1:a1,a1))

php - How to test telegram bot webhook on local machine? -

i developing telegram bot , want use webhooks instead of polling messages telegram server. i'm developing , testing app on localhost not reachable web host, can't set webhook url. now wondering how real messages telegram on local machine though webhooks? you use ngrok if needed quick public url webapp without bunch of hassle. so you'd run ngrok.exe http 192.168.10.10:80 -host-header=test.app it'll return custom domain forwarding http://449ee26d.ngrok.io -> 192.168.10.10:80 and point telegram's webhook http://449ee26d.ngrok.io/your-endpoint ngrok

sql server - How to select columns that dont need grouping by -

i want select students highest grades compared brothers/sisters sql keeps saying need group firstname. create table t ( id int, fname varchar(30), lname varchar(30), grade int ); insert t values (3,'peter','yakobo',33), (2,'ara','yakobo',21), (1,'war','jones',45), (0,'ororo','jones',46); select fname,lname,max(grade) t group lname like example: in yakobo family, peter has highest grade, , in jones family ororo has highest grade use row_number with cte as( select *, rn = row_number() over(partition lname order grade desc) t ) select id, fname, grade cte rn = 1 as commented zlk: you want use rank() , not row_number() , in case there duplicates.

c++ - Dynamically allocating array of objects like int -

in order create array of int s dynamically, need int *a = new int[20]; . is there similar way create array of objects or structs? for example, need dynamically allocated array of objects of class a , how should declare it(syntax)? what constructor called on each object(if @ constructor called)? you can using line: a* = new a[n]; how works? the new keyword allocate n sequential block in heap. each block has size of sizeof(a) total size in bytes n*sizeof(a) . allocating objects in memory ensured done calling default constructor n times. alternative: use std::vector instead. work you.

android - Clicking the button of listview is not fetching the corresponding textview value of that listview item -

im having buttons each items of listview. when button clicked, has fetch value of corresponding listview item. following getview method. @override public view getview(int position, view convertview, viewgroup parent) { view = convertview; if (convertview == null) { //inflate view each row of listview if (imageloader == null) imageloader = appcontroller.getinstance().getimageloader(); view = inflator.inflate(r.layout.pending_orders_fragment, null); vholder = new viewholder(); vholder.mshippngrefno = (textview) view.findviewbyid(r.id.shipment_ref_no_value); vholder.contact = (imagebutton) view.findviewbyid(r.id.imagebutton); vholder.mshippingstatus.settag(position); view.settag(vholder); } else vholder = (viewholder) view.gettag(); pendingordersdao item = listforview.get(position); vholder.mshippngrefno.sette...

DDL Trigger Oracle -

i've created 1 audit table record information object created in schema , whom. hr@ssc> create table create_audit 2 ( created_date date, 3 object_type varchar2(30), 4 object_name varchar2(30), 5 created_by varchar2(20)); this trigger i've created: 1 create or replace trigger create_trg_audit 2 after create on schema 3 begin 4 insert create_audit values 5 (sysdate, ora_dict_obj_typ, ora_dict_obj_name , ora_dict_obj_owner); 6* end create_trg_audit; i'm receiving below error while creating ddl trigger: hr@ssc> show error errors trigger create_trg_audit: line/col error -------- ----------------------------------------------------------------- 2/5 pl/sql: sql statement ignored 3/16 pl/sql: ora-00984: column not allowed here can't give insert command in ddl triggers? hr@ssc> select object_type, object_name ,owner all_objects last_ddl_time > sysdate-10; you have typo; insert refers...