Posts

Showing posts from April, 2010

ios - UITextField validations -

Image
hi beginner in ios in project crating 1 registration page , there have provide validations textfields best level , have searched many textfield validations tutorials did not correct 1 according requirement when clicked on textfield if there error need show alert message on textfields below screen have written many custom methods not working please me one you have make custom view validate textfields you can try https://github.com/ustwo/us2formvalidator code in reference objective-c us2validatortextfield *firstnametextfield = [[us2validatortextfield alloc] init]; firstnametextfield.validator = [[[myprojectvalidatorname alloc] init] autorelease]; firstnametextfield.shouldallowviolation = yes; firstnametextfield.validateonfocuslossonly = yes; firstnametextfield.placeholder = @"enter first name"; firstnametextfield.validatoruidelegate = self; [_textuicollection addobject:firstnametextfield]; [firstnametextfield release];

Parsing Inconsistent JSON data: PHP -

the application pipedrive gives me inconsistent json data. example, in array elements, gives me "formatted_value":"$3,500","weighted_value":2100,"formatted_weighted_value":"$2,100","rotten_time":null , while in others, gives me, "formatted_value":"$2,950","rotten_time":null,"weighted_value":2950,"formatted_weighted_value":"$2,950" . json data in order of formatted_value,weighted_value,formatted_weighted_value,rotten_time in every array element, that's not case sadly. does know of way check right data written right column based on column name , key name? below code parse json data: function parsefunction($startpos) { $url = 'urltocalljsondata'; $ch = curl_init($url); //initialize connection url if(is_callable('curl_init')) { echo "enabled"; } else { echo "not enabled"; } curl_setopt($ch, curlopt_url, $url);

Getting Chef to install, configure and run RabbitMQ -

i trying simple, single instance of rabbitmq running via rabbitmq-chef recipe . essentially, have ubuntu machine, , i’d chef take care of heavy lifting necessary install, configure , rabbitmq running on it. the documentation isn’t written beginners, went ahead , started downloading cookook: knife cookbook site download rabbitmq warning: no knife configuration file found downloading rabbitmq cookbooks site @ version 4.1.2 /users/myuser/sandbox/chef/0.6.2/rabbitmq-4.1.2.tar.gz cookbook saved: /users/myuser/sandbox/chef/0.6.2/rabbitmq-4.1.2.tar.gz however i’m @ complete loss need script/configure in order add cookbook chef server, such when ssh onto target ubuntu machine, can bootstrap machine chef , run something turn ubuntu machine rabbitmq server. ideas?

Create php file to sync mysql data from some local server -

i develop php application input technical support field(tsf) laptop (which not connected internet) , online server on office. idea create php file sync (send , receive) latest data between office pc(online) , tsf laptop(offline). the rule each tsf should sync every end of day send day report office pc , latest data office pc can used offline. the problem don't know how create php file. here structure of mysql database : table merchant : id, name, address, phone, area, lastupdate table item : id, merchid, sn, sku, code, lastupdate table visit : id, date, merchid, itemid, act, result, lastupdate tsf can edit merchant , item table , add visit table, office pc can anything... on each table give lastupdate column php sync script can compare latest update...but don't know how compare using php...can me? it's not easy, need know bit php programming. of course can't expect here (you may pay though). however, why not trying less elegan

java - Why trimToSize/ensureCapacity methods provide 'public' level access? -

