Posts

Showing posts from August, 2011

image - Background converted from white to grey when read in matlab -

Image
i have image: can seen background white, , when viewed in finder/explorer shows background white or light grey. but when read image matlab using basic command: imread(img_name); it read in this: why changing colour of background? i thought maybe indexed , tried converting grey command: [map, im] = imread(img_name); new = in2gray(im, map); but didn't work error stating map not valid colourmap edit imfinfo output added: filename: 'u:\iam_manual\010.png' filemoddate: '27-jun-2015 17:32:03' filesize: 1843331 format: 'png' formatversion: [] width: 2078 height: 2056 bitdepth: 8 colortype: 'indexed' formatsignature: [137 80 78 71 13 10 26 10] colormap: [256x3 double] histogram: [] interlacetype: 'none' transparency: 'none' simpletransparencyd

php - MySQL efficient: multiple tables or columns with nulls -

i developing mysql db user list, , trying determine efficient way design it. my issue comes in there 3 types of users: "general", "normal", , "super". general , normal users differ in values of columns, schema store them identical. however, super users have @ least 4 columns of info needs stored. in addition, each user needs unique user_id reference other parts of site. so, can keep 3 users in same table, have lot of null values stored general , normal user rows. or, can split users 2 tables: general/normal , super. rid of abundance of nulls , require lot more work keep track of user_ids , ensure unique, have handle in php instead of doing serial column in single table solution above. which solution more efficient in terms of memory usage , performance? or there another, better solution not seeing? thanks! why not build table; coloumns need super users? 2 tables 1 users , 1 super users's info

Add-On File Upload option not available in Atlassian Jira -

we gotta problem while trying add menu manager add-on. '.obr' upload option not available in manage add-ons page. please refer attached screen shot. can please advice how make done. https://answers.atlassian.com/download/attachments/18449353/upload.png?version=1&modificationdate=1435239001062&api=v2 also when tried give atlassian marketplace url menu manager in url text box below attached error. https://answers.atlassian.com/download/attachments/18449353/error.png?version=1&modificationdate=1435239001058&api=v2 can please advise how install plugin? thanks, htc you cannot install arbitrary plugins jira cloud instance - compatible ones.

Android: How to access viewholder at position (from outside the adapter) -

