Posts

Showing posts from January, 2014

Is there any way to install direct 2.4 version of GWT plugin in eclipse? -

in our project using gwt-2.4 version of gwt plugin. plugin installed in eclipse support windows xp-32 bit in long back. but, got new system windows 8.1 - 64 bit. when tried install gwt plugin in juno/luna, default installing gwt-2.6 version. not supported in project. if there way install gwt-2.4 version of gwt plugin in eclipse, please reply on question. are talking sdk version? if yes, download sdk here . unpack sdk. goto preferences -> google -> web toolkit select add button , choose downloaded version.

How can I run a ruby script as a service including Sinatra in ubuntu? -

i have written script parses ups's data via serial interface json file, looping indefinitely every 5 secs: require 'json' pipe = io.popen("apcaccess") upsdata_h = {} data = [] while true pipe = io.popen("apcaccess") upsdata_h[:ups] = {} data = [] while (line = pipe.gets) data = line.split(':') upsdata_h[:ups][data[0].strip] = data[1].strip end puts "internal temperature: #{upsdata_h[:ups]['itemp']}" file.open("upsdata.json", "w") |f| f.write(upsdata_h.to_json) end sleep 5 end i have small 1 create tiny api sinatra: require 'sinatra' set :bind, '0.0.0.0' '/api/upsdata' content_type :json file.read('upsdata.json') end i want run them both service in ubuntu server 15.04. how keep script running forever in background other ubuntu's services ? should include sinatra in service loads on boot ? you start each serv

angularjs - angular controller multiple times -

