Posts

Showing posts from May, 2010

ruby on rails - Update value in hash array with json.parse -

i have a = first => <ng::entityconfiguration id: 15881, entity_id: 1, entity_type: "ng::company", key: "wpa2.psk", value: "[{"ssid":"lvl6-staff","password":"987654321", created_at: "2016-11-08 05:13:04", updated_at: "2016-11-08 05:13:04", name: "wifi/level 6"> so when call a.value , return => "[{"ssid":"lvl6-staff","password":"987654321","dhcp":"enabled"}]" then, wanted value password: x = json.parse(a.value) x.last['password'] => "987654321" my question is, after password value, want update password value '123456789' , save it. how achieve this? this should simple. string = '[{"ssid":"lvl6-staff","password":"987654321","dhcp":"enabled"}]' # `a.value` json = json.parse(string) new_password

pandas - How to Transpose table in redshift? -

is there better way, transpose table in redshift, other taking out in pandas , getting things done. you can try using below query. below query helpful, if number of rows per group constant value select col1, split_part(col_values, ',', 1) col_value1, split_part(col_values, ',', 2) col_value2, split_part(col_values, ',', 3) col_value3 (select col1, listagg(col2, ',') within group (order col2) col_values (select col1, col2 table1) derived_table1 group col1) derived_table2 note: above query used if have same number of rows per group or if know maximum number of rows per group.

angular - Angular2 CLI: Module not found: Error: Can't resolve -

i learning angular2. folder structure is src app assets - images -- img1.png -- img2.png - scss - main.scss styles.scss angular-cli.json package.json here importing main.scss in styles.scss this @import '../node_modules/font-awesome/css/font-awesome.css'; @import 'assets/scss/main.scss'; where main.scss contains css property background: url(../images/img1.png) center center no-repeat; here getting error ./~/css-loader!./~/postcss-loader!./~/angular-cli/~/sass-loader!./src/styles.scss module not found: error: can't resolve '../image2/cal2.png' in 'd:\***\**\ui\src' resolve '../images/img1.png' in 'd:\***\**\ui\src' using description file: d:\**\**\**\package.json (relative path: ./src) field 'browser' doesn't contain valid alias configuration but, when comment line working fine. me causing issue. while importing main.scss whole code in s

excel - R - SQLDF issue with special characters -

i'm having issue running sqldf in r , special characters. here small detail of code i'm running give idea of what's going on: first read data excel sheet (using r's xlsx package), method xlsx2 seems data correctly , characters seem showing special characters such 'Ñ' verif_oblig <- try(read.xlsx2("my computer/filename.xlsx", sheetname = 'verif_oblig')) if("try-error" %in% class(verif_oblig)) verif_oblig <- empty() then start running sql query using sqldf , resulting table seems replace Ñ characters Ñ. here's query: verif_oblig_v2 <- sqldf(" select a.*, case when b.estado null 'no generado' else b.estado end estado, case when resultado_operacion in ('exito','correcto') 'exito' else 'sin exito' end resultado_actual verif_oblig left join fin2016 b on a.cups = b.cups_largo , a.division = b.division") can me find solution this?

angularjs - req.body empty Node.js -