any user access java.util.arraylist facility, has obey usage contract provided in java.util.list . but 1 can break usage contract , access methods trimtosize public void trimtosize() { ... } and ensurecapacity public void ensurecapacity(int mincapacity) { ...} because these 2 methods neither overridden java.util.abstractlist nor implemented java.util.list . so, why these 2 methods provide public level access , break abstraction provided java.util.list ? there cases efficiency may cost more data abstraction. ensurecapacity may used preallocate internal buffer once when add known number of elements. trimtosize may used when not going add more elements free wasted memory. both methods non-applicable other list implementations, added arraylist only. note list created , populated 1 method knows implementation used. not break abstraction. example, consider such code: public list<string> createlist() { arraylist<string> list = new arraylis

php - How to get Referrals URL, Landed on my site from Google Ads -

i struggling referrals url. actually , have adwords campaign , ads showing on google ads display partner site using google ads program. after click on ads, person landed on mypage. on landed page on side want url, person on right before landed on page, means on url ads showing.. want referrals url using ga api. https://support.google.com/adwords/answer/2382957?hl=en they using ga possible. is possible url ga ? if yes search criteria referral url landed google ads. which 1 report me report ? i use ga api php version. thank you naresh kumar

How to make CSS ROWS equal height? PURE CSS/HTML -

Image
i have been looking through interwebs, particularly stackoverflow, find answer, i've not been able to. folks here have helped me solve "equal column height on row" - great, of content. but, whole different game, apparently. i have site, basic css layout, top bar logo , nav, image container below it, , content footer. in 'content area' have set 2 div classes, osection , esection (odd , even, clever, know). did each div have alternating background color visually break packets of content. however, these rows not of equal height. seem expand height of content contained within div. ideally, i'd each of these divs have same height, regardless of how content in div (i guess have tall (same height) largest div), want make sure each on own individual line, need equal height divs stacked on top of each other i have tried using flexbox various properties, wasn't working expected to. here css (snip) .osection { /*margin: 2% 0; */ background-

ios - "unexpectedly found nil" - delegate assignment in subVC -

i have been stuck on past few days - graphview ui class instance - declare calculatorviewdatasource protocol outside of graphview class, contain weak var calcdatasource: calculatorviewdatasource? in it. in graphviewcontroller, in didset{} of graphview outlet try set delegate assume existing calculatorviewcontroller using following code: if let vc = splitviewcontroller?.viewcontrollers { println(vc) println(vc.count) if let fst = vc.first { println(fst.subviews) println(fst.subviews.first) } } graphview.calcdatasource = splitviewcontroller!.viewcontrollers.first!.subviews.first calculatorviewcontroller the code compile, crash "unexpectedly found nil" when assignment of graphview.calcdatasource (output) [<uinavigationcontroller: 0x7b71bd10>] 1 nil fatal error: unexpectedly found nil while unwrapping optional value (storyboard) splitviewcontroller - navigationcon

ios - Send command and wait for reply - Wait for delegate in Obj-C -

my goal achieve synchronized communication custom device i.e. next command can send when reply received. i'm doing in way device class implements devicedelegate protocol //device.h @class device; @protocol devicedelegate <nsobject> - (void)didrecivereplywithdata:(nsdata *)data; @end @interface device : nsobject {} in deviceviewcontroller implementation: @interface deviceviewcontroller() { bool waitingforreply = false; } @end @implementation deviceviewcontroller - (void)sendcommandwithdata:(nsdata *)data { if ( waitingforreply == false) { //send command code waitingforreply = true; } } - (void)didrecivereplywithdata:(nsdata *)data { //code waitingforreply = false; } @end but wish in more elegant way i.e. using gcd (semaphores?) blocks (completionhandler?). ideas? ps. sorry, forgot mention: commands sended device while waitingforreply = true should ignored!!! . possibly best approach here create queu

c# - Xamarin.Forms DatePicker not respecting Minimum / Maximum on WindowsPhone -

it may order of property setting or something, i've tried multiple ways, , verified properties prior function completing. however, when try following:- datepicker datepicker1 = new datepicker(); datepicker1.minimumdate = datetime.now.date; datepicker1.maximumdate = datetime.now.date.add(new timespan(7,0,0,0)); datepicker1.date = datetime.now.date; datepicker1.format = "mmm dd, yyyy"; on windowsphone when test this, can still select date earlier minimum , maximum date values set. actually further testing adding event listener dateselected , i've noticed control doing sorts of weird things:- so, original date when run is: aug 03, 2015 then change month july, , click tick. shows jul 03, 2015 less minimum date. don't event raised via 'dateselected' change ui date i've selected. if change month june, no event raised, display shows jun 03,2015 . if change month october, event raised, , display shows aug 10, 2015 maximum date, fine.

javascript - getting trouble with CSS in twitter widget using wordpress -

i have http://4gwirelessforum.intemind.biz/ used there plugin twitter widget showing @ right side name of linkedin profile have manage profile image know how set jst need give width of 285px; on cant understand put saying online url static.licdn.com css. how can there possibility change it. an reply highly appreciated. thanks in advance first, don't need change image size whole container's size containing widget part. go in style.css or plugin's css(if know) , add css of line in end : .li-profile-container { width:302px !important; } before 350px have used !important don't know css location keep in mind, work around m not sure site's other css have current solution test won't affect other css(i think won't).

android - Paho MQTT AlarmPingSender wakelock stucked -

i using paho android service project (app name sealer ). ( link ) i've tested 22 hours , result has brought me strange result. it seems app keeps awake cpu long time (~10,5 h). i've searched in source code wakelock tag , found wakelock tag belongs alarmpingsender class. has met problem ever ? i didn't modify android service source code, it's original. i've attached screenshots (hangouts , viber comparison). screenshots edit 1. there code snippet source code: mqttoptions = new mqttconnectoptions(); mqttoptions.setcleansession(false); // defaultkeepalive 240 mqttoptions.setkeepaliveinterval(constants.defaultkeepalive); edit 2 i think relevant code android service source code: /* * class sends pingreq packet mqtt broker */ class alarmreceiver extends broadcastreceiver { private wakelock wakelock; private string wakelocktag = mqttserviceconstants.ping_wakelock + that.comms.getclient().getclientid();

scala - Efficient PairRDD operations on DataFrame with Spark SQL GROUP BY -

this question duality between dataframe , rdd when comes aggregation operations. in spark sql 1 can use table generating udfs custom aggregations creating 1 of typically noticeably less user-friendly using aggregation functions available rdds, if table output not required. is there efficient way apply pair rdd operations such aggregatebykey dataframe has been grouped using group or ordered using ordered by? normally, 1 need explicit map step create key-value tuples, e.g., dataframe.rdd.map(row => (row.getstring(row.fieldindex("category")), row).aggregatebykey(...) . can avoided? not really. while dataframes can converted rdds , vice versa relatively complex operation , methods dataframe.groupby don't have same semantics counterparts on rdd . the closest thing can a new dataset api introduced in spark 1.6.0. provides closer integration dataframes , groupeddataset class own set of methods including reduce , cogroup or mapgroups : case cl

r - Deleting rows where any of several columns is a duplicate -

i have dataframe id column, , several attribute columns. drop rows in dataframe 1 of attribute columns (or multiple) identical other attribute column. in other words, want keep rows each attribute unique value within row. for example, using code: example = data.frame(id = c("a", "b", "c", "d"), attr1 = seq(1,4), attr2 = c(2, 3, 3, 1), attr3 = c(1, 2, 3, 3)) which results in dataframe: id attr1 attr2 attr3 1 2 1 b 2 3 2 c 3 3 3 d 4 1 3 i want drop of rows last one, id "d". i've looked ways this, particular problem (unique within rows) i'm not sure how solve -- if columns easy. thanks in advance! you may try anyduplicated example[!apply(example[-1], 1, anyduplicated),] # id attr1 attr2 attr3 #4 d 4 1 3 or example[apply(example[-1],1, function(x) length(unique(x))==3),] or using regex example[!nzchar(sub('

c - What is the value of number left shift by -1 -

this question has answer here: left shifting negative shift count 5 answers what result of number when left shifted -1 in c programming using left shift operator ? e.g.: 23 << -1 from c11 standard 6.5.7p3 (for former versions same): "if value of right operand negative or greater or equal width of promoted left operand, behavior undefined." iow: undefined behaviour . prepare nasal demons . briefly: do not caution: while many programmers aware of , avoid negative shift counts, ignored counts >= bit-size of value undefined. makes ((unsigned int)1 << 32) - 1 undefined if unsigned int has 32 bits or less. signed values things become more complicated due sign (thanks @chux pointing me @ that). common pitfall. implementations, different results constant expressions (compile-time evaluated) , run-time evaluation migh

bash - limit text files to a certain word length, but keep complete sentences -

i have corpus of text files need copy, limiting each file same word length, while maintaining complete sentences. treating punctuation within {.?!} sentence boundary acceptable. python, trying learn bash, suggestions welcome. approach have been considering overshoot target word length few words , trim result last sentence boundary. i familiar head , wc , can't come way combine two. man file head not indicate way use word-counts, , man file wc not indicate way split file. context: working on text classification task machine-learning (using weka , record). want make sure text length (which varies in data) not influencing outcomes much. this, trying normalize text lengths before perform feature extraction. let's consider test file: $ cat file exist? program. therefore, am! suppose want truncate file complete sentences of 20 characters or fewer: $ awk -v n=20 -v rs='[.?!]' '{if (length(s $0 rt)>n) exit; else s=s $0 rt;} end{print s;}'

c# - TcpListener Proxy HttpWeb -

i'm working on project requires piping http traffic through local proxy, application has set using tcplistener. it's basic setup. i can standard header, example firefox be: get http://example.com/ http/1.1 host: example.com user-agent: mozilla/5.0 (windows nt 6.3; wow64; rv:39.0) gecko/20100101 firefox/39.0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: en-us,en;q=0.5 accept-encoding: gzip, deflate connection: keep-alive now, see conctents of example.com though went through proxy. solutions have seen take these headers, , pass them through httpwebrequest. however, don't seem understand how can pass entire header. if has dealt situation before, or know how can pass entire header httpwebrequest, appreciated. i'm writing in vb.net way, replies in either of .net languages totally fine. edit: may have worded little confusing. what getting request (header) website passing along proxy. read stream tcplistener header.

sonar runner - Why does SonarQube not show results, although the analysis succeeded? -

i use sonar-runner analyse project , analysis succeeds: 14:30:34.813 info - analysis reports sent server in 160ms 14:30:34.813 info - analysis successful, can browse http://localhost:9000/dashboard/index/amlserverproj 14:30:34.813 info - note able access updated dashboard once server has processed submitted analysis report. 14:30:34.814 debug - post-jobs : 14:30:34.815 debug - release semaphore on project : org.sonar.api.resources.project@3335ebfc[id=1,key=amlserverproj,qualifier=trk], key batch-amlserverproj info: ------------------------------------------------------------------------ info: execution success info: ------------------------------------------------------------------------ total time: 53.958s final memory: 26m/788m info: ------------------------------------------------------------------------ but when navigate http://localhost:9000/dashboard/index/amlserverproj error message: no analysis has been performed since creation. available section configuration.

windows - how to move folders with a loop over folders (in batch)? -

situation: i try move files inside loop in shell code not working. for /d %%f in (*) ( if "%%f" neq "%directorytoputfilesin%" ( move /y "%%f" "%directorytoputfilesin%" ) ) after hours of testing it, realized it's because %%f pointing folder, hence file cannot moved. bad solution: the way made work , confirmed suspicions saving value of %%f in variable , using variable on next turn move file. note, following needs initialisation of %precedentfile% first turn. for /d %%f in (*) ( move /y "%precedentfile%" "%directorytoputfilesin%" if "%%f" neq "%directorytoputfilesin%" ( move /y "%%f" "%directorytoputfilesin%" set precedentfile=%%f ) problem: this solution not practical , feels wrongs. there way adapt current code it, or way? try below code move files 1 folder in batch script: for /f %%a in ('dir /a:-d /b') move /y "

Adobe DTM - set a success event in the Adobe Analytics tool ONLY IF a discrete data element value exists -

i'm curious if there's way set success event in adobe analytics tool [without using custom script option], if discrete data element value exists. for example, have data layer object captures value in 1 of 2 flavors: value1 , value2. data layer object looks this: 'data_capture': 'value1|value2' in adobe dtm, set data element named data_capture return data_layer.data_capture i'm using direct call rule [ajax screen] activate adobe analytics tool , fire event1, if %data_capture% has value of 'value1'. just reiterate, if %data_capture% = 'value1', set event1=%data_capture%. if %data_capture% not = 'value1', not set event1. i'm not programmer, apologies if of syntax jacked-up. thoughts on solution appreciated. art -- linkedin.com/in/arthurlwebb | twitter.com/arthurlwebb for event base rules , page load rules there such option, please check: rule / condition / criteria in select box(criteria) there 'ch

javascript - Instafeedjs moment.js return time ago -

using instafeedjs , moment.js render instagram feed , format dates relative format ( x days/months/hours/minutes ago ). as see below, success function callback looping thru array separate images unique dom containers. portion works perfect, although, need obtain 'caption.created_date', gets little tricky include. can output unix timestamp pretty can't seem translate desired output, described above. thank help. var imgs = []; var feed = new instafeed({ limit: '12', get: 'user', userid: xxxxx, clientid: 'xxxxxxxxxxxxxxxxxxxx', accesstoken: 'xxxxx.xxxxx.xxxxx', limit: 20, resolution: 'standard_resolution', template: '{{model.created_time_ago}}<img src="{{image}}"/>', filter: function (image) { var imagedate = new date(parseint(image.created_time * 1000, 10)); var timeago = moment(imagedate).fromnow(); image.create_time_ago = t

Accessing user created variables for an array in a separate class Java (for homework) -

i super new java (4 days) , have never coded except sql databases , simple java script before. building sales commission calculator special policy adjusts amount of commission made based on annual sales amount tier system (<=96,000, >96,000<=120,000 , >120,000). i have completed. . .what need way use second class(a second class required ) create array takes output or input to/from user , shows user potential money he/she have made if or sales @ "x" in increments of 5,000 50% of user input total sales. here code have far: (i know systemouttest class in bad form sorry) /** * * @author wudkong */ import java.util.scanner; public class systemouttest { potentialwagechart potentialwagechart; public systemouttest(potentialwagechart potentialwagechart) { this.potentialwagechart = potentialwagechart; } /** * @param args * command line arguments */ public static void main(string[] args) { // main me

java - SQLiteLog﹕ no such colum -

i trying execute basic login form in android.this trimmed version of code.basically,if user enters invalid login details should trigger alert.however,i'm getting error when ever click on login button. below posted code. alert_dialouge alert = new alert_dialouge(); @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main_activity); context = this; final databasehelper hl = new databasehelper(context); alertdialog alertdialog = new alertdialog.builder( main_activity.this).create(); button b1 = (button) findviewbyid(r.id.login); v1 = (textview) findviewbyid(r.id.text_status_id); b1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { c = c + 1; edittext user = (edittext) findviewbyid(r.id.username); edittext pwd = (edittext) findviewbyid(r.id.password); str

php - Yii2 : Bad Request (#400) Missing required parameters: id -

my controller : public function actioncreate() { $model = new createbookings(); if ($model->load(yii::$app->request->post())) { $imagename = $model->primary_name; $model->file = uploadedfile::getinstance($model, 'file'); $model->file->saveas('uploads/'.$imagename.'.'.$model->file->extension); $model->id_image = 'uploads/'.$imagename.'.'.$model->file->extension; $model->save(); return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', [ 'model' => $model, ]); } } getting error on submitting form, dont know what's wrong it.. tried $model->save(false); ..but not working well

osx - How to start a specific song in spotify/iTunes -

if have access information : song name, artist, album, possible perform search on spotify/itunes (or apple music) , start song (if search successful) within desktop client ? spotify spotify has sdk ios works on ios , not on os x. source - asked questions ios sdk itunes itunes has unofficial frameworks may you. found 1 named " eyetunes " can let want said in questions. (perform search , launch song). but, unofficial . apple music today, no sdk or api has been announced moment not solution.

python - How can I Generate a URL for a text file without a specific website/server? -

here's want do: generate url can put in wordpress blog let users view big text file. don't know how can generate url. inspired websites flickr generate urls images , hoping there corollary text files. i taking mitx 6.00.1x python course, , 1 assignment had refer text file professor had uploaded onto course site. text file has url: https://courses.edx.org/c4x/mitx/6.00.1x_5/asset/words.txt not sure if url available non members. is there way can upload file universal url can access free? kind regards, spencer the way works supplying path text file (in case words.txt) on web server. when click link, you're going root through several directories , accessing file. if have access actual files on wordpress blog, can add text file there , give people path file. otherwise, use service such pastebin provide text file.

adobe brackets - Emmet custom snippet -

i trying code custom snippet emmet, , not getting result want. trying output this: <perch:every count=" "></perch:every> with cursor between quote marks , between tags. how go this? need abbreviation rather snippet? i have far: { "html": { "abbreviations": { "perchafter":"<perch:after>", "perchbefore":"<perch:before>" }, "snippets": { "perchcontent": "<?php perch_content('|'); ?>" "perchevery": "<perch:every count="|"></perch:every>" } } }

angularjs - Angular TypeError: name.replace is not a function for ng-style -

Image
i'm new angular , keep getting following error in console typeerror: name.replace not function . i'm not sure what's causing it, seems caused ng-style statement , maybe camelcase? the part don't understand why ng-style="isfrontview() || !matches && {'display': 'none'}" throws error, ng-style="!isfrontview() || !matches && {'display': 'none'}" doesn't throw error. in attempt remedy situation tried removing camelcase function name , went lowercase. attempted use !!isfrontview() , neither seemed remove error message. do know cause of error message , potential fix? html template: <div class="system-view"> <div class="controller-container fill" id="systemview1" ng-style="isfrontview() || !matches && {'display': 'none'}"> <canvas id="canvaslayer-shell" data-layername="front" wi

java - Access ejb from web module (RESTful services) in ear application -

i have ear application consists of ejb.jar , web application (war). ejb.jar contains ejbs (beans , interfaces) , war contains rest web services. want access ejbs war module, possible? injecting ejbs doesn't work, null pointer exception. i know has been asked many times can't seem working... i using glassfish v2.1.1 (i know should upgrade, right difficult...) here code fragment returns nullpointerexception: (i know not supposed validate user through get, example code trying check if can access ejb) @path("/user") public class userws { @ejb sb_usrremote sb_usrremote; @get @produces(mediatype.text_plain) public string checkloginattempt(string username, string password) { return sb_usrremote.checkloginattempt(username, password).tostring(); } } i didn't mention code works when include ejb.jar in ear application's lib folder war module can "see" it. there other way can access ejb classes? using intellij,

c++ - segmentation fault and array issue -

i've been going trying find segmentation error in program. when program crashes @ point. unsigned long data = octets[g]; so have tracked buffer being created in main loop fixed defined size. since it's defined in if statement in main need allocated "new"? after receiving tcp socket char buffer copied unsigned char buffer check binary data types. if data arrives called existance. int8u bytearray[buffersize]; this buffer passed message id , crc checking. not doing "new" type allocation issue because in main loop? thought go out of scope @ end of "if new data received" statement. long calc_crc24q(byte* octets, int start, int last) //start first byte, last msbyte of crc { long crc = crc24seed; for(int g = start; g < last; g++) //should xor preamble end of data { unsigned long data = octets[g]; //fault occurs here crc = crc ^ data << 16; (int = 0; < 8; i++) { crc <<= 1; if (crc & 0x1

java - Using JSOUP to Login to ConEd website -

i have read extensively how , have tried number of different variations, can't work. basically, want login conedison website , scrape billing history. here have: connection.response loginform = jsoup.connect("https://apps.coned.com/cemyaccount/nonmemberpages/login.aspx?lang=eng") .data("_lastfocus","") .data("_eventtarget","") .data("_eventargument","") .data("_viewstate", viewstate) .data("_eventvalidation", eventvalidation) .data("ctl00$main$login1$username", username) .data("ctl00$main$login1$password", password) .data("ctl00$main$login1$loginbutton", "sign in") .useragent("mozilla/5.0") .method(method.post) .execute(

.net - On-premise service health monitoring -

what best way of monitoring health of services/daemons used internally (in local network)? obviously, these cloud services periodically pinging target sites not option. ideally, need installed on premise, listen periodic http messages coming target services themselves. in case of signals not received prolonged period of time, notifications should sent (e.g. via email). so far services written in .net , security reasons outbound connections public network allowed. it seems looking runtime profiler. answer etw tracing. you should use perfmonitor. take on these links: http://bcl.codeplex.com/releases https://msdn.microsoft.com/en-us/library/ms751538(v=vs.110).aspx http://blogs.msdn.com/b/vancem/archive/2010/08/02/perfmonitor-runanalyze-a-quick-performance-checkup-for-your-managed-app.aspx

lighting - Three.js less intense ambient light? -

Image
i have solar system simulator i'm working on in three.js sun has pointlight @ center intensity of 2.5. looks great while planets facing sun, rest of planet dark. there way can add kind of ambient light source less intense pointlight bright enough show detail on dark side of planets? ambient light low color value (in hex between 0x000000 around 0x666666 ) lightens everything in scene: var ambientlight = new three.ambientlight( 0x222222 ); in three.js there hemisphere light works ambient can control light top and 1 coming bottom seperatly. it used fake reflection of light ground , adds little more depth scene pure ambient light. see demo example, including directional light: http://threejs.org/examples/webgl_lights_hemisphere.html

Rails ajax form for products -

i've been working app pizzeria customers order pizzas through website. working product page try submit products shopping cart through ajax, i'm stuck. haven't been able build shoppingcart accept product-id, product-size-id, extra-toppings array , quantity. decided try go session-store order-row ids stored , on menu page every product has form user add product, size , quantity shoppingcart keep getting error in server logs: started post "/order_row" ::1 @ 2015-08-03 11:18:21 +0300 processing orderrowscontroller#create js parameters: {"utf8"=>"✓", "order_row"=>{"product"=>"1", "size"=>"0", "quantity"=>"2"}, "commit"=>"tilaa"} completed 500 internal server error in 2ms (activerecord: 0.0ms) activerecord::associationtypemismatch (product(#70158072501800) expected, got string(#70158039566200)): app/controllers/order_rows_controller.r

excel - Validate number of columns in .xls file before upload in RAILS -

i uploading .xls file using carrierwave gem in rails. before uploading xls file, want validate .xls file: 1) contains amount of columns 2) first row contains headers. i don't know begin. know validations must occur in model, , saw there gem validation csv, nothing xls. need pointed in correct direction. you try roo gem sheet = roo::excel.new("./excel_file.xls") # header sheet.row(1) # number of columns sheet.last_column http://railscasts.com/episodes/396-importing-csv-and-excel for validation create method job: def validate(sheet) errors = [] header = sheet.row(1) num_of_columns = sheet.last_column errors << 'need headers' unless (array_of_needed_headers - header).empty? errors << 'need more columns' if num_of_columns < number_of_columns errors end you create own validator on model: http://guides.rubyonrails.org/active_record_validations.html#performing-custom-validations

angularjs - Angular1.3: ng-bind-html not working when trying to load html elements/tags in a string? -

i trying render html tags in string example: ("<div>test</div><p></p>......") pulled json data, usual $sce.trustashtml() filter below not work reason , renders string plain text: myhtmlfilter.js :---- angular .module('myapp.htmlfilter', []) .filter('html', ['$sce', function ($sce) { return function (text) { return $sce.trustashtml(text); }; }]); index.html:---- <div ng-bind-html='view2.loadedjson.htmltextstring | html'></div> it seem work if hardcode html directly filter below: <div ng-bind-html='"<strong>test</strong>" | html'></div> would know going wrong? you need include ngsanitize in app. docs ( https://docs.angularjs.org/api/ng/directive/ngbindhtml ): to utilize functionality, ensure $sanitize available, example, including ngsanitize in module's dependencies (not in core angular). in order use ngsanit

c# - Extending the UI in Outlook 2010 by means of HTML or somthink like this for rendering web page -

Image
i looking way extend user interface in outlook 2010 of html or somthing on html iframe on following picture. want know if possible or must create whole interface means of fluent ui said in this article update : solved you need create outlook task pane - see https://msdn.microsoft.com/en-us/library/bb296010.aspx more details.

css - gulp-sourcemap file extension issue -

trying create gulp file picks our less files , generates appropriate .css, .min.css, , .css.map files. close, sourcemaps writing map file extension .css.min.css. /// <vs beforebuild='less' solutionopened='less' /> /// <binding beforebuild='less' projectopened='less' /> var gulp = require('gulp'); var less = require('gulp-less'); var sourcemaps = require('gulp-sourcemaps'); var autoprefixer = require('autoprefixer'); var minifycss = require('gulp-minify-css'); var pleeease = require('gulp-pleeease'); var rename = require('gulp-rename'); var mqpacker = require('css-mqpacker'); var csswring = require('csswring'); var postcss = require('gulp-postcss'); var processors = [ autoprefixer({ browsers: ["ie >= 9, firefox > 10, last 2 chrome versions, last 2 safari versions, last 2 ios versions"] }), mqpacker ]; gulp.task('less'

python - Maximum number of elements in the path of a matrix -

i tried solve problem of map (matrix 4x4) using python. i want find maximum number of elements in path of map provided next node must lesser previous node possible combinations of elements in matrix. 4 8 7 3 2 5 9 3 6 3 2 5 4 4 1 6 the movement element can move east-west-north-south for example m[0][1] can move m[0][2] , m[1][1] 4-> 8 or 2 here sample code have no idea how recursively check every element. #import itertools n = 4 matrix = [[4, 8, 7, 3 ], [2, 5, 9, 3 ], [6, 3, 2, 5 ], [4, 4, 1, 6]] index,ele in enumerate(matrix): vals=[] i2,e2 in enumerate(ele): index2,ele2 in enumerate(ele): if index < (n-1): if ele2 > matrix[index+1] [index2]: vals.append(matrix[index+1] [index2]) if index > 0: if ele2 > matrix[index-1] [index2]: vals.append(matrix[index-1] [index2]) if index2 < n-1: if ele2 > matrix[i