Posts

Showing posts from February, 2013

sql server - The current transaction cannot be committed and cannot support operations that write to the log file. Rollback the transaction -

i'm encountering error when running script in sql server 2008. when restore database in sql server 2012, runs , did not encounter errors. thanks in advance! here stored procedure: create procedure updatedependentviews ( @tablename nvarchar(128), @alldependents bit = 1 ) set nocount on; create table #dependencies ( [counter] [int] identity(1,1) not null, [view_name] [nvarchar](128), ) on [primary]; create index counter on #dependencies(counter); /* first degree dependent views. */ insert #dependencies(view_name) select v.[name] [view_name] sys.sql_expression_dependencies sd inner join sys.views v on sd.referencing_id = v.object_id inner join sys.objects d on sd.referenced_id = d.object_id sd.referenci...

php - Codeigniter REST API elapsed time -

i'm using codeigniter rest-api (author: philsturgeon ref url: https://github.com/philsturgeon/codeigniter-restserver ) i want add response how time took service generate , process response. i trying use $this->benchmark->elapsed_time() in controller, doesn't send time instead sends "success": 1,"took": "{elapsed_time}", i tried edit the main controller of api abstract class rest_controller extends ci_controller , append elapsed time final output send public function response($data = null, $http_code = null, $continue = false) but no luck, keep receiving "{elapsed_time}" appreciated. you can elapsed_time using this $this->benchmark->mark('code_start'); // code happens here $this->benchmark->mark('code_end'); echo $this->benchmark->elapsed_time('code_start', 'code_end');

angularjs - how to navigate to page without angular in protractor? -

this question has answer here: how use protractor on non angularjs website? 5 answers how can go page not contain angular protractor? test looks this: browser.driver.get('https://www.mysitewithlogin.com'); the result is: message:error while waiting protractor sync page: "angular not found on window" so site starts login page , not contain angular. uberhaupt possible? use below line of code before launching application. browser.ignoresynchronization=true; by writing above line, wont wait angular. considers app normal app.

node.js - How could I handle timeout request in koa? -

for example: var app = require('koa')(); app.use(function *(next) { var start = new date(); yield next; }); app.use(function *(next) { var result = yield loaddata(); this.body = result; }); app.listen(8080); let's assume if loaddata returns data more 1 second, want this.body = 'there timeout' . how achieve this? don't think settimeout able deal this. , tried this.response.settimeout function, said settimeout undefined. suggestion you can convert promise instead. `loaddata().then((oncompletion) => { //take time here timeout = timeend - timestart; timeout >= 1sec ? this.body = 'there timeout' : this.body = oncompletion }).((onfailure) => { //do if fails });` of course not work unless loaddata returns promise

ajax - JQuery return function error catch -

