Posts

Showing posts from August, 2015

multithreading - Java threading issue? -

i wondering why result not 400 000. there 2 threads why gets blocked? class intcell { private int n = 0; public int getn() {return n;} public void setn(int n) {this.n = n;} } class count extends thread { private static intcell n = new intcell(); @override public void run() { int temp; (int = 0; < 200000; i++) { temp = n.getn(); n.setn(temp + 1); } } public static void main(string[] args) { count p = new count(); count q = new count(); p.start(); q.start(); try { p.join(); q.join(); } catch (interruptedexception e) { } system.out.println("the value of n " + n.getn()); } } why there problem that? when 2 threads access 1 object @ same time, interfere each other, , result not deterministic. example, imagine p reads value of n , gets, say, 0, q reads same value , gets 0 too, p sets value 1 , q sets 1 (because still thinks

codeigniter - How can I use array to schedule post by php? -

$task = array( "t2" => array("10:11","12:00","23:18"), "t3" => array("08:00","11:30"), ); $post = array("post 1","post 2","post 3","post 4","post 5","post 6","post 7"); hi everybody, how can use array schedule post php? have tried use foreach it's not working me :( i want schedule such as: post 1: t2 @ 10:11 post 2: t2 @ 12:00 post 3: t2 @ 23:18 post 4: t3 @ 08:00 post 5: t3 @ 11:30 post 6: t2 @ 10:11 post 7: t2 @ 12:00 ....... please me :) you need one. first of need make array easy access , flexible, while creating array need store total amount of data, cause post use same data recursively. here create $total variable store total value , check in second foreach loop greater or not if set current looping variable $i 0 again access array first index. online check $task

json - RESTful PostgreSQL -

i attempting setup new mobile app backend. the data going stored on postgresql server, have setup on heroku. what looking easy , fast , simple way of letting apps , post data , database without need me maintain servers or apps use jdbc (for queries or inserts or etc). want communication , mobile apps in json. i have attempted @ google cloud platform, offer google sql, backed mysql. plus, have setup kind of restful service via app engine or compute engine, way work looking for. ideally, service provides restful api endpoints makes postgresql data available, simple searching , posting postgresql via service. suggestions or thoughts welcome.

ios - Rotate SCNNode to face point -

i'm trying rotate object (scnnode) face point it's moving. move across x , y axis, far tried: // action move node let action1 = scnaction.moveto(scnvector3(x: 4.0, y: 0.0, z: 6.0), duration: 3) // tan angle: let angle = cgfloat(atan2(z, x)) if angle - previousangle > pi { playerangle += 2 * pi } else if previousangle - angle > pi { playerangle -= 2 * pi } previousangle = angle playerangle = angle * rotationblendfactor + playerangle * (1 - rotationblendfactor) let rot = playerangle - 90 * degreestoradians flynode.rotation = scnvector4(x: 0, y: 1, z: 0, w: float(rot)) it works target points not all. i try add constraints array scnlookatconstraint, rotates node perfectly, stop move animation: let targernode = scnnode() targernode.position = scnvector3(x: -4.0, y: 0.0, z: -2.0) let con = scnlookatconstraint(target: targernode) flynode.constraints = [con] let action1 = scnaction

android - How to make the title bar change color when the tab is changed -

if on tab in tabbed activity, , change tabs, how make title bar , tab indicator change colors? example of i'm talking can seen below (done on paint). app bar changing color when different tabs selected figure manipulating different elements , color resources use done change uniformly, @ same time, don't know how that. have 4 tabs, , 4 sets of colors picked material design library, red, blue, green , yellow. including red dark, blue dark, etc. i'm not using default tab layout activity comes android studio, instead, using 1 similar 1 used here https://androidbelieve.com/navigation-drawer-with-swipe-tabs-using-design-support-library/ minus navigation drawer. sincerely appreciated, though i'm afraid i'm still quite beginner appreciate if make simple possible. :d you can right code according selected tab position tab 1 getsupportactionbar().setbackgrounddrawable(new colordrawable(color.parsecolor("#f00"))); for tab 2 getsupportacti

Content highlighting in solr query results -

in standard install of solr full working example enables highlighting in search results (named "techproducts"). here how make work: install solr cd install dir: cd /usr/local/cellar/solr/5.5.0 start solr existing example "techproducts" bin/solr -e techproducts index example pdfs bin/post -c techproducts ~/desktop/some_pdfs/ go url localhost:8983, select core "techproducts" in left menu enter search term in query field (replace *:* query string) check "hl" field enter field name in field "hl.fl" (for instance: "content") hit "execute query" button now you'll see @ bottom of result page context (or snippets) search keyword: "highlighting": { "/users/ugur/desktop/some_pdfs/jquery pocket reference.pdf": { "content": [ " jquery pocket" ] }, "/users/ugur/desktop/some_pdfs/jquery ui.pdf&

android - Opening Instance of Activity -

Image
i have app hold post information in activity. in activity related posts listed in bottom of post. user clicking on related post can go post activity , see post info , related posts too. as can see in image, have activity a holds post , it's related posts. when user click on post send user activity new post id , fill activity new data. but think not right way! should used fragment instead of activity ? opening instance of activity on top of simplest way of navigating content graph. user can press back, , go opened content, until user reaches starting activity, application closes. though pretty straight forward, particular approach has 2 issues: it may happen lot of instances of same activity on stack, utilising large amount of device resources memory. you don't have fine grained control on activity stack. can launch more activities, finish some, or have resort intent flags flag_clear_top etc. there approach, re-uses same activity instance, loads n

javascript - Can't display an image using angularJS -

hi i'm still new angularjs , spring mvc, server working fine when test on own can see image in client side it's not working , i'm having error in console angular.js:3153 data:image/jpeg;base64,{} net::err_invalid_url please. productcontroller.java @requestmapping(value = "/getimg/{id}", method = requestmethod.get) @responsebody public void getimg(@pathvariable long id, httpservletresponse response) throws ioexception { bytearrayoutputstream baos = new bytearrayoutputstream(); response.setheader("content-disposition", "inline; filename=productimg.png"); model model = modelrepo.findbyid(id); model.geturlimg(); fileinputstream in = new fileinputstream(model.geturlimg()); byte[] buffer = new byte[1024]; int len; while ((len = in.read(buffer)) != -1) { response.getoutputstream().write(buffer, 0, len); } response.setcontenttype("image&qu

bash - shell tool (awk/grep/sed etc) to remove text after number and before a fixed marker -

i have lines pattern <positive_integer> <texta(which may include integer)> | <larger_integer> <texta> for instance: 1544 input packet chains processed length greater 4 | 1545 input packet chains processed length greater 4 i'm not sure whitespace rules there are, may tab or spaces there. think second texta same first maybe there in netstat output might not true. if helps, working on output of diff -y filea fileb filea , fileb lines came netstat -s @ different times — after bit of filtering: based on suggestions better filtering me is: netstat -s | awk '/error|length|bad|overflow|failure|dropped|loss|unknown|detect|^[[:lower:]]*:$/ { if ($1!= 0) { $1=$1; print} }' (keeping protocol type lines tcp: ip:, call flag, may useful. hope prepend flag each line (store in variables), , maybe add number line after flag shows total data of type.) deprecated code was: netstat -s | awk '{$1=$1};1' | grep -v "^0" | grep "e

c++ - Image processing with openCV, color change -

i doing image processing , have black shape on white image. use findcontours() need white shape on black image. is there way change opencv settings track black shapes on white background instead ? i managed find white part of image using inrange() change other color, change black part white, , again first part black using inrange() . there easier way convert black white , white black on image @ same time ? starting binary_image of type cv_8uc1 : you can use binary_not (as suggested @zdar): binary_not(binary_image, binary_image); invert values aritmtetic operation (as suggested @sunreef): binary_image = 255 - binary_image; or use not logical operator ~ . binary_image = ~binary_image; this can nice shortcut if need invert values particular function, e.g.: findcontours(~binary_image, ... );

vba - Creating folder in ftp server -

i have vbscript file see below: set oshell = createobject("shell.application") set objfso = createobject("scripting.filesystemobject") set objsb = createobject("system.text.stringbuilder") yesterday = dateadd("d", -1, date) foldername = sprintf("{0:yyyymmdd}", array(yesterday)) & ".opentrades" fullpath = "c:\test\" & foldername call ftpupload(fullpath, foldername) sub ftpupload(fullpath, foldername) const copytype = 16 waittime = 80000 ftpuser = "username" ftppass = "password" ftphost = "hostname" ftpdir = "/1/" strftp = "ftp://" & ftpuser & ":" & ftppass & "@" & ftphost & ftpdir set objftp = oshell.namespace(strftp) 'upload files in folder if objfso.folderexists(fullpath) set objfolder = oshell.namespace(fullpath) wscript.echo "uploading fo

oop - Segmentation fault when creating object c++ -

i have class in c++, has constructor in matrix.h: private: int col; int row; bool isvalid; int **matrix; public: matrix(int inputint); and in matrix.cpp file : matrix::matrix(int inputint) { row=inputint; col=inputint; (int i=0;i<row;i++) matrix[i]=new int [col]; (int i=0;i<row;i++) (int j=0;j<col;j++) matrix[i][j]=0; isvalid=true; } and in main.cpp wrote matrix a(3); and got segmentation fault. why ? matrix pointer pointer, need new matrix @ first. matrix::matrix(int inputint) { row=inputint; col=inputint; matrix = new int* [row]; (int i=0;i<row;i++) matrix[i]=new int [col]; (int i=0;i<row;i++) (int j=0;j<col;j++) matrix[i][j]=0; isvalid=true; }

angularjs - Waiting for element by.css() in protractor -

i have code in $scope.$broadcast triggers event executes element.addclass() code in controller ctrlr.rolldice = function(){ .... stuff $scope.$broadcast('eventtype', args); } code in directive scope.$on('eventtype', function(){ element.addclass('class'); }); i trying wait until event has fired , element.addclass executed in protractor test using browser.wait(element(by.css('.activate')).ispresent,15000).then(function(ispresent){ expect(ispresent).tobe(true); }); however, following error typeerror: cannot read property 'getwebelements' of undefined how wait element class .activate show up ?? note element can random visible element ...it set class. if run project in actual web browser....everything runs successfully. try this: browser.wait(() => $('.activate')).ispresent() ,15000); expect($('.activate').ispresent()).tobe(true); or es5 version browser.wait(function() {

java - no target device found android studio 2.1.1 -

i'm using android studio 2.1.1 in ubuntu 14.04.now question is,i want run program through phone without emulator. chose target usb device whenever run this,below mentioned error rasing. error running app : no target device found. i checked device using adb devices command in terminal. adithya@adithya-lenovo-b460e:~$ adb devices list of devices attached 59v8i7hejjwggmk7 device i tried selecting of mtp & ptp.but nothing worked out. kindly me solve problem.. i had problem before. choose "run" "edit configurations". in "general" tab, check "deployment target options" section. in case, target set "usb device" , checkbox "use same device future launches" checked. i had change target "show device chooser dialog" , unchecked check box. device appeared in list.

html - Google directions table not resizing correctly -

Image
i have problem google directions based website not adapting small mobile screens correctly. here issue on picture below: in chrome not shrinking below 395 px width problem, because lot of mobile phones have screen smaller width, part of information not visible. in firefox doesn't go below 307 px width, not huge issue if go little bit more under this. chrome inspect found problem starts, on html table element "adp-directions" class. image below. tried changing width of class 100%, , fixed width below 395px not go under 395px. tried putting !important in css overwrite other styles might not see, still nothing... if can please me somehow because stuck here , don't know else do... here link site: link try put media query font size smaller view @media (max-width:420px){table.adp-directions { font-size: 12px !important;}} solve question. if don't reducing font size comment.

ampl - presolved in MILP -

presolve: rows , columns removed iteration objective primal inf. dual inf. time 0 9.9086144e-01 0.000000e+00 0.000000e+00 0s 16 9.9086144e-01 0.000000e+00 0.000000e+00 0s solved in 16 iterations , 0.00 seconds optimal objective 9.908614362e-01 gurobi 5.5.0: optimal solution; objective 0.9908614362 16 simplex iterations whats problem , cannt find 2 weeks. can test model right under small network data file. when test under larger network more nodes, occurs kind of problems shown above.

python - Odoo: test unique constraint? -

it looks odoo fails @ testing unique constraint. i have added constraint: _sql_constraints = [( 'uniq_line', 'unique(routing_phase_id, project_id)', 'phase have unique per routing!') ] constraint works, running unittest, can't test it. i tried this: from psycopg2 import integrityerror self.assertraises(integrityerror): self.env['project.routing.line'].create( self.project_routing_line_1.copy_data()[0]) i error, when running test: 2016-05-28 13:59:16,575 19786 error pas_test openerp.sql_db: bad query: insert "project_routing_line" ("id", "routing_phase_id", "sequence", "next_routing_phase_id", "duration", "project_id", "return_routing_phase_id", "need_approve", "create_uid", "write_uid", "create_date", "write_date") values(nextval('project_routing_line_id_seq'), 1, 5, null

hadoop - HBase KeyValue.maxSize cannot be disabled -

Image
i have added <property> <name>hbase.client.keyvalue.maxsize</name> <value>0</value> </property> in hbase-site.xml. i changed hbase.client.keyvalue.maxsize value hbase-0.94.27/docs/hbase-default.xml , set 0 <glossentry id="hbase.client.keyvalue.maxsize"> <glossterm> <varname>hbase.client.keyvalue.maxsize</varname> </glossterm> <glossdef> <para>default: <varname>0</varname></para> </glossdef> </glossentry> and change hbase-0.94.27/src/main/resources/hbase-default.xml , set 0 <property> <name>hbase.client.keyvalue.maxsize</name> <value>0</value> </property> and set on java configuration config = hbaseconfiguration.create(); config.setint("hbase.client.keyvalue.maxsize", 0); none of them disabled keyvalue.maxsize . there way disable che

ruby - Rails: Validate presence of associations in a many-to-many relation -

i trying validate presence of clients in user class, seems not working. never pass. want create user has many clients: class user < activerecord::base has_many :client_users, dependent: :destroy has_many :clients, through: :client_users accepts_nested_attributes_for :client_users validates_presence_of :name validates_presence_of :clients end ..... class clientuser < activerecord::base belongs_to :client belongs_to :user validates_presence_of :client validates_presence_of :user accepts_nested_attributes_for :user accepts_nested_attributes_for :client self.table_name = "clients_users" end ..... class client < activerecord::base has_many :person_contacts has_many :users, through: :client_users has_many :client_users, dependent: :destroy has_many :cases, through: :client_cases has_many :client_cases, dependent: :destroy accepts_nested_attributes_for :client_users, :person_contacts, allow_destroy: true validates_presence_of :name end

asp.net mvc - MVC5 EF6.1 Code First Foreign Key Constraint -

public class names { [key] public int nameid { get; set; } [stringlength(100)] [index(isunique = true)] [required] public string name { get; set; } } public class people { [key] public int peopleid { get; set; } [required] public int firstnameid { get; set; } [foreignkey("firstnameid")] public names firstname { get; set; } public int middlenameid { get; set; } [foreignkey("middlenameid")] public names middlename { get; set; } public int lastnameid { get; set; } [foreignkey("lastnameid")] public names lastname { get; set; } public datetime dateofbirth { get; set; } } after creating migration , trying update database, i'm getting following error: introducing foreign key constraint 'fk_dbo.people_dbo.names_lastnameid' on table 'people' may cause cycles or multiple cascade paths. specify on delete no action or on update no action, or modify other foreign ke

javascript - Handling page refresh in angular ui-router -

when ever reload/refresh page, state routes root page. when checked value of $state.current after reload empty. currentstate: object {name: "", url: "^", views: null, abstract: true} states: angular.module('app', ['ngcookies','ngresource','ui.router']) .config(function ($stateprovider, $urlrouterprovider) { $stateprovider .state('login', { url: '/login', templateurl: "views/login.html", data: { required: false } }) .state('dashboard', { url: '/dashboard', templateurl: "views/dashboard.html", data: { required: true } }); $urlrouterprovider.otherwise('/login'); }) .run(["$rootscope", "$state", "$location", "authservice", "$cookies", "$sessionstorage", function ($rootscope, $state, $location, authservi

Get max value sql in Java -

*i don't value of max in function other. value return "0". trying not success :( image public int pricemax(int manhom){ connection conn = this.connect(); int max = 0; if(conn != null){ try { java.sql.statement statement = conn.createstatement(); string sql = "select avg(giasp) tbsanpham manhom = '"+manhom+"'"; resultset rs = statement.executequery(sql); max = rs.getint(sql); } catch (sqlexception ex) { logger.getlogger(csdl.class.getname()).log(level.severe, null, ex); } } return max; } help!!! int manhom = cbbnhomsanpham.getselectedindex(); csdl csdl = new csdl(); int max = csdl.pricemax(manhom); joptionpane.showmessagedialog(null, "nhóm sản phẩm: '"+cbbnhomsanpham.getname()+"' \nprice max: '"+max+"' ");

How to programmatically inject jquery code in chrome extension -

i have requirement of inserting following jquery code on click of extension var klo=$(".dijitaccordiontitle.dijitaccordiontitle-selected").parent().siblings().css("display","none") $('#containerdiv').show().parentsuntil('body').andself().siblings().hide(); $("#dijit_layout_accordioncontainer_0").height($(document).height()) similar concept explained in "programmatic injection" of http://developer.chrome.com/extensions/content_scripts.html.my issue want run jquery code instead of plain javascript code. thanks

html - Having a form under a For-Each cycle in Thymeleaf -

i new in spring boot , have problem thymeleaf. want use html form under each cycle, receive exception. this code: <tr th:each="item : ${users}"> <td th:text="${item.getfirstname()}">first name</td> <td th:text="${item.getlastname()}">last name</td> <td th:text="${item.getemailaddress()}">email address</td> <td th:text="${item.getdateofbirth()}">date of birth</td> <!--<td><a th:href="${'/user/edit/' + user.id}">edit</a></td> --> <td>edit</td> <td> <form th:object="${item}" th:action="@{/delete}" method="post"> <input type="hidden" th:field="*{firstname}"/> <input type="hidden" th:field=&qu

javascript - Let <div> grow if <p contenteditable> grows -

how can move elements below paragraph p , contenteditable , when type something. here code: body, html { margin: 0; padding: 0; background-color: white; } .input { border: 1px dotted black; width: 30%; float: right; left: 45%; height: 40px; position: absolute; background-color: #8ce1ff; color: #6e6e6e; font-size: 16px; font-family: 'arimo'; } .input:hover { border: 1px solid black; } #content { border: 1px dotted black; width: 50%; float: right; position: absolute; background-color: #8ce1ff; color: #6e6e6e; font-size: 19px; font-family: 'arimo'; height: 40%; } #content:hover { border: 1px solid black; } .details { margin-bottom: 30px; z-index: 900; font-family: 'arimo'; font-size: 17px; } section { background-color: #53cffc; margin: 20%; z-index: 901; border: 1px solid black; } #button { color: #c0c0c0; margin-top: 5%; background: #

python - Use Logistic Regression for Tweets Topic Classification -

i have problem regarding use of logistic regression. i'm making tweets topic classification in python. far i'm able read train data mysql table using pandas, clean train tweets using nltk , create feature vectors using countvectorizer. here's code below.. import pandas pd sqlalchemy import * nltk.tokenize import regexptokenizer nltk.corpus import stopwords import re nltk.stem import snowballstemmer sklearn.feature_extraction.text import countvectorizer sklearn.linear_model import logisticregression #connect database , training data engine = create_engine('mysql+mysqlconnector://root:root@localhost:3306/machinelearning') tweet = pd.read_sql_query('select label, tweets tweetstable', engine, index_col='label') #text preprocessing (remove html markup, remove punctuation, tokenizing, remove stop words, stemming) def preprocessing(pptweets): pptweets = pptweets.lower() urlrtweets = re.sub(r'https:.*$', ":", pptweets)

c++ - Which low-level windows specific functions are used to implement std::thread/boost::thread/pthread in Windows? -

i want know low-level windows specific functions used implement std::thread/boost::thread/pthread in windows? the win32 api, createthread , core function starting thread on windows. most need know thread apis in windows can found here .

http - XMLHttpRequest with Pentaho Data Integration to get the response header -

i'm working pentaho data integration , need step gives me response header of http request. need implementatione of head method of http call because have see last-modified field of resorce on internet. tried using rest client step doesn't work. write script makes need. created modified java script value , put code inside: var req = new xmlhttprequest(); req.open('get', 'url', false); req.send(null); var headers = req.getallresponseheaders().tolowercase(); when run it doesn't gives me error there's in "headers". any suggestions? appreciate different solution to if url you're requesting on different domain can tell server not sending correct headers allow cross-domain resource sharing. access-control-allow-origin: * without server sending header way access of response (including headers) if script running on same domain (and protocol) or if setup proxy on own server data remote server. if open js console on page , run

android - Gradle not compiling for Firebase Cloud Messaging -

i noticed firebase apis have upgraded v 9.0.0 v 9.0.1 , decided change that. however not getting noticed. here error in gradle logcat error:(25, 13) failed resolve: com.google.firebase:firebase-messaging:9.0.1 error:(26, 13) failed resolve: com.google.firebase:firebase-core:9.0.1 and here gradle files build.gradle-> app apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "23.0.3" defaultconfig { applicationid "com.example.lifeline.applicationgreat" minsdkversion 15 targetsdkversion 23 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) testcompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.4.0'

sql - Interesting Query in MySQL with conditions -

here question: management wants know specific aircraft have been assigned same hangar lot (each aircraft assigned lot year , renewed if requested. lot may or may not same lot upon renewal; pk lots table registration number , date assigned. list aircraft registration number, hangar location, hangar capacity. each aircraft should appear once in report. here lots table: lot_nbr, hangar_nbr, reg_nbr, date_assigned '7706', '1', '505', '2011-07-17' '7707', '1', '505', '2012-07-18' '7708', '1', '505', '2013-12-22' '8801', '2', '101', '2011-01-22' '8802', '2', '101', '2012-01-22' '8803', '2', '303', '2011-01-10' '8803', '2', '202', '2011-04-12' '8803', '2', '202', '2012-04-12' 

python - Are grequests responses in the same order as the requests? -

i using grequests asynchronously download data website using same url different parameters. for example, unsent_requests = [] param in params: # assume params list containing different parameters or query strings unsent_requests.append(grequests.get(url = url, params = param)) responses = grequests.map(unsent) how can possibly know response responses belongs request unsent_requests? or responses in same order unsent requests? ps: response.url not give clue because different url returns. responses in same order requests, shown in usage example : >>> reqs = [ ... grequests.get('http://httpbin.org/delay/1', timeout=0.001), ... grequests.get('http://fakedomain/'), ... grequests.get('http://httpbin.org/status/500')] >>> grequests.map(reqs, exception_handler=exception_handler) request failed request failed [none, none, <response [500]>]

regex - Need regular Expression to Match the reverse of a word in a line -

Image
sample input string: regular expression tough understand user typed string: raluger expression si yllear tough ot understand in above 2 string, need parse input string , user typed strings -word word , need find match in user typed string . such if regular in input string should matches raluger . is should match si really should match yllear to should match ot note : input string not constant string , may vary. example: another sample string can like: regex have wasted time . user typed: xeger have wasted ym emit . i looking regular expression match reverse of word in line.but input word may changeable . but input string contain alphabets in both upper , lower case , along numbers in . foreward using regular expressions not ideal type of work. there ton of edge cases can encountered here. description \b([^\s])([^\s])(?:([^\s])(?:([^\s])(?:([^\s])(?:([^\s])(?:([^\s])(?:([^\s])(?:([^\s]))?)?)?)?)?)?)?\b(?=.*?\n.*?\b((?:(?:(?:(?:(?:(?:(?:\9)?\8)?

unity3d - How to rotate object around self center without any misshape? -

Image
after adding instantiated prefab parent want rotate new prefab around self center. gameobject clone = instantiate(mockup, transform.position, transform.rotation) gameobject; clone.transform.parent = gameobject.transform; clone.transform.localposition = vector3.zero; clone.transform.rotate (0, 45, 0); but misshape prefab. in case when not set parent rotates without misshaping. tried rotatearound , pass clone.transform.localeposition parameter still same. tried center clone.getcomponent<renderer>().bounds.size; and add position , pass parameter still no success. how rotate object around self center without misshape ? misshape: camera above , scale , rotate cube above not rectangle should be without rotation: after experiment able replicate probem. problem on line of code gameobject clone = instantiate(mockup, transform.position, transform.rotation) gameobject; you passing transform.rotation new position of new instantiated gameobject. transform.

html - How to make rotating shape look thick? -

i have created locker opening type of effect, without thick door, not looking good. how can add thickness door looks locker door? else can make more realistic? only css solution please, no javascript. #container { width: 100%; height: 600px; position: relative; } #maincircle { width: 200px; height: 200px; position: absolute; top: 200px; left: 50%; transform: translatex(-50%); border-radius: 50%; border: 1px solid black; perspective: 600px; transform-style: preserve-3d; } #door, #back { border-radius: 50%; background-color: grey; top: 1px; left: 1px; position: absolute; width: 99%; height: 99%; transition: transform 2s 0.5s; transform-origin: 0 50%; } #door { backface-visibility: hidden; } #locker { position: absolute; top: 25px; left: 25px; border-radius: 50%; width: 150px; height: 150px; background-image: url(https://irp-cdn.multiscreensite.com/806e9122/dms3rep/multi/tablet/combinationlock-1000x1000.png

javascript - Reset SetInterval to repeat the function on another ID -

im having trouble reseting setinterval() on 2 functions, suposed reused affected ids heres javascript: //fuction fade out function fadeout(elem, speed) { if(!elem.style.opacity) { elem.style.opacity = 1; } if(elem.style.opacity>=1){ setinterval(function(){ if(elem.style.opacity >=0){ elem.style.opacity = parsefloat(elem.style.opacity) - 0.03;} }, speed /50); if(elem.style.opacity >=1){ clearinterval(0); } } } //função fade in function fadein(elem, speed) { if(!elem.style.opacity) { elem.style.opacity = 0; } /*var timerid=*/ if(elem.style.opacity<=0){ setinterval(function(){ if(elem.style.opacity <=1){ elem.style.opacity = parsefloat(elem.style.opacity) + 0.03;} }, speed /50); } /*if(elem.style.opacity >="1"){ clearinterval(timerid); return;} */ } i have tried while fix problem, didn't help, when implement third "if" on fadeout fun

gcc - Calling printf in extended inline ASM -

i'm trying output same string twice in extended inline asm in gcc , on 64-bit linux. int main() { const char* test = "test\n"; asm( "movq %[test], %%rdi\n" // debugger shows rdi = *address of string* "movq $0, %%rax\n" "push %%rbp\n" "push %%rbx\n" "call printf\n" "pop %%rbx\n" "pop %%rbp\n" "movq %[test], %%rdi\n" // debugger shows rdi = 0 "movq $0, %%rax\n" "push %%rbp\n" "push %%rbx\n" "call printf\n" "pop %%rbx\n" "pop %%rbp\n" : : [test] "g" (test) : "rax", "rbx","rcx", "rdx", "rdi", "rsi", "rsp" ); return 0; } now, string outputted once. have tried many things, gu

java - What really is Atomic? -

what atomic? since have choose language frame question more choose java. know atomic means or rollback/do nothing. have following public class myclass { private boolean progress; public void setprogress(boolean progress) { this.progress = progress; } public boolean getprogress() { return progress; } } now of following thread-safe or atomic or both ? please treat each new line separate piece of code ------------------- getprogress(); // ------------------ ---------------------- setprogress(true); // ---------------------- ------------------- getprogress() setprogress(); ------------------- -------------------- setprogress(); getprogress(); -------------------- which of these cases make sense use atomicreference in java? from this: what operations in java considered atomic? i'd none of them atomic, since function call not atomic operation. once in

Azure Service Fabric: cannot run Microsoft Service Fabric Host Service -

i have problem azure service fabric. i have installed (on windows 7) said in https://azure.microsoft.com/en-gb/documentation/articles/service-fabric-get-started/ . but when try run service fabric application visual studio see windows service microsoft service fabric host service ("c:\program files\microsoft service fabric\bin\fabrichost.exe") fails start. service hangs several minutes , finishes following error message: faulting application name: fabrichost.exe, version: 5.0.217.100, time stamp: 0x571a85d8 faulting module name: fabrichost.exe, version: 5.0.217.100, time stamp: 0x571a85d8 exception code: 0xc0000602 fault offset: 0x00000000000b3146 faulting process id: 0xb34 faulting application start time: 0x01d1b90822b3eb43 faulting application path: c:\program files\microsoft service fabric\bin\fabrichost.exe faulting module path: c:\program files\microsoft service fabric\bin\fabrichost.exe report id: 0b7cff13-24fc-11e6-bccf-e06995ddb2c0 how can fix it?

web crawler - Does Googlebot and other spiders always pull the latest content? -

i understand using following meta tags prevent caching web browsers not proxies: <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> however, using cache headers server-side prevent caching entirely. my pages simple .html files, not dynamic (e.g., not .php). if use above meta tags, considering proxies may still cache pages, googlebot , other spiders pull latest content of site, or possibly not pull latest content since not setting cache headers server-side? using meta tags, or http headers no different bot meant convey suggestion requesting agent. if agent (google bot or proxy) set adhere protocol, pages wont't cached. however, bear in mind there flexibilities around , both proxies , se bots may react in different manner event though asked not-cache page. you have remember scope of google index page, , long can crawl can done or without cache tag, though impedi

Angular2 parse java.util.Date -

dealing java date biggest fight since forever. i received date example: 1998-01-05t00:01:00+01:00 is there way first 10 characters without cutting string? angular2 offers date pipe don't know if , how use here. thank help. ps: java.sql.date not option i resolve problem angular2 datepipe processing iso 8601 date (invalid argument '*' pipe 'datepipe')? i've created own pipe.