Posts

Showing posts from April, 2013

Post with parameters using HttpWebRequest in C# -

having following code: var request = httpwebrequest.create("https://api.channeladvisor.com/oauth2/token"); request.contenttype = "text/html"; request.method = "post"; request.headers.add("cache-control","no-cache"); request.headers.add("authorization", "basic " + base64translator.tobase64(system.text.encoding.ascii, devkey+":"+sharedsecret)); string postdata = " grant_type=refresh_token&refresh_token=a12sl1bhhjwerxm2nfth2efzw0yiw7462kahr43ucja"; var data = encoding.ascii.getbytes(postdata); request.contentlength = data.length; using (var stream = request.getrequeststream()) { stream.write(data, 0, data.length); } var response = (httpwebresponse)request.getresponse(); var responsestring

python - Trying to train a neural network to recognize if something is a proper sentence? -

for example, want 'the cat brown' return true , 'the cat ink brown' return false. trying use nltk package in python so. far have: sentence='i hope sentence'.split() rules = nltk.data.load('grammars/large_grammars/atis.cfg', 'text') grammar = cfg.fromstring(rules) parser = nltk.parse.bottomupchartparser(grammar) but not sure next step should or if right way approach problem. advice appreciated. thanks! wiki

Using mutliple text formatting using lambda function in pandas dataframe in python? -

i trying format given string contains alphabets, special characters, , numbers. target remove except alphabets , space in string. able in multiple line of code not good. can me reformat blow line of codes can multiple formatting in online instead 4- lines below? scholar['title_format'] = scholar['title'].map(lambda x: str(x)) #change value string scholar['title_format'] = scholar['title_format'].map(lambda x: re.sub(r'[^a-za-z ]', '', x)) #remove special characters scholar['title_format'] = scholar['title_format'].map(lambda x: re.sub(r'[0-9]', '', x)) #remove numbers scholar['title_format'] = scholar['title_format'].map(lambda x: x.lower()) #change lower case iiuc: scholar['title_format'] = scholar['title'].astype(str).str.lower() \ .str.replace(r'[^a-z\s]*', '') update: scholar['title_form

javascript - Custom button vs native button? -

i have created custom button javascript , created asp.net wrappers button. while checking button, native button of asp.net's action event triggered faster custom button. behavior client side controls , native server controls? i have created wrapper classes of below link asp.net wrapper control jquery datetime picker wiki

php - Laravel-DomPDF Guzzle GET Request From a CLI -

i want execute dompdf download terminal command. cli command executes api call guzzle. have made simple setup. problem 500 server error [guzzlehttp\exception\serverexception] server error: `get http://localhost:8888/pdf` resulted in `500 internal s erver error` response: <!doctype html> <html> <head> <meta charset="utf-8" /> <meta name="robots" content="noindex,nofollow (truncated...) api call http://localhost:8888/pdf command php artisan pdf project structure commands pdfcommand.php controller pdfcontroller.php views rapport.blade.php the sourcecode route route::get('pdf', 'pdfcontroller@downloadpdf'); pdfcommand.php <?php namespace app\console\commands; use illuminate\console\command; use guzzlehttp\client guzzleclient; class pdfcommand extends command { protected $signature = 'pdf'; protected $descripti

c# - Xamarin upload image to a REST web server (Bad Request) -

