Posts

Showing posts from April, 2013

indexing - Checking position of an entry in an index MongoDB -

i have query using pymongo outputting values based on following: cursor = db.collect.find({"index_field":{"$regex":'\s'}} document in cursor: print document["_id"] now query has been running long time (over 500 million documents) expected. wondering though if there way check query in execution perhaps finding out last printed "_id" in indexed field. last printed _id halfway through btree index? near end? i want know see if should cancel query , reoptimize and/or let finish, have no way of knowing _id exists in query. also, if has way optimize whitespace query, helpful to. based on doc, seems if of used ignorecase of been faster, although doesn't make sense whitespace checking. thanks much, j query optimization your query cannot optimized, because it's inefficient $regex search that's looking space \s in the document. can do, search $regex prefix of \s , e.g. db.collect.find({"index_field&q

Linux-Change line between two awk scripts -

i have 2 awk scripts run in linux. output of each 1 in 1 line. how can separate 2 output 2 lines? for example: awk '{printf $1}' f.txt >> a.txt awk '{printf $3}' f.txt >> a.txt the output of first script is: 35 56 40 28 57 and second output is: 29 48 73 26 if run them 1 after another, output become: 35 56 40 28 57 29 48 73 26 is there way result to: 35 56 40 28 57 29 48 73 26 thank you!~ although don't understand how manage spaces between fields way it, can add end statement first script: awk '{printf $1} end{print "\n"}' you can single awk command: awk -v ors=" " 'begin{argv[argc++] = argv[1]; = 1 } nr!=fnr && fnr==1 { printf "\n"; i=3 } { print $i } end { printf "\n" }' f.txt

javascript - Regex pattern to extract domain name, video url and video id from a string containing youtube/vimeo url with PHP -

Image
i need regex or php preg_match function should extract youtube/vimeo url , video provider/domain name (vimeo/youtube) string containing video url. and extracted video url of string, need find exact video id. the regex should graph video id below url also, youtube https://youtube.googleapis.com/v/jgyzdgpv_hk vimeo https://vimeo.com/channels/staffpicks/167414855 thanks, working on solution. post answer if find it. $sample_text = "cieker largest talentize social , professional networking website, can view on https://www.cieker.com , video on https://www.youtube.com/watch?v=jgyzdgpv_hk"; // function return video url string function extract($html) { $regex = '/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|channels\/(?:\w+\/)|watch\?v=|v\/)?([a-za-z0-9._%-]*)(\&\s+)?/'; preg_match_all($regex, $html, $match); $matched = array_unique($match[0]); usort($matched, function

java - Accessing enum arguments outside of constructor? -

i'm having trouble trying fill static map values arguments of enum. example of i'm trying here: public enum lettersandnumbers { a(1, 2), b(2, 3); private static hashmap<integer, integer> numbers = new hashmap<integer, integer(); private lettersandnumbers(int numberone, int numbertwo) {} // somehow put arguments "numberone" , "numbertwo" map public static integer getnumbertwo(int numberone) { return numbers.get(numberone); } } is there way access these variables in static block, or elsewhere outside of constructor? have been looking around while now, find nothing on it. thanks in advance. you need store numberone , numbertwo in enum fields . can use static initialization block iterate values() , store them in map . like, public enum lettersandnumbers { a(1, 2), b(2, 3); private int numberone; private int numbertwo; private static map<integer, integer> n

php - How to manage access to static content? -

i need best way manage , serve static content such images, videos, etc. i need allow permitted users load particular image or video. let's have dedicated server serve php application http://server1.com , dedicated server serve static content http://server2.com/image.jpg how can allow or deny user accessing image?

What's the difference in F# between a private member and a let val? -

this question has answer here: how choose between private member , let binding? 3 answers question in title. suppose have: namespace namespace module module = type public type() = let z y = 2 * y member private this.z y = 2 * y what difference between z , z? thanks. one thing consider reflection, private member becomes accessible. also, can't call code in z until after constructor has completed

javascript - Shield ui grid hierarchy grid make non-editable while main grid editable -

Image
i made rows of main grid editable , there no need of editing rows in hierarchy grid.but problem once click on row of hierarchy grid becomes editable , value of same column number of main grid appear in selected column of hierarchy grid. below picture attached here make more sense. so mentioned dont need happened in hierarchy grid. here code far.... $("#alltransgrid").shieldgrid({ datasource: { data: datad, schema: { fields: { mbr_id: {path: "mbr_id", type: string}, lon_id: {path: "lon_id", type: string}, center_name: {path: "center_name", type: string}, grp_name: {path: "grp_name", type: string},

java - error in parsing json object in android -

this question has answer here: how parse json 29 answers i see code on internet , follow there steps bulif .php files phpmyadmin database test php files success in connection throw web browser, results of web browser php test show {"results_data":"success"} . public class signupactivity extends asynctask<string, void, string> { private context context; public signupactivity(context context) { this.context = context; } protected void onpreexecute() { } @override protected string doinbackground(string... arg0) { string fullname = arg0[0]; string username = arg0[1]; string password = arg0[2]; string phonenumber = arg0[3]; string emailaddress = arg0[4]; string link; string data; bufferedreader bufferedreader; string result;

javascript - Immutable.js Record.set type checking with TypeScript -

i'm using immutable.js typescript build redux app. essentially, state looks like const defaultstate = { booleanvalue: true, numbervalue: 0, } const staterecord = immutable.record(defaultstate) class stateclass extends staterecord { booleanvalue: boolean numbervalue: number } const state = new stateclass() (this setup enables compile-time type checking expressions state.booleanvalue === 'hi' ) is there way enable compile-time type checking set , such state.set('booleanvalue', 'hi') ? (i want warning compiler saying 'booleanvalue' cannot set 'hi' .) or, there alternative setup make immutable.js , typescript work both when getting , setting? is there alternative setup make immutable.js , typescript work both when getting , setting not without wrapping staterecord in helper functions (basically throwing more code @ needs duplicated , kept in sync). in short nope.

c# - Get folders that contain a certain number of directories -

so right have list of directories wanted through regex pattern , linq filtering. need way folders contain number of directories , skip ones without 1 , how check if directory info empty or not . suggestions ? have far directoryinfo root = new directoryinfo(@"c:\users\jphillips\desktop\test"); var dirs = new list(); dirs = root.getdirectories("*", searchoption.alldirectories).where(d => reg.ismatch(d.name)).where((d => !d.fullname.endswith("tests"))).where(d => d.getfiles().length > 3).tolist(); foreach (directoryinfo dir in dirs) { console.writeline(dir.fullname); } can tell me how filter here, , * mean in directories function heres starting point suppose: var diprojects = new directoryinfo(@"c:\projects"); var subfolders = diprojects.getdirectories(); (var = 0; < subfolders.length; i++) { console.writeline(string.format("[{0}] {1}, directories = {2}, files = {3}" ,

php - SELECT Query, WHERE selects all when "" is empty -

the aim hi, i'm trying shorten code building query dynamically based on $ _get . current have every possible if statement relevant select query. create dynamic system feature updates. current progress //set filter based on url if ($_get[game] != "") { $gamefilter = $_get[game]; } else { $gamefilter = ''; } if ($_get[region] != "") { $regionfilter = $_get[region]; } else { $regionfilter = ''; } if ($_get[console] != "") { $consolefilter = $_get[console]; } else { $consolefilter = ''; } $result = get_matchfinder($gamefilter, $regionfilter, $consolefilter); //the function function get_matchfinder($gamefilter, $regionfilter, $consolefilter) { //set varibles $database = 'matchfinder'; $order = 'desc'; $limit = '20'; //query function $connection = connection(); $sql = 'select * '. $database .' game = "'

angular2 template - Angular 2 property binding -

i have component defined follows: export class wizardtabs { @input() tabs: any; @input() selectedstepid: number=0; selectedindex: number = 0; } and template defined follows: <md-tabs md-border-bottom md-autoselect [selected]="selectedindex"> <template md-tab *ngfor="let tab of tabs" [label]="tab.name" [selectedstepid]="tab.id"> <md-content class="md-padding"> <wizard-tab-content [tabcontent]="tab.stepcomponent"></wizard-tab-content> </md-content> </template> </md-tabs> i want access tab.id inside component. defined "selectedstepid" input property on component , binding tab.id. throwing exception. know can bind properties datasource template how reverse i.e. bind property template component? in other words how access variable defined in template component? i think can focus on getting tab component instead of getting 'selectedstep

Wordpress Custom Post Type Archive Issue -

i have blog custom post type inited like: register_post_type( 'type', array( 'labels' => array( 'name' => __( 'types' ), 'singular_name' => __( 'type' ) ), 'public' => true, 'has_archive' => true, ) ); obviously wrapped in function called init action. problem post type full of posts, on 1k, on archive page (domain.com/type) there nothing showing. tried verify query, query showing null. have reliable solution? ps - why hate wordpress. never works right. tags: wordpress-broken-again, wordpress-sucks, wordpress-i-hate-you full excerpt: function cp_init_types() { register_post_type( 'nursing-home', array( 'labels' => array( 'name' => __( 'nursing homes' ), 'singular_name' => __( 'nursing home' ) ),

php - $_POST not inserting values in the database -

i have form. when user submits, values should insert in database. value of 1 $_post not inserted in database, other $_post's inserting properly. how fix this? html: <input type="text" name="position" value="<?php echo $_post['jobtitle']; ?>" id="position" required/> php snippet: $firstname = $middlename = $lastname = $email = $mobile = $resume = $position = $message = $attachment_id = $locations = ""; if(isset($_post['submit'])){ $firstname = isset($_post['firstname']) ? $_post['firstname'] : ''; $middlename = isset($_post['middlename']) ? $_post['middlename'] : ''; $lastname = isset($_post['lastname']) ? $_post['lastname'] : ''; $email = isset($_post['email']) ? $_post['email'] : ''; $mobile = isset($_post['mobile']) ? $_post['mobile'] : ''; $locat

node.js - Deploying NodeJS/Babel/Grunt app on Heroku -

i'm trying deploy project on heroku. i've been able heroku open app , see 404 on bundle.js . app on github here . app on heroku here . i've tried making sure dependencies there regarding babel, babelify, grunt, etc. must still missing something. i don't errors after git push heroku still 404. i able recreate locally well. when run postinstall script code: $ npm run postinstall > ncps-mms@0.0.0 postinstall ncps-mms > gulp transpile --gulpfile client/gulpfile.babel.js [00:18:43] requiring external module babel-register [00:18:43] working directory changed ncps-mms/client (node:30276) fs: re-evaluating native module sources not supported. if using graceful-fs module, please update more recent version. [00:18:43] using gulpfile ncps-mms/client/gulpfile.babel.js [00:18:44] starting 'transpile'... error: cannot find module './controllers/members-detail-controller' 'ncps-mms/client/src' [00:18:44] finished 'transpil

java - Differences between @Interceptors and @InterceptorBinding + @Logged? -

seems there 2 ways binding interceptor target class/method: @interceptors on target class/method declare interceptor binding type (aka, custom annotation annotated @interceptorbinding itself, example @logged), , using on target class/method i using interceptor in cdi environment. question is, unnecessary declare interceptor binding type if using @interceptors binding interceptor target methods? if answer yes , why intellij idea complaint me error @interceptor must specify @ least 1 interceptor binding when not annotating interceptor binding type on interceptor? if answer no , binding interceptor target class/method @interceptors(arrayofmyinceptor) directly , why declare interceptor binding type , using on interceptor? search web cannt found difference of 2 approaches, hope can solve problem. thank patience. the annotations @interceptor , other costum annotations @logged supposed invoked on interceptor class, e.g. @logged @interceptor @priorit

ruby on rails - Using carrierwave to upload images to google cloud storage, the file name ends up being saved and not the public link to the image in the bucket -

i'm trying implement image upload google cloud storage rails 4.2 app using carrierwave gem. whenever go upload image uploaded bucket fine saved in db original image name e.g. image.png , not google cloud storage public link image e.g. https://storage.googleapis.com/project/bucket/image.png not sure needed done here saving public link bucket , not file name. carrierwave.rb file carrierwave.configure |config| config.fog_credentials = { provider: 'google', google_storage_access_key_id: 'key', google_storage_secret_access_key: 'secret key' } config.fog_directory = 'bucket-name' end uploaders/check_item_value_image_uploader.rb class checkitemvalueimageuploader < carrierwave::uploader::base # include rmagick or minimagick support: # include carrierwave::rmagick # include carrierwave::minimagick # choose kind of storage use uploader: #storage :file storage :fog # override direc

algorithm - finding the common parent of multiple BitSets java -

i couldn't find proper solution simple question in bitset methods. question find common parent of bitsets, starting left bit. here examples: 011 010 001 common parent: 0 00 010 common parent: 0 00 11 10 common parent: none 1101 111 1100 common parent: 11 my solution , bitsets, , find correct length looking first set bit on xor of these bitsets. worked cases failed others. have idea involves looping on bitsets happy avoid if have solution. [i know can presented binary tree, involves memory overhead avoid operating on bitsets , boolean operations (and, or, nor, nand, xor)] you example this: string[] input = {"011","010","001"}; if(input.length==0) return ; int n=input[0].length(); list<bitset> bitsets = new arraylist<>(); for(string in:input){ // n min length of inputs n=math.min(n,in.length()); // if start counting indices left, need reverse inputs string reverse =

java - Too many characters in character literal - trying to check if my value is not within ASCII values '&#092;&#048;' -

/*visit nodes keys*/ if(root.alpha != '&#092;&#048;'){ } as title above says. how better? i'm trying check if character (root.alpha) not within spectrum. thanks. to check character not within range of hexadecimal ascii codes 48 , 92: if (root.alpha < 0x48 || root.alpha > 0x92) { // ... } that is, not within range = less start or greater end.

replace MYSQL string using a PHP code -

Image
i have code , couldn't work: $character_set_array = array(); $character_set_array[] = array('count' => 8, 'characters' => '0123456789'); $temp_array = array(); foreach ($character_set_array $character_set) { ($i = 0; $i < $character_set['count']; $i++) { $temp_array[] = $character_set['characters'][rand(0, strlen($character_set['characters']) - 1)]; } } shuffle($temp_array); $pinstart = 'aa'; $pinend = implode('', $temp_array); $newpin = $pinstart.$pinend; function regenerate_pin($pin) { if ($pin == 'pin') { return ''; } else { $pin = mysql_real_escape_string($pin); // security! $result = mysql_query("select pin pins pin='$pin' limit 1"); if(mysql_num_rows($result) == 0) { return 'this pin has been used'; } else { $sql = mysql_query("update pin

shell - running Xvfb in background on remote linux -

i facing issues xvfb on remote linux. when run command xvfb :99 & i messages on command line initializing built-in extension generic event extension initializing built-in extension shape initializing built-in extension mit-shm initializing built-in extension xinputextension initializing built-in extension xtest initializing built-in extension big-requests initializing built-in extension sync initializing built-in extension xkeyboard initializing built-in extension xc-misc initializing built-in extension security initializing built-in extension xinerama initializing built-in extension xfixes initializing built-in extension render initializing built-in extension randr initializing built-in extension composite initializing built-in extension damage initializing built-in extension mit-screen-saver initializing built-in extension double-buffer initializing built-in extension record initializing built-in extension dpms initializing built-in extension present initializing bui

ios - Unable to update markers on GMaps using Swift and Parse db -

i wrote function grabs data parse db , displays markers on google maps. in viewdidload function have nstimer calls function every second. problem experience array of spotnames , spotgeopoints keeps appending , growing after each function call. also, unable remove marker in real time on map if parkingspotisempty value false. any suggestion how make more efficient? func displayparkingspots() { let query:pfquery = pfquery(classname: "parkinglocations") // query.wherekey("parkingspotisempty", equalto: true) query.findobjectsinbackgroundwithblock { (objects:[pfobject]?, error: nserror?) -> void in if !(error != nil) { object in objects! { if (object["parkingspotisempty"] as! int == 1) { self.spotnames.append(object["spotnames"] as! string) self.spotgeopoints.append(object["longitude"] as! pfgeopoint) self.spotlocat

grails - GSP pass Array from controller and display in gsp by its index -

how can pass array controller gsp, , view index in gsp? lets in controller: string[] str= new string[2]; str[0]="a" str[1]="b" render(view: "test_preview",model:[flag:str]) and in gsp, how can call let index [1] value "b" in gsp without looping possibly? you can try this. you pass full array view. , in view, following: ${flag[1]} or: pass specific value view. in controller: render(view: "test_preview",model:[flag:str[1]) and in view: ${flag}

SQL Server datetime to Oracle -

if have in sql server datetime , in oracle? date , loose fractional parts of second or better timestamp(3) ? if want preserve fractional seconds, you'd use timestamp(3) (or timestamp ). if don't care fractional seconds, you'd use date .

php - Unable to access data in view codeigniter -

i have 3 controller methods name blog , load_messages , load_comments . want pull comments when user clicks on button. post id passed method name load_comments if load view named blog gives error because have passed data view. want pass data is comments controller. the functions are: public function blog() { $user_session_email = $this -> session -> userdata('user_email','name','id'); if(!$user_session_email) { redirect('/'); } $user_data = $this -> users_model -> myaccount([ 'id' => $this -> session -> userdata('id'), 'name' => $this -> session -> userdata('name'), 'email' => $this -> session -> userdata('user_email'), ]); $data["persoanl"] = $user_data; $returned_result = $this -> users_model -> load_messages(); $messages["message"] = $returned_result['message&

Can't executeUpdate() in Grails/Groovy web application -

i trying make crud web service psql. achieved while had domain. don't need domain class , started remake this. can create , delete data database when comes edit error: uri /test/customer/edit/2 class org.codehaus.groovy.runtime.typehandling.groovycastexception message cannot cast object 'null' class 'null' class 'long'. try 'java.lang.long' instead i have controller package test class customercontroller { def customerservice def index = { redirect action: "list" } def create() {} def edit () { [customer: customerservice.updateaction(params.id,params.name,params.thl,params.dt1)] } def list() { [customers : customerservice.listaction()] } def save() { println params [customer: customerservice.insertaction(params.id,params.name,params.thl,params.dt1)] redirect action: "list" } def update(){ [customer: customerservice.upda

python - Pushing app to Heroku failed because of django_comments -

i tried push project heroku , failed because couldn't find django_comments . here log: -----> using set buildpack heroku/python -----> python app detected $ pip install -r requirements.txt $ python manage.py collectstatic --noinput traceback (most recent call last): file "manage.py", line 10, in <module> execute_from_command_line(sys.argv) file "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line utility.execute() file "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 327, in execute django.setup() file "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 18, in setup apps.populate(settings.installed_apps) file "/app/.heroku/python/lib/python2.7/site-packages/django/apps/registry.py&

ubuntu - Processing list of files and correctly naming the output files -

i'm using following command line on ubuntu try , work through list of tshark cap files , produce summary file separated. works fine. problem right @ end sudo ls /capcopy/dump*.cap -l |awk '(nr>0) {print $9}'| xargs -i {} sudo tshark -n -r {} -t fields -e separator=$ -e quote=n -e header=n -e wlan.sa -e radiotap.dbm_antsignal -e frame.time > /capcopy/dollarsep{} the last element intended prepend characters dollarsep onto file name source. in same way in tshark element. i can see doesn't work , creates file name dollarsep{} is there way pass source file name forward can need? thanks change last command in pipeline to xargs -i {} sudo bash -c 'tshark -n -r {} ... > /capcopy/dollarsep{}'

visual studio - C++ function Sleep() executes before piece of code -

i work in visual studio c++, windows form app. try paint button red, wait 3 seconds , paint blue. button1->backcolor = system::drawing::color::darkred; sleep(3000); button1->backcolor = system::drawing::color::cornflowerblue; however, sleep() functions executes before first line (painting red). program starts waiting 3 seconds , after time paints button blue. seems painting red piece of code doesn't have time execute. individually, painting red works fine. i've tried other delay solutions also. example: int wait = clock() + 2 * clocks_per_sec; while (clock() < wait) {} it seems issue in visual studio c++, because sleep() function have worked in code::blocks console script. have ideas of solution? since button window can invalidate before calling sleep() . what invalidate,update methods in vc++

c# - Linq To Entity does not support -

i learning mvc , storing user's date of birth show age. data saved properly. sort data followed this tutorial . works on first name , last name on sorting age throws exception only parameterless constructors , initializers supported in linq entities. code action is public actionresult index(string sortorder, int? page, string currentfilter, string q) { viewbag.currentsort = sortorder; viewbag.fnsortparam = string.isnullorwhitespace(sortorder) ? "fname_desc" : ""; viewbag.lnsortparam = sortorder == "lname" ? "ln_desc" : "lname"; viewbag.agesortparam = sortorder == "age" ? "age_desc" : "age"; var query = q; if (query != null) page = 1; else query = currentfilter; var users = db.myappusers.select(a => a); if (!string.isnullorwhitespace(query)) { var nquery = query.tou

Stream S3 private access Image/video in play framework scala - Issue -

aim: i have s3 video url , s3 image url. s3 bucket have private access(not public). want stream s3 media files in html. what tried: i can access s3 image/video using "access key id" , "secret access key" of "play-s3" plugin. https://github.com/kaliber/play-s3 by using above plugins can read image/video file content. code snippet: controller: def loads3file(filename: string) = action { implicit request => try { val bucket = s3("user") val result = bucket.get(filename) val file = await.result(result, 60 seconds) val bucketfile(name, contenttype, content, acl, headers) = file ok.chunked(enumerator(content)).as(contenttype); } catch { case e: exception => badrequest("error: " + e.getmessage) } } html: <!doctype html> <html> <body> <img width="240"

Cannot add to an imageView a gesture detector in Android -

i trying attach imageview gesture detector following code. want in first place code able color of bitmap , display message nothing. missing here? shall place in touchevent method? public class mainactivity extends activity implements gesturedetector.ongesturelistener, gesturedetector.ondoubletaplistener{ private static final string debug_tag = "gestures"; private gesturedetectorcompat mdetector; // called when activity first created. @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); img = (imageview) findviewbyid(r.id.imageview); mdetector = new gesturedetectorcompat(img.getcontext(),this); mdetector.setondoubletaplistener(this); } @override public boolean ontouchevent(motionevent event){ this.mdetector.ontouchevent(event); // sure call superclass implementation return super.ontouchevent(event); } @override public boolean ondown

javascript - How to call the function inside the own function -

ninjas. i know 2 things. how call functions 'initialize()' , 'fillvalidateview()'. wrote want call these functions inside following code. i'm new javascript programing. know if following code right implement page transitions. html <!doctype html> <html> <head> <meta charset="utf-8" /> </head> <body> <div id="header"> <p></p> </div> <div id="main"> <div id="validate_or_import"> <input type="button" id="go_validate" value="validate data"> <inp ut type="button" id="go_import" value="import data"> </div> </div> </body> </html> javascript $(function () { var view = function () { this.title = '' }; view.prototype = { initialize: function () {

wordpress - How to make href="#" work like a submit button in PHP? -

i have table click contents , show new table below on same wordpress pluggin admin page content details (created php function pop_details() passing href value reference), oracle child forms. unfortunately, code not working (nothing happens when click href link rest of buttons working), purist when comes code :d don't want submit button transparent background (besides nicer way) if can me, surely appreciate it. thank you. table details: ... echo "<td><a href='#' name='order_selected' value='".$mydata->orderid."'>" .$mydata->orderid."</td>"; ... isset: <?php if (isset($_post['order_selected'])) { $myordersel = $_get['order_selected']; pop_details($myordersel); } ?> 1) have use <form> hidden element if wan't retrieve post values using static method... 2) otherwise, can use ajax call using jquery example : $('a').c

animation - jQuery animate/scroll only partially works on second click -

Image
when use jquery animate scrolling behavior first click cause view jump straight clicked anchor element. second click, if issued within animation-delay, work flawlessly. if animation-delay runs out , 1 issues click again, it'll cause straight jump element again. here's short gif demonstrating issue: as can see, click on services , instantly jump. wait until animation delay runs off , click portfolio , again instant jump. click services again (animation delay didn't run off yet) , works expected. my elm-application has onclick events assigned elements. when triggered, href of element gets passed javascript function through port, so: -- partial view view = div [] [ nav [ class "navbar navbar-default navbar-fixed-top" ] [ div [ class "container" ] [ div [ class "navbar-header page-scroll" ] [ button [ class "navbar-toggle", attribute "data-target" "

vba - Put Excel array values in cache -

i have large database (700.000+ lines in 20 columns) import in excel , different manipulations on. an example of such manipulation categorizing. use 2 columns: material type , category , output in column ' final category ' by: if materialtype = "serv" or category = "service" finalcategory = "service" what fastest way perform calculation? currently use loop , disabled application.screenupdating. i wondering, there way put these columns in cache , run it? hope can help, cheers! let's 'materialtype' column , 'category' column b , 'finalcategory' column u. can try this: dim strformula string strformula = "=if(or(a1=""serv"",b1=""service""),""serv"","""")" sheet1.range("u1:u700000").formula = strformula this avoids looping on 700,000 rows , doing indvidual operation, can painfully slow no scree

java - How to implement ListFragment and NavigationDrawerFragment -

Image
i want build android application fragment contains list of option , if click on 1 of option, can see, fragment other option. so build this: activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".activity.mainactivity" tools:ignore="mergerootframe" > <framelayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" /> <linearlayout android:layout_width="480dp" android:layout_height="match_parent" android:layout_gravity="st