Posts

Showing posts from May, 2014

android.widget.ImageView cannot be cast to android.widget.CheckBox -

my code crashing , giving error image view cannot cast checkbok. source code shown below. pl me figure out pblm package com.example.application1; import android.content.context; import android.content.intent; import android.content.res.resources; import android.database.cursor; import android.graphics.bitmap; import android.os.bundle; import android.provider.mediastore; import android.provider.mediastore.images.media; import android.util.sparsebooleanarray; import android.view.layoutinflater; import android.view.view; import android.view.window; import android.view.view.onclicklistener; import android.view.viewgroup; import android.view.animation.animation; import android.view.animation.animationutils; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.baseadapter; import android.widget.button; import android.widget.checkbox; import android.widget.compoundbutton; import android.widget.compoundbutton.oncheckedchangelis

Count number of groups present in column using SQL Server 2008 -

i have table shown below: create table test ( cola varchar(10) ) inserting data: insert test values('a'); insert test values('a'); insert test values('a'); insert test values('b'); insert test values('b'); insert test values('c'); insert test values('d'); insert test values('d'); i want show how many groups present in column cola expected result: totalgroups b c d -------------------------------- 4 3 2 1 2 try this, removing [ , ] avoid sql injections: declare @sql varchar(max) = 'select (select count(distinct cola) test) totalgroups' select @sql += ',' +cast(count(*) varchar(10)) + '['+ replace(replace(cola, ']', ''), '[', '') + ']' test group cola order cola exec(@sql) result: total_groups b c d 4 3 2 1 2

enthought - speed up ifftn calculation in python -

i working on python program (in enthought canopy) calculate 2 point autocorrelation function 2 , 3 dimensional images. the core of calculation following code: fftx = fftn(newimpad) del newimpad ret_int = (fftx * np.conjugate(fftx)) del fftx ret = ifftn(ret_int) ret = fftshift(ret) where newimpad padded image. this works. however, transform (the ifftn step) slow - large images have been working on in 2d takes on 90 seconds. there way speed up?

How to hide a div if no checkbox is selected jQuery -

