Posts

Showing posts from July, 2010

pyqt - python match files from two different list -

i learning python , programing in general , need assistance. i wrote python script reads 1 file, unique values, opens second file , and uses unique values makes calculation(script long upload) created gui using pyqt4 allowed user browse clicking qpushbutton , stored file path in qlineedit set file in script f1 = self.lineedit.text() , f2 = self.lineedit2.text worked however, need allow user select multiple files , match every file 1 corresponding file 2 since dependent on each other here updates made widget functions accept multiple files: def first_file_set(self): dlg = qfiledialog() files = dlg.getopenfilenames() self.listwidget.additems(list(files)) def second_file_set(self): dlg = qfiledialog() filenames = dlg.getopenfilenames() self.listwidget_2.additems(list(filenames)) def clearf(self): item in self.listwidget2.selecteditems(): self.listwidget.clear() def clears(self): item in self.listwidget.selecteditems():

html - ckeditor not showing in JavaScript insertRow() table -

this javascript function insertrow() in table: <script> function myfunction() { var table = document.getelementbyid("mytable"); var row = table.insertrow(0); var cell1 = row.insertcell(0); var cell2 = row.insertcell(1); var cell3 = row.insertcell(2); var cell4 = row.insertcell(3); cell1.innerhtml = '{{ form::text('title_detail[]', '', array('class' => 'form-control','placeholder' => 'detail title','required' => 'required')) }}'; cell2.innerhtml = '{{ form::textarea('description_detail[]', '', array('class' => 'form-control ckeditor','placeholder' => 'detail deskripsi','required' => 'required')) }}'; cell3.innerhtml = '{{ form::number('sort_order_detail[]', '', array('class' => 'form-control','placeholder' => &#

javascript - What do querySelectorAll, getElementsByClassName and other getElementsBy* methods return? -

do getelementsbyclassname (and similar functions getelementsbytagname , queryselectorall ) work same getelementbyid or return array of elements? the reason ask because trying change style of elements using getelementsbyclassname . see below. //doesn't work document.getelementsbyclassname('myelement').style.size = '100px'; //works document.getelementbyid('myidelement').style.size = '100px'; your getelementbyid() code works since ids have unique , function returns 1 element (or null if none found). however, getelementsbyclassname() , queryselectorall() , , other getelementsby* methods return array-like collection of elements. iterate on real array: var elems = document.getelementsbyclassname('myelement'); for(var = 0; < elems.length; i++) { elems[i].style.size = '100px'; } if prefer shorter, consider using jquery : $('.myelement').css('size', '100px');

Python utility fails to successfully run a non-Python script that uses relative paths -

my python3 utility has function doesn't work (unless it's placed within selected directories, can run non-python pdflatex scripts successfully). want run utility set location on of template.tex files have, stored in various other locations. the python utility prompts user select pdflatex template file absolute path using tkinter.filedialog gui, runs user's selected pdflatex script using, example: os.system("pdflatex /afullpath/a/b/c/mytemplate.tex") python's os.system runs pdflatex , runs mytemplate.tex script. mytemplate.tex has numerous inputs written relative paths ./d/another.tex . so, python utility works fine long it's in exact same path /afullpath/a/b/c/mytemplate.tex user selects. otherwise pdflatex can't finds own input files. pdflatex delivers error message like: ! latex error: file ./d/another.tex not found because execution path relative python script , not pdflatex script. [ pdflatex needs use relative paths be

openssl - How to extract public key from certificate in Mac? -

i given certificate , tried extract public key out of it. my certificate like -----begin certificate----- snfmfgfdgiig .... -----end certificate----- and saved test.cer . i have looked online , tried extract public key. i tried: openssl x509 -inform pem -in test.cer -pubkey -noout > publickey.pem but getting unable load certificate 56091:error:0906d06c:pem routines:pem_read_bio:no start line:/buildroot/library/caches/com.apple.xbs/sources/openssl098/openssl098-59.60.1/src/crypto/pem/pem_lib.c:648:expecting: trusted certificate i not familiar process , hoping here can me out. much!

c# - Discord Add Guild Member 401 Error Despite Apparently Valid Acces Token -

i new discord's api, , working project needs able add guild member programmatically. i've learned how authorization code (with identify , guilds.join scopes), redeem access token, , user's id. last step use access code , user id add guild. command detailed here: https://discordapp.com/developers/docs/resources/guild#add-guild-member it seems need send put request url: https://discordapp.com/api/guilds/[guildid]/members/[userid] but results in response: {"code": 0, "message": "401: unauthorized"} i have tried including access token in authorization header: authorization: bearer [redacted] i've tried adding json body request: {"access_token":"[redacted]"} neither has worked. unsurprisingly, using both @ same time hasn't worked either. i wondered if permissions issue, discord confirms have guilds.join scope. json receive when exchanging authorization code access token: {&q

c# - Passing List of Data to Other Controller -

so have action method in controller data csv file uploaded through web i want pass data insert controller data csv automatically inserted tables in db , pass view i'm using csv helper, mvc public actionresult importcsv(httppostedfilebase file, int compid) { var compname = db.couriercompanies.find(compid); string path = null; list<myviewmodel> csvd = new list<myviewmodel>(); try { if(file.contentlength > 0) { var filename = path.getfilename(file.filename); path = appdomain.currentdomain.basedirectory + "upload\\" + filename; file.saveas(path); var csv = new csvreader(new streamreader(path)); var invocsv = csv.getrecords<importcsv>(); foreach(var in invocsv) { myviewmodel

go - Declaring global pointer to structs -

i want declare pointer struct globally can access pointer in other files within package. how do that? details: package y has struct named "cluster" , functions named newcluster etc. type cluster struct { } func newcluster(self *node, credentials credentials) *cluster { return &cluster{ } } now,from package "x" when tried accessing above cluster below, works good cluster := y.newcluster(node, credentials) now, want declare 'cluster' global variable can access in other files of "x" package. so, trying declare many ways not working. how declare globally? , how access in other files of "x"package or else in same file (to invoke same newcluster function)? edit: tried declaring var cluster cluster, var *cluster cluster , var cluster *cluster etc. nothing works. the scope of identifier denoting constant, type, variable, or function (but not method) declared @ top level (outside function) package blo

Javascript: How can I loop through a multi-digit number and find the consecutive digit ^ n of each? -

for instance, let's have number 345. how can in javascript loop through each digit in number , raise consecutive nth power: i.e. 3^1 + 4^2 + 5^3? this converts number string splits digits raises each power of index plus 1 , reduces via addition result in answer: ('' + 345).split('').map(function(v, i) { return math.pow(parseint(v), i+1) }).reduce(function(a, v) { return + v }, 0) results in 144

javascript - multiple fine-uploader complete callback -

Image
i have upload page, has 2 fineuploader container, , 1 manual trigger upload button. shown in image here upload button click event code: $('#trigger-upload-namecard').click(function(){ $('#upload-csv-file').fineuploader('uploadstoredfiles'); $('#upload-jpg-files').fineuploader('uploadstoredfiles'); }); how can fire callback something, eg. console.log("all of them uploaded"), both 2 fineuploader has complete upload. know fineuploader has option callbacks.onallcomplete , seem work each fineuploader individually. im unsure if work can try jquerys whena nd then. $('#trigger-upload-namecard').click(function(){ $.when( $('#upload-csv-file').fineuploader('uploadstoredfiles'), $('#upload-jpg-files').fineuploader('uploadstoredfiles') ).then( alert('all done!') ); }); https://api.jquery.com/jquery.when/

excel vba sum dynamic last column -

macro purpose: macro loop through folder of csv files sum last 2 columns , place result in next 2 adjacent cells on row 1 example: file1.csv last 2 columns k , l sum column l placed in cell m1 , sum column k placed in cell n1. file2.csv may have different amount of columns have been trying setup variables these 4 requirements. closest example find is: use last column range(f:lastcolumn) issue having have set last column in file1.csv variable syntax not allowed when summing variable: range("m1") = application.worksheetfunction.sum(columns("lastcolletter:lastcolletter")) not sure how fix above syntax. full code below: sub macro1_measure1_2() ' ' dim my_filename string dim lastcol long dim lastcolletter string '-------------------------------------------- workbooks.open filename:="file1.csv" ' ' variable1: store last column ' https://stackoverflow.com/questions/16941083/use-last-column-for-a-r

mysql - strangeproblem with http request URL Parameter in web service php -

guys i'm working on developing app , have strange problem. have database , web service, wrote number of procedures , functions in database , work within environment mysql, when use url request, not show true query (always run else condition , show me record 'xxxx' record response when understand send data isn't true , invalid , not show me blank json '[ ]'), things test, character set,... (all things been comments) please me in below you're showing code in web service , mysql: php side , web service: <?php if (isset($_request['action'])) { $action = $_request['action']; } else { echo "invalid data"; exit; } switch ($action) { case "getrecord" : getrecord($_request['id'], $_request['email'], $_request['mobile']); break; . . . . default: echo "your action select not true!"; } function getrecord($id, $email, $mobile) { $con = mysqli_connect("localhost", "root", &

