Posts

Showing posts from January, 2010

winforms - VB.NET Fading out button properly -

how fade out/in button in vb.net properly? can fadeout/in labels using: controls(i).forecolor = color.fromargb(255, alpha, alpha, alpha) (where controls(i) label for next loop through controls in me.controls ; alpha value of rgb, for next loop). this did not work me buttons because changing forecolor leaves rest of buttons' uis visible! so, way i'm trying uses saved resource image of button (from screenshot) , creates faded in/out version displayed image in picturebox : public function setimageopacity(byval imgpic image, byval imgopac double) image dim bmppic new bitmap(imgpic.width, imgpic.height) dim grpic graphics = graphics.fromimage(bmppic) dim imgatt new imageattributes() dim cmxpic new colormatrix() cmxpic.matrix33 = imgopac imgatt.setcolormatrix(cmxpic, colormatrixflag.[default], coloradjusttype.bitmap) grpic.drawimage(imgpic, new rectangle(178, 144, bmppic.width, bmppic.height), imgpic.width, imgpic.height, imgpic.widt

How to select multiple avg(column) in one select statement in MySql stored procedure? -

i find when select 1 avg(column) variable,it ok.but when select more 1 avg variable,it wrong.i not want write twice,how fixed it? //work select avg(mathpoint) mathpoint student sex=1 select avg(englishpoint) englishpoint student sex=1 //do not work select avg(englishpoint) englishpoint, avg(mathpoint) mathpoint, student sex=1 you have syntax error on into usage. into should follow variable names after selecting fields. example : select avg(englishpoint), avg(mathpoint) englishpoint, mathpoint student sex=1 documentation : select ... syntax select ... var_list selects column values , stores them variables.

Using NSTimer is Swift causes 'deinit' not to call -

after using nstimer, class deinit method never called. class written in swift, , call timer @ "init" so: init(eventsdistributor : eventsdistributor, orderside : order_side, stockviewmodel : stockviewmodel, ordertype : order_type_enum, orderprice : nsnumber) { self.eventsdistributor = eventsdistributor self.orderside = orderside self.stockviewmodel = stockviewmodel self.ordertype = ordertype self.orderprice = orderprice super.init() _events() loadpreorderdetails() //here call timer: var reloadtimer = nstimer.scheduledtimerwithtimeinterval(10.0, target: self, selector: "loadsecuritytradeinfo", userinfo: nil, repeats: true) reloadtimer.fire() } i tried using nstimer local variable too, , no success there... facing issue? there timer can use in swift not causes class not dealloced? thanks the timer has strong reference target (self). , target scheduled run loop, holds strong reference until timer inv

html - PHP mail function doesn't complete sending of e-mail -

<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: yoursite.com'; $to = 'contact@yoursite.com'; $subject = 'customer inquiry'; $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } ?> i've tried creating simple mail form. form on index.html page, submits separate "thank submission" page, thankyou.php , above php code embedded. code submits perfectly, never sends email. please help. there variety of reasons script appears not sending emails. it's difficult diagnose these things unless there obvious syntax error. without 1 need

Stop Meteor http from slowing down page requests -

i'm quite new meteor , relatively new js well. the code i'm using is: server/methods.es6 var cheerio = meteor.npmrequire('cheerio'); /*****************************************************************************/ /* server methods */ /*****************************************************************************/ meteor.methods({ /* * example: * * '/app/items/insert': function (item) { * } */ player: function () { const url = 'http://cdn.content.easports.com/fifa/fltonlineassets/c74ddf38-0b11-49b0-b199-2e2a11d1cc13/2014/fut/items/web/165434.json'; const response = meteor.http.get(url); return response; } }); client/templates/cars/cars_list.es6 meteor.call('player', function (err, res) { if (err) console.log(err); console.log(json.parse(res.content)); session.set('player', json.parse(res.content)); }); /*****************************************************************************/ /

C# Excel Add In: Get active worksheet as XML -

i have working word add in, saves selected part of document (including images, tables, etc) xml string in database. add in can retrieve saved xml strings , insert current position of open document, preserving styling , formatting. i want same excel. want xml string represents active worksheet, save database , later retrieve xml string , insert worksheet active workbook. the problem is, can't figure out how obtain xml string, nor can figure out how insert worksheet. have been experimenting , searching hours, no avail. getting active sheet seems easy: dynamic sheet = globals.thisaddin.application.activesheet; but haven't been able further. for reference, how got xml string in word: microsoft.office.interop.word.selection currentselection = globals.thisaddin.application.selection; string xmlstring = currentselection.xml; to insert it, used: string xmlstring = ...; // read string database. microsoft.office.interop.word.selection currentselection = globals.this

javascript - How to show or hide a div on the basis of a java variable value -

i working in application getting variable values user end , on basis of values open , show div. taking values in scriplet , want show or hide div on basis of value. here posting , explaining code <% user user = (user) request.getattribute(webkeys.user); int useridint = (int) user.getuserid(); list<profile> existingprofile = profilelocalserviceutil.getbyuserid(useridint); string address1 = ""; string address2 = ""; int countrycode = 0; int statecode = 0; string city = ""; string zipcode = ""; string skypeid = ""; string twitter = ""; string primaryphone = ""; string secondaryphone = ""; for(int i=0;i<existingprofile.size();i++) { address1 = existingprofile.get(i).getaddress1(); address2 = existingprofile.get(i).getaddress2(); countrycode = existingprofile.get(i).getcountryid(); statecode = existingprofile.get(i).getstate(); city = existingprofile.get

c# - ASP selectable grid/table, programmatically generated -

i need populate sort of grid/table programmatically , have respond user clicks. i can populate asp table doesn't seem have onclick or onselectionchanged events. the asp datagrid seems have data bound, that's ok because can programmatically build datatable , bind that. except don't seem able populate cells in table (though can build rows , columns) also, have built gridview 2 empty rows of 2 columns , handler attached onselectedindexchanged event never gets fired. why not? because cells empty? i new asp , web coding in general please forgive stupid questions!

python - Global name 'bluetooth' is not defined -

i working bitalino board , wanted print data python when run proper code, shows me message global name 'bluetooth' not defined according pc board connected via bluetooth. don't know problem is, me? pd: using mac os x. this part of code problem may be: try: import bluetooth bluetooth import discover_devices except importerror: pass import serial serial.tools import list_ports import time import math import numpy class bitalino(object): def __init__(self): """ bitalino class: interface bitalino hardware. """ self.socket = none self.analogchannels = [] self.number_bytes = none self.macaddress = none self.serial = false def find(self, serial=false): """ search bluetooth devices nearby output: tuple name , mac address of each device found """ try: if serial:

reporting services - SSRS Color Expression Lesser than X -

i have table handles stock, have data outputting in table in ssrs can see stock levels. so: partnumber, partdescription, qty i can use =iif (fields!qty.value < 40, "red", "teal") on quantity field set threshold within table applies every row. is there way set unique thresholds per row (partnumber)? if have threshold every partnumber can store in reportdatasource . for example: partnumber , threshold , partdescription , qty then change expression in: =iif(fields!qty.value < fields!threshold.value, "color1", "color2")

linux - /usr/lib/* files had been deleted, how to restore these files -

i accidently deleted files in /usr/lib/, how resotre files!! os centos 6.6. several command cannot used,such as:yum,rpm. should do, boss kill me~~ help. step 1: remove disk machine step 2: add disk machine non-primary disk step 3: boot other machine, , mount non-primary disk , (if separate) /usr , /usr/lib /mnt/usr/lib step 4: recover recent backup

Java 8 lambdas grouping reducing and mapping -

given list of following transaction class, using java 8 lambdas, want obtain list of resultantdto , 1 per account type. public class transaction { private final bigdecimal amount; private final string accounttype; private final string accountnumber; } public class resultantdto { private final list<transaction> transactionsforaccount; public resultantdto(list<transaction> transactionsforaccount){ this.transactionsforaccount = transactionsforaccount; } } so far, use following code group list<transaction> accounttype . map<string, list<transaction>> transactionsgroupedbyaccounttype = transactions .stream() .collect(groupingby(transaction::getaccounttype)); how return list<resultantdto> , passing list each map key constructor, containing 1 resultantdto per accounttype ? you can in single stream operation: public list<resultantdto> convert(list<transaction> transactions)

Best way redirect REST service request on glassfish + JAX-RS to https URL? -

i have implemented rest service on glassfish4 + jax-rs. want use https connection authentication. the uri http http://myhost/myapp/services/rest/myservice , https https://myhost_2/myapp/services/rest/myservice . want prevent usage of http://myhost/myapp/services/rest/myservice . i think 1 way redirect request on http://myhost in rest jax-rs class https://myhost_2 . way? how can implement this? you answer requests http 301 (moved permanently, telling client use new location in future requests) pointing https equivalent in location header of response.

Image thumbnail creation error in MediaWiki on Windows IIS7 with php -

i facing strange problem, , frustrated it the problem follows: wiki hosted on linux based server php 5.3, has been moved iis7 php 5.4 problem when upload images: if upload image normal name : foobar.png works fine, mean uploaded , thumbnails displayed, when try upload image german characters : ü ö ä Ä Ü Ö... image thumbnail not created , wiki throws error message, "error creating thumbnail" research found out wiki doesn't work windows in case of course not solution problem actually. i tried modify character type string window-1250 before passing path function save thumbnail( in short tried hack core of wiki) didn't worked. there possible solution problem ? afaik, it's impossible windows handle uploads: https://phabricator.wikimedia.org/t3780 , https://www.mediawiki.org/wiki/manual:configuring_file_uploads#known_problems_on_windows however, test sha-1 file repository feature being introduced in mediawiki 1.26alpha. process switch should like

C/C++ arrays with threads - do I need to use mutexes or locks? -

i new using threads , have read lot how data shared , protecting data. have not got grasp of when need use mutexes , locks protect data. below description of problem working on. important thing note time critical need reduce overheads as possible. i have 2 fixed size double arrays. the first array provide data subsequent calculations. threads read values never modified. element may read @ time of threads. the second array used store results of calculations performed threads. element of array ever updated 1 thread, , once when result value written it. my questions then? do need use mutex in thread each time access data read-only array? if explain why? do need use mutex in thread when writes result array though thread ever writes element? should use atomic data types , there significant time on head if do? a lot of answers type of question seems - no, don't need mutex if variables aligned. array elements in example aligned, or there way ensure are? t

javascript - Abort HTTP request when redirect -

i got page uses angular , when page loaded, requests data http call. problem if user navigates other page while http call going on, system gives error , gives me http error callback showing alert "error". $http.get('/api/something/).success(function (data, status, headers, config) { alert(data); }).error(function (data, status, headers, config) { alert('error'); }); what want instead abort http call , move user other page without error function being called. so far found this . but can't see how can use fix problem.

angularjs - How to access wrapped variables in a directive? -

i have object consists of multiple arrays : $scope.myarrays = { array1: ['pizza', 'spaghetti'], array2: ['lasagne', 'schnitzel'] }; moreover, have custom directive want pass object myarrays , bind arrays scope variables : <my-directive my-data="myarrays"></my-directive> myapp.directive('mydirective', function() { return { restrict: 'e', scope: { arrayone: '=mydata.array1', arraytwo: '=mydata.array2' }, link: function(scope, elem) { // access scope.array1 , scope.array2 } }; }); all in fiddle play around! is there way bind arrays directly or need bind arrays: '=myarrays' , access them arrays.array1 ? binding has 1 one, cannot that. yes, have access arrays inside directive. myapp.directive('mydirective', function() { return { restrict: 'e',

shell - Error loading D:\cygdrive\d\path\to\my\file.pdf -

in cygwin emacs 24.5.1, when exporting org file (using c-c c-x c-e ), sumatrapdf gets open, displays "error loading d:\cygdrive\d\path\to\my\file.pdf". to clear, pdf correctly created on disk, path sent pdf viewer wrong... i'm using same .emacs file windows emacs no problem exporting org pdf. where should finding out problem?

Inserting column name headers into a Python list -

i trying insert column headers python list. csv file using not have column names , data separated commas. trying write program don't have insert column names csv file every time make weekly maps in arcgis. turn csv dictionary if needed. either way fine. have code far produces dataset useable. know how reference columns in dictionary column name. same method doesn't seem work inserting column names column position. import os os.chdir('c:\users\####\desktop') filedata = open('south_06_01_2015_secfile.csv','rb') def dataheader(): headerline = filedata.readline() valuelist = headerline.split(',') yield valuelist def databody(): line in filedata.readlines(): segmentline = line.split(',') yield segmentline[0:6] def dataprinter(): gen1 = dataheader() gen2 = databody() print'\n' row in gen2: print row dataprinter() assuming, user inserts names of columns , csv file

sql - Bash creating csv from values -

i'm trying create csv in bash script values i'm getting non-csv file. problem see values have commas(,) in them. the csv file wrong because of (the values commas in them 2 or more different values now) there way rid of problem or other way build csv in bash script. can create other files too, needs compatible standard sql import. thanks i added quotation marks before , after every value , works great. csv looks should.

asp.net - Are intranet sites vulnerable to CSRF? -

i have developed , deployed mvc5 .net app runs within intranet , uses ldap authenticate users. since mvc 5 gives @html.antiforgery() default used them in every from. in production app running in multiple nodes i'm having problems tokens when sessions expire etc. so wondering if should using them in first place or if remove them since site runs on intranet. yes, are. example, malicious user send 1 of employees , email containing clear gif url points @ 1 of intranet pages, or employee visit web page contains javascript posts 1 of intranet pages. the mitigation clear gif attack design intranet site requests never update state or perform sensitive operations. the mitigation script/post attack include csrf token in of forms.

jquery - Create a custom Lightswitch control that mimicks the lookup function -

the lightswitch html5 built-in controls allow lookups related tables if related table has primary key related table being edited on ui. i make custom control mimics behavior of control (the search function) table not have such primary key. what ui components (which specific jquery ui controls lightswitch using here) involved in control, , take mimic it? ok, so think msdn post best way go it. firstly read post how import views datasource , set them correctly. know view in same datasource, you'll handling production database opposed intrinsic datasource controlled lightswitch designer. bare in mind during testing id's in live data may not match test data id's. one thing take note of "modeling key" section of msdn blog post. if don't model you're primary key right can bit messy. to add view lightswitch application, right click data sources in server project , click add data source... choose database , click next, choose sql serve

Creating a loop in PHP using Array with SQL values in combination with manual control through button -

i trying create loop in can create set 10 random questions questions table in sql database. when have these, want store them in list further use, , add them table in database called didwell. in table saved whether answered question right. $this->connect(); // 10 random questions , put them elsewhere in database , make list for($i = 1; $i <= 10; $i++) { $question = mysql_query("select questionnumber, question, goodanswer, badanswer `question` subjectid = '$subject' order rand() limit 1"); $question = mysql_fetch_array($question); $question = $question['questionnumber', 'question', 'goodanswer', 'badanswer']; $insertquestion = mysql_query("insert didwell (`username`, `questionnumber`, `answer`) values ('$username','questionnumber','3')"); in order see if person pressed right button, want compare button value goodanswer value sto

linux - Docker: How to create a stack, multiple images or one base image? -

Image
i new using docker, , got doubt of using 1 image base stack or have define each image depending on needs. example, reading blog creating website using docker author suggests following stack: image taken http://project-webdev.blogspot.de/2015/05/create-site-based-on-docker-part4-docker-container-architecture.html now, seen structure, if have base images in docker registry technologies mongodb, io.js, nginx, why on examples not use images insted of using single docker base image everything? i'm author of blog post/series, let me elaborate on reason why i've chosen 1 base image. :) docker offers possibility use common base image subsequent images, can stack images , each image contains diff underlying image (that's big advantage of docker!). can save disk space , ram. if don't care (i mean ram , storage cheap) can use multiple images. another advantage of 1 base image can configure/secure base image based on needs. if use different base image each cont

javascript - React issue with updating state during re-render -

i have 2 components, staticcomponent , interactivecomponent. staticcomponent shows user's information. has link edit information. link has onclick fires off handleeditclick function. replaces staticcomponent interactivecomponent has form. var staticcomponent = react.createclass({ handleeditclick: function (event) { event.preventdefault(); react.render(<interactivecomponent user_info={this.props.user_info} form_status={'form-to-be-sent'} />, document); }, }) the interactivecomponent sets state of user_info props. assigns state's formsubmissionstatus value 'form-to-be-sent' initial state, again props. component has handlesubmit function , render function. var interactivecomponent = react.createclass({ getinitialstate: function() { return { user_info: json.parse(this.props.user_info), formsubmissionstatus: this.props.form_status }; }, handlesubmit:

postgresql - Netezza TO_CHAR Function not evaluating appropriately? -

i having issues query that, if ran hard-coded dates, insert correct number of rows table (170k+). issue is, when try automate it, replacing hard-coded dates date functions, query insert single row newly truncated table. example hard-coded date: '20150401' sample of same date, using date function: to_char(last_day(add_months(now(), -3))+1, 'yyyymmdd') the above to_char function returns desired result, when ran separately. here cleaned-up version of query results in single row being inserted: insert schema.insert_table( select to_char(now(), 'yyyymm') tran_month, sum(case when b.date = to_char(last_day(add_months(now(), -3))+1, 'yyyymmdd') 'do stuff' end) stuff1, sum(case when b.date = to_char(last_day(add_months(now(), -3))+1, 'yyyymmdd') 'do other stuff' end) stuff2, sum(case when b.date = to_char(last_day(add_months(now(), -3))+1, 'yyyymmdd') 'do w

php - Symfony : is there a best practice about the directories' name including traits and interfaces? -

i guess can't create trait or interface directory inside bundle since keyword bring problems when used (i.e. use mybundle\trait\mytrait ). is there best practice how name these directories ? regarding naming convention, see coding standards regarding directory structure, don't put them in trait directory. depends on how want organize code. generally, people put trait inside package folder behaviour represents, i.e., mysql\connectiontrait

C# Update a Variable -

this question has answer here: c# string textbox 5 answers i want enter animals using variable. example: private void button14_click(object sender, eventargs e) { string newanimal; newanimal = "pig"; if (textbox1 = newanimal) { //some other code } } is possible update variable newanimal different animal, cow in different textbox, textbox2? cant figure out how update variable thank you. beginner. appreciated. here how put content of textbox2 newanimal string: private void button14_click(object sender, eventargs e) { string newanimal; newanimal = "pig"; if (textbox1.text == newanimal) { newanimal = textbox2.text; } } note check equality, should use == operator instead of = .

java - Is there any reason to still use int as opposed to long on a 64 bit machine? -

in general, there reason still use int opposed long in java if programming on 64 bit architecture? specifically in case: i use int variables being mapped keys(sequential numbers starting 1 , incremented each new entry) of type number on oracle db table. the db type number has way more precision int correct way model on java side long . i stuck int efficiency reasons , because never have many entries in table need more int can represent. on other hand, since modern machines 64 bit anyways, shouldn't make difference regarding efficiency on java side use long opposed int , right? guess make difference memory wise if load huge lists of keys memory not doing kind of operation. on 64-bit processor, long give marginal performance boost because of alignment, registers, whatever (whether or not palpable debatable). comes drawback of using more space on stack , heap, impact performance negatively. really, depends on program, since there many factors impact pe

php - PDO not returning any rows -

this setting isn't returning database. it's first time using pdo, i'm missing something. it's not throwing errors @ all, empty result. $results = array(); $stmt = $bd->prepare("select beer.beer_name, prices.price, prices.shop_name beer, prices beer.beer_name = prices.beer_name , shop_id = :retailer"); $stmt->bindvalue(':retailer', $retailer); $stmt->execute(); $results[0] = $stmt->fetch(pdo::fetch_assoc); print_r($results[0]); you don't need set array before hand, , can check results before using $query->rowcount() . here example using error catching: try { // enabled throwing errors - can remove after debugging $db->setattribute(pdo::attr_errmode, pdo::errmode_exception); // prepare statement $stmt = $bd->prepare("select beer.beer_name, prices.price, prices.shop_name beer, prices beer.beer_name = prices.beer_name , shop_id = :retailer"); // can use bindparams, use exe

Creating a table of duplicates from SAS data set with over 50 variables -

i have large sas data set (54 variables , on 10 million observations) need load teradata. there duplicates must come along, , machine not configured multiload. want create table of 300,000 duplicates can append original load did not accept them. logic i've read in other posts seems tables few variables. there way create new table each observation having same combination of 54 variables listed. i'm trying avoid proc sort...by logic using 54 variables. query builder method seemed inefficient well. thanks. using proc sort way it, need create nicer way key off of it. create test data. data have; x = 1; y = 'a'; output; output; x = 2; output; run; create new field equivalent appending of fields in row , running them though md5() (hashing) algorithm. give nice short field uniquely identify combination of values on row. data temp; length hash $16; set have; hash = md5(cats(of _all_)); run; now use proc sort , our new hash field key.

scala - missing arguments for method apply... Play Framework 2.4 compilation error -

compilation error: missing arguments method apply in class newpost; follow method `_' if want treat partially applied function i don't understand how template handling methods have , complier require of me. https://github.com/flatlizard/blog controller: def addpost = action{ implicit request => ok(views.html.newpost(postform)) } def createpost = action { implicit request => postform.bindfromrequest.fold( haserrors => badrequest, success => { post.create(post(new date, success.title, success.content)) ok(views.html.archive("my blog", post.all)) }) } routes: get /archive/new controllers.application.addpost post /archive controllers.application.createpost view: @(postform: form[post])(content: html)(implicit messages: messages) @import helper._ @form(routes.application.createpost) { @inputdate(postform("date")) @textarea(p

javascript - Converting string of coordinates to lat long array for google maps api v3 returning longitude as 0 -

i've taken @ other questions basically, have long list of coordinates string looks this: "42.2723998, -81.23239 ... 42.84099, -81.3990398" have use javascript .split(" , "); on array called coordinate[] of strings each holding 1 coordinate , using below code: // create coordinate array var polygoncoords = []; // creates new latlng var j = 0; var z = j + 1; while (z < coordinate.length) { if ((j%2) === 0) { var co1 = parsefloat(coordinate[z]); //document.write(coordinate[j]); var co2 = parsefloat(coordinate[j]); //document.write(co2); var newlatlng = new google.maps.latlng(co1,co2); polygoncoords.push(newlatlng); } else { var co2 = parsefloat(coordinate[z]); var co1 = parsefloat(coordinate[j]); var newlatlng = new google.maps.latlng(co1,co2); polygoncoords.push(newlatlng); } z++; j++; } but when print out polygoncoords array, returns longitude 0 , i've parsed string using pars

NVCC Cuda 5.0 on Ubuntu 12.04 /usr/lib/libudt.so file format not recognized -

i trying install cuda 5.0 on ubuntu 12.04 parallel programming. need use nvcc cross compilation feature, therefore, after installing cuda 5.0 (add path also), having errors when using nvcc cross compilation . this command want run: nvcc -gencode arch=compute_20,code=sm_20 -xptxas -v test.cu -o test -dlinux -dia32 -target-cpu-arch=arm -ccbin=/usr/bin/arm-linux-gnueabihf-g++-4.6 -m32 -o3 -xcompiler -fopenmp -i/usr/local/include -l/usr/local/lib -i/usr/include/thrust -ludt -lstdc++ -lpthread -lm -l/usr/local/cuda-5.0/lib -l/usr/local/cuda-5.0/lib -i/usr/local/cuda-5.0/include -i/usr/local/cuda-5.0/include initially, fails error message: ptxas info : 0 bytes gmem ptxas info : compiling entry function '_z5hellopcpi' 'sm_20' ptxas info : function properties _z5hellopcpi 0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads ptxas info : used 5 registers, 40 bytes cemm[0] /usr/lib/gcc/arm-linux-gnueabifh/4.6/../../../../arm-linux-gnueabifh/bin/ld:can n

jquery - Making CSS clip rect responsive -

Image
i'm trying implement little here: http://atmapp.io/beta/ i'm clipping google maps object, fit in phone area. works great on 1920x1080 (mainly because hardcoded rect's values). how can make clip: rect responsive? i've tried jquery, i'm idiot, , i'm miles off: css #map-canvas2 { width:100%; height: 100%; position: absolute; z-index: 9999; bottom: 0; clip:rect(191px, 1579px, 732px, 1275px); } jquery var oldresx = 1920; var oldresy = 943; var recttop = 191; var rectright = 1579; var rectbottom = 732; var rectleft = 1275; var newrecttop; var newrectright; var newrectbottom; var newrectleft; var newresx; var newresy; $(window).resize(function(){ newresy = oldresy - window.innerheight; newresx = oldresx - window.innerwidth; newrecttop = recttop + newresy; newrectright = rectright - newresx; newrectbottom = rectbottom - newresy; newrectleft = rectleft + newresx; //alert(newresx + "x" + newresy);

jquery - Position Div below window height -

lets see below example <div>main content<br><br>main content fills windows height</div> <div id="belowcontent">content show below windows height</div> i tried below $("#belowcontent").css("margin-top", $(window).height()); but problem here div using height previous div,not browser top.i tried position absolute too.still not working. p.s: if pure css method , thats advantage absolute positioning you use absolute positioning top declaration. in case i've set top 100vh place below screen height. html, body { margin: 0; padding: 0; background: lightgray; } .main { background: cornflowerblue; } #belowcontent { position: absolute; top: 100vh; background: tomato; } <div class="main">main content <br> <br>main content fills windows height</div> <div id="belowcontent">content show below windows height</d

Error 403 when posting on Facebook a Joomla URL for multilingual site -

i have multilingual joomla3 website www.mekako.fr the server redirects french language default (or italian/english detects lagnuages) the problem arises when try posto facebook wall/page link www.mekako.fr, gives "403 access denied", if post www.mekako.fr/fr or www.mekako.fr/it ok... on windows hosting, no .htaccess, web.config used... any explanation? "root url" unavailable because redirects correct language? thanks, following links provided found hint gzip compression... disabled gzip compression in joomla , working now... see: facebook open graph, required property 'og:title' of type 'string' not provided

Nginx access_log default flush time -

how nginx flushes buffer access_log default ? in manual there not info, setup syntax: access_log path [format [buffer=size [flush=time]] [if=condition]]; did bit of research on myself, , far can tell nginx doesn't flush buffers @ if not specify flush parameter. (or if does, it's more 20 minutes.) the exception if restart server, logs flushed before restart. so if specify buffer should make sure specify flush time too.

performance - Using hashes as IDs in key-value stores -

i'm wondering whether idea use hashes (cityhash, murmur , like) keys in key-value store hazelcast. i'm expecting have 2,000,000,000 records (urls) in database, collisions happen. wouldn't super critical lose data through hash collisions, of course best avoid them. a record contains url, time stamp, status code. main operations inserting , looking whether url exists. so, suggest, given speed relevant: using id generator , or using hash algorithm cityhash or murmur, or using relevant string, url in case, itself? hazelcast not rely on hashcode/equals methods of key object, instead using murmur hash of binary representation of key. in short, should not worry hash collisions.

PHP not recognizing GET variables with hash in the URL -

i have url like: http://www.example.com/page.php#tabname the hash automatically open specific tab on page. i need work _get variable, , url like: http://www.example.com/page.php#tabname?color=red then on page, have: echo $_get['red']; ...but getting undefined index error. how php recognize variable? you need put query string before hash: http://www.example.com/page.php?color=red#tabname

javascript - how to unhidden field base on the field validation in yii2 -

i have field set hidden , want unhidden field based on other field validation. how can using jquery?? here code: <?php $form = activeform::begin([ 'id' => 'assign-form', 'enableajaxvalidation' => true, ]); ?> <?= $form->field($volunteeringin, 'acid', [ 'template' => '{label} <div class="row"><div class="col-md-5">{input}{error}{hint}</div></div>', ])->dropdownlist($model->getactivitysearch(),['prompt'=>'בחר פעילות לשיבוץ המתנדב'])->label('פעילויות לשיבוץ')?> <?= $form->field($volunteeringin, 'passedtraining')->radiolist([0=>'לא',1=>'כן'] ,['separator' => '</br>','class'=>'hidden','id'=>'demo'])->label('האם המתנדב עבר הכשרה?'); ?> <div class="form-group"> <?= html::submitbutton( 

loops - Bash script not looping as expected -

this question has answer here: ssh breaks out of while-loop in bash [duplicate] 3 answers i have following script feel should loop through contents of file reads in, reason exiting after first iteration. #!/usr/bin/bash scriptdir=/soft/automation/scripts cd $scriptdir #loop through list of hosts , teardown/rebuild each ifs=$ifs, while read -r name ip vlan image; echo "$(date) : beginning teardown of host ${name}_${vlan}..." echo "$(date) : executing command: ./deploy_vm_pureflex_nstar.sh -d -n ${name}_${vlan}" ./deploy_vm_pureflex_nstar.sh -d -n ${name}_${vlan} exitcode=$? if [[ $exitcode -eq 0 ]]; echo "$(date) : teardown of host ${name}_${vlan} completed (exit code: $exitcode). sleeping 60 seconds..." else echo "$(date) : teardown of host ${name}_${vlan} completed errors (e

php - WordPress Posts/Page Content Blank on Backend After Site Move -

Image
after moving wordpress website 1 server have encountered odd issue. works great, until go edit post or page , presented empty content box on backend. (see image). all of posts , pages displayed on front end except there strange characters in content (see image). if try republish post, empty content saves on hidden content , post becomes empty on front end. i disabled plugins , switched themes changed nothing. did corrupt database on transfer or there other reason might have caused this? has else run this? the problem turned out db_charset , db_collate both set '' in wp-config.php. updated them following values , issues resolved: define('db_charset', 'utf8'); define('db_collate', 'utf8_general_ci');

Why passing string to scanf() compiles fine in C? -

i wrote simple program mistake use scanf() instead of printf() displaying message on console. expecting compile time error, compiles fine without warnings & crashes @ runtime. know scanf() used taking input keyboard. shouldn't error in following program? #include <stdio.h> int main() { scanf("hello world"); // oops, had printf() return 0; } is invokes undefined behavior(ub)? there mention in c standard? why isn't checked @ compile time whether proper & valid arguments passed scanf() function or not? the code behaving correctly. indeed, scanf declared int scanf(const char *format, ...); luckily, format not contain % there no correspondence in ... , invoke ub. further, format string literal allows compiler go through ensuring passed right type of parameters in regards format specifiers, part of sanity checks enabled higher warning levels. (-wformat family)

java - HashMap as a Broadcast Variable in Spark Streaming? -

i have data needs classified in spark streaming. classification key-values loaded @ beginning of program in hashmap. hence each incoming data packet needs compared against these keys , tagged accordingly. i realize spark has variables called broadcast variables , accumalators distribute objects. examples in tutorials using simple variables etc. how can share hashmap on spark workers using hashmap. alternatively, there better way this? i coding spark streaming application in java. in spark can broadcast serializable object same way. best way because shipping data once worker , can use in of tasks. scala: val br = ssc.sparkcontext.broadcast(map(1 -> 2)) java: broadcast<hashmap<string, string>> br = ssc.sparkcontext().broadcast(new hashmap<>());

javascript - Detect where drop occured (ng-flow) -

i using ng-flow drag & drop files , upload server. page developing has multiple drop listeners . there way detect on element drop occurred ? <body ng-app="droptest" flow-init="{target:''}"> <div name="drop1" class="fa fa-paperclip fa-rotate-90 cell small" flow-drop="" title="drag/drop files upload record"></div> <div name="drop2" class="fa fa-paperclip fa-rotate-90 cell small" flow-drop="" title="drag/drop files upload record"></div> </body> $scope.$on('flow::fileadded', function (event, $flow, flowfile) { //how detect whether drop occured on drop1 or drop2? }); i figured out $scope.$on('flow::fileadded', function (event, $flow, flowfile, elementdetails) { elementdetails.target });

Webpack: Must i specify the domain in publicPath for url() directive to work in CSS? -

my problem if don't specify complete domain in output.publicpath config option; url don't load (at least fonts). my webpack config: output: { ... publicpath: '/assets/' }, module: { loaders: { { test: /\.less$/, loader: "style!css?sourcemap!less?sourcemap" }, { test: /\.(png|jpg|svg|gif|eot|woff|ttf)$/, loader: 'file-loader?name=[path][name]-[hash].[ext]' } } }, debug: true, devtool: 'eval' i have less file states: @font-face { font-family: 'new-sources'; src: url('../../fonts/sources-icons-rev-4.eot'); ... } my server in http://localhost:5000 . when check generated css while debugging in chrome see has been replaced by: @font-face { font-family: 'new-sources'; src: url(/assets/sdk/v1/fonts/sources-icons-rev-4-fad6f81d012ba56b350abdc714d1fa5a.eot); ... } which seems correct! doesn't work chrome dev tools report error: "failed d

jquery - javascript global variable not updating in ajax callback -

on alert alerts jojo . test2.php have text loco the div gets updated loco global variable not changing. tried window.temp = data didn't worked. how can returned value in variable? please guide... <div> yolo </div> <script type="text/javascript"> var temp = 'jojo'; $.ajax({ url: 'test2.php', //loco success: function(data) { temp = data; $('div').html(data); }, error: function (err) { alert('error'); } }); alert(temp); var tobeusedlater = temp; //updated temp value ajax call refreshtab(); </script> this asynchronous function. (that's a in ajax stands for.) alerting value of temp , happening before asynchronous call has finished. if add alert(temp); to end of success handler, see value has updated.

user interface - How can I print elements from an imported text file in Python? -

okay, school assignment have been told import txt file , store inside list, have done correctly, , next step print items in 3x3 grid. have come solution doesn't seem working.. here code: import time import random words = open("words.txt","r") wordlist = [] lines in words: wordlist.append(lines) wordlist=[line.rstrip('\n')for line in wordlist] print(wordlist(0,2)) what solution print out 3 @ time list, print position 0, 1 , 2. print 3, 4 , 5 print 6, 7 , 8 , have solution. try splitting lines list , print list while adding new line every third print, don't append lines wordlist. words= words.rstrip('\n') wordlist = words.split(" ") count = 0 word in wordlist: if count % 3 == 0: print("\n") print (word) count++