Posts

Showing posts from March, 2011

php - Yii2 Export redirects to destination page -

i'm implementing export function our yii2 based application. (an humhub module) use "kartik-v/yii2-export" module. the action contains: $gridcolumns = [ ['class' => 'yii\grid\serialcolumn'], 'id', 'language', 'time_zone', ['class' => 'yii\grid\actioncolumn'], ]; $dataprovider = new sqldataprovider([ 'sql' => 'select * user status=:status' ]); return $this->render('export',[ 'dataprovider' => $dataprovider, 'gridcolumns' => $gridcolumns ]); the view contains: echo exportmenu::widget([ 'dataprovider' => $dataprovider, 'columns' => $gridcolumns ]); when klick on export function new popup windows opens information creates file now. after few seconds should start download, redirects destination page. do need add controller or did else wrong? thanks help. it's not defined if n

c# - Login url gets changed on redirection with authorize attribute -

i using owin custom authentication , asp.net identity , have login url this: http://localhost:1927/ now after login user redirected dashboard page , url this: http://localhost:1927/dashboard/index now after user logout redirecting user login page , url still fine below: http://localhost:1927/ but when enter url http://localhost:1927/dashboard/index directly in browser again redirecting login page , url changes below url: http://localhost:1927/authentication/login?returnurl=%2fdashboard%2findex i know because have decorated both authentication , dashboard controller authorize attribute . code: [authorize] public class authenticationcontroller : controller { } [authorize] public class dashboardcontroller : controller { } public partial class startup { // more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?linkid=301864 public void configureauth(iappbuilder app)

javascript - jQuery Status change True false Image Button -

