Posts

Showing posts from March, 2011

asp classic - Format a date time string -

im having problem formatting datetime field in asp classic. format need yyyy-mm-dd hh:mm:ss code far: changetodate = cdate(request.form("datepicker")&" "&request.form("timepicker")) datetime = datepart("d", changetodate)&"-"&datepart("m", changetodate)&_ "-"&datepart("yyyy", changetodate)&" "&datepart("hh", changetodate)&":"&_ datepart("mi", changetodate)&":00" but gives me invalid procedure call datepart exception. i'm kind of stuck on this. not sure if matters or not doing can insert datetime database. when use cdate function following error:conversion failed when converting date and/or time character string. query looks cdate function called: insert mytable(client ,campaign ,location ,cardcode ,created ,message ,rating ,info ,mobile ,datamessage ) values (117,227,1487,...

javascript - Pass flags to Python Script from Node/Express app python-shell -

i trying figure out how pass flags python script node/express application. when in command line execute script running: python ndbc.py --buoy 46232 i using python-shell module, think should allow me this, not entirely sure how works. python-shell documentation: https://github.com/extrabacon/python-shell#running-a-python-script-with-arguments-and-options adapted readme, should work: var pythonshell = require('python-shell'); var options = { args: ['--buoy', '46232'] }; pythonshell.run('ndbc.py', options, function (err, results) { if (err) throw err; console.log('results: %j', results); });

excel - VBA Index/Match with multiple criteria (unique value & date) -

i have spreadsheet has values more 1 month, trying first find value based on value in wsrevfile worksheet , ensure value last month. when use following code, "invalid number of arguments" error. sub revlookup(wsmvfile worksheet, wsrevold worksheet, wsnewrev worksheet, _ rowcount integer, workcol string, _ srccol1 integer, srccol2 integer) dim vrw variant, long = 2 rowcount vrw = application.match(wsrevfile.range("a" & i), wsnewrev.columns(2), format(dateserial(year(date), month(date), 0), "mm/dd/yyyy"), wsnewrev.columns(1), 0) if iserror(vrw) vrw = application.match(wsrevfile.range("a" & i), wsrevold.columns(1), 0) if not iserror(vrw) _ wsrevfile.range(workcol & i) = application.index(wsrevold.columns(srccol1), vrw) else wsrevfile.range(workcol & i) = application.index(wsnewrev.columns(srccol2), vrw, 1) end if next end sub ...

python - What other things i need to complie python2.7.5 from source on commandline -

i want compile python2.7.5 source. ran many troubles. , people had use option or option while compiling. need use django mod_wsgi know need use option ./configure --enable-shared make make install i want know there other option can add don't need recompile it. longs not harm ready install want know main things not avaialble default may need those i using django , webserver apache , nginx etc web site hosting or postgresql etc . centos 6.4 os edit: comon guys should have told me --with-ssl . wasted 10 hours

java - Maven can't find web.xml -

i'm getting following error when building maven-project command mvn clean install [error] failed execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project myproject: error assembling war: webxml attribute required (or pre-existing web-inf/web.xml if executing in update mode) i have web.xml in project. in folder web/web-inf/web.xml i using intellij idea. can avoid problem adding following pom.xml: <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-war-plugin</artifactid> <configuration> <failonmissingwebxml>false</failonmissingwebxml> </configuration> </plugin> </plugins> </build> but i'd know why maven claims web.xml missing though it's not , in default location when creating new web application project in intellij idea. ...

ios - adding objects to unknown sized array, not orderly -

i trying find structure or way adding objects array array. clarify; actualarray[] // size not specified smtharray[1,9,8,4,9] i want add objects smtharray actualarray 5th index. that, actualarray[,,,,,1,9,8,4,9] second times can add object begging. that, actualarray[1,9,8,4,9,1,9,8,4,9] what kind of structure need achieve ? note: nsset doesn't fit purpose because care actualarray orders. if understand correctly, trying use insertobjects:atindexes: perform first step of description (so elements begin @ index 5). cannot nsmutablearray because not support empty elements. here relevant discussion apple documentation (see https://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/classes/nsmutablearray_class/index.html#//apple_ref/occ/cl/nsmutablearray ): note nsarray objects not c arrays. is, though specify size when create array, specified size regarded “hint”; actual size of array still 0. means cannot insert object @ index grea...

apache camel - How to use $header in routes -

i'm creating route using java dsl in camel. i'd perform text substitution without creating new processor or bean. i have this: .setheader(my_thing, constant(my_template.replace("{id1}", simple("${header.subs_val}").gettext()))) if don't add 'constant' type mismatch errors. if don't put gettext() on simple() part, text mismatch answers. when run route, replaces {id} literal ${header.subs_val} instead of fetching value header. yet if take quotes off, compile errors; java doesn't know ${...} syntax of course. deployment takes few minutes, experiments expensive. so, how can simple substitution. nothing finding on web seems work. edit - template? specifically, string (it's url) http://this/that/{id1}/another/thing i've inherited code, unable to(...) url , apply special .tof() (??) formatting. interesting case! if place my_template in header use nested simple expression(camel 2.9 onwards) in ex...

