Posts

Showing posts from 2013

Can not connect to websocket using django-channels , nginx on docker as services -

i'm using docker compose build project django, nginx services. when launch daphne server, , client tries connect websocket server, error: *1 recv() failed (104: connection reset peer) while reading response header upstream client-side shows this failed: error during websocket handshake: unexpected response code: 502 here docker-compose.yml version: '3' services: nginx: image: nginx command: nginx -g 'daemon off;' ports: - "1010:80" volumes: - ./config/nginx/nginx.conf:/etc/nginx/nginx.conf - .:/makeup links: - web web: build: . command: /usr/local/bin/circusd /makeup/config/circus/web.ini environment: django_settings_module: makeup.settings debug_mode: 1 volumes: - .:/makeup expose: - '8000' - '8001' links: - cache extra_hosts: "postgre": 100.73.138.65 nginx: server { listen 80; se

ios - NSBatchUpdateRequest throwing NSInternalInconsistencyException -

i keep getting following error when trying perform nsbatchupdaterequest. *** terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'unknown command type <nsbatchupdaterequest : entity = person, properties = { "(<nsattributedescription: 0x6000000ff980>), name title, isoptional 1, istransient 0, entity (null), renamingidentifier title, validation predicates (\n), warnings (\n), versionhashmodifier (null)\n userinfo {\n}, attributetype 700 , attributevalueclassname nsstring, defaultvalue (null)" = "\"sometitle\""; }, subentities = 1' the error log shows "entity (null)", when correctly specified in constructor. i running test environment , wonder if nsbatchupdaterequest supports nspersistentstorecoordinator nsinmemorystoretype. cant find in docs not supported. below code using. entity , property parameters correct , shouldn't causing issue. -(bool) updatepersonnamesfrom:(

javascript - (Web application) How to restrict user from accessing certain folder through typing in the web address -

currently building web page allows user upload pictures server. user can upload pictures if login. the pictures uploaded stored in server example: pictures/"userid"/some_pictures.jpg my question how restrict other users accessing some_pictures.jpg or "userid" folder by typing url address. user login userid can access it's own folder or pictures. for example: user has login $_session['userid'] = 1234. user can access directory > pictures/1234/some_pictures.jpg if user login 1235 userid, won't able access 1234/ directory you create function checks if user logged in or not.if not logged in, redirect him login page.now if user logged in, check if user id equal user id in pictures/"userid"/some_pictures.jpg . if turns false, redirect him page such homepage.

azure webjobs - How to start jobhost with TopShelf -

i'm using topshelf create windows service , i'm thinking of integrate webjobs sdk. can point me in right direction on how setup? thanks! as mentioned need use topshelf create windows service. webjos attached webapp , webapp sandbox .it not allowed install windows service on it. if want use topshelf, please have try use azure cloudservice or virtual machine workaround.

android - Listview with EditText in each row , Scrollview inside FooterView of listview , adjustResize and adjustPan all working toghter -

Image
i have 1 fragment in have listview has edittext in each row , inside footerview controls inside scrollview when set android:windowsoftinputmode="adjustpan" not scroll footerview form when softkeyboard open , push header of activity , when trying use android:windowsoftinputmode="adjustresize" scroll footer view form auto scrolling listview when item open , lost edittext focus header not move up. sorry not in explaining hope 1 undersatand want explain. want scroll scrollview specific layout in footerview face these problems 1 can me ? thank here fragment xml file <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@col

SQL Error: 1054, SQLState: 42S22 Unknown column in 'field list' error Java Spring Boot Mysql error -

