Posts

Showing posts from April, 2011

PHP shell exec command -

i using windows application tesseract, long story short ocr application runs through command. after installing application used command test , works fine using line: tesseract text.png out it practically gets image , outputs text file out.txt i changed directory , accessible everywhere. now problem comes when using php using code follows: echo exec("tesseract text.png out 2>&1", $output); var_dump($output); and time instead of getting file saying tesseract not recognized! this output: operable program or batch file. c:\wamp64\www\prestashop\ocr\ocr.php:12: array (size=4) 0 => string '' (length=0) 1 => string 'c:\wamp64\www\prestashop\ocr>tesseract text.png out' (length=51) 2 => string ''tesseract' not recognized internal or external command,' (length=65) 3 => string 'operable program or batch file.' (length=31) can me please!? thanks i have answer. don't know why ha

powershell - Check if a number belongs to a list -

i want ot verify if user entered number belongs predefined list, -contains operator behaves different expected: 0 -contains 0. true the list generated command (get-disk).number . have false input 0. ? first, should wrap output of (get-disk).number @() force list array. then, ensure array of strings using cast. finally, pass number want check using string: [string[]]$list = @((get-disk).number) # list contains 0 $list -contains "0." # false the double 0. eqal int 0 equal string "0" have pass string.

c# - Web Service error : HTTP 413: Request Entity Too Large -

my system: iis 7.5 visual studio 2010 framework 4 i have make web service receive file(byte array). have make console app consume it(add service reference-->advance-->add web reference). http working perfectly. need consume https. so, when try consume https, giving me http 413: request entity large. have been reading lot, impossible. have tried put in webconfig of web service: <system.servicemodel> <bindings> <basichttpbinding> <binding name="basichttpbinding_inopservice" maxreceivedmessagesize="22147483647" maxbufferpoolsize="252428800" maxbuffersize="22147483647"> <readerquotas maxdepth="256" maxstringcontentlength="22147483647" maxarraylength="2222216384" maxbytesperread="2222220000" maxnametablecharcount="2222216384" ></readerquotas> </binding> </basichttpbinding> <

.net - How to use freemarker in C# -

i have scenario have use existing freemarker templates used in java application new .net application. searched on web , got freemarker.net equivalent uses ikvm wrapper , formatting of templates here . problem here there around 5 million templates need pull database , contain placeholders have different syntax in .net. example in .net have <#list sequence item> part repeated each item in existing java template have <list sequence item> part repeated each item </list> the problem need change existing 5 million templates based on freemarker .net version using, not seems feasible solution. need find solution can use same templates without of change. sample template have convert is dear ${name}, <if account_type_id=="some id">some content. <else>some content. </if> i have change dear ${name}, <#if account_type_id=="some id">some content. <#else>some content. <#/if> in same way th

javascript - Add new column to HTML table which has not table id -

how can add new column in below code, need happen if there no table id or tr id or td id. please check , tell me <p>click button insert new cell(s) @ beginning of table row.</p> <table> <tr> <td>first cell</td> <td>second cell</td> <td>third cell</td> </tr> </table><br> <button onclick="myfunction()">try it</button> <script> function myfunction() { var row = ?????????????? var x = row.insertcell(0); x.innerhtml = "new cell"; } </script> you can use getelementsbytagname access tables. var row = document.getelementsbytagname("table")[0].rows[0]; https://jsfiddle.net/4rmt4xmj/1/

c# - CheckForIllegalCrossThreadCalls in WPF -