i know question has been posted more 1 time i’m still hanged problem of sending 1 image xamarin client rest web server. receive badrequest error on client side don’t know if comes server or client. here xamarin code (client side) : public class wsdest { public string d_id { get; set; } public string d_nom { get; set; } public string d_cat1 { get; set; } public string d_cat2 { get; set; } public string d_annee { get; set; } public byte[] d_photo1 { get; set; } } static async task<string> do_updatevehiculeinfos(wsdest dest) { string cret = ""; string cip = application.current.properties["ipserveur"].tostring().trim(); using (httpclient client = new httpclient()) { try { var ojson = jsonconvert.serializeobject(dest); var cjson = new stringcontent(ojson, encoding.utf8, "application/json"); client.defaultrequestheaders.accept.add(new system.net.http.heade

ios - Swift 3.0 Delegate Protocol doesn't work -

i have made delegate protocol within 2 view controllers. delegate method doesn't call on code snippet. reason that. couldn't find out issue kindly post suggestions relive issue. main view controller class viewcontroller: uiviewcontroller, testdelegatemethod { override func viewdidload() { super.viewdidload() let vw = testviewcontroller() vw.delegatetest = self let push = self.storyboard?.instantiateviewcontroller(withidentifier: "testviewcontroller") self.navigationcontroller?.pushviewcontroller(push!, animated: true) } func testmethod(value:string) { print("hai", value) } } sub view controller protocol testdelegatemethod { func testmethod(value:string) } class testviewcontroller: uiviewcontroller { var delegatetest : testdelegatemethod? override func viewdidload() { super.viewdidload() } @ibaction func actsubmit(_ sender: any) { delegatetest?.testmethod(value: "hello how you!") } } updat

Retrieve start date and end date of a JIRA sprint using the python JIRA library -

is there way start , end date of sprint in jira using python jira library? can jira.client.resultlist sprints within board of interest using jira.sprints(jira.boards()[<sequence number of board of interest>].id) . list looks this: [<jira sprint: name='lsd sprint 1', id=1>, ... <jira sprint: name='lsd sprint 14', id=14>] could somehow access start , end date each sprint using similar issue.fields returns me jira.resources.propertyholder , can access additional data ? for testing used jirashell ( python-jira 1.0.10 ), jira 6.3.11 , jira 7.2.3 , jira agile rest api v1.0 . ran following code in jirashell : dir(jira.sprints(jira.boards()[0].id)[0]) it prints methods , attributes of sprint object: ['agile_base_rest_path', 'agile_base_url', 'agile_experimental_rest_path', 'greenhopper_rest_path', 'jira_base_url', '_readable_ids', '__class__', '__delattr__', '

python - PyQT5 on mac: determine the screen containing the QMainWindow -

i using mac multidisplay environment, monitors @ different resolutions , want able determine dpi settings of window "holding" qmainwindow, in order set proper scaling matplotlib figures. in real application implement control when window moved, redraw operation detect different dpi settings , show consistent output, right struggling detection. i understood qdesktopwidget class should report screennumber in qwidget open. in appkit can use methods access resolution. however, in following example code reports window open in screen 0 (the main laptop screen), when it's inside external monitor. am missing trivial? in pyqt learning stage, there more obvious ways deal problem, should common enough? from pyqt5.qtwidgets import * pyqt5.qtgui import * pyqt5.qtcore import * import sys import appkit class formwidget(qwidget): def __init__(self,parent): super(formwidget,self).__init__(parent) self.parent=parent self.lblinfo = qlabel(' &#

PHP file is not uploading -

i have form in can upload image. reason not able upload image. have updated file permissions (777 permissions) , still file not upload. form seems working because text (not included in form updating) <form action="manage_content.php?project=5" method="post" enctype="multipart/form-data"> <div class="width"> <p>project image: <br> <input type="file" name="image_file" id="file" class="inputfile" /> <label for="file">choose file</label> </p> </div> <input type="submit" name="update_project" value="update current project"> </form> the php form processing. if (isset($_post['update_project'])) { $required_fields = array("project_name", "date", "content"); validate_presences($required_fields);

javascript - Using document.write removes all other text and displays only the message -

i have question how make there button in 1 column , when click button, text appears in column. overall goal make simple clicker. here code: <html lang="en"> <head> <meta charset="utf-8" /> <title>clicker</title> <meta name="generator" content="bbedit 11.6" /> </head> <body> <table width=600> <tr> <td width=300><span><font size=24px><button onclick='onclick()'> click me </button></span></td> <td sidth=300><span><font size=24px>so this</span></td> </tr> </table> <script> clicks = 0; function onclick () { clicks = (clicks + 1); document.write ("you have clicked button ")

c++ - Linked List Exception Thrown -

i new linked lists , getting error when trying remove 1 of nodes of linked list. exception thrown: exception thrown: read access violation. std::_string_alloc<std::_string_base_types<char,std::allocator<char> > >::_mysize(...) returned 0xddddddf1. occurred code: #include "stdafx.h" #include <iostream> #include <string> using namespace std; struct node { string song, artist; node* next; }; node* add(node *head) { string song, artist; cout << "enter song name:" << endl; getline(cin, song); cout << "enter artist name:" << endl; getline(cin, artist); node *new_ptr = new node; new_ptr->song = song; new_ptr->artist = artist; if (head == nullptr) { head = new_ptr; head->next = nullptr; } else { node *ptr = head; while (ptr->next != nullptr) { ptr = ptr->next; }

java - Hiding sensitive information in response -

i working in project have user model , using rest api fetch list of users. (i have more entities). user has password field. not want include password field in result. excluded in dto. when want create user, want include password in request. spring mvc gets user entity (not dto). i don't think so.... example have event model connected user many-to-many relationship. don't want in request. want user. suggest me do? have kind-of dto? thanks in advance. use @jsonignore access.write_only getter method only example @jsonproperty(access = access.write_only) private string password; wiki

java - How to lookup the thumb of a slider in a controller class for fxml? -

i want customize slider , found working example here on stackoverflow : import javafx.application.application; import javafx.geometry.insets; import javafx.scene.scene; import javafx.scene.control.label; import javafx.scene.control.slider; import javafx.scene.layout.pane; import javafx.scene.layout.stackpane; import javafx.stage.stage; public class sliderwithlabeledthumb extends application { @override public void start(stage primarystage) { slider slider = new slider(); stackpane root = new stackpane(slider); root.setpadding(new insets(20)); scene scene = new scene(root); slider.applycss(); slider.layout(); pane thumb = (pane) slider.lookup(".thumb"); label label = new label(); label.textproperty().bind(slider.valueproperty().asstring("%.1f")); thumb.getchildren().add(label); primarystage.setscene(scene); primarystage.show(); } public stati

java - Jboss 4.2.3 migration to Jboss 7 EAP, datasources and security -

i want migrate several java applications jboss 4.2.3 jboss 7.0.0 eap . for first step, decided migrate datasources. example have such datasource config in 4.2.3: {profile}/deploy/some-ds.xml <local-tx-datasource> <jndi-name>someds</jndi-name> ... <security-domain>encryptedsomedblocalrealm</security-domain> </local-tx-datasource> </datasources> but have noticed datasource credentials encrypted , need migrate security system. there related configs in 4.2.3: {profile}/conf/login-config.xml <application-policy name = "encryptedsomedblocalrealm"> <authentication> <login-module code = "org.jboss.resource.security.jaassecuritydomainidentityloginmodule" flag="required"> <module-option name = "username">user123</module-option> <module-option name = "password">1ad9fnmta/65ufh583zan4</module-option>

java - Spring RestTemplate handle custom status code -

i should call service application can return unusual http status codes, such 230, 240 etc. default error handler i'm getting: servlet.service() servlet [dispatcher] in context path [] threw exception [request processing failed; nested exception org.springframework.web.client.unknownhttpstatuscodeexception: unknown status code [230] null] root cause... when use custom error handler can avoid this: @override public boolean haserror(clienthttpresponse response) throws ioexception { int status = response.getrawstatuscode(); if (status >= 200 && status <= 299) return false; httpstatus statuscode = response.getstatuscode(); if (statuscode.is2xxsuccessful()) return false; httpstatus.series series = statuscode.series(); return (httpstatus.series.client_error.equals(series) || httpstatus.series.server_error.equals(series)); } but when resttmplate tries retrieve falls s

css - What is the difference among col-lg-*, col-md-* and col-sm-* in Bootstrap? -

what difference among col-lg-* , col-md-* , col-sm-* in twitter bootstrap 3? the bootstrap 3 grid comes in 4 tiers (or "breakpoints")... extra small (for smartphones .col-xs-* ) small (for tablets .col-sm-* ) medium (for laptops .col-md-* ) large (for laptops/desktops .col-lg-* ). these grid sizes enable control grid behavior on different widths. different tiers controlled css media queries . so in bootstrap's 12-column grid... col-sm-3 3 of 12 columns wide (25%) on typical small device width (> 768 pixels) col-md-3 3 of 12 columns wide (25%) on typical medium device width (> 992 pixels) the smallest tier set ( xs , sm or md ) defines size larger screen widths. so, same size column on tiers, set width smallest viewport... <div class="col-lg-3 col-md-3 col-sm-3">..</div> same as, <div class="col-sm-3">..</div> because col-sm-3 means 3 units on sm , up , unless overridden larg

python - Webapp2 temp pytesseract with AppEngine -

the algorithm process deleting captcha lines saves in temp_cap variable , use pytesseract read characters not allow me error of 'input_file_name ='% s.bmp '% tempnam ()', using webapp appengine suggestion give me? def bypass(type,dni): session = requests.session() if type=='xxx': cnn =session.get('https://zyz.xzy.duh.ye/val/codigo.do') img=image.open(string.stringio(cnn.content)) img = img.convert("rgba") pixdata = img.load() y in xrange(img.size[1]): x in xrange(img.size[0]): red, green, blue, alpha=pixdata[x, y] if blue<100: pixdata[x, y] = (255, 255, 255, 255) temp_cap=pytesseract.image_to_string(img) temp_cap=temp_cap.strip().upper() captcha_val='' in range(len(temp_cap)): if temp_captcha_val[i].isalpha() or temp_cap[i].isdigit(): captcha_val=capt+temp_ca

html - Background Image Only Showing White Background CSS -

i'm veteran css , html, never before have seen problem. have background image, css, , html files placed properly. believe have code right since checked against site made, image not appear anything. css body { background-image: url(am-stage.png); background-repeat: no-repeat; background-color: black; background-size: 100% 100%; } html <!doctype html> <html> <head> <meta charset="utf-8"> <title> </title> <link rel="stylesheet" type="text/css" href="css.css"> </head> <body> </body> </html> edit: chrome giving error saying css file can't found. not sure why though. css in same directory html , image. i figured out, sublime wasn't saving css css file. told save css, wasn't adding extension time reason. chose css , manually put in .css @ end , it's working. wiki

pypi - How to develop python modules locally? -

if have module i.e modulea, , have moduleb depends on modulea, , want modifications modulea , moduleb. we both own modulea , moduleb, how actively develop against both if both being changed? should using requirements-dev.txt points fork of modulea in moduleb. ensure isn't committed source control, , have requirements.txt point artifact in our private pypi instance? thanks, sriram wiki

sql - Check constraint on Oracle compare sum to other table value -

i using oracle 11.2 db , have 3 tables: project_employee |id (pk) | p_id |e_id |month |capacity| |--------|------|------|--------|--------| |1 |1 |1 |201701 |0.4 | |1 |1 |2 |201701 |0.6 | |1 |2 |1 |201701 |0.4 | employee |id (pk) | maxcapacity | |----------|---------------| |1 | 0.8 | |2 | 0.6 | project |id (pk) |other columns| |----------|-------------| |1 |some data | |2 |some data | furthermore have check constraint check wether combination (p_id, e_id. month) of table project_employee unique. now not want can insert data table project_employee , if sum of capacity employee in 1 month greater maxcapacity specific employee of table employee . e.g. in example above: should not able insert row 201701 employee 1 nor 2. is prossible solve check constraint? a check constraint abl

SELECT nearest under or equal to X based on SUM amount SQL Server -

i have 2 tables: declare @tbitems table (accntno varchar, saved_amount decimal) insert @tbitems select 001 , 25 declare @tbtransact table (idno int , acctno varchar, amount decimal) insert @tbtransact select 1 , 001 , 10 union select 2 , 001 , 10 union select 3 , 001 , 10 union select 4 , 001 , 10 tbitems : accntno | saved_amount (decimal) --------+----------------------- 001 | 25 tbtransact : idno | acctno | amount (decimal) ------+---------+----------------- 1 | 001 | 10 2 | 001 | 10 3 | 001 | 10 4 | 001 | 10 how nearest idno less or equal saved_amount tbitems adding tbtransact amounts ordered idno (i don't know how in words). anyway based on table, expected result should idno 2 since nearest under 25 20 if in java, loop through tbtransact add every row until go higher saved_amount idno before current one. have no idea how in sql. expected result is: idno | acctno | amount ------+---------+---------

php - SQL : if and count doesent count second id -

Image
i made query using if statement.its working in following database. select date, if(id <= 5, count(*), 0)*5 + if(id >= 6 , id <=8, count(*), 0)*4 + if(id >= 9 , id <=10, count(*), 0)*5 total prepare_test group date but problem when doesent count 2nd id select date, if(id >= 2 , id <= 5, count(*), 0)*5 + if(id >= 6 , id <=8, count(*), 0)*4 + if(id >= 9 , id <=10, count(*), 0)*5 total prepare_test group date it return zero. plese suggest query this. if have other method please briefly. assuming want count number of rows having id < 2 , total number of rows, can achieved using 2 queries: select count(*) less_than_2 plugin id < 2 and select count(*) total plugin or can both values using single query: select sum(if(id < 2, 1, 0)) less_than_2 count(*) total plugin wiki

parsing - Python parse only specific parts of text file -

i have text file containing lots of data looks this: logstart . . . (chunk of data) logend . . . logstart . . . (chunk of data) logend . . . times logstart . . . (chunk of data) logend . . . times logstart . . . (chunk of data) logend . . . i want python code open file , read chunks of data if , if there "times" associated right below "logend". if there no times chunk want ignore it. , when reads correct chunks of data want read times associated it. this had before realized needed extract parts (which saved entire text file 'lines'): lines = [] open(filename, 'rt') in_file: line in in_file: lines.append(line) how can change 'lines' specific parts of file? something this: lines = [] open(filename, 'rt') in_file: chunk = [] line in in_file: chunk.append(line) if(line.find('times')>=0): lines.extend(chunk) if(line.find('logstart')>=0):

android - How to implement thumb RangeSeekbar for height in feet and inches -

i want implement thumb rangeseekbar height height in feet , inches. absolute min value 4.1 , absolute max value 6.12. have done there 1 problem range should not go above 4.12, 4.13. , on. in 4.11 next range 5 not 4.12, can solve issue. below xml code <com.yahoo.mobile.client.android.util.rangeseekbar.rangeseekbar android:id="@+id/rangeseekbar" android:layout_width="fill_parent" android:layout_height="wrap_content" rsb:absolutemaxvalue="6.12" rsb:absoluteminvalue="4.1" /> below java code public class mainactivity extends appcompatactivity { button submitbutton; float i; float j; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); submitbutton=(button)findviewbyid(r.id.submitbutton); setsupportactionbar(toolbar);

python - optparse doesn't collect all values passed to an option -

i'm working on simple portscanner, , want program take 2 options when executed command shell. in general can executed shell since options absolutely required program. i want options be: -h : host ip address -p : list of ports should scanned here problem: want ports separated comma , blank, in example of starting program: d:\localuser\mypython\portscanner>c:\users\localuser\appdata\local\programs\pytho n\python35-32\python.exe portscanner_v0.0.py -h 192.168.1.1 -p 21, 1720, 8000 unluckily seem not collected program, first value of second option gets read variable in code. i'm using optparse , python 3.5, please tell me how ports shell. here code: def portscan(tgthost, tgtports): #doing port scans #wont show actual code here, it's working fine def main(): parser = optparse.optionparser('usage%prog ' + ' -h <target host> -p <target port>') parser.add_option('-h', dest='tgthost', type='stri

c++ - Should I use smart pointers in this situation? -

i know go-to rule use shared_ptr s or other smart pointers. however, i'm not sure how implement without copy ctor'ing std::make_shared . i'll elaborate: the problem i want create tree-like expression, like: struct foo{ std::vector<foo*> v; }; this allows me following: foo add(foo& f1, foo& f2){ return foo {&f1, &f2}; } that's good, because 2 become children of new node. i want following evaluated correctly: foo x, y; auto z = add(x,y); assert(z.v[0] == &x && z.v[1] == &y); this way, there's no copying , it's good. however, have resource management issue here. addressing resource management issue if these elements allocated on heap, , unknowingly might, we'll run memory leak. best way use smart pointers raii: struct foo{ std::vector<std::shared_ptr<foo> > v; }; foo add(foo& f1, foo& f2){ return foo {std::make_shared<foo>(f1), std::make_shared<foo>

ios - View not displaying for childViewController of another ChildViewController -

Image
i'm having issue multi-level hierarchy of childviewcontrollers in ios/swift. there 3 layers current setup lowest-to-highest: infoviewcontroller selectionviewcontroller mainviewcontroller the infoviewcontroller has view loaded xib. selectionviewcontroller contains uistackview infoviewcontroller , uibutton . mainviewcontroller top-level vc embedded in uinavigationcontroller . the problem when add infoviewcontroller , it's view directly mainviewcontroller works great. func setupinfoviewcontrollerdirectlyonmainvc () { addchildviewcontroller(infoviewcontroller) infoviewcontroller.view.embedinside(otherview: infocontainerview) infoviewcontroller.didmove(toparentviewcontroller: self) } however, if add selectionviewcontroller mainviewcontroller using same method, embedded infoviewcontroller doesn't update it's ui - looks untouched xib file controlling. when not embedded in selectionviewcontroller behaves expected. as shown below

php - Prepared Statement - Mysql query result fetched into the array -

i implementing prepared statement fetching query result array seems wrong in fetch array line. <?php $cat_id = intval($_get['cat_id']); include '../sys/conn.php'; if($category= $conn->prepare(" select t.term_id, t.name, t.slug, tm.term_id, tm.name, count(tr.object_id) total_products mg_terms t join mg_term_taxonomy tx on tx.term_id = t.term_id left join mg_term_relationships tr on tr.term_taxonomy_id=tx.term_taxonomy_id left join mg_terms tm on tm.term_id = tx.parent t.term_id=? group t.term_id")) { $category->bind_param('i', $cat_id); $category->execute(); $category->bind_result($cat_id, $cat_name, $cat_slug, $par_id, $par_name, $count); $category->fetch(); $array = $category->fetch_array(mysql_num); //line error $category->close(); } the error have is: fatal error: call undefined method mysqli_stmt::fetch_array() any idea? you have learn php oop.. , whatever need in simple way..

Show JSON data as selected in Select AngularJS -

i don' have lot of knowledge angularjs. have json data , first created select , according selected option show data or others according value, ids in json json $scope.players = [ { "player": { "info": { "position": "d", "shirtnum": 4, "positioninfo": "centre/right central defender" }, "nationalteam": { "isocode": "be", "country": "belgium", "demonym": "belgian" }, "age": "27 years 139 days", "name": { "first": "toby", "last": "alderweireld" }, "id": 4916, "currentteam": {

sql server - How to remove the " in parameter with " in the value -

i have sql query string passing size value (1") strsql = @"select * dbo.model '" + strmodel + "'" datedeleted > getdate()" the value strmodel going in '1\"' how remove \ passed value. the value setting strmodel strmodel = convert.tostring(dgvsheetdata.rows[i].cells[4].value); wiki

javascript - How to size a DIV between two fixed attributes -

quick question. i have 2 navigation bars on site i'm working on. first fixed-height bar running width of screen on top of page, second fixed-height bar running width of screen on bottom of page. is there way make content div between them resize based on percentage of remaining space, rather percentage of total page size? window shrunk vertically, content div in middle resize accordingly while 2 bars stay same size. any appreciated! here 2 of commonly used methods this: 1. calculate content's size subtracting header + footer height using calc html, body { height: 100%; } .bar { background: #ccc; height: 50px; } .content { background: #aaa; height: calc(100% - 100px); } <div class="bar">header</div> <div class="content">content</div> <div class="bar">footer</div> 2. use vh (viewport height) units calculate layout out of 100vh .bar { backgroun

ios - How to get my UIPageViewController to load the correct index? Swift 3 -

this first post, open feedback if can improve question. i have been studying swift year , trying build app uses uipageviewcontroller make app mimics experience of book. user able create many pages want. now, have template uiviewcontroller imageview , textview. user presses "+" button add next page, should appear pre-set blank imageview (that can set) , blank textview. specs: i'm persisting user information coredata. the problem: create new set of pages. add image , text. tap "+" , same on next page. when tap "+" after that, next page , each page after copies image , text previous page rather being empty page. here logic how pages should run. extension bookpageviewcontroller: uipageviewcontrollerdatasource { func pageviewcontroller(_ pageviewcontroller: uipageviewcontroller, viewcontrollerbefore viewcontroller: uiviewcontroller) -> uiviewcontroller? { guard let viewcontrollerindex = storypageviewcontrollers.index(of: viewcont

c# - CS1513 } expected Line 17 -

alright. i've looked through of questions on here have error , looked on code @ least 10 times can't find error. bot discord server automate little better. i've counted semicolons, brackets, etc, , can't find problem is. it's saying cs1513 } expected line 17 i've looked , looks fine. other bot running fine, 1 doesn't seem me. line 17 { under public mybot() . namespace dexter { class mybot { discordclient discord; public mybot() { discord = new discordclient(x => { x.loglevel = logseverity.info; x.loghandler = log; }); discord.executeandwait(async () => { await discord.connect("inserttokenhere", tokentype.bot); }); } private void log(object sender, logmessageeventargs e) { console.writeline(e.message); } } } wiki

android - Display property in Python Kivy -

i have been watching tutorial kivy , python creating calculator, i've seen property: display value of widget id. value can access other properties of widget. here code (.kv file): <calcgridlayout>: id: calculator display: entry #this display property rows: 5 padding: 10 spacing: 10 boxlayout: textinput: id: entry #with value of font_size: 32 multiline: false boxlayout: spacing: 10 button: text: "7" on_press: entry.text += self.text button: text: "8" on_press: entry.text += self.text button: text: "9" on_press: entry.text += self.text button: text: "+" on_press: entry.text += self.text boxlayout: spacing: 10 button: text: "4" on_press: entry.text += self.text butt

Google Analytics and cookies -

my question is: i'm developing website , want monitor analytics google analytics, i've been reading articles cookies , didn't realize if need program website kind of cookies in order use google tool, or if don't need on website. thanks to tracking need insert code snippet can ga admin interface. however since in eu need point out visitors being tracked on web page , site uses cookies (and think need provide opt-out, although might german thing). mandated european privacy directive, referred "cookie law" (technically incorrect, since neither law nor cookies), maybe gave idea need programming. wiki

java - How to handle nested exceptions without dropping any information? -

often have kind of pattern: (fictional example) public void saveimage(image image) throws imageserviceexception { try { savetodatabase(image); //private method saving image's meta data (id, name, infos etc.) savetofile(image); //private method saving image's raw binary data } catch(sqlexception ex) { throw new imageserviceexception("could not save image database", ex); } catch(ioexception ex) { try { deletefromdatabase(image); } catch(sqlexception deletionex) //exception ignored !!! { throw new imageserviceexception("could not save image on disk , not delete image database", ex); } throw new imageserviceexception("could not save image on disk, database has been cleaned up", ex); } } i'm trying save database infos image , save image on disk. if fails saved on disk, want rollback did in database. if

python 2.7 - wget2 - works in bash shell but not on windows -

i'm using python 2.7.13 , executing script sublime text 3 on windows 10. i use wget download files use wget2 instead. i've compiled code here wget2.exe: https://github.com/rockdaboot/wget2 when run script sublime text works expected , file downloaded. from subprocess import call wget_path = "x:/wget.exe" filetodownload = "http://192.168.1.181/media/test_01.mov" destinationfile = "x:/thing.mov" call([wget_path, filetodownload, "--output-document=" + destinationfile]) if switch wget.exe wget2.exe nothing happens , script finishes. have wget2.exe in same directory wget.exe. if use mysys2 bash shell, can run wget2.exe there cd'ing it's directory , typing out entire command. when try doing same in windows command prompt wget.exe works wget2.exe doesn't. nothing , gives no feedback. what need wget2 work script? wiki

sql server - RSQLServer: Cannot begin a nested transaction after dbRollback -

background in database have uniqueness constraints. if data breaks 1 of conditions, error message violation of unique key constraint . i use trycatch in code, capture error , return meaningful message user. far good. however, if try run new transaction on server after having captured error, error message saying cannot begin nested transaction. my findings i traced error down, , figured when dbrollback called (either explicitly, or within withtransaction ) 1 cannot submit new dbbegin anymore (either explicitly or implicitly via dbwritetable , friends). what need unstuck, run dbcommit , allowed run dbbegin . looking @ code of dbcommit , dbrollback see in former case setautocommit set true, signals dbbegin not nesting transactions. not case dbrollback : getmethod("dbcommit", "sqlserverconnection") # method definition: # # function (conn, ...) # { # rjava::.jcall(conn@jc, "v", "commit") # rjava::.jcall(conn@jc,

iis 7 - .NET version vs build number -

on test server running windows server 2012, in windows\microsoft.net\framework folder, see several folders, highest version# 4.0.30319 how can tell if have 4.6 framework installed? also, 4.6 framework still considered part of 4.0 framework? if 4.6 installed, shows when go set framework app pool in iis? wiki

javascript - Ember.JS change handlebars operators -

is possible change way handlebars mustache binding working within ember? case want use ember within metalsmith.io static site builder using handlebars, when template being built {{ }} binding being interpreted handlebars instead of ember. my template: <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml" dir="ltr" lang="en-us"> <head> {{> header }} <title>{{ title }}</title> <meta name="description" content="{{ description }}"> <!-- typekit javascript -->{{> typekit }} </head> <body class="stretched no-transition"> <!-- document wrapper ============================================= --> <div id="wrapper" class="clearfix"> <div id="header-trigger"><i class="icon-line-menu"></