basically trying make simple promotion page, error getting sql error: 1054, sqlstate: 42s22 error unknown column 'promotion0_.promo_type_id' in 'field list' here model classes package promotions.model; import java.io.serializable; import javax.persistence.cascadetype; import javax.persistence.column; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; import javax.persistence.joincolumn; import javax.persistence.manytoone; import javax.persistence.onetomany; import javax.persistence.onetoone; import javax.persistence.table; @entity @table(name="promotion") public class promotion implements serializable{ @id @generatedvalue(strategy=generationtype.auto) @column(name="id") private int id; private string name; private boolean active; private boolean status; @manytoone @joincolumn(name="promotype_id") private promo_type promo_type; @manyto

php - images joined together, align properly -

Image
i tried adjust images of category modifying vqmod in 100x100 200x200 , happen, use display: block, float: left; im not lucky fix it. i tried adjust col-sm-2 , added d-inline , not working. instead of using css code or stylesheet, added code here. can show me code fix it? thank , regards all <modification> <id>subcategory images oc 2.0</id> <version>1.0</version> <vqmver>1.2.3</vqmver> <author>vger.co.uk</author> <file name="catalog/controller/product/category.php"> <operation> <search position="replace" index="1" offset="3"><![cdata[ $data['categories'][] = array( ]]></search> <add><![cdata[ if ($result['image']) { $image = $this->model_tool_image->resize($result['image'], 200, 200); } else { $image = $this->model_tool_image-&

node.js - Webpack bundling doesn't include specific module such as 'sequelize' -

i'm developing nodejs webpack, seqelize , other modules below webpack configuration. const path = require('path'); const webpack = require('webpack'); const fs = require('fs'); const glob = require('glob'); const cleanwebpackplugin = require('clean-webpack-plugin'); var nodemodules = {}; fs.readdirsync('node_modules') .filter(function(x) { return ['.bin'].indexof(x) === -1; }) .foreach(function(mod) { nodemodules[mod] = 'commonjs ' + mod; }); module.exports = { // entry: [ path.resolve(__dirname, 'server.js'), models ], entry: glob.sync(path.resolve(__dirname, 'src/**/*.js')), resolve: { // add `.ts` , `.tsx` resolvable extension. root : [path.resolve(__dirname, '')], extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js'], modulesdirectories: ['node_modules'] }, module: {

sql server - Combining several query results into one result -

i using sql server. have 5 tables (mtable, c1table, c2table, c3table, c4table). in mtable have 4 queries , each 1 of them gives correct result: query 1: select mtable.cid, mtable.col1, mtable.col2, mtable.col4, mtable.col5, mtable.col6, mtable.col7, mtable.col8, mtable.col9, mtable.col10, mtable.col11, c1table.col12, c1table.col13, c1table.col14, c1table.col15 mtable left outer join c1table on mtable.col2 = c1table.col2 (mtable.col6 = 0) , (mtable.col5 = 0) , (mtable.col4 = 0) , (mtable.col2 > 0) query 2: select mtable.cid, mtable.col1, mtable.col2, mtable.col4, mtable.col5, mtable.col6, mtable.col7, mtable.col8, mtable.col9, mtable.col10, mtable.col11, c2table.col12, c2table.col13, c2table.col14, c2table.col15 mtable left outer join c2table on mtable.col4 = c2table.col4 (mtable.col6 = 0) , (mtable.col5 = 0) , (mtable.col4 > 0) query 3: select mtable.cid, m

javascript - How to use gulp-defer in gulp task? -

i having issue javascript loaded before page contents loaded decided use gulp-defer package in gulptask. here code // including plugins var gulp = require('gulp') defer = require("gulp-defer"); // task gulp.task('concat', function () { gulp.src('./javascript/*.js') // path files .pipe(concat('concat.js')) // concat , name "concat.js" .pipe(gulp.dest('./dest')); }); gulp.task('html:release', function() { return gulp.src('./index.html') .pipe(defer()) //defer method called .pipe(gulp.dest('./dest')); }); i referred gulp-defer package.actually cant able understand how processed. please 1 explain how defer works in gulp task . in advance!! not sure asking documentation self-explained: moves render blocking javascript , css deferred loading section. it helpful if "eliminate render-blocking javascript , css in above-the-fold co

exception - Java Security Manager grand permissions not working -

java code: public class test { public static void main(string[] agrs) { system.out.print("123"); } } policy: grant codebase "file:/users/workspace/test/src/*" { permission java.security.allpermission; }; jvm arg: -djava.security.manager -djava.security.policy=my.policy when running java code, still got access denied exception: exception in thread "main" java.security.accesscontrolexception: access denied ("java.lang.reflect.reflectpermission" "suppressaccesschecks") @ java.security.accesscontrolcontext.checkpermission(accesscontrolcontext.java:472) @ java.security.accesscontroller.checkpermission(accesscontroller.java:884) @ java.lang.securitymanager.checkpermission(securitymanager.java:549) @ java.lang.reflect.accessibleobject.setaccessible(accessibleobject.java:128) @ com.intellij.rt.execution.application.appmain.main(appmain.java:146) break in console not supported due secu

python - How to restart a failed task on Airflow -

i using localexecutor , dag has 3 tasks task(c) dependant on task(a). task(b) , task(a) can run in parallel below a-->c b so task(a) has failed , task(b) ran fine . task(c) yet run task(a) has failed. my question how re run task(a) alone task(c) runs once task(a) completes , airflow ui marks them success. in ui: go dag, , dag run of run want change click on graphview click on task a click "clear" this let task run again, , if succeeds, task c should run. works because when clear task's status, scheduler treat if hadn't run before dag run.

gcc - How do I link to external THUMB code? -

i'm writing thumb code embedded core (arm7tdmi) needs linked existing thumb code. i'm using gnu arm embedded toolchain ( link ). cannot linker treat existing external code thumb; seems think it's arm. existing code i'm linking absolutely static , cannot changed/recompiled (it's plain binary sitting on rom chip, basically). here example program, multiply.c , demonstrates issue: extern int externalfunction(int x); int multiply(int x, int y) { return externalfunction(x * y); } compiled using: arm-none-eabi-gcc -o multiply.o -c -o3 multiply.c -march=armv4t -mtune=arm7tdmi -mthumb arm-none-eabi-ld -o linked.o multiply.o -t symbols.txt where symbols.txt simple linker script: sections { .text 0x8000000 : { *(.text) } } externalfunction = 0x8002000; when objdump -d linked.o , get: 08000000 <multiply>: 8000000: b510 push {r4, lr} 8000002: 4348 muls r0, r1 8000004: f000 f804 bl 8000

powershell - Getting error after using ErrorAction Silentlcontinue in my command -

i still getting error in out after using -erroraction silentcontinue . here command using: get-childitem c:\ -include *.bak -recurse | foreach ($_) {remove-item $_.fullname } -erroraction silentlycontinue -errorvariable you retrieve error within get-childitem cmdlet. should add parameter there ( -ea 0 alias -erroraction silentlycontinue ). also usage of foreach-object cmdlet within code obsolete since remove-item cmdlet takes pipeline object: get-childitem c:\ -include *.bak -recurse -ea 0 | remove-item -ea 0

git - Can I create new repository on github.com by shell command? -

now if want create new repository on github.com, have create on website github.com. can create new 1 on local machine shell command? there several cli tools github. 1 of more famous hub , written in go. how remotely create new github repo shell it: $ git init $ git add . && git commit -m "it begins." $ git create -d "description goes here" # (creates new project on github name of current directory) $ git push origin master

Could I change redis data structure list to set -

i used redis list structure store data, want change list type set. command this? no built-in way that. need manually items list , insert set. if list small, can use following lua script: repeat local item = redis.call('lpop', keys[1]) if (item) redis.call('sadd', keys[2], item) end until not item however, if list large, script block redis long time. have incrementally move items list set: call lrange items (small batch) list call sadd insert these items set call ltrim remove these items list go step 1 until items have been moved.

android - How to disable increasing volume ring in Marshmallow programmatically? -

i want disable escalating/rising/increasing volume of ringtone on incoming call. know there's application disable increasing ring i'm android developer, cant see mobile ads stop phone's increasing volume ;) i've tried way... public class callreceiver extends broadcastreceiver { context context; public void onreceive(context context, intent intent) { try { this.context = context; telephonymanager manager = (telephonymanager) context.getsystemservice(context.telephony_service); manager.listen(new myphonestatelistener(), phonestatelistener.listen_call_state); } catch (exception e) { e.printstacktrace(); } } private class myphonestatelistener extends phonestatelistener { public void oncallstatechanged(int state, string incomingnumber) { audiomanager manager = (audiomanager) context.getsystemservice(context.audio_service);

c# - How to Deploy Owin Self Hosted Application In Production? -

i have asp.net owin self hosted webapi application. application can installed windows service in production environment. currently i'm running , accessing service via url http://localhost:8000 successfully. now want map service domain access public network. have registered domain , have control on it. ex: www.myservice.com how can point domain webapi service self hosted application? in order allow public access self-hosted owin web api app. follow following steps: allow inbound connections firewall run wf.msc command open windows firewall advanced security , add new inbound rule tcp port 8000 or port want use. you can make sure service getting request opening <machine public ip>:8000 other machines. get static ip isp request isp static ip. of times isp charges that. if have static ip, skip step , move next step. point domain static ip lastly, go domain dns manager , add a record host name = www , ip adress = <your machine static ip>

javascript - Toggle/document/click and close other? -

Image
here scenario. step 1- click action opens drop down can closed on click of anywhere except dropdown area , action text. problem 1- want close on click of action text only. solution close on click of area anywhere except dropdown area , on click of action text. step 2 - on click of multiple action text opens multiple dropdowns . problem 2- want way if 1 gets open other gets close. code: $('.toggleclass a').click(function(ev) { $(this).next('.actiondropdown').fadein(500); }); $(document).click(function(e) { e.stoppropagation(); var container = $(".toggleclass"); //check if clicked area dropdown or not if (container.has(e.target).length === 0) { $('.actiondropdown').fadeout(500); } }); * { margin: 0px; padding: 0px; float: left; box-sizing: border-box; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; font-family: arial; } { text-decoration: none; } body

c# - An static Controller Handler to manage the methods that are used in controllers...¿good? -

i have created static class methods used in controller actions, idea not put logic inside controller actions example of class is: namespace mytestproject.infrastructure.handler { public static class controllerhandler { public static string getusername(getloggeduserresponse user) { string username = string.empty; if (user != null) { username = user.nombre; } return username; } private static list<menu> getvisiblechildmenus(getloggeduserresponse user, int idmenu, bool tab) { return user.menusperfiles.where(mp => mp.menu.idpadre == idmenu && mp.menu.visible.value && mp.menu.tab.value == tab) .select(mp => mp.menu) .orderby(m => m.orden)

javascript - Form is not getting validate -

i have created 1 form add record in database, insertion of record , working well. i wanted put validation form, happening though have set fields required after clicking on submit button form getting submit , blank values getting insert n database. i have referred link validation : a simple jquery form validation script but somehow not working me. <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>post</title> </head> <body> <form class="postform" id="postform" method="post" action="addpost.php"> <fieldset> <legend>please add details below </legend> <p> <label for="title">title (required, @ least 2 characters)</label> <input id="title" name="title" minlength="2" type="text" required> &l

Cancel Oracle procedure from SQL Server procedure when cancelled -

i'm executing stored procedure on sql server side. in part of procedure, remote oracle procedure called using execute (' begin oraprocname(procparams); end;') @ remotedb. today, needed stop executing procedure have used cancel query on sql server side. the problem sql server not able stop procedure until remote procedure stopped (i needed kill remotedb side). is there way somehow "inform" oracle side procedure needs cancelled stored procedure on sql server side? your problem once you've sent command oracle, not return until end of command. so unless execute () @ remotedb has specific parameters wrap call in sub-process can stopped caller (unlikely, why not?), must create own oracle function kill long-running session. so solution create oracle function or procedure kill long-running session, , call separate process. get running sessions: select sid , serial# v$session username='<your user>' , statu

How to implement behaviour branches depending on GUI details in Android Espresso? -

in questions 21031556 (finding string espresso) , 23381459 (how text textview using espresso) recommended not read out value gui variable. in situation don´t find convincing solution: in testcase, kernel testcase action has start in situation user not logged in. stable behavior want implement preparation, checking whether user logged in, , if so, perform logout; if not continue. i can implement if-block, depending on variable: if (userisloggedin) { // required actions perform logout } i have text field shows “login” or username, , can perform assertion: textview.check(matches(withtext("login"))); to set variable, tried nest assertion within exception handler, variable set within handle method: userisloggedin = false; // member variable viewinteraction logoutview = onview( allof(childatposition( allof(withid(r.id.left_drawer), withparent(withid(r.id.navigation_drawer))), 0),

MyEclipse's accelerate keyszoom in(ctrl+-) and zoom out(ctrl+=) are invalid -

i use myeclipse (version :myeclipse-2015-stable-3.0 or myeclipse-2016-ci-7) in windows 7, , want zoom in/out fonts while editing accelerate keys ctrl+ =/-,but don't work. i don't want use way windows--preference--color , fonts--...to change fonts size because isn't convenient,there no accelerate keys confilcts also,and after changing accelerate keys,they still don't work. any ways solve problem? those commands don't seem defined in general->keys preferences page, text editing, though defined in eclipse mars (on myeclipse 2016 based), don't work there either. can't find eclipse bug that, though there should one. however, did find solution, if you're willing update myeclipse 2017 (the ci stream or stable stream), since zoom function works fine there.