i writing bot twitch , using library called twichlib ( https://github.com/swiftyspiffy/twitchlib ) in example made winforms there method called globalchatmessagereceived , there checkforillegalcrossthreadcalls = false; . whole method looks like private void globalchatmessagereceived(object sender, twitchchatclient.onmessagereceivedargs e) { //don't in production checkforillegalcrossthreadcalls = false; richtextbox1.text = string.format("#{0} {1}[issub: {2}]: {3}", e.chatmessage.channel, e.chatmessage.displayname, e.chatmessage.subscriber, e.chatmessage.message) + "\n" + richtextbox1.text; } now in wpf unable checkforillegalcrossthreadcalls can point me on how should method solve crossthreadcalls? the correct way use wpf dispatcher perform action on ui thread: private void globalchatmessagereceived(object sender, twitchchatclient.onmessagereceivedargs e) { var di

orientdb docker can't connect or remove database of type 'memory' -

i attempted remove orientdb database of type ' memory ' named 'unit_tests', following error: {"errors":[{"code":505,"reason":505,"content":"java.lang.stackoverflowerror"}]} i run docker container created following command: docker run -d --name minion --net=host -p 2424:2424 -p 2480:2480 -p 2434:2434 -p 5701:5701 -e orientdb_node_name=minion -v /home/user/orient-config:/orientdb/config -v /home/user/databases:/orientdb/databases -e orientdb_root_password=password orientdb:latest /orientdb/bin/server.sh -ddistributed=true -xmx8g i error if try remove database via browser interface, console.sh or pyorient. the error happens when connect database. is possible use databases of type ' memory ' in orientdb's docker unit testing purposes? i must missing something. this problem happens if running docker -ddistributed=true . hoping run unitests on same setup server. i'm sure it's

jdbc - How do I keep Logstash running so it syncs data from my RDBMS to ES? -

i'm complete newbie elk stack, please excuse ignorance. i've been able logstash send data database elasticsearch, exits once it's done transfer. how keep running keeps them in sync? thanks you need specify schedule in jdbc input: the schedule below ( * * * * * ) run every minute , select records database , select records have been updated after last time query ran. updated timestamp field might named differently, feel free adjust fit case. input { jdbc { jdbc_driver_library => "mysql-connector-java-5.1.36-bin.jar" jdbc_driver_class => "com.mysql.jdbc.driver" jdbc_connection_string => "jdbc:mysql://localhost:3306/mydb" jdbc_user => "mysql" parameters => { "some_field" => "value" } schedule => "* * * * *" statement => "select * songs some_field = :some_field , updated > :sql_last_value" } }

SELECT With MySQL Stored Function in VB.Net -

i got stored function named getitemqty() in database. when run code localhost loading data's. select itemid, catalognumber, cost, getitemqty(itemid), minimum, maximum, typeid, supplierid items; showing rows 0 - 24 (4387 total, query took 2.4682 seconds.) its working fine in localhost when apply datagridview. loading takes forever , timeout expired. timeout period elapsed show. heres code populate datagridview . dim command new mysqlcommand() dim cmdstring string dim adapter new mysqldataadapter dim dt new datatable cmdstring = "select itemid, catalognumber, cost, getitemqty(itemid), minimum, maximum, typeid, supplierid items;" command .connection = conn .commandtext = cmdstring .commandtimeout = 60 end conn.open() adapter.selectcommand = command adapter.fill(dt) dg

android - How to achieve Circular progress bar? -

Image
i working in android project in need progress bar shown . try add layout xml file: <progressbar android:id="@+id/progressbar" android:layout_width="wrap_content" android:layout_height="wrap_content" /> is meant?

go - Looking for list of binary file extensions -

i need quick estimate if file binary/text looking @ extension, errors acceptable. example: images, audio, video considered binary (i.e. .jpg , .gif , .mp4 , etc.). are there more or less complete lists use purpose? checked https://golang.org/pkg/mime/#typebyextension not seem fit. thanks! from understand looking mime type list. there great resource here gives large list of each type , content. it looks mime package perfect fit use case.

Pimcore Workflow Management -

i'm tring set example workflow management in default pimcore instalation , don't know should start. understand states, configs etc. in pimcore panel placee when object or asset? now have default config workflow example config, , in documents information state (to do). how somothing? do know tutorials of this? good see you're experimenting workflow management. i've written introductions feature, they're available here: part 1 - basic introduction https://www.gatherdigital.co.uk/community/post/pimcore-workflow-management-pt1/66 part 2 - how configure actions https://www.gatherdigital.co.uk/community/post/pimcore-workflow-management-pt2/67 part 3 - how extend actions using events https://www.gatherdigital.co.uk/community/post/pimcore-workflow-management-pt3/70 to going, there example in configuration directory in pimcore all actions can carried out in elements themselves, in case of documents, if workflow configured correctly see button calle

javascript - Node js, Call WebSocket server from oracle apex -

i trying create web-sockets in apex automatic refresh node but getting error not valid json: java script code $(function(){ window.websocket = window.websocket || window.mozwebsocket; if (!window.websocket) { console.log('sorry websockets'); } else { var connection = new websocket('ws://127.0.0.1:1337'); connection.onerror = function (error) { console.log( 'sorry, there problem connection or server down.'); }; connection.onmessage = function (message) { console.log(message.data); try { var json = json.parse(message.data); if (json.message=='refresh') { greport.pull(); } else { console.log(json.message); } } catch (e) { console.log('thisnot valid json: ' + message.data); } }; } });

angularjs - Init function only runs every second time -

for strange reason ini() function runs every second time. have issue in app well... i have no idea why. my code: <ion-view ng-init="ini()"> <ion-header-bar class="banner-top ext-box" align-title="left"> <div class="int-box2"><h2 id="s_back1">map stories</h2></div> </ion-header-bar> <ion-content overflow-scroll="true" class="has-header has-footer no-bgcolor" scroll="false" > js .controller('mapctrl', function($scope, $state, $http) { $scope.ini = function() { $http({ method : "get", url : "https://domain.ch/pois.php" }).then(function mysucces(response) { console.log("success"); }, function myerror(response) { $state.go("error"); }); } }) route .state('map', { url: '/map', templateur

inheritance - C++ error C2248: cannot access private member declared in SUPER class -

i have looked through similar questions stackoverflow haven't found answer yet. here's subclass declaration: class enemy : public entity { public: enemy(); ~enemy(); }; // line shows error... here's superclass declaration: class entity { //member methods: public: entity(); ~entity(); bool initialise(sprite* sprite); void process(float deltatime); void draw(backbuffer& backbuffer); void setdead(bool dead); bool isdead() const; bool iscollidingwith(entity& e); float getpositionx(); float getpositiony(); float gethorizontalvelocity(); void sethorizontalvelocity(float x); float getverticalvelocity(); void setverticalvelocity(float y); protected: private: entity(const entity& entity); entity& operator=(const entity& entity); //member data: public: protected: sprite* m_psprite; float m_x; float m_y; float m_velocityx; float m_velocityy; bool m_dead; private: }; i have subclass called playership using same structure, 1

php - Advanced Custom Fields is slow on admin screens -

i'm using acf set series of slots in page. admin screen contains series of flexible fields, each of can 1 of following: post category tag works great on front end. can drag-and-drop, choose posts/categories/tags etc. database , have time. unfortunately when trying add new slot page on end, or load it, time taken add new row killing it. i've got few rows there, it's taking unacceptably long; i'm sure when add few more we'll start getting timeouts. the information can find problem support thread on acf forums ( https://support.advancedcustomfields.com/forums/topic/slow-backend-v-2-5-7/ ), says: yeah, if you've got big database , try , use flexible fields it's gonna that. i'm using acf-json no noticeable effect. has else experienced problem? did work around it? or did have abandon? (ideally solution keep flexible fields, they're client wants in situation - if there's solution enables them edit end in linear time, i'm int

arrays - What is wrong with the PHP function in_array(...)? -

this question has answer here: php in_array() / array_search() odd behaviour 2 answers the php function in_array(...) "checks if value exists in array". but i'm observing strange behavior on handling strings (php v7.0.3 ). code $needle = 'a'; $haystacks = [['a'], ['b'], [123], [0]]; foreach ($haystacks $haystack) { $needleisinhaystack = in_array($needle, $haystack); var_dump($needleisinhaystack); } generates following output: bool(true) bool(false) bool(false) bool(true) <- what? the function returns true every string $needle , if $haystack contains element value 0 ! is design? or bug , should reported? if not set third parameter of in_array true, comparison done using type coercion. if third parameter strict set true in_array() function check types of needle in haystack. under loose c

xcode - is there any way to get all application installed in user's iphone? -

this question has answer here: listing installed apps on iphone programmatically? 4 answers i know little bit sandbox. however, can list of total applications installed in user's iphone.i want done iphone device whether jailbroken or not. i got list of installed application in iphone. uses private framework it's not jail broken device. #include <objc/runtime.h> class lsapplicationworkspace_class = objc_getclass("lsapplicationworkspace"); sel selector=nsselectorfromstring(@"defaultworkspace"); nsobject* workspace = [lsapplicationworkspace_class performselector:selector]; sel selectorall = nsselectorfromstring(@"allapplications"); nslog(@"apps: %@", [workspace performselector:selectorall]); i have tried code , it's workings on ios9.

apache spark - How do I raise failure with Scala Try -

in spark, can handle exceptions way: val myrdd = sc.textfile(path) .map(line => try { // dangerous // if(condition) // raise isfailure; }).filter(_.issuccess).map(_.get) i'd element read first map function raise failure well, under conditions. how do it? if you're ignoring actual errors, can filter condition (given condition depends entirely on line): def condition(line: string): boolean = ??? val myrdd = sc.textfile(path) .map(line => try { // dangerous }) .filter(_.issuccess) .filter(condition) .map(_.get)

android - Drawing one group over the other in libgdx (same stage) -

i have menu screen on game 2 groups using same stage: maingroup , popupgroup(hidden -> isvisible(false)). when button on maingroup clicked, popupgroup(isvisible(true)) added stage , comes imagebutton. i darken entire screen extent except imagebutton on display. how can have such click anywhere else on screen except imagebutton remove() popupgroup , bring maingroup forefront? code.. ...addlistener(new inputlistener() { public boolean touchdown(inputevent event, float x, float y, int pointer, int button) { maingroup.settouchable(touchable.disabled); popupgroup.setvisible(true); popupgroup.setcolor(1f, 1f, 1f, 0f); popupgroup.addaction(actions.fadein(1f)); return true; } is there clicklistener detect when you've pressed out of bounds of group or item? thanks first of - why not create 1 more stage? easier have 2 stages - 1 common sprites , second pop-ups.

How can I strip the data:image part from a base64 string of any image type in Javascript -

i doing following decode base64 images in javascript: var strimage = ""; strimage = strtoreplace.replace("data:image/jpeg;base64,", ""); strimage = strtoreplace.replace("data:image/png;base64,", ""); strimage = strtoreplace.replace("data:image/gif;base64,", ""); strimage = strtoreplace.replace("data:image/bmp;base64,", ""); as can see above accepting 4 standard image types (jpeg, png, gif, bmp); however, of these images large , scanning through each 1 4-5 times replace seems dreadful waste , terribly inefficient. is there way reliably strip data:image part of base64 image string in single pass? perhaps detecting first comma in string? thanks in advance. you can use regular expression: var strimage = strtoreplace.replace(/^data:image\/[a-z]+;base64,/, ""); ^ means at start of string data:image means data:image \/ means / [a-z]+ me

php - Check if the email is valid in a data migration and/or it's real -

two question code made migrate table form old format, many fake emails (not existents), , wrong emails (bad write) application did not check anything. first , use validation on laravel 5.2 check if old email value detect if email valid email. all examples see it's use check on form web, not command. all, validate examples of forms, , think it's different because should not included in use use illuminate\validation\validator; .. $email_wrong = 'ksisks @kikoo'; // how check it's valid email? second question try search class or example validate if email it's real email. to validate email can use next function method in class: /** * check if @param formatted e-mail address. * * @param string $emailtockeck * @return bool */ private function validateemail($emailtockeck) { $my_data = [ 'email' => $emailtockeck, ]; $validator = validator::make($my_data, [ 'email' => 'email', ]);

python - if form field is None don't find in model in that field -

i have model blank=true fields. in form have fields optional if in model blank=true. so, if in form want make them empty, , want filter model objects, don't want use empty fields search. need create other query in case? forms.py class searchgoods(forms.form): region_from = forms.modelchoicefield(required=false, queryset = region.objects.all(), widget = forms.select()) region_to = forms.modelchoicefield(required=false, queryset = region.objects.all(), widget = forms.select()) models.py class add_good(models.model): loading_region = models.foreignkey(region, blank=true, related_name="loading_region", null=true) unloading_region = models.foreignkey(region, blank=true, related_name="unloading_region", null=true) views.py if form['region_from'] == none: if form['region_to'] == none: data_from_db = add_good.objects.filter(loading_country=form['country_from'],

Consuming a live REST services in ASP.NET -

can point me , working examples of how consume restful services in web asp.net. tutorials, walk-through or useful material. join company require me , new asp.net rest service. have used many materials , yet not clear. help me b c of rest usage in asp.net pls here code works rest servive. using system; using system.collections.generic; using system.linq; using system.net.http; using system.net.http.headers; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.web.script.serialization; using newtonsoft.json; using system.io; using system.runtime.serialization.formatters; using system.net; namespace webtestrestfullservice { public partial class _default : page { public string js; public string resp; protected void page_load(object sender, eventargs e) { } public void page_init(object sender, eventargs e) { using (var client = new httpclient()) {

c# - SQL Server Global Temp Table Still Exist After Drop -

i'm trying run query in sql server. inside query there part this: ... if exists(select * tempdb.dbo.sysobjects id = object_id(n'tempdb.dbo.[##emp]')) drop table ##emp select * ##emp #emp (nolock) ... the thing keep getting error says ##emp exists. how thing possible when checked if exist drop ? tried remove if exist part , manually drop table, still says table exists. check both temp table statuses simple: select * tempdb..sysobjects name '%emp%' then shure handle deletion , recreation both : begin transaction ... if exists(select * tempdb..sysobjects id = object_id(n'tempdb..[#emp]')) drop table #emp create table #emp(exampleid uniqueidentifier); ... if exists(select * tempdb.dbo.sysobjects id = object_id(n'tempdb.dbo.[##emp]')) drop table ##emp select * ##emp #emp ... commit transaction as @damien-the-unbeliever pointed out globally visible

how to use Bootbox with my jQuery Validation -

i trying jquery validation plugin work bootbox.js. i show message bootbox instead error label. here code $().ready(function() { // validate comment form when submitted $("#mainform").validate({ debug: true , rules: { idmail: { required: true, minlength: 7, email: true } , idnome: { required: true, minlength: 2 } }, messages: { idmail: "please insert valid mail", idnome: "please insert name" } }); }); <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="http://cdn.jsdelivr.net/jquery.validation/1.15.0/jquery.validate.min.js"></script> <meta charset="utf-8"> <title>sets validation form, checks if form valid when clicking button.</title> <link rel="stylesheet" href="http://jqueryvalidation.org/files/demo/site-demos.css">

c++ - All jobs failing in C COMPSs execution -

i have downloaded compss 1.4 , test programs http://www.bsc.es/computer-sciences/grid-computing/comp-superscalar/downloads-and-documentation , trying test them. java executions went fine; however, amb having problems c. i trying execute simple. readme states need 2 commands: buidapp simple runcompss --lang=c master/simple 1 the app builds fine, when executing command, following error: [errmgr] - warning: job 1 running task 1 on worker localhost has failed; resubmitting task same worker. [errmgr] - warning: task 1 execution on worker localhost has failed; rescheduling task execution. (changing worker) [errmgr] - warning: no task scheduled of available resources. end blocking compss. check again in 20 seconds. possible causes: -network problems: non-reachable nodes, sshd service not started, etc. -there isn't computing resource fits defined tasks constraints.

c# - Assign values to dataset object -

i have values want assign dataset tried below didn't worked. string strexp = ""; (int = 0; < ds.tables[0].rows.count; i++) { strexp = "raname = '" + ds.tables[0].rows[i]["raname"].tostring() + "'"; datarow[] dr= ds.tables[0].select(strexp); } dataset dsnew = new system.data.dataset(); dsnew = ds.tables[0].select(strexp); kindly let me know how assign values dataset you did not call acceptchanges : string strexp = ""; (int = 0; < ds.tables[0].rows.count; i++) { strexp = "raname = '" + ds.tables[0].rows[i]["raname"].tostring() + "'"; datarow[] dr= ds.tables[0].select(strexp); } ds.tables[0].acceptchanges(); //commits changes made table since last time acceptchanges called. datatable dtnew = ds.tables[0].select(strexp).copytodatatable(); dataset dsnew

node.js - npm adduser Incorrect username or password -

i newbie npm. trying create username password npm. here code: abhi@abhi-lenovo-z50-70:~/desktop/css_html/with_js$ npm adduser username: abhishek password: email: (this public) parikh5555@gmail.com npm warn adduser incorrect username or password npm warn adduser can reset account visiting: npm warn adduser npm warn adduser https://npmjs.org/forgot npm warn adduser npm err! linux 3.13.0-24-generic npm err! argv "/usr/local/bin/node" "/usr/local/bin/npm" "adduser" npm err! node v6.3.1 npm err! npm v3.10.3 npm err! code e401 npm err! registry returned 401 put on http://registry.npmjs.org/-/user/org.couchdb.user:abhishek if have registered on https://www.npmjs.com/ , sure username , password correct, delete $home/.npmrc , try adduser again. this may caused bug recorded here: https://github.com/npm/npm/issues/6545

Matching a number within a number in a python List -

a queryset returned list: list1=[2856,28564,1245,232856] when try find if number exists in above list writing: num=2856 if num in list1: it matches 2856, 25564, , 232856. how can make sure matches 2856 , not rest? sorry new python, , not find solution. apologies if asking duplicate question. it not behave suggest. in fact current syntax gives desired output. >>> list1=[2856,28564,1245,232856] >>> num=2856 >>> if num in list1: ... print(num) ... 2856 >>> this behavior suggesting. note how necessary convert integers strings in case. >>> list1 = [2856,28564,1245,232856] >>> num = 2856 >>> [x x in list1 if str(num) in str(x)] [2856, 28564, 232856]

Cursor select * with Fetch Next statement -

i working on fetch statement inside cursor. need convert sql server script teradata. following scnerio working in teradata( select columns ) sql server input:--------------------------------------- declare vend_cursor cursor select cnic departments; open vend_cursor fetch next vend_cursor; teradata output: --------------------------------- replace procedure #anonymous# () begin declare var#0 varchar(100); declare vend_cursor cursor select cnic departments; open vend_cursor; fetch next vend_cursor var#0; end; but need convert following script(in select columns replaced select *) sql server input:--------------------------------------- declare vend_cursor cursor select * departments; open vend_cursor fetch next vend_cursor; teradata output: --------------------------------- replace procedure #anonymous# () begin declare var#0 varchar(100); declare vend_cursor cursor select cnic departments; o

html - Apply Containment to Clone JQuery -

i want apply containment clone of image when dragged 1 div (keeping clone draggable). the problem when image dragged , dropped div clone becomes un-draggable, inorder make draggable have called .draggable function calling loses containment attribute , become draggable everywhere. have tried best find solution can't find anything. $(function() { $(".move-icon-class").draggable( { containment: '#screen', helper:'clone', revert: 'invalid', scroll: false, collision: 'fit flip', } ); $("#screen").droppable({ accept: '.move-icon-class', activeclass: 'ui-state-hover', hoverclass: 'ui-state-active', drop: function(event, ui) { dropped = true; $.ui.ddmanager.current.cancelhelperremoval = true; ui.helper.appendto(this).draggable(); // want apply containment } }); }); when assign draggable

perl - "Not well-formed" error from XML::Simple -

i'm trying parse xml contains namespace xml::simple throwing error. not well-formed (invalid token) @ line 3, column 53, byte 63 use data::dumper; use xml::simple; $string = q( <result> <something id="207" xlink:href="http://someurl.com&op=yeah">something 207</something> </result> ); print dumper(xmlin($string)); is there way can work xml::simple ? or have use different xml parsing library? please take note of warning in documentation xml::simple , reads follows: the use of module in new code discouraged. other modules available provide more straightforward , consistent interfaces. in particular, xml::libxml highly recommended , xml::twig excellent alternative. xml documents may not contain ampersands & or angle brackets < > outside cdata sections. within ordinary (pdata) data sections , attribute values need replaced entities &amp; &lt; , &gt; respectively your progr

performance - How to check the network speed using swift -

i have googled many pages saying on network reachability (only yes or no availibilty), never heard detect network speed using swift xcode environment. need feature(detect network speed host), gave me clue on issue i made func calculate network speed in swift 3 . download image server , calculate elapsed time. func testspeed() { let url = url(string: "http://my_image_on_web_server.jpg") let request = urlrequest(url: url!) let session = urlsession.shared let starttime = date() let task = session.datatask(with: request) { (data, resp, error) in guard error == nil && data != nil else{ print("connection error or data nill") return } guard resp != nil else{ print("respons nill") return } let length = cgfloat( (resp?.expectedcontentlength)!) / 1000000.0 print(length) let elapsed =

javascript - Need help working with Sublime Text 3 -

i know question basic , have been searching answer quite time now. hope give me clear idea on this. trust me have done research on web lot , found not satisfied. hope me out here can have clear idea on this. need in understanding on how works.: i came visual studio (ide) , there have worked on projects(angular js) in previous company.it has inbuilt server on it. when loading files(scripts) , images , css different folders used work , loved it. in new company, people using sublime text 2/3 , have installed server (python or something..i don't know exactly).hence able load files, images , stuff. i have downloaded on personal laptop , installed many packages . using same (sublime 3). commands, editing etc.. all seem cool problem when try load images/script files/css other folders (everything under same directory - folder difference) . nothing seems work there. unable see images, angular script files working , on.. how configure or how rid of problem once , can c

Localhost inside docker - neo4j -

i'm trying create dockerfile sets neo4j instance. have following: from neo4j:3.0 maintainer andy cmd curl \ -h "content-type: application/json" \ -x post -d '{"password":"mypassword"}' \ -u neo4j:neo4j http://localhost:7474/user/neo4j/password from here, build image , run using following command docker run -p 7474:7474 myimage while i'm able access neo4j panel @ localhost:4747 on host machine, curl command intended run inside container, unable access it's own localhost instance. so guess question is, doing correctly , how 1 call localhost inside container? just clarify, don't want curl request escape container - should communicate neo4j inside container. maybe want use environment variable $neo4j_auth that controls authentication explained here . for example disable authentication docker run -p 7474:7474 -e neo4j_auth=none -d neo4j:3.0 you might want check entrypoint script of docker neo4j:3.0 ima

ios - How to make Background ViewControllers should be blur when open SWRevealViewController from any ViewController -

when open swrevealviewcontrtoller(side menu) viewcontroller(ex:homevc) @ time background viewcontroller(homevc) should blur or darken. thanks got solution . in home view controller make these changes. -(void)initialsetup { self.revealviewcontroller.delegate = self; } - (void)revealcontroller:(swrevealviewcontroller *)revealcontroller didmovetoposition:(frontviewposition)position { if (position == frontviewpositionright) { revealcontroller.frontviewcontroller.view.alpha = 0.5; } else { revealcontroller.frontviewcontroller.view.alpha = 1; } }

node.js and ncp module - fails to copy single file -

i using node.js v6.3.1 , ncp v2.0.0 i can ncp copy contents of directory, not single file within directory. here code copying contents of directory recursively works: var ncp = require("ncp").ncp; ncp("source/directory/", "destination/directory/", callback); ...and here same code file source: var ncp = require("ncp").ncp; ncp("source/directory/file.txt", "destination/directory/", callback); from can think ncp designed copy directories recursively, not single files maybe? i had thought using filesystem's read / write stream functions described here consistency hoping stick ncp. update: i have found package called node-fs-extra want without need me add event handlers operations, have filesystem read/write solution. here code working: var fsextra = require("fs-extra"); fsextra.copy("source/directory/file.txt", "destination/directory/file.txt", callback); obviously

multithreading - Using a single QSqlDatabase connection in multiple qt threads -

i have multi threaded qt application has multiple threads accessing single database. required create separate qsqldatabase connections performing select / insert / update in each thread? from qt documentation, unable understand if following guideline discouraging above approach suggested: "a connection can used within thread created it. moving connections between threads or creating queries different thread not supported." i have practically tried using same connection in multiple qthreads , works fine practically wanted understand if correct thing do. fyi, using sqlite3 within qt (using qtsql api) understand supports serialized mode default: https://www.sqlite.org/threadsafe.html the reason want use same connection name in multiple threads because when tried using different connections same database on multiple threads , performed select / insert / update, got database locked issue quite frequently. however, on using same connection in multiple

How to set a privilege inside a role in ASP.NET MVC? -

i have system there user table, role table, , user-roles association table, 1 user can associated multiple roles (like admin, basicuser, etc.). able authorize action methods based on these roles. identity framework. now want add support privileges action methods can restricted based on well, rather roles. example, in controller, may have httppost action "write" privilege should able perform successfully. what changes need make can assign privileges roles? i.e., want select "admin" role have "write" , "read" privileges, while "basicuser" role assigned "read" privilege. way, admin can access method allowed write privilege, while basicuser can not. if create table called "privilege" , association table between , roles, , code set privileges in role, how can use privilege filter? example, below action should allowed performed user in role has "write" privilege attributed it. [write] public actionres

java - Log4j RollingFileAppender every minute -

i'm testing log4j rollingfileappender log4j 2.6.2. i want rotate logs every minute , have log4j2.xml similar 1 example of here https://logging.apache.org/log4j/2.x/manual/appenders.html#rollingfileappender . log4j2.xml <?xml version="1.0" encoding="utf-8"?> <configuration status="warn" name="testlog4j2" packages=""> <properties> <property name="basedir">c:/tmp/testlog4</property> </properties> <appenders> <rollingfile name="rollingfile" filename="${basedir}/app.log" filepattern="${basedir}/$${date:yyyy-mm}/app-%d{yyyy-mm-dd-hh-mm}.log.gz"> <patternlayout pattern="%d %p %c{1.} [%t] %m%n" /> <crontriggeringpolicy schedule="0 0/1 * * * ?"/> <defaultrolloverstrategy> <delete basepath="${basedir}" maxdepth="2"> <iffile

c# - Linq query group by distinct -

i have linq query complete. it's working need retrieve original list of items in list full fills reiquirements. now returns true or false if has count > numberofresourcetobook. but instead want return items in avaialbetimes having (with it's properties). please help! bool enoughresourceavailable = availabletimes.groupby(l => new { l.from, l.to }) .select(g => new { date = g.key, count = g.select(l => l.resourceid).distinct().count() }).where(c => c.count >= numberofresourcestobook).count() > 0;

ios - How to cancel one specific SKAction.movebyX in SpriteKit? -

i have skaction want cancel in touchesended . of right now, have code: self.player.removeallactions() , code works. problem i'm experiencing code cancelling actions including animation of player. did research , found code: player.removeactionforkey() , action code not include key. please see code below help. thank you. import spritekit var player = skspritenode() //i skipped code in view did load. // in touches began: let rightmoveaction = skaction.movebyx(50, y: 0, duration: 0.1) player.runaction(skaction.repeatactionforever(rightmoveaction)) let leftmoveaction = skaction.movebyx(-50, y: 0, duration: 0.1) player.runaction(skaction.repeatactionforever(leftmoveaction)) // in touches ended self.player.removeallactions() // mentioned earlier, works need cancel 1 action not have animated player. you can assign action key, , cancel referring key: add key action: player.runaction(skaction.repeatactionforever(rightmoveaction), withkey: "rightmove")

c# - OpenOffice Bootstrap stuck when deployed to IIS -

i have c# code convert documents pdf using openoffice. works fine when ran project visual studio when deployed on iis, got stuck. can see new openoffice processes in task manager whenever uno.util.bootstrap.bootstrap() called nothing happens afterward. i have tried enabling 32 bit application support on iis. changing application pool networkservice, localsystem, wwn logged in user , after restarting iis. nothing seems work. there no error displayed related error while loading *_cli assemblies. openoffice version 4 .net version 4.5.

php - Issues installing Symfony 2.8 on a Linux -

i have spend weeks trying install symfony on linux... i create new project (applications) .... , wasn't able access browser. created new folder, cut-paste files in , deletted folder create symfony. able access browser (using srv-web-03/applications/). if try srv-web-03/applications/web, can see file , folders in it. if try srv-web-03/applications/web/something, have 404 error. if try srv-web-03/applications/web/app.php/something, have blank page. editted file app.php app_dev.php : no change. when @ apache log files have error : "php fatal error: class 'symfony\component\debug\debug' not found in /var/www/html/applications/web/app.php on line 14" i try http://symfony.com/doc/2.8/book/installation.html#book-installation-permissions , result same. last thing : i'm... let i'm dumbass linux... doesn't help. thank in advance

node.js - Swisscom App Cloud Node version -

i use new ef6 features in new node.js application. where find current supported node version installed in swisscom app cloud? with cloud foundry command line tool can list installed build packs: > cf buildpacks getting buildpacks... in output can find installed buildpack version node.js buildpack | position | enabled | locked | filename | nodejs_buildpack | 4 | true | false | nodejs_buildpack-cached-v1.5.14.zip | the nodejs buildpack github repo contains changelog file updates buildpacks maintained. updates node version pointed out there.

javascript - Creating a full stack Java WS, Angular.JS, TDD/BDD, maven Eclipse project -

Image
got few issues setting project full java, angular.js, tdd/bdd stack. far these issues aren't blocker, might turn one. i'm using eclipse 4.6.0 neon wtp, jsdt , angular plugins. the 2 red flags see waving @ moment are: in "javascript resources" folder, eclipse showing "ecma 3 browser support library". should ecmascript 5 surely? (if not 6!) since neon came out, it's bit of surprise can't change can change java version instance in project facets dialog. the html , css files buried in src/main/webapp. shouldn't have 3 clicks them, should easy click java or js files. how come there's no "web resources" match "java resources" , "javascript resources" in project in project explorer view? like said @ point neither of these /seem/ matter i'd hate waste loads of time on problem in future , find out should have set project differently. i'm quite happy hear impossible , should split technologies out se

jquery - Loop through all h2 elements and add unique id -

i need add unique ids h2 tags jquery. dont know how add unique ids of h2 tags same when use attr function , have no idea how change that. $('h2').attr("id", "rev3"); you may use implicit function inside jquerys .each() this var id = 0; $('h2').each(function(){ $(this).attr("id", "rev" + id); id++; }) .each() loops through result array elements, while this reffers current element.

javascript - How to prevent resizing when mobile url hides -

i know has been discussed, , have tried implement suggested javascript fix problem, seems nothing resolves it. there definitive fix mobile dropdown urls resizing fixed background images? here js added try , fix problem: $(function(){ var bg = $("#about-page-background-image, #blogs-page-background-image, #blogs-page-background-image-show, #faqs-page-background-image, #whats-included-page-background-image"); $(window).on('resize', resizebackground); function resizebackground() { var windowsize = $(window).height() + 60 + 'px'; bg.css('height', windowsize); } resizebackground(); }) this works, not until remove finger screen, doesn't help, there still 60px white space when scroll , url hides. in advance or suggestions, has been bugging me time.

html5 - Should I use the "for" attribute for <label> when I'm using it to label a text field or is it not necessary? -

when use checkbox or radio input, use attribute, needed when want label text input or input other checkbox / radio? absolutely. not programmatically connect label text input (so screenreader users told text input for), increase 'click' area input, clicking (or tapping) on label set users focus corresponding field. if don't want use 'for' attribute whatever reason, can wrap text input in label well. <label> text input <input type="text" /> </label> this have same effect increasing click area.

jquery - DOMException: Failed to execute 'send' on 'XMLHttpRequest' on Chrome only -

i'm trying retrieve xml cross-domain server via ajax jquery's method , following error message appears on console: domexception: failed execute 'send' on 'xmlhttprequest': failed load: 'http://foreign.domain/...' the code brings error is: var temp = $.ajax({ url : url, async : false datatype : "xml", success : function(xml) { // irrelevant case }, error : function(xhr, textstatus, error) { console.warn('an error occured while loading following url: "%s". error message: %s', url, error); } }); the problem synchronous option specified by: async: false, this seems not work in chrome because of specification of jquery's ajax method, says: cross-domain requests , datatype: "jsonp" requests not support synchronous operation. the strange of situation firefox , internet explorer seem ignore specification , both perform http request , return x

asp.net - Out of Memory exception in the String C# -

i creating asp.net web api service end point return bulk data oracle database. converting returned data in json format. working fine, getting error saying out of memory exception in string result. public httpresponsemessage getdetails([fromuri] string[] id) { using (oracleconnection dbconn = new oracleconnection("data source=j;password=c;persist security info=true;user id=t")) { var inconditions = id.distinct().toarray(); var srtcon = string.join(",", inconditions); dataset userdataset = new dataset(); var strquery = @"select * stcd_prio_category stpr_study.std_ref in(" + srtcon + ")"; oraclecommand selectcommand = new oraclecommand(strquery, dbconn); oracledataadapter adapter = new oracledataadapter(selectcommand); datatable selectresults = new datatable(); adapter.fill(selectresults); string result = jsonconver

asp.net mvc - Can i use authorize/authentication for custom database -

can use authorization custom database have created own user table have following attributes , @ same time can use authorization check if user logged in checks role of user he/she can view page or not. username role id etc. i have tried session["username"] , many things manage login system didn't worked eg have 3 views managerpage testerpage developerpage each can view related page according roles manager tester , developer. thank in advance please dnt block me ask me if cant explain problem. going based on picture. should provide more information if going ask question in future. select uid dbo.user_project pid = '1';

R: count the number of occurrences -

this question has answer here: is there built-in function finding mode? 26 answers i more familiar python need in r. have data frame this: id apps 8400 10,19,9,9,8,9,1,3,3,6 10915 10,2,6,2,3,2,2,3,2,3,2,6 72331 10,9,6,1,2,4,6,2,14,3,3,2,3,9,2 i want count number of occurrences of each app , return app occurrences in new column: id apps 8400 10,19,9,9,8,9,1,3,3,6 9 10915 10,2,6,2,3,2,2,3,2,3,2,6 2 72331 10,9,6,1,2,4,6,2,14,3,3,2,3,9,2 2 bests. i added answer case, maybe helps else :). let me answer question, maybe helps else too: mymode <- function(x) { x <-

sql - Yes/No Calculation Based Off Of Other Tables Record -

i having issue calculating column in 1 table based off of tables records value. here layout: tblcontainers: container isrented 00-0033 yes 00-0044 no tblrentals: customer isrenting container brian yes 00-0044 jake no 00-0033 so tblcontainers contains of containers, tblrentals contains of rental history company. can see containers referenced in both tables, renting. if in tblrentals, container listed has yes in isrenting column, in tblcontainers, isrented switched yes. in example above, in tblcontainers, isrented container 00-0033 changed no, , isrented 00-0044 changed yes. i have found others this, however, they're based on sum's , pretty new bare me. reference others below see if guys me out. thanks help! references: calculate field's value based on multiple records in table in access db i need calculate values record in database based off of other values in other records this last 1 similar on same table,

azure - DocumentDB, How to work with continuationToken in a SP -

the next sp suppose run on collection , keep query next batch of documents (10 docs every batch). instead return same 10 documents every time. function sample(prefix) { var continuations = [], ids = [], context = getcontext(), collection = context.getcollection(), response = context.getresponse(); var queryoptions = { pagesize: 10, continuation: null }; (i = 0; < 10; i++) { // user wish list actions var query = "select * w", accept = collection.querydocuments(collection.getselflink(), query, queryoptions, processmultiusers); if (!accept) throw "unable read user's sessions"; } getcontext().getresponse().setbody(ids); function processmultiusers(err, docs, options) { if (err) throw new error("error: " + err.message); if (docs == undefined || docs.length == 0) throw new error("warning: users not exists"); (j = 0; j < docs.length; j++) { ids.push(docs[j].userid); } queryoptions

java - Send an email to my work's email server with JavaMail -

i have searched through many other posts on here users similar problems can't seem work. package testingstuff; import java.io.*; import java.util.*; import javax.mail.*; import javax.mail.message.recipienttype; import javax.mail.internet.*; import javax.activation.*; public class test { public static void main(string[] args) { // todo auto-generated method stub system.out.println("hello world"); final string user = "my work id"; final string pw = "my work password"; properties props = new properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "server got our outlook app"); props.put("mail.smtp.port", "587"); session session = session.getinstance(props, new javax.mail.authenticator() { protected passwordauthentication get

python - How to plot multiple rows on Pandas? -

Image
say have following pandas dataframe: in[114]: df out[114]: 0-10% 11-20% 21-30% 31-40% 41-50% 51-60% 61-70% 71-80% 81-90% \ f 0.186 3.268 3.793 4.554 6.421 6.345 7.383 8.476 8.968 l 1.752 2.205 2.508 2.866 3.132 3.157 3.724 4.073 4.905 91-100% f 12.447 l 8.522 and want produce barplot have columns categories on x axis and, each category, 2 bars, 1 f , 1 l , make comparisons. how in order avoid bars being stacked? my attempt produces stacked bars , offset in terms of x labels: x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] labels = ['0-10%','11-20%','21-30%','31-40%','41-50%','51-60%','61-70%','71-80%','81-90%','91-100%'] row1 = df.iloc[0] row1.plot(kind='bar',title='binned comparison', color='r',stacked=false) row2 = df.iloc[1] row2.plot(kind='bar',title='binned comparison', color='k&

c# - Compiler directives for targeting several frameworks using .NET Core -

i have library targeting .net core , net45 @ point on code need use reflection this: var type = obj.gettype(); var properties = type.getproperties().tolist(); if (type.isprimitive || type.isenum || properties.count == 0) return new dictionary<string, object> { { unnamed, obj } }; now porting library support .net core made new .net core library project, project.json { "version": "1.0.0", "dependencies": { "wen.logging.abstractions": "1.0.0" }, "frameworks": { "net45": { "frameworkassemblies": { "system.reflection": "4.0.0.0" }, "dependencies": { "newtonsoft.json": "6.0.4", "nlog": "4.3.5" } }, "netstandard1.6": { "imports": "dnxcore50", "dependencies": { "netstandard.library"

roll two fair die in python using int and not a string. here is the code i have and the feedback from my teacher -

from random import randrange def roll(): return randrange(1,7) def rolldice(n): onecount = 0 twocount = 0 threecount = 0 fourcount = 0 fivecount = 0 sixcount = 0 in range (n): dice = roll() if dice == 1: onecount = onecount +1 if dice == 2: twocount = twocount +1 if dice == 3: threecount = threecount +1 if dice == 4: fourcount = fourcount +1 if dice == 5: fivecount = fivecount +1 if dice == 6: sixcount = sixcount +1 return (dice, onecount, twocount, threecount, fourcount, fivecount, sixcount) def rolltwodice(): total = 0 turn in range(2): total += roll() return total def rolltwodicecount(n): twos = 0 turn in range(n): if roll() == 2: twos +=1 message teacher: >>> rolldice(6000) (4, 996, 1022, 976, 991, 1018, 997 that looks works, once figured out