Posts

Showing posts from March, 2011

http - Sending a PATCH request to a object that the user does not own -

i'm developing app has frontend , backend component. use jwt tokens authorize network requests. during development, realize patch route 1 of model objects can patch object account. i can change data @ url "<some-host>/orders/149" if current user doesn't own data. this feels insecure, , i'm not fluent backend stack. guy responsible backend junior (fresh out of bootcamp). i'm wondering if can validation based on jwt token check if user eligible change data. any other advice appreciated!

c# - Automapper's ProjectTo throws serilization error -

i trying use automapper's projectto() extension method , running error: the 'objectcontent`1' type failed serialize response body content type 'application/json; charset=utf-8'. the inner exception is: unable create null constant value of type 'datacontracts.statecontract'. entity types, enumeration types or primitive types supported in context. call making looks this: public iqueryable<origincontract> origins() { return contextprovider.origins.projectto<origincontract>(automapperconfiguration); } and classes using this: contracts: public class origincontract { public int originid { get; set; } public string code { get; set; } public string name { get; set; } public string city { get; set; } public int stateid { get; set; } public statecontract state { get; set; } } public class statecontract { public int stateid { get; set; } public string abbreviation { get; set; } public str

parallel processing - Whether block scheduling is done by GPU? -

can assign block specific sm programmatically? can runtime information(number of blocks or warps,a block's or warp's execution time etc.) of sm? no. no. nothing of sort exposed standard cuda runtime , driver apis.

html - How can I combine multiple textarea sets within PHP to output to a file? -

currently have form 3 text areas. it looks this there button sends data php backend , creates word document of data , downloads user. multi-line textarea issue running having trouble getting proper formatting within word document. so example if textarea setup so: textbox1 textbox2 textbox3 file1 n/a 600 file2 use tab 1 1000 file3 use tab 2 200 i expect output in word document just file1 n/a 600 file2 use tab 1 1000 file3 use tab 2 200 but is file1 file2 file3 n/a use tab 1 use tab 2 600 1000 200 in format. however, if had 1 line (say file1 line) output how want to. how can setup php string format desired output? php if (strlen($multipleimports) > 0) { $content = $content . "

android - How can I get a circular progress bar in Fresco simple drawee view while image is not yet loaded? -

i have used following code : <com.facebook.drawee.view.simpledraweeview android:id="@+id/sdv_single_image" android:layout_width="match_parent" android:layout_height="match_parent" fresco:actualimagescaletype="fitcenter" fresco:failureimagescaletype="center" fresco:progressbarimage="@drawable/spinner_1" fresco:progressbarimagescaletype="fitcenter" fresco:retryimage="@drawable/spinner_1" fresco:retryimagescaletype="fitcenter" /> but didn't work in few cases. i want progress bar shown till images loaded web service.it works when use same above code circular drawee view not applicable others. any appreciable. thanks!

c++ - Systemwide USB keyboard hook -

im looking wdk @ moment see how able make systemwide keyboard hook on usb keyboards ( , specific id ). what want able filter keystrokes coming in specific usb keyboard (usb hid/keyboard), , able send specific application/process only. ive seen examples of applications has running can in combination of rawinput , hook, systemwide , not demanding application run. i can find examples makes quite easy ps2 keyboard, when comes usb starts different. anyone suggest me correct model has based on, , better examples of how possible ? and work xp/windows7 windows10 also.

c++ - QDateedit date changes on mouse press -

i have qdateedit , set date on .but when mouse press on date part automatically changes dont want behaviour happen , happens when have following option on date edit,i want change date when user click on popup menu or when edits in line edit part.i have attcahed video better understanding.any on issue highly appreciated. qdateedit *startdateedit = new qdateedit; qdateedit *enddateedit = new qdateedit; startdateedit->setcalendarpopup(true); startdateedit->setdate(qdate::currentdate()); enddateedit->setcalendarpopup(true); enddateedit->setdate(qdate::currentdate()); [sample][1] [1]: https://www.youtube.com/watch?v=qwn_qati6sg as qdateedit class inherited qabstractspinbox can solve problem adding next (the problem seems little bug) : dateedit->setbuttonsymbols(qabstractspinbox::nobuttons);

angularjs e2e - Protractor and xpath to navigate the DOM -

i'm able use csscontainingtext() grid row, , fetch id attribute follows: this.getrowidbytext = function (text) { var sel = '#thereport .ui-grid-viewport .ui-grid-canvas'; var firstrow = element.all(by.css(sel)).first(); var gridrows = firstrow.all(by.repeater('(rowrenderindex, row) in rowcontainer.renderedrows track $index')); var result = gridrows.all(by.csscontainingtext('div', "col 1, row 1 text contents")).first(); var parentid = result.all(by.xpath("./div")); // "./ancestor::div[starts-with(@id, 'id')]" return parentid.getattribute("id"); but i'd use xpath expression fetch related data row, text value "my value - col2, row 1" , id="1484316102519-0-uigrid-0007-cell". here sample dom - <div class="ui-grid-contents-wrapper"> <div class="grid-menu-stuff">...</div> <!-- left-most columns --> <div

jquery - How to align buttons in a row of Bootstrap thumbnails? -

Image
i using jquery code align row of bootstrap thumbnails: <script> function equalheight(group) { var tallest = 0; group.each(function() { var thisheight = $(this).height(); if(thisheight > tallest) { tallest = thisheight; } }); group.each(function() { $(this).height(tallest); }); } $(document).ready(function() { equalheight($(".thumbnail")); }); </script> screenshot: question: how can align 4 buttons? you can using flex. wrap content, except button in div. apply flex-direction:column;justify-content:space-between; on parent div. here's example.i setting .col fixed width, since doing equivalent thing using jquery. .col{ width:150px; padding:0 10px; margin:5px; border:1px solid black; float:left; display:flex; flex-direction:column; height:230px; justify-content:space-between; } <div class=

MSR605 Magnetic Card Reader unable to read cards without special software -

we have application allows cc reader (such msr206) swiped enter in credit card number. these magnetic swipe readers dump whatever data on card screen cursur, if typed. example, if had notepad open, , swiped card, output data notepad. there no programming necessary, except parse data, etc. i purchased msr605, can write read cards. however, unable read info cards, unless have software open, sets card reader "read mode". is there way utilized magnetic reader/writer msr605 simple reader? in msr programmers manual, states following: "1. power on system (pc). 2. setup usb driver(for windows xp or vista) , setup driver msr605,all driver in cd. 3. connect usb of msr605 signal cable free serial port . 4. connect power-in cable power supply , ac receptacle (110v~240v). 5. can use msr605 msr206." however, have not been able work. setup driver, , still not read, unless open separate program, , then, reads windows in msr605. you need down load msr605 so

python - renaming files with CSV and glob -

i looking make script renames of pdf files have based on .csv file , need match. the csv file has numbers this: p20084579 p10092865 p10147356 p20154177 p10028030 p10058367 p10122918 p10122478 p20008810 p10029609 p20015658 the pdf files named like: all_c_2017.1.pdf all_c_2017.2.pdf all_c_2017.3.pdf all_c_2017.4.pdf all_c_2017.5.pdf all_c_2017.6.pdf all_c_2017.7.pdf all_c_2017.8.pdf all_c_2017.9.pdf all_c_2017.10.pdf all_c_2017.11.pdf etc etc, first number of csv file (p20084579) goes all_c_2017.1.pdf , on, want rename these number p20084579.pdf i understand how can read in csv files , globs f = open('test names.csv', 'rb') reader = csv.reader(f) row in reader: print row[0] pdf = glob.glob('*.pdf') pdfname in pdf: print pdfname and hoping os.rename() module have loop be os.rename(pdfname,row[0]) but when use glob list out directories lists rename file incorrectly if try go method: all_c_2017.1.pdf all_c_2017.10.pdf

android - How to store images in phone gallery after capture -

by these code can turn on camera , capture image. after capturing image image can show on activity. can not store image on mobile storage. want store image on mobile gallery after capturing. thanks. public class mainactivity extends appcompatactivity { private static final int camera_request = 1888; private imageview imageview; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); this.imageview = (imageview) this.findviewbyid(r.id.imageview1); button photobutton = (button) this.findviewbyid(r.id.button1); photobutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent cameraintent = new intent(android.provider.mediastore.action_image_capture); startactivityforresult(cameraintent, camera_request); } }); } protected void onactivityresult(int requestcode, int resultcode,

Paypal API - REST API or SDK (Java) -

we re-developing our ecommerce application , goingto use paypal our main gateway. trying figure out whether use rest api or sdk. sdk easier use rest api? better use? a way @ paypal sdks built on top of apis (the root endpoints) in order abstract out lot of complexities , keep integrations up-to-date possible. if leveraging off of api own code (and no sdk), you'll have build out pieces auth (oauth 2), in order capture access token, build out calls each endpoint wish build against. of time you'll see integrations if people want highly customize build against api, or want build in language / integration not available in sdks. the sdk abstract out complexities you, it'll easier integration. in addition, sdks continually updated apis change, won't have update code maintain that, fetch newest sdk version , test integration. if you're looking easiest integration, use sdk. java, that's @ https://github.com/paypal/paypal-java-sdk . there's number o

How to use an external OpenShift namespace in cdi-camel -

i trying use archetype cdi-camel-mq-archetype test out application running on openshift in own namespace. want application use message broker residing in different namespace on same openshift cluster. when running application on openshift see following error in pod's logs: java.lang.runtimeexception: failed process @factory annotated method: create on bean: com.demo.mqdemotest.activemqcomponentfactory. failed lookup bean of type: class org.apache.activemq.activemqconnectionfactory service: broker-tcp. caused by: java.lang.runtimeexception: failed process @factory annotated method: create on bean: com.demo.mqdemotest.mq.activemqconfigurer. failed lookup service broker-tcp. caused by: java.lang.illegalargumentexception: no kubernetes service found name: broker-tcp in namespace: null is there way inject namespace broker lives in application (as not see way in fabric8 cdi documentation)? if not how work expected? you have 2 options. depending on setu

Change selected window's title in C# -

this question has answer here: how change text in titlebar in windows forms? 3 answers like said in title want change text of selected window using c#. (not forms/windows have in application) possible? especially doesent understand, example: open notepad, , notepad selected. click on other window , selected. selected window? if selected mean active form try this:- foreach(form frm in application.openforms) { if (frm.topmost) { frm.text = "your title"; } } edit: try code. rename title of windows process. have used notepad , wordpad example private void button1_click(object sender, eventargs e) { process[] processes = process.getprocessesbyname("notepad"); if (processes.length > 0) { setwindowtext(processes[0].mainwi

c++ - Cross compile GNU Scientific Library for ARM Zynq ( baremetal ) -

i'm trying use gnu scientific library in baremetal application in zynq. tried cross compile library below: first configure project, ./configure --host=arm-xilinx-eabi cc="/home/wizard/programs/xilinx_2015/sdk/2015.4/gnu/arm/lin/bin/arm-xilinx-eabi-gcc" cflags="-o2 -g -wall -fpic" then run make . after outputs following error occured: libtool: link: cannot build libtool library `libutils.la' non-libtool objects on host: strdup.o i have following questions: is possible compile gsl baremetal app in zynq? since libray said has no dependencies? how can fix error above?