web scraping - Python: import a module but avoid executing it? -

i making scrawler , want randomize request headers. things goes that: in configs.py have headers defined: import random user_agents = ['1', '2', '3'] def get_random_user_agent(): return random.choice(user_agents) headers = {'user-agent': get_random_user_agent()} in main.py have test code that: from configs import headers in range(5): print(headers['user-agent']) the result same one. reckon variable 'headers' initialized when importing. want randomized user agent. there best practice this? thank you. that's way python works. code parsed file accessed, code no in function executed immediately. why can have python script this: import random print(random.randint(1,10)) and can executed file python random number. just define headers in function: def get_headers(): return {'user-agent': get_random_user_agent()}

sql - Join more than two tables -

i trying join 2 tables , in 1 table there may or may not have corresponding values.but need join table , list fields null. i have tried join tables left join.but if 2 entries there in secoond table corresponding value of first table,then first table data displayed twice. i need display 1 time if there 2 data in table or there no data in table,but should display null. here sql query. select *,incident.incident_id incidentid register_incident incident left join incident_images im on im.incident_id= incident.incident_id incident.state='active' i need display 1 time each data if there no corresponding rows in table,but fields in second table list null. if there more 1 row in table,then display each row in first table 1 time 1 entry in second table. you can use select distinct 1 row eg (limiting select indicent_id ,, can add distinctcolumn need ): select *,incident.incident_id incidentid register_incident inc

