Posts

Showing posts from January, 2010

linux - multithread access to platform device driver -

i writing platform device driver embedded linux on arm. i've noticed multithreaded application user space can access driver 1 thread @ time, , never simultaneously regardless of separate file access in /dev/* driver. the same driver (with modified probe()) targeted x86 on pcie works fine multithreaded access functions. any idea why? thanks. this error in user space application.

C++: How might one draw an ASCII character at a specific location in command prompt -

basically, want able create function can go: draw('c', x, y); draw('h', x+1, y); draw('a', x+2, y); draw('r', x+3, y); and command prompt display char @ given x , y position all figure out in research have include <windows.h> , have minimal experience with, , use pre-defined content in library. this might started. see https://msdn.microsoft.com/en-us/library/windows/desktop/ms682073(v=vs.85).aspx more info. #include <windows.h> #include <stdio.h> void main() { handle screenbuffer = createconsolescreenbuffer( generic_read | generic_write, file_share_read | file_share_write, null, console_textmode_buffer, null); if (screenbuffer == invalid_handle_value) { printf("createconsolescreenbuffer failed - (%d)\n", getlasterror()); return; } if (!setconsoleactivescreenbuffer(screenbuffer)) { printf("setconsoleactivescre...

image - Highcharts: Custom button - symbol is misplaced -

