Posts

Showing posts from January, 2015

Is there a way of detecting cURL connections? PHP -

basically have php page want display data, want page downloadable , people can display locally. but! want add feature can check internet connection, connecting page's origin see if resources available such external style sheets etc. checking connection this: public function connection(){ const location='http://myresource.co.uk/'; $curl=curl_init(location); $result=curl_execute(); curl_close(); return($result==='i exist')?true:false; } now i'm bit stuck because want resources index display information. want use 'i exist' when checking resource. possible? or should use additional file sane person? xd this isn't going practically work because users typically aren't going have php installed. can allow them download php file.. sure unless have web server running it's not going work. on top of they'll need have curl extension etc.. see here check if extension loaded: http://php.net/manual/en/function.ext

Where is the temporary file generated by chrome extension? -

a chrome extension generated image file, opened in chrome tab, url of tab filesystem:chrome-extension://fdpohaocaechififmbbbbbknoalclacl/temporary/screencapture-www-google-com-webhp-1436884653249.png is possible locate temporary file in os? fyi. here code generate file window.webkitrequestfilesystem(window.temporary, size, function(fs){ fs.root.getfile(name, {create: true}, function(fileentry) { fileentry.createwriter(function(filewriter) { filewriter.onwriteend = onwriteend; filewriter.write(blob); }, errorhandler); }, errorhandler); }, errorhandler); the chrome extension installed on win7 pc at: c:\users\{myname}\appdata\local\google\chrome\user data\profile 1\extensions\fdpohaocaechififmbbbbbknoalclacl\0.0.15_0 but cannot find temporary file/folder. for windows os ,please follow below steps: 1-go c:\users{username}\appdata\local\google\chrome\user data\default\file system 2-sort folders according date mo

eclipse - goClipse: internal error executing preparing launch. reason: java.lang.NullPointerException why? -

i'm trying install goclipse on ubuntu 14.04. i've installed java8 repository , downloaded eclipse mars 4.5. i tried example code,in file called hello.go: package main import "fmt" func main() { fmt.printf("hello, world\n") } but work terminal follow commands: go run hello.go thankyou the "main.go" needs inside sub directory inside src folder of project structure. go files directly under src folder ignored. suggest creating "mainprogram" directory under src , running there.

ruby - How to extract each JSON object in an array and feed into API request body -

