Posts

Showing posts from March, 2013

java - The exception is thrown - and the code is executed further -

faced situation - in main method, child method called, checks object, , exception thrown in child method (one of objects in list null). code of main method still continues executed! example code: @transactional public boolean addcompany(list<company> companies, list<address> addresses) throws exception{ checkaddress(addresses); try{ for(int = 0; < companies.size(); i++){ if(findcompany(companies.get(i).getid()) == null && !isexistscompany(companies.get(i))){ companies.get(i).setaddress(addresses.get(i)); this.em.persist(companies.get(i)); } } }catch(exception e){ return false; } return true; } public void checkaddress(list<address> addresses) throws exception{ try{ if(addresses == null) throw new exception(thread.currentthread().getstacktrace()[2].getclassname() + "." + thread.currentthread().getstacktrace()[2].getmeth...

unity3d - Visual Studio Error: Type 'CoreApplicationView' and 'CoreWindow' Defined in assembly that is not referenced -

Image
in visual studio 2017 i'm getting error when i'm trying compile: 'coreapplicationview' , 'corewindow' type defined in assembly not referenced. must add reference assembly 'windows, version=255.255.255.255, culture=neutral, publickeytoken=null, contenttype=windowsruntime'. see screenshots. i want deploy app on hololens. don't need emulator. installed everything, reinstalled several times. followed these instructions: https://developer.microsoft.com/en-us/windows/mixed-reality/install_the_tools https://developer.microsoft.com/en-us/windows/mixed-reality/holograms_100 i figure visual studio knowledge should able help. enter image description here

php - How to extend Quickbooks API entity with more fields -

i'm needing extend the employee entity adding more rows of data it. example 1 row need add might call 'types', can know type of employee (e.g. administrator, journeyman, owner etc). is possible? quickbooks doesn't allow add "rows", or add fields "rows". there custom fields can use store additional data you're describing. docs: https://developer.intuit.com/docs/0100_quickbooks_online/0200_dev_guides/accounting/0040_create_custom_fields

MySQL prepared stmt issue -

i've following simple table structures , prepared statement: create table junk1(name varchar(10), state varchar(10)); create table junk2(state varchar(100)); insert junk2(state)values("state '%tex%'"),("state '%neb%'"),("state '%was%'"); insert junk1(name, state) values ('asa', 'texas'), ('dff', 'washing'), ('fgfgf', 'oklahoma'), ('bbb', 'nevada'), ('hhh', 'texas'), ('jjj', 'nebraska'); set @va = ''; select group_concat(state separator ' or ') @va junk2; prepare stmt1 'select * junk1 ?'; execute stmt1 using @va; deallocate prepare stmt1; i'm not getting results expected. no results. i'm doing wrong here? you can't use syntax elements parameters in prepared statement, i.e. can't pass entire clause parameter, values. you may want concatenate clause instead: select group_concat...

servlets - Java Login with SSO -

i have servlet saml , wo2 server working. after login, system gets user data ldap. library created application using jsf (faces context). there class called loginutil makes user data available applications through static methods such as: getuserid(), getuseremail() etc... each of method gets http session via faces context retrive user data saved @ login. now have new applications being using spring boot , because of that, loginutil class doesnt work anymore. i want suggestions change loginutil class make available use in application. @ first idea remove faces context , use pure session object, method statics wont able use normal variable inside of it. , i cant use static variable because applications deployed in clustered server. any ideas? your first idea not crazy, contextfaces, uses threadlocal request, you can same thing, make threadlocal, every request, using servlet filter, put theadlocal in loginuser, work in every app class loginutil { private static...

loops - Generate 1s in place of NAs when i=2 -

i need change nas 1s when i=2, in loop. reposted question since did not have solution in r-help. my code: zeta <- rep(1,8) n <- 7 (i in 1:2){ beta <- zeta[1:n+(i-1)*(n+1)] print(beta) parm <- zeta[i*(n+1)] print(parm) } the output follows: [1] 1 1 1 1 1 1 1 [1] 1 [1] na na na na na na na [1] na the desired outcome be: [1] 1 1 1 1 1 1 1 [1] 1 [1] 1 1 1 1 1 1 1 [1] 1 how desired outcome? best, moohwan

rest - Proper request with async/await in Node.JS -

in program make async call function api module: var info = await api.myrequest(value); module code: var request = require("request") module.exports.myrequest = async function myrequest(value) { var options = { uri: "http://some_url", method: "get", qs: { // query string ?key=value&... key : value }, json: true } try { var result = await request(options); return result; } catch (err) { console.error(err); } } execution returns immediately, result , therefore info contains request object , request body - info.body key=value&... , not required response body. what i'm doing wrong? how fix? proper request usage async , or works correctly promises mentioned here: why await not working node request module ? following article mentioned possible: mastering async await in node.js . you need use request-promise module, not reques...

POST HTML/PHP form submission not displaying posted data -

i'm having trouble setting basic php form submission. using following code: index.html: <html> <body> <form action="welcome.php" method="post"> name: <input type="text" name="name"/><br> e-mail: <input type="text" name="email"/><br> <input type="submit"> </form> </body> </html> with following php on welcome php page. welcome <?php echo $_post["name"]; ?><br> email address is: <?php echo $_post["email"]; ?> </body> </html> the index page displays 2 forms text fields may typed in, when imputing text , clicking submit takes me php page without sending of data. description bit vague, here gif show happening: https://gyazo.com/aa1c9df6b090600cbc403151df49f0e3

ios - Can a Swift function accept only a range of values? -

what trying write generic function compresses image. func compress(image: uiimage, withratio ratio: cgfloat) -> data? { return uiimagejpegrepresentation(image, ratio) } but here compress() 's ratio can cgfloat value 0...∞ , want accept 0.0...1.0 . there way that? as function can return nil , can check value of ratio before using it. if not in desired range, can return nil . func compress(image: uiimage, withratio ratio: cgfloat) -> data? { if 0...1 ~= ratio { return uiimagejpegrepresentation(image, ratio) } else { return nil } } or can throw exception: enum compresserror: error { case ratiooutofrange } func compress(image: uiimage, withratio ratio: cgfloat) throws -> data? { if 0...1 ~= ratio { return uiimagejpegrepresentation(image, ratio) } else { throw compresserror.ratiooutofrange } }

ruby - Regex: Match all hyphens or underscores not at the beginning or the end of the string -

i writing code needs convert string camel case. however, want allow _ or - @ beginning of code. i have had success matching _ character using regex here: ^(?!_)(\w+)_(\w+)(?<!_)$ when inputs are: pro_gamer #matched #ignored _proto proto_ __proto proto__ __proto__ #matched nerd_godess_of, skyrim nerd_godess_of_skyrim i recursively apply method on first match if looks nerd_godess_of . i having troubled adding - matches same, assumed adding - mix work: ^(?![_-])(\w+)[_-](\w+)(?<![_-])$ and matches this: super-mario #matched eslint-path #matched eslint-global-path #not matched. i understand why regex fails match last case given worked correctly _ . the (almost) full set of test inputs can found here the fact that ^(?![_-])(\w+)[_-](\w+)(?<![_-])$ does not match second hyphen in "eslint-global-path" because of anchor ^ limits match on first hyphen only. regex reads, "match beginning of line, not followed hyphen or und...

pointers - Purpose of *,& symbol behide datatype? -

i learning implement graph using c++. came across see follow code. explain function of symbols * , & behide data type "vertex" , "string"? #include <iostream> #include <vector> #include <map> #include <string> using namespace std; struct vertex { typedef pair<int, vertex*> ve; vector <ve> adj; //cost of edge, distination vertex string name; vertex (string s) : name(s) {} }; class gragh { public: typedef map<string, vertex *> vmap; vmap work; void addvertex (const string&); void addedge (const string& from, const string&, double cost); }; void gragh::addvertex (const string &name) { vmap::iterator itr = work.find(name); if (itr == work.end()) { vertex *v; v = new vertex(name); work[name] = v; return; } cout << "vertex alreay exist"; } int main() { return 0; } '*' means de-reference i.e. go address of variable address l...

c++ - Armstrong numbers. print armstrong numbers -

i kindly request think question have been asked earlier, read on first. i need print armstrong numbers between 1 , 10000. problem whenever program run , reaches 150, does (1^3) + ((5^3)-1) + (0^3) instead of (1^3) + (5^3) + (0^3). thus not print 153 (which armstrong number), of course because sum results in 152. not know if other numbers doing this. have checked untill 200 , there no problem other numbers except in 150–160 range. is compiler error. should re-install compiler? using codeblocks. #include <iostream> #include <math.h> using namespace std; int main() { for(int = 0;i <= 10000;++i) { int r = i; int dig = 0; while(r != 0) { dig++; r /= 10; } int n = i, sum = 0; while(n != 0) { int d = n % 10; sum += pow(d, dig); n /= 10; } if(sum == i) cout << << ' '; } cout...

django - python convert emoji to HTML decimal -

i have django application consumes twitter public api. the tweets application received contains emojis , want convert html decimal equivalent. searching python emoji found 2 libraries ( emoji_unicode , pyemoji ). i using 2 libraries following decimal value of emoji included in tweet body; import emoji_unicode, pyemoji def emoji_callback(e): t = pyemoji.encode(e.unicode).replace('\\u','') return "&#%s;" % str(int(t, 16)) emoji_unicode.replace(u'time ⛽ ',emoji_callback) the previous example works fine other emojis did not work , throws invalid literal int() base 16 exception. example below code not work. emoji_unicode.replace(u'time 🌄',call) questions 1- there simpler way html decimal of emoji in tweet body instead of implemented here? 2- if no, how solve exception , code working emojis? something :) def emoji_calback(e): '&#x{0};'.format(e.unicode.encode('unicode_escape').de...

Apache redirect http to https too many redirects errors -

here rewrite rule generated certbot. rewriteengine on rewritecond %{server_name} =www.mysite.com [or] rewritecond %{server_name} =mysite.com rewriterule ^ https://%{server_name}%{request_uri} [end,ne,r=permanent] it not work , browser show many redirects erros. rewriteengine on rewritecond %{http_host} !^www\. [nc] rewriterule ^(.*)$ https://www.%{http_host}/$1 [r=301,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^/$ index.php [l] use code redirect domain http://www . . , avoid many redirection

macOS windows requiring an explicit click to make active, before UI elements inside can be clicked - Ask Different

i'm new mac user, having been issued macbook pro when started new job 3 months ago. windows , linux user before, i'm getting quite used differences using apple's desktop environment. one thing still slowing me down little requirement explicitly click in application window make active, before ui elements inside window can interacted with. for example, if have 2 browser windows open side side left 1 active, takes 2 clicks follow link in right hand window: 1 make window active, 1 click link. this in contrast windows or linux, can click on ui element in inactive window , single click both activate window , element in it. a similar issue trying copy , paste text between windows. can select , copy text in active terminal or editor, paste 'right-click, paste' doesn't activate window. still need left-click window activate before can type it. in windows , linux, right-click paste activate window. if pasting command terminal, hit enter run it, whereas mo...

javascript - How to understand which cookie the client should send in a node.js request? -

i'm trying scrape through website need's authentification. after login session cookie set, want send server everytime subsequent request. when set options this: const options = { hostname: www.exaple.com, port: 443, path: '/loginpage', headers: { auth: 'basic' + new buffer('username:password').tostring('base64'), }, method: 'post', }; i response back: statuscode: 200 headers: { 'cache-control': 'private', 'content-type': 'text/html; charset=utf-8', 'x-frame-options': 'sameorigin', 'set-cookie': [ 'asp.net_sessionid=oka0kl302tcza53btd3arzam; path=/; httponly', 'remarketingrandomgroup=16; expires=sun, 19-aug-2018 22:00:00 gmt; path=/', '__requestverificationtoken=drdasuhybpe6c6vizvcayixdr90tvjg06jz6l88i3iongyi7mvqno9kg_bpcdtsxajtaykziixbr_tq0smy1hwu5s1a1; path=/; httponly' ], date: 'sun, 20 aug 2...

c++ - Qt5: How to solve this trouble. Custom QWidget with custom paintEvent() vs. QWidget move() function -

first post here, need others. i'm new @ qt/c++, years of hobby making programming things, i'm progressing relatively fast. i'm trying learn making game, on, made, besides other things, custom sprite class inherits qwidget. reimplemented, common practice, paintevent function, using tricks, qpixmap/qpainter, json files, spritesheets, codehelpers made self, succefully play animation stances idle/walking/attacking. all went perfect until tried move while walking function move(int x, int y) qwidget. the problem, think, every time call "move" function updates/refresh/repaint qwidget calling paintevent function again, chopping animation, generating several issues, etc. etc. i can't figure out how move without repainting or waiting animation finish, or i'm missing. seems there no other ways move qwidget. belive problem in event function that's being called emitted signal, moveevent, reimplemented keeping empty , result same. do have idea? shoul...

Entity Framework Core 2.0 - Run migrations step by step -

in ef6 retrieve migrations , run step step. there way similar in ef core? ef 6 code public static void runmigration(this dbcontext context, dbmigration migration, string providername, string manifest) { var prop = migration.gettype().getproperty("operations", bindingflags.nonpublic | bindingflags.instance); if (prop != null) { ienumerable<migrationoperation> operations = prop.getvalue(migration) ienumerable<migrationoperation>; migrationsqlgenerator generator = (new dbmigrationsconfiguration()).getsqlgenerator(providername); var statements = generator.generate(operations, manifest); foreach (migrationstatement item in statements) context.database.executesqlcommand(item.sql); } } you can use getmigrations extension method of databasefacade class (returned database property of dbcontext ) list of pending migration names. then can obtain imigrator service , use migrate method passi...

android - Application crashes when logging in using facebook or google account -

i have followed tutorial create aplication login using facebook , google using firebase."sign in email" button works fine, when try login using google or facebook application crashed. here mainactivity public class mainactivity extends appcompatactivity implements view.onclicklistener{ private static final int rc_sign_in=0; firebaseauth auth; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); firebaseauth auth=firebaseauth.getinstance(); if(auth.getcurrentuser()!=null) { log.d("auth",auth.getcurrentuser().getemail()); } else { startactivityforresult(authui.getinstance() .createsigninintentbuilder().setproviders( authui.facebook_provider, authui.google_provider, authui.email_provider ).build(), rc_sign_in); } ...

qt - Can we save png file using QPrinter? -

using same example in how convert pdf file png (image) file in qt is there way can use qpainter save png file. please see example below qstring filepath("x.pdf"); qprinter printer(qprinter::highresolution); printer.setcreator(product_name); printer.setoutputfilename(filepath; printer.setoutputformat(qprinter::nativeformat); qpainter painter(&printer); render(&painter); i tried above code not working in case.the image not proper.

linux - Ubuntu replace PHP path -

i have installed ampps , add /usr/local/ampps/php/bin /ect/environment , when rebooted laptop worked out, after used sudo apt-get install composer , installed dependencies on ubuntu including php, php --ini showing path /usr/local/ampps/php/bin how can change ampps folder? you can add new path this: vi ~/.bashrc export path=$path:/usr/local/ampps/php/bin you can edit path whatever like

java - Android: Checkbox in listview (how to create OnCheckedChangeListener in Adapter) -

Image
i'm creating to-do list application , have question regarding using checkboxes , listeners in list adapter. single row in listview contains 3 textviews , 1 checkbox. want change background of single row when user "check" checkbox. have read should put checkbox listener in adapter class , did it. problem - when add few rows listview , left checkbox unchecked of them works fine, when add row, check checkbox , try add 1 error java.lang.nullpointerexception: attempt invoke virtual method 'void android.view.view.setbackgroundcolor(int)' on null object reference below code of adapter. thank advice. i'm starting android programming thank understanding in advance. public class todoadapter extends arrayadapter<todotask> { arraylist<todotask> objects; context context; int resource; public todoadapter(@nonnull context context, @layoutres int resource, @nonnull arraylist<todotask> objects) { super(context, resource, objects); thi...

Capnproto D language Print all data in a file -

i downloaded capnproto dlanguage , started tinkering sample-addressbook.. problem is, everytime add person addressbook, still prints 1 of data in file, instead of whole file.. void writeaddressbook() { messagebuilder message = new messagebuilder(); auto addressbook = message.initroot!addressbook; auto people = addressbook.initpeople(1); auto person = people[0]; person.id = 123; person.setname("tomas"); person.email = "tomas@example.com"; auto personphones = person.initphones(1); personphones[0].number = "0917xxxxxxx"; personphones[0].type = person.phonenumber.type.mobile; person.employment.school = "school of thoughts"; file f = file("1.dat","a+b"); serializepacked.writetounbuffered(new filedescriptor(f), message); } if call writeaddressbook() 4 times, have 4 people in addressbook same name, problem is, everytime print of data, prints first one.. void printaddress...

javascript - How to get JSON data into option list -

i getting json in following format (as array of objects) [{"0":"ahmednagar","city_name":"ahmednagar","1":"1","city_id":"1"},{"0":"akola","city_name":"akola","1":"2","city_id":"2"},{"0":"amravati","city_name":"amravati","1":"3","city_id":"3"},{"0":"aurangabad","city_name":"aurangabad","1":"4","city_id":"4"},{"0":"beed","city_name":"beed","1":"5","city_id":"5"},{"0":"bhandara","city_name":"bhandara","1":"6","city_id":"6"},{"0":"buldhana","city_name":"buldhana","1...

Concat Results of 2 Select Queries into 1 Column (oracle) -

im trying insert record table. there 1 column in want concatenated results of 2 select statements. 2 statements fetch records , concatenate form 1 value can inserted column. insert abc (name,city,age) values ('john',( (select city tablea id=1)concat(select city tablea id=2)),'22') or can comma separated not getting use here. try one: insert abc (name, city, age) values ('john', ( (select city tablea id = 1) || (select city tablea id = 2) ), '22'); but ensure ... id = 1 , ....where id = 2 return 1 row.

multithreading - JAVA - Why SwingWorker Thread not processing all publish strings? -

i using worker class extends swingworker , process string values in it's process method , prints them jtextarea . so making lot of publish(some_string) calls print strings text area, but when execute worker thread - doesn't print text publish in doinbackground() method. misses lot of publish calls, , partial of words want. but when excute thread , put breakpoint , follow step step can see print all strings publish calls. doing it's supposed do. why working in debug mode in normal mode doesn't? my code: public class worker extends swingworker<void , string> { public worker(int int optionofwork){}; protected void doinbackground() throws exception { ... publish("hellow"); publish("this test"); ... // lot of **publish(some_word) calls** ... publish("some more words"); }//doinbackground() @override protected void process...

java - Using Volley to get list from JSON generating list with last object only -

i trying fetch data in json form. list created on fetching having last object details against every list item. pls guide . here code mainactivity fetch data. package com.example.ankurdell.customlistview; import java.util.arraylist; import java.util.list; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import android.app.activity; import android.app.progressdialog; import android.graphics.color; import android.graphics.drawable.colordrawable; import android.os.bundle; import android.provider.settings; import android.util.log; import android.view.menu; import android.widget.listview; import com.android.volley.request; import com.android.volley.response; import com.android.volley.volleyerror; import com.android.volley.volleylog; import com.android.volley.toolbox.jsonarrayrequest; import com.android.volley.toolbox.jsonobjectrequest; public class mainactivity extends activity { // log tag private static final string tag = mainactiv...

opencv - Capturing a window in Python -

i'm looking find module, or code allow me capture processes window. i've tried working imagegrab, captures area of screen rather binding specific process window. since i'm working small monitor can't guarantee won't lap on onto captured area of screen, sadly imagegrab solution isn't enough. you can achieve using win32gui . from pil import imagegrab import win32gui hwnd = win32gui.findwindow(none, r'window_title') win32gui.setforegroundwindow(hwnd) dimensions = win32gui.getwindowrect(hwnd) image = imagegrab.grab(dimensions) image.show() you move window preferred position if small screen problem. win32gui.movewindow(hwnd, 0, 0, 500, 700, true) see win32gui.movewindow

Dummy Package in R -

could ? i using dummy package in r (function dummy) convert categorical variable(10 categories) dummy variables because of algorithms using (adaboost , rotation forest), don't handle categorical variables well. after using package 10 dummy variables factors. expected them numeric 1s , 0s. should convert them numeric ? or use them factors. thanks lot !!!! best pedro after performing 1 hot encoding there no difference keeping them factor or numeric . better not perform 1 hot encoding tree based models.it decrease performance. here article describing effect of 1 hotted variables. .it better pass categorical variables converting them factors

javascript - Changing background color of td based on php array value -

Image
with below code trying change background color of td element. think code needs correction, please. it's not applying color. or other better solution. php code: $color = "#000000"; if (($change[array_keys($change)[0]] < 0)) $color = "#e54028"; else if (($change[array_keys($change)[0]] >= 1) && ($change[array_keys($change)[0]] <= 19)) $color = "#f18d05"; else if ($change[array_keys($change)[0]] >= 20) $color = "#61ae24"; td element: <td <?php echo "style=background: $color";?>><?php echo $change[array_keys($change)[0]];?>%</td> hm, did tried this? https://www.w3schools.com/cssref/pr_background-color.asp <?php echo "style='background-color:{$color};' "; ?>

hibernate - How to pass Table Name as parameter to HQL Query -

hi want pass table name parameter hql query have used string concatenation as: string hql = "from " + table ; query query = session.createquery(hql); return query.list(); this implementation works throws sql injection exception. there way can pass table name avoiding exception using hibernate query language (hql) can perform database operation without using query. means don't need use table name perform operation. can using pojo or beans class name. hql=" pojo class"; query query = session.createquery(hql); return query.list();

jquery - Position div inside another div without absolute -

i've seen few questions around, no answers worked me far. i'm trying inside div on bottom of outer div (although not entirely, want, like, 5px margin bottom), can't seem position @ without putting position on absolute. if that, though, width , centering doesn't work anymore. is there way me achieve that? here's code: var height = $('.windows').height()*0.85; $('.windows-content').css('height', height); .windows { max-width: 900px; width: 70%; min-height: 300px; height: auto; box-shadow: -1px -1px 0px 0px #000 inset, 1px 1px 0px 0px #fff inset, -2px -2px 0px 0px #868a8e inset; background-color: #c2c5ca; margin: 0 auto; } .windows-content { width: 98.5%; height: auto; box-shadow: 2px 2px 0px 0px #000 inset, -1px -1px 0px 0px #fff inset; background-color: #fff; margin: auto; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script> <d...

javascript - i want to read an image form firebase and show it in an item or img but i keep getting this net::ERR_FILE_NOT_FOUND -

i want read image file firebase, wrote code , keeps giving me error. please me let database=firebase.database(); var filebutton = document.getelementbyid("filebutton"); var main = document.getelementbyid("main"); var bildeurler =database.ref("bildeuler"); function largeurl(snap){ let url=snap.downloadurl; bildeurler.child("rose").set(url); } filebutton.addeventlistener('change', function(e){ var file = e.target.files[0]; var storageref = firebase.storage().ref('kora/'+file.name); storageref.put(file).then((largeurl)); }); function visbilder(snap){ let url=snap.val(); main.innerhtml+='<img src="${url}">'; } bildeurler.on("child_added",visbilder); this obvious. value pass image source not point image.

linux kernel - How do waitpid and ptrace work together? -

going through source code of linux 4.12, can't wrap head around below code when task being ptraced . do_wait() will call ptrace_do_wait(wo, tsk) which call wait_consider_task for every thread tracing on. in turn call wait_task_stopped which find pid [pid = task_pid_vnr(p);] waitpid return, great. but calls put_task_struct(p); which free task structure. if happens, how debugger wait on process/task again? entry added again somewhere, , if where? can 1 explain flow me? thanks. what mean "put_task_struct frees structure"? familiar reference counting? did see matching get_task_struct? let's have @ code: get_task_struct(p); refcount incremented pid = task_pid_vnr(p); why = ptrace ? cld_trapped : cld_stopped; read_unlock(&tasklist_lock); the list of tasks unlocked. in principle can wait() on thread rid of structure due increased refcount sched_annotate_sleep(); if (wo->wo_rusage) getrusage(p, rusage_both, wo-...

html - How to make image fit column in bootstrap -

if had : <div class = "row"> <div class = "column-md-6"> <p>place holder paragaraph. place holder paragaraph place holder paragaraph. place holder paragaraph. place holder paragaraph. place holder paragaraph. place holder paragaraph. place holder paragaraph. place holder paragaraph. place holder paragaraph. </p> </div> <div class = "col-md-6"> <img src = "#"> </div> </div> how can make image exact height , width of paragraph left of it? use this, give background image rather giving image inside img tag <div class = "col-md-6 my_img"> <img src = "#"> </div> and css be: .my_img{ height:300px; /* give required height */ background:url('your image url or location'); background-size:cover; }

jquery - Node Scraper using request module returning undefined for response -

i trying run nodejs scraper , using request module. following js code var request = require('request') var cheerio = require('cheerio'); urls =[]; request({uri:'https://www.bloomingdales.com'}, function(err,resp,body){ console.log(body); if(!err && resp.statuscode == 200){ var $ = cheerio.load(body); } else console.log(err); }) when console.log(body)..i getting undefined..however when url changed www.flipkart.com or other html on response. warning saying (node:9828) warning: possible eventemitter memory leak detected. 11 pipe listeners added. use emitter.setmaxlisteners() increase lim it getting following error error: exceeded maxredirects. stuck in redirect loop https://www.bloomingdales.com/ @ redirect.onresponse (c:\users\sanjanahe\desktop\scraper\node_modules\request\lib\redirect.js:98:27) @ request.onrequestresponse (c:\users\sanjanahe\desktop\scraper\node_m...

mapping - Android retrofit 2 send array as field -

@formurlencoded @post("mobile/order") call<orderresult> oredertaxi( @field("user_id") integer user_id, @field("driver_id") integer driver_id, @field ("locations") list<string> location); retrofit 2 maps elements of array , create key_value pairs `driver_id: 8 locations: 40.7830904,43.861694 locations: 40.789281071949176,43.8663412258029 locations: 40.79531973066005,43.86150989681482 locations: 40.79855839824006,43.85658267885446 but have send 1 jsonarray ` locations:[ 40.7830904,43.861694 40.789281071949176,43.8663412258029 40.79531973066005,43.86150989681482 ] help please..

python - Difference between ! and % in Jupyter Notebooks -

both ! , % allow run shell commands jupyter notebook. % provided by ipython kernel , allows run "magic commands", many of include well-known shell commands. ! , provided jupyter, allows shell commands run within cells. i haven't been able find much comparing two, , simple shell commands cd , etc. main difference see % interactive , change location in shell while in notebook . are there other points or rules of contrast when thinking symbol use shell commands in jupyter notebook? ! calls out shell (in new process), while % affects process associated notebook (or notebook itself; many % commands have no shell counterpart). !cd foo , itself, has no lasting effect, since process changed directory immediayely terminates. %cd foo changes current directory of notebook process, lasting effect.

hadoop - Compare X level directory in HDFS using shell script -

i have base directory in hdfs /user/a123 the hdfs directory a123 has nested sub directories /user/a123/foldera/2017-08-17/xyz /user/a123/foldera/2017-08-18/abc /user/a123/folderb/2017-08-17 /user/a123/folderb/2017-08-19 /user/a123/folderc/2017-08-17 /user/a123/folderd/2017-08-20/def /user/a123/folderd/2017-08-17 /user/a123/foldere/2017-08-17/xyz from base directory, need select second level directory i.e 'yyyy-mm-dd' directory, , compare if older 2 days. if older 2 days, print archive & complete folder name else existing. today=`date +'%s'` hdfs dfs -ls /user/a123/ | grep "^d" | while read line ; dir_date=$(echo ${line} | awk '{print $6}') difference=$(( ( ${today} - $(date -d ${dir_date} +%s) ) / ( 24*60*60 ) )) filepath=$(echo ${line} | awk '{print $8}') if [ ${difference} -lt 2 ]; echo "archive : "${filepath} else echo "existing : "${filepath} fi done expected output: archive : /user/a123/foldera/...

jquery - php archive are be called more than once -

well, have jquery post: $('.form-submit').click(function(){ var form = $(this).attr('data-form'); $("#"+form).submit(function(e) { e.preventdefault(); $.ajax({ url: "../assets/action/action.php", type: "post", data: new formdata(this), contenttype: false, cache: false, processdata:false, success: function(data) { $(".return-post-msg").html(data); } }); }); }) the thing is, working fine, if click button.form-submit again, jquery called once action.php file called twice, , if click again, 3x... if clcik againx.. have in action.php echo "<script> alert('".$method." aaaaa'); </script>"; for check how many times file being called... here html: <form id="create_requisite"> ...

vector - Java AWT Fonts scrambled -

Image
we using following code draw texts in xchart library, on odroid c2 example text scrambled , not readable (see attached picture reference). code used before line starting layout.draw replaced causing issues in eps , pdf export. have github issue here states various reasons problems. working fine on several other installations. fontrendercontext frc = g.getfontrendercontext(); // textlayout layout = new textlayout(ticklabel, font, new fontrendercontext(null, true, false)); textlayout layout = new textlayout(ticklabel, getchartpainter().getstylemanager().getaxisticklabelsfont(), frc); rectangle2d ticklabelbounds = layout.getbounds(); // layout.draw(g, (float) xoffset, (float) (yoffset + axistick.getaxis().getpaintzone().getheight() - ticklocation + ticklabelbounds.getheight() / 2.0)); shape shape = layout.getoutline(null); affinetransform orig = g.gettransform(); affinetransform @ = new affinetransform(); at.translate((float) ...

SQLite Entity Framework ADO.NET Error -

i trying implement data service based on ef (6.1.3) , sqlite. have working in small test app, can't see duplicate experience. data service class library has system.data.sqlite.... components loaded. loaded sqlite.codefirst read create functions in ef 6.1.3 not complete sqlite. however, error when data service called is: system.invalidoperationexception occurred hresult=0x80131509 message=no entity framework provider found ado.net provider invariant name 'system.data.sqlclient'. make sure provider registered in 'entityframework' section of application config file. see http://go.microsoft.com/fwlink/?linkid=260882 more information. i think must in app.config file, can't seem find out whats wrong configuration. here code context class. public class irmcontext : dbcontext { public dbset<operator> operators { get; set; } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { base.onmodelcreating(modelbuilder);...

javascript - Rotate, scale based in pivot point working exactly like CSS -

i trying make pixi function rotate , scale css transform work.. i made test here show, if try press run many times, see doesn't work right always. how can fix "pixitransformlikecss" function ? var app = new pixi.application(200, 100, {backgroundcolor : 0xffff00}); document.body.appendchild(app.view); var img = pixi.sprite.fromimage('https://www.gravatar.com/avatar/') app.stage.addchild(img); //randomize scale, rotation, rotationorigin var scale = [ 0.5+((50 - math.random()*100)/100), 0.5+((50 - math.random()*100)/100) ]; var degrotation = parseint(math.random()*100); var rotationorigin = [ (50 - math.random()*100)/100, (50 - math.random()*100)/100 ]; //css version $('img').css({ transform: 'scale('+scale[0]+','+scale[1]+') rotate(-'+degrotation+'deg)', transformorigin: rotationorigin[0]+'px '+rotationorigin[1]+'px' }); //pixi version img = pixitransform...

delphi - Why is dynamic array "constructor" much slower than SetLength and elements initialization? -

i comparing performances between these 2 ways of initializing dynamic array: arr := tarray<integer>.create(1, 2, 3, 4, 5); and setlength(arr, 5); arr[0] := 1; arr[1] := 2; arr[2] := 3; arr[3] := 4; arr[4] := 5; i've prepared test , i've noticed using array "constructor" takes twice time required other method. test: uses dateutils; function createusingsetlength() : tarray<integer>; begin setlength(result, 5); result[0] := 1; result[1] := 2; result[2] := 3; result[3] := 4; result[4] := 5; end; ... const c_count = 10000000; var start : tdatetime; : integer; arr : tarray<integer>; ms1 : integer; ms2 : integer; begin start := now; := 0; while(i < c_count) begin arr := tarray<integer>.create(1, 2, 3, 4, 5); inc(i); end; ms1 := millisecondsbetween(now, start); start := now; := 0; while(i < c_count) begin arr := createusingsetlength(); inc(i); end; ms2 := mill...