python - Multiply a matrix and a tensor with symbolic entries using sympy -

i using sympy , module gravypy calculate quantities in general relativity (ricci tensor , scalar, christoffel symbols , on.) i multiply matrix tensor, both symbolic entries, , simplify result each entry. have tried use 'tensorproduct' module sympy.physics.quantum, error: sympy.core.sympify.sympifyerror: sympify of expression 'could not parse ''' failed, because of exception being raised: syntaxerror: invalid syntax (, line 1) the full code following: from sympy import * sympy.physics.quantum import tensorproduct gravipy import * import csv t, r, theta, phi = symbols('t, r, \\theta, \phi') x = coordinates('\chi', [t, r, theta, phi]) #defining coordinates m=symbols('m') #m mass metrics = diag(-(1-2*m/r), 1/(1-2*m/r), r**2, r**2*sin(theta)**2) metrics_inv = metrics.inv() gs = metrictensor('g', x, metrics) gs_inv = metrictensor('g_inv', x, metrics_inv) #defining metric tensor gs (that 4x4 matrix) , inverse gs_in

android - How To Get MetaData From Music URL -

i working on project of online music player. possible retrieve metadata music file url , show info song in project? please, suggest me that, if possible thanks. you can use mediametadataretriever metadata (id3 tags): mediametadataretriever mmr = new mediametadataretriever(); if (build.version.sdk_int >= 14) mmr.setdatasource(link, new hashmap<string, string>()); else mmr.setdatasource(link); string albumname = mmr.extractmetadata(mediametadataretriever.metadata_key_album));// album name

java - How to remove comma from column of Abstracttablemodel -