i have array of 647 json objects , want extract each object , feed them 1 one request body of api. api accept each json object separately individual http request each object. how do this? this have far using basic each block in ruby httparty gem: require "json" require "httparty" restaurants = json.parse file.read('pretty-regex2.json') new_rest_variable = restaurants.each |restaurant| end response = httparty.post("https://api.example/placeholder", { :body => new_rest_variable.to_json, :headers => { "content-type" => "text", "accept" => "application/x-www-form-urlencoded", "authorization" => "token example-placeholder" } }) puts response.body puts response.code puts response.message example of 4 "restaurant objects" enclosed in array square brackets 647: [ { "id": "223078", "name": "3 south place&quo

php - selecting rows from database between two dates giving wrong results -

selecting rows database between 2 dates giving wrong results, below query not working me. tried answers, 1 not giving correct results.i think, missing somewhere. select * table date between '07/10/2015' , '07/14/2015' changed select * table date between '07-10-2015' , '07-14-2015' still not working! that's right, can not use between statement when data type format not date or datetime , must change data type first. btw realized data type date/datetime format can't use / in sql statement when using mysql, versus sql can use / when column data type date/datetime . correct me if i'm wrong...

How to dynamically deny access using .htaccess -

i familiar denying access based on ip, block of ips, browser, url etc... problem here is, let me state, how deny access if came ip address, @ least 3 times second long period of time. here, don't know ip address unless @ access file. time found out ip address it's drawn of bandwidth. you can't use htaccess doing this. out-of-box apache directives can't handle browsing sessions. you'll need install sort of log parser, maybe fail2ban ? or can cook set of iptables rules blocking lots of connections 1 ip: https://askubuntu.com/questions/437059/linux-command-to-prevent-dos-attack-by-using-netstat-and-iptables

regex - awk: comment a SQL statement -

i have huge file lines like insert mytable (),()... i'd replace lines beginning insert mytable by /* insert mytable (),()... */ i know there tons of possibilities, including vim search replace macro, i'd in command line. here's awk version: awk '{ gsub("^(insert.*)","/* & */"); print $0 }' this assuming insert first character on line. if there can leading spaces, use instead: awk '{ gsub("^([[:space:]]*insert.*)","/* & */"); print $0 }' this should work non-gnu awk's well. tested on linux , aix.

openid connect - Equivalent of SAML's back-channel Single Log-out in OIDC? -

for openid connect, there equivalent of saml's soap-based single log-out protocol enable identity provider ability terminate remote sessions in rp application? necessary component several security requirements in enterprise environments including not limited to: enact limits on number of concurrent sessions terminating previous sessions. ability administrators terminate specific sessions or sessions given user. ability terminate sessions upon other trigger events, such password change. that not part of core openid connect specification ( http://openid.net/specs/openid-connect-core-1_0.html ), nor implementers draft extension session management ( http://openid.net/specs/openid-connect-session-1_0.html ) btw. include "javascript postmessage based" frontchannel logout. there work-in-progress on separate logout extension openid connect may standardize backchannel logout, see: http://openid.net/specs/openid-connect-logout-1_0.html , esp. chapter 2 http://

javascript - the labels flashes instead of being displayed -

as shown above it's register form , every field not filled ... label shown when submitting ... , it's working fine ! added code generator ... when user entered wrong code(mismatch) submit form ... there alert. when call in javascript whole javascript code not working ... label flashing instead of displaying next fields function registerform(){ var allow=true; var tit=document.signup.title.value; if(tit ==""){ document.getelementbyid("title_error").style.display="inline"; allow= false; } else{ document.getelementbyid("fname_error").style.display="none"; } var key=document.comp.gen.value; var key1=document.comp.matched.value; if (key !=key1){ alert(" code didn`t match"); allow=false; } return allow; } <html> <body> <?php function generaterandomstring($length=10) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzabcdef

ios - Core Data filter to many ordered relationship with predicate -

i have core data model task , list, list has to-many ordered relationship task, , task has inverse to-many relationship list. need retrieve tasks given list in correct order, filtered match predicate. example, if priority field on task, nspredicate* predicate = [nspredicate predicatewithstring:@"priority == high"] list* list; // fetched i can accomplish nsarray* alltasks = list.tasks; nsarray* sometasks = [alltasks filteredarrayusingpredicate:predicate]; but requires pulling tasks memory. fetch tasks directly nsfetchrequest* req = [[nsfetchrequest alloc] initwithentityname:@"task"]; [req setpredicate:[nspredicate predicatewithformat:@"list == %@ , priority == high", list]]; nsarray* sometasks = [context executefetchrequest:req error:&error]; but task order not preserved. is there way filter relationship fault predicate? i think following method work, though inefficient: fetch required tasks using desired predicate, ens

javascript - How to decide at runtime for which Meteor collection a client will subscribe -

i writing web application dynamically inspect collections (publications) of ddp server. 1 of issues i'm running once meteor collection created sticks around lifetime of app: foo = new meteor.collection("foo"); however, depending on user application, might no longer interested in foo. wasteful have collection linger around, potentially end entire database being stored on client. the issue made worse fact client doesn't know collections going subscribe for. think causes issues how template helpers setup. examples i've seen far show helpers returning results of particular collection, like: return foo.find(); i still getting head around how reactive model works, i'm guessing if reassign foo: foo = new meteor.collection("bar"); ... above helper code not magically update return contents of 'bar'. update: since suggestions revolve around using combination of subscriptions , single collection i'd thought give context why as

Is Borland delphi 5 compatible with Windows 2012 servers? -

we working on borland delphi 5 on windows 2003 r2x64 bit server os. now going upgrade our windows os 2003 2012. know whether borland delphi 5 version compatible windows 2012 server os. thanks in advance mannual joseph delphi 5 applications 32 bit applications, using win32 api, run on windows server 2012. but in respect application: as compiler, delphi 5 apps run on windows server 2010; you have check third-party components (visual or db); be aware system-level expectations did change since vista , windows server 2008 (e.g. how common folders work ); also note vcl ui won't themed default, , may have refreshing issues . the upcoming nano server edition of windows 2016 provide win64 apis, , won't allow 32 bit code execution more. not able run delphi 5 application in nano server - if windows 2016 (with full apis , gdi) told still win32 compatible - delphi 5 compatible.

javascript - sidebar is not collapsing when removing code -

i have following html i'm customizing sb-admin template - http://startbootstrap.com/template-overviews/sb-admin-2/ index.html <!doctype html> <html lang="en"> {% load static %} {% if user.is_authenticated %} <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>{% block title %}company dashboard{% endblock %}</title> <!-- bootstrap core css --> <link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet"> <!-- metismenu css --> <link href="{% static "css/plugins/metismenu/metismenu.min.css" %}" rel="stylesheet"&

Informatica Data Quality Developer Tool Parameter file -

my project migrated power center idq developer , had move mappings idq developer. able migrate except parameter files. it seems layout , syntax parameter file different power center. there can supply sample of parameter file idq? sample shell script run mapping or application command line.

z80 - What is the behavior of the carry flag for CP on a Game Boy? -

on page 87 of the game boy cpu manual claimed cp n instruction sets carry flag when there no borrow , means a < n . seems conflict itself, because carry flag set when a > n . an example: if a=0 , b=1 , cp b sets flags sub a, b , 0 - 1. becomes 0 + 255 = 255 , carry flag not set, though a < b . i came across same issue in other z80 documents well, don't believe typo. am misunderstanding how borrow , sub work or there else going on? sub not equal add two's complement in terms of flags? the gameboy cpu manual has backwards. sub , sbc , cp set carry flag when there borrow. if sub/sbc/cp a,n executed carry set if n > a otherwise clear. this consistent z-80 (and 8080) operation. mame , mess implement carry the same way .

java - Upload complete event using HttpPost -

my app uploads image server. in order execute uploading, use httppost class. here relevant code fragment: try { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("%path_to_server_page%"); httppost.setentity(new urlencodedformentity(namevaluepairs)); httpclient.execute(httppost); } catch (exception e) { system.out.println("connection error: " + e.tostring()); } my question how can raise event , know if uploading has been finished sure file on server? thanks. probably, implementation of observer design pattern suitable solution. reference: https://stackoverflow.com/a/6270150/462347

Rails 4 w/ Heroku RSolr::Error::Http (RSolr::Error::Http - 404 Not Found -

my setup: rails 4, heroku websolr addon. the solr search been working fine months rails 4 (production) application. 1 day quit , went through following stackoverflow answers , none of them worked. answer 1 , answer 2 , answer 3 since didn't have java installed @ 1 point, pretty tedious go through, need mention before answer went through 3 answers before solved it, did above may have enabled it. took me full day of sifting through answers , gut application , remove solr altogether. i solved going heroku dashboard, clicking websolr addon icon took me websolr page heroku app. deleted index there default , set new 1 new name. once new index has been created, copy , paste text in field labeled configure heroku application lastly, went terminal , entered these commands. $ heroku config:add websolr_url=[url_goes_here] $ heroku restart everything works fine now.

javascript - FuelUX Wizard How to disable specific steps? -

in web form using fuelux wizard (link: http://getfuelux.com/javascript.html#wizard ) , have different roles of people coming page. need able "disable" steps of wizard based on data obtain @ page load. believe have styling of haven't had luck in finding need. for example, i have steps 1-6, , user comes page. identify him data architect, need disable steps 4 , 6. have few specific roles need disable combinations of tabs each individual role. could done calling javascript fuel ux based on role identify user in code behind? , changes need specific step make user not able access it? edit: here steps: <ul class="steps"> <li data-step="1" data-name="documentation" class="active"><span class="badge">1</span>documentation<span class="chevron"></span></li> <li data-step="2" data-name="business"><span class=&

c# - Should I always minimize IO in my App -

i have c# desktop app. it 'reads' 4 digital cameras 1 jpeg frame @ time. each jpeg no more 20k bytes. every motion movement detected save frame hard drive. the other way store footage create avi files in managed code , split after size has built up. the reason save 1 jpeg @ time if burglar steals pc app running or/and pc reboots or/and app stops able save latest frame. if took avi approach lose whatever cut-off had set in code. i know if burglar stole pc have footage circumvent saving external hard drive stored in safe (for example). so, bearing in mind low number of bytes save (but possibly frequent) best can hope achieve in terms of memory efficiency? thanks let's consider different aspects of problem. writing rate your maximum writing rate 800kb/s (10 fps, 4 camera, 20kb each frame) not high on modern hdd (even external hard drive). less of importance if using ssd. how improve writing efficiency traditionally, writing efficiency imp

android - Migrating to GCM breaks the build process -

Image
i'm trying migrate app , adding classpath 'com.google.gms:google-services:1.3.0-beta1' breaks build: this top level gradle.build: // top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { jcenter() } dependencies { // note: not place application dependencies here; belong // in individual module build.gradle files classpath 'com.android.tools.build:gradle:1.1.0' classpath 'com.github.hamsterksu:android-appversion-gradle-plugin:1.2.+' classpath 'com.google.gms:google-services:1.3.0-beta1' } } allprojects { repositories { jcenter() mavenlocal() mavencentral() } } doing fails build following message: what went wrong: problem found configuration of task ':app:zipalignappdebug'. file '/path../outputs/apk/app-app-debug-unaligned.apk' specified property 'inputfi

c# - Difference in CSC and Roslyn compiler's static lambda expression evaluation? -

consider following example code. class program { static void main( string[] args ) { dosomethingwithaction( => { console.writeline( "value: {0}", ); } ); console.readline(); } private static void dosomethingwithaction( action<int> ) { console.writeline( something.target == null ? "method static." : "method not static." ); something( 5 ); } } if compile , run code under debug using visual studio 2010 (under csc compiler) print out following result: method not static. value: 5 if compile same code in visual studio 2010, time using release settings, following output generated: method static. value: 5 now, if execute same code time using visual studio 2015 ctp (under roslyn compiler), following output generated both debug , release settings: method not static. value: 5 first, find curious there difference b

ant script to build ejb project and deploy on Weblogic -

i have ejb(3.1) project want build , deploy on weblogic 12c using ant build file. able create ejb-jar file , getting deployed on weblogic when click on deployed ejb-jar file eclipse console double check deployment, following error message displayed: please help. <error> <console> <wgc1w7jkcr65j> <adminserver> <[active] executethread: '0' queue: 'weblogic.kernel.default (self-tuning)'> <weblogic> <> <6511265e550b6034:-4d6743a3:14e8c70b04f:-8000-000000000000001c> <1436880971372> <bea-240003> <administration console encountered following error: java.io.ioexception: exception in appmerge flows' progression @ weblogic.deploy.api.internal.utils.appmerger.getmergedapp(appmerger.java:63) @ weblogic.deploy.api.model.internal.weblogicdeployableobjectfactoryimpl.createdeployableobject(weblogicdeployableobjectfactoryimpl.java:181) @ weblogic.deploy.api.model.internal.weblogicdeployableobjectfactoryimpl.create

postgresql - Talend tPostgreSQLSCD missing data -

Image
i using talend component tpostgresqlscd in order update or insert on database table. there doesn't seem problem components strange error occurring. basically job gets run through batch file cannot see console output after testing can see rows passed tmap scd component. of rows not inserted actual table. out of on average 8000 rows 500 not inserted each morning. when job run individually in morning problem not occur , rows entered database. has problem occurred else or has insight on possible fix this. any suggestions appreciated. if more information needed please ask. thanks

c++ - Segmentation fault while using vfprintf() -

the following program hitting segmentation fault, , cannot figure out problem is. 1 #include<stdio.h> 2 #include<stdarg.h> 3 void writeformat(file*,char*, ...); 4 int main() 5 { 6 file *fp; 7 fp=fopen("file1.txt","w"); 8 writeformat(fp,"/modules.php?name=top&querylang=%20where%201=2%20all%20select%201,pwd,1,1%20from%20nuke_authors/*"); 9 fclose(fp); 10 return(0); 11 } 12 13 void writeformat(file *stream,char *format, ...) 14 { 15 va_list args; 16 va_start(args,format); 17 vfprintf(stream,format,args); 18 va_end(args); 19 } i tried in gdb, , tells me problem in vfprintf() : (gdb) run starting program: /ws/anaganes-sjc/junk warning: no loadable sections found in added symbol-file system-supplied dso @ 0x2aaaaaaab000 program received signal sigsegv, segmentation fault. 0x0000003c44c7fb30 in wcslen () /lib64/libc.so.6 (gdb) bt #0 0x0000003c44c7fb30 in wcslen () /lib64/libc.so.6 #1 0x0

java - How to allocate different heap sizes to different eclipse instances? -

in eclipse can have multiple eclipse instances, each pointing different workspace. want 1 eclipse instance have lesser heap size other, because number of projects handles less , stuff run in requires less memory (this can reason). can set heap size in eclipse.ini using -xms40m -xmx512m options. but, changes heap size every eclipse instance start. don't want this. i want different heap sizes different eclipse instances. how achieve this? (i reckon in .metadata folder in workspace). you can specify ini file use --launcher.ini command line option when launching eclipse: --launcher.ini <location> (executable) the location of product .ini file use. if not specified executable file beside launcher same name , extension .ini. (ie eclipse.exe looks eclipse.ini, product.exe looks product.ini) you can either create different shortcuts or different .exe files, e.g. windows use path/to/eclipse.exe --launcher.ini eclipse-min.ini (or copy defaul

video - i want to convert images(3~4ea) and mp3 to mp4 file -

i convert images(3~4) , mp3 video ffmpeg i use command ffmpeg -loop 1 -i %05d.jpg -i sample.mp3 -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest out.mp4 converting done. but, images changing short period. i want set images changing period once every 10~15 seconds. how using ffmpeg? well, there no need use loop task. can specify framerate instead control time duration according request. following work 10 sec duration between each image. ffmpeg -framerate 1/10 -i screenshot%06d.jpg -i track2.mp3 -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest out.mp4 read documentation more information.

Wordpress & picturefill implementation -

i'm trying implement responsive image in wordpress theme. there few plug-ins available ones tried messed layout. what replace existing images (not featured images or thumbnails) responsive images, either srcset or my wordpress theme creates following image sizes: add_image_size( "maximal", "1900" ); add_image_size( "desktop", "1405" ); add_image_size( "tablet", "981" ); add_image_size( "smalltablet", "768" ); add_image_size( "mobile", "479" ); i have tried replace img tags preg_replace function have never managed capture images , i'm not sure if it's best way it. of images have classes, don't. in end, replace simple image this: <img src="<destination"> id="<id>" class="<class"> by this: <picture> <source srcset="<img src mobile" media="(max-width: 500px)"> <source

sql server - How to concatenate bits to varbinary with CTE -

i have table ids , bits in following order: id bit 1 0 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 ... ... ... 2 0 2 1 2 0 2 0 2 1 2 0 2 0 2 0 2 1 2 0 2 ... ... ... n ... how group id column , concatenate bit column varbinary column using cte? id bits 1 0x... 2 0x... thanks in advance... declare @bits table ( id int, position int, value int ); insert @bits ( id, position, value ) values ( 1, 0, 1 ), ( 1, 1, 1 ), ( 1, 2, 0 ), ( 1, 3, 1 ), ( 1, 4, 1 ), ( 1, 5, 1 ), ( 1, 6, 1 ), ( 1, 7, 0 ), ( 1, 8, 1 ), ( 1, 9, 0 ), ( 1, 10, 1 ), ( 1, 11, 0 ), ( 1, 12, 1 ), ( 1, 13, 1 ), ( 1, 14, 0 ), ( 1, 15, 1 ), ( 1, 16, 1 ), ( 1, 17, 0 ), ( 1, 18, 1 ), ( 1, 19, 1 ), ( 1, 20, 1 ), ( 1, 21, 1 ), ( 1, 22, 1 ), ( 1, 23, 0 ), ( 1, 24, 1 ), ( 1, 25, 1 ), ( 1, 26, 1 ), ( 1, 27, 0 ), ( 1, 28, 1 ), ( 1, 29, 1 ), ( 1, 30, 1 ), ( 1, 31, 1 ), ( 2, 0, 0 ), ( 2, 1, 1 ), ( 2, 2, 0 ), ( 2, 3, 0 ), ( 2, 4, 0 ), ( 2, 5, 0 ), ( 2, 6,

javascript - How to superimpose 2 img without changing Bootstrap position -

Image
i superimpose 2 img without changing bootstrap position of, in fact here section when superimposing 2 images : when hover, second img revealed jquery : but like position, bootstrap (i'm using .col-md-3) : here html code : <section id="service"> <div class="row"> <div class="wow fadeinleft title" align="center"> provide </div> <div class="col-md-3 wow fadein insurance" align="center"> <img class="bottom" src="img/insurancehovr.png" alt="insurancehovr"> <img class="top" src="img/insurance.png" alt="insurance"> <div class="wow fadeindown insurancetxt" align="center"> <p>insurance</p> </div> </div> <div class="col-md-3 wow fadein quality" align="center"> <img src="img/quality.png" alt="

java - Regex: Want to change case of letter following one of a set, except HTML entity -

examples: rythm&blues -> rythm&blues .. don&apos;t wear white/live -> don&apos;t wear white/live first convert whole string lowercase (because want have uppercase @ start of word). i using split pattern: [&/\\.\\s-] , convert parts' first letter uppercase. it works well, except, converts html entities of course: e.g. don&apos;t converted don&apos;t entity should left alone. while writing discover additional problem... initial conversion lowercase potentially messes html entities well. so, entities should totally left alone. (e.g. &ccedil; not same &ccedil; ) an html entity matched this: &[a-z][a-z][a-z]{1,5}; i thinking of doing groups, unfortunately find hard figure out. this pattern seems handle situation "\\w+|&#?\\w+;\\w*" there may edge cases, can adjust accordingly come up. pattern breakdown: \\w+ - match word &#?\\w+;\\w* - match html entity code

Using a c++ function in an other c++ function (inside a R Package with Rcpp) -

i try create r package (using rcpp). works fine. wrote c++ function, want call in other c++ file. in /src there is: function1 = linearinterpolation.cpp function2 = getslope.cpp let's take function1, linear interpolation between 2 points @ specific position. #include <rcpp.h> using namespace rcpp; //' @name linearinterpolation //' @title linearinterpolation //' @description twodimensional linearinterpolation specific point //' @param xcoordinates 2 x coordinates //' @param ycoordinates coresponding 2 y coordinates //' @param atposition point interpolation shall done //' @return returns linear interpolated y-value specific point //' @examples //' linearinterpolation(c(1,2),c(1,4),3) //' //' @export // [[rcpp::export]] double linearinterpolation(numericvector xcoordinates, numericvector ycoordinates, double atposition) { // start + delta y / delta x_1 * delta x_2 return ycoordinates[1] + getslope(xcoordinates, yco