Image
i have added new custom button, own symbol image: image not placed should :( can 1 help? chanan here how added button: exporting: { buttons: { 'mybutton': { _id: 'mybutton', symbol: 'url(images/gallery/reset_zoom.jpg)', x: -62, symbolfill: '#b5c9df', hoversymbolfill: '#779abf', onclick: function() { alert('click!') } } } } found answer :) using symbolx , symboly exporting: { buttons: { 'mybutton': { _id: 'mybutton', symbol: 'url(images/gallery/reset_zoom.jpg)', symbolx:6, symboly:6, x: -62, symbolfill: '#b5c9df', hoversymbolfill: '#779abf', onclick: fun...

hadoop - Creating Hive Tables via Informatica Big Data Edition -

i old informatica powercenter 8 guy , heading team using informatica big data edition 9.5.1. have question regarding hive. can informatica build hive tables or have built separately? if can built when 'not exists', steps? thanks! if enable below option in pc, generate/create hive tables "generate , load hive table" available in pc, power exchange hadoop way works is, pc first load hdfs file , create hive definition on , make sure select "externally managed hive table", pc create external table. although @ mapping level, need define flat file target

r - Sum counts given in one data.frame up to dates given in another data.frame -

i update audit data frame comparisons within data frame: test : data frame of number of patients date : test <- data.frame( date=as.date(c("2012-12-12","2012-12-29","2013-01-15")), patients=c(4,7,3) ) date patients 1 2012-12-12 4 2 2012-12-29 7 3 2013-01-15 3 audit : data frame of audit dates : audit <- data.frame(date=as.date(c("2012-12-31","2013-01-31")), count=c(na)) date count 1 2012-12-31 na 2 2013-01-31 na q: audit$count should total number of patients in test audit$date ? this doesn't work: audit$count <- sum(test[test$date < audit$date,]$patients) how best it? one way use sapply values of audit$date : audit$count <- sapply(audit$date, function(x) sum(test$patients[test$date < x])) date count 1 2012-12-31 11 2 2013-01-31 14

YouTube channel subscribe for Android -

i using youtube api within app. users can log in google+ account. user able subscribe youtube channels. there seems web here: https://developers.google.com/youtube/subscribe/ but can't find suited android. missing documentation or there workaround? you don't need specific android library subscribe authenticated user specific channel. send authenticated post request subscriptions/insert endpoint channelid of channel want subscribe part param snippet : http post https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&key={your_api_key} request body: { "snippet": { "resourceid": { "channelid": "xxxxx" // channel id want subscribe } } }

android - Out of memory on a 322013-byte allocation -

i want display bitmap flickr in staggeredgrid layout. photos display @ beginning. however, when scroll images down further, returns "error - out of memory". how avoid out of memory error when displaying bitmap images? below log: e/dalvikvm-heap: out of memory on 322013-byte allocation. 01-21 09:56:42.718 25341-25360/com.example.myapp i/dalvikvm: "thread-557" prio=5 tid=13 runnable 01-21 09:56:42.718 25341-25360/com.example.myapp i/dalvikvm: | group="main" scount=0 dscount=0 obj=0x4251a118 self=0x5f496370 01-21 09:56:42.718 25341-25360/com.example.myapp i/dalvikvm: | systid=25360 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1598646248 01-21 09:56:42.718 25341-25360/com.example.myapp i/dalvikvm: | state=r schedstat=( 24035935571 12370314782 38194 ) utm=2070 stm=333 core=1 01-21 09:56:42.718 25341-25360/com.example.myapp i/dalvikvm: @ java.io.bytearrayoutputstream.tobytearray(bytearrayoutputstream.java:~122) 01-21 09:56:42.718 253...

matlab - Dividing a matrix into sub matrices with same number of rows but different number of columns -

if, example, have 5000x30 matrix , want obtain 10 sub matrices having dimensions of 5000x3 , how code in matlab . have read several post on issue, this 1 here example , none of them keep number of rows in submatrices same main matrix. as handling large matrices, prefer code faster, using matlab's inbuilt functions such mat2cell or other vectorized method, not loops. as per @beaker comment, using reshape(a, 5000, 3, 10) solved problem.

Play video when app goes background android -

how keep continue playing video when press home button , app go background? @ time still able listen audio , work on app. should add service control video playing? if app running in background, way show screen (image, view objects) using windowmanager in service . should create service , add view want show windowmanager . i'm not sure can show video windowmanager . think way try.

c++ - ShellExecute doesn't work for other computer -

i made program using win32api. in program, has "shellexecute" phrase in order execute chrome searching. following abstraction fo wrote. #include <windows.h> #include <shellapi.h> int main () { shellexecute(null, l"open", searching_url, null, null, sw_showmaximized); } it works in computer. but, sent windows app other people , said doesn't work. mean shellexecute doesn't work. cannot catch start figuring out what's wrong here. would please suggest how figure out in structured way? thanks. two things try: shellexecute can require com initialized under circumstances. docs shellexecute function explain why in more detail. should call coinitializeex(null, coinit_apartmentthreaded | coinit_disable_ole1dde) before call shellexecute , couninitialize() afterwards. instead of using l"open" verb, should use null . null give "default" action object (equivalent double-clicking it) not "open"...

ios - When should I use weakself in a block, and why there is no retain cycle in Masonry? -

uibutton *testbutton = [[uibutton alloc] init]; [self.view addsubview:testbutton]; testbutton.backgroundcolor = [uicolor redcolor]; [testbutton mas_makeconstraints:^(masconstraintmaker *make) { make.width.equalto(@100); make.height.equalto(@100); make.left.equalto(self.view.mas_left); make.top.equalto(self.view.mas_top); }]; [testbutton bk_addeventhandler:^(id sender) { [self dismissviewcontrolleranimated:yes completion:nil]; } forcontrolevents:uicontroleventtouchupinside]; i use both blockskit , masonry in code. if use blockskit, bk_addeventhandler , there retain cycle, think because self retain self.view, retain testbutton, retain self. however, when use mansonry alone without blockskit, , use strong self in masonry mas_makeconstraints , occurs me there no retain cycle because viewcontroller can invoke dealloc method. can explain me there no retain cycle in masonry? it's because block kit block retained execution @ later date (thus creating, th...

ios - How to stop cursor changing position when I setAttributedText in UITextView delegate method textViewDidChange -

the following code changes "test" in textview's string red color has effect of moving cursor end of text block when textviewdidchange called (aka when text editing made annoying). how can prevent cursor moving when setattributedtext in textviewdidchange? - (void)textviewdidchange:(uitextview *)textview { nsstring* currentstring = self.textview.text; nsmutableattributedstring* string = [[nsmutableattributedstring alloc]initwithstring:currentstring]; nsarray *words=[currentstring componentsseparatedbystring:@" "]; (nsstring *word in words) { if ([word isequaltostring:@"test"]) { // change color nsrange range=[currentstring rangeofstring:word]; [string addattribute:nsforegroundcolorattributename value:[uicolor redcolor] range:range]; } } // assign new color textview's text [self.textview setattributedtext:string]; } simply save , restore selected range:...

android - My R in library is red but I can build and run app normally -

Image
i use compile project(':pickphotos') include library named pickphotos. the r in pickphotos red though have me.crosswall.photo.pick.r.i can build , run app normally. when use alt+enter , shows solution: when use move 'r' in pickphotos, shows r: but if pick me.crosswall.photo.pick.r,i repeat r error in next build. below build.gradle of pickphotos: apply plugin: 'com.android.library' android { compilesdkversion 23 buildtoolsversion '23.0.2' compileoptions { sourcecompatibility javaversion.version_1_7 targetcompatibility javaversion.version_1_7 } defaultconfig { minsdkversion 14 targetsdkversion 23 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } sourcesets { ma...

javascript - AngularJs Ui-view can't show correctly -

i want use ui-view , ui-router in part of page.but reason can't show template "app_usermng_table.html". main code of part follows: 1. router config part (i have add "ui.router" dependency in module "app" yet.) .state('app.usermng', { url: '/usermng', templateurl: 'tpl/app_usermng.html', resolve: { deps: ['uiload', function( uiload ){ return uiload.load( ['js/controllers/usermng/usermng.js','css/usermng.css'] ); }] }, onenter: function(){ console.log("enter usermng"); } }) .state('app.usermng.table',{ url:'/table', templateurl:'tpl/app_usermng_table.html', resolve:{ deps:[ 'uiload', ...

How to convert a string to datetime in ruby -

this question has answer here: ruby datetime parsing 'mm/dd/yyyy' format 4 answers in ruby string "tuesday, january 19, 2016 8:00 pm" options have converting date/time format recognized ruby? edit: similar questions ask converting mm/dd/yyyy format, question different format appears answer same. understand why may appear duplicate not. you can use datetime.strptime . example: 2.1.2-perf :029 > datetime.strptime("tuesday, january 19, 2016 8:00 pm", "%a, %b %d, %y %i:%m %p") => #<datetime: 2016-01-19t20:00:00+00:00 ((2457407j,72000s,0n),+0s,2299161j)>

I cannot log in my wordpress website -

when open website link ,i found errors.the error is: "cannot modify header information - headers sent (output started @ ...../wp-includes/pomo/entry.php:2) in /...../wp-includes/pomo/pomo.php(1) : eval()'d code on line 1". and cannot log in website admin shows plugabble.php errors. how can that? you need troubleshoot whats going on... check plugin compatibility issues, deactivate plugind , see if works another problem might have gotten text or whitespace [spaces or newline] before opening php tag or after closing php tag in theme's functions.php file. there can't single character before or after tags, check that... remove white spaces other files, on wp-congig.php maybe... do research on wordpress forums, below link might help https://wordpress.org/support/topic/cannot-modify-header-information-headers-already-sent-4

php - Message: session_start(): Cannot send session cache limiter - headers already sent -

this question has answer here: how fix “headers sent” error in php 11 answers having problem sessions becoming annoying. every time try start session on particular page following error: warning: session_start(): cannot send session cache limiter - headers sent (output started @ /home/uplbcdcn/public_html/cdc/admin_uplbcdc/header.php:57) in /home/uplbcdcn/public_html/cdc/admin_uplbcdc/index.php on line 33 warning: cannot modify header information - headers sent (output started @ /home/uplbcdcn/public_html/cdc/admin_uplbcdc/header.php:57) in /home/uplbcdcn/public_html/cdc/admin_uplbcdc/index.php on line 42 here code: header.php <!doctype html> <html> <head> <title>uplb credit , development cooperative</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!--...

android - Toolbar: changing menu items and background and items color -

Image
in application want toolbar behave in google applications. in apps, when select items list, toolbar changes it's menu items, , changes it's color , statusbar color. followed animation. i know best way of doing that. maybe there official api, or library? here thoughts: having 2 sets of menu items , manually adding/removing or showing/hiding them, , changing toolbar color property animator having 2 toolbars @ same position, , replacing them when needed. (you can see on .gif image toolbar's title's margin changes, there 2 toolbars) ? it called action mode . used show options specific operation. have @ link creating contextual menus .

msbuild - Visual Studio 2015 UP1 always rebuilds my C# netmodule-output project. Can it be fixed? -

i have c# project, named 'x', modified x.csproj file, , changed <outputtype>library</outputtype> <outputtype>module</outputtype> means outputting .netmodule files instead of .dll files, cool, can use netmodules inputs c++/cli projects. but, visual studio insists on recompiling project on every build, , when turn build output verbosity 'diagnostic', see line in output: project 'x' not date. missing output file 'c:...\x\bin\debug\x.exe'. the problem, of course, compiler outputting x.netmodule, , not x.exe, x.exe never found, , hence project recompiling on every build. worse, if run msbuild command line on csproj, correct behavior occurs, rebuilds when files within project have changed. this leads me believe vs2015 [or others], computing final output name incorrectly because have specified module <outputtype> , , vs2015 forcing re-build, not msbuild. i know modifying <outputtype> of .csproj non-stan...

Get all files in raw folder in android -

lets have 100 .mp3 files in raw folder for single known file can read files can use getresources().openrawresource(r.raw.myfilename) but want files names in raw folder , pick random 1 list any help? public void listraw(){ field[] fields=r.raw.class.getfields(); for(int count=0; count < fields.length; count++){ log.i("raw asset: ", fields[count].getname()); } } since actual files aren't sitting on filesystem once they're on phone, name irrelevant, , you'll need refer them integer assigned resource name. in above example, integer thus: int resourceid=fields[count].getint(fields[count]); this same int you'd referring r.raw.whateveryounamedtheresource refer

java - Selenium encountering error in chrome driver -

while running script in local machine chrome driver, getting following error, same script working fine firefox. using selenium-java 2.48.2 , chrome driver 2.20 error log.. java.lang.nosuchmethoderror: org.openqa.selenium.remote.service.drivercommandexecutor.<init>(lorg/openqa/selenium/remote/service/driverservice;ljava/util/map;)v @ org.openqa.selenium.chrome.chromedrivercommandexecutor.<init>(chromedrivercommandexecutor.java:40) @ org.openqa.selenium.chrome.chromedriver.<init>(chromedriver.java:170) @ org.openqa.selenium.chrome.chromedriver.<init>(chromedriver.java:159) @ org.openqa.selenium.chrome.chromedriver.<init>(chromedriver.java:116) @ com.ancestry.systemtest.testngtestbase.setup(testngtestbase.java:137) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java....

How to create mupltiple qml components in a loop -

i wish create qml window 100 textedit's example, how create within loop? possible? a loop imperative code, it's not qml javascript or c++. sure, can (for example embedding qt.createcomponent() call in js loop) in qml, it's better thing think declarative, mean don't 'do' things, 'define' things : import qtquick 2.0 rectangle { id: base; width: 400; height: 800; column { spacing: 5; // simple layout avoid overlapping repeater { model: 10; // define number want, can variable delegate: rectangle { width: 200; height: 20; color: "white"; border { width: 1; color: "black" } radius: 3; textinput { anchors.fill: parent; } } } } } this way it's more powerfull , cleaner qml point of view !

php - mysql left join not return all left table row -

i have 2 tables phonetype: phonetypeid (pk) phonetyepe phone: phoneid (pk) peopleid (fk) phonetypeid (fk) areacode number` for specific peopleid return phonetypes , if peopleid has number diplay it, if not empty. like: phonetype phonetypeid areacode number company 1 111 11111 fax 2 home 3 222 222222 mobile 4 here prepared statement: $stmt = $conn->prepare("select * phonetype left join phone on phonetype.phonetypeid=phone.phonetypeid phone.peopleid = ?; "); if ( !$stmt ) {die(printf("error: %s.\n", mysqli_stmt_error($stmt) ) );} else if ( !$stmt->bind_param('i', $peopleid) ) {die(printf("error: %s.\n", mysqli_stmt_error($stmt) ) );} but way have phonetype phonetypeid areacode number company 1 111 11111 home 3 222 222222 what doing wrong? ps first join!! thanks!! edit (this questi...

regex - gsub error extract url with R, what did i miss -

i tried extract url everytime run code. didn't work. did miss? great. x$url <- gsub("(.*)( http://www.bloomin.com )(. jpg)(. )", "//2//3", x$product.description.) [1] //2//3 it return. want http://www.blooming.com/image/xxxxxxxx.jpg in return below vector. <div>colorful floor chair series</div><div><br /></div><div>soft suede</div><div><br /></div><div>cute bubble design</div><div><br /></div><div><p align="center"><p align="center"><img src="http://gdetail.image-gemkt.com/186/716088198/2010/2/e3b117e2-a7bd-4d.gif" /></div><div><p align="center"><p align="center"><img src="http://www.blooming.com/image/xxxxxxxx.jpg" /></div> backreferences must refered backslash no forward slash. use .*? ( non-greedy ) matc...

javascript - targeting class in script -

i have following script (i want to) adds '.shrink' class quarter-circle class div. <script> $(function(){ var shrinkheader = 50; $(window).scroll(function() { var scroll = getcurrentscroll(); if ( scroll >= shrinkheader ) { $('quarter-circle').addclass('shrink'); } else { $('quarter-circle').removeclass('shrink'); } }); function getcurrentscroll() { return window.pageyoffset || document.documentelement.scrolltop; } }); </script> <div class="quarter-circle"></div> but doesn't target it, not sure why. edit- trying apply when class added css .quarter-circle.shrink { height: 75px; width: 75px; } class selector . (dot) not empty character. so $('.quarter-circle') answer. edit: your div.quarter-circle has no content , width , height aren't specified(so 0x0px size) made example fiddle help. check out. fiddle : http://jsfiddl...

iphone - mpmovieplayercontroller view on uitableviewcell -

i want play video on uitableviewcell. click player view restart video. want click video player view open control menu , click uitableviewcell restart video. - (void)configurecell:(uitableviewcell *)cell atindexpath:(nsindexpath *)indexpath{ if (self.videoplayer && [self.indexpath_k isequal:indexpath]) { cell.imageview.userinteractionenabled = yes; cell.imageview.image = [cell.imageview.image resim_skala:cgsizemake(150, 100)]; uiview *vieww = [[uiview alloc] initwithframe:cgrectmake(0, 0, 150, 100)]; self.videoplayer.view.frame = cgrectmake(0, 0, 150, 100); self.videoplayer.view.userinteractionenabled = yes; [vieww addsubview:self.videoplayer.view]; [cell.contentview addsubview:vieww]; }else{ } } - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath{ self.videoplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:url]; ..... ...

angularjs - Angular input Validations not working -

<form name="lpform"> <div class="form-row clearfix"> <label class="lbl-fld" style="margin-left: 12%;">email id</label> <input class="mob-adj-inpbx" type="email" name="uemail" ng-model="useremail" placeholder=" me@example.com" ng-required="true"/> <div ng-show="lpform.uemail.$valid">enter valid email.</div> </div> </form> here, i'm adding validations 'email' , trying display error message when user enters invalid email. not working. i suppose want show error message if input invalid so ng-show="!lpform.uemail.$valid" maybe forgot bind scope variable? cause seems work fine. function ctrl($scope) { $scope.useremail = ''; } <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular.min.js...

angularjs - function call in ng-repeat does not render properly -

Image
i have piece of code: <tr ng-repeat="convention in conventions"> <td>{{ convention.id }}</td> <td>{{ convention.title }}</td> <td><a href="javascript:void(0)" ng-click="alert(convention.id)">edit</a></td> </tr> i wanna call function alert , pass id parameter.but not render properly: any suggestion? wrap alert() in function in controller , add scope this: $scope.handleclick = function(id) { alert(id); } then call function template: ng-click="handleclick(contention.id)" expressions embedded in templates see functions in respective scope.

visual studio - Unable to install NuGet Packages due to Incompatibility -

i can't seem install windows azure storage nuget package because version clashes package depends on it. can't seem install related azure because same error pops every time. install failed. rolling back... updating 'microsoft.data.odata 5.6.2' 'microsoft.data.odata 5.6.4' failed. unable find versions of 'windowsazure.mobileservices.backend.tables, windowsazure.mobileservices.backend.entity' compatible 'microsoft.data.odata 5.6.4'. why , how can around having compatible versions?

authentication - How to authenticate by using windows credentials in c# web application under form authenticate mode -

i developing web application , application must satisfy these requirement: the application need support authentication active directory , sql membership provider. if logged-in window account of actor window account existed in database, system show homepage , not show login form. otherwise, system shows login form user enter username , password login. the problem here is: can't windows account (username/ password) , base on username, check against database continue show homepage or show login page. how can username , password? notice in iis, system configured under form authentication, not windows authentication. web.config: <authentication mode="forms"> i tries such : windowsidentity.getcurrent() . environment.name , ... doesn't work. could please help? great thanks. providing link..hope http://www.codeproject.com/articles/94612/windows-authentication

NSExtensionActivationRule for exact one image or video - iOS App extension -

i building app action extension. that, extension should enable if user selects either 1 video or 1 image(it can process 1 file/object @ once). got nsextensionactivationrule predicate apple documentation this, subquery ( extensionitems, $extensionitem, subquery ( $extensionitem.attachments, $attachment, $attachment.registeredtypeidentifiers uti-conforms-to "org.appextension.action-one" || $attachment.registeredtypeidentifiers uti-conforms-to "org.appextension.action-two" ).@count == $extensionitem.attachments.@count ).@count == 1 and documentation says this statement iterates on array of nsextensionitem objects, , secondarily on attachments array in each extension item. each attachment, predicate evaluates uniform type identifier (uti) each representation in attachment. when attachment representation uti conforms of of 2 different specified utis (which see on right-hand side of each uti-conforms-to operat...

ruby on rails - NameError: uninitialized constant ApplicationHelperTest::Fill_IN -

i error message when add last test in code ruby on rails tutorial, listing 6.11 , 6.12 , run bundle exec rake test listing 6.13 running linux xubuntu 1) error: applicationhelpertest#test_full_title_helper: nameerror: uninitialized constant applicationhelpertest::fill_in test/helpers/application_helper_test.rb:5:in `block in ' when remove email validation test passes. test/models/user_test.rb require 'test_helper' class usertest < activesupport::testcase def setup @user = user.new(name: "example user", email: "user@example.com") end test "should valid" assert @user.valid? end test "name should present" @user.name = "" assert_not @user.valid? end test "email should present" @user.email = " " assert_not @user.valid? end end app/models/user.rb class user < activerecord::base validates :name, presence: true v...

ios - placeholder is not taking NSTextAlignmentNatural -

i have app have uitextfield . my app english - arabic app. now have below. addpostvideourl.backgroundcolor = [uicolor clearcolor]; addpostvideourl.textalignment = nstextalignmentnatural; <-- setting alignment addpostvideourl.textcolor = pgray_343434; addpostvideourl.placeholder = localize(@"videourl"); [addpostvideourl setvalue:pgray_343434 forkeypath:@"_placeholderlabel.textcolor"]; addpostvideourl.font = [self adjustdefaultfont:40]; addpostvideourl.autocorrectiontype = uitextautocorrectiontypeno; if see, have set alignment text nstextalignmentnatural . did because if keyboard arabic (& app english or arabic), want textfield start right side. with when changed keyboard english, text field start ltr & if change keyboard arabic, textfield start rtl. however, placeholder have @ left. any way how can make placeholder alignment based on app language? to tackle issue, below did... in .pch add below #define mydirection001 ([local...

Changing HTML Background Image Using JavaScript, depending on time of day (Using Multiple Images)? -

so i'm trying change background image of website correlate time of day. ex. it's evening, background picture change sunset. it's morning, background picture sunrise. but, wanting have function choose several arrays of pictures randomly. such as, have array of 3 evening, array 3 morning, array of 3 afternoon, etc. depending on time of day, function choose picture randomly correlating array , use picture background. i don't know if it's possible, appreciate guidance. edit: //greeting based on time of day var today = new date(); var hournow = today.gethours(); var greeting; var style; if(hournow >= 18) { greeting = 'good evening.'; } else if (hournow >= 12) { greeting = 'good afternoon.'; } else if (hournow > 0) { greeting = 'good morning.'; } else { greeting = 'hello.'; } document.write('<h1>' + greeting + '</h1>'); there isn't of image arrays on there because ...

How Runtime Exceptions are handled by Spring ExceptionHandler -

i using spring's @controlleradvice , @exceptionhandler exception handling. method throws custom exception controller , corresponding @exceptionhandler handle it. if runtime exception occurs(eg hibernateexception) throw runtime exception , dont have @exceptionhandler runtimeexceptions. my question how handle runtime exception? need add @exceptionhandler every exception thrown controller? dont want create generic exceptionhandler exception.class because have send different error code according exception occured. one way add try catch block in controller , throw custom exception catch block? or there better way? all @exceptionhandlers inside @controlleradvice class. the alternative don't catch exception in controller . catch exception in service layer , throw custom exception eg. if persisting record failed, throw databaseexception message. see below method: student persist(student object){ try{ studentdao.insert(object); }catch(hibernateexc...

mysql - Sql query not running in php and maybe an issue related to sql -

function running , other query of inserting data running commented below. error getting "error: select max(product_id) product_attribute " public function add_tbl1($attribute_id , $attribute_description){ $con=$this->con; $id = mysqli_real_escape_string($con, $attribute_id); $description = mysqli_real_escape_string($con, $attribute_description); $sql2="select max(product_id) product_attribute "; $no=0; if ($con->query($sql2) === true) { $no= $con->query($sql2); $no=$no+1; echo $no; } else { echo "error: " . $sql2 . "<br>" . $con->error; } /*$sql = "insert product_attribute ( attribute_id, attribute_description) values ( '$id', '$description')"; if ($con->query($sql) === true) { echo "new record created successfully"; } else { echo "error: " . $sql . "<br...

php - How to convert onsubmit to form_open -

my code this: <form action="http://<?php echo site_url();?>/loader/task1" onsubmit="return checkdifferance();" method="post"> how can convert onsubmit form_open? how improve code below? <?php echo form_open('loder/task1');?> try this <?php echo form_open('loder/task1', array('onsubmit' => 'return checkdifferance();'));?>

theorem proving - Z3 will not case split on hand-crafted data types -

i have defined own booleans, called boolean smt2, , and function boolean_and on them. conjecture , commutative: (declare-sort boolean) (declare-const sk_x boolean) (declare-const sk_y boolean) (declare-const boolean_false boolean) (declare-const boolean_true boolean) (declare-fun boolean_and (boolean boolean) boolean) ;; axiomatize booleans: false /= true , every bool true or false (assert (forall ((x boolean)) (or (= x boolean_false) (= x boolean_true)))) (assert (not (= boolean_false boolean_true))) ;; definition of , (assert (forall ((a boolean)) (= (boolean_and boolean_false a) boolean_false))) (assert (forall ((a boolean)) (= (boolean_and boolean_true a) a))) ;; try prove , commutative (assert (not (= (boolean_and sk_x sk_y) (boolean_and sk_y sk_x)))) (check-sat) however, z3 reports unknown on problem after while, though thought should able use case split assertions on skolemised variables sk_x , sk_y . curiously,...

android - TextInputLayout error text padding -

Image
i using textinputlayout appcompatedittext having custom xml shape based background appcompatedittext . whenever set error , error line starts beginning of layout. there way give padding error line. you can reference error textview using: textview textview = (textview) inputlayout.findviewbyid(android.support.design.r.id .textinput_error); then can layout params work with.

php - sfThumbnailPlugin black background for transparent parts -

i'm using sfthumbnail-plugin (version 2.0.1) in symfony 1.4-project, create thumbnails uploaded pdf-files. unfortunately transparent parts, i.e. background, of documents (which shown white in usual pdf-viewers) converted black in thumbnails. is there way fix this? my code: $t = new sfthumbnail(134, 190, true, true, 75, 'sfimagemagickadapter', array('extract' => 1)); $t->loadfile(sfconfig::get('sf_upload_dir') . "/path/" . $this->getobject()->pdf); $t->save(sfconfig::get('sf_upload_dir') . '/path/' . $this->getobject()->pdf . '.jpg', 'image/jpeg'); i cant provide working code this, might consider using pngs, support transparency, suggested here: imagemagick pdf jpgs results in black background further can try add flatten option described here: creating jpg thumbnails pdf causes problems new version of imagemagick you can pass additional options in 7th param of (unteste...

r - AWS EC2 Rstudio Server Error Occured During Transmission -

after on month, have managed piece how setup aws ec2 server. has been hard upload files there conservative (size) limits when done via upload button in rstudio server. error message when attempted "unexpected empty response server". not unique in respect e.g. trouble uploading large files rstudio using louis aslett's ami on ec2 i have managed use following commands through putty , has allowed me upload files via either filezilla or winscp. sudo chown -r ubuntu /home/rstudio sudo chmod -r 755 /home/rstudio once use these commands , log out, can no longer access rstudio on instances in future logins. can relogin instances via browser, error message: error occurred during transmission everything fine other once use putty lose browser access instances. think because command change of ownership or similar. should using different command? if don't use command cannot connect between filezilla/winscp , instance. if thinking of posting comment should close...

sql server - PHP- Error with SQLSRV_FETCH_ASSOC & sqlsrv_fetch_array -

this code using download result sql server query in excel . connection & query works fine , have installed sqlsrv extensions properly. still getting error these "use of undefined constant sqlsrv_fetch_assoc - assumed sqlsrv_fetch_assoc'" " warning : sqlsrv_fetch_array() expects parameter 2 long" i think problem sqlsrv_fetch_assoc . appreciated. function cleandata(&$str) { $str = preg_replace("/\t/", "\\t", $str); $str = preg_replace("/\r?\n/", "\\n", $str); if(strstr($str, '"')) $str = '"' . str_replace('"', '""', $str) . '"'; } $servername = "********"; $connectioninfo = array( "database"=>"****", "uid"=>"***", "pwd"=>"*****"); $connect = sqlsrv_connect( $servername, $connectioninfo); // filename download $filename = ...

python - Reduce by multiple combinations of key in Spark Streaming -

i have spark job listens kinesis stream , aggregations on it. rdds in dstream have structure follows - {"name":"abc", "sex": "m", "age":25, "points": 2}, ..... i want calculate sum of points across different combinations of keys ie, name, sex, age, sex_age, name_sex, etc the way doing right follows - count_by_name = instream.map(lambda x: (x.get('name'), x.get('points'))).reducebykey(lambda x, y: x[1]+y[1]) count_by_age = instream.map(lambda x: (x.get('age'), x.get('points')).reducebykey(lambda x, y: x[1] + y[1]) count_by_age_and_sex = instream.map(lambda x: (x.get('age')+'_'+x.get('sex'), x.get('points'))).reducebykey(lambda x, y: x[1]+y[1]) and on each key. not elegant way this, since there can more keys , more combinations. , have write separate reducer each combination. is there better way can parallelization or modularity of code?

javascript - Filtering in Telerik Kendo Multiselect -

hi have simple select in mvc view.... <select id="msproducts" multiple style="width:100%;"></select> which converted kendo multiselect using javascript/jquery $(document).ready(function () { //products multi-select $("#msproducts").kendomultiselect({ placeholder: "select product(s)", datatextfield: "productnametext", datavaluefield: "productnamevalue", datasource: { type: "json", serverfiltering: true, transport: { read: { url: "home/products" } } } }); }); my contoller has: 'get: home/products <httpget> function products() jsonresult dim diaryproductlist list(of productsmodel) = productsmodel.getproducts return json(diaryproductlist , jsonrequestbehavio...

Reading a hosted PDF file from a URL and converting to text in iOS using Objective-C -

i reading pdf file stored locally (using nsbundle) , converting text. but when trying read pdf http i.e. url scheme , give path pdf text converter returns nil. solutions appreciated. my basic question how read pdf file url path? on way there many restriction convert pdf file plain text.if want display pdf on app use pdf reader core

javascript - Play and pause to play sound -

im trying have these 4 buttons, added in code impliment 5th 1 later, can ignore 1 atm. want have when click on 1 button plays sound, if click on different one, pauses current sound , plays new one. dont seem working. code: <audio id="sound1" src="monkey.mp3"></audio> <audio id="sound2" src="sounds/sound2.mp3"></audio> <audio id="sound3" src=".mp3"></audio> <audio id="sound4" src=".mp3"></audio> <audio id="sound5" src=".mp3"></audio> <button onclick="playsound1()">sound 1</button><br /> <button onclick="playsound2()">sound 2</button><br /> <button onclick="playsound3()">sound 3</button><br /> <button onclick="playsound4()">sound 4</button><br /> <button onclick="playsound5()">sound 5</button...

angularjs - resumeChunkSize option -

i tried use resumechunksize option. example, upload.upload({ url: 'myurl', data: { file: file } ,resumechunksize: '10mb' found out causes ng-file-upload repeatedly upload same chunk if file smaller chunk. correct server response prevent or bug? reproduced taking fiddle 'drop , upload' , adding above resumechunksize option it

paypal - No API credentials when adding test accounts -

this question has answer here: paypal sanbox api credentials missing? 4 answers no end of trouble since developer site , sandbox changed last week. i've not managed make single working call new platform since launched. i've managed far getting 100002 errors - @ least means things talking, noticed today if create test accounts, api credentials blank/missing: ![screenshot])( http://qikr.co/files/pics/p/paypalnoap91044.jpg ) does know fix this? i've cleared out browser cache etc. there issues credentials not appearing accounts. logged developer account. try logging actual sandbox seller account, , going profile , requesting credentials. should able view these within sandbox seller account, , if have not been requested yet, can generate these. log out paypal account clearing browser cache , cookies (i use firefox). go developer.paypal.com ,...

yii2 - Setting up a database for Yii 2 -

i need install app written in yii 2 on local computer. installed composer , initiated app with: php /path/to/yii-application/init now need "create new database , adjust components['db'] configuration in common/config/main-local.php accordingly." i have no clue how that. 1) create database on server. 2) open common/config/main-local.php edit components to: 'components' => [ 'db' => [ 'class' => 'yii\db\connection', 'dsn' => 'mysql:host=localhost;dbname=database_name', 'username' => 'database_user', 'password' => 'database_password', 'charset' => 'utf8', ], if using mamp mac edit dsn line : 'dsn' => 'mysql:unix_socket=/applications/mamp/tmp/mysql/mysql.sock;dbname=database_name'