public class webcrmsearchoutputtablemodel extends abstracttablemodel { /** * */ private static final long serialversionuid = 1l; private vector itotalrows = null; public webcrmsearchoutputtablemodel() { super(); } public string getcolumnname(int pcolumn) { string[] colheads; colheads = new string[] { language.getmessage("tit0007"), //channel language.getmessage("tit00038"), //old loyalty no language.getmessage("tit00039"),// ulp no language.getmessage("tit00040"), // first name language.getmessage("tit00041"), // last name language.getmessage("tnr036"),//town/city language.getmessage("tit00042"),//dob language.getmessage("cor0756"),//mob no language.getmessage("t

Extract content from a Listview column c#/wpf -

i'm populating listview sql database. listview has 3 columns defined xaml. <listview x:name="lstas7" grid.row="1"> <listview.view> <gridview> <gridviewcolumn x:name="as7nom" header="{dynamicresource as7_nom}" width="350" displaymemberbinding="{binding as7_nom}"/> <gridviewcolumn x:name="as7lib" header="{dynamicresource as7_lib}" width="350" displaymemberbinding="{binding as7_lib}"/> <gridviewcolumn x:name="as7prix" header="{dynamicresource as7_prix}" width="80" displaymemberbinding="{binding as7_prix}"/> </gridview> </listview.view> the code behind next one foreach (datarow valeur in ds.tables["tb1"].rows) { lstas7.items.add(new { as7_nom = valeur["name"], as7_lib = valeur["text_short"], as7_prix = valeur["price&q

hadoop - How can i import a column type SDO_GEOMETRY from Oracle to HDFS with Sqoop? -

issue i'm using sqoop fetch data oracle , put hdfs. unlike other basic datatypes understand sdo_geometry meant spatial data. my sqoop job fails while fetching datatype sdo_geometry. need import column shape sdo_geometry datatype oracle hdfs. i have more 1000 tables has sdo_geometry datatype , how can handle datatype in general while sqoop imports happen ? i have tried --map-column-java , --map-column-hive , still error. error : error tool.importtool: encountered ioexception running import job: java.io.ioexception: hive not support sql type column shape sqoop command below sqoop command have : sqoop import --connect 'jdbc:oracle:thin:xxxxx/xxxxx@(description=(address=(protocol=tcp)(host=xxxxxxx)(port=1521))(connect_data=(sid=xxxxx)))' -m 1 --create-hive-table --hive-import --fields-terminated-by '^' --null-string '\\\\n' --null-non-string '\\\\n' --hive-overwrite --hive-table prod.plan1 --target-dir test/plan1 --tab

indexing - Excel - how to look in a dynamically changing range of multiple rows and columns and retrieve data -

Image
i have 2 excel files. 1 workfile in work, other output of database. see pic 1 database output (simplified). what see here: the purchase order numer in column a the row in database in column b the status of row in database in column c the classification in column d , w means product want measure , p meaning delivery costs, administration costs etc (we don't want measure this) the number of items ordered , number of items delivered in column e the company name , product info in column f now, want, this: i want table filled automatically based on database output. works column b, i'm stuck on column c, d , e . what want you! i need column c, d , e. number of rows: needs calculate rows only w in column d . item 4410027708 has 2 (only 2 rows w ) , item 4410027709 should 1 . items ordered: needs add-up values directly right of w in column d. so, 4410027708 , needs add 3 , 5 . must ignore rows p ! items delivered: may guess this, needs ad

java - difference between arraylist = arraylist and arraylist.addAll(arraylist) -

what difference between assigning arraylist , using method addall between 2 arraylists? 1 > arraylist = arraylist; //should assign value of later arraylist first. 2> arraylist.addall(arraylist) //add data of later list first. the first replaces data in list ? second 1 appending data in list(if has any) ??? if arraylist.add(arraylist) without assigning data first list, insert data ? i did following code testing , found results do'not know. secondlist.add("1"); secondlist.add("2"); firstlist = secondlist; log.i("check","first list = "+ firstlist); firstlist.addall(secondlist); log.i("check","firs list add : "+firstlist); firstlist.clear(); firstlist.addall(secondlist); log.i("check","firs list add 2 : "+firstlist); result : check: first list = [1, 2] check: firs list add : [1, 2, 1, 2] check: firs list add 2 : [] i expecting last log have result : [1,2] as mentioned i

sql server - Currency defaults to dollars in MS Excel 2016 cube reports -

connecting cube excel 2016 leads wrong currency sign. have currency conversion implemented in cube- language function in mdx script shown below: calculate; language([currency].[currency].[usd])=1033; language([currency].[currency].[gbp])=2057; language([currency].[currency].[eur])=1036; ... instead of option selected in currency filter( can euro, pound, yen, rand etc.) , dollar sign in measures. when use excel 2010 works expected. i use currency format string measures , language of cube set english(united states). ps: have created cube scratch , set language english(united kingdom) , set format string base measure ( not calculated) currency. in excel 2010 report, pound symbol measure value. in excel 2016 report, dollars( again

c# - Importing google contacts -

hi want retrieve google contacts in default mvc5 application. login using code below. googleoauth2authenticationoptions googleoptions = new googleoauth2authenticationoptions() { clientid = "<clientid>", clientsecret = "<clientsecret>", accesstype = "offline", provider = new googleoauth2authenticationprovider() { onauthenticated = (context) => { context.identity.addclaim(new claim("accesstoken", context.accesstoken)) if (context.refreshtoken != null) { context.identity.addclaim(new claim("refreshtoken", context.refreshtoken)); } context.identity.addclaim(new claim("emailaddressfieldname", context

python 2.7 - PynamoDB Number of Items in batch_get -

i using pynamodb batch_get this: batchitems = mymodel.batch_get(id_list) how know how many items in batchitems ? i wanna if it's empty else. i don't know helpful you, items count using loop: item_count = 0 item in mymodel.batch_get(id_list): item_count += 1 # check item_count

paint.net - Delete background of an image and add it without background -

Image
how can delete background of image , add layer without background? can far delete background, when add image on background deleted program treats though there background. stuck. here image before deleting background: here image after deleted background on it: here when try add picture without background picture: as can see picture without background still has background goes on other pictures. tried use magic wand selected rectangle image, selects entire layer.

asp.net - Automapper: Mapping from any type to property of generic type -

lets have following generic type: class a<t> { public t value {get; set;} } now have these 2 classes: class source { public string name {get; set;} public int age {get; set;} } class destination { public a<string> name {get; set;} public a<int> age {get; set;} } class source , class destination contain hundres of attributes in current project, , have lot of different types (not string , int, in example). configure automapper, map any type has mapping set property "value" in target type. possible, or have configure mapping type?

c - Converting String from strftime to int/long -

the goal function, delivers int (or long) actual time. therefor write localtime string (as far understood this) , try convert atoi/atol int/long. somehow don't expected result. things i've tried: i switched initial int long. i changed size of string. if resize 7 instead of needed 15 bytes, converts @ least date part of string. need all. i've got following code: long generate_time() { time_t time1; time(&time1); char time_str[15]; long act_time; strftime(time_str, 15, "%y%m%d%h%m%s", localtime(&time1)); printf("actual time: %s\n", time_str); act_time = atol(time_str); printf("transformed time: %d\n", act_time); return act_time; } resulting in response: actual time: 20170407091221 transformed time: 1240669205 i hope easy sort out , thank in advance! you cannot use long store such data: max value signed long is: -2^31+1 +2^31-1 or -2,147,483,648 2,147,48

xamarin - Error XBD009: Partial Download Failed for one or more parts -

i have rebuilded solution on visual studio team services build 3 days ago builded success. there no changes in code no error on build project step: 2017-04-07t07:32:25.8202471z downloading partial zip parts from: https://dl-ssl.google.com/android/repository/android_m2repository_r42.zip 2017-04-07t07:33:06.1575894z ##[error]src\packages\xamarin.build.download.0.4.2\build\xamarin.build.download.targets(47,3): error xbd009: partial download failed 1 or more parts 2017-04-07t07:33:06.1575894z c:\a\1\s\src\packages\xamarin.build.download.0.4.2\build\xamarin.build.download.targets(47,3): error xbd009: partial download failed 1 or more parts [c:\a\1\s\src\android\android.csproj] 2017-04-07t07:33:06.2360591z ##[error]src\packages\xamarin.build.download.0.4.2\build\xamarin.build.download.targets(47,3): error : error occurred while sending request. 2017-04-07t07:33:06.2370576z c:\a\1\s\src\packages\xamarin.build.download.0.4.2\build\xamarin.build.download.targets(47,3): e

ionic2 - npm install -g ionic@2.0.0-beta.11 cannot install the ionic 2 beta -

Image
please whenever run command npm install -g ionic@2.0.0-beta.11 returns me errors. want install ionic version 2 beta specific requirement. if beta.11 doesn't work. can suggestion me version of ionic 2 beta install. project requires ionic 2 beta. best regards here error encountred:

ios - how to create a dotted polyline in Google Maps with swift 2.0 -

i've tried question has relevant objc code, swift2.0 version produces dashed (and not dotted) lines. code: let path = // ... define path here let route = gmspolyline(path: path) route.strokewidth = 4.0 let styles = [gmsstrokestyle.solidcolor(uicolor(red: 0.945, green: 0.392, blue: 0.278, alpha: 1.0)), gmsstrokestyle.solidcolor(uicolor.clearcolor())] let lengths = [15,15] route.spans = gmsstylespans(route.path!, styles, lengths, gmslengthkind(rawvalue: 1)!); route.map = m_map_view

.htaccess - htaccess redirect entire domain to another, but make a custom redirection for specific url -

i need make redirection domain. basically need explained below. redirect entire domain.net domain.com, leave custom redirect, this: domain.net/specific_url.html domain.com/my_new_url.html you can try one. rewritecond %{http_host} ^(www\.)?example\.net rewriterule ^(.*)$ http://example.com [r=301,l] rewritecond %{http_host} ^(www\.)?example\.net rewriterule ^specific_url/? http://example.com/new_url [r=301,l]

ubuntu - key_load_public: invalid format after ssh-keygen -

after updating ubuntu 16.04 i've problem ssh connection, connection require password though public key copied in remote authorized_keys ssh-copy-id. after new ssh-copy-id receive key_load_public: invalid format , sure of correct key format i've generated new key ssh-keygen , re-launch ssh-copy-id result same key_load_public: invalid format , same ssh connection in have type password. how can generate key , copy on remote server without receive invalid format error? ssh -v <user>@<host-name> : openssh_7.2p2 ubuntu-4ubuntu2.1, openssl 1.0.2g 1 mar 2016 debug1: reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: applying options * debug1: /etc/ssh/ssh_config line 57: deprecated option "useroaming" debug1: connecting <host-name> [<ip>] port 22. debug1: connection established. debug1: key_load_public: no such file or directory debug1: identity file /home/<user>/.ssh/id_rsa type -1 debug1: key_load_pu

autocomplete - Pycharm : Cannot find reference 'xxx' in "__init__.py" for Tensorflow -

Image
i trying set tensorflow using pycharm. although below program working well, seem not totally linked library autocompletion shown parts of available function. example, tf.float32 variable in auto complete. tf.session not. i search same question in stackoverflow seem not working me how should fix auto complete can work?

wpf - Listview control template. How to add an event to command? -

<listview x:name="listviewpoducts" selectionmode="single" itemssource="{binding productgroups}" selecteditem="{binding selectedproductgroup}" scrollviewer.horizontalscrollbarvisibility="disabled" scrollviewer.verticalscrollbarvisibility="auto" background="{staticresource nouvemlightbackgroundbrush}"> <listview.itemspanel> <itemspaneltemplate> <wrappanel orientation="vertical" /> </itemspaneltemplate> </listview.itemspanel> <listview.itemcontainerstyle> <style targettype="{x:type listviewitem}"> <setter property="width" value="auto"/> <

scope - The most annoying quirk of class methods in ruby ever -

can spot problem in following code? module f def f(x) return x*x end end class test3 include f def self.ok(x) return f(2*x) end end how one? class test1 def f(x) return x*x end def test1.ok(x) return f(2*x) end end or maybe this? class test2 def self.ok(x) def f(x) return x*x end return f(2*x) end end this not intuitive @ all. why can't ruby find 'f' in of these cases? like many object-oriented languages, ruby has separation between methods in class context , in instance context : class example def self.a_class_method "i'm class method!" end def an_instance_method "i'm instance method!" end end when calling them using native context works: example.a_class_method example.new.an_instance_method when calling them in wrong context errors: example.new.a_class_method # => no such method example.an_instance_method # => no such

python - Pandas dataframe - have column with list of strings -

i have dataframe on format: id val 0 294 aa 1 254 bb 2 844 cc i need 'val' column list string inside, since need join dataframe dataframe format: id val 0 294 [aa] 1 254 [bb] 2 844 [cc] anyone know how can accomplish this? has list, seeing other dataframe format of our db, want insert joined dataframe into. i advise against storing non-scalar types if insist can use apply , construct list each row: in [53]: df['val'] = df['val'].apply(lambda x: [x]) df out[53]: id val 0 294 [aa] 1 254 [bb] 2 844 [cc]

javascript - How to make chrome/firefox able to run parent.frame -

i working on old web not supporting chrome/firefox. 1 problem code can run on ie not chrome/firefox. put 'parent.frames("snscont").location.href="../../../../../fts/main/account/initial.html"'; on chrome,it indicated uncaught type error: parent.frame not function . jquery or modern code can make supported chrome/firefox? lot. you can use following code fallback parent.frames old ie behavior: function isfunction(obj) { return !!(obj && obj.constructor && obj.call && obj.apply); } if (parent.frames && !isfunction(parent.frames)) { var originparentframes = parent.frames; parent.frames = function(name) { return originparentframes[name]; }; } for questions in comment: why use parent? without context of code, it's hard answer question. basically, parent references parent of current window or subframe, if invoked on window not have parent, references itself. can check https://developer.moz

java - How to set Artifact Path at runtime -

i'm developing build runner plugin teamcity. want publish artifact teamcity server when build done. however, find set artifact path on server before build started. build runner generate artifact in random file folder, can file folder when build running. here comes question, how set artifact path when build running? teamcity artifacts can published via service message . available build script or build tool. an agent plugin can publish artifacts via call artifactswatcher.addnewartifactspath

c# - Populate ItemsControl from a Collection which is incomplete -

i need create pdf previewer in wpf , want display pages in itemscontrol bound observablecollection of rendered pages (each page bitmapsource instance). itemscontrol inside scrollviewer . now, don't want render pages @ once because there can hundred of them , eat memory fast. want render ones visible in app window. but, @ same time want itemscontrol big number of pages in pdf document scrollviewer 's scrollbar adequately small , shows how more there scroll. so question is, how make itemscontrol big number of pages not make observablecollection have pages? i considered replacing itemscontrol grid , add dummy items height set height of page , replace actual page when it's visible user seems lot of work. instead of having observablecollection<bitmapsource> (which seemingly have) should have observablecollection<page> , page class bitmapsource property implements inotifypropertychanged interface, e.g. public class page : inotifypropert

.net - Drawing String with Graphics c# -

this question has answer here: system.drawing.brush system.drawing.color 2 answers how draw string graphics in c#? tried code dose not work. thanks. g.drawstring("string", new font(this.font, fontstyle.bold), new brush(), new point(100, 100)); error: error 1 cannot create instance of abstract class or interface 'system.drawing.brush' c:\users\mihai\appdata\local\temporary projects\graphics drawtext\form1.cs 33 73 graphics drawtext instead of abstract brush have create concrete 1 - example solidbrush (or other of choice). see msdn list of brush implementations (classes derive brush ) can use.

arduino yun - Using postman to Send Post several times a day -

i'm working on arduino personal project. with thingspeak + postman i'm being able manually send tweets. want postman send tweets automatically when ever api field updates. can me please? you should take @ newman . with newman can run postman requests on command line. setup cronjob automate newman call.

Fedora 25: switch between onboard graphics card and Geforce210 -

i have dell poweredge t430 running fedora 25. comes per default onboard graphics (which allows resolution of 1024x768 (at least not able drivers running) , insufficient applications produce graphical output). i bought geforce210 graphics card , plugged in how tell fedora use instead of onboard graphics? pretty sure need in system's own system setup ("bios configuration") — go integrated devices section , switch embedded video controller disabled . don't think there support multiple video controllers active @ same time.

wordpress - Timber use different template for custom post type -

i new php, wordpress , timber. have custom post type called projects , uses posts archive template , going crazy create specific projects archive template can have different layout it. this index.twig looks {% extends "layouts/base.twig" %} {% block content %} <div class="uk-child-width-1-3@m" uk-grid uk-scrollspy="cls: uk-animation-fade; target: > div > .uk-card; delay: 500; repeat: false"> {% post in posts %} {% include "tease-post.twig" %} {% endfor %} </div> {% endblock %} and tease-post.twig {% block content %} <div> <div class="uk-card uk-card-default"> <div class="uk-card-media-top"> <a href="{{post.link}}"><img src="{{post.thumbnail.src('full')}}" alt=""></a> </div> <div class="uk-card-body"> <h3 class=&

javascript - angular 4.0.0 novalidate attribute -

after migrating angular 4 strange issue template-driven form has occured. required attr on input seems broken. suppose has novalidate attribute default. need html5 validations. tried novalidate="false" had no success. there way enable validation? seems using reactive forms validators.required way. thanks! my html component code snippet: <form (submit)="savephone(phone);" novalidate="false"> <h3>Новый телефон</h3> <md-input-container> <input mdinput placeholder="Номер телефона" onlynumber="true" name="number" [(ngmodel)]="phone.number" required> </md-input-container> <md-select placeholder="Источник получения" (ngmodel)="phone.source" name="source"> <md-option *ngfor="let source of sources" [value]="source"> {{ source }} </md-option> </md-select> <tex

apply function (Bitwise "and") on each cell of a raster in R? -

what best way "bitwise and" on pixels in raster (maybe using "raster" package)? want check if sixth bit set. if given integer, use r's bitwand operator. 'and' 32 (has sixth bit set) , see if result 0 or otherwise. example: bitwand(96,32) # 32, has sixth bit set bitwand(192,32) # 0, not have sixth bit set i tried bitwand(myraster,32l) not work. thanks! r. for operations on each cell of raster, can use function calc of library raster . in case, be: r.test <- calc(myraster, fun = function(x) bitwand(x,32l))

ibm watson cognitive - Tone analyser only returns analysis for 1 sentence -

when using tone analyser, able retrieve 1 result. example, if use following input text. string m_stringtoanalyse = "the world rocks ! love !! bananas awesome! old king cole merry old soul!"; the results return analysis document level , sentence_id = 0, ie. "the world rocks !". analysis next 3 sentences not returned. any idea doing wrong or missing out anything? case when running provided sample code well. string m_stringtoanalyse = "this service enables people discover , understand, , revise impact of tone in content. uses linguistic analysis detect , interpret emotional, social, , language cues found in text."; running tone analysis using sample code on sample sentence provided above return results document , first sentence only. i have tried versions "2016-02-19" "2017-03-15" same results. i believe if want sentence sentence analysis need send every separate sentence json object. return analysis in array id=se

iOS IPad Keyboard UIToolbar is unable to click for 1 seconds after done keying -

i need help. notice uibarbuttonitem in input accessory view unable click after done keying. step replicate:- add uibarbuttonitem in uitoolbar , set input accessory view. the uibarbuttonitem clickable , works expect. typing in keyboard. , click on uibarbuttonitem immediately. you notice button unable click. wait awhile, clickable , works per normal. anyone have idea how solve problem?

python - How to change timezone in http response (django server)? -

i'm running django server without proxy: python manage.py runserver 0.0.0.0:80 i set local timezone on linux server, it's correct: root@83b3bf90b5c5:/app# date fri apr 7 12:38:42 msk 2017 also set local timezone on settings.py of django project: time_zone = 'europe/moscow' and checked it: >>> django.utils.timezone import localtime, >>> localtime(now()) datetime.datetime(2017, 4, 7, 12, 38, 42, 196476, tzinfo=<dsttzinfo 'europe/moscow' msk+3:00:00 std>) but when open webpage client (google chrome browser) - in http response headers timezone isn't local: date:fri, 07 apr 2017 09:38:42 gmt how can change timezone in http headers project globally? how can change timezone in http headers project globally? http date headers defined being in utc (represented historical reasons characters gmt ), neither django nor other server or framework allow localize them time zone. there reason want that? djang

SQL Temp table life time during multiple stored procedure calls -

i have stored procedure 2 different behaviors. first case things , create local temp table ( #mytemptable ). second case check existence of temp table , if exists works on it. @ second call temp table doesn't exist anymore. know shouldn't deleted until connection alive. why? currently solved global temp table( ##mytemptable ) know why server deletes file. thanks advance. you have call second stored procedure first stored procedure. if create temp table in 1 stored procedure after flow exits sp, temp table dropped. below. create procedure procedure1 [parameters] begin exec procedure2 [parameters]; end in way, second sp have access local temp table created in first sp.

c# - Castle Windsor web.config parameters -

i transfer windor installer in web.config of webapplication, need pass parameter static attribute of class. there's example: // (namespace web) public void install(iwindsorcontainer container, iconfigurationstore store) { container.register( component.for(typeof(irepository)) .implementedby(typeof(repository<myctx>)) .dependson(dependency.onvalue("store", mvcapplication.globalstore)) .lifestyleperwebrequest() ); } my actual web.config: <components> <component service="core.business.irepository, core" type="ef.business.repository, ef" lifestyle="perwebrequest"> <parameters> <store>web.mvcappltication.globalstore ???</store> </parameters> </component> </components> i concluded has defined in code. therefore decided way of create facility. my new code: web.config <component

r - Inserting values in a heatmap plotted using ggplot -

i have prepared heatmap using ggplot using following commands: mat_data=read.xlsx("average_trendfollowing.xlsx") mat_data$investment.horizon=factor(mat_data$investment.horizon, levels=mat_data$investment.horizon) p <- ggplot(data = mat_data) + # set data geom_tile(aes(y = investment.horizon, x = smoothing.parameter, fill = annualized.returns)) + # define variables plot scale_fill_gradient(low = "white", high = "black") p + ggtitle("trendfollowing strategy") + theme(plot.title = element_text(lineheight=.8, face="bold")) how insert datapoints of annualized.returns plots. used geom_text(aes(fill = mat_data$annualized.returns)) which found on net not working somehow.

java - UDP multicast high % of packet loss -

i'm sending packets through multicast socket. i'm using max pratical size packets, 65 507 bytes (65,535 − 8 byte udp header − 20 byte ip header). however, results in 40-50% packet loss, if server , client in same computer. after testing out values, noticed can 0% packet loss if packet size less 10 000 bytes. why that? is limitation on laptop's network card? or problem udp itself? i'm using max pratical size packets, 65 507 bytes no aren't. 65,507 maximum theoretical size. sizes bigger impossible in ipv4. the maximum practical size 534 or thereabouts, whatever required never fragmented. fragmentation occurs increase probability of datagram loss same factor number of resulting fragments, there nothing in udp recover lost fragments.

ubuntu - Unable to paste anything in the mounted folder for S3 -

Image
i mounted s3 bucket on ubuntu 14.0 , following instructions in s3fs-fuse . can see content of bucket in folder. when try paste in folder, i'm getting permission denied error: this error when trying upload node multer . trying locally copy/paste fails same error. tried chmod 777 mys3mt/ , input/output error : on bucket in aws console, i've given read , write permission for both, object access , permissions access. uploaded s3 bucket listed in ubuntu. not able add ubuntu. what missing? please help. many thanks.

sql - Netezza conditionally count one record per ID -

i'm new netezza , need count number of ids have non-zero key. key transaction type, , want return count of ids have had transaction. want count of uids have non-zero key. my data: src uid key ... 118 3 ... 517 0 ... 517 1 ... 517 4 ... b 623 4 ... c 972 0 ... c 972 0 ... what want return: source uids uids_w_trans 2 2 b 1 1 c 1 0 here's code: select src source, count(distinct(uid)) uids, sum(case when key = 0 0 else 1) uids_w_trans database group uid, source what i'm getting source uids uids_w_trans 2 3 b 1 1 c 1 0 you can see query counting every non-zero key. i've tried number of variations on above query, nothing has gotten me closer. how can count 1 non-zero key per uid? i think looking conditional count(distinct) : select src source, count(distinct(uid)) uids, count(distinct case when key

What is the difference in the API or features of Watson Tone Analyzer service with standard & premium plan? -

i using watson tone analyzer service. @ time of service creation, there 2 pricing plans - standard & premium. there difference in api or features of api if service created premium plan? have support compared standard plan? there no difference in actual api features between standard , premium plans. on pricing page states "watson premium plans offer higher level of security , isolation customers sensitive data requirements." means ibm offers 2 additional tiers of service on standard, shared saas offering - premium (a single-tenant virtual environment deployed on bluemix shared) , dedicated (a private cloud deployment built on bluemix dedicated). for pricing specifics, you'd have contact sales pricing page: https://www.ibm.com/watson/developercloud/tone-analyzer.html#pricing-block it comes down security requirements , weighing them against additional costs.

spring - Can't add dependency to Maven project -

i'm making project in maven . added dependency pom.xml , downloaded dependency maven repostitory but have getting following message: missing artifact org.springframework:spring-context:jar:5.0.0.m5 <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>pl.tutorial</groupid> <artifactid>fiszki</artifactid> <version>0.0.1-snapshot</version> <dependencies> <dependency> //here showing mistake <groupid>org.springframework</groupid> <artifactid>spring-context</artifactid> <version>5.0.0.m5</version> </dependency> </dependencies> i checked , dependency downloaded in maven repo

How to plot two 3D plots of matrices on the same figure with same scale in Python -

Image
i have 2 matrices , have corresponding 2 3d plots on 2 subplots on same figure, same z axis. this code far: import numpy np import matplotlib.pyplot plt mpl_toolkits.mplot3d.axes3d import axes3d def myplot(matrix1, matrix2): mymin = np.min(np.array([np.min(matrix1), np.min(matrix2)])) mymax = np.max(np.array([np.max(matrix1), np.max(matrix2)])) xsize, ysize = matrix1.shape x = np.arange(0, ysize, 1) y = np.arange(0, xsize, 1) xs, ys = np.meshgrid(x, y) z1 = matrix1 z2 = matrix2 fig, (ax1, ax2) = plt.subplots(1, 2) ax1 = axes3d(fig) ax1.plot_surface(xs, ys, z1, rstride=1, cstride=1) ax2 = axes3d(fig) ax2.plot_surface(xs, ys, z2, rstride=1, cstride=1) plt.tight_layout plt.show() mat1 = np.random.random(size = (10, 10)) mat2 = np.random.random(size = (10, 10)) myplot(mat1, mat2) why see 1 3d plot? how can have same z axis in both plots? i think need generate sub plots see plot below (i've changed

create a text boxes for everty product in ruby on rails(shopify app) -

i have created app using ruby on rails shopify.this time app displaying available products on store. but want text boxes every product display text box values in product page. how can achieve this? have read somewhere can done metafields , have used below code: in controller: @products = shopifyapi::product.find(:all, :params => {:limit => 10}) in view: <% @products.metafields.each |metafield| %> <%= metafield.key %> : <%= metafield.value %> <% end %> but getting error on app page. there else need add in code?