Why is floating point value saved incorrectly in MySQL? -

we saved value of 2.01 in float column in mysql. then, after applied avg function, returned 2.009999990463257 why happening? here query using: select avg(height) `students` class='b1'

java - Checking if String entered is a binary numer, getting incorrect output -

i trying write program check if user-entered string binary number, , if is, output number of 1s in number. had working fine integer value, since int can't hold more 2 billion or whatever max value is, trying rewrite work strings. as of right now, number enter output "number entered not binary." , when enter 0, stringindexoutofboundsexception. novice programmer, forgive obvious errors may have missed, asking possible solution problem or push in right direction. here code (after trying make work strings rather integers): import java.util.*; public class binaryhw { public static void main(string[] args) { scanner kb = new scanner(system.in); system.out.println("enter binary number: "); string bin = kb.nextline(); //the method used check whether or not user entered binary //number requires changing value of 'bin'. //therefore, 'origbin' set equal 'bin' later use. string origbin = bin; int count = 0; ...

Why this function is not working? PHP -

this original function , works perfectly... function delete_directory($dirname) { if (is_dir($dirname)) $dir_handle = opendir($dirname); if (!$dir_handle) return false; while ($file = readdir($dir_handle)) { if ($file != "." && $file != "..") { if (!is_dir($dirname."/".$file)) unlink($dirname."/".$file); else delete_directory($dirname.'/'.$file); } } closedir($dir_handle); rmdir($dirname); return true; } i tried version curly braces , different names not working , i'm not sure problem is function borrar_directorio ($carpeta) { if (is_dir($carpeta)) { $abrir_directorio = opendir($carpeta); if (!$abrir_directorio) { return false; } } while ($archivo = readdir($abrir_directorio)) { if ($archivo != "." && $archivo != "..") { if (!is_dir...

excel - VBA Range and String confusion -

think i'm having problem difference between ranges , strings. trying search cells in range of winners spit out point value. sub it() dim round1 range dim round2 range dim lngcnt long dim winner() string dim pointsum double redim winner(1 4) winner(1) = "mohler" winner(2) = "scotter" winner(3) = "dkgay" winner(4) = "lassie" set round1 = range("l3,l11,l22,l32").text each winner in round1 lngcnt = lngcnt + 10 winner(lngcnt) = pointsum.value next msgbox pointsum.value end sub you need 2 loops: sub it() dim round1 range dim round2 range dim lngcnt long dim winner() string dim pointsum double dim rng range dim long redim winner(1 4) winner(1) = "mohler" winner(2) = "scotter" winner(3) = "dkgay" winner(4) = "lassie" set round1 = range("l3,l11,l22,l32") each rng in round1 = 1 ubound(winner) if rng.value = winner(i) ...

javascript - Angularjs - Fire Http Post On Tab/Browser Close -

goal i using idle timer found on github see if users afk webapp. https://github.com/hackedbychinese/ng-idle it works , have no issues it. unable set users away if close browser or leave site. therefore need way detect if navigate site not apart of site , if close browser or tab site on. code below works still happens if redirect different page on site var exitevent = window.attachevent || window.addeventlistener; var chkevent = window.attachevent ? 'onbeforeunload' : 'beforeunload'; exitevent(chkevent, function (e) { dashboardservice.setidle(); var confirmationmessage = ' '; (e || window.event).returnvalue = "are sure you'd close page?"; return confirmationmessage; }); code below doesn't work $window.onbeforeunload = function () { dashboardservice.setidle(); } could not find way tell if browser has closed user. instead timeout created disassoicate u...

javascript - filling data from one html to another html file -

