Posts

Showing posts from May, 2015

java - What is x after "x = x++"? -

what happens (behind curtains) when executed? int x = 7; x = x++; that is, when variable post incremented , assigned in 1 statement? compiled , executed this. x still 7 even after entire statement . in book, says x incremented! x incremented. assigning old value of x itself. x = x++; x++ increments x , returns old value. x = assigns old value itself. so in end, x gets assigned initial value.

automation - Connection aborted when using Python Requests -

i attempting write script using python requests i'm running error i've never seen before , can't decipher , google doesn't seem help. import requests email_n = 0 print ("select shoe") print (" 1 - vapormax") print (" 2 - blazer") print (" 3 - air max 90") print (" 4 - air jordan 1") print (" 5 - air presto \n") shoe = int(input("select shoe: ")) url = "123434" if (shoe == 1): url = "http://www.london.doverstreetmarket.com/nike/04.html" elif (shoe == 2): url = "http://www.london.doverstreetmarket.com/nike/05.html" elif (shoe == 3): url = "http://www.london.doverstreetmarket.com/nike/02.html" elif (shoe == 4): url = "http://www.london.doverstreetmarket.com/nike/01.html" elif (shoe == 5): url = "http://www.london.doverstreetmarket.com/nike/03.html" else: pass print (shoe) print (url) header = { 'user-

javascript - Displaying a modal per browser session? -

i testing changing cookie values nothing working want show popup per browser session. code function setcookie(cname,cvalue,hours){ var d = new date(); d.settime(d.gettime()+(hours*60*1000)); var expires = "expires="+d.togmtstring(); document.cookie = cname + "=" + cvalue + "; " + expires; } if(response.result == "success"){ jquery('.errordiv').hide(); jquery('.message').html('thank subscribing us.'); /*jquery(".subscription-error").hide(); jquery(".registration-form").fadeout("slow", function(){ jquery(".congrats").fadein("slow"); });*/ setcookie("online-popup", 1, 24*30*12); }else{ jquery('.message').hide();

php - Drupal 8 breadcrumb and books -

i have taxonomy term name "category" , url: category i have created simple page "test" tag, , url page is: /category/test because there prefix /category path, breadcrumb shows: home / category category linked taxonomy term. works charm. problem when create book page. category tag disappear breadcrump. how can keep breadcrumb based on path of taxonomy term books?

python - Is it possible to run replace on a list/subset of columns in a dataFrame? -

for example: dataset['column_1'].replace(['(null)'],['0'],inplace=true) replaces of 'error' strings in column one. if want few specific columns right i'm going: dataset['column_1'].replace(['(null)'],['0'],inplace=true) dataset['column_5'].replace(['(null)'],['0'],inplace=true) dataset['column_7'].replace(['(null)'],['0'],inplace=true) is there way combine , run same replace on list of column names? i have tried doing this: names = ['column_1','column_2','column_3','column_4','column_5','column_6','column_7'] dataset = pandas.read_csv('allvalues.csv', names=names) dataset[['column_1','column_3','column_4','column_7']].replace(['(null)'],[0],regex=true,inplace=true) but columns still being printed afterwards '(null)' string values. you can use

actionscript - Error: incorrect number of arguments expected 1 -

can please me understand wrong code? public function main { var _myscreens:screens = new screens(); this.addchild(_myscreens); } after compilation, error error: incorrect number of arguments expected 1 probably screens class needs 1 argument passed on creation of new screens object. also should have: public function main() { ... }

android - Calculating frustum FOV for a PerspectiveCamera -

Image
i have screen consisting of 2 areas: (values assumed particular example , may of course vary depending on screen). the screen in total 1080x1432px (wxh) , consists of 2 areas, each clipped using glviewport . because want area (1) not fill screen when zooming. game area. can zoomed. size 1080x1277px (wxh) , located @ top. the hud (fyi objects here can moved area (1). non zoomable. size 1080x154 (wxh). both have own cameras. area (1) width 15f , height more 15f (does not matter long it's @ least 15f). i want area (2) 7f in width , 1f in height (for convenience). want set camera accordingly. i've tried calculating fov: float size = 1f; float halfheight = size * 0.5f; halfheight *= (float) 154 / (float) 1080; float fullheight = 2 * halfheight; float halffovradians = mathutils.degreestoradians * camera.fieldofview * 0.5f; float distance = halfheight / (float) math.tan(halffovradians); camera.viewportwidth = 1080; camera.viewportheight = 154; camera.position.set

response - Creating a dataframe from counts (evil survey) -

so, before time, office did somethings silly when contracting vendor internal survey. got "base" package, didn't include raw data. bought right response option counts question. have of information, there way can stick in dataframe without tedious amounts of coding? i know won't responses matched respondent, using r building stacked bar charts, , i'm stuck. can help? lets have 50 items, 6 response options each, counts each response option each question. fun.

javascript - Complex swipe gesture for hybrid app -

how able detect "complex" swipe shapes in mobile app made javascript? complex mean detecting if user drawing circle or triangle or more complex. possible? possible in html app viewed both browser , hybrid app? require javascript library abstracts such native motions?

ruby on rails - How do I suppress db creation when running a test on my model? -

i'm trying write simple test model , don't need database created. added below file in prevent database creation myenv:myproject nataliab$ cat lib/tasks/db/test.rake rake.application.remove_task 'db:test:prepare' namespace :db namespace :test task :prepare |t| # rewrite task not don't want end end end but when run test, still below error myenv:myproject nataliab$ rails test -b test/models/my_model_test.rb running via spring preloader in process 52504 /users/nataliab/.rvm/gems/ruby-2.4.0/gems/activerecord-5.0.5/lib/active_record/connection_adapters/postgresql_adapter.rb:598:in `async_exec': pg::insufficientprivilege: error: permission denied relation schema_migrations (activerecord::statementinvalid) : select "schema_migrations".* "schema_migrations" /users/nataliab/.rvm/gems/ruby-2.4.0/gems/activerecord-5.0.5/lib/active_record/connection_adapters/postgresql_adapter.rb:598:in `block in exec_no_cache' /

amazon web services - How to write my cloud formation more reusable instead of renaming resources -

i new cloudformation , writing cfn code infrastructure of project. there issue bugs me time when writing code. let's have following resources create: resources: myec2instance: type: "aws::ec2::instance" properties: imageid: "ami-79fd7eee" keyname: "testkey" blockdevicemappings: - devicename: "/dev/sdm" ebs: volumetype: "io1" iops: "200" deleteontermination: "false" volumesize: "20" - devicename: "/dev/sdk" nodevice: {} as see creating resource called myec2instance. lets have environment called stg exact same above easy way use above code different stack name have been told need rename resource name follows: resources: myec2instancestg1: type: "aws::ec2::instance" properties: imageid: "ami-79fd7eee" keyname: "testkey" blockdevicemappings: - d

eureka forms - Custom PushRow with ability to add new values -

Image
i try implement picture below. want extend pushrow new functionality possibility add new values , clear selected value. can't figure out how extend _selectorviewcontroller , override setupform. can me in right direction. i've started, can't work. open class _myselectorviewcontroller<row: selectablerowtype>: _selectorviewcontroller<row> row: baserow { open override func setupform() { super.setupform() // implementation here } }

Revolution Slider Background Layer CSS -

i'm trying set 2 types of slides in revolution slider. there main background image slide, semi-opaque layer taking 40% of left side or right side of slide, text layer above that. have following css can achieve semi-opaque layer 1 side (right or left, in case below, left side) using 'after' psuedo selector: .rev_slider .slotholder:after{ width: 40%; height: 100%; content: ""; position: absolute; top: 0; left: 0; pointer-events: none; /* black overlay 50% transparency */ background: rgba(0, 0, 0, 0.5); }' this takes care of 1 side of transparency not other, need slide-specific class adds "left" or "right" property parent .slotholder class. suggestions? you can try use :before right side, please try use css .rev_slider .slotholder:after, .rev_slider .slotholder:before{ width: 40%; height: 100%; content: ""; position: absolute; top: 0; pointer-events: none; /* black overlay 50% transparency */ background:

node.js - Meteor Mongo BulkOp turning ObjectID into plain object -

while using meteor, access underlying node mongo driver can make bulk updates , inserts. const bulk = coll.rawcollection().initializeorderedbulkop(); bulk.insert({key_id: mongo.collection.objectid()}); // note key_id objectid ... bulk.execute(); but value of key_id fields ends being plain subdocument {_str: '...'} when in database after insert. is there way use bulk operations in node's mongo library (whatever meteor uses) , keep objectid's mongo's objectid type? (there's many posts nature of different id types, , explaining minimongo, etc. i'm interested bulk operations converting objectid's plain objects, , solving issue.) from neil's top-level comment on native method need grab native implementation. should able access loaded driver through mongointernals [...] mongo.collection.objectid not plain objectid representation, , complex object meteor internal use. hence why native methods don't know how use value.

firebase - Updating database at certain time -

i'm looking make firebase database update @ particular time. the way should work that, group, leader sets deadline time. group votes on stuff. @ deadline time, database automatically tabulate votes , store response within. i'm not sure how set these types of rules database without doing check whenever member of group online , refreshes feed. also, allow member write vote-result field, seems bad when want automatic. seems there should easier way this, can't find anything. it seems other option set separate server counts through time-frames , sends update request when time has allotted. seems firebase should have built in. i'm sure i'm missing something. thank in advance. edit: here more comprehensive @ usecase. looking cron stuff now, think solve problem, don't know. 1) leader creates group , invites friends it. event created firebase database. group created specific deadline. 2) before deadline, leader , friends can vote on options. submit dictio

How to build custom json for return with jersey java? -

hi building response using json.org, want return values usin response dont know how build response :/ for example, using json im return string in methods: public string create(product entity) { jsonobject response = null; try { new productbll().create(entity); response = new jsonobject(); response.put("status", "ok"); response.put("message","product created!"); } catch (exception ex) { response = new jsonobject(); response.put("status", "error"); response.put("message",ex.getmessage()); } return response.tostring(); } its works want using "response" return custom message similar jsonobject building

extract all words between commas in html page and put together line by line for each np++ -

i have downloaded backup facebook , moved new account want subscribe join etc favs backup, because big job 500+ groups likes etc etc copy , paste in facebook search want quick, know notepad++ great tool search replace , on, cant figure out how, have opened html page in notepad ++ see source need esp. results between td , /td each group name between comma in new line any appreciated bye

php - Notice Undefined index -

i saw several lines of errors today not know do. notice: use of undefined constant admin - assumed 'admin' in /home/qwikia.tk/public/core.php on line 14 call stack: 0.0001 238928 1. {main}() /home/qwikia.tk/public/index.php:0 0.0007 327920 2. require_once('/home/qwikia.tk/public/core.php') /home/qwikia.tk/public/index.php:3 warning: include_once(../core/engine.php): failed open stream: no such file or directory in /home/qwikia.tk/public/administration/admin.php on line 3 call stack: 0.0001 238928 1. {main}() /home/qwikia.tk/public/index.php:0 0.0007 327920 2. require_once('/home/qwikia.tk/public/core.php') /home/qwikia.tk/public/index.php:3 0.0341 1080536 3. require_once('/home/qwikia.tk/public/administration/admin.php') /home/qwikia.tk/public/core.php:15 warning: include_once(): failed opening '../core/engine.php' inclusion (include_path='.:/usr/local/php/php56/lib/php') in /ho

html5 canvas - Setting context.globalAlpha overrides the image's own alpha -

i have .png image alpha channel, , if draw canvas render image's alpha channel. if set context.globalalpha = 0.5 draw every pixel of image using alpha of 0.5, ignoring image's alpha - not want! want draw image half alpha has @ each pixel. how do this?

xcode - Ionic 3 App Error: Apple Mach-O Linker Error - No Push Notification Plugin, Not using CocoaPods -

i getting error running ionic app on ios via xcode due error "apple mach-o linker (id) error. linker command failed exit code 1 (use -v see invocation)". have tried every solution indicated on other forum posts, no luck. 1) have tried opening .xcworkspace instead of .xcodeproj 2) not using push notifications plugin. plugin have added camera. 3) have tried looking in build phases remove "pods" reference, there no reference pods. 4) have tried rebooting 5) have tried installing cocoapods.org, removing platforms/plugins, reading plugin, rebuilding, opening .xcworkspace. this not complicated app, created new blank app, added camera plugin, called getpicture on button click, , display picture in img component. that's it. any appreciated, has consumed hours , hours. i found environment, compiled when took different mac. went extreme method , reloaded os. works charm.