if no checkbox selected, how .slideup parent div? if ($("input:checkbox:not(:checked)")) { $("#parentofparentdiv").slideup(); // should slide entire parent div if none selected, doesnt work } else { $("input:checkbox:not(:checked)").closest('div').slideup(); //this should slideup divs not checked, works } you need this: if (!$(":checkbox").is(":checked")) { $("#parentofparentdiv").slideup(); } else { $("input:checkbox:not(:checked)").closest('div').slideup(); }

java - get user input assign it to String -

is possible assign user-input string? same way assign double: scanner s = new scanner(system.in); system.out.println("enter here value of x: "); double x = s.nextdouble(); and possible make jframe, , name jframe string, in eclipse if ask title jframe, can enter console, , jframe name change(or have update frame, if so, how?) i beginner please keep simple possible(i netherlands sorry bad englisch). just read docs of scanner class. state there 3 methods return string s user input: next(): string next(pattern pattern): string next(string pattern): string nextline(): string

c# - How to add delays in thread-safe manner (TcpClient) -

i'm creating project read in list of emails , using external libraries, mx records domain, , use telnet determine whether or not email exists. i have managed make work far - due how fast code runs, believe i'm attempting read server's response quicker being sent. (i assume this, code return empty strings when run without debugging, breakpoints returns fine.) to counter-act added thread.sleep() in areas around code wait response, works locks thread , stops responding several minutes. how able perform task without locking ui? here code class issue - class telnetconnection { tcpclient tcpclient; list<char> reply; public telnetconnection(string hostname, int port) { tcpclient = new tcpclient(); tcpclient.beginconnect(hostname, port, null, null); thread.sleep(2000); } public list<char> getreply() { reply = new list<char>(); stringbuilder sb = new stringbuilder(); while (

ios - NSFetchController fetch with other predicate when 1ste one fails -

i'm having fetchrequest. need "tracked" points database when there no tracked points need retrieved. how can that? set predicate on fetchcontroller when doesn't find tracked points doesn't show anything. can hook on , retrieve everything... is there way listen there nothing found or how done? edit: - (nsfetchedresultscontroller *)fetchedresultscontroller { if (_fetchedresultscontroller != nil) { return _fetchedresultscontroller; } nsfetchrequest *fetchrequest = [[nsfetchrequest alloc] init]; nsentitydescription *entity = [nsentitydescription entityforname:@"rank" inmanagedobjectcontext:[nsmanagedobjectcontext mr_defaultcontext]]; [fetchrequest setentity:entity]; /* nspredicate *predicate = [nspredicate predicatewithformat:@"name == %@", @"auto"]; [fetchrequest setpredicate:predicate];*/ nssortdescriptor *sort = [[nssortdescriptor alloc] initwithkey:@"name" ascending:no];

excel - What is wrong with this query? i am using vb script to insert data to access database -

i trying insert data microsoft access database these queries wrong seems. whenever run query syntax error near insert statements. following queries; can 1 tell me correct syntax? first query : strst = "use employee_data insert employee_data (loginid,fname,lname,number) values (""" & user & """,""" & firstname & """,""" & lastname & """, """ & phonenumber & """)" second query : strst = "use employee_data insert employee_data (loginid,fname,lname,number) values (""user"", ""firstname"", ""lastname"", ""phonenumber"")" third query : dbs.execute " insert employees " _ & "(userid, fname, lname, number) values " _ & "(user, firstname, lastname, phonenumber);" fourth query : str

java - Method to calculate the upcoming birthdays in next N days -

i need method takes integer input (n) , returns birthdays in next n days. finding difficult code running. below code of how want work - in no means working code. highly appreciated. /* print out birthdays in next n days */ public void show( int n){ calendar cal = calendar.getinstance(); date today = cal.gettime(); // birthdaylist list containing list // of birthdays format: 12/10/1964 (mm/dd/yyyy) for(int = 0; i<birthdaylist.getsize(); i++){ if(birthdaylist[i].gettime()- today.gettime()/(1000 * 60 * 60 * 24) == n)){ system.out.println(birthdaylist[i]); } } } calendar calendar = calendar.getinstance(locale.english); calendar.settime(new date()); calendar.add(calendar.date, n); // n number of days upto calculated date futuredate = calendar.gettime(); list<string> listofdates = returnlistofdatesbetweentwodates(new date() , futuredate); where p

c# - Foolproof MVC 5 deppending validation -

grettings friends... so have set of checkboxes set in model: [displayname("páginas consultadas")] public list<checkboxes> paginasconsultadas { get; set; } and have fieldtext ("paraqueusaestaspag") required if of checkboxes checked... [displayname("¿para que usa esta(s) página(s)?")] public string paraqueusaestaspag { get; set; } and part of view: <div class="col-lg-4" id="divpagconsultadas"> <span>@html.labelfor(model => model.paginasconsultadas, @html.displaynamefor(model => model.paginasconsultadas))</span> @{ (int = 0; < model.paginasconsultadas.count(); i++) { <div class="checkbox"> <label> @html.checkboxfor(model => model.paginasconsultadas[i].valorcheckbox) @model.paginasconsultadas[i].nombrecheckbox </label> </div> @html.hiddenfor(mod

reporting services - Security on report server URL for SSRS -

i have report takes department_id parameter. users can see report of own department problem can access below url , view other department's report. http://<server>/reports or http://<server>/reportserver?/<foldername>/report&department_id=5 is there way make these urls secure authorized users can access it? or option not available in ssrs , have block access through firewall or something? disallowing access url ips , allow web server ip access , make page in asp.net in show report using report viewer?

vim - expression to transform unicode codepoint to character -

i've got file has escaped unicode in it: blah blah blah \u2192 blah blah blah i'd transform unicode escapes actual characters search/replace: :%s/\\u\(\d\{4}\)/\=codepointtocharacter(submatch(1))/g though know how transform codepoint character in insert mode ( ctrl-v u 2192 →), don't know how transformation in viml expression. do need write custom function, or there builtin or plugin can use? you can first use str2nr() convert number hex, use nr2char display char. extend command little bit: %s/\\u\(\x\{4}\)/\=nr2char(str2nr(submatch(1),16))/g

nfc - Is it possible to send APDUs to an HCE service from Android userland? -

i apologize in advance if question sounds stupid, i'm not developer , answer might obvious (but not me @ least…). i'm interested in possibilities of relatively new host card emulation introduced in android kit-kat. with former secure-element-based nfc applications, possible exchange apdus applet hosted in se either through nfc controller or "contact" interface (the socket between chip , phone). the latter enables communication between se , application running in android userland (which can act proxy remote server). authorization application communicate applet granted based on kind of hash of application had "injected" beforehand in se — far know security mechanism part of global platform specifications. i have doubt regarding similar possibility hce since read this section in google documentation: the hce architecture provides 1 core piece of security: because service protected bind_nfc_service system permission, os can bind , communicate s

Drupal 7 - Add a wrapper around related nodes on Taxonomy term page -

on taxonomy term page, taxonomy term info shown first, followed related nodes. want add wrapper div around related nodes (ex. class="related-nodes"). taxonomy-terms.tpl.php controls display of taxonomy term's fields, i'm not sure how nodes show up. thinking making node template taxonomy , doing render($content['nodes']). however, i'm not sure $content key related nodes. one approach enable taxonomy term view display (is disabled default). in view config, can add classes clicking in settings of format option. hope helps. regards.

database - Which SQL Server 2008 data type should be used for image and text data? -

i have table in sqlserver, , 1 of fields expecting rather mixed data; receive text value, let's sake of argument: ascii art picture of cat poorly spelt caption then contain actual jpeg contains images of cats poorly spelt captions. what's best datatype use in instance? big, long, object. we can assume ascii art pictures small, 16 chars x 16 chars. store them in varchar(256) field, @ least if wasn't pesky big 2mb jpegs people send. additional bit semantically, can both of these images of cats, albeit in different formats. question guess i'm asking if there appropriate datatype handle values semantically same thing, come in different forms. additional bit #2 in case, amount of data our cat varies wildly. cat caption image small, , need ~256bytes of information stored. large, if plaintext ascii cat image, might take ~256megabytes, can shove in jpeg , takes 2megabytes. yay, moar cat images can stored on our harddrive! naturally, not want convert ~256byte

apache pig - Reuse Pig Groups in nested FOREACH statement -

i'm trying group records together, calculate average of score1, filter out lower half of scores, , compute average of score2. can calculate summary statistics, , rejoin them original dataset, i'd prefer use intermediate grouped values. example input id,groupby,score1,score2 1,a,58.8,67.3 2,a,85.2,76.3 3,b,49.1,90.7 4,b,78.3,99.8 pig script records = load 'example.csv' using pigstorage(',') (id,groupby,score1,score2); grouped = group records groupby; avgscore = foreach grouped generate group groupby, avg(records.score1) avgscore; joined = join grouped group, avgscore groupby using 'replicated'; results = foreach joined { scores = foreach records generate score1,score2; low = filter scores score1 < avgscore.avgscore; generate groupby, avg(low.score2); }; dump results; desired output a 67.3 b 90.7 however gives me result of java.lang.exception: org.apache.pig.backend.executionengine.execexception: error 0: scalar has m

Androidplot - creating chart without XML -

i need create piecharts on activity, , quantity of charts varies. try create piechart dynamically code, , it's doesn't work. layout correct - button added successfully. can me? code: layout: <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:context="example.bros.nik.tabs1.mealsactivity" android:layout_width="wrap_content" android:layout_height="wrap_content"> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/l_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin

c# - Passing an object to a collection editor -

i'm trying build check list toolstripmenuitem automatically handles checking , unchecking of item , provide event programmer allowing them handle happens next. if exists, love know is. i've created collection editor custom toolstripmenuitem , can add check lists collection of checklists. problem create collection editor this: [designerserializationvisibility(designerserializationvisibility.content), editor(typeof(toolstripitemextcollectioneditor), typeof(uitypeeditor))] i need able pass toolstripmenuitem 's dropdownitems collection editor when add new checklist , click on items property of checklist can add/remove 1 of known toolstripmenuitems to/from checklist. passing reference won't work since of happening inside attribute , wouldn't know begin if answer reflection. this answer applies vb.net. plan on turning c# dll, it's in vb.net because that's started idea , language project in. here's have far: toolstripmenuitemext purp

hibernate - Any idea why H2 parser throws an exception at Oracle SQL statement "Syntax error in SQL statement "SELECT SUBJECT_SEQ.NEXTVAL FROM[*] DUAL"? -

i've following error when injecting entitymanager: caused by: org.hibernate.exception.sqlgrammarexception: not prepare statement @ org.hibernate.exception.internal.sqlstateconversiondelegate.convert (sqlstateconversiondelegate.java:123) [hibernate-core-4.3.5.final.jar:4.3.5.final] @ org.hibernate.exception.internal.standardsqlexceptionconverter.convert (standardsqlexceptionconverter.java:49) [hibernate-core-4.3.5.final.jar:4.3.5.final] caused by: org.h2.jdbc.jdbcsqlexception: syntax error in sql statement "select subject_seq.nextval from[*] dual "; expected "identifier"; sql statement: select subject_seq.nextval dual [42001-173] @ org.h2.message.dbexception.getjdbcsqlexception(dbexception.java:331) @ org.h2.message.dbexception.get(dbexception.java:171) @ org.h2.message.dbexception.getsyntaxerror(dbexception.java:196) @ org.h2.command.parser.readcolumnidentifier(parser.java:2846) @ org.h2.command.parser.readtermobjectdot(parse

build - Ant to delete subdirectories and files in subdirectories but not any file from the directory itself -

my requirement delete subdirectories specified directory, not delete files in specified directory. i have fussed around fileset , dirset , not single collection job. works this: <delete includeemptydirs="true" verbose="true" > <fileset dir="release/reports" > <exclude name="*.*" /> </fileset> <dirset dir="release/reports" includes="**/*" /> </delete> isn't there way 1 collection (either fileset or dirset)? it should work : <delete includeemptydirs="true"> <fileset dir="c:/yourdir" includes="**/*" excludes="*.*"/> </delete>

Using AngularJS dependency inside a template -

i set max-height of div $window.innerheight . following code fails: <div ng-style="{'max-height': $window.innerheight}" style="overflow-y: auto"> my walk-around use scope variable: $scope.divnheight = $window.innerheight; <div ng-style="{'max-height': divheight}" style="overflow-y: auto"> is there way achieve ng-style $window binding? thanks you're missing 'px' in ng-style see plunker: http://plnkr.co/edit/eqkz9wgyzm8loz6pzan0?p=preview to answer question, no... variable wish use in html must scope variable. if window height changing, can use watcher bind variable window height: $scope.$watch(function(){ return $window.innerheight; // thing watch }, function(newvalue, oldvalue) { // function run when value changes console.log(newvalue); $scope.divnheight = $window.innerheight; }); update: try adding controller, registers function fire when resize: window.onr

java - Strange JaxB-Behavior when (un)marshaling XMLGregorianCalender -

the main class: public class checkjaxbbehavior { private string xml = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?><date day=\"---10+02:00\" month=\"--09--+02:00\" year=\"2014+02:00\"/>"; public datetype unmarshal() throws exception { bytearrayinputstream input = new bytearrayinputstream(xml.getbytes()); jaxbcontext jaxbcontext = jaxbcontext.newinstance(datetype.class); unmarshaller jaxbunmarshaller = jaxbcontext.createunmarshaller(); datetype date = (datetype) jaxbunmarshaller.unmarshal(input); return date; } private static xmlgregoriancalendar createxmlgregoriandate(date date) throws exception { gregoriancalendar gregoriancalendar = new gregoriancalendar(); gregoriancalendar.settime(date); xmlgregoriancalendar xmlgregoriancalendar = datatypefactory.newinstance().newxmlgregoriancalendar

smalltalk - How to undo > 1 in Squeak -

how undo in squeak more 1 time? using coglinux-vm, squeak-image 4.5 squeak source version 41. i wrote test code in workspace window , want undo more steps, squeak won't it. support multiple undo has been dropped in 2009 when integrating texteditor cuis. findable in morphic package history (or @ http://source.squeak.org/trunk/morphic-ar.149.diff ) cuis fork of squeak aiming @ simpler code in general, , particularly simpler morphic (all code must understandable single programmer yet remain powerfull), see http://www.jvuletich.org/cuis/index.html . it sounds main usage of texteditor in browser, , methods short enough not require multiple undo... @ least there no complaints until then, , guess drop un-noticed. possible might have been accidental rather deliberate... however, object used storing multiple undo history still there (editcommand) , there preferences (multipletextundo) unsent restored... it exercize see how hard/easy restoring feature be. start trackin

javascript - Alphabetically sorting a backbone collection using a key -

i have collection needs sorted on particular key ('display'), know backbone has default comparator not defined default, @ loss of how implement it var listcollection = new backbone.collection(rebuiltarray.map(function(text){ return { attribute: text, displaynames: displaynames[text] }; })); thanks in advance help try following var listcollection = backbone.collection.extend({ comparator: 'displaynames' }); var listcollection = new listcollection(rebuiltarray.map(function(text){ return { attribute: text, displaynames: displaynames[text] }; }));

css3 - Show Css Transition on hover -

i trying make bootstrap menu dropdown transition opacity, im close not working quite right have looked lots of examples , have come with: http://jsfiddle.net/studentrik/o642hw2e/ i dropdown appear when hover on a tag, appears when @ bottom of a tag due position how make work? give try. li.dropdown > .dropdown-menu{ display: block; position: absolute; top: 17px; left: 0; } li.dropdown > .dropdown-menu{ opacity: 0; transition: opacity .5s ease-in-out; } li.dropdown:hover > .dropdown-menu{ opacity: 1; }

r - Impute missing values with the average of the remainder -

i have data frame of form: weight day hour na m 0 na m 1 2 m 2 1 m 3 4 t 0 5 t 1 na t 2 2 t 3 3 w 0 3 w 1 1 w 2 na w 3 for given na value in weight , want replace average of non-na values having same value hour . example, first value in weight na. hour value 0, want average other weights hour 0 (those values being 4 , 3). want replace na computed average (3.5). as r beginner, i'd see clear, multistep process this. (i'm posing learning exercise rather specific "solve problem" type question. i'm not interested in can in fewest characters.) you can use ave such operations. dat$weight <- ave(dat$weight,dat$hour,fun=function(x){ mm <- mean(x,na.rm=true) ifelse(is.na(x),mm,x) }) you apply function group of hours. for each group compute mean wuthout missing values. you assign mean if val

Vim write temporary info as :write does -

i have macro calls function defined in vimrc :function! dostuff() :!mycommand :end map <c-p>i :call dostuff()<cr> when press macro keys right shell output of mycommand , works fine improve that. i noticed when write file (:w) short message displayed short time in command bar says "file x written", want achieve same result, when macro sequence pressed want check if command went fine (checking return code) , display message (such "ok" or "not okay") :write command does. any ideas ? write external command output temporary file via vimscript functions first, capture output of external command in variable, contents can written (temporary) file via writefile() . :let output = system('mycommand') :call writefile(output, 'path/to/tempfile') via scratch buffer if need apply arbitrary commands captured contents, or need vim handle different file encodings, have use buffer: :new path/to/tempfile :0read !

javascript - Meteor this.params._id is undefined based upon ":_id?" -

i have game know works id per code on client side. example if use below {{game._id}} works properly: template.gamepage.game = function() { return gamecollection.findone({current: true}); }; however, trying gain access publications of 'submissions; specific game id. console log below returns undefined. router.js this.route('gamepage', { path: '/games/:_id?', waiton: function() { console.log(this.params._id); return [ meteor.subscribe('randomquestions', random.id()), meteor.subscribe('submissions', this.params._id) ]; } }); i suspect params._id pulls games/:_id, however, that remains games/:_id? not have unnecessary long address. any thoughts on why getting undefined params._id i think have 1 button access game, example... tracker.autorun(function () { session.set('gamecurrent'); }); template.gamepage.helpers({ allgames: function

jquery - The if statement not working properly in Javascript -

i trying create logic if enters "<p>" , "</p>" characters inside <textarea> , jquery should show win message.i have textarea class html , h2 class result shows win or loss.by now, have code: var html = $('.html').val(); if(html.indexof("</p>" && "<p>") === -1) { document.getelementbyid("result").innerhtml = "you lost it."; } else{ document.getelementbyid("result").innerhtml = "hurray!you won"; } but, code checking if <p> there , not checking </p> .so can do.... the expression "</p>" && "<p>" equivalent "<p>" -- && evaluates each of arguments left right, , returns last truthy argument. since both strings truthy, wrote effectively: if (html.indexof("<p>") === -1) if want test whether string contains 2 substrings, have call indexof separately ea

google compute engine - VM Instance Password Expired -

so, ignored , forgot notice password expire in 2 days. 2 days have passed, , when attempt remote instance, error credentials did not work. way fix this, without needing delete , recreate instance? lesson learned - next time i'll make priority change password reset protocol... p.s. on forum suggested using localhost\ in front of account name, didn't work. open rdp file in notepad, add following line , save it. enablecredsspsupport:i:0 connect server , change expired password.

While loop asking for input until ctrl-d using C -

i want make while loop continually asking user input until user ctrl-d's out of it. how can correctly? using right now: while (1) { printf("enter host name: "); fgets(user_input, 1000, stdin); } this works, except user has hit ctrl-c end program. wanting continually ask user input until he/she hits ctrl-d. how can this? you have test eof, ctrl-d returns. so this: while ( fgets( ... ) != null ) { ... } edit: since you're prompting, better be: for ( ;; ) { printf( "enter input: " ); fflush( null ); // make sure prompt displayed, credit basile starynkevitch if ( fgets( input, ... ) == null ) break; // handle input here }

python - Machine learning for monitoring servers -

i'm looking @ pybrain taking server monitor alarms , determining root cause of problem. i'm happy training using supervised learning , curating training data sets. data structured this: * server type **a** #1 * alarm type 1 * alarm type 2 * server type **a** #2 * alarm type 1 * alarm type 2 * server type **b** #1 * alarm type **99** * alarm type 2 so there n servers, x alarms can up or down . both n , x variable. if server a1 has alarm 1 & 2 down , can service a down on server , cause of problem. if alarm 1 down on servers, can service a cause. there can potentially multiple options cause, straight classification doesn't seem appropriate. i tie later sources of data net. such scripts ping external service. all appropriate alarms may not triggered @ once, due serial service checks, can start 1 server down , server down 5 minutes later. i'm trying basic stuff @ first: from pybrain.tools.shortcuts import buildnetwork pybrai

c# - HttpResponseMessage System.InvalidOperationException -

quite simple problem i've got easy solve reckon brains. it's tried different queries on google , nothing popped hey that's why here. here error: system.invalidoperationexception basically error thrown on piece of code here string test = response.content.headers.getvalues("location").firstordefault(); location in fiddler looks this: location: https://www.redirecturlishere.com/blah here entire function: private async task<string> getrequest() { //httpcontent postcontent = new stringcontent(post, encoding.ascii, "application/x-www-form-urlencoded"); using (httpresponsemessage response = await httpclient.getasync( "http://www.cant-share-url.com")) { using (httpcontent content = response.content) { string test = response.content.headers.getvalues("location").firstordefault(); } } return "";

Java local database -

i creating piece of software using java , eclipse. software freestanding , not require internet connection. the main use of program requires access database. used developing android there inbuilt mysql database in every device. there similar thing java. have looked everywhere , have seen references kind of thing have not seen clear answers. know there jdbc, seems method of controlling database rather creating it. what trying establish is, there pre installed database available use in eclipse without further installation, in same way mysql db available when using android?? the version of java using java.runtime.version=1.7.0_40-b43 and using eclipse kepler service release 2 what trying establish is, there pre installed database available use in eclipse without further installation, in same way mysql db available when using android?? first, android includes sqlite (not mysql). second, no. no there not. use derby or sqlite or h2 (or other pure java database).

php - Laravel 4 Route Level Access -

i need add level access website , code route : route::get('/', array( 'as' => 'home-view', 'uses' => 'homecontroller@viewhome' )); /* authenticated group */ route::group(array('before' => 'auth'), function(){ route::get('/', array( 'as' => 'admin-view', 'uses' => 'admincontroller@viewadmin' )); } /* unauthenticated group */ route::group(array('before' => 'guest'), function(){ route::get('/signin', array( 'as' => 'user-signin-get', 'uses' => 'usercontroller@getsignin' )); } i need add level access "user" or "admin". how can filter route? simple possiple or recommend? you can have many filters single route like. consider this: route::group(array('before' => 'auth|hasadminlevel'), function(){ route

What is the use `-d` in Perl? -

this question has answer here: using -d test operator in perl 3 answers what -d in following piece of code: foreach $filename (@files) { $filepath = $dir.$filename; next if -d $filepath; function1(); } this short form for if (-d $filepath) { next; } where -d $filepath test if $filepath directory. see http://perldoc.perl.org/functions/-x.html full list of file tests.

objective c - NSPredicate to match string with an array of prefixes -

i'm unsure how write nspredicate achieve following. have array of prefixes, , want know if of them (plus underscore) prefix of given string. don't need know matched, yes/no if matched @ all. i can't seem work out, @ moment have this #import <foundation/foundation.h> int main(int argc, char *argv[]) { @autoreleasepool { nsarray *bins = @[@"aaa", @"bbb", @"ccc"]; nsstring* item = @"aaa_blah"; nspredicate *pred = [nspredicate predicatewithformat:@"%@ beginswith self", item]; nslog(@"%@", [[bins filteredarrayusingpredicate:pred] count] ? @"yes" : @"no"); } } the way think of doing filtering array - firstly there better approach? and secondly, want return true if prefix followed underscore so @[@"aaa", @"bbb", @"ccc"]; @"aaa_blah"; // yes @"aaablah"; // no @"bbbblah"; // no i

javascript - entire page moves up when i click menu bottom tag -

the following code works fine error - when click last tag in menu entire page move top how resolve error html <!doctype html> <html lang="en" class="no-js"> <head> <meta charset="utf-8" /> <title>blueprint: vertical icon menu</title> <link rel="shortcut icon" href="../favicon.ico"> <link rel="stylesheet" type="text/css" href="css/leftmenu.css" /> <link rel="stylesheet" type="text/css" href="flaticon.css" /> <style> body {position: relative;font-family: 'lato', calibri, arial, sans-serif; color: #47a3da;} body, html { font-size: 100%; height: 100%; padding: 0; margin: 0;} {text-decoration: none;} a:hover {color: #000;} #header{height: 90px;width: 100%;background-color: #b9f5bb;} #footer{height: 50px;width: 100%;background-color

coldfusion - QueryNew() Data Types in CF9 -

i have taken on system on production server running cf9.0.1 , cannot find copy of in developer's edition, running cf10. i exporting data database excel. because data comes multiple datasources, results manually entered query used output excel. 1 of first problems solve that, because excel automatically types data, wierd things happening trailing zeros being dropped, numbers turned dates, etc. after lot of research, tried specifying datatypes of data going query "varchar" excel read text. this, replaced original querynew following line of code. dataquery = querynew("row_number,function,nomenclature,hw,crit,load,sw,media,svd,bds,ecp,install,notes", "varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar"); that worked great on cf10. then, got posted production cf9 , didn't solve anything. excel still not receiving data text type , autoformatting it. so, tried following inste