i getting few records database (from rest call). have separate page update record. on display-all-recs page, once click on recid, want open data update page. i using angular in front end. have make more call? (i don't want have data displayed in table) is there way can fill update page existing values statically?

gsm - Identify provider using Asterisk -

i want set asterisk , recognize call incoming, or provider is. if home phone line, redirect ivr. if comes cellphone line, redirect corresponding gsm line, in order reduce costs, since same provider phone call free in country. is possible? yes! depends on how incoming call being presented. if pstn/pots need ensure fxo card supports regions caller id system. if sip or ip based trunk included in headers. if have @ answer here give basic idea of can matching patterns or complete caller id's. otherwise can of thinking of in question.

php - Place a default email address in when a custom form field is left blank -

i want place default email address in when custom form field left blank. can't code right. use email address in place of real email address. <?php if(get_field('cemail')) { ?> <?php $email = (get_field('cemail')); if($email!=""){ echo 'email address' ; } ?> you can like; <?php $email = $_get["email"]; if($email=="" || !filter_var($email, filter_validate_email) === false) $email = "default_email@email.com"; echo $email; ?>

python - Sklearn matplotlib coloring clusters by unique values in figure and showing labels that correspond to these cluster colors -

i want set label/legend correspond colors of clusters after running pca. ex. here clusters colored value 1-4. **see attached image 1) want have legend shows group of values correspond 1-4 value. tried np.unique() , did not work. 2) also, coloring clusters lets bmi, how can set range group them , still show legend of color ranges? data = pd.read_table('test.txt', header=none) data.columns = ['age', 'score', 'asa', 'bmi'] pandas.tools.plotting import scatter_matrix #_ = pd.scatter_matrix( data, figsize=(30,30)) pca = pca(n_components=data.shape[1]) pca.fit(data) data_pca = pca.transform(data) fig = plt.figure( figsize=(24,8)) ax1 = fig.add_subplot(131) ax2 = fig.add_subplot(132) ax3 = fig.add_subplot(133) ax1.scatter( data_pca[:,0], data_pca[:,1], alpha=0.5, s=25, c=data.asa) ax2.scatter( data_pca[:,2], data_pca[:,1], alpha=0.5, s=25, c=data.asa) ax3.scatter( data_pca[:,2], data_pca[:,3], alpha=0.5, s=25, c=data.asa,label=np.uni...

sql - `GROUP BY` expression -

i got error message: msg 164, level 15, state 1, line 18 each group by expression must contain @ least 1 column not outer reference below tsql: declare @client_count int select @client_count=count(clt_nbr) client select case when status=3 'category1' else 'category2' end category ,count(*) count ,@client_count [total client] ,count(*) / @client_count percentage client_status status in (3,8) group status,@client_count can me fix it? thank you!

win universal app - Marshal.GetLastWin32Error() throws Access Denied in UWP C# -