python - Django no module named elasticsearch_dsl.connections -

i'm trying connect django model elasticsearch server on local host when try from elasticsearch_dsl.connections import connections i error "importerror: no module named elasticsearch_dsl.connections". when use same command in django shell, works fine. search.py from elasticsearch_dsl.connections import connections elasticsearch_dsl import doctype, text, date, boolean, integer, keyword, fields elasticsearch.helpers import bulk elasticsearch import elasticsearch .models import homegym, country, rating connections.create_connection() class homegymindex(doctype): title = text() price = fields.floatfield() tags = keyword() city = text() country = text() rate = integer() opusapproved = boolean() def bulk_indexing(): homegymindex.init() es = elasticsearch() bulk(client=es, actions=(b.indexing() b in homegym.objects.all().iterator())) this leads importerror on line 1. "no module named elasticsearch_dsl.connections&qu

When should I use Twitter Bootstrap 4 shorthand spacing and sizing class utilities vs css, and why -

for example, set padding-left: // bootstrap shorthand class utility <div class="pl-1"></div> or // regular css <div class="blah"></div> .blah{ padding-left: 5px; } so practical situations use 1 or other?

File extension when open custom file with Xamarin Android -

i'm trying open custom file in xamarin android app when open can't file extension correctly or name of file. tried onedrive , works not google drive or downloads app. this androidmanifest: <application android:allowtaskreparenting="true" ...> <activity android:launchmode="singletask" ...> <intent-filter android:autoverify="true"> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:scheme="content" android:mimetype="application/octet-stream" android:pathpattern=".*\\.pec" /> <data android:scheme="content" android:mimetype="application/*" android:pathpattern=".*\\.pec" /> <data