this angular controller code im passing certificationid , userid delete certification details of user. $scope.deletecertification = function(certificationid){ var username = $scope.userid; var certificationid = certificationid; var deletecertificationinfo = {'username': username, 'certificationid':certificationid}; console.log('deletecertificationinfo*******'); console.log(deletecertificationinfo); userprofileservice.deleteusercertificationinfo(deletecertificationinfo).then (function(data){ console.log($scope.certification); console.log('certification deleted'); }) } userprofiledata.deleteusercertificationinfo = function (deletecertificationinfo) { var deferred = $q.defer(); $http.delete('/api/profileupdate/deleteusercertification', deletecertificationinfo, { }).success(function(res){ var deletedusercertificationresult = res; deferred.resolve(deletedusercertificationresult); $log.debug('response c

javascript - How to use eventlisteners and functions from outside react components? -

i have loaded library (cordova) in main index.html file. added eventlistener 'deviceready' on document. how can call function , related library inside react component? html file: <!doctype html> <html> <head> <title>title</title> </head> <body> <div id="app"></div> </body> <script type="text/javascript" src="cordova.js"></script> <script> document.addeventlistener('deviceready', ondeviceready); // function want call inside component. // function ondeviceready() { // var rect = { x: 0, y: 0, width: window.innerwidth, height: window.innerheight }; // cordova.plugins.camerapreview.startcamera(rect, 'back', true, true, true) // cordova.plugins.camerapreview.show(); // } </script> </html> my react component: import react, { component } 'react'; class example extends component { // he

leaflet - Cluster markers from different overlays with each other -

i use angular-leaflet leaflet markercluster plugin (see http://tombatossals.github.io/angular-leaflet-directive/examples/0000-viewer.html#/layers/overlays-markercluster-example example). now have 3 different overlays 'clustermarker' type. @ moment markers of each overlay cluster markers same overlay. of them cluster each other. how can accomplish this? you might interested in leaflet plugins: leaflet.featuregroup.subgroup leaflet.markercluster.layersupport but unsure how use them angular leaflet directive. disclaimer: author of plugins.

google oauth2 - Should I send the Secret with the Refresh Token in OAuth 2.0 -

i'm working implement oauth 2.0 server, , while reading rfc6749 specification realized section 6 on page 47 regarding "refreshing access token". explains need use refresh token have new token. but example, in addition refresh token, google require user id , secret so. this confuses me, because on 1 hand have google processing high volume of requests every day, , have specification written smaller scope in mind. is send secret every hour refresh token? personally believe no: because user id , secret should used go on whole oauth 2.0 process. basically you use token on each request prove are. refresh token used once hour (and potentially changed @ each refresh) secret , user id go internet possible. when option 1 , 2 compromised. i believe sending secret refresh token less secure. maybe i'm missing something. if have point of view, please share :) i might missing something, what google requires , what's specified oauth2 when refresh

ios - XCTAssertEqual on string allways fails -

Image
i trying parse dictionary newsitem object. xtassert("teststring" == "teststring") or xctassertequal("teststring", "teststring") not fail. use swift 3 , xcode 8.0. xctassert(s == t) //also fails i parse newsitem.newspreamble so let newspreamble: string ... self.newspreamble = dictionary["newspreamble"] as? string ?? "" from debugger output (lldb) po (s.data(using: .utf8)! nsdata) <e2808be2 808b7465 73745374 72696e67> one can see string has 2 "invisible" characters, e2 80 8b utf-8 sequence u+200b "zero width space". removing white space @ start (and end) 1 possible solution: var s = "\u{200b}\u{200b}teststring" print(s) // teststring print(s.data(using: .utf8)! nsdata) // <e2808be2 808b7465 73745374 72696e67> print(s == "teststring") // false s = s.trimmingcharacters(in: .whitespaces) print(s == "teststring") // true

python - Access data from bokeh widgets in a jupyter notebook -

Image
i want use text input widget in jupyter notebook autocompletion. therefore used autocompleteinput() bokeh.models.widgets.inputs . from bokeh.models.widgets.inputs import autocompleteinput bokeh.io import output_notebook bokeh.plotting import show output_notebook() txt_input = autocompleteinput(completions=['val1', 'val2']) show(txt_input) displaying widget , autocompletion works fine , how can access value of input widget upon change? txt_input.value returns default value (an empty string). as of bokeh 0.12.3 , fuller integration of bokeh widgets in jupyter notebook still open issue . however, there workarounds, though may considered clunky. here customjs callback can pass widget set value of python value: from bokeh.models import customjs callback = customjs(code=""" if (ipython.notebook.kernel !== undefined) { var kernel = ipython.notebook.kernel; cmd = "widget_value = '" + cb_obj.value + "'"

python 3.x - Create and access sqlite3 database using python3 -

Image
i trying create (and later, access) database using python3. millions of example in , internet( eg. this ), doing: #!/usr/bin/env python3 string import ascii_uppercase import sqlite3 sqlfile = "jour.db" tabname = "abbre" id_col = "full_name" col_name = "abbre_name" conn = sqlite3.connect(sqlfile) c = conn.cursor() c.execute('''create table journals (jid int, full text , abbr text)''') c.execute("""insert journals values (1, 'physical review b', 'phys. rev. b')""") conn.commit() c.close() but, creating table, no data inserted. what going wrong here? you looking @ wrong database file. (the schema different.) connecting file name jour.db use current directory, whatever happens be. correct jour.db database file somewhere on computer. it might idea specify full path of database file.

reactjs - this.props.relay.setVariables() doesnt fetch new results (but change variable as well) -

i can't figure out i'm doing wrong, can't make work refetching new range via change variable. here part of relay container code (on initial works , fetch first 5 results): export const account = relay.createcontainer(_account, { initialvariables: { activities: 5 }, fragments: { account: () => relay.ql` fragment on nodeinterface { id ... on member { activities(first: $activities) { totalcount edges { node { id } } } } } ` }, }); here part of react component changes relay variable: export class _account extends react.component { constructor(props) { super(props); this.state = { activities: 5 }; } loadmoreactivities(e) { e.preventdefault(); this.setstate((state,props) => { const next = state.activities + 5; this.props.relay.setvariables({ activities: n

android - Can I connect bluetooth device automatically with the device which already paired without showing choose dialog -

i developing solution connection between obd2(vehicle ecu scanner) mobile app. want when ever obd device found , paired application automatically connect device , create socket transmission of data . without showing dialog box choose paired device. you can connect paired bluetooth device, so, have know device's address , uuid. embedded devices may have defined uuid (for example, hc05 adapter), can uuid documentation. tricky part here have monitor failure , loss of connection can retry again. i'm implementing feature in home project, fell free see code: https://github.com/alexshutov/ledlights

php data from text file to multidimensional array doesnt work but no console errors -

i've written code read in data text file. data looks this: 11:12:12:test titel 1 12:13:13:test titel 2 13:14:14:test titel 3 the following code reads date, splits 1 string each line, go in 1 array. works perfectly. after this, should devide each line again in string go in array, , these arrays go 1 multidimensional array. last part doesnt work... think it's strange instead of errors, of half page, shows empty page... also, i've tried putting of code in comment, , i've narrowed down bit. give guys commented code, comments should go away, , should work that! thanks! <?php $filename = "data.txt"; $fp = fopen($filename, "r"); $content = fread($fp, filesize($filename)); $lines = explode("\n", $content); $parts = null; fclose($fp); print_r($lines); echo sizeof($lines); ($i=0; $i < sizeof($lines)-1 ; $i++) { //the minus 1 corrects empty line automatically added when saving data.txt file //$tempparts[] = ex

Best way for implementing JavaScript lib in Java WebApplication -

i android developer , new java web development, please apologize if thought wrong. in our web app project have compare images ( gif/png/jpeg ) , have show result. we got javascript lib ( resemble.js ) compare images , give result. please on implementing lib web app project. js lib can implement in front end right? if correct way? because have other process in backend. or else how use js lib in backend or let me know best way in implementing same. using react.js front-end. to execute javascript need javascript engine. java virtual machine not designed run javascript short answer is: should use resemble.js front-end browser's engine (or back-end server process javascript node.js). long answer: there implementation of javascript written in java use (i don't konw if supports html). take at: how can run javascript code @ server side java code?

oracle - Output parameter value is shown as 'invalid identifier' -

i trying retrieve values temporarily created tables. return value throws error 'invalid identifier' create or replace procedure edu_stream (input in varchar2,vals out varchar2) inp varchar2(30); valu varchar2(30); begin inp:=input; if inp='secondary education' execute immediate'with secedu ( (select "icse" name dual ) union (select "cbse" name dual ) union (select "state board" name dual) ) select name valu from(select name secedu order dbms_random.random)where rownum<2'; vals:=valu; else if inp='intermediate education' execute immediate'with intedu ( (select "mpc" name dual ) union (select "bipc" name dual ) union (select "mbipc" name dual) union (select "cec" name dual) ) select name valu from(select name intedu order dbms_random.random

c# - Emgu 3.1 exit application after CVInvoke.FindContours -

i trying work emug 3.1 in visualstudio 2015 using c#. so tried find contours find ellipses, not far : mat sobel_out = new mat(); umat thres_out = new umat(); mat hierachy = new mat(); vectorofvectorofpointf contours = new vectorofvectorofpointf(); // detect edges using sobel cvinvoke.sobel(ocvimage, sobel_out, emgu.cv.cvenum.depthtype.cv32f,1,0,3); // make binary out of sobel cvinvoke.threshold(sobel_out, thres_out, krset.kr_lowerthreshold, krset.kr_upperthreshold, emgu.cv.cvenum.thresholdtype.binary); image<gray, byte> img = thres_out.toimage<gray, byte>(); // find contours cvinvoke.findcontours(thres_out, contours, hierachy, emgu.cv.cvenum.retrtype.list, emgu.cv.cvenum.chainapproxmethod.chainapproxsimple); after findcontours method, application exit following message in output window: exception t

java - How to disable auto complete on a Samsung smartphone (Android) in a Cordova Project? -

i can't figure out how disable auto complete on android samsung device in cordova project. when user tries type in email address, changes user typed in. dot replaced 2 dots, not acceptable user. i tried add attributes html form, didn't work. <input type="email" name="email" autocomplete="off"> i tried override webview in android project (java code), didn't work either. webview.getsettings().setsaveformdata(false); webview.getsettings().setsavepassword(false); webview.clearformdata(); try this: <input autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" /> (credits : https://davidwalsh.name/disable-autocorrect )

javascript - How can I check a column for NULL values in node-orm -

i'm using orm package in node.js , i'm trying query database using find() on 1 of models. however, can't figure out how check column null values using find() . there way this? if sent_at field not there when not set then: db.emails.find({sent_at: {$exists: false}}) if there , null, or not there @ all: db.emails.find({sent_at: null}) reference: query nul fields note: since didn't mention database name nor orm used assuming database mongodb. hope helps.

c - how to export all the files path from the debug symbols -

i'm using gcc -g compile. in gdb, use "info sources" list files path (c, cpp, h, etc..) now want export result file. one solution turn on gdb logging "set logging on" it's not want: i need type "enter" export results, there "," @ end of lines i want automatically after compilation edit one solution be: #!/bin/sh gdb -batch -ex "info sources" the_executable > /tmp/list_sources.txt sed -i -e 's/, /\r\n/g' /tmp/list_sources.txt grep -e '^\/' /tmp/list_sources.txt > list_sources.txt you can run gdb in batch mode: gdb -batch -ex "info sources" your_program > info_sources.txt

c# - Exposing DataTransferObjects not Entities in WCF DataService -

i trying create wcf dataservice expose large set of data. data displayed in devexpress grid has built in support paging, sorting , querying on serverside. works absolutely fine if expose generated entities entity framework. however expose datatransfer objects act sort of abstraction. can't find source of information on web ... maybe of guys can me going right direction. create dto class has property named id has [key] attribute. create class inheriting odatacontroller , controller. put method named get() on it: [enablequery] public virtual iqueryable<mydto> get() { } in method return data iqueryable . after call entityset on dto in odata configuration.

c# - Unable to pull username and password in SSRS connection properties -

Image
i migrating crystal reports ssrs reports using windows app, build based on .net code. need migrate connection string username , password. when open rdl post migration, can see connection string shown in below image. when click on edit button, username/password not populated automatically , i'm seeing fields blank shown below. can notice server name getting populated , not user name , password. is there property i'm missing connection string or how can auto populate user name , password without manual workarounds? really appreciate suggestions. you may use shared data source instead of embedding connection info in rdl file. if have quite few reports convert, may try crystal migration services convert reports automatically.

angularjs - how to merge JSON object together -

i want make bar-chart , have 2 functions each of them return data exemple : first function 1,: $scope.data = { labels: ['jan', 'feb', 'mar'], datasets: [ { label: 'my first dataset', fillcolor: 'rgba(220,220,220,0.2)', strokecolor: 'rgba(220,220,220,1)', pointcolor: 'rgba(220,220,220,1)', pointstrokecolor: '#fff', pointhighlightfill: '#fff', pointhighlightstroke: 'rgba(220,220,220,1)', data: [55, 40, 84] } ] }; the second function returned : $scope.data = { labels: ['apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'], datasets: [ { label: 'my second dataset', fillcolor: 'rgba(151,187,205,0.2)', strokecolor: 'rgba(151,187,2

android - React-natives AsyncStorage does not work -

i trying call function includes asyncstorage-calls (receives , stores data 'tutorialnotover'). program worked while ago somehow got broken. react-native not give me warnings or errors, don't work right. looks program skips call of getfirsttime()-function. <view> ... {this.props.firsttime = this.getfirsttime} ... </view> ... async getfirsttime(){ let firsttime = "null"; try{ firsttime = await asyncstorage.getitem('tutorialnotover', (err, result) => { console.log("getfirsttimefirsttime: " + result); }); } catch (error){ console.log(error); } if (firsttime === 'null') { firsttime = 'true'; } if (firsttime === "true") { try{ asyncstorage.setitem('tutorialnotover', "true"); return true; } catch (error){ console.log(error); } } return false; }

android - Resizing rotated child view in custom ViewGroup subclass -

Image
background i have custom viewgroup subclass rotates , mirrors child view. purpose correctly display traditional mongolian text . i put viewgroup , current project putting edittext in it. ( i never successful in rotating , mirroring edittext directly. however, wrapping in custom view group work.) problem my problem when try resize viewgroup programmatically, child view not getting resized along it. edittext match size of parent viewgroup appears single view. mcve i made new project show problem. button increases width of viewgroup (shown in red). images show project start (with working fine) , 2 width increments. edittext white , not getting resized though width , height set match_parent the full project code below. mongolviewgroup.java (custom viewgroup rotates , mirrors content) public class mongolviewgroup extends viewgroup { private int angle = 90; private final matrix rotatematrix = new matrix(); private final rect viewrectrotated = new

java - Decryption of a String in VB.NET which was encrypted in Android Studio -

i'm trying find solution decrypting string in vb.net encrypted in android studio. encoded string base64. want paste encrypted string in vb.net program decrypt it says length of string short. i started vb.net because boss told me so! any more appreciated! :) here's code of android studio , vb.net. android studio encrypt: public static string encryptit(string value) { try { deskeyspec keyspec = new deskeyspec(cryptopass.getbytes("utf8")); secretkeyfactory keyfactory = secretkeyfactory.getinstance("des"); secretkey key = keyfactory.generatesecret(keyspec); byte[] cleartext = value.getbytes("utf8"); // cipher not thread safe cipher cipher = cipher.getinstance("des"); cipher.init(cipher.encrypt_mode, key); string encrypedvalue = base64.encodetostring(cipher.dofinal(cleartext), base64.default); return encrypedvalue; } catch (invalidkeyexception e)

mysql - load data infile -

Image
i don't know how fix warrning. i try ignore, in vain. create table medici ( id_m int auto_increment primary key, nume varchar(100) unique, prenume varchar(100) unique, statut enum('primar','specialist'), specialitate varchar(50) ); while loading data table, there 2 same values nutu exist column prenume . column prenume defined unique . correct data , try loading data table.

How can I obtain mutants files (.class or .java) on disks? Is there a suitable mutation testing tools to recommend? -

i conducting mutation testing on java programs , need conduct research on mutants files. how can obtain mutants files on disk? i have tried mujava , pit. however, mujava may report exceptions when comes complex annotations , structures, , pit seems report final mutation kill/fail report , don't enable users find specific internal mutants generated. is there tool can more useful , enable me mutants generated .class or .java files? if can code there raw way in can mutated / changed files list using watch service feature of java 7. watchservice watcher = filesystems.getdefault().newwatchservice(); then register watchservice given directory following: path dir = paths.get("path/to/watched/directory"); dir.register(watcher, entry_create, entry_delete, entry_modify); example - how use. while (true) { watchkey key; try { // wait key available key = watcher.take(); } catch (interruptedexception ex) { return; }

python - Tkinter - Code is executed without tkinter reacting -

this question has answer here: button command being called automatically 2 answers while trying create countdown timer, have ran problem. have based myself on bryan oakleys code ( making countdown timer python , tkinter? ) did not post whole code because quite long. what want code do: wait x amount of seconds, stored in wait , collected entry waite. next, want wait_button call countdown call. class create label in own tkinter window. after countdown (= x seconds delay) main function recalled , change flow. what does: the code executed without errors. countdown takes place, , flows changed, without second delay , without opening tkinter window. any appreciated, looked on site did not find helped resolve problem. stijn def wait_button(self): """this part of larger tkinter grid , called after pushing button""" "

ios - There are one or more errors on the page error show -

i have uploaded app itunes using xcode. have changed version. when click on 'submit review' shown "there 1 or more errors on page" error, , shown red error in build show 'submit builds using xcode 6 or later, or application loader 3.0 or later.' i have upload app xcode 7. can me? you need select build want reviewed list of build there. more details check submit build

html - How to Show Javascript Modal Boxes Without Button? -

i have script open modal boxes javascript when user click button, want modify script, show modal boxes when page loaded specific parameter. example : http://domain.com/login?msg=incorrect password any solution ? <html> <head> <style> /* modal (background) */ .modal { display: none; /* hidden default */ position: fixed; /* stay in place */ z-index: 1; /* sit on top */ padding-top: 100px; /* location of box */ left: 0; top: 0; width: 100%; /* full width */ height: 100%; /* full height */ overflow: auto; /* enable scroll if needed */ background-color: rgb(0,0,0); /* fallback color */ background-color: rgba(0,0,0,0.4); /* black w/ opacity */ } /* modal content */ .modal-content { position: relative; background-color: #fefefe; margin: auto; padding: 0; border: 1px solid #888; width: 80%; box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19); -webkit-animation-name: animat

npm install gulp-dnx suddely requires github authentication -

Image
npm install gulp-dnx generates pop-up asking github credentials if press cancel (or if our build server) following error: ps c:\src\tmp> npm install gulp-dnx npm err! git clone --template=c:\users\user\appdata\roaming\npm-cache\_git-remotes\_templates --mirror git@gith ub.com:luisrudge/gulp-shell.git c:\users\user\appdata\roaming\npm-cache\_git-remotes\git-github-com-luisrudge-g ulp-shell-git-fdebe4af: cloning bare repository 'c:\users\user\appdata\roaming\npm-cache\_git-remotes\git- github-com-luisrudge-gulp-shell-git-fdebe4af'... npm err! git clone --template=c:\users\user\appdata\roaming\npm-cache\_git-remotes\_templates --mirror git@gith ub.com:luisrudge/gulp-shell.git c:\users\user\appdata\roaming\npm-cache\_git-remotes\git-github-com-luisrudge-g ulp-shell-git-fdebe4af: error: repository not found. npm err! git clone --template=c:\users\user\appdata\roaming\npm-cache\_git-remotes\_templates --mirror git@gith ub.com:luisrudge/gulp-shell.git c:\users\user\appda

Error while Using docker behind proxy- TLS failed to parse certificate -

i trying run zeppelin using docker. found 1 github project same. machine behind proxy , have added http_proxy , https_proxy information in /etc/defaults/docker file also. bala@axis-v4:~/projects/docker-zeppelin$ sudo docker pull dylanmei/zeppelin using default tag: latest pulling repository docker.io/dylanmei/zeppelin error while pulling image: https://index.docker.io/v1/repositories/dylanmei/zeppelin/images: tls: failed parse certificate server: x509: unhandled critical extension bala@axis-v4:~/projects/docker-zeppelin$ can find out whats going wrong here? here more information /etc/default/docker export http_proxy=http://<username>:<password>@<proxy host ip>:3128 export https_proxy=https://<username>:<password>@<proxy host ip>:3128 https_proxy=https://<username>:<password>@<proxy host ip>:3128 http_proxy=http://<username>:<password>@<proxy host ip>:3128 /etc/systemd/system/docker.service.d/

ios - Xcode8 Controllers are Grey which are designed in Xcode 7 with size classes -

Image
i making ios application compatible ipad.i have designed ui of application xcode 7 size classes more designed iphone, have upgrade support ipad also. now xcode 8 when select ipad storyboard device pan of controller greyed i.e. controllers not showing on ipad on device , on storyboard also. please check screenshot that i know reason why greyed out, because designed size classes different size. now question is , possible somehow use controller ipad without redesigning ui , updating auto layouts, of not seeing way make controllers available ipad. also have tried way think long, have delete controllers , add , set layouts again. also way design separate storyboard. so please suggest me better solution overcome this. thanks even after compatibility conversion xcode 8, if still doesn't seem work, need check if there leftovers below: if want make sure works width , height, find constraint: and remove clicking on x , leaving installed checked: that s

html5 - Lost responsive while switching server -

i'm facing weird issue, had 2 sites on web hosting provider (ovh), both sides running smoothly , correctly. i decided dedicated server (for many purposes, amongst them wanted independant concerning configuration). i'm using ubuntu based server caddy, sites made out of jquery, html5/css3. since i've put them on dedicated server, responsive isn't working anymore while exact same website still responsive on web hosting server... what should after? don't have idea begin @ :s thanks help! solution : check script calling, sources external files have same website url (if website https, file sources should https too).

wordpress - How to custom a home shop page with all products? -

i'm trying set-up home shop page specific content on it. my menu contains categories , want switch of category when click on each item. problem : - want set-up homepage banner content above products category (link "tous) - don't want banner content appears on others categories. i'm using woocommerce on wordpress. many thib in wordpress theme, create file called woocommerce.php gives idea of how: https://docs.woocommerce.com/document/template-structure/ once add/create woocommerce.php file theme can add image banner above woocommerce_content() if want target main shop page, can use is_shop() add function in functions.php want wrap with: if function_exists(is_shop()) { //add code here }

java - Maven JAXB 2 Plugin - how to setup to use cross scheme dependencies -

using maven-jaxb2-plugin generate jaxb classes 2 wsdl schemas related each other. the classes generated this: com - accounts |- payments |- other maven-jaxb2-plugin set this: <plugin> <groupid>org.jvnet.jaxb2.maven2</groupid> <artifactid>maven-jaxb2-plugin</artifactid> <version>0.13.1</version> <executions> <execution> <id>unipayments</id> <goals> <goal>generate</goal> </goals> <configuration> <schemalanguage>wsdl</schemalanguage> <args> <arg>-npa</arg> </args> <schemas> <schema> <url>http://...accounts?wsdl</url> </schema

PHP preg_match: How is this variable(67278) to preg_match working? -

ex: 67278 how can using preg_match??? how can information preg_match? $data = '<script>fcgetplayerinsights("67278")</script>)'; preg_match("/tr\('(.*?)'/",$data,$match); print_r($match); i not recommend regex on html unless it's way... but: if(preg_match("/(\d{5})/", $data)){ echo "a 5 digit number there"; }else{ echo "there no 5 digit number"; } may work.. recommend @ least use strip_tags on $data. if(preg_match("/(\d{5})/", strip_tags($data))){ echo "a 5 digit number there"; }else{ echo "there no 5 digit number"; } that removes html string , leaves fcgetplayerinsights("67278")) to regex on, bit safer. http://www.phpliveregex.com/p/hno

single sign on - Is it possible to modify exisiting shibboleth cookie? -

i have deployed 1 rest based application protected shibboleth sp , idp. of now, after authentication, pass uid via shibboleth cookie application , based on application take decision based on permission assigned uid. recently, asked me if forge shibboleth cookie , change uid. not sure if possible @ , guess, if can able again shibboleth cookie change , discarded shibboleth. so, possible somehow i.e. change uid in shibboleth cookie ? if yes have add 1 more layer of api security oauth,

php - Laravel 4 - mirror database? -

we have created mirror database replica of main database of our application. goal jump between 2 databases in case of unavailability. i wondering how can implement such thing in laravel 4 ? lets have 'mysql' => array( 'driver' => 'mysql', 'host' => '172.22.22.22', 'port' => '3306', 'database' => 'db', 'username' => 'username', 'password' => 'password', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ), and 'mysql' => array( 'driver' => 'mysql', 'host' => '172.22.22.23', 'port' => '3306', 'database' => 'db', 'username' => '

javascript - How to prevent a click from passing through a fixed positioned element to the element behind it? -

i have fixed positioned header has searchbox in , there content behind (the header has higher z-index). have event handler handles 'focus' event on searchbox. problem when click in searchbox, event handler triggers, click passes through header elements behind it. don't want click pass through. tried event.preventdefault() , event.stoppropagating() , event.cancelbubble = true none of them seems work. it looks you're trying stop propagation of focus event. try binding click event of searchbox , use event.stoppropagation() on it.

c++ - Building WMF (Windows Media Foundation) mediadriver plugin for Qt on Windows 10 -

i've downloaded , installed msvc compiled qt 5.7 qt official download page via online installer windows 10. i try create media player application uses qvideoprobe . apparently there are 2 mediadriver plugins (or multimedia backends) windows. directstreamer , media foundation (mf or wmf). both has limitations. can capture video directstreamer qvideoprobe not supported. on wmf side it's on contrary. can't use camera capture wmf qvideoprobe supported. my problem qt comes directstreamer default. can found @ <qt-install-path>\5.7\msvc2015_64\plugins\mediaservice\dsengine.dll understand have build , deploy wmf plugin myself didn't find documentations or tutorials. if 1 downloads qt source (also available in download page) source code of plugin can found in <qt-src-path>\qt-everywhere-opensource-src-5.7.0\qtmultimedia\src\plugins\wmf directory. my questions: how create plugin sorce existing qt install? need additional libraries or other stuff win

xml - The content of element type "interceptor" must match "(param)*" -

i working struts2.5.5 using maven. i got error in interceptor tag: the content of element type "interceptor" must match "(param)*" in struts.xml file: <?xml version="1.0" encoding="utf-8"?> <!doctype struts public "-//apache software foundation//dtd struts configuration 2.5//en" "http://struts.apache.org/dtds/struts-2.5.dtd"> <struts> <package name="default" namespace="/action" extends="struts-default"> <interceptors> <interceptor name="authenticationinterceptor" class="authenticationinterceptor"> <interceptor-stack name="securestack"> <interceptor-ref name="authenticationinterceptor"></interceptor-ref> <interceptor-ref name="defaultstack"></interceptor-ref> </interceptor-stack> </int

python - Dynamically creating models in Django -

i want create many models based on abstract one, different default values fields. def get_model(name): class abstractmodel(models.model): field1 = models.charfield(max_length=100, default=name) class meta: abstract = true return abstractmodel class mymodel(get_model('mymodel')): pass what disadvantages of approach presented above? there better way? it looks need single model instead of set of models. might have single model additional field having kind of model type - same model name. there lots of disadvantages of idea. confusing others , influence negatively performance due constant using code reflections. update default value name dependent on class can make overwriting in constructor: from django.db import models class a(models.model): def __init__(self): self.f = 'model name' f = models.charfield(max_length=100) class b(a): def __init__(self): self.f = 'model b n

asp.net mvc - Dropdownlistfor returns null value -

i have customer class property gender. created list of gender type contains , id number , gender type. when form submitted, getting null value. view @model movierentals.viewmodel.customerview <div class="form-group"> <h4>@html.labelfor(l => l.customer.birthdate)</h4> @html.dropdownlistfor(l => l.customergender, new selectlist(model.customergender, "genderid", "gendertype"), "select gender", new { @class = "form-control" }) </div> model public class customerview { public ienumerable<membershiptype> membershiptypes{ get; set; } public customer customer { get; set; } public list<genderclass> customergender{ get; set; } } public class genderclass { public int genderid { get; set; } public string gendertype { get; set; } } controller public actionresult new() { var membershipty = _context.memebershiptype.tolist(); var viewmodel = new cu

Android soap(ksoap2) service invalid int -

Image
i using soap services in application getting data api https://www.interserver.net/ and response api includes interger value , in form "ito-207-18564", , during getting response app crashes exception java.lang.numberformatexception: invalid int: "ito-207-18564" i know problem response coming interserver api , before can it, app crashes, how can handle crash on side? time , help. here code. soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.setoutputsoapobject(request); httptransportse androidhttptransport = new httptransportse(url); try { // invoke web service androidhttptransport.call(soap_action + "api_openticket", envelope); // response soapobject response = (soapobject) envelope.bodyin; string status_return = response.getproperty(0).tostring(); string status_text = response.getproperty(1).tostring(); string ti

concurrency - Java data channel implementation not correct using counting semaphore -

i try implement circle data channel communication between producer , consumer using counting semaphore, meet problems. consumed , produced data not equal. data channel: public class datachannel { int[] array; int p; int c; semaphore semaphore; public datachannel(int[] array) { this.semaphore = new semaphore(array.length); this.array = array; this.p = 0; this.c = 0; } public void writedata (int data) { try { system.out.println("--- try write array["+p+"]="+data); this.semaphore.acquire(); this.array[p] = data; this.p = (p + 1) % array.length; } catch (interruptedexception e) { e.printstacktrace(); } } public int readdata() { this.semaphore.release(); int data = array[c]; system.out.println("!!! try read data array["+c+"]="+data); this.c = (c + 1) % array.length; return data; }} start point: public class app { public static void main(string[] args

javascript - Promise not being resolved when run inside Jasmine unit tests -

facing strange issue when testing method returns promise in jasmine unit tests. have following class: import http = require('http'); import https = require('https'); import fs = require('fs'); export default class imagedownloader { constructor(protected downloadpath:string) {} async download(url: string): promise<string> { return new promise<string>((resolve, reject) => { let file = fs.createwritestream(this.downloadpath, { autoclose: true }); let schema:any = url.startswith('https') ? https : http; schema.get(url, (response:fs.readstream) => { response.pipe(file).on('finish', () => resolve(this.downloadpath)); }).on('error', (error) => reject(error)); }); } } it downloads image download path given in constructor, , resolves promise download path once file has been written disk. i've written jasmine unit tes

android - How to read files located on values folder -

this question has answer here: how string different locales in android? 3 answers i read string.xml file, in full, located under : src -> main -> res -> values. for sake of argument, need specific file in order handle localization issues might occur in application : selected device language french, still, want values main english string.xml file only specific scenarios . so, resources in values/strings.xml should exists on values-fr/strings.xml, , removing them values-fr is not option . obviously, solution of sort of getstring(r.string.text_name) not acceptable since we'll receive value of text_name values-fr/strings.xml file, , not values/strings.xml . this won't : getresources().getidentifier("text_name", "string", getpackagename()); this won't well, since string.xml not raw asset. context.getresources().openra

r - How to select a subset of least resembling combinations of a common vector? -

i need select 10 times different combinations of 15 items common set of 30 items, several constraints. first constraint: each of 10 combinations, need remove 3 items should not present in specific combination. let's wf01, wf02 , wf03 first combination; wf04, wf05 , wf06 second combination , on. second constraint: on ten combinations, each item should present same number of times (5). third constraint: ten combinations should different possible 1 (i.e. should avoid sharing common items as possible). i doing in excel, guess there should more efficient way in r! here coding far: # data: 30 items (pictures choose from) picturenames <- c("wf01", "wf02", "wf03", "wf04", "wf05", "wf06", "wf07", "wf08", "wf09", "wf10", "wf11", "wf12", "wf13", "wf14", "wf15", "wf16", "wf17", "wf18", "wf19&