i have recycler view adapter. hosts 3 views. each view has imageview. when user clicks on image (1 out of 3) creates new intent use photo app , returns caller when done. caller (the activity, created recyclerview , adapter) handles onactivityresult. there need set thumbnail image taken in mentioned intent corresponding selected imageview. question. in activity, how know imageview (out of available 3) modify ? activity knows position of item in recycler view adapter clicked on. is possible somehow reference particular imageview in adapter using position? this: activity: adapter.getimageview(position) edit: solution was: keeping track of imageviews in adapter , stored ref in arraylist in `onbindviewholder. can use adapter.getimageview(position) i believe can setonclicklistener imageview (or row view) in adapter. fire intent there.

apache - Disable SSL on specific WordPress page -

i've spent days searching solution. i'd disable ssl on 1 wordpress page /stream, know can done via mod_rewrite don't know input there. use ubuntu , apache. edit: site's redirect configuration. edit2: use pretty permalinks, may have different solution others. servername zegoattt.com redirect permanent / https://zegoattt.com/

php - Dynamically set class array parameter, redbeanphp wrapper -

i'm writing wrapper redbeanphp orm, basically instead of using $user = r::dispense('users'); $user->name = 'zigi marx'; r::store($user); i so $user = new user(); $user->name = 'zigi marx'; $user->save(); the way done is, have class called user extends model , model runs redbeanphp the full code of model can found here http://textuploader.com/bxon my problem when try set 1 many relation, in redbean done so $user = r::dispense('users'); $user->name = 'zigi marx'; $book = r::dispense('books'); $book->name = 'lord of rings ii'; $user->ownbooks[] = $book; and in code $user = new user(); $user->name = 'zigi marx'; $book = new book(); $book->name = 'lord of rings ii'; $user->ownbooks[] = $book; i error notice: indirect modification of overloaded property zigi\models\user::$ownbooks has no effect the answer: __get function in model needed changed so pub

python - Shorthand code and Fibonnaci Sequence -

this question has answer here: multiple assignment , evaluation order in python 6 answers i have found example fibonacci sequence goes this: def fib(n): a, b = 0, 1 while b < n: print (b) a, b = b, a+b fib(20) so here's don't it: a, b = 0, 1 # shortcut writing = 0 b = 1 right? now, following same logic a, b = b, a+b #should same writing = b b = a+b but isn't because if write that, output different. i'm having hard time understanding why. thoughts? yes isn't same , because when write - a, b = b, a+b the value of a , b @ time of executing statement considered, lets before statement, a=1 , b=2 , first right hand side calculated , b=2 calculated , a+b=3 calculated. assignment occurs, a assigned value 2 , b assigned value 3 . but when write - a = b b = a+b the assignment occurs alo

c# - WPF How to make a Viewbox aware of its available space from within a StackPanel -

Image
i have custom wpf control based on soroosh davaee’s imagebutton example @ http://www.codeproject.com/tips/773386/wpf-imagebutton . custom control combines image , textblock in horizontal stackpanel within button. (btw, soroosh’s example run, had edit solution properties “sampleview” startup project rather “extendedbutton” being startup project.) i want text in textblock automatically shrink if necessary avoid clipping @ right edge if text long fit naturally in button. example, if edit soroosh's mainwindow.xaml make button text long fit... ... <eb:imagebutton width="100" height="30" content="texttoolongtofitinthebutton" grid.row="2" ... <eb:imagebutton width="100" height="30" content="texttoolongtofitinthebutton" grid.row="2" ... ...the result following buttons clipped text: in researching this, seems simplest way auto-shrink content of textblock wrap within viewbo

java - FXML controller and Threads -

so, i'm coding college assignment , got stuck in part have build thread socketserver open new threads each client connection. here's java code: this method linked setonaction of button: void openserver(){ new serverthread().startthread(); } this method called method above: public class serverthread implements runnable{ private serversocket serv; @override public void run(){ try { serv = new serversocket(1234); while(true){ socket sc = serv.accept(); system.out.println("someone connected!"); thread t = new thread(new clientthread(sc)); t.start(); } } catch (ioexception e) { system.out.println("erro no servidor"); } } void startthread(){ thread t = new thread(new serverthread()); t.run(); } } this thread called code above: public class clientthread implements runnable{ p

javascript - How to Make Every Image on a Page Fade In on Scroll -

i'm polishing 1 of websites, , add in effect images on page fade in when user scrolls down each respective image. i've seen several posts concerning effect, deal fading in 1 particular image. is there way have images on page fade in when user scrolls down each one? i've got quite few images on page, didn't want have go each 1 , copy/paste code add effect each image individually if can away it. bonus points me figure out how reverse effect when user scrolls up. this way, if user scrolls top (or section of page) images have faded in fade out once out of view. this way, if user decides scroll down, same image fade in effect each time scroll through page. any on issue appreciated. thank you! you check on scroll event if offset of image reached, , them show image, on contrary can make work hidding ;)

Send Email from amazon ec2 instance -

i have installed ubuntu on ec2 instance. want send email using php website im hosting on machine. have tried ses , sent successful email using console. how can this? easiest way (requiring least setup) ? best way? ses idea. have option of either sending through smtp or through amazon aws ses api. for sending trough smtp can use php mailer: https://github.com/phpmailer/phpmailer for sending through ses api, at: http://docs.aws.amazon.com/aws-sdk-php/guide/latest/service-ses.html http://docs.aws.amazon.com/aws-sdk-php/v2/api/class-aws.ses.sesclient.html#_sendemail the key thing consider here, email sending app, deliverability of email tricky part, not sending. ses has concept of sandbox can send to/from verified emails/domains. collects metrics on how doing (bounces etc) , take corrective actions if use service spam. upside of this, odds of mail being delivered higher when comes ses opposed if run own mail server.

301 redirects in .htaccess forming incorrect redirect -

i'm trying redirect http://brisbaneamazingrace.com.au/details.html http://www.teambonding.com.au/activities/amazing-race-brisbane different domain. in .htaccess file have redirect 301 http://brisbaneamazingrace.com.au/details.html http://www.teambonding.com.au/activities/amazing-race-brisbane but redirect goes http://teambonding.com.au/activities/amazing-race-brisbane details.html it keeps adding details.html end of redirect url. whats that? you should use redirectmatch regex matching: redirectmatxh 301 ^/details\.html$ http://www.teambonding.com.au/activities/amazing-race-brisbane also test after clearing browser cache.

delimited text - Delimit a string by character unless within quotation marks C# -

i need demilitarise text single character, comma. want use comma delimiter if not encapsulated quotation marks. an example: method,value1,value2 would contain 3 values: method, value1 , value2 but: method,"value1,value2" would contain 2 values: method , "value1,value2" i'm not sure how go when splitting string use: string.split(','); but demilitarise based on commas. possible without getting overly complicated , having manually check every character of string. thanks in advance copied comment: use available csv parser visualbasic.fileio.textfieldparser or this or this . as requested, here example textfieldparser : var alllinefields = new list<string[]>(); string sampletext = "method,\"value1,value2\""; var reader = new system.io.stringreader(sampletext); using (var parser = new microsoft.visualbasic.fileio.textfieldparser(reader)) { parser.delimiters = new string[] { "," };

r - Fastest read WAV -

i trying find length (in seconds) of files (only wav) in directory. require(tuner) fnam=file.path("dir") filist=list.files(fnam, recursive=true, pattern="wav" ) filist1=paste(fnam, "/", filist, sep="") nfiles=length(filist1) x=1:nfiles file_len=function(n){ inname=data_phone$filist1[n] if(file.info(inname)$size!=0){ ywave=readwave(inname) lengthsec=length(ywave@left)/ywave@samp.rate } else { lengthsec=0 } } len_file=unlist(lapply(x,fun=file_len)) but works 86k files. maybe there way faster? you need header this. this: library("tuner") filist <- list.files("dir", recursive=true, pattern="\\.wav$", full.names = true) file_len <- function(fil) { if (file.info(fil)$size != 0) { wavheader <- readwave(fil, header = true) wavheader$samples / wavheader$sample.rate } else { 0 } } len_file <- sapply(filist, file_len) i've simplified , tidied code, ke

php - url problems on a production server -

on dev server have next url http://someurl.com/index.php/home//index and work fine, see double slashes before method call. on production server same url throws 404 error. can me problem? configuration on server mising ? i using codeigniter 2.x project , apache2 there no need put index function have @ end of url http://www.someurl.com/index.php/home/ you may have set routes. http://www.codeigniter.com/userguide2/general/routing.html you may need have controller class , file names home.php , class name home

Javascript function return number instead of object -

so, right now, have code looks this var citibiz2 = new slao_stat(4, 25, 4, 55, splunktimecitibiz, "citibiz2", "citibiz", '0', 1, subcitibiz); var slao_stat = function(slahour, slamin, slohour, slomin, splunktime, statusname, mainarray, number, criticality, location) { this.slamin = slamin; this.slahour = slahour; this.slomin = slomin; this.slohour = slohour; //set sla , slo time each function var slatoday = new date(time.year, time.month, time.day, slahour, slamin); var slotoday = new date(time.year, time.month, time.day, slohour, slomin); //set sla , slo time next day var slatom = addday(slatoday, 1); var slotom = addday(slotoday, 1); //set sla time 12 hours before current var slayest = addday(slatoday, -.5); //set sla , slo time previous day var sloyes = addday(slotoday, -1); var slayes = addday(slatoday, -1); var sl

How to run below PL/SQL code from groovy againts oracle database -

below pl/sql code want run groovy program against oracle database. begin execute immediate 'drop table employee'; exception when others if sqlcode != -942 raise; end if; end; / how can that. have every thing setup connecting oracle database groovy program. want somthing below: sql = sql.newinstance(url, username, password, driver) string plsql="begin\n" + " execute immediate 'drop table employee';\n" + "exception\n" + " when others then\n" + " if sqlcode != -942 then\n" + " raise;\n" + " end if;\n" + "end;\n" + "/" sql.execute(plsql) error log-from comments below error getting... jun 29, 2015 9:05:52 pm groovy.sql.sql execute warning: failed execute: begin execute immediate 'drop table employee'; exception when others if sqlcode != -942 raise; en

highcharts - Using global data in High Charts point click custom function in R Shiny -

i trying show different table or plot in different div when bar on a bar plot clicked. have come far. server.r library(shiny) shinyserver(function(input,output,session) { custom_data = # data frame in r barclick_func <- "#! function() { var cats = ['100','200','3000','4000']; var datum = [20,40,30,10]; } $('#container_subcat').highcharts({ chart: { type: 'column', }, xaxis: { categories:cats }, series: [{data :datum}] }); } !#" output$my_plot <- renderchart2({ <- hplot(x="id",y="variable",data=custom_data,type="column") a$tooltip( animation = 'true

lua - Cannot use math.pow function in NodeMCU/ESP8266 -

i need math.pow function in nodemcu/esp8266 cannot include math library you may try using exponentiation ^ operator instead of math.pow : 2^3 == 8 .

excel vba - VBA - Top 10 percent of each region -

i have excel 2013 spreadsheet that, among other things, shows income assets in different districts. i'm writing macro enter date in empty cell next income if income in top 10 percent district , not reviewed. , that's i'm finding difficulty. i can write line of code return top ten percent of income, can't figure out how return top ten percent of 1 district. as function, can achieve desired result follows: {=large(if(i13:i1000=800,if(ao13:ao1000<>date(2015,3,12),ai13:ai1000,""),""), 17)} for macro, have written code will: 1) accept input district reviewed , date of review 2) determine when last review conducted (kind of, same problem, need find max assets in district) 3) calculate how many assets need reviewed (top ten percent , bottom twenty percent) this code have far: sub schedulenextreview() 'determine district reviewed dim dist string dim nextdate date dist = inputbox(prompt:="enter district revi

Passing data between Activities Android | java -

consider 3 activities, a,b,c . want pass data activity activity c, activity c not launched activity , instead launched activity b, looking solution if can send integer value activity c activity , , activity c receives value whenever gets executed, can use intent.putextra() purpose? appreciated. yes right . can use intent.putextra() you can pass data using intent.putextra() activity a activity b . then sote bundle in activity b then when launching activty c pass bundle intent catch data in activity c

string - From list to sentence on python3 -

this question has answer here: converting list string 7 answers my mind,from: >>>text='hi how you' >>>example=text.split() >>>print(example[0:4:2]) it print list ['hi', 'are'] my question, how convert them? list above, to: >>> hi are if got it, please answer. text='hi how you' example=text.split() print(' '.join(example[0:4:2]))

css - How to style parent li from child div, using Angular syntax? -

http://codepen.io/leongaban/pen/kpzxkg?editors=110 i'm trying add border style li contains div class. in case .text-trans-normal . is there conditional exists accomplish this? the codepen above example, below actual markup angular syntax involved: <ul ng-show="loadingtickersdone" class="tickers-list"> <li ng-repeat="ticker in tickers" id="{{ticker.ticker}}" ng-hide="ticker.removed" ng-class="{'selected':ticker.selected}"> <div class="ticker" ng-click="unselectall(); selectticker('top', ticker); ticker.selected = !ticker.selected;" ng-class="{'text-trans-normal' : ticker.ticker == 'all'}" ng-if="ticker.ticker != 'all'" > {{ticker.ticker}} </div> </li> </ul> css .button { float:

java - (LeetCode) Contains Duplicate III -

given array of integers, find out whether there 2 distinct indices , j in array such difference between nums[i] , nums[j] @ t , difference between , j @ k. hello! i kinda stumped question, honest. solutions provided in (leetcode) discussion forum question did not provide explanation/thought process how solve it. i'd rather understand technique solving problem having full implementation code given me. feel best way learn. so, clue here use (java) treeset approach problem. assuming floor , ceiling methods useful here. i'd appreciate if there out there can give me bit of clue/hint approach problem. pseudocode welcome well! don't need full implementation code i've said before. starting point great! :) thanks! edit: i'm working on in meantime! so, if answer, i'll post on here future reference. :) first implementation comes mind 2 loops, 1 nested. within inner loop check logic abs(nums[i]-nums[j]) <= t , abs(i-j)<=k. outer

jsf 2 - c:forEach does not show data in correct order after ajax update -

i m using jsf2 primefaces , have refresh problem. i have : <p:commandbutton ajax=true update="tableauobservatoire" <p:outputpanel id="tableauobservatoire" into p:outputpanel have <c:foreach... construct à table when arrived on page, data correctly show. when click on commandbutton, action launched, , refresh ok, table, data not correctly ordered!! if click again on p:commandbutton, data reorganized! don't understand happenning. does need don't combine p:outputpanel c:foreach? , use combinaison in case? if want more precision answer, don't hesitate ask me. thanks lot!

java - Is Method overloading is also known as static polymorphism? -

iam newbie java in below code have oveloaded print method between 2 different classes based on object @ runtime corresponding print method executed.if understanding right how can method overloading considered static ploymorphism class parent { private int arg; public void print(int arg) { this.arg=arg; system.out.println(arg+"printed"); } } class child extends parent{ private string arg; public void print(string arg) { this.arg=arg; system.out.println(arg+"printed"); } public static void main(string[] args) { // todo auto-generated method stub parent p1=new parent(); child ch=new child(); p1.print(1); ch.print("string"); } } please clarify me.thanks in advance try reading , may clear doubts how polymorphism works can't access object in array java

php - if statement with multiple or condition -

consider following code if ( stripos($a,'something1')===0 || stripos($a,'something2')===0 ) { return ''; } is there performance benefit using in_array or php stops testing if first condition evaluate true ? relative question performance. as here, strpos better. https://stackoverflow.com/a/21070786/4627253

android - ways to add 18dpx18dp size image right of title in collapsing toolbar layout? but not in toolbar -

Image
i want put icon right title in collapsing tool bar, shown below but after collapsing don't want show in tool bar. i want hide after collapsing. i have done thing. using collapsingtoolbarlayout.settitle(item.getname()); collapsingtoolbarlayout.setforeground(getresources().getdrawable(r.drawable.ic_photo_library_white_24dp)); which this. i still trying adjust image. but want hide image after collapsing. bez looks this. here java code. private void settoolbar(product item) { ((appcompatactivity) getactivity()).setsupportactionbar((producttoolbar)); actionbar actionbar = ((appcompatactivity) getactivity()).getsupportactionbar(); actionbar.settitle(""); producttoolbar.setnavigationonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { getactivity().onbackpressed(); } }); collapsingtoolbarlayout.settitle(item.getname()); collapsingtoolbarlayout.setforeground(getresources().getdrawable(r.dra

SQL Server : Trace won't create file -

i'm trying start using sql trace , running "access denied" errors when using following: exec @rc = sp_trace_create @traceid output, 0, n'c:\users\user$\desktop\sqltrace', @maxfilesize, null if (@rc != 0) goto error i have tried unc path , local, using admin account login mgmt studio, component missing? have tried saving locally , remote client. it's not permissions account has, it's whether or not account used start sql server service has write permissions folder. please check first. see sp_trace_create doc: for sp_trace_create, sql server service account must have write permission on trace file folder. if sql server service account not administrator on computer trace file located, must explicitly grant write permission sql server service account.

WebView Android 5 doesn't open links with target=_blank -

Image
i detected issue can reproduce samsung galaxy s5 , android 5.x (not htc one, android 5.x). when opening link in webview (target=_blank), nothing happens. can see exception in logcat output, webview webviewclient method shouldoverrideurlloading never called (there create intent opens url). my current workaround remove target=_blank links - knows if bug or normal behaviour , i've set wrong? thanks

How to get default page url in liferay? -

i set default page url in portal-ext.properties. default.landing.page.path=/group/guest/home then create portlet controller : public class userportrait extends mvcportlet { @override public void render(renderrequest renderrequest, renderresponse renderresponse) { } @override public void processaction(actionrequest actionrequest, actionresponse actionresponse) throws ioexception, portletexception { super.processaction(actionrequest, actionresponse); } } now , how landing page url in processaction method. simply, use com.liferay.portal.kernel.util.propsutil.get(string propertyname) property portal-ext.properties file.

python 2.7 - Identify orthogonal and non-orthogonal Polygon and fracture them -

Image
we using boost polygon library perform polygon operation. in latest scenario need determine following point. identify if polygon orthogonal or non orthogonal , receiving following coordinates input . input python list have interface data = [(100, 100), (100, 200), (300, 200), (600, 400), (1150, 400), (1150,300), (600,300), (300,100)](these data point create following non orthogonal polygon) data = [(550 , 221), (800 , 221), (800 , 269), (1090 , 269), (1090 , 173), (1520 , 173), (1520 , 269), (1810 , 269), (1810 , 173), (2420 , 173), (2420 , 221), (2708 , 221), (2708 , 317), (550 , 317) ] these data point create orthogonal polygon what should behavior if doing fracture in horizontal or vertical direction of non orthogonal polygon , orthogonal polygon need handle both polygon can vertical , horizontal rectangle non orthogonal. could not add image not have 10 reputation.

How to Pass byte[] from Excel vba to web service -

Image
i want pass byte[] excel vba web service. below code convert file byte[]. dim bytfile() byte bytfile = getfilebytes("c:\test.doc") below code used call webservice. bytfile parameter dim xmlhttp object: set xmlhttp = createobject("microsoft.xmlhttp") xmlhttp.open "post", service + "/passexceldata", false xmlhttp.setrequestheader "content-type", "application/x-www-form-urlencoded" xmlhttp.send "filebyte=" & bytfile but not able pass webservice. getting error @ last line. want possible? if not, way can achieve this? i have tried below code function filetostr(byval strfile string) string dim hfile long hfile = freefile open strfile input #hfile filetostr = input$(lof(hfile), hfile) close #hfile end function and called as: xmlhttp.send "filebyte=" & filetostr(file path). but returned below error: you can't append byte array & operator. text of file using

javascript - Using Node.js require vs. ES6 import/export -

in project i'm collaborating on, have 2 choices on module system can use: importing modules using require , , exporting using module.exports , exports.foo . importing modules using es6 import , , exporting using es6 export are there performance benefits using 1 on other? there else should know if use es6 modules on node ones? are there performance benefits using 1 on other? keep in mind there no javascript engine yet natively supports es6 modules. said using babel. babel converts import , export declaration commonjs ( require / module.exports ) default anyway. if use es6 module syntax, using commonjs under hood if run code in node. there technical difference between commonjs , es6 modules, e.g. commonjs allows load modules dynamically. es6 doesn't allow this, but there api in development that . since es6 modules part of standard, use them.

java - ThreeTen-Backport implementation vs. backport of JSR-310? -

note: not duplicate of comparing threeten backport jsr-310 . question more specific. in company, i'm trying devops o.k. use of threeten-backport refactoring legacy code (which because of deployment constraints weblogic 10.3.6.0 can't upgrade java 6 , can't use version of jodatime beyond version 1.2.1). i can see devops having issue statement on threeten-backport's github page: the backport not implementation of jsr-310, require jumping through lots of unnecessary hoops. instead, simple backport intended allow users use jsr-310 api on java se 6 , 7. when ask me "not implementation" means, need able explain them. however, word implementation can have wide semantic range, , i'm not sure meant myself. so question is, in contexts this, meant implementation vs. backport ? since jsr-310 backport , not implementation, there counter example of use, is implementation of else, in same sense threeten-backport not implementation of jsr-3

Azure stream analytics - Joining on a csv file returns 0 rows -

Image
i have following query: select [vanlist].deviceid ,[vanlist].[vanname] events.[timestamp] ,events.externaltemp ,events.internaltemp ,events.humidity ,events.latitude ,events.longitude [iot-powerbi] [iot-eventhub] events timestamp [timestamp] join [vanlist] on events.deviceid = [vanlist].deviceid where iot-eventhub event hub , vanlist reference list (csv file) has been uploaded azure storage. i have tried uploading sample data test query, returns 0 rows. below sample of json captured event hub input [ { "deviceid":1, "timestamp":"2015-06-29t12:15:18.0000000", "externaltemp":9, "internaltemp":8, "humidity":43, "latitude":51.3854942, "longitude":-1.12774682, "eventprocessedutctime":"2015-06-29t12:25:46.0932317z", "partitionid":1, "eventenqueuedutctime":"2015-06-29t12:

php - Strip "$" from csv file -

i have php page takes in csv file , uploads database. issue having of fields have '$' not need. there way remove $ of fields? data structure coll_id cocc_id agedtotal paymenttotal 5074 11110 $7.50 ($7.50) my query $deleterecords = "truncate table mytable"; //empty table of current records mysql_query($deleterecords); //upload file if (isset($_post['submit'])) { $i=0; if (is_uploaded_file($_files['filename']['tmp_name'])) { echo "<h1>" . "file ". $_files['filename']['name'] ." uploaded successfully." . "</h1>"; echo "<h2>displaying contents:</h2>"; readfile($_files['filename']['tmp_name']); } //import uploaded file database $handle = fopen($_files['filename']['tmp_name'], "r"); while (($data = fgetcsv($handle, 1000, ",")) !== false) { if

javascript - How to optimize seamless image grid? CSS or Jquery? Image optimization? -

i'm simple ux designer beefing code skills, please forgive ignorance , crappy code. i'm rebooting portfolio website. original seamless grid built using masonry jquery plugin. it's sluggish though. http://jack-a-lope.net/illustration.html i decided rebuild using masonry worried performance might still bad, found css solution, hope loads faster. https://css-tricks.com/seamless-responsive-photo-grid/ i asked on website , told issue not plugin slow preloading 3mb of images. i've resized images, , optimized them best of ability, cutting out pretty significant chunk of memory, , yet it's still loading slow. doing wrong? why larger websites can load many images, code choking up? there other things need optimize this? matter of sticking loading screen on page or what? [edit:] images compressed , optimized. images load decently fast, problem fouc while js takes time reformat images etc. you preloading 3mb of images because that's sum of images weigh

interrupt - AVR: volatile variable resetting to zero -

i have interrupt service routine contains variable count , variable state changes when count reaches value. what want code change , maintain state period of time determined value of count in if statements in isr. e.g. want variable state equal 1 10 counts; want state equal 0 5 counts. similar changing duty cycle of pwm. the problem having variable state resets 0 around end of isr or end of if statement, i'm not sure. after searching answers, have found might related gcc compiler's optimisation cannot find fix problem besides declaring volatile variables, have done. any appreciated thanks. my code: #include <avr/io.h> #include <avr/interrupt.h> volatile int count = 0; volatile int state = 0; int main(void) { cli(); ddrb |= (1 << pb2); tccr0b |= (1 << cs02)|(0 << cs01)|(1 << cs00); timsk |= (1 << toie0); sei(); while(1) { ... } } isr(tim0_ovf_vect) { cli(); // user

C pointer value - unexpected change in the LHS value -

the output of following program not giving expected result: #include <stdio.h> int main() { int *x; int *y; *x = 10; *y = 45; printf("before\n"); printf("*x = %d, *y = %d\n\n",*x, *y); *x = *y; printf("after\n"); printf("*x = %d, *y = %d\n\n",*x, *y); return 0; } build result (mingw32-g++.exe): before *x = 10, *y = 45 after *x = 10, *y = 10 [finished in 0.7s] why *y = 10 after assigning *y *x? the program has undefined behaviour because pointers x , y not initialized , have indeterminate values. int *x; int *y; you should write (if c program) int *x = malloc( sizeof( int ) ); int *y = malloc( sizeof( int ) ); *x = 10; *y = 45; //... free( y ); free( x ); or have use operators new , delete if c++ program int *x = new int(); int *y = new int(); *x = 10; *y = 45; //... delete y; delete x; in c++ can use smart pointers. example #include <iostream> #

apache - Setting up CubeCMS on Windows -

Image
so i'm trying setup cubecms first time on windows locally on apache, , i'm trying follow instructions on package's read me file. the read me file asks user provide chmod 777 access several directories, in windows equilvalent everyone having full access. i ensure folders requested shared (since it's local on computer , no 1 else connects network, not huge risk). even though did provide files full access still error attached any how set highly appreciated. in advanced, j

ruby - error 400 from 'rest-client' gem -

i have simple ruby script invoke crontab entry, entire script below: require 'rest-client' require 'json' valve_id, gpio_pin, cmd, http_host = argv # puts "valve_id --> #{valve_id}, cmd --> #{cmd}, http_host --> #{http_host}" restclient.put "http://#{http_host}/api/valves/#{valve_id}.json", { "params" => {"cmd" => "#{cmd}"}}.to_json , :content_type => :json, :accept => :json here crontab entry: ruby /home/kenb/development/coffeewater/lib/tasks/rest_client.rb 5 23 0 stargate:9292 the resource being accessed simple rails model, valve, integer attribute 'cmd'. i can't seem encoding right, keep getting error 400. i have tried code , works fine own url http://zoker.sinaapp.com/sonar.php i think there wrong api interface, maybe should cache error message begin...rescue see happened api here test code ruby.rb require 'rest-client' require 'json&

scala - Spark union weird behavior -

i' m experiencing strange behavior union method of rdd class. , can't understand why happens. i have class, in there data , filtereddata vars. first 1 initialized textfile , other map , filter , second instead sc.emptyrdd[point] . have method this: do{ /** * here val lastfiltered computed */ logger.debug("filtered "+lastfiltered.count()+" points") filtereddata=filtereddata.union(lastfiltered) logger.debug("filtered far "+filtereddata.count()+" points") data = data.subtract(lastfiltered) /** here data repartitioned **/ }while(/** here there condition equivalent lastfiltered.count() == 0 **/) logger.info("preprocessing has filtered "+filtereddata.count()+" points") what i'm getting logger very strange me: filtered 13 points filtered far 13 points filtered 4 points filtered far 4834 points filtered 0 points filtered far 0 points preprocessing has filtered 0 points of cou

java - How do I reach the running instance of my Thread? -

basically, have class called playback extends thread. want able run functions have defined class thread object, when have no affect on current thread of said object. can functions work when called if .run() instead of .start() causes gui freeze up. here code playback function = new playback(list, progbar, settings); function.start(); function.terminate(); the above code not work below does playback function = new playback(list, progbar, settings); function.run() function.terminate(); when use run though causes gui freeze. how call methods on running thread? here playback class: package chronos.functions; import java.awt.robot; import java.awt.event.inputevent; import java.util.list; import javafx.scene.control.progressbar; import chronos.graphics.inputvalue; public class playback extends thread { list<inputvalue> list; progressbar progbar; settings settings; boolean terminated = false; public playback(list<inputvalue> list, pr

c# - Spawning object over various times and at two random points -

i trying make spawner getting mechanics coded in before spawn object since assuming easier part. far have created code works yet spawning points heavily skewed 1 of 2 - ratios 30:1 or more. false being heavily skewed spawn. timeleftuntilspawn = time.time - starttime; system.random secondsbetweenspawn = new system.random (); float num2 = secondsbetweenspawn.next (1, 10); // random number between 1 , 10 'seconds' if (timeleftuntilspawn >= num2) { starttime = time.time; timeleftuntilspawn = 0; debug.log ("spawn 1 here"); system.random rnd = new system.random (); // here deciding on position of spawn after 1 has been spawned int num = rnd.next (0, 10); //random number between 0 , 10 if (num < 5) { switchspawning = false; debug.log ("false"); transform.position = spawnposition; } else if (num > 5) { switchspawning = true; debu

c# - Exception filter not triggered -

i wanted add exceptionfilter project @ work. made test api project vs2013 on .net 4.5: a web api action throws custom exception (has filter attribute) custom exception constructor being build filter exception catch , handles. and worked great! now, went work project, working .net 4.5, created testcontroller file , copy paste code test project file. web api action hit, custom exception constructor called exception filter didn't triggered. why? this apicontroller, exceptionfilter, customexception , customer class: using system; using system.collections.generic; using system.io; using system.linq; using system.net; using system.net.http; using system.net.mime; using system.text; using system.web.http; using system.web.http.filters; using system.web.services.description; namespace web.controllers.webapi { public class testcontroller : apicontroller { public static list<customer> customers; static testcontroller() {

php - How to remove automatically added <br class=“clear” > in wordpress -

i'm creating 1 wordpress template. required information added in wordpress header.php, footer.php , fine. added 1 page. while viewing page there small problem above footer. after checking found following code creating problems < br class="clear" > but didn't added in page content. please tell me thing came, , how remove this? or atleast tell me thing check problem.

c# - How to hide column in GridView after DataBind? -

i ask question because think have different problem : how hide gridview column after databind? my gridview has data database. don't set "td" in code, html changes gridview table , have "td". problem is, don't want cell or "td" shown on page, want receive data in cell show image in database. this code retrieve data database: public static datatable fetchallimagesinfo(int id) { string sb = "select img_content, img_id, csrid images img_id = " + id + ";"; sqlconnection conn = databasefactory.getconnection(); sqldataadapter da = new sqldataadapter(sb, conn); datatable dt = new datatable(); da.fill(dt); return dt; } this codebehind bind gridview, here tried set visible true or false, doesn't work. set column index manually because it's has 3 column : gridview1.datasource = productalllocationcatalog.fetchallimagesinfo(_id); gridview1.databind(); gridview1.columns[0].visible

java - CDI @Inject Instance @Any - But instance never populated with instances -

why 'instance' never iterate on implementations? missing? jboss eap 6.3.0.ga (as 7.4.0.final-redhat-19) public interface simple { } public class simplea implements simple { public simplea() { } } public class simpleb implements simple { public simpleb() { } } public class simpleuser { @inject @any instance<simple> instance; @postconstruct public void init() { (final simple simple : instance) { system.out.println(simple); } } } in case helps else, using deltaspike 1.5.2 , running same issue (if remove deltaspike, no longer have problem). in case adding producer methods did not solve it. after looking around beanprovider gets around problem far elegant. https://deltaspike.apache.org/documentation/core.html#beanprovider i had call list<myserviceinterface> myservicelist = beanprovider.getcontextualreferences(myserviceinterface.class, false, false); there better ways. notice deltaspike turns on bunch of

angularjs - multiple selection using mouse drag -

i using ui-grid v3.0.0-rc.22 in application. i use selection features of , work fine, want use selection using mouse drag. is possible select multiple row using mouse drag. any appreciated. i don't think possible. can select multiple rows holding ctrl+shift , left-clicking on first , last rows of interval of rows want select.

javascript - Check if starSpin() is already running and stop it using stopSpin() in case it is running -

i using spin.js show spinner before data gets loaded on screen. have several tabs. everytime, click on tab, shows spinner , have kept stopspin() inside function when data gets loaded, spinner stop. this runs fine in normal condition. user clicks tab -- spinner starts -- data gets loaded-- spinner stops. but when click on tab , @ moment click on other tab, spinner keeps on spinning. spinner of first tab clicked. didnt let complete function run , when clicked on other tab, new spinner got loaded , stops. first tabs spinner continues spin... is there way check if can see if spinner running , stop if @ running. **\$("#rpt21 a.keepopen").click(function(){ \$("#report_panel").html(""); \$("#report_panel,#report_header,#report_panel_alldata,#report_header_alldata").hide(); $get_parameters; startspin(); x = getdataforrpt(rmanager,manager,account,folderdate,pricedate,"buy_list","$tmp_rpt_folder&quo

json - Rails API / Ember-cli web app: what is the conventional workflow? -

in process of building spa, opted combination of rails api , ember-cli. from understand, architecture of app following: rails api run back-end of app, api ember-cli run front-end of app, front-end mv* framework data served rails api ember-cli json what not seem clear though, should development workflow? in other words, should we: build back-end (rails models, etc), build front-end , connect both? build @ same time, 1 feature @ time? go option? i recommend building both @ same time, in separate apps (that way can test api actual api rather backend), in close proximity 1 another. way can make sure both play nicely each other , you're getting results need, plus if on 1 causes error on other bug become apparent. let me know if answers question enough, can clarify/ give additional examples here if you'd like.

c++ - Passing a point in to a function -

in program i've created 2 pointers (a,b) points memory address of x , y. in function i've created supposed swap memory address of , b(so b=a , a=b). when compile gives me error (invalid conversion 'int' 'int*') mean? i'm passing pointer function or read regular int? #include <iostream> using std::cin; using std::cout; using std::endl; void pointer(int* x,int* y)// swaps memory address a,b { int *c; *c = *x; *x = *y; *y = *c; } int main() { int x,y; int* = &x; int* b = &y; cout<< "adress of a: "<<a<<" adress of b: "<<b<<endl; // display both memory address pointer(*a,*b); cout<< "adress of a: "<<a<<" adress of b: "<<b<<endl; // displays swap of memory address return 0; } error message: c++.cpp: in function 'int main()': c++.cpp:20:16: error: invalid conversion 'int

authentication - How to use an auth token and submit data using Python requests.POST? -

using wheniwork's api, need use token authentication, , need send data create new user. order or name of arguments send requests.post() matter? if i'm using pull information, can have url contain thing i'm looking for, , send payload token. example: url = 'https://api.wheniwork.com/2/users/2450964' payload = {"w-token": "ilovemyboss"} r = requests.get(url, params=payload) print r.text when try add new user however, i'm either not able authenticate or not passing data correctly. api reference shows format using curl: curl https://api.wheniwork.com/2/users --data '{"first_name":"firstname", "last_name": "lastname", "email": "user@email.com"}' -h "w-token: ilovemyboss" here's i've written out in python (2.7.10) using requests: url = 'https://api.wheniwork.com/2/users' data={'first_name':'testfirst', 'last_name':

ios - UIAlertView for when fetching JSON fails -

this question has answer here: fetching json data after failed retrieval 1 answer i'm trying uialertview run when fetching json data fails, can't seem work. i'd appreciate if show me how or point me in right direction! i think have forget write failure block. afhttprequestoperation *operation = [[afhttprequestoperation alloc]initwithrequest:request]; [operation setcompletionblockwithsuccess:^(afhttprequestoperation *operation, id responseobject) { nslog(@"success: %@", operation.responsestring); } failure:^(afhttprequestoperation *operation, nserror *error) { nslog(@"error: %@", operation.responsestring); }]; hope you.

angularjs - Grunt is stuck when building tasks tree for ng-grid project in Webstorm in Windows 2012 -

i cannot setup ng-grid project in webstorm under windows 2012. npm , grunt references set correct. grunt references: node interpreter: c:\program files (x86)\microsoft visual studio 14.0\common7\ide\extensions\microsoft\web tools\external\node.cmd grunt-cli package: c:\program files (x86)\microsoft visual studio 14.0\common7\ide\extensions\microsoft\web tools\external\node\node_modules\grunt-cli\ npm succeeded install grunt package: npm install -g grunt-cli c:\program files (x86)\microsoft visual studio 14.0\common7\ide\extensions\microsoft\web tools\external\node\grunt -> c:\program files (x86)\microsof t visual studio 14.0\common7\ide\extensions\microsoft\web tools\external\node\node_modules\grunt-cli\bin\grunt grunt-cli@0.1.13 c:\program files (x86)\microsoft visual studio 14.0\common7\ide\extensions\microsoft\web tools\external\node\node_modules\grunt-cli ├── resolve@0.3.1 ├── nopt@1.0.10 (abbrev@1.0.7) └── findup-sync@0.1.3 (lodash@2.4.2, glob@3.2.11) when i'm