How to get number of rows in SAP table by powershell using RFC? -

i trying reach number ob rows in sap table mara using powershell. call em_get_number_of_entries function. don't know powershell , have problem correctly pass tabname value. think line "$rfctableout.setvalue("tabname","mara")" incorrect. here's script: function invoke-sapfunctionmodule { #-loads nco libraries------------------------------------------------- $rc = [reflection.assembly]::loadfile("c:\sap\64\sapnco.dll") $rc = [reflection.assembly]::loadfile("c:\sap\64\sapnco_utils.dll") #-sets connection parameters------------------------------------------ $cfgparams = new-object sap.middleware.connector.rfcconfigparameters $cfgparams.add("ashost", "some ip") $cfgparams.add("sysnr", "20") $cfgparams.add("name", "some system") $cfgparams.add("user", "some user") $cfgparams.add("passwd", "some pass@") $cfgparams.add("cl

wildcard link to parent route reactjs -

let's have class handler respond on both /handle , /handle/:id. have problem : component(in case , handler class ) shown on both pages has buttons take me 1 other, example button gets me /handle /handle/195 , gets me /handle/195 /handle. so button on /handle having: onclick={()=>{hashistory.push('/handle/195')}} which works perfectly, 1 on /handle/195 with: onclick={()=>{hashistory.push('/handle')}} does not, know how redirect parent url using hashistory? apologize if problem poorly explained. tried best. thanks.

ios - why do my constraints make the layout different while running app on iphone 5 and iphone 6? -

Image
i designing swift app shows photo, map , content - of in uitableview header. when run app on iphone 5, looks this: the yellow field text view has following constraints: and: this looks fine on iphone 5. however, when run on iphone 6, see: i don't understand why 2 views differ. now, in code, in viewdidload() have call method: defineheaderview() that populates header view data (e.g. fills username, text, photo). i have block of code: override func viewdidlayoutsubviews() { super.viewdidlayoutsubviews() sizeheadertofit() } func sizeheadertofit() { let headerview = mytable.tableheaderview! headerview.setneedslayout() headerview.layoutifneeded() let height = headerview.systemlayoutsizefitting(uilayoutfittingcompressedsize).height var frame = headerview.frame frame.size.height = height headerview.frame = frame mytable.tableheaderview = headerview } in storyboard define headerview view inside uitableview :

android - When Deep Links are available for public? -

i have added deep links app, have tested them android studio, , working fine. have few questions. if upload apk alpha, these links become active , available users, or become available when promote apk production. if so, how can test them browser? what if creates same deep link using e.g: myapp://playvideo . can used many people, how playstore open app , not other when same deep links being used. manifest <intent-filter> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.browsable" /> <category android:name="android.intent.category.default" /> <data android:scheme="link" android:pathprefix="/path" android:host="video"/>

r - Memory usage of caret train function with cforest model -

Image
i trying train() cforest model using caret package , 32 gb of ram being hoovered @ end of process (at 92% seen on screeshot below). cannot share data, question more cforest() implementation (or maybe theory behind it?) actual code. hope still fits here. data , code: dataset not big, 230k obs. 19 variables (1 of target), str() follows: classes ‘data.table’ , 'data.frame': 227358 obs. of 20 variables: $ var_n : factor w/ 11 levels $ var_n : factor w/ 2 levels $ var_n : factor w/ 2 levels $ var_n : factor w/ 2 levels $ var_n : factor w/ 2 levels $ var_n : factor w/ 2 levels $ var_n : factor w/ 16 levels $ var_n : factor w/ 2 levels $ var_n : num $ var_n : factor $ var_n : factor $ var_n : int $ var_n : int $ var_n : factor w/ 15 levels $ var_n : factor w/ 16 levels $ var_n : int $ var_n : factor w/ 7 levels $ var_n : factor w/ 31 levels my whole control , train looks follows: ctrl_params <- traincontrol( summaryfunction = twoclasssummar

Attach a file to a virtual beacon using Android Beacon Library -

i interested in using android beacon library seems can project. want create virtual beacons using smartphones act if beacon attached file, listening smartphone access text file when detects virtual beacon. i have seen there different ways of doing using library: there data fields (long) encode url file , there beacon data factory seems used information server there few documentation last option , not know how using it. so questions are: should use data fields or factory purpose? in case of recommend using factory, how works notifier? have example code this? thank much the main issue use case limited number of bytes available in standard bluetooth le beacon advertisements transporting data. regardless of beacon format use (ibeacon, altbeacon, eddystone-uid, eddystone-url, etc.), limited a maximum of 23 usable bytes of data space in advertisement. practical number may smaller, because must use bytes identify advertisement type, , whether your beacon vs. 1 belongin

tensorflow tf.while_loop segmentation error when parallel_iterations=0 -

i'm wondering why tf.while_loop gives segmentation error when run below code while setting parallel_iterations=0, works fine long >0. there reason ? import tensorflow tf import numpy np = tf.constant(0) s = tf.constant(0) x = tf.random_uniform([], 0, 761-64, dtype=tf.int32)

python - Multiple variables through one variable -

this question has answer here: what ** (double star/asterisk) , * (star/asterisk) parameters? 12 answers in python, have code this: def var(a=1, b=2, c=3): return a, b, c running gives outcome: >>> import test >>> test.var() (1, 2, 3) in case, 1, 2 , 3 default values want use. occasionally, want able modify or of variables. however, because have many possible var() statements different defaults , number of defaults. can var(a=1, b=2, c=3) or var(d=1, e=2, f=3, g=4) or var(h=0) , on. i want modify these variables through single variable can feed command line, this: >>> arguments = 'a=0, b=5, c=7' but doesn't work. >>> test.var(arguments) ('a=0, b=5, c=7', 2, 3) it interprets 'arguments' variable being 'a' while leaving b , c untouched. how can make 'arguments' var

c# - ORA-01017: invalid username/password when connecting to 9i oracle database using the ODP.NET, Managed Driver -

i'm trying connect 9i oracle database using odp.net, managed driver. every time see ora-01017: invalid username/password; logon denied. wnen i'm trying connect 10g or higher oracle database - well. also, when i'm trying connect 9i oracle database using .net framework oracle or .net framework ole db (msdaora) - well. what problem? this seems not possible, have @ odac 12c release 2 (12.1.0.1.2) installation instructions, setup, , notes system requirements access oracle database server ( oracle 10g release 2 or later )

How to do simple authentication in resteasy? -

i tried this final nettyjaxrsserver server = new nettyjaxrsserver(); server.setdeployment(deployment); server.setexecutorthreadcount(1); server.setport(port); server.setrootresourcepath(""); final simplesecuritydomain securitydomain = new simplesecuritydomain(); securitydomain.adduser("user", "123", new string[] { "admin" }); server.setsecuritydomain(securitydomain); and annotation request handler this @path("") @rolesallowed("admin") public class mossroserequesthandler but server returns response code 200 , empty content. server works when securitydomain set null. help? much!

plsql - oracle database, Omitting records from a table which are subset of records in same table based on two columns -

i have customers clustered groups cluster_id , amount of data huge (so performance matter here). simplest form of have following table: cust_id | cluster_id ---------- | ----------- 1 | 1 2 | 1 3 | 1 2 | 2 1 | 2 2 | 3 4 | 3 1 | 4 i want clusters greatest number of customers such no costumer removed. in other words, want delete records of cluster subset of cluster. in above example, output table should this: cust_id cluster_id -------- | ---------- 1 | 1 2 | 1 3 | 1 2 | 3 4 | 3

python - Error in encoding string -

this might simple problem not able solve it. in python console : request.request.data.get('comment') i {u'price': u'21', u'unit': u'30\xd730', u'name': u'test', u'comments': u'check'} the value of comment : "comments" : "check", "name" : "test", "price" : "21", "unit" : "30×30"(multiplication sign x) how can solve such request.request.data.get('comment') {u'price': u'21', u'unit': u'30x30', u'name': u'test', u'comments': u'check'} ? i tried using: request.request.data.get('comment').get('unit').encode('utf-8') but returns '30\xc3\x9730' i want convert /xd ascii. it seems feature (bug?) in methods dict.__repr__() and/or dict.__str__() of pytho

c++ - Qt Bluetooth on iOS -

i tried search answer query. seems trivial, cant find answer yet. i trying run program using qt bluetooth on ios. able use on macos. but basic feature of code : qbluetoothlocaldevice localdevice; qstring localdevicename; // check if bluetooth available on device if (localdevice.isvalid()) { // turn bluetooth on localdevice.poweron(); // read local device name localdevicename = localdevice.name(); // make visible others localdevice.sethostmode(qbluetoothlocaldevice::hostdiscoverable); // connected devices qlist<qbluetoothaddress> remotes; remotes = localdevice.connecteddevices(); ui->textbrowser->settext(localdevice.name() + "\n" + localdevice.address().tostring()); } gives me null vector address. is there specific settings needed run in ios. need add flags on info.plist file? kindly suggest. for information, using qt 5.7 , xcode 8, programming on macos sierra macbook , building ios10. as pointed out paulw11, indeed, possible use blu

vba - How do I automate the Import Data form or stop it from prompting me? -

Image
edit: feel such idiot, 2 days of headaches playing around vba mouse positioning , window focus title name , time didn't need macro .isy download / import. have found out can refresh data connection part of macro. feel free still answer below if know how or tempted problem (i'll go once project done, don't defeated) no longer needed. so i've automated ie .click 'export excel' on sharepoint in new excel workbook (for security our organisation has disabled visual basic sharepoint). i have used .sendkeys interact first message box , used nasty settings shut data connections security warning up. that leaves import data form deal with: when try use .sendkeys imitate return or spacebar, keypress happening elsewhere, whether in code when developer open or in application when not. i have tried select sheet1 if manually form gain focus. any ideas how can automate control of form or force gain focus .sendkeys work? for clarity, here's full code:

apk - Protect Android Application From Moding -

we have challenge reverse engineer modding our app , change behavior of , repack it. we added app signature checking code reverse engineer can found part , disabled it. the challenge third-party api use must done on client , can't perform on server. have idea increase security of app ? i have 3 things in mind security. use proguard code deobfuscation write native code secured part. can't reverse engineered or process secured part in server side & use result.

Setting regex in python for a complex string -

i have string of ingredients of product this: text = 'pork , beef, water, salt (1,7%), spices (white pepper, nutmeg, coriander, cardamom), stabilizer (e450), glucose, antioxidant (e316), preservative (e250), flavorings' i want detect text (ingredients) such should this. ingredientslist= ['pork , beef', 'salt', 'spices', 'white pepper', 'nutmeg', 'coriander', 'cardamom', 'stabilizer', 'glucose', 'antioxidant', 'preservative', 'flavorings'] the current regex using here following: ingredients = re.findall(r'\([^()]*\)|([^\w\d]+(?:\s+[^\w\d]+)*)', text) but not providing the text in bracket. did not want include codes , percentages want ingredients inside brackets. should here ? in advance. you may restrict first branch match codes start e , followed number: \(e\d+\)|([^\w\d]+(?:\s+[^\w\d]+)*) see regex demo now, \(e\d+\) match (exxx) -like substr

Aurelia Custom Plugin giving no exported Member -

i trying write plugin, basic local storage wrapper, angular-local-storage . in index.js have export function configure(config) { config.globalresources('./local-storage-provider'); } and in local-storage-provider.js have export class localstorageproivder { constructor(prefix = '') { this.prefix = prefix; } setprefix(prefix = ''){ this.prefix = `${prefix}.`; } get(name){ return localstorage.getitem(this.prefix+name); } set(name, value){ localstorage.setitem(this.prefix+name, value); } } test cases wrote passing when try use app getting node_modules/aurelia-local-storage/dist/commonjs/index"' has no exported member 'localstorageproivder'. i using skelton-plugin . there doing wrong?

android - GPU vs CPU programming: inconsistencies in processing times -

i'm working on image tracking: camera i'm tracking finger touches interact android system. image processing done on gpu opencl: convert camera output black , white frames in order spots in white. processing time 65ms method. since objective make program smoother, i've performed same operations on cpu opencv method. gives processing time of 115ms. problem program feels more reactive, faster opencv method , don't understand how processing time can longer in case: seems contradictory me. measurement, proceed this: start= clock(); finish = clock(); double time =((double)finish -start)/clocks_per_sec; std::cout<<"process time : "<< time<<std::endl; here code: static cv::mat original_right,binary_right; static cv::mat original_left, binary_left; int width, height; clock_t start,finish; double time = 0.0; width = (int) this->camera_right.getcapture().get(cv::cap_prop_frame_width

ruby on rails - Send_file does not down load the file -

i have application rails 3.2.22 , ruby 2.2. i'm trying implement send_file in application. download action triggered button click. <input type='button' id='btn_save_log' value="save"/> corresponding ajax call implementation click event given below. $("#btn_save_log").on('click', function () { $.ajax({ url: "/a/b/save_trunk_logs?device_id="+deviceid+"&trunk_name="+trunkdevicename }) }); controller action code given below def save_trunk_logs device_id = params['device_id'] trunk_name = params['trunk_name'] ||= "test" data ="" file = "#{trunk_name}.txt" trunk_logs = db taken(active record) file.open(file, "w+") |afile| afile.write("trunk name : #{trunk_name}\n") afile.write("*"*100) afile.write("\n") afile.write("time stamp"+"\t"+"

Eclipse Che error while loading workspace -

Image
i deployed eclipse che instance in azure , when create , access work space pop-up dialog error. here screenshot of error message. please help! you need open ephemeral port range inbound connections

No luck with GPT in Facebook Instant Articles -

all, i'm have no luck in getting gpt implementation working in fbia. fails return creative. i've used fb documented example (almost) verbatim , still nothing. currently implementation looks in fbia source <!doctype html><html><head><link rel="canonical" href="url"/>..........stuff......<figure class="op-ad"><iframe width="300" height="250"><script type="text/javascript"> var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; (function() { var gads = document.createelement("script"); gads.async = true; gads.type = "text/javascript"; var usessl = "https: " == document.location.protocol; gads.src = (usessl ? "https : ": "http: ") + " //www.googletagservices.com/tag/js/gpt.js"; var node = document.getelementsbytagname("script")[0]; node.parentnode.inser

sql server - SQL Stored Procedure Combine UNION rows into 1 row -

i love know how put results of query 1 row instead of 3 rows gives back: select count([fms].[dbo].[booking].bookingnumber) [fms].[dbo].[booking] inner join [fms].[dbo].[container] on [fms].[dbo].[booking].[bookingnumber] = [fms].[dbo].[container].[bookingnumber] inner join [fms].[dbo].[file] on [fms].[dbo].[container].filenumber = [fms].[dbo].[file].filenumber [fms].[dbo].[booking].relationcode = 'ship02' , [fms].[dbo].[file].eta between '2000-10-27' , '2016-10-28' union select count([fmsair].[dbo].[booking].bookingnumber) [fmsair].[dbo].[booking] inner join [fmsair].[dbo].[container] on [fmsair].[dbo].[booking].[bookingnumber] = [fmsair].[dbo].[container].[bookingnumber] inner join [fmsair].[dbo].[file] on [fmsair].[dbo].[container].filenumber = [fmsair].[dbo].[file].filenumber [fmsair].[dbo].[booking].relationcode = 'ship02' , [fmsair].[dbo].[file].eta between '2000-10-27' , '2016-10-28' union select count([fmsprojects].[dbo].

Python: passing a constant as method parameter -

i want pass class name method constant. example: def foo(bar): # ... eventually, want able use bar class name in method foo is possible do? yes, can pass class argument function. below example prove it. class bar(): @staticmethod # created staticmethod; can call without creating object def my_print(): print 'hello, class function' def foo(my_class): my_class().my_print() # call my_print() of object passed foo(bar) # pass class "bar" argument "foo()" # prints: hello, class function

python - Variable function as position -

i trying associate position of button index of list. have 1 list containing many names, , list containing many numeric values. want create function takes position (or other parameter) of button, , associates button position index of list. for example: when click on first button, function takes first name of list, , takes first numeric value of other list. clicked last button, , function takes last name of list , last numeric value other list. i did creating many function values, think there more intelligent way this. .py n = ["a", "b", "c", "d"] v = [10, 20, 30, 40] x = 0 y = [] = 0 class primeiroscreen(screen): def __init__(self, **kwargs): self.name = 'um' super(screen,self).__init__(**kwargs) def fc1(self, *args):#i don't know how make variable button position global x x = x + v[i] y.append(n[i]) print (x) print (y) .kv <primeiroscreen>: sta

asp.net mvc - getting value of input text from html to mvc -

i have textbox containing url. in html looks this: <input id="bannerlink1" name="bannerlink1" type="text" value="@viewbag.baner1_link" /> i'm trying value controller using request object: baner.url_link = request["bannerlink1"]; but controller see request["bannerlink1"] empty string. guesses can wrong? you need put input-tag inside form tags ( html.beginform() ) put value when form posts.

python - Can I use a function to either import or install a module -

this question has answer here: import module string variable 3 answers i running windows 7, python 2.7, anaconda 4.0.0: here want do. want take code , put in function. try: import easygui except importerror: os import system system('pip install easyqui') import easygui else: pass this have come not able work. def install(mypack): try: import mypack except importerror: os import system system('pip install ' + str(mypack)) import mypack else: pass install('easygui') the error "importerror: no module named mypack". the import statement takes module name literally , not reference other object. import mypack not translate import easygui , import module mypack instead, should use builtin __import__ takes name/string: __import__(mypack)

php - cant load file inside directory -

having weird problem. simple php website, root page.php another-page.php css/ images/ services/ service-name.php another-service-name.php this structure looks slimmed down. so when go localhost/page.php shows page, if try access file inside services folder 500 http error. the localhost page isn’t working localhost unable handle request. im using mamp setup host website locally. any ideas?

javascript - Resolve multiple dependencies of angular-ui modal -

using angular-ui modal directive can create modal , resolve dependency. $modal.open({ templateurl: 'my/path/template.html', controller: mycontroller, controlleras: 'vm', backdrop: 'static', resolve: { form: _modelformresolver, lists: ['form', function(form) { console.log(form); }] } }); the dependency form gets resolved correctly. however, lists depending on form resolved. results in error. unknown provider: formprovider is possible resolve parameter other resolved parameters or have chain them somehow?

swing - Java synth - How to apply solid color to button background -

i trying obtain simple flat button using synth xml in java. button should contain solid color background , text no other effects. i have checked tutorials , implemented below solution need provide solid color background image button. <state> <imagepainter method="buttonbackground" path="images/button_press.png" sourceinsets="10 10 10 10"/> <font name="dialog" size="16"/> <color type="text_foreground" value="#ffffff"/> </state> but per synth documentation here should able provide background color button instead of using image. have tried below xml settings same. not applying background buttons. whereas applying provided color text. <state> <font name="verdana" size="14"/> <color value="#ff0000" type="background"/> <color value="#000000" type="

php - Exporting data is not in proper format -

Image
i exporting data database. like joining 3 tables. i want replace column assigned_to data (183) user_login( raghu) but if below code getting added instead of replaced $col_final= column names $row[$j]= data if($col_final[$j] == "assigned_to") { $result3 = $wpdb->get_results("select user_login wp3_users id=".$row[$j].";"); foreach ($result3 $res3){ $columnlist3 = $res3->user_login; } $schema_insert .= $columnlist3.$sep; } output expected output tried replace assigned_to (183,183,246) user_login name(raghu,raghu,joseph) but getting added assigned _to row not replacing

node.js - expressjs socket.io port 3000 is already in use -

should need to specify different ports express (3000) , socket.io? error: port 3000 in use my code: index.js var express = require('express') ,router = express.router() , app = express() , http = require('http') , server = http.server(app) , io = require('socket.io').listen(server) server.listen(3000); router.get('/', function(req, res, next) { res.render('index', { title: 'express' }); }); io.on('connection',function(socket){ console.log("a user connected"); socket.on('point1', function (value) { socket.broadcast.emit('point1',value); }); socket.on('less1', function (value) { socket.broadcast.emit('less1',value); }); socket.on('point2', function (value) { socket.broadcast.emit('point2',value); }); socket.on('less2', function (value) { socket.broadcast.emit('less2'

javascript - meteor import global variable how? -

hello using meteor 1.3.5 i have package in: projectdir/packages/mypackage in package defined global variable: myglobalvariable = "somedata"; now have myapi.js in: projectdir/imports/api/myservice i want use myglobalvariable in myapi.js. included line: import {myglobalvariable} 'meteor/mypackage'; in code global variable still undefined when enter code in myapi.js. what doing wrong? you can kept global variable inside lib/constant.js here able access any files placed in folder lib/ anywhere in app structure loaded before every other file lib/constant.js myglobalvariable = "somedata "

Segmentation fault for array larger than 1022x1022 -

i don't know rust wanted investigate performance in scientific computing compare julia , fortran. managed write following program problem runtime segmentation fault when max larger 1022. advice? fn main() { const max: usize = 1023; let mut arr2: [[f64; max]; max] = [[0.0; max]; max]; let pi: f64 = 3.1415926535; // compute useless , put in matrix ii in 0.. max { jj in 0.. max { let = ii f64; let j = jj f64; arr2[ii][jj] = ((i + j) * pi * 41.0).sqrt().sin(); } } let mut sum0:f64 = 0.0; //collapse scalar sum(sum(array,1),2) in other langs iii in 0..max { let vec1:&[f64] = &arr2[iii][..]; sum0 += vec1.iter().sum(); } println!("this {}", sum0); } so no error 'segmentaion fault' in terminal. i'm using ubuntu 16 , installed command on www.rustup.rs. stable version rustc 1.12.1 (d4f39402a 2016-10-19) . you have stack overflow (how ironic, hey?). the

android - How can i make the three views always be in one line and also always have the same amount of space between them? -

my goal have 3 views in 1 line no matter how big display of device is. want 3 views have same amount of space between them, symmetrical. these 2 things possible , if so, how? thank in advance! <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.juliandrach.eatfit.mainactivity"> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true"> <imageview android:layout_width="48dp" android:layout_height="48dp" android:background="@drawable/profilbild" android:layout_margin="10dp" /> <textview

ansible - How to make a task dependant of a change in a group? -

we managing solaris zones ("containers") ansible. necessary run command on global zone ("host"), if change has been done non-global zone ("guest"). i found way handle direct dependencies register non_global_zone_1 in non-global zone , when: non_global_zone_1.changed in global zone. the problem is, global zone runs 20 non-global zones. , need perform task in global zone once, if @ least 1 changed has been made 1 non-global zone. how express alternation "zone_1.changed or zone_2.changed or ... zone_n.changed" ? ideally express alternation based on inventory group, because ansible not able gather list of zones standard setup module.

html - How to change prestashop order listing page? -

i want add new module prestashop office order page. can tell me tpl file change can simly add new hook ? added hook controller file, can't find tpl file. in case want add order details page there several hooks available same, can use of them. some of hooks are: hook_tab_ship hook_tab_order hook_content_ship hook_content_order to add orders listing page through module not possible without overriding core file. need override renderlist() of file /controllers/admin/adminorderscontroller.php

c# - How to Display a combobox message -

i'm looking or advice. trying put message in combo box prompting user make selection. thing i've read has told use this.comboboxname.text = "message" , however have tried in few different places , dose not seem work in code. i'm wondering if have missed blatantly obvious. suggestions? code: namespace databaseconnection { public partial class mainwindow : window { public mainwindow() { initializecomponent(); //this dosen't work this.worldcbx.text = "select country"; sqlconnection con = new sqlconnection(@"data source=>this works fine.mdf;integrated security=true;connect timeout=30"); con.open(); sqlcommand com = new sqlcommand("select name bbc", con); sqldatareader sdr = com.executereader(); while (sdr.read()) { this.worldcbx.items.add(sdr["name"]); } sdr.close(); } private void worldcbx_s

.net - When do exceptions from fire and forget Tasks get raised in the calling thread? -

according msdn : if not wait on task propagates exception, or access exception property, exception escalated according .net exception policy when task garbage-collected. when exceptions allowed bubble joining thread, possible task may continue process items after exception raised. i assumed task class has finalizer raises exception or something. why following seem run indefinitely? long collectioncount = 0; task.factory.startnew(() => { throw new notimplementedexception(); }); while (true) { gc.collect(); gc.waitforpendingfinalizers(); ++collectioncount; } since .net framework 4.5, unobserved exceptions task s no longer crash process when finalized . means code running on .net 4.5 (or newer) , you're getting new, non-crashing behavior.

apache nifi - parse json and load data to mongodb -

i having large json,the result paged in different files... unable parse below json files...and how load mongodb using nifi. first file second file i need "resourcetype" : "patient","id" : "104","meta" : {"versionid" : "1","lastupdated" : "2016-09-19t10:18:45z"},"text" : {"status" : "generated","div" : "http://www.w3.org/1999/xhtml\">hughes, teresa. mrn: 577423"},"identifier" : [{"type" : {"coding" : [{"system" : " http://hl7.org/fhir/v2/0203 ","code" : "ss"}]},"system" : " https://github.com/projectcypress/cypress/patient ","value" : "577423"}],"active" : true,"name" : [{"use" : "official","family" : ["hughes"],"given" : ["teresa"]}

html - Centering image (logo) -

this image im trying center, ive tryed different ways no success think bootstrap pre determining position , if dont know how disable can me issue many thanks. <div class="container"> <div class="row"> <div class="col-md-5"> <!-- <img src="../images/4usupportlogo.png" class="" height="250px"/> --> <br> </br> <!-- <img src="../images/4usupportlogo.png" alt="logo" align="top" width="300" height="200" </br> --> <!-- <img src="../images/4usupportlogo.png" width="300" height="200" style="display:block; margin-left:auto; margin-right: auto;" align="center" /> --> <center> <img src="../images/4usupportlogo.png&quo