postgresql - PostGIS: How to Create a Geometry Collection from a set of Pointz? - Geographic Information Systems Stack Exchange

i have large number of 3d points stored postgis pointz type. i'd create geometry collection these points, i'm struggling directly in sql. i've tried following, puts 1 point geometry collection: update public.geometry_collection set geometry_collection_data = st_forcecollection( (select object.geometric_point -- pointz type object,point,geometry_collection object.pk in ( select object_pk point point.geometry_collection_pk = geometry_collection.geometry_collection_pk )) ); is possible select pointz , insert selection geometry collection column? i think want this, update public.geometry_collection set geometry_collection_data = ( select st_collect(object.geometric_point) object inner join point on point.geometry_collection_pk = geometry_collection.geometry_collection_pk cross join geometry_collection ); that gets things multipoint z , if want geometrycollection z

c# - Cannot cast Outlook object to ReportItem -

i trying enumerate different mail items in outlook folder. some of mail items reportitems ... can tell because class = 46. however, when try cast __comobject reportitem using ((outlook.reportitem)item) exception: autoresolvedwinner {system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> system.runtime.interopservices.comexception: operation failed. --- end of inner exception stack trace --- @ system.runtimetype.invokedispmethod(string name, bindingflags invokeattr, object target, object[] args, boolean[] byrefmodifiers, int32 culture, string[] namedparameters) @ system.runtimetype.invokemember(string name, bindingflags bindingflags, binder binder, object target, object[] providedargs, parametermodifier[] modifiers, cultureinfo culture, string[] namedparams) @ system.dynamic.idispatchcomobject.getmembers(ienumerable`1 names)} system.reflection.targetinvocationexception if helps, messageclass property of object

parsing - Parse error: syntax error, unexpected '[' -

was trying install wp plugin- dt world clock , got error msg. the actual error msg: parse error: syntax error, unexpected '[' in /var/www/html/wp-content/plugins/dt-world-clock/dt-world-clock.php on line 415 and line 415 is: function dt_world_clock_shortcode($atts = [], $content = null, $tag = '') { i have no idea edit- would appreciate help...    try function dt_world_clock_shortcode($atts = array(), $content = null, $tag = "") {

PHP Session MVC using CodeIgniter -

so have been developing simple login , insert data pages using codeigniter, want every user has own data kept in db , every user has own set of-db. focus here session first, because can't session code. i new php , never use php native 1 before. here controller: public function login(){ $this->load->library('session'); $email = $this->input->post('email'); $password = $this->input->post('password'); log_message('error','isi email : '.$email); log_message('error','isi password : '.$password); $return = $this->welcome_model->checklogin($email, $password); if($return){ $this->session->set_userdata('email',$email); $var = $this->session->userdata; redirect('welcome/masuk');} model: public function checklogin($email, $password) { $return = $this->db->get_where('login',array('email'=>$email,

pyautogui - How can I on mac using python press keys in other applications? -

i looked around past day or information on how python script work using pyautogui. pretty want press button in game drive car. didn't work , tried couple of things slowing down time module. , stuff. tried in flash game on internet , worked fine. reading around , found out pyautogui uses virtual keys might using different way of input game want use used to. found out have use scan codes directly keyboard input. found script online on website uses window api. i've looked around mac stuff maybe create own. lot of libraries tried using didn't seem work , believe used virtual keys. can point me in right direction this? import pyautogui import time; while true: pyautogui.keydown('a') time.sleep(2)

msbuild - Visual Studio Build Tools 2017 for Office VSTO -

Image
i have installed vs build tools 2017 on build server. when try build /t:publish /p:publishdir="pub/" _deploymentunpublishable: skipping unpublishable project. is there way fix or need install full vs office developer tools? is there way fix or need install full vs office developer tools? i got same error msbuild arguments on command line: you need configure msbuild command line on build server 2 additional arguments: /p:deployonbuild=true , /p:publishprofile=your_publish_profile.pubxml instead of /t:publish /p:publishdir="pub/ . so msbuild command line should be: msbuild.exe "yourprojectname.csproj" /p:deployonbuild=true /p:publishprofile=publishprofilename.pubxml of course, need create publish profile .pubxml, don't need specified path publish_profile.pubxml long it's under publishprofiles directory project file. update ant`s comment: since project type "excel 2013 , 2016 vsto add-in", not "excel

c# - WCF message security with username credential type -

i work on project has tcp wcf service message security mode , username credential type certificate. when client call wcf service error occurred: exception : secure channel cannot opened because security negotiation remote endpoint has failed. may due absent or incorrectly specified endpointidentity in endpointaddress used create channel. please verify endpointidentity specified or implied endpointaddress correctly identifies remote endpoint. inner exception : request security token has invalid or malformed elements. how can fix it? service web.config <?xml version="1.0"?> <configuration> <configsections> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false"/> </configsections> <appsettings> <add key="a

javascript - Function undefined when run through chrome browser -

i have small project i'm working on, , reason chrome says code below undefined. html: <input type="reset" onclick="cleartxt()" class="rset" value="clear text"></input> javascript: var cleartxt = function() { document.getelementbyid("text").value = ""; }; can me figure out why functioning way? your code working fine. here working snippet. var cleartxt = function() { alert('reset working'); document.getelementbyid("text").value = ""; }; <input type="text" id="text" /> <input type="reset" onclick="cleartxt()" class="rset" value="clear text"/>

javascript - multiple images upload using FormData and separate fields -

i want start upload images server before submit form can't nest forms use formdata() the form contain title , 5 images captions , want start upload once choose image without click upload , , without submit main form , prevent submiting form until images uploaded this part of code work first input only $(document).ready(function(){ var counter = 2; $("#howaddbutton").click(function () { if(counter>25){ alert("error"); return false; } $('#file' counter +).change(function(){ var file_data = $('#file' counter +).prop('files')[0]; var form_data = new formdata(); form_data.append('file' counter +, file_data); $.ajax({ url: "upload.php", type: "post", data: form_data, contenttype: true, cache: false, processdata:true, success: function(data){ console.log(da

c# - WPF - Binding to ListView cannot work -

code behind, try bind listview obserablecollection packageinfos. however, when run it, shows no information. can slove it? public partial class mainwindow : window { public mainwindow() { initializecomponent(); packageinfos = new observablecollection<packageinfo>(); polulatepackageinfos(); datacontext = this; } public observablecollection<packageinfo> packageinfos { get; private set; } private void polulatepackageinfos() { packageinfos.add(new packageinfo() { name = "apple", pricerate = "10", imageurl = "images/greatwallofchina.jpg" }); packageinfos.add(new packageinfo() { name = "beijing", pricerate = "6", imageurl = "images/greatwallofchina.jpg" }); packageinfos.add(new packageinfo() { name = "china", pricerate = "4", imageurl

javascript - Jquery get values from json into select -

i have json array looks this [{ "": "select state/region" }, { "bal": "balkh" }, { "bam": "bamian" }] i trying values out of using jquery, can't seem loop through. this i've tried var value = $(this).val(); var url = '{{ route('getstatesjson') }}'; $.getjson(url, { state: value }, function(obj) { (var = 0, len = obj.length; < len; i++) { } }); but can't seem pull of objects out. idea can use first value value , second value text in select. you have below:- $.getjson(url, { state: value }, function(obj) { var html = ''; $.each(obj,function(key,value){ $.each(value,function(k,v){ html +="<option value='"+k+"'>"+v+"</option>"; }); }); $('put select-box id or class').html(html); }); demo example:- obj = [{ " ": "select state/region"

Very complex C infinite loop debugging -

i want color stand alone digits, not preceded alphabetical character , terminated numeric one. can guess why when use program write existing text file text file, several megabytes in size in seconds? there infinite loop occurring. char ch; _bool finished = true; void color(); void skip(); int main() { while (finished) { ch = getchar(); if (ch == -1) { finished = false; } if ( (ch >= 'a' && ch <= 'z') || (ch >= 'a' && ch <= 'z') ) { skip(); } else if (ch >= '0' && ch <= '9'){ color(); } else { printf("%c", ch); } } return 0; } void color() // color characters numbers { printf("\e[31m%c\e[0m", ch); } void skip() // skip whole words , still print them { putchar(ch); while ((ch = getchar()) != ' ') { printf(&q

unicode - Copy/Paste non space separator character? -

i trying trick word count in text form when read person space between 2 words looks typical space word count read character not space. so phrase "two words" technically 1 word in word count because space not read space character? ideas? i've tried few whitespace characters i'm not sure if read differently. is possible or word counters take consideration? running seriff's suggestion... .w { color: white; } <body> <text>this<text class="w">.</text>seems<text class="w">.</text>a<text class="w">.</text>little<text class="w">.</text>silly...</text> </body>

html - How to fix images in visual composer don't expaned layout -

i create element textarea_html container image overflowed. me fix error. image overflows code param teaxtarea_html array( 'type' => 'textarea_html', 'holder' => 'div', 'heading' => __( 'text', 'japan-language' ), 'param_name' => 'content', 'value' => __( 'default value', 'japan-language' ), 'description' => __( 'box text', 'japan-language' ), 'admin_label' => false, 'weight' => 0, 'group' => 'custom group', )

how to export mutiple page attachements in xwiki 9.7 -

i working on xwiki 9.7,i have created multiple pages when exporting pages images not shown in pdf. like "servername/xwiki/bin/export/wikispace/wikipage?format=xar&pages=wikispace.wikipage&pages=sandbox.projecttest &pages=managers.leaders&pages=xwiki.mydashboard" i exporting multiple pages you seem have found bug. mind reporting @ http://jira.xwiki.org/browse/xwiki can fixed? note think i've found more info it. if call following url http://localhost:8080/xwiki/bin/export/sandbox/webhome?format=pdf (or http://localhost:8080/xwiki/bin/export/sandbox/webhome?format=pdf&pages=sandbox.webhome ), image appears fine. however if call http://localhost:8080/xwiki/bin/export/a/b?format=pdf&pages=sandbox.webhome image doesn't appear. seems context issue. thanks

LOOP IN PHP / MYSQL -

Image
i have record of dates , logid. wonder if display dates depending on logid 2017-09-01 2017-09-05 logid = 015511439 2017-09-01 2017-09-05 9272276416 . i made loop php for ($x = 0; $x <= 1; $x++) then @ mysql plain select date, logid mytable . thanks in advance $query = "select * mytable"; $results=mysql_query($query); $row_count=mysql_num_rows($results); while ($row_users = mysql_fetch_array($results)) { //output row here if($row_users['logid']=="015511439"){ echo ($row_users['date']); echo ($row_users['logid']); } } or without if condition can using clause.... hope looking for