this jquery code bind html table.i have 2 image...how can check when true 1.jpg show , when false 2.jpg show. $(function () { debugger $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: "webform5.aspx/binddatatable", data: "{}", datatype: "json", success: function (dt) { debugger; (var = 0; < dt.d.length; i++) { $("#example1 > tbody").append("<tr><td> <input type='checkbox' class='chk' id=" + dt.d[i].categoryid + " /></td><td>" + dt.d[i].categoryid + "</td><td>" + dt.d[i].name + "</td><td><input type='image'if() src='images/1.png'title='deactivate this' value=" + dt.d[i].status + " alt='submit' width='18' height='18'> </t

python - Create new record with the self rererenced Foreignkey relation -

below models.py , made self reference foreignkey relationship. class emp_details(models.model): emp_id = models.autofield(primary_key = true) emp_first_name = models.charfield(max_length = 50,null = false) emp_manager_id = models.foreignkey('self') a1 = emp_details(emp_first_name = "ramesh",emp_manager_id = 2) a1.save() here trying create new record. got following error: valueerror: cannot assign "'2'": "emp_details.emp_manager_id" must "emp_details" instance. how can create new record self rererenced foreignkey relation? in case, emp_manager_id foreign key field, should assign id emp_manager_id_id . a1 = emp_details(emp_first_name = "ramesh", emp_manager_id_id=2) it better change field name emp_manager . note it's recommended use camelcase model name, empdetail better emp_details . putting together, have: class empdetail(models.model): emp_i

amazon web services - Different output in AWS PHP SDK than in AWSCLI -

the primary goal i'm trying achieve iterate on running ec2 instances in php. it's easy data using bash script, shown below: bash script: #!/bin/bash export aws_access_key_id="akidexample" export aws_secret_access_key="wjalrxutnfemi/k7mdeng+bpxrficyexamplekey" aws ec2 describe-instances --region="eu-west-1" --filter "name=instance-state-name,values=running" bash output: { "reservations": [ { "ownerid": "58728357357", "reservationid": "r-0e0283649826935", "instances": [ { "securitygroups": [ { "groupid": "sg-2fe333148", "groupname": "web" } ], "publicdnsname": "ec2-53-13-121-72.eu

javascript - Why is it returning undefined? -

i want store following method, , constant value, querying using key find value or value find key function my_reference() { return { 30:'', 31:'err591', 32:'err761', 33:'err671', 34:'err551', }; } console.log( my_reference[31], my_reference.31, my_reference().31, my_reference()[31] ); my_reference[31], trying read property (which doesn't exist) of function. property on object return value of calling function. my_reference.31, trying use number identifier. isn't allowed. my_reference().31, trying use number identifier. isn't allowed. my_reference()[31] this works

Wix install location -

i have wix setup allows user select install location. when uninstalling, need run custom action should activate file in install location. tried getting install location session["installdir"] results in default path , not 1 given user. how can reach location? i've done in own installer - following should work. this adds property retrieve install location value registry. <property id="installdir"> <registrysearch id='registry' type='raw' root='hkcu' key='software\$(var.manufacturer)\$(var.productname)' name='location' /> </property> this sets install location in registry. <component id="registry" guid="*"> <registrykey root="hkcu" key="software\$(var.manufacturer)\$(var.productname)"> <registryvalue name="location" type="string" value="[insta

Android - Display image to fit width of device -

Image
i developing android app thap show photos in listview. layout each item in listview. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <imageview android:id="@+id/exam_page_item_imageview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scaletype="centercrop"/> </relativelayout> my listview displays i want display imageview fits width of device. (fit width only) could give me suggestion or have idea resolve problem ? try : <imageview android:id="@id/imgview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:adjustviewbounds="true" android:scaletype="fitcenter&

c# - Connection Open / Close with Dependency Injection -

Image
we're working on asp.net core application using dependency injection , entity framework 6, , discussing team database performance. use prefix monitoring our application, , detect ef6 opens , close connection each time made request. fine regarding entity framework principle, if send lots of request (30 requests), select requests, opens / closes connection @ each request. as can see, open / close operation takes each request 43ms, , can annoying. code made request uses single instance of dbcontext http request. we tried create, of ourself, unique connection each request, open , close @ end of http request. have unique open , unique close each http request, detect bad performance .net code time, unknown source (maybe ef6 ?) now little bit lost performance question. better ? correct way of using ef6 ?

node.js - Javascript - how to find the PID where match found? -

i have following string buffer (they random rows random column values). how can search "warnning" in row available, found row, how filter pid? var exec = require('child_process').exec; exec('tasklist /v /fi "imagename eq python*"', function(a,b,c) { console.log(b); // pid contain word : "warnning" ? can list them chronologically? }); output: image name pid session name session# mem usage status user name cpu time window title ========================= ======== ================ =========== ============ =============== ================================================== ============ ===================================================== python.exe 9999 rdp-tcp#10 1 19?556 k running sun\tpt 0:00:15 warnning of windows python.exe 3861

javascript - slideToggle not animating (need help related to the code i have) -

jsfiddle: https://jsfiddle.net/32oumq5k/ the problem: have been sitting here 2 hours, searching, editing , trying new things, please excuse me if code isnt best (im new javascript) , well... css messy .-. why cant find solution. but basically, slidetoggle wont animate (well does, not want to), inside fiddle find alot of css (most of can ignored) im trying create navigation menu gracefully slides down... using slidetoggle, normal ul no styling works fine, reason style messes :( i have tried many different positions, heights, widths, displays, different divs, renaming things, padding, removed z-indexes because thought problem. 1 thing did notice when doing of if background color ul set (to visualise animation... animates 310px 300px , dissapears leads me belive not sliding child elements has inside confusing if appreciated :/ maybe fresh eyes me solve issue. not duplicate, have been literally 50 other slidetoggle stackoverflow questions none helped, when combining 2 or more

Neo4J cypher query to get nodes connected by paths with the same generic attribute -

i'm trying create cypher query returns me nodes connected given range of hops (i.e. 1..5), relationships between these hops share same attribute value, without specifying attribute. so like match (a {type: 'cin1'})-[rels:next*1.. {value: 1}]->(b {type: 'cancer'}) return (a), (b) but without specifying value on edges should one, need equal among edges in hopping process. i add upper bound path. or use (all)shortestpath(s) also make sure a , b indexed label + property combination. and can use predicate on relationships-collection forms path. match (a:label {type: 'cin1'}) match (b:label {type: 'cancer'}) match shortestpath((a)-[rels:next*1..20]->(b)) all(r in tail(rels) (head(rels)).value = r.value) return (a), (b)

python - Django 1.9 CircularDependencyError -

what can error??? raise circulardependencyerror(", ".join("%s.%s" % n n in cycle)) django.db.migrations.exceptions.circulardependencyerror: price_schedule.0001_initial, depot.0001_initial even when run python3 manage.py makemigrations it shows "no changes detected", though deleted migrations file , folder if run python3 manage.py migrate it not showing of app apply migrations: authtoken, sessions, contenttypes, admin, auth running migrations: no migrations apply.

android - how to set image in my More_FragmentListView -

i have more_fragment listview , listview side arrowimage in not properway? want set images in listview? how? see image once? can clerity?? enter image description here this more_fragmnet listview public class more_fragment extends fragment implements adapterview.onitemclicklistener { more_fragment context; listview listview; public static int[] images = { r.drawable.project14, r.drawable.event, r.drawable.social, r.drawable.gallery, r.drawable.shop, r.drawable.share, r.drawable.nextbutton}; public more_fragment() { // required empty public constructor } @override public view oncreateview(layoutinflater inflater, viewgroup container,bundle savedinstancestate) { // inflate layout fragment final view rootview = inflater.inflate(r.layout.fragment_more_, container, false); listview = (listview)rootview.findviewbyid(r.id.morefragment_listview); string s[] = {"projects","events",&quo

Not all voice files give output from Google Speech to Text API for Node.js -

i using below node.js script snippet, 'use strict'; var google_speech = require('google-speech'); google_speech.asr({ debug: true, lang: 'en_us', developer_key: '<google api key>', file: '<voice file name path>', }, function(err, httpresponse, xml){ if(err){ console.log(err); }else{ console.log(httpresponse.statuscode, xml) } } ); the output getting audio files not all. example 1 flac file giving output flac file doesn't. is there specific type of files required api give output. if yes, let me know specific type/format of file. if you're using this google-speech node library, appears it's hardcoded content-type header audio/l16; rate=16000 here in source code. it looks can overridden option in first param, so, example, if you're using 44.1khz flac file, following might work 'use strict'; var google_speech = require('google

r - Response and predictor must be vectors of the same length -

i'm using proc curve in order compare performance of models. have plotted 4 svm models. when plot decision tree model following error: error in roc.default(x, predictor, ...) : response , predictor must vectors of same length. the following code represent how plotted curve: rocobj1 <-plot(roc(as.numeric(video.test$rate),as.numeric(svm.grossesse.pred4)),main="comparaison ",col="#1c61b6") rocobj5 <-lines.roc(as.numeric(video.test$rate),as.numeric(predarbredecision),col="pink")

mongodb - Find a mail with a status and compare date scheduled with now (MONGO/PHP) -

i have little problem send mail. searching send many mails come db 2 conditons : mail status 'to_send. mail date scheduled. these 2 conditions run in find request : $mails = $database->mails->find(['status' => 'to_send', ['date_scheduled' => ['$gte' => new mongodb\bson\utcdatetime()]]]); find mails status good, when i'm adding scheduled condition have message : fatal error : uncaught mongodb\driver\exception\invalidargumentexception: mongodb\bson\utcdatetime::__construct() expects 1 parameter, 0 given in /users/developpeur/cron/cron_mail.php:22 stack trace: 0 /users/developpeur/cron/cron_mail.php(22): mongodb\bson\utcdatetime->__construct() 1 {main} thrown in /users/developpeur/cron/cron_mail.php on line 22 can me please? the utcdatetime() constructor expects single parameter (the number of milliseconds since epoch). i'm no php expert, should able pass time() * 1000 parameter create mong

objective c - Fetch all possible values for category fields -

i'm trying fetch possible pktcategoryoptions of item field. @ moment have figures out how fetch selected values using item.valuesforfield("mycategoryfield") as? [pktcategoryoption] ... is possible? i've looked in different header files method this, no luck far.

Pass function arguments that are variable names into formulae in R functions? -

i looking simple way pass function arguments variable names formulae in r functions. test dataset: set.seed(4892) df.pass <- data.frame("alfa"=sample(1:9, 100, replace=t), "beta"=sample(1:9, 100, replace=t), "theta"=sample(1:9, 100, replace=t), "out"=runif(100, 0, 1)) example analysis (testing if interaction model different) made function: lrtest(glm(out~alfa*beta, family = binomial("logit"), df.pass), glm(out~alfa + beta, family = binomial("logit"), df.pass)) if goal create generic function invinteract solves problem above arbitrary variable names , data sets, simplest way pass variable names function() arguments formulae terms corresponding positions of out , alfa , beta ? inserting raw variable names formulae not work, because r tries evaluate names objects , finds nothing. inserting string variable names directly formulae not work either. is necessary reconstruct for

c# - Flurl: cannot serialize JSON string received from HttpTest -

Image
i want receive json rest api , translate pocos. it's supposed simple turns out not :( in unit test have string of sample json data api sends: string mockjsonresponse = @"[{ ""project_name"": ""mailjet support"", ""cluster_name"": ""24/7 support"", ""is_billable"": ""1"", ""usedtime"": ""128"" }, { ""project_name"": ""caring"", ""cluster_name"": ""caring"", ""is_billable"": ""0"", ""usedtime"": ""320"" }, { ""project_name"": ""engagement&

cannot play mp3 using mediaplayer android -

i pressed button play abc.mp3 file , "unfortunately, app has stopped". java public class mainactivity extends appcompatactivity{ mediaplayer background_music; protected void oncreate(bundle savedinstancestate) { background_music.create(this,r.raw.abc); } public void playmusic(view view) { background_music.start(); } } xml <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="new button" android:id="@+id/button" ... android:onclick="playmusic" /> it plays music , don't know why error comes up. please me. it nullpointerexception since background_music null & try call start() on null object reference. background_music.create(this,r.raw.abc); the above code returns mediaplayer object not saved background_music object. should initialize background_music = background_music.create(this,r.raw.abc); or backgro

c# - Web API CORS FormsAuthentication from AngularJS Client -

i implemented angularjs project. server side coded using .net web api (c#). enabled cors in web api installing nuget package https://www.nuget.org/packages/microsoft.aspnet.webapi.cors [enablecors(origins: "*", headers: "*", methods: "*")] public class samplecontroller : apicontroller { [allowanonymous] [httpget] public string getanonymousstring() { formsauthentication.setauthcookie("sample allowanonymous", false); return "calling allowanonymous method using cors - public text"; } [authorize] [httpget] public string getauthorizestring() { return "calling authorize method using cors - private text"; } } i hosted client side application in http://localhost:8050 , hosted service web api in http://localhost:8060 . now tried access getanonymousstring() - http://localhost:8060/api/sample/getanonymousstring working fine , returns httponly cookie client via r

Azure Runbook error - Object reference not set to an instance of an object -

i'm trying set auto shut down/start on vm using automation account, keep running this error. i have created automation account, added credential , trying test run book. have tried following many tutorials stuck. if point me in right direction it'd appreciated.

Ms Access and SQL: how to identify where error occurs -

Image
i have form in ms access lot of queries running calculate kinds of numbers using user input , using other queries ouput. of sudden error below: error text is: the record source ' ' specified on form or report not exist. name of recordsource may misspelled, recordsource deleted or renamed, or recordsource exists in different database. in form or report's design view or layout view, display property sheet clicking properties button, , set recordsource property existing table or query. i don't remember added/removed have caused , can't find error occurs. how can i, guess, debug access form while it's running queries? i don't see image blocked @ work. the 1 way debug application when errors occurs break execution using keyboard combination : ctrl + pause/break do when error message appears this doesnt work if application compiled in mde/accde when ctrl-break doesnt work, have add break point in code. bring vba window

ios - Get keyboard height while being dismissed interactively with scroll -

i'm creating chat interface , whatsapp, have created "scrolltobottom" button, appears when user scrolls collection distance. button follows keyboard frame when keyboard appears , when disappears, problem when keyboard being dismissed interactively, can't make button follow keyboard frame. after keyboard hidden system sends notification , button changes constant. i have tried keyboard notifications , none of them helped me issue. need in time, makes button follow keyboard without delay. uikeyboardwillchangeframenotification haven't worked me. nsnotificationcenter.defaultcenter().addobserver(self, selector:#selector(self.keyboardwillshow(_:)), name:uikeyboardwillshownotification, object:nil) nsnotificationcenter.defaultcenter().addobserver(self,

php - JSON response not working correctly -

so fixed thank has tried me problem lied webhost company with, has anti-bot protection not allow api requests turned off , works charm thank you... hi i'm not sure if me current problem im making game in ue4 (unreal engine), , using json plugin, when created working on localhost using (bitnami), migrated on webhost , not working, instead of getting json response keep getting error. logvarest: response (200): <html> <body> <script type="text/javascript" src="/aes.js" ></script><script>function tonumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseint(d,16))});return e}function tohex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].tostri ng(16);return e.tolowercase()}var a=tonumbers("f655ba9d09a112d4968c63579db590b4"),b=tonumbers("98344c2ee

reactjs - Could not load image of .JPG format -

Image
i trying load image local resource format .jpg. every time gives me following error. do react native support .jpg format ? can me on ? thanks... if sure image_path right rename image in folder capital letters (.jpg) lower case letters (.jpg). tested case windows , reproduce , fix above solution. react-native version: 0.23.1 for clarification: var yourpicture = require('./yourpathtoyourpicture/picture.jpg); //working var yourpicture = require('./yourpathtoyourpicture/picture.jpg); //not-working solution solve capital letter problem: save picture in project folder lower case letters yourpicture.jpg -> yourpicture.jpg use image render(){ return( <image source={yourpicture}/> ); }

Nginx 301 redirect old domain to the single homepage on a new domain -

i'm trying redirect multiple url on old domain single page on new one. old-domain.com/one old-domain.com/query?=two old-domain.com/one/cat+mouse should redirect new-domain.com/ using following, redirects whole path, not homepage: server { listen 80; server_name old-domain.com; return 301 http://new-domain.com; } if need redirect domain, you'll need return 301 $scheme://new-domain.com$request_uri; if need redirect new home, try server { listen 80; location / { return 301 $scheme://new-domain.com/; } }

php - Query-not getting right answer -

i want used group can data country-state-district . want display country state , district level want add checkbox. $this->db->distinct(); $this->db->select('country_name,s_name,dist_name'); $this->db->from('resource_details'); $this->db->join('location','reso_dtail_location=loc_id'); $this->db->join('go_state', 'go_stste_id = loc_state', 'left'); $this->db->join('go_country', 'num = loc_country', 'left'); $this->db->join('go_dist', 'id = loc_district', 'left'); $this->db->where('loc_id !=1 , loc_id !=2'); $query = $this->db->get(); //result $location = $query->result(); but query not give right answer after using group_by shows 1st record you can use group country. can distinct country name. states , city can use group concat.

openoffice.org - open office java extension undo and onStartApp method -

i'm creating java extension open office , need use open office undo method. i've found documentation xundomanager since i'm quite unexperienced api don't know how use in code. furthermore, want extension things before openning document, i've found onstartapp but, again due non experience, don't know how use on code. could me ? in advance ! for undo, use dispatcher call shown in listing 4.3 of andrew pitonyak's macro document . for onstartapp , did not find lot of documentation. create file called events.xcu code following: <node oor:name="applicationevents"> <node oor:name="bindings"> <node oor:name="onstartapp" oor:op="replace"> <prop oor:name="bindingurl" oor:type="xs:string"> <value>vnd.sun.star.script:events.py$onstartapp?language=python&amp;location=application</value> change value of vnd.su

migration - Migrate data from Informix to Cassandra -

i have tried sqoop slow. fast approaches move data informix cassandra? sqoop stuck here long. info 12:53:17 consistency level reads cfs: local_quorum info 12:53:17 consistency level writes cfs: local_quorum warn 12:53:18 unable load native-hadoop library platform... using builtin-java classes applicable info 12:53:18 loaded cfs compression rules filesystem: cfs info 12:53:20 using read commited transaction isolation info 12:53:20 running job: job_201607121017_0008 info 12:53:21 map 0% reduce 0%

selenium - Dynamic buttons added to the page, don't know how to find the element -

i have complected structure of page , have no idea how find element... the page contains folders created user, need create folder , click on it, have no idea how find element i've created. structure this: <div class="row-text" style="width: calc(100% - 84px);"> <span class="row-item-name"> <span class="row-item-link"> <a class="grid-row-element-name">eclipse111</a> </span> <span class="row-item-actions hover-child"> <a>share</a><span> | </span><a watchdox-rename="name" watchdox-save-func="rename(element, name)" class="rename-link"><span translate="">rename</span></a> </span> </span> <br> <span class="row-meta-data"> <span class="creation-date-formatted">today @ 10:30 | </span> <span c

c# - Is all the query in Entity framework 6 is already compiled? -

i want optimized queries in entity framework 6.1.3 , need know whether queries compiledqueries or need write them manually compiledquery? thanks in advance. no, not. you'll need specify want use compiledquery. that said, using compiled query provide 7% performance improvement. if tuning performance of ef major issue you, recommend reading following: https://msdn.microsoft.com/en-us/data/hh949853

javascript - How to set audio delay for HTML5 videos (desync) -

vlc has nice feature adjust audio delay in video. can audio in sync audio when play on cable connected sonos play:5. speaker has delay due audio processing. does html5 video tag allow control audio delay via javascript? want set audio signal -1500 ms before video signal. html5 video player doesn't support that. maybe can find library that.

android - create a button programatically with sharp edge containing image -

Image
i wanted create custom button or view progrmatically simple image , text shown in image, edge of button not of image. please don't use xml. any appreciated. wanted learn , create custom view canvas since new 1 canvas, not able create it. import android.content.context; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.graphics.rect; import android.util.attributeset; import android.view.view; public class containerbox extends view { private paint textpaint; private string maintext="vikram singh"; private string backgroundcolour = "#ff8514"; private string textcolour = "#1896bb"; private bitmap lefticon; private paint paintbackground; private rect recbackground; private paint paintimage ; private rect recimage; public containerbox(context context) { super(context); initializepa

c++ - Cannot pass template argument to std::list<T>::iterator -

this question has answer here: where , why have put “template” , “typename” keywords? 5 answers i made container template class follow: template<typename k, typename v> class hash_table { public: class iterator { private: list<v> list_; // works list<v>::iterator it_; // fails: syntax-error "iterator" list<int>::iterator it2_; // works }; //.... } can tell me, did wrong @ list<v>::iterator it_; ? why should syntax error? as @songyuanyao sugested, solution put typename before list<v>::iterator in: template<typename k, typename v> class hash_table { public: class iterator { private: list<v> list_; // works typename list<v>::iterator it_; // no more fails list<int>::iterator it2_; // works

r - how to set the x-axis of barplot -

Image
this has been questioned many times 1 x axis in barplot in r however none helped me solve problem dt<- structure(c(79l, 54l, 37l, 41l, 42l, 121l, 134l, 169l, 23l, 19l, 22l, 19l, 25l), .names = c("experi_1", "experi_2", "experi_3", "experi_4", "experi_5", "experi_6", "experi_7", "experi_8", "experi_9", "experi_10", "experi_11", "experi_12", "experi_13")) i plot data mydt<- barplot(dt) if , overlay twice x-axis axis(side=1,at=mydt[1+c(1,13)],labels=c("experi1","experi13")) it set few of x-axis labels automatically. want manually, example mention beginning of x-axis label , end . in case experi1 , experi 13. tried understand ?axis , specially label not set costume axis label want. parameter names.arg of barplot function allows custom labels way want. have give parameter vector of name same length numbe

Serve HTTP through SSH with Nginx? -

we have server stuck inside our office network, , access outside office. i set ssh tunnel on 1 of our public server in cloud computing company. can access our internal server ssh through public server. but internal server serving webservices. we'd able access webservices there through public server , tunnel ssh between these both. is there way of doing nginx? or other software actually. sonny you should use proxy_pass directive, instance: location /{ proxy_pass http://<the private server ip>:<the private server http port>/; } it redirect every request private server

c++ - Concurrent system calls in Linux -

simple question is, haven't found googling. safe make concurrent calls linux system, such calling socket() on several threads @ (what might be) same time? specifically, kernel guarantee thread-safety socket() , connect() , and/or send() ? if not, why not? i'd learn more topic , why system calls or not thread-safe. my main concern here socket() not return duplicate or invalid file descriptor when called different threads. i'm not going connecting or writing same socket @ same time in case. is safe make concurrent calls linux system, such calling socket() on several threads @ (what might be) same time? yes, thread safe. though not sure per posix standard or not. specifically, kernel guarantee thread-safety socket(), connect(), and/or send()? as per this link, yes. says locks used internally, mean send operation serialized, not in specific order. answer updated part of question: my main concern here socket() not return duplicat

MariaDB query from python code -

i'm writing python script connects mariadb server (v 10.1.12) , saves file results of queries. however, when sending following query: sql = 'select * monitor_run_tracking entry in (select max(entry) ' \ 'from monitor_run_tracking run in ({0}) ' \ "and whenentered<'{1}' group run)".format( runstr, quality_date ) followed cursor.execute( sql ) , following error: file "build/bdist.linux-x86_64/egg/mysqldb/cursors.py", line 174, in execute file "build/bdist.linux-x86_64/egg/mysqldb/connections.py", line 36, in defaulterrorhandler _mysql_exceptions.programmingerror: (1064, "you have error in sql syntax; check manual corresponds mariadb server version right syntax use near ') , whenentered<'2020-01-01' group run)' @ line 1") could explain me mistake is? thanks! you didn't close parenthesis around nested select. should be select * monitor_ru

r - How to find a common variable in a large number of databases using Stata -

so have large number of databases (82) in stata, each contain around 1300 variables , several thousand observations. of these databases contain variables give mean or standard deviation of concepts. example, variable in such dataset called " leverage_mean ". now, want know datasets contain variables called concept _mean or concept _sd, without having go through every dataset hand. i thinking maybe there way loop through databases looking variables containing "mean" or "sd", unfortunately have idea how this. i'm using r , stata datafiles. yes, can loop in stata r. first, should check out stata command ds , package findname , many of things described here , more. show happening "under hood", i'll show stata code can achieve below: /*set current directory location of databases*/ cd "[your cd here]" save names of 82 databases list called "filelist" using stata's dir function macros. note: don'

javascript - Pop-up content sometimes appearing behind main content -

on wordpress website have button set on top right of screen (request demo) when click it, popup appears text , hubspot form. have working fine whatever reason 1 out of 10 page reloads content of hubspot form won't appear in popup appear behind main content on web page default without button being clicked. it's particularly bad on firefox though seems happen 50% of time. i'm struggling find solution this. website url: http://crowdsight.co/ thanks, jonathan haven't succeeded in reproducing problem yet sounds js hiding form , attaching click event "request demo" failed job. because can't find elements in dom(the form , "request demo"). make sure form , button's initialization happens after dom ready: jquery(document).ready(function() { //initialization here }); or: document.addeventlistener("domcontentloaded", function(event) { //initialization here });//unlike jquery function, works modern browsers.

sql - Make column value of table the result of 3 strings concatenated together MS Access 2013 -

one of columns called "code" should store result of concatenating 3 strings together. these 3 strings retrieved same table, 3 different columns. how can in vba? or there easier way in access? i want autocalculated once user finishes entering data in form or table. know can done in query pretty i'm finding difficult in table. use default value in table https://support.office.com/en-gb/article/examples-of-expressions-d3901e11-c04e-4649-b40b-8b6ec5aed41f

python - How to shut-down built-in Flask server? -

whenever ran experimental flask server, used running on http://0.0.0.0:5000/ (press ctrl+c quit) . indeed did quit whenever pressed ctrl + c . after ran threaded flask server, pressing ctrl + c closes server not exit process. must manually(painstakingly), kill process, jobs determine process number kill it, wait until terminated before restart server. wrong it? threaded servers behave way? edit do in application.py . from flask-sse import sse # code... app = flask(__name__) app.config["redis_url"] = "redis://localhost" app.register_blueprint(sse, url_prefix='/foo') # code again sse.publish() # want # code if __name__ == "__main__": app.run(threaded=true, host="0.0.0.0") now run file python application.py . no need flask run... . says running on http://0.0.0.0:5000/ (press ctrl+c quit) now try press ctrl + c . try reloading webpage, won't, implying server closed. @ terminal, process still hasn't termina

Set button handle in C# -

btnname1 = new button(); counter++; //start setting of button btnname1.location = new point(47, 35 + a); btnname1.size = new size(132, 59); btnname1.flatstyle = flatstyle.popup; btnname1.text = textbox1.text; btnname1.name = "btn" + counter.tostring(); btnname1.backcolor = color.white; btnname1.forecolor = color.black; panel1.controls.add(btnname1); += btnname1.size.height + 2; btnname1.click += btnname1_click; i wrote code making new button. when click on add button code runs , each click on add button can make new button. problem how can set click handle each button? mean when click on each button, show text me , wrote code make texts different: btnname1.text = textbox1.text; you didn't post event code, steve mentioned in comment (that appears have since been removed), can use sender argument particular button clicked. following should you're aft

How to reference anonymous inner class in Kotlin? -

this question has answer here: how reference “this” within anonymous listeners when using short notation? 2 answers i have following extension method. how can reference ongloballayoutlistener passed addongloballayoutlistener() method? need pass listener removeongloballayoutlistener() method. fun view.ongloballayout(callback:() -> unit ): unit{ this.viewtreeobserver.addongloballayoutlistener { if(android.os.build.version.sdk_int >= android.os.build.version_codes.jelly_bean) { this.viewtreeobserver.removeongloballayoutlistener(this); } else { this.viewtreeobserver.removeglobalonlayoutlistener(this); } callback(); } } one way use object expression instead of lambda so: fun view.ongloballayout(callback: () -> unit): unit { val viewtreeobserver = this.viewtreeobserver

javascript - Expand Collapse functionality breaks jQuery -

in project i'm using vertical-accordion-menu-plugin-for-jquery-nav-accordion allows me make parent links clickable. have made minor changes jquery make keyboard accessible. looks besides 1 little thing. when expand levels , close parent's container, sub-level items not longer showing expand/collapse button. reasons breaks. https://jsfiddle.net/webira7/mvtf6zve/ /* nav accordion plugin v1.1.2 ************************************/ (function($){ $.fn.navaccordion = function(options, callback){ this.each(function(){ //options var settings = $.extend({ expandbuttontext : "+", //text inside of expand button collapsebuttontext: "-", //text inside of collapse button selectedexpand: "true", //expand selected channel selectedclass: "selected", //class used detect selected channel - check "parentelement" class (the parent <li> default) multiplelevels: "true", //ap

javascript - How can I click the login image without Id or Name in website? -

i wanna write code via vba automatically login website. and login "button" "login image", without id or name. don't know how make vba "left mouse click" on "login image". addtionally, noticed when move mouse onto "login image", left-bottom corner displays: \smcvdol\logon may help...i don't know javascript @ all here's it: <td align=right width="20%" height="21"><input type="image" src="../img/dl.jpg" width="63" height="22" border="0" onclick="javascript:submitform();" style="cursor: pointer;"></td> and here's submitform(): <script> function submitform(){ if(frm.authid.value==''){ alert("please enter user name!"); frm.authid.focus(); return false; }else{ frm.submit(); } } function reset_text(){ document.getelementbyid('username').focus(); } </script