i have web page angular in using ngroute redirect 3 pages. modulo_angular.config(function($routeprovider){ //config y defi de las rutas $routeprovider.when("/", { controller: "appuom", controlleras: "apuom", templateurl: "home.html" }) .when("/descargas", { controller: "appsocket", controlleras: "apsocket", templateurl: "descargas.html" }) .when("/opciones", { controller: "appphenomena", controlleras: "apphen", templateurl: "opciones.html" }); }); i have 3 factories , 3 different controllers. each factory related 1 controller can keep data when page changed. in 1 page, "descargas", have sockets receive data ym node.js server. controller: function controladorsocket($http, factor

How to put a Wordpress widget inside a bootstrap navbar? -

i making first wordpress theme using bootstrap. want create widget area in far right of navbar, can add ie. language selector. tried following code, nothing appears on site, or in source code widget should be. ideas? <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <div class="row"> <div class="span8"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <a class="brand" href="<?php echo site_url(); ?>"><?php bloginfo('name'); ?></a>

java - Execute Junit tests on classes in Android Studio without initialising mobile device / emulator -

is there way execute test in android studio specific class without mobile device being used testing environment? tests execute on development machine instead. classes in question not contain android specific code. this common problem android development , 1 has been solved robolectric . allows tests run on jvm , can therefore ran within android studio. example below taken website. @runwith(robolectrictestrunner.class) public class myactivitytest { @test public void clickingbutton_shouldchangeresultsviewtext() throws exception { myactivity activity = robolectric.setupactivity(myactivity.class); button button = (button) activity.findviewbyid(r.id.button); textview results = (textview) activity.findviewbyid(r.id.results); button.performclick(); assertthat(results.gettext().tostring()).isequalto("robolectric rocks!"); } }

struts2 - struts '.action' not defaulting into URL -

i'm wondering why struts application direct me https://myhost.com/mything/mything?picklistid=2000000011 instead of: https://myhost.com/mything/mything.action?picklistid=2000000011 shouldn't these show same thing? top url directs me 404 page , bottom works correctly. i solved problem. turned out in web.xml filter mappings directing urls containing .action struts. needed change filter mappings requests allowed go struts.

Error using Blueprint xml to establish a Weblogic component with a JndiObjectFactoryBean -

so, i'm trying weblogic component work in our application's blueprint file using snippit below, though i'm not sure else include other being used connect jms queue. > <bean id="wmqjndifactorybean" > class="org.springframework.jndi.jndiobjectfactorybean"> > <property name="jndiname" value="jms/connectionfactory"/> > <property name="jnditemplate"> > <bean class="org.springframework.jndi.jnditemplate"> > <property name="environment"> > <props> > <prop key="java.naming.factory.initial">weblogic.jndi.wlinitialcontextfactory</prop> > <prop key="java.naming.provider.url">t3://localhost</prop> > <prop key="java.naming.security.principal">weblogic&

Logging the XML or JSON sent by RestSharp -

i'm using restsharp send information api. log xml i've sent api can debug later. i this: var request = new restrequest(resourcepath, method); request.addbody(dto); logger.log(request.content); var response = client.execute(request); but, actual request sent restsharp not seem exposed. everything sent in request available in request.parameters. to make getting request body easier created extension method: public static class restsharpextensions { public static string getbody(this irestrequest request) { var bodyparameter = request.parameters .firstordefault(p => p.type == parametertype.requestbody); return bodyparameter == null ? null : bodyparameter.value.tostring(); } }

ios - custom table cell displaying nil -

i'm trying set title , display button in custom cell object in second table view controller, first dynamic prototype cell displaying text. the first prototype cell uitableviewcell , second custom object. in first view controller implement same exact method , works fine. not sure error be, models use have data in them. have correct cell identifier in storyboard, , connection custom cell uibutton set. thanks in advance. method: -(uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cellidentifier"; static nsstring *questionsectionidentifier = @"questionsectioncell"; if (indexpath.section == 0) { uitableviewcell *cellquestion = [tableview dequeuereusablecellwithidentifier:questionsectionidentifier]; if (cellquestion == nil) { cellquestion = [[uitableviewcell alloc]

amazon web services - S3 keys from a QT/C++ client -

we have application written in c++/qt sits on client machines around world , client uploads files amazon s3, best way authenticate amazon without including amazon key on every client, there way generate unique key each client (1000s of potential clients)? would make more sense send intermediate server or proxy , there upload files amazon s3? the optimum way implement follow below steps: step1: allow clients upload files intermediate server. step2: store aws s3 bucket user credentials in intermediate server file or database. step3: upload files intermediate server amazon s3 bucket. hope helps....

c# - How to open link address containing HEX without converting HEX to digit? -

i have links containing hex values, i'm opening them code below: var webrequest = webrequest.create(url); try { webresponse webresponse = webrequest.getresponse(); webresponse.close(); } but when webrequest created, links converting uri loosing special hex values. example: original link: /generic=http%3a%2f%2fnym1.ib.adnxs.com%2fab%3fenc%3drmexlckt4t actual link: /generic=http%3a/nym1.ib.adnxs.com/ab%3fenc%3drmexlckt4t %2f converted / possible force opening of original link, or maybe way open such links? thanks!

types - Frustrated when creating a pair of integers in C++ -

this question has answer here: c++11 make_pair specified template parameters doesn't compile 1 answer i want create pair in c++ int x=3; int y =4; std::pair<int,int> mypair = std::make_pair<int,int>(x,y); but error: error: no matching function call ‘make_pair(int&, int&)’ std::pair<int,int> mypair = std::make_pair<int,int>(x,y); on other hand, if use std::pair<int,int> mypair = std::make_pair<int,int>(3,4); then works. explanation on ths? , how make first case above work 1 can create pair (x,y) wihtout pain? change to: std::pair<int,int> mypair = std::make_pair(x,y); explanation here

java - I just can't get a fragment to work -

i trying add simple fragment , doing wrong. create blank "mainactivity" in android studio, add fragment , try wire up: mainactivity.java: package com.fragtester.fragtester.fragtester; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // check activity using layout version // fragment_container framelayout if (findviewbyid(r.id.fragment_container) != null) { // however, if we're being restored previous state, // don't need , should return or else // end overlapping fragments. if (savedinstancestate != null) { return; } // create new fragment placed in

email - How to add X-header to unix mailx or add attachment to usr/sbin/sendmail -

i attempting add x-header x-app-volt: yes header of email .tar attachment. have access usr/sbin/sendmail , mailx . not have root access can't download other versions of mailx or mutt . i can add x-header usr/sbin/sendmail using below code, can't figure out how add .tar attachment. /usr/sbin/sendmail -i -- toemail << end to: toemail subject: test x-app-volt: yes hope works! end i can attach .tar file mailx using the below code, can't figure out how add x-header . mailx not have -a option. cat file | uuencode filename | mailx -s "test" toemail thank you one way construct input in temporary file: cat > tmpfile$$ << end to: toemail subject: test x-app-volt: yes hope works! end uuencode filename < file >> tmpfile$$ /usr/sbin/sendmail -i -- toemail < tmpfile$$ also, use sendmail's -t flag in case, rather repeating recipient: /usr/sbin/sendmail -i -t < tmpfile$$ if don't want use tempor

jquery - change image src with .replace -

i've got images want change image when hover on div. image 1: "geluid1", image 2: "geluid2". $(".block").mouseover(function(){ $("img",this).attr("src").replace("1","2"); }); but reason doesn't seem work properly. can me find problem? your code src of image , replaced content. however, did not updated src attribute of img . you didn't set src attribute value of img . use following code set src value replaced one. $("img",this).attr("src", $('img', this).attr('src').replace("1","2")); code $(".block").mouseover(function() { var img = $('img', this); // cache image object img.attr('src', img.attr('src').replace('1', '2')); // update image src url new url });

sql - drop trigger if exists and create -

i check if trigger exists on [tbl] , create one. tried way didn't work. doing wrong? if exists (select * sys.objects [name] = '[dbo].[trg]' , [type] = 'tr') drop trigger [dbo].[trg] on [dbo].[tbl] go create trigger [dbo].[trg] on [dbo].[tbl] after delete begin // end go the [name] field in sys.objects contain actual name (i.e. trg ), not including schema (i.e. dbo in case) or text qualifiers (i.e. [ , ] in case). and, don't specify table name drop trigger since trigger object (unlike indexes). need remove on clause (which used ddl , logon triggers). if exists (select * sys.objects [name] = n'trg' , [type] = 'tr') begin drop trigger [dbo].[trg]; end; please note should prefix object name string literal n since [name] field sysname datatype equates nvarchar(128) . if did want incorporate schema name, use object_id() function allow schema names , text qualifiers (you need match against object_id in

bouncycastle - Provider-independent crypto in Java? -

i'm trying write program in java digitally sign database entries prior insertion. program algorithm-independent - ideally, user specify jce provider , algorithm arguments @ runtime. is there way this? i've been testing bouncycastle provider, , code runs fine when dynamically register it: security.addprovider(new bouncycastleprovider()); however, when try statically register provider adding following lines end of security/java.policy file, error: java.security.nosuchproviderexception: no such provider: bc when try instance of security object using provider. security.provider.1=sun.security.provider.sun security.provider.2=org.bouncycastle.jce.provider.bouncycastleprovider specifically, added lines /etc/java-7-openjdk/security/java.policy (which linked $java_home/jre/lib/security/java.policy ). on ubuntu 12.04. tried adding bouncycastleprovider first entry , got same error. am configuring static registration wrong or attempting impossible? i think addin

javascript - How do I simulate multiple simultaneous slow Meteor publications? -

i want simulate multiple slow subscriptions. client subscribes 2 or more publications @ same time, , result arrive later. goal able see how network latencies , randomness can affect application (it bugs because expected publication ready before another, ...). using following short setup publications: // server/foo.js meteor.publish('foo', function() { console.log('publishing foo'); meteor._sleepforms(2000); console.log('waking foo'); this.ready(); }); // server/bar.js same different name meteor.publish('bar', function() { console.log('publishing bar'); meteor._sleepforms(2000); console.log('waking bar'); this.ready(); }); both publications slowed down meteor._sleepforms seen in this amazing answer . the client subscribes each publication: meteor.subscribe('bar'); // /client/bar.js meteor.subscribe('foo'); // /client/foo.js from there expected see both 'publishing' logs first, bot

How do I declare a reference to an ActiveX "ListView" Control in Access VBA? -

i'm using access 2003. in "references" (tools > references > browse...), i've added in "microsoft windows common controls 6.0 (sp6)" (c:\windows\system32\mscomctl.ocx) , i've created/inserted instance of control "microsoft listview control 6.0 (sp6)" on form , given control name "mylistview". i wanted decorate mylistview custom methods i've created class ("decoratedlistview") contains member field ("lvw"). i want 'lvw' point/reference mylistview, don't know reference type use in declaration. importantly, want capture lvw's columnclick event. i've tried: public withevents lvw object public withevents lvw control public withevents lvw mscomctllib.listview.2 and none works when set lvw = myform.mylistview can explain how should create reference (lvw) existing object (mylistview)? access can't handle sort of thing. the onclick should available on myform

mongodb - Unable to Understand the Document Size in Mongo Db -

this question has answer here: mongo = size of single document 3 answers i encountered strange behavior of mongo , clarify bit. wanted practically find out how many bytes single document consume when has 1 boolean attribute present in. using stackoverflow, found out can use following command object.bsonsize - javascript method should return size in bytes while executing these commands got results confusing. here provide steps incorporated i created database called mydatabase , stored collection called datarandom has 1 attribute called status , have set false .it assigned object id=558bf45d5ea9019aec35d7a2 . ran following query in robomongo object.bsonsize(db.datarandom.find( {"_id" :objectid("558bf45d5ea9019aec35d7a2")})); i got 100 bytes . i ran second query on robomongo follows object.bsonsize(db.datarandom.findone( {&quo

sql server - How to prompt an SQL query user to input information -

i have query wrote in sql server run people don't know sql, , there 2 areas have have different string or date entered each time query run. of right now, wrote enter information @ top of query , stored variable. there way can sql prompt person running query enter data? below excerpt of code has talking in it. declare /*enter accounting month*/ @amon varchar(2) = '05', /*enter invoice date in mm/dd/yyyy format*/ @invdate date = '05/31/2015' ~~ rest of code ~~ declare @suma numeric(25, 5), @sumb numeric(25, 5), @ratio numeric(25, 5) select @suma = sum(amnt) accnt accno = '1152' select @sumb = sum(amnt) acc1152 update acc1152 set amnt = amnt * (@suma/@sumb), amon = @amon, invdate = @invdate, ven = '1152', code = '1152', invno = 'inventory' so possible sql prompt user type in value @amon , @invdate? other me having comment line telling them so? in case can not application, have no developers etc etc, have 1 wa

fine uploader - How to modify current chunk data during upload process with FineUploader -

we need call third party lib, ideally @ time of onuploadchunk callback. shown in documentation ( http://docs.fineuploader.com/branch/master/api/events.html#uploadchunk ), can have parameters in order identify chunk , stuff javascript slice method. but, question : how give updated chunk fineuploader upload process ? thanks lot help. you cannot modify chunks created fine uploader, nor should able may change size of chunk, expected total number of chunks, , require adjustments of internal state , sent parameters. if you'd modify files, have 2 options: modify file before sent to fine uploader modify file before file upload begins. can cancel original file , , submit changed versions via the addfiles api method .

c++11 - how to get file names vs directory names in c++ (using boost filesystem library) -

when use boost::filesystem list of file names in directory, receive file names directory names: #include <string> #include <iostream> #include <boost/filesystem.hpp> using namespace std; using namespace boost::filesystem; int main() { path p("d:/anyfolder"); (auto = directory_iterator(p); != directory_iterator(); i++) { cout << i->path().filename().string() << endl; } } output like: file1.txt file2.dat folder1 //which folder is there quick way distinguish between files , folders? os windows 8.1, if matters. is_directory() boost::filesystem::is_directory(i->path());

enterprise guide - How can I assign libname to WORK Data Library in SAS? -

we have enterprise guide project, have multiple process flows. output of each process flow saved specific library called "save", defined libname statement. done easier jump , work on process flow without needing run above process flows (except of course process flow initialize save library libname statement). however, when want run code on production server, save library points sas work data library, dont need in-between data. is possible direct library work data library, using libname statement (e.g. "libname save sas.work;") ? the define libref use libname statement. find path used existing libref use pathname() function. libname save %sysfunc(quote(%sysfunc(pathname(work)))) ; be careful using trick because save.memname , work.memname refer same physical file. code worked in development environment might not work because of name conflicts.

Excel Spreadsheet to track and create joins -

i writing lot of sql code @ moment - haven't done in long time , getting frustrated @ time spent working out relationships between tables. i thinking might idea create in excel list of tables , how join other tables. can use drop down select table1 , table2 , use vlookup or similar find how link , generate join. i started occurred me may have done in elegant way. my process far has been create table in excel per table below. can either have dropdown or use filter find appropriate relationship , create code required join: table1 |table2 |table1_field |table_ field |join type cnsmr |cnsmr_accnt |cnsmr_id |cnsmr_id |inner cnsmr_accnt |udefgeneral |cnsmr_accnt_id |cnsmr_accnt_id |inner cnsmr_accnt_tag |cnsmr_accnt |cnsmr_accnt_id |cnsmr_accnt_id |inner wrkgrp |cnsmr |wrkgrp_id |wrkgrp_id |inner i can use formula (looking on list of tables table abbreviation: =" " &

javascript - jQuery Overflow: Hidden on Parent, Detect if Child is Actually On Visible -

i'm having issue jquery blowing mind. i've tried 3 different js , jquery functions people suggested online accomplishing , can't seem work. i'm trying hide class .arrow-up when .first visible on screen , hide class .arrow-down when .last visible on screen. sounds simple enough, right? well parent element has overflow: hidden on (like carousels–they hell). know how this? i'd appreciate help, js isn't strongest means... here's current jquery– jquery(document).ready(function ($) { $(".arrow-down").bind("click", function (event) { event.preventdefault(); $(".vid-list-container").stop().animate({ scrolltop: "+=300" }, 300); }); $(".arrow-up").bind("click", function (event) { event.preventdefault(); $(".vid-list-container").stop().animate({ scrolltop: "-=300&quo

Regex string match -

i attempting create regex satisfies following conditions: object name must: be upper case can contain numbers either side of characters following characters excluded anywhere '"*'&<>/ any tips on how achieve appreciated. valid examples : site 10 a23 - flats 12b range , allowance pitch. 2 - 9 guardspace avenue. invalid examples : site 10 a23 / flats 12b range , allowance pitch 2 & 9 guardspace avenue it can achieved following regex: ^[^a-z'"*&<>\/]+$ see demo it allows letter not '"*'&<>\/ , , requires there no lowercase english letter. ^ - start of string [^a-z'"*&<>\/]+ - 1 or more characters other ' , " , * , & , < , > , / or lowercase english character. $ - end of string restricting length can achieved limiting quantifier: ^[^a-z'"*&<>\/]{3,60}$

java 8 - Maven, Proguard and JDK8 -

i'm trying contribute parceler library i'm having issues maven android plugin, obfuscation , jdk8. it known issue , i've tried fix installing latest tool , specifying specific proguard.jar path. looks still failing . looking if can lead me in right direction. meanwhile i'm digging more. upd here error have: caused by: java.io.ioexception: can't process class [com/oracle/net/sdp$1.class] (unsupported class version number [52.0] (maximum 51.0, java 1.7)) [info] @ proguard.io.classreader.read(classreader.java:112) [info] @ proguard.io.filtereddataentryreader.read(filtereddataentryreader.java:87) [info] @ proguard.io.jarreader.read(jarreader.java:65) [info] @ proguard.io.directorypump.readfiles(directorypump.java:65) [info] @ proguard.io.directorypump.pumpdataentries(directorypump.java:53) [info] @ proguard.inputreader.readinput(inputreader.java:226) [info] ... 6 more [info] caused by: java.lang.unsupportedoperationexception: unsupported class v

java - Waffle authentication not working in Windows -

i'm trying use waffle in java tomcat 7 application, authentication windows isn't working. i have web application works fine, added maven dependency waffle: <dependency> <groupid>com.github.dblock.waffle</groupid> <artifactid>waffle-jna</artifactid> <version>1.7.4</version> </dependency> and added filter in web.xml: <filter> <filter-name>securityfilter</filter-name> <filter-class>waffle.servlet.negotiatesecurityfilter</filter-class> <init-param> <param-name>principalformat</param-name> <param-value>fqn</param-value> </init-param> <init-param> <param-name>roleformat</param-name> <param-value>both</param-value> </init-param> <init-param> <param-name>allowguestlogin</param-name> <param-value>false</param-value> </init-param> <init-param

html - Vertical CSS Timeline layout issue -

i creating vertical css timeline. float elements left , right stack each column. works have noticed after few elements large gap appears look @ following codepen . after 5th element large gap appears on left hand side not consistent previous gaps, , again after few more elements. causing this? note produced html produced angular <ul class="timeline ng-scope"> <li class="year first">july 2015</li> <li class="event highlightedsection ng-scope" ng-repeat="activity in activities"> <span class="itempoint"></span> <span class="time ng-binding">2 minutes</span> <div ng-if="activity.contenttype != 1" class="message ng-binding ng-scope">device connected</div> </li> </ul> the basic cause way float works: won't float item position higher previous element! see example. this good , b

asp.net mvc - Migration Error when I execute migration command -

could not load file or assembly 'microsoft.visualstudio.shell, version=10.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' or 1 of dependencies. system cannot find file specified. this error appear when try write command: enable-migrations -contexttypename musicstorecontext

scala - Bulding Apache Spark 1.4 with maven : stop bulding without error -

i'm trying build apache spark 1.4.0 maven, build never ends; freezes , no error shown. have no idea why freezes on line : [info] --- scala-maven-plugin:3.2.0:compile (scala-compile-first) @ spark-launcher_2.10 --- i try update scala (2.11.4) , maven (3.0.5) , it's same. does have idea why fails ? are building way suggest it? which running included mvn command (see readme ).

c# - How to set text color of aspx tree node in run time -

i want write on c# side: protected void eventhandler(object sender, devexpress.web.somethingtreeviewevent e){ //figure out color mapping, may depend on date , time, whatever. foreach (node in in mytree) node.textcolor = colormapping(mappingfunc(node)); } question is, method setting color? there treeviewnodetextstyle , is read only, , it's constructor takes no arguments.

Spring Security 4 sessionRegistry doesn't populate Principal list -

i trying implement function admin user can terminate user's session. followed official spring security documentation here: http://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#list-authenticated-principals , started getting logged in users through sessionregistry.getallprincipals() , returned empty list. i set breakpoint in sessionregistryimpl.registernewsession() , see did indeed invoked , did add userdetails (my own implementation both equals() , hashcode() implemented) hashmap principals . when access sessionregistry bean spring mvc controller, list empty. my configuration looks pretty same documentation . how fix this? did sessionregistry work spring security 4? remember made work spring security 3 following these intructions( enter link description here ) ok, fixed issue cleaning spring configuration files, suggested comments. messed web.xml - added reference context xml referenced spring's dispatcherservlet , causing loaded t

angularjs - Angular ui router view loaded but not passing parameters -

Image
i'm working on website angular ui-router. there page needs pass parameters view. defined states this: .state('locaties', { url: "/locaties", data: {rule: function($cookiestore) {} }, controller: "franchisesctrl", templateurl: "view/locaties.html" }) .state('locaties.detail', { params: { locatieid: 1, locatiename: "derptown", locatielat: 50, locatielong: 50 }, url: "/:locatiename", controller: "locatiedetailctrl", templateurl: "view/locatie.html", resolve: { locatiedetail: function ($stateparams, $http){ var url ="http://website/api/franchises/" + $stateparams.locatieid +

Create a new SessionID with Chrome Extension -

i have read page chrome.sessions , searched web, cant find how can change sessionid or create new 1 within chrome extension. regards, peter you can't this. session started @ browser launch.

api - Wunderlist Tasks - how do I get the tasks for a list using curl in php -

i have been searching quite bit , can't overview of tasks single list using wunderlist endpoint: https://a.wunderlist.com/api/v1/tasks i can lists, folders , create list, folders, tasks works fine. how tasks list? tried interpret documentation found here: https://developer.wunderlist.com/documentation/endpoints/task when method error message: {"error":{"type":"missing_parameter","translation_key":"api_error_missing_params","message":"missing parameter.","title":["required"]}} however, don't want add title, since don't want create new task, want tasks of list back. what doing wrong here? here code far: function docall($endpoint, $parameters = array(), $method = 'get') { // check if curl available if (!function_exists('curl_init')) { print "this method requires curl (http://php.net/curl), seems extension isn't installed. "._

objective c - iOS bordered button behaviour on tap -

i need pre-ios uibutton border in app. use: btn.layer.bordercolor = [uicolor blackcolor].cgcolor; btn.layer.borderwidth = 1.0; btn.layer.cornerradius = 10; this works ok on tap border not flash(button highlight state). way implement ? implement when creating button: [self.botonconfigurar addtarget:self action:@selector(setbgcolorforbutton:) forcontrolevents:uicontroleventtouchdown]; [self.botonconfigurar addtarget:self action:@selector(clearbgcolorforbutton:) forcontrolevents:uicontroleventtouchdragexit]; [self.botonconfigurar addtarget:self action:@selector(setbgcolorforbutton:) forcontrolevents:uicontroleventtouchdragenter]; and these 2 functions: -(void)setbgcolorforbutton:(uibutton*)sender { [self.botonconfigurar settitlecolor:[uicolor whitecolor] forstate:uicontrolstatenormal]; self.botonconfigurar.layer.backgroundcolor = [uicolor colorwithred:89/255.0 green:194/255.0 blue:237/255.0 alpha:1.0].cgcolor; } -(void)clearbgcolorforbutton:(uibutton*)se

c# - Exception handling in .NET vs Java -

this question has answer here: how use java-style throws keyword in c#? 8 answers i'm porting library wrote java .net c# , i'm dealing differences in exception handling between 2 worlds. in particular have abstract class use base class implement several services. in class have these methods: public void myconcretemethod(){ //... try { initialize(); } catch(initializationexception ex){ // ... } // ... } public abstract void initialize() throws initializationexception; every extending class must implement way initialize , know need handle possible initializationexception . in c# converted code this: public void myconcretemethod(){ //... initialize(); // ... } public abstract void initialize(); but way haven't clear information possible initialization problems: in classes throw exception,

html <base> tag functionality misunderstood? -

i have simple iis structure: defaultwebsite testapp defaultwebsite - landing page reachable going 192.168.1.5 testapp - web application reachable going 192.168.1.5/testapp testapp's index.html <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>test app</title> <base href="/testapp/" > </head> <body> <a href="/">test link</a> </body> </html> i'm using base tag set base of app, when clicking on test link expect reload page pointing documents root. not case. clicking on "test link" takes me index of defaultwebsite. is way how should work or not understanding the base tag correctly ... the base tag applies relative urls. so, base tag <base href="/testapp/"> following apply. <a href="/index.html">link</a> would refer defaultwebsite. but <a href="i

php - WordPress plugin + Composer? -

i'm making wordpress plugin using few third party libraries. common practice use composer wordpress plugin? if it's okay use it, assume should provide composer files along plugin, because don't want make people manually run composer install . another question is, safe use composer's autoloading? configured autoload own classes , libraries of course autoloaded well. that's convenient. is using composer wordpress plugin overhead? or have additional issues?

asp.net mvc - how do i consume model in BL to controller MVC -

i implementing loosely coupled architecture. mvc presentation layer(projectname.web) , business logic handled in seperate c# project projectname.bl. i consuming webservice bl layer(projectname.bl). requestparameter class objects visible bl since making servicereference. 1) issue facing how send request parameter controller bl layer. 2) next issue how map viewmodel objects in bl once response service, viewmodels in web projects. request assistance have no clue achieve one. this other question on layering , separation of concerns. use dto. in business layer, introduce types performing action want perform, , perform mapping between types. your question isn't quite concrete, i'll go foo: service layer: public class servicefoorequest { public int id { get; set; } } public class servicefooresponse { public string bar { get; set; } } public servicefooresponse getfoo(servicefoorequest request) { return new servicefooresponse { bar

mvvm - Binding WPF UserControl to View Model and Code Behind -

i'm attempting understand best way of wiring custom control use dependency properties , view model. dependency properties implemented expose properties can used in xaml initialise properties in view model. example, in code behind of custom control can define following dependency property: public static readonly dependencyproperty mypropertyproperty = dependencyproperty.register( "myproperty", typeof(string), typeof(mycontrol), new propertymetadata(null)); public string myproperty { { return (string)getvalue(mypropertyproperty); } set { setvalue(mypropertyproperty, value); } } where view model defined as public class mycontrolviewmodel : inotifypropertychanged { public mycontrolviewmodel() { _myproperty = "default view model string"; } private string _myproperty; public string myproperty { { return _myproperty; } set { _my

performance - which version of openssl gives better speed? -

i using openssl encryption work in project encrypt files. encrytion/decryption process takes time. version of openssl should use better speed? lighter version available? i have observed openssl-1.0.2a (latest) gives worst performance regarding speed. if build o3 optmization, performance better. lower versions, performance doesn't increase in considerable amount optimization. why so? which version of openssl gives better speed? its dependent upon number of things, including hardware , and algorithms. the encrytion/decryption process takes time. that's kind of relative. i have observed openssl-1.0.2a (latest) gives worst performance regarding speed. but have not told hardware, algorithm selection or showed code... but if build o3 optmization, performance better. i find -os gives best performance because small code keeps caches hotter. depends on hardware, found hold true i386, x86_64, , arm. there's lots of arm processors, ones t

I want to create arrow shape using CSS -- Please see screenshot -

i want create arrow shape css 1 screenshot i want create next , previous post button this... please help use pseudo element , css triangle : .arrow-right, .arrow-left { position: relative; display: inline-block; height: 20px; padding: 0 6px; color: white; background-color: #a5a5a5; } .arrow-right::after, .arrow-left::after { content: ''; position: absolute; top: 0; width: 0; height: 0; border-style: solid; } .arrow-right::after { right: -10px; border-color: transparent transparent transparent #a5a5a5; border-width: 10px 0 10px 10px; } .arrow-left::after { left: -10px; border-color: transparent #a5a5a5 transparent transparent; border-width: 10px 10px 10px 0; } <div class="arrow-right">lorem</div> <br> <div class="arrow-left">lorem</div>

php - SQLi Protection From User Input Text -

this question has answer here: how can prevent sql injection in php? 28 answers i put manual sqli parameter checks in place (i.e check if input valid email). although in case, need put user message db how work? i tried code, whole input gets erased somehow. <?php $text = "hello world"; echo "$text "; $text = stripslashes($text); $text = mysqli_real_escape_string($text); echo $text; ?> thannk you! need linking parameter mysqli like $text = $db->mysqli_real_escape_string($text); example: //escaping characters $db->real_escape_string('this unescaped "string"'); //there alias function can use shorter , less type: $db->escape_string('this unescape "string"');

grid - A Star Pathfinding -

i've implemented standard a* pathfinding algorithm , have working fine on 2d grid. my question is, there way weight lines take "straightest" path instead of potential shortest path takes. instead of lines taking short path , moving in zigzag pattern try find right angle first. any links resources or advice appreciated! do mean they'd move diagonally on grid? you'd have open node expanding code expand (+1, +1), (-1, -1), (+1, -1) , (-1, +1), turning orthogonal instead of cardinal. if a* algorithm correct, favour single diagonal move on east north move. if mean move across larger areas freely, different , harder do.

c++ - Sorting QComboBox delete data in UserRole -

i have problem custom data in qcombo box , here minimal example, empty project qcombobox named combobox in ui. here c'tor code: ui->setupui(this); //add sort proxy qsortfilterproxymodel* proxy = new qsortfilterproxymodel(ui->combobox); proxy->setsourcemodel(ui->combobox->model()); ui->combobox->model()->setparent(proxy); ui->combobox->setmodel(proxy); //first strange thing //here first additem triggers current index changed signal //in second run, every additem trigger signal qdebug() << "initializing"; for( size_t i=1; i<1e10; i*=10 ) ui->combobox->additem( "item", ); qdebug() << "sorting"; proxy->sort(0); proxy->sort(0); qdebug() << "selecting"; ui->combobox->setcurrentindex(0); //here fine for( int i=0; i<ui->combobox->count(); ++i ) qdebug() << ui->combobox->itemdata(i).value<size_t>(); //clear box , same again! ui-

ruby - What does "(...) interpreted as grouped expression" mean? -

i'm using ruby linter in atom , lines gives following warning: (...) interpreted grouped expression an example of line get's warning this: elsif not (params[:vacancy].nil? or params[:vacancy]['company_id'].nil? or params[:vacancy]['company_id'] == "0" ) how should line improved make warning go away? the warning (...) interpreted grouped expression and means says: in ruby, parentheses can used 3 purposes, expression grouping, parameter lists , argument lists. warning emitted when ruby thinks want argument list wrote grouped expression instead. common cause whitespace between name of message , argument list in message send this: foo.bar (1, 2) this interpreted not argument list message send, rather grouped expression, which, in particular case, syntaxerror . in particular case, warning seems false positive.

mysql - PHP form size truncate -

i trying save data via form . when submit form, number of data 45 when try information in post request save it, number becomes 39 , don't know why. has idea? here code use save date in database: $config = new jconfig(); $mysqli = mysqli_connect($config->host, $config->user, $config->password, $config->db); $users = $_post['user']; foreach($users $id => $user){ $query ="update `expo_comprofiler` set `cb_website`='".mysqli_real_escape_string($mysqli, $user[cb_website])."', `cb_rue`='".mysqli_real_escape_string($mysqli, $user[cb_rue])."', `cb_lieu`='".mysqli_real_escape_string($mysqli, $user[cb_lieu])."', `cb_domaine`='".mysqli_real_escape_string($mysqli, $user[cb_domaine])."', `cb_contact`='