i submitting form call $.ajax() php. here $.ajax function work when success. when want show errors, there trouble loop responsetext. see $.ajax() code: $.ajax({ // ... , error: function(errors){ $.each(errors, function(index, error){ info.hide().find('ul').append('<li>'+error+'</li>'); }); info.slidedown(); } }); i catch errors, confusion, how renders errors see output in screen http://prntscr.com/7nt3lq . want render these error fields: {"name":["the name field required."],"fname":["the fname field required."]}, if write as: error: function(errors){ console.log(errors); } then output in screen http://prntscr.com/7nt9tv . how remove exceptional error: 422 (unprocessable entity) , responsetext loop through? the problem first param error callback not respose data, jqxhr object. $.ajax({ url: '/echo/asdf...

php - failed to import the csv file to mysql -

plzz me fix errors in following code.. couldn't read php code. how can make it? want show status of connection when closes. <table width="600" style="margin:115px auto; background:#f8f8f8; border:1px solid #eee; padding:20px 0 25px 0;"> <form action="<?php echo $_server["php_self"]; ?>" method="post" enctype="multipart/form-data"> <tr><td colspan="2" style="font:bold 15px arial; text-align:center; padding:0 0 5px 0;">browse , import excel file </td></tr> <tr> <td width="50%" style="font:bold 12px tahoma, arial, sans-serif; text-align:right; border-bottom:1px solid #eee; padding:5px 10px 5px 0px; border-right:1px solid #eee;">select file</td> <td width="50%" style="border-bottom:1px solid #eee; padding:5px;"><input type="file" name="file" id="file" /></td...

How do I center gadgets, gadget titles, and link lists in the footer section on blogger using HTML5 or CSS code? -

i have searched interwebs hours, including site, answer question , have not found one, i'm sorry if it's been answered before. i trying center gadgets (widgets?), gadget titles, , links. basically, want centered in footer section. have 3 column footer , using watermark template in blogger. managed center sidebar content (or @ least images , gadget titles) using css code found on forum. same code did not apply footer. searches have found info. , code pertains the post footer...but i'm concerned page footer. any pointing me in right direction helpful. you can check out website specific visual of problem, run erotica website , wouldn't want break content rules here. 18+ website/nsfw. if listing web address not okay, need see site visual of problem, please pm me it. if okay list website, let me know, people can me out it. thanks! try css blocks footer { margin :0 auto }

javascript - Page action icon displays only in extension page -

Image
i'm learning creating chrome extensions. have studied page actions, used create icon inside address bar. code follows: in manifest.json : { "manifest_version" :2, "name" : "gtmetrix", "description": "test google chrome extension", "version" : "1.0", "page_action":{ "default_icon" : "icon.png", "default_popup" : "popup.html", "default_title" : "test google chrome extension" }, "background": { "scripts": ["background.js"] }, "permissions" : [ "activetab" ] } in background.js chrome.tabs.getselected(null, function(tab) { chrome.pageaction.show(tab.id); }); in popup.html <html> <head> <script src="jquery.min.js"></script> <script src="popup.js"></script> <!-...

multithreading - how to run portions of bash script in parallel -

i running bash script consisting of 2 rather intensive loops run in sequence (the first loop runs followed second). quite time consuming , wondering if there way run these loops in parallel in order make script more efficient? any appreciated. thank you. you can do: ( while x loop 1 done ) & ( while y loop 2 done ) & # wait both loops finish wait

mysql inside a transaction does the binlog guarantee the update oder of table -

start transaction; update set b=1 a=1; update b set c=1 a=1; commit; the binary log record a, b update in order, when b's update flush log before a? how recurrent? if using transactional engine such innodb, guaranteed either both updates applied, or neither. if using engine such myisam transaction may left in state of partial completion, however, binary log done in same order made in initial connection. there no situation b updated before when made same connection(/transaction). if did these queries in parallel 2 different connections occur in either order.

angular - Making web workers work with Angular2/Zone.js -

i use web workers in angular2 application. when update model state callbacks triggered worker ( onmessage ), ui not getting refreshed. my understanding process depends on zone.js monkey-patching kinds of browser functions able detect updates things xhr or timeouts (and state updates settimeout work). supposed include support web workers? have explicitly trigger update somehow? try using ngzone , trigger update so: zone.run(() => { // change detection run after function });

Joomla module ReferenceError: jQuery is not defined -

i created module joomla 3 when load page jquery not working gives following error. referenceerror: jquery not defined var $k2 = jquery.noconflict(); k2.js?v.../gslab/ (line 9, col 4) another on referenceerror: jquery not defined jquery(window).on('load', function() { contact...enstack (line 35) and typeerror: document.getelementbyid(...) null document.getelementbyid('fb-root').appendchild(e); contact...enstack (line 647, col 2) i searched lot not able solve issue, jquery not working not able use j query date-piker. javascript code working. it error occur due fact jquery not loaded before k2. can correct error if switch jquery load in k2 parameters. go component - k2 - parameters , choose jquery @ "jquery library handling" selector.

wordpress - "text-align: center" not working with Media Query -

i have searched these boards extent believe thoroughly , still have issues after trying number of different solutions. using avada themes , using there shortcodes layout elements. in style.css have following @media screen , (min-width: 980px) { /* styles here */ p1#p114 { font-family: times; font-size !important; font-size: 380%; color: #ffffff; font-style: italic !important; text-shadow: 4px 4px 2px rgba(5, 5, 5, 0.75); line-height: 125%;} in page file have following code [fullwidth backgroundcolor="" backgroundimage="http://dylanstevenscrawshaw.com/painterspaint/wp-content/uploads/2015/06/colour-1.jpg" backgroundrepeat="no-repeat" backgroundposition="left top" backgroundattachment="fixed" video_webm="" video_mp4="" video_ogv="" video_preview_image="" overlay_color="" overlay_opacity="0.5" video_mute="yes" video_loop="yes...

ios - Get word under tap from UIWebView using JavaScript -

i'm displaying local web content , word under tap point. single tap delegate setup , can work great if use uitextview , load html nsattributedstring , nshtmltextdocumenttype, lose formatting such paragraph spacing , small caps; adding nsmutableparagraphstyle without effect. using uiwebview , loadhtmlstring includes jquery, there way? there several pages show how use js word under cursor, such following: how word under cursor using javascript? how word under cursor? get word under mouse pointer is possible word under mouse cursor in `<textarea>`? how word under cursor? but after several days, i've been unable work. code: var jsfile = nsbundle.mainbundle().pathforresource("webview", oftype: "js"); let jsdata = nsstring(contentsoffile:jsfile!, encoding:nsutf8stringencoding, error:nil) as! string let returned = webview.stringbyevaluatingjavascriptfromstring(jsdata)! string println("returned \(returned).") the word unicode dif...

visual studio 2012 - Default SSMS Settings? -

Image
i started internship in i'll working vb (decent experience), asp (decent experience 15 years ago), dynamics nav (never heard of until now), sql server(some db, not setting up) . so, downloaded visual studio express , automatically installed sql server 2012 express because wanted vb. now, i'm trying use ss management studio first time , have no idea of server name is. there no options local connection , network connection computer. tried running sqlcmd -s [server] -d [db_name] -e -q "select @@version" and came slew of errors. have never set kind of database before , i'm @ loss. don't know if running @ moment. checked under control panel->services , there sqlserver vss writer running, need? should uninstall , try reinstalling? appreciate help, i'm warning might have lot of questions......

php - Cannot update textfield based on dropdown list Yii -

i have 3 dependent dropdowns, , textfield being dependent last dropdown. if 1 of value in last dropdown, want textfield value dynamically changes based on selected value (it's same database table). this view of third dropdown: <div class="row" id="id_subkeg"> <?php echo $form->labelex($model, 'id_subkeg'); ?> <?php echo $form->dropdownlist($model, 'id_subkeg', array(), array( 'style' => 'width: 100%', 'ajax' => array( 'type' => 'post', 'url' => ccontroller::createurl('dynamicsatuan'), 'update' => '#' . chtml::activeid($model, 'satuan'), //'update'=>'#seksi', 'data' => array('id_subkeg' =...

ios - Implementing a c function callback in Swift 2.0? -

cfreadstreamsetclient has c-function callback ( cfreadstreamclientcallback ) in it's initializer, cfreadstreamclientcallback looks this: typealias cfreadstreamclientcallback = (cfreadstream!, cfstreameventtype, unsafemutablepointer<void>) -> void i have method attempts handle cfreadstreamclientcallback c-function callback: func callback(stream: cfreadstreamref, eventtype: cfstreameventtype, inclientinfo: unsafemutablepointer<void>) { } but when attempt set callback in cfreadstreamcallback follows, doesn't compile. cfreadstreamsetclient(stream, registeredevents, callback, clientcontextptr) i know swift 2.0 there's way use swift closures c-function callbacks cant seem work. know how can done in situation? you can make closure in function this: cfreadstreamsetclient(stream, registeredevents, { readstream, event, data -> void in // stuff here. }, clientcontextptr) also note c function blocks ...

javascript - Why the slider plugin show before it is ready to generate? -

Image
i use jquery slider plugin "slippry" : http://slippry.com/ i followed tutorial , write this: $(document).ready(function () { $('#item').slippry(); }); </script> and html <ul id="item"> <?php foreach ($banner_list $key => $banner) { echo "<li>"; echo "<a href='#slide'" . $key . "><img src='" . site_url("banner/" . $banner["image_url"]) . "'></a>"; echo "</li>"; } ?> </ul> the problem , there second slider show when not ready. and in second , generated , show this also , if press f5 not have problem (perharps cached?) when press enter @ address bar enter page again has same problem again. how fix problem ? thanks try $(document).ready(fun...

javascript - Dropdown changing value when selected -

i have 5 cities (phil, germany, usa, china , russia) , 5 cities stored database , have 5 dropdown having 5 cities there values. what want happened this, if user select germany on dropdown 1, germany value on other dropdowns shouldn't exist anymore. meaning, germany remove automatically on options of other dropdown. can know's how make possible on codeigniter? at moment have initial code http://screencast.com/t/edtzfhjmon is there's need use jquery or javascript make happened? thanks i recommend having 5 of dropdowns generated, , disable first. way people must answer in order . when first selected, run code, , re-enable next select , remove appropriate option remaining. <select id="dropone" class="countries"> <option class=".germany">germany</germany> <option class=".phil">phil</germany> <option class=".usa">usa</germany> <option class=...

ios - [__NSArrayI length]: unrecognized selector sent to instance when moving through views -

this question has answer here: how can debug 'unrecognized selector sent instance' error 10 answers i have encountered error when click on label @ master view leads detail view (which should show labels displayed in data model @ reasonlibrary. my code: master view controller header @interface masterviewcontroller : uiviewcontroller @property (strong, nonatomic) iboutletcollection(uilabel) nsarray *reasonlabelviews; @end master view controller implementation #import "masterviewcontroller.h" #import "detailviewcontroller.h" #import "reasons.h" @interface masterviewcontroller () @end @implementation masterviewcontroller - (void)viewdidload { [super viewdidload]; (nsuinteger index = 0; index < self.reasonlabelviews.count; index++) { reasons *reason = [[reasons alloc] initwithindex:index]; ...

How to determine if a .NET DLL is an interop assembly? -

Image
i converting existing project use nuget packages dependencies. 1 part of building nuget packages correctly set reference properties if assembly interop assembly (i.e., set embedinteroptypes false). problem there lot of assemblies aren't either regular .net assembly or interop assembly. there way determine, purely assembly, if interop assembly? if imported com typelib, assembly should marked importedfromtypelibattribute , displayed here output ildasm :

java - How to generate test-output folder from testng tests? -

Image
how generate test-output folder testng test? i trying default testng report, index.html netbeans7/windows7 i made simple testng test case, ran in netbeans 7, , here result. see no test-output. displaying project , file structure. if need ant or maven, please describe detailed steps how proceed on windows 7 -- new both of tools. if need build.xml, please give explicit, detailed steps edit: here screenshot of final netbeans layout, including testsuite.xml file got results folder generate: by default report files (html & xml) written folder named test-output under workspace. netbeans overrides location. places output build/test/results folder. please re-run testng test suite , watch results folder. required files generated there. if want tinker output location open file nbproject/project.properties under project folder. in file there property called build.test.results.dir gets passed argument ant task testng run. not think need edit netbeans ge...

ios - Setting initial height for constraint-animated UIView -

Image
i want animate view (the green 1 in screenshots) it's bottom height defined proximity top layout guide. plan animate vertical distance constraint (top of green box top layout guide), so: here's code: - (ibaction)upbutton:(uibutton *)sender { self.animatedheightconstraint.constant = 20; [uiview animatewithduration:0.5 animations:^{ [self.view layoutifneeded]; } completion:nil]; } fine, works. however, scheme doesn't take account starting height of view, want small, zero. since @ point i'm relying on constant set in storyboard set starting height, constant can number, depending on device. i need positive method set initial, device-independent starting point top of green uiview. my first thought set height constraint, compiler detects conflict, , corrects breaking restraint. my second thought, although seems pretty clumsy, set both constraints, remove vertical constraint @ runti...

windows installer - Wix Toolset - Is there a way to set a property based on RadioButtonGroup value within the control? -

what i'd set, or alternatively unset, property (create_user) based on selected radiobutton within radiobuttongroup control. possible? note: example below not work me. # placed under fragment tag <property id="sql_user_type" value="existingsqluser" /> # placed under dialog tag <control id="sqlusertype" type="radiobuttongroup" x="40" y="134" width="210" height="15" property="sql_user_type"> <radiobuttongroup property="sql_user_type"> <radiobutton value="newsqluser" x="90" y="0" width="80" height="15" text="!(loc.tenantdbconnectdlg_createnewuser)" /> <radiobutton value="existingsqluser" x="0" y="0" width="80" height="15" text="!(loc.tenantdbconnectdlg_useexistinguser)" /> </radiobuttongroup> <...

javascript - Change site depending on user agent -

i change things on site depending on user agent. want change text , url of download button when user on ubuntu/linux, arch/linux, debian-based/linux, mac os x, or windows are presented info , download button reverent them. kinda libreoffice does. i in javascript , not on server. thanks in advance. you can use conditional on these variables apply appropriate changes site's styles or dom.

Mysql Merge 2 Columns in table but prefer first column value over second -

i have 2 column in database like: omi | iut | final ------------------------------------------------ 98234 | | | v3455 | 09876 | v5537 | i have column "final" empty , want merge these 2 column in third column like" omi | iut | final ------------------------------------------------ 98234 | | 98234 | v3455 | v3455 09876 | v5537 | 09876 so if omi empty .. take iut value if iut empty .. take omi value if both have values, take omi value any help? update tablename set final=if(omi='',iut,omi);

objective c - Second Screen display rotated 90 degrees in iOS 8.3 & 8.4 -

my question less of how fix issue , more of why happening: starting in ios 8.3, when displaying videos on second screen (through either airplay or lightning -> hdmi) screen rotated 90º. isn't problem on previous versions of ios or when app launched in portrait instead of landscape. i've created workaround checking ios version , screen rotation , rotating view second window. in case else has problem, here's solution: if ([[uidevice currentdevice].systemversion floatvalue] >= 8.3f) { cgfloat width = (_externalwindow.frame.size.width > _externalwindow.frame.size.height) ? _externalwindow.frame.size.width : _externalwindow.frame.size.height; cgfloat height = (_externalwindow.frame.size.width < _externalwindow.frame.size.height) ? _externalwindow.frame.size.width : _externalwindow.frame.size.height; cgrect rotatedframe = cgrectmake(0.0f, 0.0f, width, height); _externalwindow.frame = rotatedframe; if ([uidevice currentdevice].orientation...

c# - want to access data from text box in the form which is in another solution in visual studio 2013? -

i have 2 solutions tranferservice , sender. tranferservice has wcf service , iishost host service. in sender solution have windows forms application. in form used button browse , select file, text box display selected file path, , button(send) transfer file through wcf service. unable access textbox value in transfer solution. shows"the name not exist in current context". code transferservice using system; using system.collections.generic; using system.linq; using system.runtime.serialization; using system.servicemodel; using system.text; namespace transferservice { // note: can use "rename" command on "refactor" menu change class name "transferservice" in both code , config file together. public class transferservice : itransferservice { public file downloaddocument() { file file = new file(); string path = txtselectfilepath.text; file.content = system.io.file.readallbytes(@path); //file.name = ...

jquery - Transition End Fallback for ie9 -

i'm using following code jquery trigger events on transitionend , avoid multiple callback/support multiple browsers: function whichtransitionevent(){ var t; var el = document.createelement('fakeelement'); var transitions = { 'transition':'transitionend', 'otransition':'otransitionend', 'moztransition':'transitionend', 'webkittransition':'webkittransitionend' } for(t in transitions){ if( el.style[t] !== undefined ){ return transitions[t]; } } } (code found here: http://davidwalsh.name/css-animation-callback ) however, seems ie9 doesn't support transitionend regardless of prefix/syntax. how set fallback ie9 when i'm using in scenario following (to remove loading screen dom after animation complete)? $('#loading').one(transitionevent, function(event) { $('#loading').remove(); }); i've seen s...

How do I customize WordPress's wp_nav_menu function -

i'm working on wordpress site , top nav generated by: <?php wp_nav_menu(array('container_class' => 'nav', 'sort_column' => 'menu_order', 'theme_location' => 'top_nav')); ?> and picks nav items defined list in wp_admin. thing is, want each item have extra, conditional, css on it. specifically, 1) on hover, want text color up, same-colored line appear. 2) when i'm in area (determined slug) want menu item stay colored. i.e.: active 3) each of menu items have different colors - it's not universal across nav. obviously, css behind simple. question how keep "black box" aspect of using wp_nav_menu() still able put conditional code in nav. is possible? thanks! using wp_nav_menu() : custom walker can customized own way menu item example: https://wordpress.stackexchange.com/questions/14037/menu-items-description-custom-walker-for-wp-nav-menu

c# - ObjectHandle unwrap gives me a MarshalbyRefObject object instead of my class object -

i'm trying load assembly in appdomain , seems problem objecthandle. assembly contains 1 class: namespace mytestassembly { using system; public class someclass : marshalbyrefobject { public virtual bool run() { return true; } } and in assembly b try invoke class this: var assembly_path = "/path/to/something.dll" system.appdomain appdomain = system.appdomain.createdomain("mydomain"); system.runtime.remoting.objecthandle oh = appdomain.createinstancefrom(assembly_path, "mytestassembly.someclass"); object obj = oh.unwrap(); obj.gettype().invokemember("run", system.reflection.bindingflags.invokemethod, type.defaultbinder, obj, null); appdomain.unload(appdomain); this gives me exception: an exception of type 'system.missingmethodexception' occurred in mscorlib.dll not handled in user code addition...

SQL Server Check Like Constraint for letters and numbers, and a trigger -

i'm creating simple constraint on table's column accepts 3 capital letters first 3 letters, dash "-" , 6 numbers follow. far inserts have been rejected because of it: my constraint: alter table equipos add constraint nombre check (idenlace like('[a-z][a-z][a-z]-[0-9][0-9][0-9][0-9][0-9][0-9]')) go trigger caps: create trigger tr_upper_nombre on equipos instead of insert begin insert equipos select upper(i.codequipo),i.marcaequipo,i.fchequipo,i.vtoequipo,i.idenlace inserted end go edit: example of should valid: 'jhs-929323' something should invalid 'jhs-929323' 'jhs-99323' 'jhs929323' i think constraint wrong. comes after isn't being validated. suggestions who's done similar before? create constraint this.... alter table equipos add constraint nombre check ( left(idenlace,3) = upper(left(idenlace,3)) collate latin1_general_cs_ai , substring(idenlace,4,1) = '-...

Hints on migrating GWT to AngularJS -

with end of development plugin, fun has gone out of gwt development. every small change triggers endless recompilation , i'm still debugging half java half javascript in browser. i'm thinking migrating angularjs. hints on how approach this? should first switch rpc servlets webservices returning json? i'm using gxt grids. how best replace these? are using super dev mode? makes development lot better use browser dev tools debug , makes use of source maps. in opinion, has made gwt relevant again. do backend first converting rpc servlets equivalent rest interface. can use front-end mvc framework - angular, native mobile, or whatever. for gxt grids, angularui has grid component. http://ui-grid.info/ . use extjs grids.

scala - Spark Runtime Error - ClassDefNotFound: SparkConf -

after installing , building apache spark (albeit quite few warnings), compilation of our spark application (using "sbt package") completes successfully. however, when trying run our application using spark-submit script, runtime error results states sparkconf class definition not found. sparkconf.scala file present on our system, seems if not being built correctly. ideas on how solve this? user@compname:~/documents/testapp$ /opt/spark/spark-1.4.0/bin/spark-submit --master local[4] --jars /opt/spark/spark-1.4.0/jars/elasticsearch-hadoop-2.1.0.beta2.jar target/scala-2.11/sparkesingest_2.11-1.0.0.jar ~/desktop/csv/data.csv es-index localhost warning: local jar /opt/spark/spark-1.4.0/jars/elasticsearch-hadoop-2.1.0.beta2.jar not exist, skipping. log4j:warn no appenders found logger (app). log4j:warn please initialize log4j system properly. log4j:warn see http://logging.apache.org/log4j/1.2/faq.html#noconfig more info. using spark's default log4j profile: org/apache/spar...

puppet - How to order resources to be used inside create_resources? -

i have create resource like files_list = { '/a': {ensure => 'file'}, '/a/b': {ensure => 'link', target => '/d/e', require[file['/a']]} } create_resources(file, files_list) it gives error, dependency file['/a'] not found. first, should require => file[/a] , same syntax usual. second, ensuring /a file, not directory. means creating symlink @ /a/b fail, since not directory. finally, not need specify dependency @ all, since puppet handles auto-requiring parent directories. in other words, file /a/b/c automatically require both /a , /a/b if declared.

java - Longitude and Latitude showing 0.0 -

when click button shows latitude , longitude of 0.0. ideas why? followed online tutorial. if there better way current location of user please let me know , sure it. p.s. not have knowledge in java , android. thanks everyone. issue fact did not have permissions in correct area. help! package com.example.android.getgpslocation; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; import android.widget.textview; public class mainactivity extends actionbaractivity { button btnshowlocation; gpstracker gps; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); btnshowlocation= (button) findviewbyid(r.id.show_location); btnshowlocation.setonclicklistener(new view.onclicklistener() { @override ...

scala - Using fold on Option without having x => x -

given: val personsopt:option[list[person]] = ??? i prefer: persons = personsopt.fold(list[person]()){person => person} to this: persons = personsopt.getorelse(list[person]()) for type safety reasons. example not compile: persons = personsopt.fold(nil){person => person} is there simple way type safety not have {person => person} ? edit: 2 things concretely understood: there nothing un-type-safe getorelse . instance not compile: personsopt.getorelse("") nil list() , if type can't inferred compiler ask explicit. there can no type issues using nil i couldn't find link now, did (incorrectly) read getorelse somehow less type safe using fold option . there function identity defined in predef : persons = personsopt.fold(list[person]())(identity) i find lot less readable using getorelse , , using not make code more type-safe using getorelse . note passing nil getorelse make return correct type: scala> case cl...

c - looking for numbers in a character array -

i'm writing program reads lines file need print out numbers, lines read stored in character array: char line[255]; //code read line file here (c=0;c<256;c++) { if (line[c]<58 && line[c]>47) printf("the character is: %c\n",line[c]); } the configuration file has following lines: buttons 3 the result i'd the character 3 , instead 3,9,4,4 hope i've provided sufficient information. thanks your if-statement wrong. you can express clearer, , more correctly as: if ('0' <= line[c] && line[c] <= '9') { printf("the character is: %c\n",line[c]); } your loop runs 256 characters, though input of "buttons" has 7 characters. you're running off memory not yours, , finding 9, 4, 4, there random chance. you want: for (int c=0; c < 256; ++c) { if (line[c] == '\0') // if end of input found, stop loop. { break; } if ('0' ...

android - CollapsingToolbarLayout crash -

i have recyclerview triggers collapsingtoolbarlayout , when try , reopen collapsed toolbar on 4.2.2 crash below. ideas? java.lang.illegalargumentexception: width , height must > 0 @ android.graphics.bitmap.createbitmap(bitmap.java:638) @ android.graphics.bitmap.createbitmap(bitmap.java:620) @ android.support.design.widget.collapsingtexthelper.ensureexpandedtexture(collapsingtexthelper.java:405) @ android.support.design.widget.collapsingtexthelper.setinterpolatedtextsize(collapsingtexthelper.java:382) @ android.support.design.widget.collapsingtexthelper.calculateoffsets(collapsingtexthelper.java:227) @ android.support.design.widget.collapsingtexthelper.setexpansionfraction(collapsingtexthelper.java:203) @ android.support.design.widget.collapsingtoolbarlayout$offsetupdatelistener.onoffsetchanged(collapsingtoolbarlayout.java:754) @ android.support.design.widget.appbarlayout$behavior.dispatchoffsetupdates(appbarlayout...

css - Shift div upward to fill empty space in Bootstrap 3 layout -

i have bootstrap layout reorders way want when goes 1-column @ smallest media query size of xs : [a] [b] [img] [c] [d] [e] at higher screen sizes, want this: [a][img] [b][e] [c] [d] instead, looks this: [a] [b][img] [c] [d][e] here's demo . how can make image , div on right "float" upward fill empty space? then should put columns in order. like this: [a], [img], [b], [e], [c], [d] your current order is: [a], [b], [img], [c], [d], [e] see updated codepen . i aware mobile layout in different order, cannot rearrange dom elements css

php - multidimensional array, leafs as keys with parent. Recursive iterator -

hello need change structure of multidimensional array parents contains children data children holds info parents $tab = [ 'movies' => [ 'action', 'drama', 'comedy' => [ 'romance' => ['90th'], 'boring' ] ], 'colors' => [ 'red'=>'light', 'green'=> [ 'dark', 'light' ], 'oragne' ] ]; transfer to $tab = [ '90th' => [ 'romance' => [ 'comedy' => 'movies' ] ], 'boring' => [ 'comedy' => 'movies' ], 'comedy' => 'movies', 'drama' => 'movies', ...

c# - Handling similar checkbox values in .NET Web App -

list<char> errorlist = new list<char>(); if (meetingerrorcheckbox.checked) errorlist.add('m'); if (scheduledmachinedowntimecheckbox.checked) errorlist.add('s'); if (toolingcheckbox.checked) errorlist.add('t'); if (processissuecheckbox.checked) errorlist.add('p'); if (operatormaintenancecheckbox.checked) errorlist.add('o'); if (vactioncheckbox.checked) errorlist.add('v'); if (cellleadcheckbox.checked) errorlist.add('c'); if (waittoolscheckbox.checked) errorlist.add('w'); if (unscheduledmaintenancecheckbox.checked) errorlist.add('u'); if (waitmaterialcheckbox.checked) errorlist.add('a'); if (waitinspectioncheckbox.checked) errorlist.add('i'); if(alternatedepartm...