i have below code in uwp app public static class deviceiocontrolhelper { [dllimport("kernel32.dll", setlasterror = true, charset = charset.ansi)] private static extern safefilehandle createfile( string lpfilename, [marshalas(unmanagedtype.u4)] fileaccess dwdesiredaccess, [marshalas(unmanagedtype.u4)] fileshare dwsharemode, intptr lpsecurityattributes, [marshalas(unmanagedtype.u4)] filemode dwcreationdisposition, [marshalas(unmanagedtype.u4)] fileattributes dwflagsandattributes, intptr htemplatefile); public static safefilehandle returnfilehandler() { const string drive = @"\\.\lcd"; safefilehandle hddhandle = createfile(drive, fileaccess.read, fileshare.none, intptr.zero, filemode.open, fileattributes.normal, intptr.zero); if (hddhandle.isinvalid) { int lasterror = marshal.getlastwin32error(); ...

Android permission doesn't work even if I have declared it -

i'm trying write code send sms android app, when try send sms sends me error: 09-17 18:37:29.974 12847-12847/**.**.****e/androidruntime﹕ fatal exception: main process: **.**.****, pid: 12847 java.lang.securityexception: sending sms message: uid 10092 not have android.permission.send_sms. @ android.os.parcel.readexception(parcel.java:1599) @ android.os.parcel.readexception(parcel.java:1552) @ com.android.internal.telephony.isms$stub$proxy.sendtextforsubscriber(isms.java:768) @ android.telephony.smsmanager.sendtextmessageinternal(smsmanager.java:310) @ android.telephony.smsmanager.sendtextmessage(smsmanager.java:293) @ **.**.****.mainactivity$3.onclick(mainactivity.java:70) @ android.view.view.performclick(view.java:5198) @ android.view.view$performclick.run(view.java:21147) @ android.os.handler.handlecallback(handler.java:739) @ android.os.handler.dispatchmessage(handler.java:95) @ android...

for loop - Need help assigning .txt characters into a 2d array. C++ -

i'm working on school project involves taking pre-designed 25x25 maze .txt file , inputting 2 dimensional array, printing onto console , moving character through maze. main issue i'm having moving characters array. feel i'm close code have causes program crash. here's loop i'm using move characters array: int col=0; ifstream infile; infile.open("maze.txt"); char temp = infile.get(); while(!infile.eof()) { for(int row=0; row<25; row++) { while(temp != '\n') { boundary[row][col] = temp; col++; temp=infile.get(); } temp=infile.get(); } } infile.close(); essentially, point move both spaces , block characters 25x25 character array taking characters in each row same row of array until reaches new line character, should move next character on next row , start while loop again. it compiles fine, program crashes before can move other code. if know how fix without ...

sonarlint - Sonar Lint eclipse plugin project report -

i have sonar lint eclipse plugin installed on eclipse. plugin working perfectly, need run sonar checks not on single file, on whole project. i did research , learned cli interface of sonar can achieve such thing , can generate html report, 1 reason or other documentation not obvious it. any or direction appreciated. in ides, sonarlint focuses on analyzing files edited, catch issues possible. idea prevent new issues introduced, more detect existing problems. sonarlint cli designed check issues on projects not using supported ides, before committing code. analyzing files not supported might implemented later @ point. currently, concentrated in making sonarlint eclipse efficient possible in analyzing code edited.

ios - Loading Process- Different UILabels -

in app have uibutton , when tap have uiactivityindicatorview , want add diffrent ui labels loads. not real loading process looks. how go doing this? step 1: create custom uiview (u can xibs if want). view should have second uiview container in it. when init view set same size viewcontroller putting in. background color transparent (or black lower alpha if want have greyed out effect). set container actual size want appear. step 2: put uiactivityindicatorview , uilabel in container. lay out how like. step 3: write label updating method uses timer. either performselector:afterdelay: or dispatch_after. have method set label text, wait period of time, change text, wait period of time, change again , on. step 4: write showindicator() , hideindicator() methods. view , container's hidden property should set true. when showindicator() called set hidden false , call label updating method step 3. when you've reached end of label changes set hidden = true it ...

python - Pandas & NumPy on Pythonista iPad App -

is pythonista viable tool data analysis? i'm looking learn python can break qa @ company, , i'm debating whether should go mac , sublime text, or ipad pro , pythonista. if want make data analysis, should make computer. power tablet not enough make analysis.

Yii2 fixtures not unloading, not loading with dependencies -

unloading issue i'm trying create fixtures in yii2 able fill tables test data. i'm not using codeception yet. i'm following yii2 guide on fixtures. first table user table: namespace tests\unit\fixtures; use yii\test\activefixture; /** * user fixture */ class userfixture extends activefixture { public $modelclass = 'common\models\user'; } this 1 works when ssh vagrant , load fixture, entries still there after unload. according terminal output fixture unloaded. missing here? should work out of box or should create own unload function? edit: did adding user fixture: public function unload(){ parent::unload(); $this->resettable(); } i expect present in unload anyhow, have read (very slow) discussion in link posted below. don't know if parent::unload() line necessary, worked without line, baseactivefixture defines , empties $this->data , $this->_models. depends issue my second fixture depends on user fixture: namespace tes...

java - What's the best way to sum two Map<String,String>? -

i have following maps. map<string,string> map1= new hashmap<string, string>(){{ put("no1","123"); put("no2","5434"); put("no5","234");}}; map<string,string> map1 = new hashmap<string, string>(){{ put("no1","523"); put("no2","234"); put("no3","234");}}; sum(map1, map2); i want join them one, summing similar keyed values together. what;s best way using java 7 or guava libraries ? expected output map<string, string> output = { { "no1" ,"646"}, { "no2", "5668"}, {"no5","234"}, {"no3","234" } } private static map<string, string> sum(map<string, string> map1, map<string, string> map2) { map<string, string> result = new hashmap<string, string>(); result.putall(map1); (string ...

Python 2.6 : Using caldav and carddav libs at the same time -> lxml ImportError -

i'd create simple access baikal caldav/carddav server read address book , calenders entries. no update required, read-only! whole thing must run python 2.6 (win32) - not 2.7 or 3.x. i found these packages: caldav: https://pypi.python.org/pypi/caldav/0.4.0 carddav: https://github.com/ljanyst/carddav-util well have dependencies installed , both use lxml. installed this: https://pypi.python.org/pypi/lxml/3.6.0 but running simple program using both libs (carddav, caldav) encounter following error: file "c:\python26\lib\site-packages\carddav.py", line 46, in <module> import lxml.etree et importerror: dll load failed: die angegebene prozedur wurde nicht gefunden. so seems although lib lxml latest release not work carddav.py! i tried older versions of lxml - e.g. 2.2.4 - , seems work?! what has changed , how work around issue? use lxml 3.60! note python26 , libs win32. thank you!

javascript - When is it necessary to use the Object.assign() method to copy an instance of an object? -

the following example scenario made own practice of problem. if want skip straight technical details, please see 'technical details' below. i have personal project i've been working on learn javascript. basically, user can design shoe picking available options. the trick left , right shoe must have same size, among other properties, things color, shoe lace texture, etc. can independent properties per shoe. (i figured decent way me practice object manipulation , inheritance). the user starts off designing right shoe; when "swap" button clicked @ left shoe, user sees copy of right shoe (but inverted). only on first swapping of shoes left shoe generated , made exact copy of right shoe. onwards, unique options per shoe orientation preserved. then, if user makes specific changes that left-shoe model, , switches right shoe, user supposed see exact same right shoe had designed before clicked "swap" button. so if right shoe had red laces, switch ...

java - Determine if a number is power of 4, logNum % logBase == 0 vs (logNum / logBase) % 1 == 0 -

problem: check if number power of 4. my solution in java: public static boolean ispoweroffour(int num) { return (math.log(num) % math.log(4) == 0); } but seems off in cases, example when num 64. i found out if change code little bit, works well. public static boolean ispoweroffour(int num) { return (math.log(num) / math.log(4) %1 == 0); } i think both solutions same thing, check if remaining of lognum/logbase 0. why first solution doesn't work? because solution incorrect or relative low level jvm stuff? thanks. building on @dasblinkenlight's answer, can combine both conditions (first, power of 2, power of 4 among possible powers of 2) simple mask: public static boolean ispoweroffour(int num) { return ((( num & ( num - 1 )) == 0 ) // check whether num power of 2 && (( num & 0xaaaaaaaa ) == 0 )); // make sure it's power of 2 } no loop, no conversion float.

Key size change for leveldb -

we using leveldb indexing data blocks disks , use 1 leveldb instance per disk. keys index fingerprint existing in key historical reasons (not known me) planning rid of fingerprint suffix key (as concluded can maintain uniqueness of key inode , page_offset). the issue upgrade older version newer version, need maintain 2 indexes brief time till first index becomes free. question is, there way use same old index , change key size new key insertions , use old keys ignoring suffix part during lookups ? please let me know if question not clear. you can work on leveldb::options.comparator , default leveldb::bytewisecomparatorimpl . example can define class named ignoresuffixcomparatorimpl : #include "leveldb/comparator.h" class ignoresuffixcomparatorimpl : public comparator { ... virtual int compare(const slice& a, const slice& b) const { return removesuffix(a).compare(removesuffix(b)); } ... } then, when init db, can use new comparator: ...

How to merge new buffer to old buffer in scala? -

Image
i try merge new data old buffer when refreshing. update or insert accroding "id" attr. could tell me how in scala? def merge(oldbuf: buffer[java.util.map[string, value]], newbuf: buffer[java.util.map[string, value]]) { // loop newbuffer{ // val item = newbuf(n) // val id = item.get("id") // if same id found in oldbuf: // update new [value] old item in oldbuf // else (can not found id in oldbuf) // add new item oldbuf //} return oldbuf } if want use java's map , try putall : import java.util object buf extends app { val oldbuf = new util.hashmap[int, string]() oldbuf.put(1, "1") oldbuf.put(2, "2") oldbuf.put(3, "3") oldbuf.put(4, "4") val newbuf = new util.hashmap[int, string]() newbuf.put(4, "4 new") newbuf.put(5, "5") oldbuf.putall(newbuf) printl...

CSS weather-icons as font next to a text -

Image
so i'm not coding, im trying understand how works. have given in .php file , want optimize following script, can use icon/font. <?php header('content-type: text/event-stream'); header('cache-control: no-cache'); //hier ds18b20 id eintragen: $temp = exec('cat /sys/bus/w1/devices/28-00000629745a/w1_slave |grep t='); $temp = explode('t=',$temp); $temp = $temp[1] / 1000; $temp = round($temp,1); echo "data: $temp&#x00b0; celsius icon_here \n\n"; ob_flush(); ?> the "weather-icons.css" looks this: @font-face { font-family: 'weather'; src: url('../font/weathericons-regular-webfont.eot'); src: url('../font/weathericons-regular-webfont.eot?#iefix') format('embedded-opentype'), url('../font/weathericons-regular-webfont.woff') format('woff'), url('../font/weathericons-regular-webfont.ttf') format('truetype'), url('../font/weathericons-regular-webfo...

ios - How to convert a string into JSON using SwiftyJSON -

the string convert: [{"description": "hi","id":2,"img":"hi.png"},{"description": "pet","id":10,"img":"pet.png"},{"description": "hello! :d","id":12,"img":"hello.png"}] the code convert string: var json = json(stringliteral: stringjson) the string converted json , when try count how many blocks inside json (expected answer = 3), 0. print(json.count) console output: 0 what missing? appreciated. actually, there built-in function in swifyjson called parse /** create json json string - parameter string: normal json string '{"a":"b"}' - returns: created json */ public static func parse(string:string) -> json { return string.datausingencoding(nsutf8stringencoding) .flatmap({json(data: $0)}) ?? json(nsnull()) } var json = json.parse(stringjson) its changed var json =...

python - sys.argv[1] IndexError: list index out of range -

i writing python http client. when have code below error message terminal "list index out of range". from socket import * import sys server_host = sys.argv[1] server_port = sys.argv[2] filename = sys.argv[3] host_port = "%s:%s" %(server_host, server_port) try: clientsocket = socket(af_inet,sock_stream) clientsocket.connect((server_host,int(server_port))) header = { "first_header" : "get /%s http/1.1" %(filename), "host": host_port, "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", "accept-language": "en-us", } httpheader = "\r\n".join("%s:%s" %(item,header[item]) item in header) print httpheader clientsocket.send("%s\r\n\r\n" %(httpheader)) except ioerror: sys.exit(1) final = "" responsemessage = clientsocket.recv(1024) while responsemessage: final += responsemessage...

curl - R travis error: Protocol "https" not supported or disabled in libcurl -

i'm trying test r package travis , having troubles internal cmake command failing download https. in r package's configure script downloads , cmake's metapackage github. download , install begin fails following error: scanning dependencies of target hdf5 [ 3%] creating directories 'hdf5' [ 3%] performing download step (download, verify , extract) 'hdf5' -- downloading... src='https://www.hdfgroup.org/ftp/hdf5/releases/hdf5-1.8.15-patch1/src/hdf5-1.8.15-patch1.tar.bz2' dst='/tmp/minc-toolkit-v2/build/hdf5-prefix/src/hdf5-1.8.15-patch1.tar.bz2' timeout='none' cmake error @ hdf5-prefix/src/hdf5-stamp/download-hdf5.cmake:27 (message): error: downloading 'https://www.hdfgroup.org/ftp/hdf5/releases/hdf5-1.8.15-patch1/src/hdf5-1.8.15-patch1.tar.bz2' failed status_code: 1 status_string: "unsupported protocol" log: protocol "https" not supported or disabled in libcurl closing connection -1 ...

python - How to get stack trace of exception happening in __del__? -

is there easy way stack trace printed exception happens in __del__ ? in case, there's no __del__ method defined object exception typeerror: "'nonetype' object not callable" in <bound method interactivesession.__del__ of <tensorflow.python.client.session.interactivesession object @ 0x2867710>> ignored you'd have detect error manually inside __del__ : def __del__(self): try: cleanup() except exception: import traceback traceback.print_exc() # let error keep propagating. raise there's no way configure python exceptions raised __del__ . it's direct call pyerr_writeunraisable , no place provide callback, no configuration possible print stack trace, , retrieve exception information afterward.

batch file - Java - Run a jar with VM arguments without commandline -

i have jar needs -djava.library.path set lwjgl on launch or throw unsatisfiedlinkerror . negate problem, have launched jar through cmd vm argument using batch file (windows). my question - there way natively in jar without requiring kind of launcher? you can set properties inside program. use either system.setproperty("org.lwjgl.librarypath", "path/to/natives"); or configuration.library_path.set("path/to/natives"); at start of main method.

Android How to create a new json file if it doesn't exist python -

i creating app lets user enter information , can save data json file called hello.json. works fine when file exists, when testing on android crashed because not contain file. how can create new json file on android if doesn't exist? .py file from kivy.app import app kivy.lang import builder kivy.uix.popup import popup kivy.uix.button import button kivy.graphics import color, rectangle kivy.uix.boxlayout import boxlayout kivy.uix.floatlayout import floatlayout kivy.uix.image import asyncimage kivy.uix.label import label kivy.properties import stringproperty, listproperty kivy.uix.behaviors import buttonbehavior kivy.uix.textinput import textinput kivy.network.urlrequest import urlrequest kivy.storage.jsonstore import jsonstore os.path import exists kivy.compat import iteritems kivy.storage import abstractstore json import loads, dump kivy.config import config class phone(floatlayout): def __init__(self, **kwargs): # make sure aren't overriding important ...

IIS Server - Post method not working for XML files -

Image
i new iis server , trying implement requirement need send post request xml files located on iis server. keep getting "http/1.1 405 method not allowed" error. the method xml files working. post method doesn't work. by looking online found need "handler-mappings" . tried looking "handler-mappings" staticfile (assuming handler xml files). see has "all verbs" enabled. please let me know how debug further. version: iis server 7.5 running on windows server 2008 i able fix making web.config entry below. found alternative solution renaming .xml .aspx worked. <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webserver> <handlers> <add name="xml" path="*.xml" verb="get,post" modules="isapimodule" scriptprocessor="c:\windows\system32\inetsrv\asp.dll" resourcetype="file" requireaccess=...

html - Hide and than Show a Div - Jquery -

i'm creating html5 game , want have new div (containing main menu) pop when click enter button on splash page. i've been successful having main menu div pop when clicking button , hiding splash page, have not been able hide main menu page before clicking button, appears when page loading disappears supposed to. hope makes sense. in advance assistance $("#mainmenu").hide(); $("#enter").click(function () { $("#main").hide(); $("#mainmenu").show(); return false; }); $( "#mainmenu" ).hide( "slow", function() { //insert show query here });

UI Bootstrap Angular Modal Not showing -

i'm trying show simple view of angular ui modal bootstrap (no javascript being used). problem code? <link href="http://netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> <script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.3.1.js"></script> <a id="mymodal" href="#mymodal" role="button" data-toggle="modal" class="btn btn-default">download csv</a> <div id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true" class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" data-dismiss="modal" aria-hidden="true" class="close">×</button> ...

ruby - Trying to solve for a '.includes' issue in rails controller active record -

i pretty noob ror coder, trying figure out problem no luck. have application accessing 2 models: -appointments (belongs location) -locations (has many appointments) on appointment index page displaying map of locatations pins using gmap4rails gem. working fine, cannot figure out how limit @appointments locations nearby... def index @appointments = appointment.where(active: "true").order("created_at desc") @hash = gmaps4rails.build_markers(@appointments) |appointment, marker| marker.lat appointment.location.latitude marker.lng appointment.location.longitude end end this gets me of appointments active. working on locations index: def index if params[:search].present? @locations = location.near(params[:search], 50) else @locations = location.near([session[:latitude], session[:longitude]], 50) end @hash = gmaps4rails.build_markers(@locations) |location, marker| marker.lat location.latitude marker.lng location....

css - How to edit wordpress v4.5 be Html page -

Image
i have problemm wordpress site. install on softclaus in cpanel... want edit wordpress html. dont know can find edit. wordpress v4.5 . how edit html?? tried find on web. wordpress different me? ... wordpress twenty sixteen theme. how can edit ???? please me!!!! wordpress considered cms (content management system). means pre-designed you. if trying edit or create new html page, click create new page/post. each option either create blog or webpage depending on template. if looking whole new theme click on appearance -> themes -> new themes. if trying create new design utilizing ftp , creating child directory shown here: http://www.wpbeginner.com/wp-themes/how-to-create-a-wordpress-child-theme-video/

python - Prevent Overlapping in FacetGrid using col, row, and hue -

Image
i have plot looks fine import seaborn sns tips = sns.load_dataset('tips') sns.violinplot('day', 'total_bill', data=tips, hue='sex') however, when want create facet using facetgrid object, violins, in example, plotted on top of eachother. how prevent tha happening male , female plotted next each other? facet = sns.facetgrid(tips, col='time', row='smoker', hue='sex', hue_kws={'male':'blue', 'female':'green'}). facet.map(sns.violinplot, 'day', 'total_bill') seems solution is: import seaborn sns facet = sns.facetgrid(tips, col="time", row='smoker') facet.map(sns.violinplot, 'day', 'total_bill', "sex") passing sex map call seems wanted. name of parameter sex assigned to? it's not hue . know being passed here? the other way barebones matplotlib.pyplot level import matplotlib.pyplot plt ...

active directory - Getting the logged in user info from ADAL on android -

i working adal https://github.com/azure-samples/active-directory-android my code mimics sample close mauthcontext.acquiretoken(todoactivity.this, constants.resource_id, constants.client_id, constants.redirect_url, constants.user_hint, new authenticationcallback<authenticationresult>() { @override public void onerror(exception exc) { if (mloginprogressdialog.isshowing()) { mloginprogressdialog.dismiss(); } toast.maketext(getapplicationcontext(), tag + "gettoken error:" + exc.getmessage(), toast.length_short) .show(); navigatetologout(); } @override public void onsuccess(authenticationresult result) { if (mloginprog...

java - Object to list -> why do I have to create a new object? -

i understand why following happens: datatype bank public class bank { string blz; string name; public string getblz() { return blz; } public void setblz(string blz) { this.blz = blz; } public string getname() { return name; } public void setname(string name) { this.name = name; } } this works expected: public list<bank> getsearchresult() { list<bank> banks = new arraylist<>(); bank bank = new bank(); bank.setblz("1"); bank.setname("berlin"); banks.add(bank); bank = new bank(); bank.setblz("8"); bank.setname("münchen"); banks.add(bank); return banks; } the list hast first element 1 / berlin , second 8 / münchen. don't understand: public list<bank> getsearchresult() { list<bank> banks = new arraylist<>(); ...

android - Customized popup window leads to leaked window. -

i have following code displaying customized popup, executing same leads leaked window error, not able determine how resolve it. following code: public void reminder() { ddialog = new dialog(farrier.this); ddialog.setcontentview(r.layout.farrierpop2); ddialog.settitle("reminder"); ddialog.setcancelable(true); final button pop1 = (button) ddialog.findviewbyid(r.id.btn1); pop1.setonclicklistener(new onclicklistener() { public void onclick(view v) { intent intent = new intent(intent.action_edit); intent.settype("vnd.android.cursor.item/event"); intent.putextra("title", idb); intent.putextra("description", "farrier service"); intent.putextra("begintime", "eventstartinmillis"); intent.putextra("endtime", "eventendinmillis"); startactivity(intent); finish(); } ...

Convert file in PHP to readable values -

i don't mess files may not asking correct question providing correct content. i attempting open file in php , extract value it. so far able open file in notepad++, convert hex , use website convert hex correct number: http://www.scadacore.com/field-applications/programming-calculators/online-hex-converter/ when var_dump value of file characters this: ��������j+���� ��� is there way can replicate method above in php convert that. please let me know additional information might need answer question! thanks!

php - How to properly install/use LESS in CodeIgniter -

my original problem linking multiple stylesheet frameworks. primary option materialize , reasons, i'd integrate bootstrap on buttons , other components. after hours of desperate research, found myself staring @ css pre-processors, e.g. less , sass . found out can dynamic css using these badasses. investing couple more hours deciding use, ended failing install both. so far managed download bootstrap sass , integrated inside project , compiled using grunt (follow instruction ). don't know how use , start. i found cool references here not enough me going. .bootstrap { @import "/bootstrap.less" } i have follow questions post : should link less file on index.php? can use editor , compile less less compiler? should link compiled less or created css? do need use less this? note: i'm total newbie less , sass. information ++.

Uppercase abbreviated Country in MySQL -

i using following code $wpdb->query( "update $wpdb->usermeta set meta_value = replace(meta_value, 'ontario', 'on')" ); it works fine, want know there way can make "on" uppercase in mysql insert? mysql provides string function upper() http://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_upper it's possible reference function in insert statement.

css - Changing the theme color of class" well" in bootstrap -

<div class="col-md-4" style="margin-top:30px;" id="subscriber_page"> <div class="well"> <form> <h3> subscribe now! </h3> <label for="name"> fullname </label> <input type="text" class="form-control" placeholder="input fullname here" id="name" required/> <br /> <label for="name"> address </label> <input type="text" class="form-control" placeholder="input full address here" id="address" required/> <br /> <br /> <br /> <center><button type="submit" class="btn btn-primary">subscribe</button></center> </div> </form> </div> </div> hi ther...

javascript - how can i turn off the debug view in electron?i cant find any about it using google -

Image
every time run electron app,it starts this! turn front-end elements view,how can start app without show on gui? besides,why goes black bg? went on chrome. thank u,guys the black screen due css files routes. check them. if followed starter electron tutorial, calling mainwindow.opendevtools(); . remove line , not console.

sql - Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given PHP -

i'm newbie on php , want select data joined tables can't =/ can me? i'm getting error warning: mysqli_num_rows() expects parameter 1 mysqli_result, boolean given this code: <?php $consulta = mysqli_query($conexao,"select exercicios.nome_exercicio nome_exc , exercicios.repeticoes_exercicio rep_exc , exercicios.serie serie_exc exercicios inner join usuarios on usuarios.id_usuario = exercicios.id_usuario id_usuario = usuarios.id_usuario "); if(mysqli_num_rows($consulta) > 0) { while ($exercicio = mysqli_fetch_assoc($consulta)) { echo "<div class='table-responsive'><table class='table table-responsive'> <tr><td></td><td>nome</td><td>repetições</td><td>série</td></tr> <td>'".$exercicio['nome_exc']."'</t...

memory - How to let gcc actually allocate variables instead substituting with symbols? -

i noticed if have variables defined char = 'a'; or char a; = 'a'; or char a; = 'a'; = 'b'; , , try print a in gdb, tells me no symbol "a" in current context. . apparently gcc, during compilation, optimizes a character constant, instead of char variable holding value. how tell gcc not trick, treat a variable (allocate memory , assign character value memory)?

apache - "#2002 Cannot log in to the MySQL server" on login -

Image
i trying setup drupal on windows 8 xampp when try login phpmyadmin, error: i've tried many different things can't seem working. both apache , mysql running fine xampp control panel. if you're on fresh install, config.inc.php file may not exist. need rename/copy config.sample.inc.php file change relevant line. please check below link: phpmyadmin throwing #2002 cannot log in mysql server phpmyadmin.

Android background service ksoap error -

i developing android application background service consumes method of web service on every 5 mins. using ksoap 2.4 , asp.net web service. android background service running on every 5 mins but androidhttptransport.call(soap_action+webmethname, envelope); returns null. here android service code. package com.example.rashid.challandb; import android.app.service; import android.content.context; import android.content.intent; import android.os.ibinder; import org.ksoap2.soapenvelope; import org.ksoap2.serialization.marshalbase64; import org.ksoap2.serialization.propertyinfo; import org.ksoap2.serialization.soapobject; import org.ksoap2.serialization.soapserializationenvelope; import org.ksoap2.transport.httptransportse; public class testservice extends service { private static string namespace = "http://tempuri.org/"; private static string url = "http://192.168.50.107:80/androidservice/service1.asmx"; private static string soap_action = "http://tempuri....